0

I'm initiating API/RPC connection to NEAR Protocol using JsonRpcProvider like that:

const provider = new nearAPI.providers.JsonRpcProvider(
  `https://rpc.${networkId}.near.org`
)

I'm getting this warning

JsonRpcProvider(url?: string) deprecated use `JsonRpcProvider(connectionInfo: ConnectionInfo)` instead index.js:18:18

I can't find any example of how to use it in JS. The only ConnectionInfo object I could found is https://near.github.io/near-api-js/interfaces/utils_web.connectioninfo.html

MSaudi
  • 4,442
  • 2
  • 40
  • 65

1 Answers1

0

The way you can use it is like that:

let connInfo = { url: "https://rpc.${networkId}.near.org" }
// sets up a NEAR API/RPC provider to interact with the blockchain
const provider = new nearAPI.providers.JsonRpcProvider(connInfo)
MSaudi
  • 4,442
  • 2
  • 40
  • 65