Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 687 Bytes

README.md

File metadata and controls

26 lines (19 loc) · 687 Bytes

@stacks/rpc-client

Client library for working with Stacks blockchain RPC interface.

Installation

npm install @stacks/rpc-client

Usage

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", ... }