In this lesson, you will be using the Working-With-User-Controlled-Wallets project.
Go ahead and open up the project.
.env File
You will need to modify the .env file.
Stays Same
Following fields will remain the same.
API_KEYAPP_IDUSDC_TOKEN_IDModify
You will modify the following fields
USER_ID: You should enter the new user id.WALLET_ID: This will be replaced with the new wallet's id.ADDRESS: This will be replaced with the new wallet's address.Check Wallet Status
As you did in the last section of this course, you are going to get the challenge id. The user will verify the challenge by entering his/her pin.
npm run check_wallet_status. This command will return a response to the console.The response will be something like:
"data": {
"wallets": \[
{
"id": "13cda487-0c8b-5812-8b95-59042d......",
"state": "LIVE",
"walletSetId": "018d846e-216e-794f-923e-f08c92ab80b5",
"custodyType": "ENDUSER",
"userId": "ae097766-5770-4407-805a-7879036c6818",
"address": "0x3328477a6892e3bcf11d6de95370cc8ed03c11e8",
"blockchain": "MATIC-AMOY",
"accountType": "SCA",
"updateDate": "2024-02-07T16:37:06Z",
"createDate": "2024-02-07T16:37:06Z"
}
\]
}
address and id as ADDRESS and WALLET_ID to the .env file.accountType with the value: SCA. This indicates that this account is a type of SCA. That is what we were aiming for.Get Test USDC
npm run check_balance. You should see a similar response on the console, where the second token's (USDC) amount is 10.Initiate Transaction
Last time, you also had to get native token Matic for the gas fee. This time since you are using gas fee, the gas is sponsored and you can directly make the transfer. For that run the command npm run initiate_transaction which should return user token. encryption key and challenge id. Note these values.
Complete the Challenge
User-Controlled-Wallet project, click the wallet icon, where you call websdk.APP ID, User Token, Encryption Key and Challenge ID.Verify Transaction
This is also the same as before.
Swap insights and ask questions about “Learn everything about Circle and USDC”.
Ask a question or share your thoughts about this lesson.