partisia-blockchain-applications-rpc
v1.0.13
Published
```bash npm i partisia-blockchain-applications-rpc ```
Downloads
64
Readme
Install
npm i partisia-blockchain-applications-rpc
Query Across All Shards
import { PartisiaAccount } from "partisia-blockchain-applications-rpc"
// Set the Config for each shard
const rpc = PartisiaAccount({
urlBaseGlobal: { url: 'https://reader.partisiablockchain.com', shard_id: 99 },
urlBaseShards: [
{ url: 'https://reader.partisiablockchain.com/shards/Shard0', shard_id: 0 },
{ url: 'https://reader.partisiablockchain.com/shards/Shard1', shard_id: 1 },
{ url: 'https://reader.partisiablockchain.com/shards/Shard2', shard_id: 2 },
]
})
// get account info
const account = await rpc.getAccount('<address>')
// get nonce for adderss
const nonce = await rpc.getNonce('<address>', account.shard_id)
// get contract info
const contract = await rpc.getContract('<contract address>',1)
// get url being used for a specific shard
const url = rpc.getShardUrl(account.shard_id)