[@kadena/client] - docs Add example for local calls
Closed this issue · 1 comments
ash-vd commented
Add an example to the docs/tutorials on how to run a local Pact command.
const ENDPOINT = isTestnet ? "testnet." : "";
const CHAIN_ID = 0;
const NETWORK_ID = isTestnet ? 'testnet04' : 'mainnet01';
const API_HOST = `https://api.${ENDPOINT}chainweb.com/chainweb/0.0/${NETWORK_ID}/chain/${CHAIN_ID}/pact`;
const command = new PactCommand();
command.code = `(coin.get-balance "k:${publicKey}")`;
const { result } = await command.local(API_HOST);
if (result.status !== "success") return 0;
return result.data