Skip to main content
Every type listed here is exported from @mandate.md/sdk:
import type {
  MandateConfig,
  MandateWalletConfig,
  PreflightPayload,
  PreflightResult,
  ValidateResult,
  IntentPayload,
  IntentStatus,
  RegisterResult,
  ExternalSigner,
  TransferResult,
} from '@mandate.md/sdk';

MandateConfig

Base configuration for MandateClient. Pass your runtime key and an optional custom API URL.
interface MandateConfig {
  runtimeKey: string;
  baseUrl?: string;
}
FieldTypeRequiredDescription
runtimeKeystringYesYour mndt_live_... or mndt_test_... runtime key
baseUrlstringNoMandate API URL. Defaults to https://app.mandate.md

MandateWalletConfig

Configuration for MandateWallet. Extends MandateConfig with chain and signer options. You must provide either privateKey or signer, not both.
interface MandateWalletConfig extends MandateConfig {
  chainId: number;
  privateKey?: `0x${string}`;
  signer?: ExternalSigner;
  rpcUrl?: string;
}
FieldTypeRequiredDescription
chainIdnumberYesTarget chain ID (e.g. 84532 for Base Sepolia, 8453 for Base)
privateKey`0x${string}`NoRaw hex private key. Use this for simple setups.
signerExternalSignerNoExternal wallet adapter. Use this for AgentKit, Privy, or custom signers.
rpcUrlstringNoCustom RPC endpoint. Defaults to Base Sepolia/Base public RPCs.

PreflightPayload

Input for the action-based validate() method on MandateClient. Describes the intended action in human-readable terms.
interface PreflightPayload {
  action: string;
  amount?: string;
  to?: string;
  token?: string;
  reason: string;
  chain?: string;
}
FieldTypeRequiredDescription
actionstringYesAction type (e.g. "transfer", "swap", "approve")
amountstringNoHuman-readable amount (e.g. "5.00")
tostringNoDestination address
tokenstringNoToken symbol or address (e.g. "USDC")
reasonstringYesWhy the agent wants to perform this action
chainstringNoChain name or ID (e.g. "base-sepolia")

PreflightResult

Response from validate(). Extends ValidateResult with the action field echoed back.
interface PreflightResult extends ValidateResult {
  action: string;
}
FieldTypeDescription
allowedbooleanWhether the action is permitted
intentIdstring | nullIntent ID if a reservation was created
requiresApprovalbooleanWhether human approval is needed
approvalIdstring | nullApproval request ID, if applicable
approvalReasonstring | nullWhy approval is required
blockReasonstring | nullReason code if blocked
blockDetailstring | nullAdditional detail about the block
actionstringThe action that was evaluated

ValidateResult

Response from rawValidate(). Contains the policy decision and intent metadata.
interface ValidateResult {
  allowed: boolean;
  intentId: string | null;
  requiresApproval: boolean;
  approvalId: string | null;
  approvalReason?: string | null;
  blockReason: string | null;
  blockDetail?: string | null;
}
FieldTypeDescription
allowedbooleanWhether the transaction is permitted
intentIdstring | nullIntent ID for tracking. null if blocked.
requiresApprovalbooleanWhether human approval is needed before proceeding
approvalIdstring | nullApproval request ID for polling
approvalReasonstring | nullHuman-readable reason for requiring approval
blockReasonstring | nullMachine-readable block reason (e.g. spend_limit_exceeded)
blockDetailstring | nullAdditional context from the policy engine

IntentPayload

Full transaction parameters for rawValidate(). Used in self-custodial signing flows where you compute gas parameters yourself.
interface IntentPayload {
  chainId: number;
  nonce: number;
  to: `0x${string}`;
  calldata: `0x${string}`;
  valueWei: string;
  gasLimit: string;
  maxFeePerGas: string;
  maxPriorityFeePerGas: string;
  txType?: number;
  accessList?: unknown[];
  intentHash: `0x${string}`;
  reason: string;
}
FieldTypeRequiredDescription
chainIdnumberYesTarget chain ID
noncenumberYesSender’s transaction nonce
to`0x${string}`YesDestination address
calldata`0x${string}`YesEncoded transaction data (0x for native transfers)
valueWeistringYesNative token value in wei
gasLimitstringYesGas limit
maxFeePerGasstringYesEIP-1559 max fee per gas
maxPriorityFeePerGasstringYesEIP-1559 priority fee per gas
txTypenumberNoTransaction type. Defaults to 2 (EIP-1559).
accessListunknown[]NoEIP-2930 access list. Defaults to [].
intentHash`0x${string}`YesKeccak256 hash of canonical tx params. See Intent Hash.
reasonstringYesWhy the agent is making this transaction

IntentStatus

Status of a tracked intent. Returned by getStatus(), waitForApproval(), and waitForConfirmation().
interface IntentStatus {
  intentId: string;
  status: 'reserved' | 'approval_pending' | 'approved' | 'broadcasted' | 'confirmed' | 'failed' | 'expired';
  txHash: string | null;
  blockNumber: string | null;
  gasUsed: string | null;
  amountUsd: string | null;
  decodedAction: string | null;
  summary: string | null;
  blockReason: string | null;
  requiresApproval: boolean;
  approvalId: string | null;
  expiresAt: string | null;
}
FieldTypeDescription
intentIdstringUnique intent identifier
statusstringCurrent state: reserved, approval_pending, approved, broadcasted, confirmed, failed, or expired
txHashstring | nullOn-chain transaction hash (set after broadcast)
blockNumberstring | nullBlock number where tx was confirmed
gasUsedstring | nullActual gas consumed
amountUsdstring | nullUSD value of the transaction
decodedActionstring | nullHuman-readable decoded action (e.g. "transfer 5 USDC")
summarystring | nullOne-line summary of the transaction
blockReasonstring | nullReason if the intent was blocked or failed
requiresApprovalbooleanWhether approval is still pending
approvalIdstring | nullApproval request ID
expiresAtstring | nullISO 8601 expiration timestamp for approval window

RegisterResult

Response from MandateClient.register(). Contains credentials for the newly registered agent.
interface RegisterResult {
  agentId: string;
  runtimeKey: string;
  claimUrl: string;
  evmAddress: string;
  chainId: number;
}
FieldTypeDescription
agentIdstringUnique agent identifier
runtimeKeystringRuntime key (mndt_live_... or mndt_test_...) for API auth
claimUrlstringURL for the agent owner to claim and link the agent to their dashboard
evmAddressstringThe agent’s EVM wallet address
chainIdnumberThe 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 with MandateWallet.
interface ExternalSigner {
  sendTransaction(tx: {
    to: `0x${string}`;
    data: `0x${string}`;
    value: bigint;
    gas: bigint;
    maxFeePerGas?: bigint;
    maxPriorityFeePerGas?: bigint;
    nonce?: number;
  }): Promise<`0x${string}`>;
  getAddress(): Promise<`0x${string}`> | `0x${string}`;
}
MethodReturnsDescription
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.
The 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 by MandateWallet.transfer(), sendTransaction(), and related methods. Contains the transaction hash, intent ID, and final status.
interface TransferResult {
  txHash: Hash;
  intentId: string;
  status: IntentStatus;
}
FieldTypeDescription
txHashHashOn-chain transaction hash (viem Hash type, which is `0x${string}`)
intentIdstringMandate intent ID for audit trail and status polling
statusIntentStatusFinal 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.