https://github.com/hirosystems/stacks-rpc-client
https://github.com/hirosystems/stacks-rpc-client
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hirosystems/stacks-rpc-client
- Owner: hirosystems
- Created: 2024-09-26T14:40:50.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-18T09:08:58.000Z (over 1 year ago)
- Last Synced: 2025-02-22T19:50:01.431Z (over 1 year ago)
- Language: TypeScript
- Size: 361 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @stacks/rpc-client
Client library for working with [Stacks blockchain RPC interface](https://github.com/stacks-network/stacks-core/blob/master/docs/rpc/openapi.yaml).
## Installation
```
npm install @stacks/rpc-client
```
## Usage
```typescript
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", ... }
```