Wallet Module
Wallet module handles operations related to wallet creation and balance retrieval.
To learn more about how to use the AI Agent SDK to interact with the wallet module, please visit AI Agent SDK Wallet Management.
1.1 Create Wallet
Creates a new wallet
Function Name
create_walletExample Code
from crypto_com_developer_platform_client import Wallet wallet = Wallet.create_wallet() print(wallet)
Returns
The address of the new wallet.Errors
ValueError: If the Wallet class is not initialized with a Client instance.Example Return
{'status': 'Success', 'data': {'address': 'example-address', 'privateKey': 'example-private-key', 'mnemonic': 'example-mnemonic'}}
Function Name
createExample Code
import { Wallet } from '@crypto.com/developer-platform-client'; try { const wallet = await Wallet.create(); console.log(wallet); } catch(err) { console.log(err); }
Returns
{Promise<ApiResponse<CreateWalletData>>}: A promise that resolves to the newly created wallet details.Errors
{Error}: Throws an error if the request fails.Example Return
{ status: 'Success', data: { address: 'example-address', privateKey:'example-private-key', mnemonic: 'example-mnemonic' } }
1.2 Get Wallet Balance
Retrieves the balance of the wallet for a specific address.
Function Name
get_balanceArguments
wallet_address (str): The address to get the balance for (CronosIds with the `.cro` suffix are supported, e.g. `xyz.cro`)Example Code
from crypto_com_developer_platform_client import Wallet balance = Wallet.get_balance('example-wallet') print(balance)
Returns
The balance of the wallet.Errors
ValueError: If the Wallet class is not initialized with a Client instance.Example Return
{'status': 'Success', 'data': {'balance': 'example-balance'}}
Function Name
balanceArguments
{string} walletAddress: The wallet address to fetch the balance for (CronosIds with the `.cro` suffix are supported, e.g. `XXX.cro`)Example Code
import { Wallet } from '@crypto.com/developer-platform-client'; try { const balance = await Wallet.balance('example-wallet'); console.log(balance); } catch(err) { console.log(err); }
Returns
{Promise<ApiResponse<Balance>>}: A promise that resolves to the balance of the wallet.Errors
{Error}: Throws an error if the request fails.Example Return
{ status: 'Success', data: { balance: 'example-balance' } }
Last updated
Was this helpful?