βοΈcreateWallet
Description
The createWallet function generates a new mnemonic that can be used to create a new cryptocurrency wallet. The mnemonic is a randomly generated sequence of words that can be used to generate a hierarchical deterministic wallet, allowing for easy backup and recovery of the wallet.
Parameters
This function does not take any parameters.
Response
code
number
Indicates whether the function was successful or not. A value of 1 indicates success, while a value of 0 indicates failure.
result
string
If the code is 1, then this field contains the generated mnemonic. If the code is 0, then this field will be empty.
error
string
If the code is 0, then this field contains the error message. If the code is 1, then this field will be empty.
Example Request and Response
Prerequisites 
Before making requests with Volary SDK, you must have it installed.
You can install Volary SDK using either npm or yarn. Use the following commands to install Volary SDK:
npm install @nest25/wallet-lib
OR
yarn add @nest25/wallet-libNext, install tiny-secp256k1 npm package in order to create a new wallet:
npm install tiny-secp256k1
or 
yarn add tiny-secp256k1Request
Here is an example of how to make a createWallet request using the Volary SDK:
// import Nest SDK
import { Wallet } from 'nest25/wallet-lib';
import * as ecc from 'tiny-secp256k1'; 
// Create a new instance of the Wallet class
const wallet = new Wallet(ecc); // Wallet class has 2 params: one is for ecc and the second one for environment (testnet , mainnet). By default, the value is set to testnet
const main = async () => {
  // Create a new wallet
  const response = await wallet.createWallet();
  // Log the response
  console.log('Response: ', response);
};
main();Response
{
        code: 1,
        result: 'forest almost like horn board swamp wish wedding rough number live                      when'
}Use Cases
- Cryptocurrency Wallets: This function can be used by cryptocurrency wallets to generate a new wallet and associated mnemonic for the user. 
- Blockchain Development: This function can be used by developers building blockchain applications to generate new wallets for testing and development purposes. 
Last updated
