This guide walks you through the main functions of Custodial Wallets in the development environment. In this environment, some configurations that require manual setup in the production environment are already enabled by default, making the process simpler with fewer required steps. If you are ready to use Custodial Wallets in the production environment, refer to the Production usage guide.
Cobo Portal offers two types of Custodial Wallets: Asset Wallets and Web3 Wallets. This guide focuses on setting up and using Asset Wallets.
This guide will walk you through the step-by-step process to set up and use Custodial Wallets (Asset Wallets) in the development environment of Cobo Portal, including:
An iOS device to run Cobo Guard, our app for multi-factor authentication (MFA), operation approval, transaction signing, and private key share management.
Log in to the development environment of Cobo Portal, and click Set Up Cobo Guard in the pop-up at the lower left corner. Follow the on-screen instructions to install Cobo Guard on your iOS device and link your account to it.If the pop-up is closed, click Guide in the left-hand menu to reopen it.Purpose of setting up Cobo Guard:
Use it as the MFA method for Cobo Portal.
Use it to approve various requests in Cobo Portal.
You can invite team members to your organization and assign permissions. For the actions associated with each permission, refer to Roles and permissions.
Set transaction policies (risk control rules) for token transfers, including token type, amount, blocklist/allowlist, and approval thresholds (m/n approvals). Refer to Set up token transfer policy for details.
For your testing convenience, the development environment already includes pre-generated addresses for SETH, ETH, BTC, Tron, BNB, SOL, and TON.
To add more chains, refer to Add chains.
For your testing convenience, SETH test tokens are automatically allocated to you in the development environment.
If you need to deposit other tokens (such as USDC or USDT), confirm the chain used (Tron / BEP-20 / ERC-20, etc.) and refer to Transfer (deposit / withdraw) for more details.To pay on-chain gas fees, ensure your wallet has enough gas tokens for the corresponding chain.
This section shows how to use the WaaS 2.0 API with Custodial Wallets (Asset Wallets) to deposit and withdraw tokens.
Generate an API Key and API Secret
Generate an Ed25519 key pair locally to serve as your API Key (public key) and API Secret (private key).
For more details, refer to Generate API Key and API Secret.
Register the API Key
After generating the API Key, register it in Cobo Portal and assign the user role and wallet scope.
Refer to Register API Key.
Integrate the WaaS SDK
After configuring your API Key, integrate the WaaS SDK.
To begin with, you can call a read-only API (such as list supported chains) to test if your SDK setup is working.
For details, refer to:
Set up callbacks and webhooks (optional)
For strengthened security, set a callback endpoint to confirm withdrawal requests.
Refer to Webhooks and callbacks guide.
Initiate a withdrawal transaction
If you have configured transaction policies, a Main Group, or callback endpoints for your wallet, these settings will affect the withdrawal process. For example, you may need additional approval before the transaction can be completed.To pay on-chain transaction fees, make sure your wallet has sufficient gas tokens. If both the sender and recipient are Asset Wallets, the transfer can be automatically completed through the Cobo Loop network without consuming any on-chain gas.The following is an example code using the JavaScript WaaS SDK. For more details, see the Transfer token API documentation.
Copy
Ask AI
const CoboWaas2 = require("@cobo/cobo-waas2");// Initialize API clientconst apiClient = CoboWaas2.ApiClient.instance;// Set environment (development: Env.DEV, production: Env.PROD)apiClient.setEnv(CoboWaas2.Env.DEV);// Configure API Secret. Replace <YOUR_PRIVATE_KEY> with your API Secret.apiClient.setPrivateKey("<YOUR_PRIVATE_KEY>");// Create TransactionsApi instanceconst apiInstance = new CoboWaas2.TransactionsApi();// Construct withdrawal parametersconst opts = {TransferParams: CoboWaas2.TransferParams.constructFromObject({ request_id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", // Request ID, must be unique source: { source_type: "Asset", // Wallet type: Asset Wallets wallet_id: "f47ac10b-58cc-4372-a567-0e02b2c3d479", // Wallet ID }, token_id: "ETH_USDT", // Token ID destination: { destination_type: "Address", // Destination type account_output: { address: "19AR6YWEGbSoY8UT9Ksy9WrmrZPD5sL4Ku", // Destination address amount: "1.5", // Amount }, },}),};// Submit withdrawal requestapiInstance.createTransferTransaction(opts).then((data) => { console.log("API called successfully. Returned data: " + data);},(error) => { console.error(error);},);
Example response:
Copy
Ask AI
API called successfully. Returned data: {"request_id": "f47ac10b-58cc-4372-a567-0e02b2c3d471","transaction_id": "c8964e6b-32d7-4da3-8407-6c4a4a8c92d7","status": "Submitted"}
Now you have completed the quick start for Custodial Wallets (Asset Wallets) in the development environment, including key tasks such as account setup, deposits, and withdrawals. To officially deploy and use Custodial Wallets (Asset Wallets) in the production environment, refer to the Production usage guide.