Keypair
createKeypair​
- Creates an instance of WalletKeypar
using password.
This method is used to restore a wallet keypair. The Keypair contains some essential information, such as:
- Â address
- Â public key
- Â key store
and so on, and it is used for pretty much any personalized operation that user can do using FindoraSdk
Parameters:​
- Â
<string>
- Password to be used to generate an encrypted KeyStore
Results:​
- Â
Promise<WalletKeypar>
- An instance ofWalletKeypar
Example:​
const password = "qsjEI%123";
// Create a wallet info object using given password
const walletPair = await Keypair.createKeypair(password);
getAddressByPublicKey​
- Get wallet address by given public key
Using this function user can retreive the wallet address by given public key
Parameters:​
- Â
<string>
- Public key
Results:​
- Â
Promise<string>
- A wallet address.
Example:​
const pubkey = "qsjEI%123";
// Get wallet address by public key
const walletAddress = await Keypair.getAddressByPublicKey(pubkey);
getAddressPublicAndKey​
- Create an instance of LightWalletKeypair
using given wallet address.
This method is used to create a light version of the WalletKeypar using given wallet address.The LightWalletKeypair contains two essential information:
- Â address
- Â public key
It's a light version of the WalletKeypar, containing only address and publickey
Parameters:​
- Â
<string>
- Wallet address
Results:​
- Â
Promise<LightWalletKeypair>
- An instance ofLightWalletKeypair
.
Example:​
const address = "fra234xfde4";
// Create a LightWalletKeypair object using given address
const lightWalletKeypair = await Keypair.getAddressPublicAndKey(address);
getMnemonic​
- Creates an array of Mnemonic phrases.
This method is used to creates an array of Mnemonic phrases.
Parameters:​
- Â
<number>
- Desired length of mnemonic phrases. It can only be 12/15/18/21/24. - Â
<string>
- (optional) Default isen
.
Results:​
- Â
Promise<LightWalletKeypair>
- An instance ofLightWalletKeypair
.
Example:​
const desiredLength = 24;
// Create a wallet info object using given password
const mnemonic = await Keypair.getMnemonic(desiredLength);
restoreFromMnemonic​
- Creates an instance of WalletKeypar
using Mnemonic and password.
This method is used to restore a wallet keypair. The Keypair contains some essential information, such as:
- Â address
- Â public key
- Â key store
and so on, and it is used for pretty much any personalized operation that user can do using FindoraSdk
Parameters:​
- Â
<string[]>
- mnemonic words - Â
<string>
- Password to be used to generate an encrypted KeyStore
Results:​
- Â
Promise<WalletKeypar>
- An instance ofWalletKeypar
.
Example:​
const password = "qsjEI%123";
const mnemonic = ["Apple", "Orange", "Banana"];
// Create a wallet info object using given Mnemonic and password
const walletPair = await Keypair.restoreFromMnemonic(mnemonic, password);
restoreFromPrivateKey​
- Creates an instance of WalletKeypar
using given private key and password.
This method is used to restore a wallet keypair. The Keypair contains some essential information, such as:
- Â address
- Â public key
- Â key store
and so on, and it is used for pretty much any personalized operation that user can do using FindoraSdk
Parameters:​
- Â
<string>
- Private key - Â
<string>
- Password to be used to generate an encrypted KeyStore
Results:​
- Â
Promise<WalletKeypar>
- An instance ofWalletKeypar
.
Example:​
const password = "qsjEI%123";
const pkey = "XXXXXXXXXX";
// Create a wallet info object using given private key and password
const walletInfo = await Keypair.restoreFromPrivateKey(pkey, password);