@mandate.md/sdk:
MandateConfig
Base configuration forMandateClient. Pass your runtime key and an optional custom API URL.
| Field | Type | Required | Description |
|---|---|---|---|
runtimeKey | string | Yes | Your mndt_live_... or mndt_test_... runtime key |
baseUrl | string | No | Mandate API URL. Defaults to https://app.mandate.md |
MandateWalletConfig
Configuration forMandateWallet. Extends MandateConfig with chain and signer options. You must provide either privateKey or signer, not both.
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Target chain ID (e.g. 84532 for Base Sepolia, 8453 for Base) |
privateKey | `0x${string}` | No | Raw hex private key. Use this for simple setups. |
signer | ExternalSigner | No | External wallet adapter. Use this for AgentKit, Privy, or custom signers. |
rpcUrl | string | No | Custom RPC endpoint. Defaults to Base Sepolia/Base public RPCs. |
PreflightPayload
Input for the action-basedvalidate() method on MandateClient. Describes the intended action in human-readable terms.
| Field | Type | Required | Description |
|---|---|---|---|
action | string | Yes | Action type (e.g. "transfer", "swap", "approve") |
amount | string | No | Human-readable amount (e.g. "5.00") |
to | string | No | Destination address |
token | string | No | Token symbol or address (e.g. "USDC") |
reason | string | Yes | Why the agent wants to perform this action |
chain | string | No | Chain name or ID (e.g. "base-sepolia") |
PreflightResult
Response fromvalidate(). Extends ValidateResult with the action field echoed back.
| Field | Type | Description |
|---|---|---|
allowed | boolean | Whether the action is permitted |
intentId | string | null | Intent ID if a reservation was created |
requiresApproval | boolean | Whether human approval is needed |
approvalId | string | null | Approval request ID, if applicable |
approvalReason | string | null | Why approval is required |
blockReason | string | null | Reason code if blocked |
blockDetail | string | null | Additional detail about the block |
action | string | The action that was evaluated |
ValidateResult
Response fromrawValidate(). Contains the policy decision and intent metadata.
| Field | Type | Description |
|---|---|---|
allowed | boolean | Whether the transaction is permitted |
intentId | string | null | Intent ID for tracking. null if blocked. |
requiresApproval | boolean | Whether human approval is needed before proceeding |
approvalId | string | null | Approval request ID for polling |
approvalReason | string | null | Human-readable reason for requiring approval |
blockReason | string | null | Machine-readable block reason (e.g. spend_limit_exceeded) |
blockDetail | string | null | Additional context from the policy engine |
IntentPayload
Full transaction parameters forrawValidate(). Used in self-custodial signing flows where you compute gas parameters yourself.
| Field | Type | Required | Description |
|---|---|---|---|
chainId | number | Yes | Target chain ID |
nonce | number | Yes | Sender’s transaction nonce |
to | `0x${string}` | Yes | Destination address |
calldata | `0x${string}` | Yes | Encoded transaction data (0x for native transfers) |
valueWei | string | Yes | Native token value in wei |
gasLimit | string | Yes | Gas limit |
maxFeePerGas | string | Yes | EIP-1559 max fee per gas |
maxPriorityFeePerGas | string | Yes | EIP-1559 priority fee per gas |
txType | number | No | Transaction type. Defaults to 2 (EIP-1559). |
accessList | unknown[] | No | EIP-2930 access list. Defaults to []. |
intentHash | `0x${string}` | Yes | Keccak256 hash of canonical tx params. See Intent Hash. |
reason | string | Yes | Why the agent is making this transaction |
IntentStatus
Status of a tracked intent. Returned bygetStatus(), waitForApproval(), and waitForConfirmation().
| Field | Type | Description |
|---|---|---|
intentId | string | Unique intent identifier |
status | string | Current state: reserved, approval_pending, approved, broadcasted, confirmed, failed, or expired |
txHash | string | null | On-chain transaction hash (set after broadcast) |
blockNumber | string | null | Block number where tx was confirmed |
gasUsed | string | null | Actual gas consumed |
amountUsd | string | null | USD value of the transaction |
decodedAction | string | null | Human-readable decoded action (e.g. "transfer 5 USDC") |
summary | string | null | One-line summary of the transaction |
blockReason | string | null | Reason if the intent was blocked or failed |
requiresApproval | boolean | Whether approval is still pending |
approvalId | string | null | Approval request ID |
expiresAt | string | null | ISO 8601 expiration timestamp for approval window |
RegisterResult
Response fromMandateClient.register(). Contains credentials for the newly registered agent.
| Field | Type | Description |
|---|---|---|
agentId | string | Unique agent identifier |
runtimeKey | string | Runtime key (mndt_live_... or mndt_test_...) for API auth |
claimUrl | string | URL for the agent owner to claim and link the agent to their dashboard |
evmAddress | string | The agent’s EVM wallet address |
chainId | number | The chain the agent registered on |
ExternalSigner
Interface for plugging in any wallet that can send transactions. Implement this to use AgentKit, Privy, or any custom wallet withMandateWallet.
| Method | Returns | Description |
|---|---|---|
sendTransaction(tx) | Promise<\0x$`>` | Sign and broadcast the transaction. Return the tx hash. |
getAddress() | Promise<\0x$`> | `0x$“ | Return the wallet address. Can be sync or async. |
tx object passed to sendTransaction contains all fields needed for an EIP-1559 transaction. maxFeePerGas, maxPriorityFeePerGas, and nonce are optional because some signers manage these internally.
TransferResult
Returned byMandateWallet.transfer(), sendTransaction(), and related methods. Contains the transaction hash, intent ID, and final status.
| Field | Type | Description |
|---|---|---|
txHash | Hash | On-chain transaction hash (viem Hash type, which is `0x${string}`) |
intentId | string | Mandate intent ID for audit trail and status polling |
status | IntentStatus | Final intent status after broadcast and optional confirmation wait |
MandateClient
Low-level API client that uses these types.
MandateWallet
High-level wallet wrapper with signing and broadcasting.
Errors
Error classes thrown when validation fails.