Skip to main content

Installation

Published release: @grantex/sdk@0.8.2. The npm tarball matches the validated CI artifact; see Release Status.
The unpinned npm install @grantex/sdk command follows npm’s current latest tag. Keep the exact version above in reproducible builds. See Release Status before upgrading. Version 0.7.0 adds grantex.webauthn.createEnrollmentSession() for principal-authenticated hosted passkey registration and grantex.anomalies.getResponsePolicy() / setResponsePolicy() for the account-level irregularity response mode. Both server capabilities are default-off for self-hosted deployments and require explicit operator rollout; both are enabled on the Grantex-hosted service. Version 0.7.1 adds typed WebAuthnGrantEvidence references to grant and verification responses and the updated VC WebAuthn attestation. It does not enable hosted server flags or add custom assertion UI helper methods.
Version 0.8.2 requires Node.js 22.12+ and retains the 0.8.0 breaking enforcement defaults: audience binding, denial of capped calls without trusted amounts, and online revocation checks. Register allowed resource servers before audience-bound authorization. Signature-only verification is not current-state enforcement. Follow the migration guide.
SDK 0.6.0 introduced 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.1 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 22.12+ (uses native fetch and crypto)
  • ESM only — the package ships as "type": "module" with TypeScript NodeNext resolution

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

The Grantex client exposes the following sub-clients:

Standalone exports

These functions can be used without instantiating a Grantex client:

Error handling

All errors extend GrantexError. See the Error Handling reference for the full hierarchy and usage patterns.

Ownership

Grantex is owned by Orchestrum Technologies LLP. Inventor and owner: Sanjeev Kumar. Ownership contact: sanjeev@orchestrum.in or mishra.sanjeev@gmail.com.
Last modified on October 4, 2026