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 of WalletKeypar

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:

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 of LightWalletKeypair.

Example:

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 is en.

Results:

  • Promise<LightWalletKeypair> - An instance of LightWalletKeypair.

Example:

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 of WalletKeypar.

Example:

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 of WalletKeypar.

Example:

Last updated

Was this helpful?