Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@rpcnode/sdk

Official Node.js / TypeScript client for the RpcNode Public API: dedicated fullnode RPC (Ethereum, Solana, Bitcoin, Tron, BNB Chain, Polygon, Arbitrum, Optimism, Base, and more), HMAC-signed merchant HTTP, address watch webhooks, and crypto payments.

API: https://api.rpcnode.dev

Repo: github.com/rpcnode/api-sdk-typescript

Install

npm install github:rpcnode/api-sdk-typescript
# or:
git clone git@github.com:rpcnode/api-sdk-typescript.git
cd api-sdk-typescript && npm install && npm run build

Auth

Every request is HMAC-signed. Query string is not part of the signature.

Header Value
X-Api-Key Key prefix (pk_live_…)
X-Timestamp Unix seconds (±300s)
X-Signature hex(hmac_sha256(secret, canonical))
{timestamp}\n{METHOD}\n{path}\n{sha256_hex(body)}

Empty body → SHA-256 of "". Headers are added by the client.

Quickstart

import { RpcNodeClient } from '@rpcnode/sdk'

const client = new RpcNodeClient({
  baseUrl: process.env.PUBLIC_API_BASE ?? 'https://api.rpcnode.dev',
  apiKey: process.env.PUBLIC_API_KEY!,    // pk_live_…
  secret: process.env.PUBLIC_API_SECRET!, // sk_live_…
})

const account = await client.getAccount()
const tokens = await client.listNetworkTokens({
  network_slug: 'tron-nile',
  include_native: true,
})

Methods

Client HTTP
getAccount() GET /v1/account
getAccountUsage(days?) GET /v1/account/usage
listEndpoints() GET /v1/endpoints
listAvailableNetworks() GET /v1/endpoints/available-networks
getWorkspaceUsage(days?) GET /v1/endpoints/usage
createEndpoint(body) POST /v1/endpoints
getEndpointUsage(id, days?) GET /v1/endpoints/{id}/usage
updateEndpointStatus(id, status) PATCH /v1/endpoints/{id}/status
updateEndpointAllowedIps(id, ips) PATCH /v1/endpoints/{id}/allowed-ips
getAddressWatchAccount() GET /v1/address-watch/account
listAddresses(params?) GET /v1/address-watch/addresses
addAddress(body) POST /v1/address-watch/addresses
deleteAddress(watchId) DELETE /v1/address-watch/addresses
listEvents(params?) GET /v1/address-watch/events
getWebhook() GET /v1/address-watch/webhook
setWebhook(body) PUT /v1/address-watch/webhook
listPayments(params?) GET /v1/payments
createPayment(body) POST /v1/payments
getPayment(paymentId) GET /v1/payments/{id}
getPaymentByOrderId(orderId) GET /v1/payments/orders/{orderId}
listNetworkTokens({ network_slug, include_native? }) GET /v1/network-tokens

Tests

cp .env.example .env   # PUBLIC_API_KEY + PUBLIC_API_SECRET for live smokes
npm test

HMAC unit tests run without credentials. Live reads use .env or the environment. Writes: PUBLIC_API_SMOKE_MUTATE=1, PUBLIC_API_SMOKE_CREATE_PAYMENT=1.

License

MIT

About

RpcNode Public API SDK for TypeScript / Node.js

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages