Client library for working with Stacks blockchain RPC interface.
npm install @stacks/rpc-client
import { createClient } from '@stacks/rpc-client';
import { StacksTestnet } from '@stacks/network';
const client = createClient(new StacksTestnet());
const result = await client.GET('/v2/accounts/{principal}', {
params: {
path: { principal: 'ST2QKZ4FKHAH1NQKYKYAYZPY440FEPK7GZ1R5HBP2' },
query: { tip: 'latest', proof: 0 },
},
});
console.log(result.data); // { "balance": "0x000000000000000000228fb60297b639", ... }