Web Frontend - NEAR API JS
The NEAR API JS provides various methods and functionalities for interacting with smart contracts, retrieving account information, sending transactions, and more.
info
You can refer to the NEAR API JS documentation for detailed information on how to use the available methods and interact with the Calimero network.
Create a new Private Shard API key
- Generate a new token in the Calimero console dashboard. Follow the steps provided here.
- Copy your API key somewhere safe for security reasons. The API key will only be shown to you once. Make sure to store it securely, as it cannot be retrieved or restored.
Initialize the connection with the private shard
Create a new ConnectConfig
with the following parameters and initialize the connection.
nodeUrl: The JSON RPC url. It can be obtained from the Calimero dashboard and it follows the pattern https://api.calimero.network/api/v1/shards/${shardId}/neard-rpc/
token: The token generated in the previous step
shardId: The identificator of the shard is passed as the network ID to the Near Connection
const connectionConfig = {
networkId: shardId,
keyStore: myKeyStore,
nodeUrl: "https://api-testnet.calimero.network/api/v1/shards/xabi/neard-rpc/",
headers: {
"x-api-key" : TOKEN
}
};
const near = await connect({ ...config, keyStore });