Skip to main content

Web Frontend - NEAR API JS

Prerequisites

Access to the Calimero console running a private shard.

Configure NEAR API JS

Create a new Private Shard API key

https://near.github.io/near-api-js/interfaces/connect.connectconfig.html

Generate a new token in the calimero security dashboard Copy your API key somewhere safe. For security reasons, you will only be shown your API key one time. Please store it somewhere safe as we will not be able to retrieve or restore it.

Initialize the connection with the private shard

Create a new ConnectConfig with the following parameters and initialize the 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 });