F-Kit - Documentation
SolanaWallet
USolanaWallet Class Reference
#include <
SolanaWallet.h
>
Public Member Functions
void
SetSaveSlotName (FString NewSaveSlotName)
const FString &
GetSaveSlotName () const
bool
DoesWalletExist () const
bool
GenerateMnemonic (FString &MnemonicString)
bool
RestoreMnemonic (FString InMnemonic)
FString
GetMnemonicString () const
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FOnMnemonicUpdated, FString, Mnemonic)
bool
SetPassword (FString NewPassword)
bool
SaveWallet ()
bool
UnlockWallet (FString Password)
void
LockWallet (bool bSaveWallet)
void
WipeWallet ()
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam (FOnWalletWiped, USolanaWallet *,
Wallet)
bool
IsWalletLocked () const
bool
SetDerivationPath (const FDerivationPath &DerivationPath)
bool
GetAccountsFromPath (FDerivationPath Path, int32 NumAccounts, TArray< FAccount > &OutAccounts) const
UWalletAccount *
GetAccountFromGenIndex (int32 GenIndex) const
UWalletAccount *
GenerateAccountFromGenIndex (int32 GenIndex)
uint32
GetNextAccountIndexToGenerate () const
UWalletAccount *
GenerateNewAccount ()
UWalletAccount *
ImportAccountFromPrivateKey (FString PrivateKey)
UWalletAccount *
ImportAccountFromPublicKey (FString PublicKey)
void
RemoveAccount (UWalletAccount *Account)
TArray< UWalletAccount * >
GetAccounts () const
Static Public Member Functions
static bool
IsMnemonicValid (FString Mnemonic)
static TArray< FDerivationPath >
GetDerivationPaths ()
static void
ClipboardCopy (FString String)
Public Attributes
FOnMnemonicUpdatedFOnMnemonicUpdated
OnMnemonicUpdatedOnMnemonicUpdated
FOnWalletWiped
OnWalletWiped
Detailed Description
USolanaWallet
This class abstracts a wallet for the Solana network and it is made up of:
a mnemonic phrase to generate new accounts
a derivation path to generate new accounts
a save slot name to save the wallet on disk
a password to encrypt the wallet on disk
a list of accounts either generated from the mnemonic phrase or imported from a public or private key
Member Function Documentation
ClipboardCopy()
static void USolanaWallet::ClipboardCopy(FString String)static
Copy the string parameter to the system clipboard.
Parameters:
String: The string to copy.
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam() [1/2]
USolanaWallet::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMnemonicUpdated ,FString ,Mnemonic )
Called when mnemonic is set, loaded or erased.
Parameters:
Mnemonic: The Updated Mnemonic
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam() [2/2]
USolanaWallet::DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnWalletWiped ,USolanaWallet * ,Wallet )
Called when the wallet get wiped
Parameters:
Wallet: The wiped wallet
DoesWalletExist()
bool USolanaWallet::DoesWalletExist()const
Check if there is an existing file for this wallet.
Returns:
Whether the wallet file already exists or not.
GenerateAccountFromGenIndex()
UWalletAccount * USolanaWallet::GenerateAccountFromGenIndex(int32 GenIndex)
Generate an account with the given generation index
Parameters:
GenIndex: The generation index
Returns:
The generated UWalletAccount.
GenerateMnemonic()
bool USolanaWallet::GenerateMnemonic(FString & MnemonicString)
Generate a mnemonic if no mnemonic exists in this wallet
Parameters:
MnemonicString: the mnemonic string currently in use.
Returns:
Whether the mnemonic has been generated or not.
GenerateNewAccount()
UWalletAccount * USolanaWallet::GenerateNewAccount()
Generate a new account increasing the generation index
Returns:
The generated account
GetAccountFromGenIndex()
UWalletAccount * USolanaWallet::GetAccountFromGenIndex(int32 GenIndex)const
Get the account corresponding to the given generation index if it has been already generated
Parameters:
GenIndex: The generation index
Returns:
The corresponding UWalletAccount
GetAccounts()
TArray< UWalletAccount * > USolanaWallet::GetAccounts()const
Get all accounts in this wallet
Returns:
The list of account for this wallet
GetAccountsFromPath()
bool USolanaWallet::GetAccountsFromPath(FDerivationPath Path,int32 NumAccounts,TArray< FAccount > & OutAccounts)const
Get accounts for a specific derivation path
Parameters:
Path: The DerivationPath
NumAccounts: The number of accounts to retrieve
OutAccounts: The list of accounts
Returns:
Whether the accounts were found for the given derivation path
GetDerivationPaths()
static TArray< FDerivationPath > USolanaWallet::GetDerivationPaths()static
Get all available derivation paths
Returns:
The list of available derivation paths
GetMnemonicString()
FString USolanaWallet::GetMnemonicString()const
Get the Mnemonic string of this wallet
Returns:
The mnemonic of this wallet
GetNextAccountIndexToGenerate()
uint32 USolanaWallet::GetNextAccountIndexToGenerate()const
Get the index of the next account to generate
Returns:
The index of the next account to generate
GetSaveSlotName()
const FString & USolanaWallet::GetSaveSlotName()constinline
Get the name of the file used to load or save this wallet
Returns:
Name of the slot name file currently in use
ImportAccountFromPrivateKey()
UWalletAccount * USolanaWallet::ImportAccountFromPrivateKey(FString PrivateKey)
Create an account from a private key
Parameters:
PrivateKey: The private key
Returns:
The created account
ImportAccountFromPublicKey()
UWalletAccount * USolanaWallet::ImportAccountFromPublicKey(FString PublicKey)
Create an account from a public key
Parameters:
PublicKey: The public key
Returns:
The created account.
IsMnemonicValid()
static bool USolanaWallet::IsMnemonicValid(FString Mnemonic)static
Check if a Mnemonic string is valid.
Parameters:
Mnemonic: The Mnemonic to check
Returns:
Whether the mnemonic is valid or not
IsWalletLocked()
bool USolanaWallet::IsWalletLocked()const
Whether the wallet is locked or not
Returns:
Whether the wallet is locked or not
LockWallet()
void USolanaWallet::LockWallet(bool bSaveWallet)
Lock the wallet, deleting mnemonic and private keys from memory
Returns
Whether the lock was successful or not
RemoveAccount()
void USolanaWallet::RemoveAccount(UWalletAccount * Account)
Remove an account from this wallet
Parameters
Account: The account to remove
RestoreMnemonic()
bool USolanaWallet::RestoreMnemonic(FString InMnemonic)
Restore a mnemonic if no mnemonic exists in this wallet
Parameters:
InMnemonic: The new Mnemonic
Returns:
Whether the mnemonic has been restored or not
SaveWallet()
bool USolanaWallet::SaveWallet()
Save this wallet to disk to reload it later
Returns:
Whether the save was successful or not
SetDerivationPath()
bool USolanaWallet::SetDerivationPath(const FDerivationPath & DerivationPath)
Set the derivation path for this wallet to derive new wallet address
Parameters:
DerivationPathThe new DerivationPath
Returns:
Whether the new DerivationPath has been set or not
SetPassword()
bool USolanaWallet::SetPassword(FString NewPassword)
Set or change the password
Parameters
NewPassword: The new password
Returns:
Whether the new password has been set or not
SetSaveSlotName()
void USolanaWallet::SetSaveSlotName(FString NewSaveSlotName)
Set the name of the file used to load or save this wallet
Parameters
NewSaveSlotName: Name of the slot name file to use.
UnlockWallet()
bool USolanaWallet::UnlockWallet(FString Password)
Load and unlock this wallet from disk if password is correct
Returns:
Whether the unlock was successful or not
WipeWallet()
void USolanaWallet::WipeWallet()
Wipe the wallet from both memory and disk
Returns:
Whether the wipe was successful or not
SolanaWalletManager
USolanaWalletManager Class Reference
Public Member Functions
virtual void
Initialize (FSubsystemCollectionBase &Collection) override
TArray< FString >
GetSaveSlotList () const
USolanaWallet *
CreateNewWallet ()
USolanaWallet *
GetOrCreateWallet (const FString &SlotName)
void
RegisterWallet (USolanaWallet *Wallet)
Member Function Documentation
CreateNewWallet()
USolanaWallet * USolanaWalletManager::CreateNewWallet()
Create a new wallet
Returns:
The created USolanaWallet
GetOrCreateWallet()
USolanaWallet * USolanaWalletManager::GetOrCreateWallet(const FString & SlotName)
Get a wallet from a slot name, create a new one if not exists
Parameters:
SlotName: The slot name
Returns
The created or retrieved account
GetSaveSlotList()
TArray< FString > USolanaWalletManager::GetSaveSlotList()const
Get the list of available save slots
Returns:
The array of available slots
RegisterWallet()
void USolanaWalletManager::RegisterWallet(USolanaWallet * Wallet)
Register a newly created wallet into the list of wallets
Parameters:
Wallet: The private key
Last updated