RPC API (Provider)

Initializing

Instantiating the RPC API. This is going to expose the NEAR Json RPC Provider service.

// web3Api.ts

import naxios from '@wpdas/naxios'

const naxiosInstance = new naxios({
  contractId: "hello.near-examples.near",
  network: 'mainnet', // or testnet, localnet
})

/**
 * NEAR RPC API
 */
export const rpcApi = naxiosInstance.rpcApi()

API Reference

All details about it and how to query data using it can be found on the original RPC API Docs website.

Here is a simple example of using this feature to view account details:

Last updated