Installation
Published release:@grantex/sdk@0.6.0. npm integrity, exact-version
clean installation, public exports, and a zero-vulnerability consumer audit
were verified on 7 September 2026.
npm install @grantex/sdk command follows npm’s current latest
tag. Keep the exact version above in reproducible builds. See
Release Status before upgrading.
SDK
0.6.0 includes PrepaidWalletAgentClient,
PrincipalPrepaidWalletClient, and DeveloperPrepaidWalletPolicyClient with
safe assignment defaults, layered policy, exact approval, semantic context, and
reload governance. Version 0.6.0 also adds EVM payment responses and
reconcileReservation() to principal and agent wallet clients. Pair it with
@grantex/x402@0.4.0 for opt-in Base USDC 402/sign/retry. External custody
remains fail-closed until the operator configures the Base custody/RPC adapter
or supplies another verified provider. See x402
Prepaid Wallets and Agent Wallet
Governance.Requirements
- Node.js 18+ (uses native
fetchandcrypto) - ESM only — the package ships as
"type": "module"with TypeScriptNodeNextresolution
Configuration
Options
string
required
Your Grantex API key. Falls back to the
GRANTEX_API_KEY environment variable if omitted.string
default:"https://api.grantex.dev"
Base URL for the Grantex API. Override for self-hosted or local development.
number
default:"30000"
Request timeout in milliseconds. The SDK uses
AbortController to enforce the deadline.Quick start
The complete authorization flow in one script:Available resources
TheGrantex client exposes the following sub-clients:
Standalone exports
These functions can be used without instantiating aGrantex client:
Error handling
All errors extendGrantexError. See the Error Handling reference for the full hierarchy and usage patterns.