Runtime APIs
Metadata >= v15
>= v15// Get account nonce
const nonce = await client.call.accountNonceApi.accountNonce(<address>);
// Query transaction payment info
const tx = client.tx.balances.transferKeepAlive(<address>, 2_000_000_000_000n);
const queryInfo = await client.call.transactionPaymentApi.queryInfo(tx.toU8a(), tx.length);
// Get runtime version
const runtimeVersion = await client.call.core.version();Metadata v14
v14import { RuntimeApis } from 'dedot/runtime-specs';
const client = await DedotClient.new({
provider: new WsProvider('wss://rpc.mynetwork.com'),
runtimeApis: RuntimeApis
});
// Or bring in only the Runtime Api definition that you want to interact with
import { AccountNonceApi } from 'dedot/runtime-specs';
const client = await DedotClient.new({
provider: new WsProvider('wss://rpc.mynetwork.com'),
runtimeApis: { AccountNonceApi }
});
// Get account nonce
const nonce = await client.call.accountNonceApi.accountNonce(<address>);Last updated