@quicknode/sdk 3.6.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +236 -1
- package/errors.js +52 -1
- package/index.d.ts +287 -1
- package/index.darwin-arm64.node +0 -0
- package/index.js +54 -52
- package/index.linux-arm64-gnu.node +0 -0
- package/index.linux-arm64-musl.node +0 -0
- package/index.linux-x64-gnu.node +0 -0
- package/index.linux-x64-musl.node +0 -0
- package/package.json +6 -6
- package/sdk.d.ts +164 -0
- package/sdk.js +17 -0
- package/sdk.mjs +7 -0
package/README.md
CHANGED
|
@@ -11,8 +11,12 @@ This is one of four language bindings published from the same Rust core. See the
|
|
|
11
11
|
- [Installation](#installation)
|
|
12
12
|
- [Quick Start](#quick-start)
|
|
13
13
|
- [Configuration](#configuration)
|
|
14
|
+
- [Option A — Pass config directly](#option-a--pass-config-directly)
|
|
15
|
+
- [Option B — Load from environment (`from_env()`)](#option-b--load-from-environment-from_env)
|
|
16
|
+
- [Custom headers and `User-Agent`](#custom-headers-and-user-agent)
|
|
14
17
|
- [Platform Support](#platform-support)
|
|
15
18
|
- [API Reference](#api-reference)
|
|
19
|
+
- [Language conventions](#language-conventions)
|
|
16
20
|
- [Admin Client](#admin-client)
|
|
17
21
|
- [Endpoints](#endpoints)
|
|
18
22
|
- [Endpoint Tags](#endpoint-tags)
|
|
@@ -48,6 +52,12 @@ This is one of four language bindings published from the same Rust core. See the
|
|
|
48
52
|
- [Sets](#sets)
|
|
49
53
|
- [Lists](#lists)
|
|
50
54
|
- [SQL Client](#sql-client)
|
|
55
|
+
- [RPC & Tooling Access](#rpc--tooling-access)
|
|
56
|
+
- [Crypto-micropayment lane (`rpc.call`)](#crypto-micropayment-lane-rpccall)
|
|
57
|
+
- [Wallet generation](#wallet-generation)
|
|
58
|
+
- [x402 credit drawdown (authenticate once, then draw one credit per call)](#x402-credit-drawdown-authenticate-once-then-draw-one-credit-per-call)
|
|
59
|
+
- [Testnet faucet](#testnet-faucet)
|
|
60
|
+
- [MPP payment channel (deposit once, then vouchers)](#mpp-payment-channel-deposit-once-then-vouchers)
|
|
51
61
|
- [Error Handling](#error-handling)
|
|
52
62
|
- [License](#license)
|
|
53
63
|
|
|
@@ -78,6 +88,10 @@ There are two ways to configure the SDK.
|
|
|
78
88
|
// Node.js
|
|
79
89
|
import { QuicknodeSdk } from "quicknode-sdk";
|
|
80
90
|
const qn = new QuicknodeSdk({ apiKey: "your-key", http: { timeoutSecs: 30 } });
|
|
91
|
+
|
|
92
|
+
// apiKey is optional: the crypto-micropayment lane pays per request instead, so
|
|
93
|
+
// omitting it builds a usable SDK. Every other client still needs one, and
|
|
94
|
+
// fromEnv() always requires QN_SDK__API_KEY.
|
|
81
95
|
```
|
|
82
96
|
|
|
83
97
|
### Option B — Load from environment (`from_env()`)
|
|
@@ -1674,6 +1688,222 @@ const schema = await qn.sql.getSchema("hyperliquid-core-mainnet");
|
|
|
1674
1688
|
console.log(schema.tables.length);
|
|
1675
1689
|
```
|
|
1676
1690
|
|
|
1691
|
+
---
|
|
1692
|
+
|
|
1693
|
+
### RPC & Tooling Access
|
|
1694
|
+
|
|
1695
|
+
Tooling Access provisions a single multichain, read-only endpoint per account and
|
|
1696
|
+
mints short-lived session JWTs. `qn.rpc` makes JSON-RPC calls directly against that
|
|
1697
|
+
endpoint, minting and refreshing the JWT automatically — no endpoint URL or token to
|
|
1698
|
+
manage.
|
|
1699
|
+
|
|
1700
|
+
Tooling Access must be enabled once (admin role + eligible plan). The control-plane
|
|
1701
|
+
methods live on `qn.admin`:
|
|
1702
|
+
|
|
1703
|
+
```typescript
|
|
1704
|
+
// Node.js
|
|
1705
|
+
const status = await qn.admin.toolingAccessStatus();
|
|
1706
|
+
if (!status.enabled) {
|
|
1707
|
+
await qn.admin.enableToolingAccess(); // idempotent; admin role required
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1710
|
+
// Make on-chain calls. params defaults to []; pass an array (positional) or object.
|
|
1711
|
+
const blockNumber = await qn.rpc.call("eth_blockNumber");
|
|
1712
|
+
const balance = await qn.rpc.call("eth_getBalance", ["0xabc...", "latest"]);
|
|
1713
|
+
|
|
1714
|
+
// Multichain: select a network by its multichain_urls key. Seed the map first
|
|
1715
|
+
// (from admin.getEndpointUrls), then pass the network as the 3rd arg.
|
|
1716
|
+
const urls = await qn.admin.getEndpointUrls(endpointId);
|
|
1717
|
+
const map = Object.fromEntries(
|
|
1718
|
+
Object.entries(urls.multichainUrls ?? {}).map(([k, v]) => [k, v.httpUrl]),
|
|
1719
|
+
);
|
|
1720
|
+
qn.rpc.setNetworks(map);
|
|
1721
|
+
const slot = await qn.rpc.call("getSlot", [], "solana-mainnet");
|
|
1722
|
+
|
|
1723
|
+
// Custom endpoint URL: send to a fully-formed HTTP URL, bypassing Tooling Access
|
|
1724
|
+
// and the JWT (no Authorization header). Per-call via the 4th arg, or client-wide
|
|
1725
|
+
// via `new RpcConfig({ endpointUrl })`. endpointUrl and network are mutually
|
|
1726
|
+
// exclusive (a custom URL is not multichain-routed).
|
|
1727
|
+
const block = await qn.rpc.call("eth_blockNumber", [], undefined, "https://my-endpoint.example/rpc");
|
|
1728
|
+
|
|
1729
|
+
// A JSON-RPC error member is thrown as RpcError (with .code and .message).
|
|
1730
|
+
import { RpcError } from "@quicknode/sdk";
|
|
1731
|
+
try {
|
|
1732
|
+
await qn.rpc.call("eth_getBalance", ["bad"]);
|
|
1733
|
+
} catch (e) {
|
|
1734
|
+
if (e instanceof RpcError) console.error(e.code, e.message);
|
|
1735
|
+
}
|
|
1736
|
+
```
|
|
1737
|
+
|
|
1738
|
+
A host that persists across processes can snapshot the cached token with
|
|
1739
|
+
`qn.rpc.currentToken()` and re-seed it via `RpcConfig.seed` on the next construction;
|
|
1740
|
+
`refreshMarginSecs` (default 60) tunes how early the token is refreshed. Set
|
|
1741
|
+
`RpcConfig.endpointUrl` to route every call to a custom HTTP URL by default (no
|
|
1742
|
+
JWT minted); a per-call `endpointUrl` overrides it.
|
|
1743
|
+
|
|
1744
|
+
## Crypto-micropayment lane (`rpc.call`)
|
|
1745
|
+
|
|
1746
|
+
Pay per RPC request with a stablecoin instead of a provisioned account + API key,
|
|
1747
|
+
against Quicknode's `x402.quicknode.com` and `mpp.quicknode.com` gateways. Configure
|
|
1748
|
+
it by setting `payment` on the RPC config; the SDK runs the `402` → sign → resend
|
|
1749
|
+
handshake for you. An API key is **not** required for this lane — build a keyless SDK.
|
|
1750
|
+
|
|
1751
|
+
There are four payment paths. Two pay per request; two amortize one signature over many
|
|
1752
|
+
calls.
|
|
1753
|
+
|
|
1754
|
+
| Path | Entry point | Gateway | Signs |
|
|
1755
|
+
|---|---|---|---|
|
|
1756
|
+
| Per-request x402 | `call` / `callWithReceipt` with `scheme: "x402"` | x402 | once per call |
|
|
1757
|
+
| Per-request MPP charge | `call` / `callWithReceipt` with `scheme: "mpp"` | mpp | once per call |
|
|
1758
|
+
| [x402 credit drawdown](#x402-credit-drawdown-authenticate-once-then-draw-one-credit-per-call) | `gatewayAuthenticate` → `gatewayDrawdownCall` | x402 | once per session |
|
|
1759
|
+
| [MPP payment channel](#mpp-payment-channel-deposit-once-then-vouchers) | `mppOpen` → `mppSessionCall` | mpp | once per channel |
|
|
1760
|
+
|
|
1761
|
+
The signer construction is derived from the scheme and pay network, never stated directly:
|
|
1762
|
+
**x402/EVM** signs an EIP-712 `TransferWithAuthorization`, **x402/Solana** an SPL
|
|
1763
|
+
`TransferChecked` in a v0 tx (the gateway sponsors gas), and **MPP/Tempo** a native Tempo
|
|
1764
|
+
transaction.
|
|
1765
|
+
|
|
1766
|
+
`scheme` selects the gateway for `call` only. The `gateway*` drawdown methods always use
|
|
1767
|
+
the x402 gateway and the `mpp*` channel methods always use the MPP gateway, whatever
|
|
1768
|
+
`scheme` is set to.
|
|
1769
|
+
|
|
1770
|
+
`PaymentConfig` fields:
|
|
1771
|
+
|
|
1772
|
+
| Field | Meaning |
|
|
1773
|
+
|---|---|
|
|
1774
|
+
| `scheme` | `"x402"` (pay-per-request) or `"mpp"` (MPP charge; `"mpp-charge"` is accepted too) |
|
|
1775
|
+
| `key` | raw private key — EVM/Tempo: hex; Solana: base58 64-byte secret |
|
|
1776
|
+
| `payNetwork` | CAIP-2 pay network, e.g. `eip155:84532`, `solana:5eykt4…` |
|
|
1777
|
+
| `asset` | token address/mint to pay in (matches the offered menu entry) |
|
|
1778
|
+
| `maxAmount` | **required** spend ceiling in integer base units of `asset` |
|
|
1779
|
+
| `svmRpcUrl` | optional Solana RPC for x402/Solana payment-build reads (mint + blockhash) |
|
|
1780
|
+
| `baseUrlOverride` | optional gateway base (testing) |
|
|
1781
|
+
|
|
1782
|
+
`network` on the call is the **query** chain (gateway path slug), independent of the
|
|
1783
|
+
pay network. Use `callWithReceipt` to also get the settlement receipt (`reference` =
|
|
1784
|
+
settlement tx hash) — populated on the MPP lane, `null` for x402.
|
|
1785
|
+
|
|
1786
|
+
**Things to know:**
|
|
1787
|
+
|
|
1788
|
+
- **Do not log your own `PaymentConfig`** — the `key` field is readable. The SDK
|
|
1789
|
+
never prints it in its own errors, but `console.log(config)` will show it.
|
|
1790
|
+
- **`maxAmount` is integer base units of the selected asset.** The SDK skips any offered
|
|
1791
|
+
entry above it and refuses to sign one — a guard against an overcharging gateway.
|
|
1792
|
+
- **`PaymentIndeterminateError` means the paid request was sent but the response was lost.**
|
|
1793
|
+
You MAY have been charged — do **not** blindly retry.
|
|
1794
|
+
- **x402/Solana: one payment per call.** Building a payment reads the mint and a recent
|
|
1795
|
+
blockhash from a Solana RPC. The default is a public RPC that **rate-limits
|
|
1796
|
+
aggressively** — set `svmRpcUrl` to your own endpoint at any volume.
|
|
1797
|
+
|
|
1798
|
+
```typescript
|
|
1799
|
+
import { QuicknodeSdk } from "@quicknode/sdk";
|
|
1800
|
+
|
|
1801
|
+
const qn = new QuicknodeSdk({
|
|
1802
|
+
rpc: {
|
|
1803
|
+
payment: {
|
|
1804
|
+
scheme: "x402",
|
|
1805
|
+
key: process.env.QN_PAYMENT_KEY!,
|
|
1806
|
+
payNetwork: "eip155:84532",
|
|
1807
|
+
asset: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
1808
|
+
maxAmount: "10000",
|
|
1809
|
+
},
|
|
1810
|
+
},
|
|
1811
|
+
});
|
|
1812
|
+
const { result, paymentReceipt } = await qn.rpc.callWithReceipt("eth_blockNumber", [], "base-sepolia");
|
|
1813
|
+
console.log(result, paymentReceipt);
|
|
1814
|
+
```
|
|
1815
|
+
|
|
1816
|
+
### Wallet generation
|
|
1817
|
+
|
|
1818
|
+
`generatePaymentWallet("evm")` creates a fresh keypair offline — no network call, no funds — for
|
|
1819
|
+
`"evm"`, `"svm"`, or `"tempo"`. The private key is returned **exactly once**, at
|
|
1820
|
+
generation; nothing in the SDK stores or re-derives it, so persist it immediately.
|
|
1821
|
+
|
|
1822
|
+
```typescript
|
|
1823
|
+
import { generatePaymentWallet } from "@quicknode/sdk";
|
|
1824
|
+
|
|
1825
|
+
const wallet = generatePaymentWallet("evm");
|
|
1826
|
+
console.log("fund this address:", wallet.address);
|
|
1827
|
+
// wallet.key is returned exactly once — persist it now.
|
|
1828
|
+
```
|
|
1829
|
+
|
|
1830
|
+
### x402 credit drawdown (authenticate once, then draw one credit per call)
|
|
1831
|
+
|
|
1832
|
+
Cheaper per call than paying per request: one SIWE signature mints a session JWT, then
|
|
1833
|
+
each call draws a single credit from the account balance instead of signing a fresh
|
|
1834
|
+
settlement. Minting the session is free and moves no funds, so a host can re-authenticate
|
|
1835
|
+
transparently. Persist it between processes.
|
|
1836
|
+
|
|
1837
|
+
Fund the payment wallet out of band — the testnet faucet below, or by sending funds to
|
|
1838
|
+
`paymentAddress()` directly. Credits are provisioned against the account gateway-side.
|
|
1839
|
+
|
|
1840
|
+
EVM signers only: SIWE is an EIP-4361 construction, so an x402/Solana key errors here.
|
|
1841
|
+
|
|
1842
|
+
| Method | Cost | Returns |
|
|
1843
|
+
|---|---|---|
|
|
1844
|
+
| `paymentAddress()` | free, offline | the wallet address derived from the key |
|
|
1845
|
+
| `gatewayAuthenticate()` | free | `GatewaySession { token, expUnix, accountId }` |
|
|
1846
|
+
| `gatewayCredits(session)` | free | `CreditBalance { accountId, credits }` |
|
|
1847
|
+
| `gatewayDrip(session)` | free (testnet) | `DripReceipt { accountId, transactionHash }` |
|
|
1848
|
+
| `gatewayDrawdownCall(method, session, network, params?)` | 1 credit | the JSON-RPC `result` |
|
|
1849
|
+
|
|
1850
|
+
```typescript
|
|
1851
|
+
const session = await qn.rpc.gatewayAuthenticate();
|
|
1852
|
+
const balance = await qn.rpc.gatewayCredits(session);
|
|
1853
|
+
console.log("credits:", balance.credits);
|
|
1854
|
+
const result = await qn.rpc.gatewayDrawdownCall("eth_blockNumber", session, "base-sepolia");
|
|
1855
|
+
```
|
|
1856
|
+
|
|
1857
|
+
A `token_expired` surfaces as an `ApiError` with status 401/403; re-authenticate and retry
|
|
1858
|
+
that call.
|
|
1859
|
+
|
|
1860
|
+
#### Testnet faucet
|
|
1861
|
+
|
|
1862
|
+
`gatewayDrip` requests testnet tokens for the payment **wallet** on Base Sepolia. The
|
|
1863
|
+
gateway allows one drip per account, and it returns the on-chain funding transaction hash
|
|
1864
|
+
— not a credit balance.
|
|
1865
|
+
|
|
1866
|
+
### MPP payment channel (deposit once, then vouchers)
|
|
1867
|
+
|
|
1868
|
+
Open a payment channel by depositing into the escrow, then authorize each call with a
|
|
1869
|
+
cumulative voucher — one `ecrecover` server-side, no on-chain transaction per call.
|
|
1870
|
+
|
|
1871
|
+
| Method | Cost | Returns |
|
|
1872
|
+
|---|---|---|
|
|
1873
|
+
| `mppOpen(deposit)` | **moves funds** | `ChannelState` — persist it |
|
|
1874
|
+
| `mppTopUp(channel, additionalDeposit)` | **moves funds** | the updated channel state |
|
|
1875
|
+
| `mppStatus(channel)` | **1 request unit** | `ChannelStatus { channelId, acceptedCumulative, spent }` |
|
|
1876
|
+
| `mppSessionCall(method, network, channel, newCumulative, params?)` | 1 request unit | the JSON-RPC `result` |
|
|
1877
|
+
| `mppClose(channel)` | settles on-chain | nothing — refunds the unused deposit |
|
|
1878
|
+
|
|
1879
|
+
```typescript
|
|
1880
|
+
const channel = await qn.rpc.mppOpen("1000000"); // persist this object
|
|
1881
|
+
const newTotal = (BigInt(channel.cumulativeSpent) + BigInt(channel.perCall)).toString();
|
|
1882
|
+
const result = await qn.rpc.mppSessionCall(
|
|
1883
|
+
"eth_blockNumber", "base-sepolia", channel, newTotal,
|
|
1884
|
+
);
|
|
1885
|
+
// On success, store newTotal as the channel's cumulativeSpent.
|
|
1886
|
+
```
|
|
1887
|
+
|
|
1888
|
+
**Things to know:**
|
|
1889
|
+
|
|
1890
|
+
- **Persist the channel state.** The gateway exposes no read-only channel endpoint, so a
|
|
1891
|
+
lost local record means opening (and funding) a new channel.
|
|
1892
|
+
- **`mppStatus` is not free.** The gateway prices every session POST as a chargeable
|
|
1893
|
+
request and computes the balance from the *new* spend a voucher authorizes, so the
|
|
1894
|
+
probe advances `cumulativeSpent` by `perCall` exactly like a call. Re-persist the
|
|
1895
|
+
advanced total. It raises `PaymentUnsupportedError` before any network I/O when the
|
|
1896
|
+
channel has no room left for the probe.
|
|
1897
|
+
- **The lifecycle takes no query network.** A channel is scoped by the configured pay
|
|
1898
|
+
network and asset, so one channel funds calls to every supported network. Only
|
|
1899
|
+
`mppSessionCall` takes a network, because it routes an RPC method.
|
|
1900
|
+
- **Amounts are decimal strings, not numbers.** They are `u128` in the core; a JS `number` is an f64 that loses precision above 2^53, so pass and store them as strings.
|
|
1901
|
+
- **Advance `cumulativeSpent` only after a success.** A voucher authorizes the running total
|
|
1902
|
+
*after* the call; re-presenting the current high-water mark authorizes zero and is
|
|
1903
|
+
always refused with `insufficient-balance`.
|
|
1904
|
+
|
|
1905
|
+
|
|
1906
|
+
|
|
1677
1907
|
## Error Handling
|
|
1678
1908
|
|
|
1679
1909
|
Every binding exposes a typed exception hierarchy derived from the core `SdkError`
|
|
@@ -1689,8 +1919,13 @@ subclass to branch on transport vs. API semantics.
|
|
|
1689
1919
|
| `ConnectionError` | connection refused / DNS / TLS (subclass of `HttpError`) | — |
|
|
1690
1920
|
| `ApiError` | non-2xx HTTP response | `status`, `body` |
|
|
1691
1921
|
| `DecodeError` | 2xx response but JSON parse failed | `body` |
|
|
1922
|
+
| `RpcError` | JSON-RPC call returned an `error` member | `code`, `message` |
|
|
1923
|
+
| `PaymentError` | base class for the crypto-micropayment lane | — |
|
|
1924
|
+
| `PaymentUnsupportedError` | no offered payment option matched your selector (or all were over `max_amount`/unsupported) | — |
|
|
1925
|
+
| `PaymentRejectedError` | the gateway rejected a signed payment (terminal, one resend only) | `status`, `body` |
|
|
1926
|
+
| `PaymentIndeterminateError` | paid request sent but response lost — MAY have been charged; do NOT blindly retry | — |
|
|
1692
1927
|
|
|
1693
|
-
Class names: Importable from `@quicknode/sdk`: `QuicknodeError`, `ConfigError`, `HttpError`, `TimeoutError`, `ConnectionError`, `ApiError`, `DecodeError`. All extend `Error`.
|
|
1928
|
+
Class names: Importable from `@quicknode/sdk`: `QuicknodeError`, `ConfigError`, `HttpError`, `TimeoutError`, `ConnectionError`, `ApiError`, `DecodeError`, `RpcError`, `PaymentError`, `PaymentUnsupportedError`, `PaymentRejectedError`, `PaymentIndeterminateError`. All extend `Error`.
|
|
1694
1929
|
|
|
1695
1930
|
```typescript
|
|
1696
1931
|
// Node.js
|
package/errors.js
CHANGED
|
@@ -54,7 +54,48 @@ class DecodeError extends QuicknodeError {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
class RpcError extends QuicknodeError {
|
|
58
|
+
constructor(message, code) {
|
|
59
|
+
super(message);
|
|
60
|
+
this.name = "RpcError";
|
|
61
|
+
this.code = code;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Payment-lane errors. PaymentError is the family base; PaymentRejectedError
|
|
66
|
+
// carries the gateway status/body; PaymentIndeterminateError is its own class
|
|
67
|
+
// so callers can catch "may have been charged — do not retry" distinctly.
|
|
68
|
+
class PaymentError extends QuicknodeError {
|
|
69
|
+
constructor(message) {
|
|
70
|
+
super(message);
|
|
71
|
+
this.name = "PaymentError";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
class PaymentUnsupportedError extends PaymentError {
|
|
76
|
+
constructor(message) {
|
|
77
|
+
super(message);
|
|
78
|
+
this.name = "PaymentUnsupportedError";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
class PaymentRejectedError extends PaymentError {
|
|
83
|
+
constructor(message, status, body) {
|
|
84
|
+
super(message);
|
|
85
|
+
this.name = "PaymentRejectedError";
|
|
86
|
+
this.status = status;
|
|
87
|
+
this.body = body;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
class PaymentIndeterminateError extends PaymentError {
|
|
92
|
+
constructor(message) {
|
|
93
|
+
super(message);
|
|
94
|
+
this.name = "PaymentIndeterminateError";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const TAG_RE = /^\[(Config|Http|Timeout|Connect|Api|Decode|Rpc|PaymentUnsupported|PaymentRejected|PaymentIndeterminate)\|([^|]+)\|([^\]]+)\](.*)$/s;
|
|
58
99
|
|
|
59
100
|
function fromNapiError(err) {
|
|
60
101
|
if (!(err instanceof Error)) return err;
|
|
@@ -82,6 +123,11 @@ function fromNapiError(err) {
|
|
|
82
123
|
case "Http": return new HttpError(msg);
|
|
83
124
|
case "Api": return new ApiError(msg, Number(statusStr), body);
|
|
84
125
|
case "Decode": return new DecodeError(msg, body);
|
|
126
|
+
// For Rpc, statusStr is the JSON-RPC code and body is its message.
|
|
127
|
+
case "Rpc": return new RpcError(body || msg, Number(statusStr));
|
|
128
|
+
case "PaymentUnsupported": return new PaymentUnsupportedError(msg);
|
|
129
|
+
case "PaymentRejected": return new PaymentRejectedError(msg, Number(statusStr), body);
|
|
130
|
+
case "PaymentIndeterminate": return new PaymentIndeterminateError(msg);
|
|
85
131
|
default: return err;
|
|
86
132
|
}
|
|
87
133
|
}
|
|
@@ -116,6 +162,11 @@ module.exports = {
|
|
|
116
162
|
ConnectionError,
|
|
117
163
|
ApiError,
|
|
118
164
|
DecodeError,
|
|
165
|
+
RpcError,
|
|
166
|
+
PaymentError,
|
|
167
|
+
PaymentUnsupportedError,
|
|
168
|
+
PaymentRejectedError,
|
|
169
|
+
PaymentIndeterminateError,
|
|
119
170
|
fromNapiError,
|
|
120
171
|
wrapClient,
|
|
121
172
|
};
|
package/index.d.ts
CHANGED
|
@@ -221,6 +221,23 @@ export interface BulkUpdateEndpointStatusResponse {
|
|
|
221
221
|
error?: string
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* A minted session JWT plus the endpoint it authenticates against and its
|
|
226
|
+
* wall-clock expiry. This is the unit cached by the RPC client and the unit a
|
|
227
|
+
* host persists between processes (e.g. the CLI's on-disk token cache).
|
|
228
|
+
*
|
|
229
|
+
* `exp_unix` is the JWT `exp` claim (unix seconds), used directly so it
|
|
230
|
+
* survives a process restart (unlike a monotonic `Instant`).
|
|
231
|
+
*/
|
|
232
|
+
export interface CachedToken {
|
|
233
|
+
/** The provisioned tooling-access endpoint URL the JWT authenticates against. */
|
|
234
|
+
endpointUrl: string
|
|
235
|
+
/** The minted ES256 session JWT, presented as a Bearer token. */
|
|
236
|
+
token: string
|
|
237
|
+
/** JWT `exp` claim in unix seconds. */
|
|
238
|
+
expUnix: number
|
|
239
|
+
}
|
|
240
|
+
|
|
224
241
|
/** A blockchain supported by Quicknode along with its networks. */
|
|
225
242
|
export interface Chain {
|
|
226
243
|
/** Chain slug (e.g. `ethereum`). */
|
|
@@ -1350,6 +1367,55 @@ export interface Payment {
|
|
|
1350
1367
|
marketplaceAmount?: string
|
|
1351
1368
|
}
|
|
1352
1369
|
|
|
1370
|
+
/**
|
|
1371
|
+
* Binding-facing crypto-micropayment configuration. **Plain data** — all
|
|
1372
|
+
* fields are strings so this can be a `napi(object)` / `pyclass` / Ruby hash;
|
|
1373
|
+
* it is converted to the internal `enum Signer` + resolved config at the Rust
|
|
1374
|
+
* boundary. The private `key` field stays readable to the caller, but the
|
|
1375
|
+
* SDK's own `Debug` redacts it (below) so an SDK log line or panic can't leak
|
|
1376
|
+
* it.
|
|
1377
|
+
*
|
|
1378
|
+
* **Do not log your own `PaymentConfig`** — `println!("{config:?}")` on the
|
|
1379
|
+
* derived-Debug *binding* object (napi/pyclass/hash) still shows the raw key.
|
|
1380
|
+
* Only the SDK's internal rendering is redacted.
|
|
1381
|
+
*/
|
|
1382
|
+
export interface PaymentConfig {
|
|
1383
|
+
/** Payment protocol: `"x402"` (pay-per-request) or `"mpp"` (MPP charge). */
|
|
1384
|
+
scheme: string
|
|
1385
|
+
/**
|
|
1386
|
+
* Raw private key. EVM/Tempo: hex (with or without `0x`). Solana: base58
|
|
1387
|
+
* 64-byte secret key.
|
|
1388
|
+
*/
|
|
1389
|
+
key: string
|
|
1390
|
+
/**
|
|
1391
|
+
* CAIP-2 pay network selector, e.g. `"eip155:84532"` (x402/EVM),
|
|
1392
|
+
* `"solana:5eykt4…"` (x402/Solana), or `"eip155:42431"` (MPP/Tempo).
|
|
1393
|
+
*/
|
|
1394
|
+
payNetwork: string
|
|
1395
|
+
/**
|
|
1396
|
+
* Asset (token) address/mint to pay in. Matches the offered menu entry's
|
|
1397
|
+
* `asset`. EVM: token contract hex. Solana: mint base58.
|
|
1398
|
+
*/
|
|
1399
|
+
asset: string
|
|
1400
|
+
/**
|
|
1401
|
+
* Spend ceiling in base units of `asset` (integer string). **Required.**
|
|
1402
|
+
* The selector skips any offered entry above this, and the driver refuses
|
|
1403
|
+
* to sign one — guarding against a buggy/hostile gateway overcharging a
|
|
1404
|
+
* custodied key.
|
|
1405
|
+
*/
|
|
1406
|
+
maxAmount: string
|
|
1407
|
+
/**
|
|
1408
|
+
* Explicit Solana RPC URL for x402/Solana payment-build reads: the mint
|
|
1409
|
+
* (for its decimals and owning token program) and a recent blockhash, so
|
|
1410
|
+
* two reads per payment. Optional; when unset the SDK falls back to a
|
|
1411
|
+
* public Solana RPC matching the pay cluster. **Set this at any real
|
|
1412
|
+
* volume** — the public default rate-limits aggressively.
|
|
1413
|
+
*/
|
|
1414
|
+
svmRpcUrl?: string
|
|
1415
|
+
/** Test-only gateway base override (points the lane at a mock gateway). */
|
|
1416
|
+
baseUrlOverride?: string
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1353
1419
|
/** Configuration for delivering stream batches to a PostgreSQL database. */
|
|
1354
1420
|
export interface PostgresAttributes {
|
|
1355
1421
|
/** Database host. */
|
|
@@ -1465,6 +1531,51 @@ export interface ResendTeamInviteResponse {
|
|
|
1465
1531
|
error?: string
|
|
1466
1532
|
}
|
|
1467
1533
|
|
|
1534
|
+
export interface RpcConfig {
|
|
1535
|
+
/**
|
|
1536
|
+
* Custom HTTP URL to send JSON-RPC calls to, bypassing the Tooling Access
|
|
1537
|
+
* endpoint. When set, every `rpc.call` on this client goes straight to this
|
|
1538
|
+
* URL with NO session token minted or attached — the URL is treated as a
|
|
1539
|
+
* self-authenticating endpoint (e.g. a provisioned `.quiknode.pro` URL that
|
|
1540
|
+
* already embeds its token, or a self-hosted node). A per-call
|
|
1541
|
+
* `endpoint_url` overrides this default. Unset means tooling-JWT mode.
|
|
1542
|
+
*/
|
|
1543
|
+
endpointUrl?: string
|
|
1544
|
+
/**
|
|
1545
|
+
* Optional pre-existing token to seed the in-memory cache (e.g. loaded
|
|
1546
|
+
* from a host's on-disk cache). Advisory: a malformed or expired seed is
|
|
1547
|
+
* treated as a cache miss and a fresh token is minted.
|
|
1548
|
+
*/
|
|
1549
|
+
seed?: CachedToken
|
|
1550
|
+
/**
|
|
1551
|
+
* Seconds before `exp` at which the client proactively refreshes. The
|
|
1552
|
+
* margin also absorbs clock skew between client and endpoint. Defaults to
|
|
1553
|
+
* 60 when unset.
|
|
1554
|
+
*/
|
|
1555
|
+
refreshMarginSecs?: number
|
|
1556
|
+
/**
|
|
1557
|
+
* Per-network URL map for multichain routing: network key (e.g.
|
|
1558
|
+
* `"solana-mainnet"`, `"polygon"`) -> full http_url. Built from
|
|
1559
|
+
* `admin.get_endpoint_urls(...).multichain_urls`. When set, `rpc.call` with
|
|
1560
|
+
* a `network` resolves the target URL here. Optional; the default-network
|
|
1561
|
+
* call path needs no map.
|
|
1562
|
+
*/
|
|
1563
|
+
networks?: Record<string, string>
|
|
1564
|
+
/**
|
|
1565
|
+
* Crypto-micropayment lane. When set, `rpc.call` pays per request with a
|
|
1566
|
+
* stablecoin against Quicknode's x402/MPP gateways instead of using the
|
|
1567
|
+
* account API key + session JWT. `#[serde(skip)]` so `from_env` can never
|
|
1568
|
+
* populate it — an env-derived private key is exactly what we don't want;
|
|
1569
|
+
* callers must pass this programmatically. The field is always present
|
|
1570
|
+
* (plain data), but the payment lane is only wired into `rpc.call` when a
|
|
1571
|
+
* crypto feature (`payments`/`payments-svm`/`payments-tempo`) is enabled;
|
|
1572
|
+
* built without any of them, a set `payment` is ignored and `rpc.call`
|
|
1573
|
+
* keeps its normal tooling-JWT behavior. The precompiled Python/Node/Ruby
|
|
1574
|
+
* packages always ship with the payment features on.
|
|
1575
|
+
*/
|
|
1576
|
+
payment?: PaymentConfig
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1468
1579
|
/** Configuration for delivering stream batches to an S3-compatible object store. */
|
|
1469
1580
|
export interface S3Attributes {
|
|
1470
1581
|
/** S3 service endpoint (e.g. `s3.amazonaws.com`). */
|
|
@@ -1490,13 +1601,24 @@ export interface S3Attributes {
|
|
|
1490
1601
|
}
|
|
1491
1602
|
|
|
1492
1603
|
export interface SdkFullConfig {
|
|
1493
|
-
|
|
1604
|
+
/**
|
|
1605
|
+
* Account API key. **Optional** so a keyless SDK can be built for the
|
|
1606
|
+
* crypto-micropayment lane (`rpc.call` with `RpcConfig.payment`). When
|
|
1607
|
+
* absent, no `x-api-key` header is installed: the payment lane works, while
|
|
1608
|
+
* the keyed surfaces (admin/streams/webhooks/kvstore/sql and tooling-JWT
|
|
1609
|
+
* `rpc.call`) send un-authenticated requests and the gateway rejects them
|
|
1610
|
+
* (surfacing as an `ApiError`, typically 401). `from_env` still requires
|
|
1611
|
+
* the key (validated in `from_config`) — only programmatic construction
|
|
1612
|
+
* may omit it.
|
|
1613
|
+
*/
|
|
1614
|
+
apiKey?: string
|
|
1494
1615
|
http?: HttpConfig
|
|
1495
1616
|
admin?: AdminConfig
|
|
1496
1617
|
streams?: StreamsConfig
|
|
1497
1618
|
webhooks?: WebhooksConfig
|
|
1498
1619
|
kvstore?: KvStoreConfig
|
|
1499
1620
|
sql?: SqlConfig
|
|
1621
|
+
rpc?: RpcConfig
|
|
1500
1622
|
}
|
|
1501
1623
|
|
|
1502
1624
|
/** A single security feature's name, status, and optional value. */
|
|
@@ -1778,6 +1900,23 @@ export interface TestFilterResponse {
|
|
|
1778
1900
|
logs: Array<string>
|
|
1779
1901
|
}
|
|
1780
1902
|
|
|
1903
|
+
/**
|
|
1904
|
+
* Current Tooling Access status for the account. `enabled` is the source of
|
|
1905
|
+
* truth — a previously-provisioned-but-disabled account may still report a
|
|
1906
|
+
* non-null `endpoint_url`.
|
|
1907
|
+
*/
|
|
1908
|
+
export interface ToolingAccessStatus {
|
|
1909
|
+
enabled: boolean
|
|
1910
|
+
endpointUrl?: string
|
|
1911
|
+
enabledAt?: string
|
|
1912
|
+
/**
|
|
1913
|
+
* The provisioned endpoint's id. Used to fetch the per-network URL map
|
|
1914
|
+
* (`get_endpoint_urls`) for multichain routing. `None` on control planes
|
|
1915
|
+
* that don't yet return it.
|
|
1916
|
+
*/
|
|
1917
|
+
endpointId?: string
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1781
1920
|
/** Parameters for `update_endpoint`. */
|
|
1782
1921
|
export interface UpdateEndpointRequest {
|
|
1783
1922
|
/** New human-readable label. */
|
|
@@ -2265,6 +2404,24 @@ export declare class AdminApiClient {
|
|
|
2265
2404
|
* chain slug rejects with `ApiError` (status 404).
|
|
2266
2405
|
*/
|
|
2267
2406
|
getApiCredits(chain: string): Promise<GetApiCreditsResponse>
|
|
2407
|
+
/**
|
|
2408
|
+
* Returns the current Tooling Access status for the account. Inspect
|
|
2409
|
+
* `enabled` to decide whether to enable provisioning.
|
|
2410
|
+
*/
|
|
2411
|
+
toolingAccessStatus(): Promise<ToolingAccessStatus>
|
|
2412
|
+
/**
|
|
2413
|
+
* Enables (provisions) Tooling Access. Idempotent. Requires an admin role
|
|
2414
|
+
* and an eligible plan.
|
|
2415
|
+
*/
|
|
2416
|
+
enableToolingAccess(): Promise<ToolingAccessStatus>
|
|
2417
|
+
/** Disables Tooling Access, pausing the endpoint. Idempotent. */
|
|
2418
|
+
disableToolingAccess(): Promise<ToolingAccessStatus>
|
|
2419
|
+
/**
|
|
2420
|
+
* Mints a short-lived session JWT for the provisioned Tooling Access
|
|
2421
|
+
* endpoint. Returns the endpoint URL, the JWT, and its expiry. Requires
|
|
2422
|
+
* Tooling Access to be enabled first.
|
|
2423
|
+
*/
|
|
2424
|
+
mintToolingToken(): Promise<CachedToken>
|
|
2268
2425
|
/**
|
|
2269
2426
|
* Returns the account's invoices, including id, status, billing reason,
|
|
2270
2427
|
* amounts due and paid, line items with descriptions and billing periods,
|
|
@@ -2424,10 +2581,128 @@ export declare class QuicknodeSdk {
|
|
|
2424
2581
|
get kvstore(): KvStoreApiClient
|
|
2425
2582
|
/** Returns the sql sub-client. */
|
|
2426
2583
|
get sql(): SqlApiClient
|
|
2584
|
+
/** Returns the JSON-RPC sub-client. */
|
|
2585
|
+
get rpc(): RpcApiClient
|
|
2427
2586
|
/** Creates a new SDK instance using configuration from environment variables. */
|
|
2428
2587
|
static fromEnv(): QuicknodeSdk
|
|
2429
2588
|
}
|
|
2430
2589
|
|
|
2590
|
+
export declare class RpcApiClient {
|
|
2591
|
+
/**
|
|
2592
|
+
* Makes a JSON-RPC call against the account's Tooling Access endpoint,
|
|
2593
|
+
* authenticated with a short-lived session JWT (minted and refreshed
|
|
2594
|
+
* automatically). `params` accepts an array (positional) or object
|
|
2595
|
+
* (by-name) and defaults to `[]`. `network` selects a chain on the
|
|
2596
|
+
* multichain endpoint (a key in the seeded network map, e.g.
|
|
2597
|
+
* `"solana-mainnet"`); omit for the endpoint's default network.
|
|
2598
|
+
*
|
|
2599
|
+
* `endpointUrl` sends this call to a custom HTTP URL instead, bypassing the
|
|
2600
|
+
* Tooling Access endpoint and the session JWT (no Authorization header is
|
|
2601
|
+
* attached). It overrides the client-wide `RpcConfig.endpointUrl` default.
|
|
2602
|
+
* Passing both `endpointUrl` and `network` throws (they are mutually
|
|
2603
|
+
* exclusive). Returns the JSON-RPC `result`; a JSON-RPC error is thrown as
|
|
2604
|
+
* `RpcError`.
|
|
2605
|
+
*/
|
|
2606
|
+
call(method: string, params?: any | undefined | null, network?: string | undefined | null, endpointUrl?: string | undefined | null): Promise<any>
|
|
2607
|
+
/**
|
|
2608
|
+
* Like `call`, but also returns the crypto-micropayment settlement
|
|
2609
|
+
* receipt. Resolves to `{ result, paymentReceipt }` where `paymentReceipt`
|
|
2610
|
+
* is `{ method, status, timestamp, reference }` on the MPP payment lane and
|
|
2611
|
+
* `null` for x402 and every non-payment lane (identical to `call`).
|
|
2612
|
+
*/
|
|
2613
|
+
callWithReceipt(method: string, params?: any | undefined | null, network?: string | undefined | null, endpointUrl?: string | undefined | null): Promise<any>
|
|
2614
|
+
/**
|
|
2615
|
+
* Seeds the per-network URL map for multichain routing (network key ->
|
|
2616
|
+
* full http_url), typically built from
|
|
2617
|
+
* `admin.getEndpointUrls(...).multichainUrls`.
|
|
2618
|
+
*/
|
|
2619
|
+
setNetworks(networks: Record<string, string>): void
|
|
2620
|
+
/**
|
|
2621
|
+
* Discards the in-memory cached token, forcing the next call to mint a
|
|
2622
|
+
* fresh one. Use when the cached token is known stale beyond expiry.
|
|
2623
|
+
*/
|
|
2624
|
+
clearCachedToken(): void
|
|
2625
|
+
/**
|
|
2626
|
+
* Returns a snapshot of the currently cached session token, or `null` if
|
|
2627
|
+
* no token has been minted or seeded yet. Hosts use this to persist the
|
|
2628
|
+
* token between processes.
|
|
2629
|
+
*/
|
|
2630
|
+
currentToken(): CachedToken | null
|
|
2631
|
+
/**
|
|
2632
|
+
* The configured payment wallet's on-chain address (EVM/Tempo `0x…` hex,
|
|
2633
|
+
* Solana base58), derived offline from the key with no network round trip.
|
|
2634
|
+
*/
|
|
2635
|
+
paymentAddress(): string
|
|
2636
|
+
/**
|
|
2637
|
+
* Authenticates against the x402 gateway with a SIWX message and resolves
|
|
2638
|
+
* to `{ token, expUnix, accountId }`. Free — no funds move. Persist the
|
|
2639
|
+
* object and pass it back to the `gateway*` methods.
|
|
2640
|
+
*/
|
|
2641
|
+
gatewayAuthenticate(): Promise<any>
|
|
2642
|
+
/**
|
|
2643
|
+
* Reads the account's current x402 credit balance. Resolves to
|
|
2644
|
+
* `{ accountId, credits }`. `session` comes from `gatewayAuthenticate`.
|
|
2645
|
+
*/
|
|
2646
|
+
gatewayCredits(session: any): Promise<any>
|
|
2647
|
+
/**
|
|
2648
|
+
* Buys a block of credits, settling the gateway's offer with the same
|
|
2649
|
+
* signer construction as the per-request lane. Resolves to the
|
|
2650
|
+
* post-purchase `{ accountId, credits }`. Single-attempt: a paid lane never
|
|
2651
|
+
* blind-retries.
|
|
2652
|
+
*/
|
|
2653
|
+
gatewayBuyCredits(session: any, network: string): Promise<any>
|
|
2654
|
+
/**
|
|
2655
|
+
* Requests testnet tokens from the x402 faucet. Resolves to the funding
|
|
2656
|
+
* transaction `{ accountId, transactionHash }` — NOT a balance; call
|
|
2657
|
+
* `gatewayCredits` afterwards for that. Allowed once per account.
|
|
2658
|
+
*/
|
|
2659
|
+
gatewayDrip(session: any): Promise<any>
|
|
2660
|
+
/**
|
|
2661
|
+
* Makes one x402 drawdown JSON-RPC call with the session as a Bearer
|
|
2662
|
+
* token, drawing 1 credit on success. Resolves to the unwrapped JSON-RPC
|
|
2663
|
+
* `result`. Single-attempt; re-authenticate on a 401/403 `ApiError`.
|
|
2664
|
+
*/
|
|
2665
|
+
gatewayDrawdownCall(method: string, session: any, network: string, params?: any | undefined | null): Promise<any>
|
|
2666
|
+
/**
|
|
2667
|
+
* Opens an MPP payment channel by depositing `deposit` base units (a
|
|
2668
|
+
* decimal string) into the escrow. Resolves to the channel state — persist
|
|
2669
|
+
* it; the gateway has no read-only channel endpoint, so a lost record means
|
|
2670
|
+
* opening a new channel. Moves real funds; single-attempt.
|
|
2671
|
+
*
|
|
2672
|
+
* Takes no network: the channel is scoped by the configured pay network and
|
|
2673
|
+
* asset, so one channel funds calls to every supported network.
|
|
2674
|
+
*/
|
|
2675
|
+
mppOpen(deposit: string): Promise<any>
|
|
2676
|
+
/**
|
|
2677
|
+
* Adds `additionalDeposit` base units (a decimal string) to an open
|
|
2678
|
+
* channel. Resolves to the updated channel state. Moves real funds;
|
|
2679
|
+
* single-attempt.
|
|
2680
|
+
*/
|
|
2681
|
+
mppTopUp(channel: any, additionalDeposit: string): Promise<any>
|
|
2682
|
+
/**
|
|
2683
|
+
* Cooperatively closes a channel: settles the final cumulative spend
|
|
2684
|
+
* on-chain and refunds the unused deposit. Single-attempt.
|
|
2685
|
+
*/
|
|
2686
|
+
mppClose(channel: any): Promise<void>
|
|
2687
|
+
/**
|
|
2688
|
+
* Fetches the gateway's view of the channel as
|
|
2689
|
+
* `{ channelId, acceptedCumulative, spent }` (amounts are decimal strings).
|
|
2690
|
+
*
|
|
2691
|
+
* **This costs one request unit** and advances the voucher by `perCall`,
|
|
2692
|
+
* exactly like a session call — persist the advanced `cumulativeSpent`.
|
|
2693
|
+
* Rejects with `PaymentUnsupportedError` before any network I/O when the
|
|
2694
|
+
* channel has no room left for the probe.
|
|
2695
|
+
*/
|
|
2696
|
+
mppStatus(channel: any): Promise<any>
|
|
2697
|
+
/**
|
|
2698
|
+
* Makes one MPP session-lane JSON-RPC call, authorizing it with a
|
|
2699
|
+
* cumulative voucher for `newCumulative` (a decimal string: the running
|
|
2700
|
+
* total AFTER this call). Resolves to the unwrapped JSON-RPC `result`.
|
|
2701
|
+
* Single-attempt; advance the persisted `cumulativeSpent` on success.
|
|
2702
|
+
*/
|
|
2703
|
+
mppSessionCall(method: string, network: string, channel: any, newCumulative: string, params?: any | undefined | null): Promise<any>
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2431
2706
|
export declare class SqlApiClient {
|
|
2432
2707
|
/** Executes a SQL query against the given cluster and returns the result set. */
|
|
2433
2708
|
query(query: string, clusterId: string): Promise<QueryResponseNode>
|
|
@@ -2621,6 +2896,17 @@ export interface CreateWebhookFromTemplateParamsNode {
|
|
|
2621
2896
|
templateArgs: any
|
|
2622
2897
|
}
|
|
2623
2898
|
|
|
2899
|
+
/**
|
|
2900
|
+
* Generates a fresh payment keypair for `chain` (`"evm"`, `"svm"`, or
|
|
2901
|
+
* `"tempo"`). Returns `{ address, chain, key }` where `key` is the raw private
|
|
2902
|
+
* key in the format the `keyFile` config reads.
|
|
2903
|
+
*
|
|
2904
|
+
* The key is returned exactly once, at generation: nothing in the SDK stores or
|
|
2905
|
+
* re-derives it, so persist it before discarding the object. Randomness comes
|
|
2906
|
+
* from the OS CSPRNG.
|
|
2907
|
+
*/
|
|
2908
|
+
export declare function generatePaymentWallet(chain: string): any
|
|
2909
|
+
|
|
2624
2910
|
export interface ListStreamsResponseNode {
|
|
2625
2911
|
data: Array<StreamNode>
|
|
2626
2912
|
pageInfo: PageInfo
|
package/index.darwin-arm64.node
CHANGED
|
Binary file
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@quicknode/sdk-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@quicknode/sdk-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '3.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
80
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@quicknode/sdk-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@quicknode/sdk-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '3.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
96
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@quicknode/sdk-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@quicknode/sdk-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '3.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
117
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@quicknode/sdk-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@quicknode/sdk-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '3.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
133
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@quicknode/sdk-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@quicknode/sdk-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '3.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
150
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@quicknode/sdk-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@quicknode/sdk-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '3.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
166
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@quicknode/sdk-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@quicknode/sdk-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '3.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
185
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@quicknode/sdk-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@quicknode/sdk-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '3.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
201
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@quicknode/sdk-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@quicknode/sdk-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '3.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
217
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@quicknode/sdk-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@quicknode/sdk-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '3.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
237
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@quicknode/sdk-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@quicknode/sdk-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '3.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
253
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@quicknode/sdk-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@quicknode/sdk-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '3.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
274
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@quicknode/sdk-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@quicknode/sdk-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '3.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
290
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@quicknode/sdk-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@quicknode/sdk-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '3.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
308
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@quicknode/sdk-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@quicknode/sdk-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '3.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
324
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@quicknode/sdk-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@quicknode/sdk-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '3.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
342
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@quicknode/sdk-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@quicknode/sdk-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '3.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
358
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@quicknode/sdk-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@quicknode/sdk-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '3.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
376
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@quicknode/sdk-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@quicknode/sdk-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '3.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
392
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@quicknode/sdk-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@quicknode/sdk-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '3.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
410
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@quicknode/sdk-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@quicknode/sdk-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '3.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
426
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@quicknode/sdk-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@quicknode/sdk-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '3.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
443
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@quicknode/sdk-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@quicknode/sdk-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '3.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
459
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@quicknode/sdk-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@quicknode/sdk-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '3.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
479
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@quicknode/sdk-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@quicknode/sdk-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '3.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
495
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@quicknode/sdk-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@quicknode/sdk-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '3.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 3.
|
|
511
|
+
if (bindingPackageVersion !== '3.8.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 3.8.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -588,6 +588,8 @@ module.exports.WebhookTemplateId = nativeBinding.WebhookTemplateId
|
|
|
588
588
|
module.exports.AdminApiClient = nativeBinding.AdminApiClient
|
|
589
589
|
module.exports.KvStoreApiClient = nativeBinding.KvStoreApiClient
|
|
590
590
|
module.exports.QuicknodeSdk = nativeBinding.QuicknodeSdk
|
|
591
|
+
module.exports.RpcApiClient = nativeBinding.RpcApiClient
|
|
591
592
|
module.exports.SqlApiClient = nativeBinding.SqlApiClient
|
|
592
593
|
module.exports.StreamsApiClient = nativeBinding.StreamsApiClient
|
|
593
594
|
module.exports.WebhooksApiClient = nativeBinding.WebhooksApiClient
|
|
595
|
+
module.exports.generatePaymentWallet = nativeBinding.generatePaymentWallet
|
|
Binary file
|
|
Binary file
|
package/index.linux-x64-gnu.node
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quicknode/sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Quicknode SDK",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
},
|
|
55
55
|
"license": "MIT",
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@quicknode/sdk-linux-x64-gnu": "3.
|
|
58
|
-
"@quicknode/sdk-linux-arm64-gnu": "3.
|
|
59
|
-
"@quicknode/sdk-linux-x64-musl": "3.
|
|
60
|
-
"@quicknode/sdk-linux-arm64-musl": "3.
|
|
61
|
-
"@quicknode/sdk-darwin-arm64": "3.
|
|
57
|
+
"@quicknode/sdk-linux-x64-gnu": "3.8.0",
|
|
58
|
+
"@quicknode/sdk-linux-arm64-gnu": "3.8.0",
|
|
59
|
+
"@quicknode/sdk-linux-x64-musl": "3.8.0",
|
|
60
|
+
"@quicknode/sdk-linux-arm64-musl": "3.8.0",
|
|
61
|
+
"@quicknode/sdk-darwin-arm64": "3.8.0"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/sdk.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
XrplWalletFilterTemplate,
|
|
17
17
|
HyperliquidWalletEventsFilterTemplate,
|
|
18
18
|
StellarWalletTransactionsFilterTemplate,
|
|
19
|
+
RpcApiClient,
|
|
19
20
|
} from "./index";
|
|
20
21
|
|
|
21
22
|
// Stream destination attributes (input). The inner key is `attributes` rather
|
|
@@ -326,8 +327,102 @@ export type {
|
|
|
326
327
|
ChainSchemaNode,
|
|
327
328
|
TableSchemaNode,
|
|
328
329
|
ColumnSchemaNode,
|
|
330
|
+
// rpc / tooling access
|
|
331
|
+
RpcConfig,
|
|
332
|
+
CachedToken,
|
|
333
|
+
ToolingAccessStatus,
|
|
334
|
+
RpcApiClient,
|
|
335
|
+
// payment lane
|
|
336
|
+
PaymentConfig,
|
|
329
337
|
} from "./index";
|
|
330
338
|
|
|
339
|
+
// A settlement receipt for the crypto-micropayment lane. Returned inside
|
|
340
|
+
// `RpcCallResponse.paymentReceipt` by `rpc.callWithReceipt`. `reference` is the
|
|
341
|
+
// settlement transaction hash. Present only on the MPP lane; `null` otherwise.
|
|
342
|
+
export interface PaymentReceipt {
|
|
343
|
+
method: string;
|
|
344
|
+
status: string;
|
|
345
|
+
timestamp: string;
|
|
346
|
+
reference: string;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// The result of `rpc.callWithReceipt`: the JSON-RPC `result` plus the optional
|
|
350
|
+
// settlement receipt (`null` for x402 and non-payment lanes).
|
|
351
|
+
export interface RpcCallResponse {
|
|
352
|
+
result: any;
|
|
353
|
+
paymentReceipt: PaymentReceipt | null;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// ── Payment lanes ──────────────────────────────────────────────
|
|
357
|
+
//
|
|
358
|
+
// Base-unit amounts are `string`, not `number`: they are u128 in the core and a
|
|
359
|
+
// JS number is an f64 that loses precision above 2^53. Pass and store them as
|
|
360
|
+
// decimal strings.
|
|
361
|
+
|
|
362
|
+
// An x402 gateway session (from `rpc.gatewayAuthenticate`). `token` is a live
|
|
363
|
+
// bearer credential — persist it, but keep it out of logs.
|
|
364
|
+
export interface GatewaySession {
|
|
365
|
+
token: string;
|
|
366
|
+
expUnix: number;
|
|
367
|
+
accountId: string;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// An x402 credit balance (`rpc.gatewayCredits` / `rpc.gatewayBuyCredits`).
|
|
371
|
+
export interface CreditBalance {
|
|
372
|
+
accountId: string;
|
|
373
|
+
credits: number;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// The faucet result (`rpc.gatewayDrip`): the on-chain funding transaction, NOT
|
|
377
|
+
// a balance. Call `rpc.gatewayCredits` afterwards to read the new balance.
|
|
378
|
+
export interface DripReceipt {
|
|
379
|
+
accountId: string;
|
|
380
|
+
transactionHash: string;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// Local state for an open MPP payment channel (`rpc.mppOpen` /
|
|
384
|
+
// `rpc.mppTopUp`). Persist this verbatim: the gateway has no read-only channel
|
|
385
|
+
// endpoint, so a lost record means opening a new channel.
|
|
386
|
+
export interface ChannelState {
|
|
387
|
+
channelId: string;
|
|
388
|
+
token: string;
|
|
389
|
+
payee: string;
|
|
390
|
+
salt: string;
|
|
391
|
+
authorizedSigner: string;
|
|
392
|
+
escrowContract: string;
|
|
393
|
+
/** Base units, decimal string. */
|
|
394
|
+
deposit: string;
|
|
395
|
+
/** Base units, decimal string. */
|
|
396
|
+
cumulativeSpent: string;
|
|
397
|
+
/** The gateway's per-call price, in base units, as a decimal string. */
|
|
398
|
+
perCall: string;
|
|
399
|
+
chainId: number;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// The gateway's view of a channel (`rpc.mppStatus`).
|
|
403
|
+
export interface ChannelStatus {
|
|
404
|
+
channelId: string;
|
|
405
|
+
/** Base units, decimal string. */
|
|
406
|
+
acceptedCumulative: string;
|
|
407
|
+
/** Base units, decimal string. */
|
|
408
|
+
spent: string;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// A freshly generated payment wallet (`generatePaymentWallet`). `key` is the raw
|
|
412
|
+
// private key, returned exactly once at generation — nothing in the SDK stores
|
|
413
|
+
// or re-derives it, so persist it before discarding the object.
|
|
414
|
+
export interface GeneratedWallet {
|
|
415
|
+
address: string;
|
|
416
|
+
chain: "evm" | "svm" | "tempo";
|
|
417
|
+
key: string;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Generates a fresh payment keypair. Offline: no network call, no funds.
|
|
422
|
+
* Randomness comes from the OS CSPRNG.
|
|
423
|
+
*/
|
|
424
|
+
export function generatePaymentWallet(chain: "evm" | "svm" | "tempo"): GeneratedWallet;
|
|
425
|
+
|
|
331
426
|
// const enums must use `export` (not `export type`) so they are usable as values
|
|
332
427
|
export {
|
|
333
428
|
StreamRegion,
|
|
@@ -392,6 +487,61 @@ export interface SqlApiClientTyped {
|
|
|
392
487
|
getSchema(clusterId: string): Promise<ChainSchemaNode>;
|
|
393
488
|
}
|
|
394
489
|
|
|
490
|
+
// Retypes the payment-lane returns from napi's `any` to the interfaces above.
|
|
491
|
+
// napi emits `any` for every method returning a `serde_json::Value`, so without
|
|
492
|
+
// this the declared payment interfaces would be documentation only and a
|
|
493
|
+
// mistyped field would not be an error. Keep method signatures in sync with the
|
|
494
|
+
// napi-generated RpcApiClient in ./index.d.ts.
|
|
495
|
+
export interface RpcApiClientTyped
|
|
496
|
+
extends Omit<
|
|
497
|
+
RpcApiClient,
|
|
498
|
+
| "callWithReceipt"
|
|
499
|
+
| "gatewayAuthenticate"
|
|
500
|
+
| "gatewayCredits"
|
|
501
|
+
| "gatewayBuyCredits"
|
|
502
|
+
| "gatewayDrip"
|
|
503
|
+
| "gatewayDrawdownCall"
|
|
504
|
+
| "mppOpen"
|
|
505
|
+
| "mppTopUp"
|
|
506
|
+
| "mppClose"
|
|
507
|
+
| "mppStatus"
|
|
508
|
+
| "mppSessionCall"
|
|
509
|
+
> {
|
|
510
|
+
callWithReceipt(
|
|
511
|
+
method: string,
|
|
512
|
+
params?: any | undefined | null,
|
|
513
|
+
network?: string | undefined | null,
|
|
514
|
+
endpointUrl?: string | undefined | null
|
|
515
|
+
): Promise<RpcCallResponse>;
|
|
516
|
+
gatewayAuthenticate(): Promise<GatewaySession>;
|
|
517
|
+
gatewayCredits(session: GatewaySession): Promise<CreditBalance>;
|
|
518
|
+
gatewayBuyCredits(
|
|
519
|
+
session: GatewaySession,
|
|
520
|
+
network: string
|
|
521
|
+
): Promise<CreditBalance>;
|
|
522
|
+
gatewayDrip(session: GatewaySession): Promise<DripReceipt>;
|
|
523
|
+
gatewayDrawdownCall(
|
|
524
|
+
method: string,
|
|
525
|
+
session: GatewaySession,
|
|
526
|
+
network: string,
|
|
527
|
+
params?: any | undefined | null
|
|
528
|
+
): Promise<any>;
|
|
529
|
+
mppOpen(deposit: string): Promise<ChannelState>;
|
|
530
|
+
mppTopUp(
|
|
531
|
+
channel: ChannelState,
|
|
532
|
+
additionalDeposit: string
|
|
533
|
+
): Promise<ChannelState>;
|
|
534
|
+
mppClose(channel: ChannelState): Promise<void>;
|
|
535
|
+
mppStatus(channel: ChannelState): Promise<ChannelStatus>;
|
|
536
|
+
mppSessionCall(
|
|
537
|
+
method: string,
|
|
538
|
+
network: string,
|
|
539
|
+
channel: ChannelState,
|
|
540
|
+
newCumulative: string,
|
|
541
|
+
params?: any | undefined | null
|
|
542
|
+
): Promise<any>;
|
|
543
|
+
}
|
|
544
|
+
|
|
395
545
|
export class QuicknodeSdk {
|
|
396
546
|
constructor(config: SdkFullConfig);
|
|
397
547
|
static fromEnv(): QuicknodeSdk;
|
|
@@ -400,6 +550,7 @@ export class QuicknodeSdk {
|
|
|
400
550
|
webhooks: WebhooksApiClientTyped;
|
|
401
551
|
kvstore: _QuicknodeSdk["kvstore"];
|
|
402
552
|
sql: SqlApiClientTyped;
|
|
553
|
+
rpc: RpcApiClientTyped;
|
|
403
554
|
}
|
|
404
555
|
|
|
405
556
|
// Typed static factory methods producing each discriminated variant of
|
|
@@ -450,3 +601,16 @@ export class ApiError extends QuicknodeError {
|
|
|
450
601
|
export class DecodeError extends QuicknodeError {
|
|
451
602
|
body: string;
|
|
452
603
|
}
|
|
604
|
+
export class RpcError extends QuicknodeError {
|
|
605
|
+
code: number;
|
|
606
|
+
}
|
|
607
|
+
// Payment-lane errors (crypto-micropayment `rpc.call`). Catch PaymentError to
|
|
608
|
+
// handle them all. PaymentIndeterminateError means the paid request was sent
|
|
609
|
+
// but its response was lost — the payment MAY have settled, so do NOT retry.
|
|
610
|
+
export class PaymentError extends QuicknodeError {}
|
|
611
|
+
export class PaymentUnsupportedError extends PaymentError {}
|
|
612
|
+
export class PaymentRejectedError extends PaymentError {
|
|
613
|
+
status: number;
|
|
614
|
+
body: string;
|
|
615
|
+
}
|
|
616
|
+
export class PaymentIndeterminateError extends PaymentError {}
|
package/sdk.js
CHANGED
|
@@ -16,6 +16,7 @@ class QuicknodeSdk {
|
|
|
16
16
|
this.webhooks = errors.wrapClient(this._inner.webhooks);
|
|
17
17
|
this.kvstore = errors.wrapClient(this._inner.kvstore);
|
|
18
18
|
this.sql = errors.wrapClient(this._inner.sql);
|
|
19
|
+
this.rpc = errors.wrapClient(this._inner.rpc);
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
static fromEnv() {
|
|
@@ -30,6 +31,7 @@ class QuicknodeSdk {
|
|
|
30
31
|
instance.webhooks = errors.wrapClient(instance._inner.webhooks);
|
|
31
32
|
instance.kvstore = errors.wrapClient(instance._inner.kvstore);
|
|
32
33
|
instance.sql = errors.wrapClient(instance._inner.sql);
|
|
34
|
+
instance.rpc = errors.wrapClient(instance._inner.rpc);
|
|
33
35
|
return instance;
|
|
34
36
|
}
|
|
35
37
|
}
|
|
@@ -76,10 +78,20 @@ class TemplateArgs {
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
// Translate module-level napi errors; wrapClient only handles clients.
|
|
82
|
+
function generatePaymentWallet(chain) {
|
|
83
|
+
try {
|
|
84
|
+
return _index.generatePaymentWallet(chain);
|
|
85
|
+
} catch (e) {
|
|
86
|
+
throw errors.fromNapiError(e);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
79
90
|
module.exports = {
|
|
80
91
|
..._index,
|
|
81
92
|
QuicknodeSdk,
|
|
82
93
|
TemplateArgs,
|
|
94
|
+
generatePaymentWallet,
|
|
83
95
|
QuicknodeError: errors.QuicknodeError,
|
|
84
96
|
ConfigError: errors.ConfigError,
|
|
85
97
|
HttpError: errors.HttpError,
|
|
@@ -87,4 +99,9 @@ module.exports = {
|
|
|
87
99
|
ConnectionError: errors.ConnectionError,
|
|
88
100
|
ApiError: errors.ApiError,
|
|
89
101
|
DecodeError: errors.DecodeError,
|
|
102
|
+
RpcError: errors.RpcError,
|
|
103
|
+
PaymentError: errors.PaymentError,
|
|
104
|
+
PaymentUnsupportedError: errors.PaymentUnsupportedError,
|
|
105
|
+
PaymentRejectedError: errors.PaymentRejectedError,
|
|
106
|
+
PaymentIndeterminateError: errors.PaymentIndeterminateError,
|
|
90
107
|
};
|
package/sdk.mjs
CHANGED
|
@@ -25,6 +25,8 @@ export const {
|
|
|
25
25
|
WebhooksApiClient,
|
|
26
26
|
KvStoreApiClient,
|
|
27
27
|
SqlApiClient,
|
|
28
|
+
RpcApiClient,
|
|
29
|
+
generatePaymentWallet,
|
|
28
30
|
QuicknodeError,
|
|
29
31
|
ConfigError,
|
|
30
32
|
HttpError,
|
|
@@ -32,4 +34,9 @@ export const {
|
|
|
32
34
|
ConnectionError,
|
|
33
35
|
ApiError,
|
|
34
36
|
DecodeError,
|
|
37
|
+
RpcError,
|
|
38
|
+
PaymentError,
|
|
39
|
+
PaymentUnsupportedError,
|
|
40
|
+
PaymentRejectedError,
|
|
41
|
+
PaymentIndeterminateError,
|
|
35
42
|
} = cjs;
|