Create New Wallet
This method allows you to create a new MPC wallet for a particular account.
Method Signature
async create(expireDate?: string, options?: { rampable?: RampableAccount }): Promise<CreateWalletResponse>
Parameters
expireDate
(optional):string
- The expiration date for the JWT token generated from the response.options
(optional):object
- Additional options for the create wallet request.rampable
(optional):RampableAccount
- Rampable account configuration.
Returns
Promise<CreateWalletResponse>
- An object containing the following properties:
walletToken
:string
- JWT token used to access the Wallet Operation endpoint.refreshToken
:string
- Refresh token used to generate a new wallet token.secret0
:string
- The encrypted secret that users need to save to recover their wallet if they lose access to the account.secret0Link
:string
- Temporary link to download the recovery file. The value is the same as the secret0 value, but it is already saved in a .xellar file. The link will expire 5 minutes after being created.address
:string
- User's MPC wallet address.rampableAccessToken
:string
- JWT token used to access the Rampable Operation endpoint (if applicable).
Example Usage
const response = await sdk.account.wallet.create();
console.log(response);
Example with Options
const expireDate = "2024-10-02";
const options = {
rampable: {
username: "johndoe",
fullName: "John Doe",
password: "JohnDoe123",
},
};
const response = await sdk.account.wallet.create(expireDate, options);
console.log(response);
Response Example
{
"walletToken": "your_wallet_token_here",
"refreshToken": "your_refresh_token_here",
"secret0": "your_secret_here",
"secret0Link": "temporary_link_to_download_secret0_file",
"address": "your_address",
"rampableAccessToken": "your_rampable_access_token_here"
}
⚠️
Remember to save the secret0 value from the response data to a file with the .xellar extension. This file will be useful if the user wants to recover their wallet to a new account.
For more information, see the Xellar Create New Wallet API Documentation (opens in a new tab).