Prerequisites
Before you begin:- Create a Circle Developer Account and API key
- Install the Developer Services Server-side SDKs
- Complete the Create Your First Developer-Controlled Wallet tutorial to register an entity secret and create a wallet set
Step 1. Create NEAR wallets
When creating a developer-controlled wallet, passNEAR-TESTNET or NEAR in the blockchains field. This wallet can be
used to sign transactions on NEAR.
The following example code shows how to create a wallet using the Circle
Developer SDK.
You must send NEAR tokens to activate the wallet. Without NEAR tokens in the
wallet, you will receive an error stating that the account does not exist when
broadcasting a transaction.
Use
count to specify the number of wallets to create, up to a maximum of 200
per API request.Step 2. Build and sign a raw transaction
To build a raw transaction for signing in JavaScript:- Prepare the transaction object - To build a NEAR transaction, you must define several parameters, including the sender, receiver, amount, actions, nonce, and any additional metadata required.
- Serialize the transaction object with Borsh and encode it with Base64 - NEAR uses Borsh serialization for transaction objects, so you need to serialize the constructed transaction and then encode it to Base64 before signing.