MonmouthMonmouth Docs

Quickstart

Installation

Install the Monmouth Wallet SDK:

npm install @monmouth/wallet-sdk

Register an Agent Identity

Every agent needs an on-chain identity before it can transact:

import { MonmouthIdentity } from '@monmouth/wallet-sdk'
 
const identity = await MonmouthIdentity.register({
  metadata: {
    name: 'MyAgent-001',
    capabilities: ['swap', 'transfer'],
    owner: '0x...',
  },
  guardians: [
    { address: '0x...', role: 'owner' },
  ],
})
 
console.log(identity.did)
// → did:monmouth:agent:0x...

Initialize the Agent Wallet

import { MonmouthWallet } from '@monmouth/wallet-sdk'
 
const wallet = new MonmouthWallet({
  // Agent identity
  agentDid: identity.did,
 
  // Guardrails configuration
  guardrails: {
    maxTransactionValue: '1 ETH',
    allowedContracts: ['0x...'],
    dailySpendingLimit: '10 ETH',
  },
 
  // Policy enforcement
  policies: {
    requireApprovalAbove: '5 ETH',
    blockedOperations: ['selfdestruct'],
  }
})

Execute an Intent

// Describe what the agent wants to do
const intent = {
  type: 'swap',
  fromToken: 'ETH',
  toToken: 'USDC',
  amount: '0.5 ETH',
  maxSlippage: '0.5%',
}
 
// Monmouth handles routing and execution
const result = await wallet.executeIntent(intent)
 
console.log(result.transactionHash)
// → 0x...

Cross-Chain Operations

// Execute cross-chain via SVM Router
const result = await wallet.executeIntent({
  type: 'cross-chain',
  targetChain: 'solana',
  intent: {
    type: 'swap',
    fromToken: 'SOL',
    toToken: 'USDC',
    amount: '10 SOL',
  }
})

Check Reputation

const reputation = await identity.getReputation()
 
console.log(reputation)
// {
//   trustScore: 94.2,
//   totalTransactions: 1542,
//   successRate: 0.998,
// }

Next Steps

On this page