AgentSkillsCN

nerve-agent-payment

将 AI 代理与 Nerve 网络集成,用于支付——创建/验证地址、查询余额与资产、接收与支付。使用 Nerve RPC MCP 进行只读查询,并参考 NerveSwap SDK 实现转账与兑换。当用户或代理需要 Nerve 支付、接收、支付、查询余额、Nerve 地址,或进行 NerveSwap 交易时使用。

SKILL.md
--- frontmatter
name: nerve-agent-payment
description: Integrates AI Agents with Nerve network for payments—create/validate addresses, check balances and assets, receive and pay. Uses Nerve RPC MCP for read-only queries and refers to NerveSwap SDK for transfers and swaps. Use when the user or agent needs Nerve payment, receiving, paying, balance check, Nerve address, or NerveSwap.

Nerve Agent payment integration

Use Nerve as native payment in AI Agents: no gas, fast confirmation, decentralized, locally managed accounts.

When to use this Skill

  • User or Agent needs: receive, pay, check balance, create/validate Nerve address, NerveSwap.
  • Add “economic” capability to the Agent using Nerve (no gas, suited for high-frequency small payments).

Prerequisites

  • Nerve RPC MCP is configured and available (tools: nerve_info, nerve_get_balance_list, nerve_get_account_balance, nerve_validate_address, nerve_get_tx, etc.).
  • Nerve mainnet chainId is usually 9; assets use assetChainId + assetId or key chainId-assetId (e.g. 9-1).

Receiver: create address, receive, query amount and currency

1. Create address

  • Local (recommended): Use nerve-sdk-js (nerve.newAddress(chainId, password, prefix) or nerve.importByKey(...)). Mainnet chainId is usually 9; see official docs for prefix.
  • With EVM wallet: Use NerveSwap SDK getAccount({ provider, address, message }) to get address.NERVE and pub.
  • Keep the private key only locally or in Agent secure storage; no custody.

2. How to receive

  • Share your Nerve address (e.g. TNVT...) with the payer; they send to that address.

3. Query received amount and currency (MCP only, no private key)

NeedMCP toolExample params
All asset balances for addressnerve_get_balance_listchainId=9, address=receive address
Single asset balancenerve_get_account_balancechainId, assetChainId, assetId, address
Validate addressnerve_validate_addresschainId=9, address
Chain/asset infonerve_infono params

Use nerve_get_balance_list to see which currencies and amounts were received; use nerve_get_account_balance to confirm one currency.

Payer: query balance, pay directly, pay after swap

1. Query payer address assets

  • Call nerve_get_balance_list(chainId, fromAddress) to get all assets and balances (symbol, balance, etc.).

2. Pay directly (when you have enough of the target asset)

  • Use NerveSwap SDK: nerveswap.transfer.transfer({ provider, from, to, assetChainId, assetId, amount, remark, type, EVMAddress, pub }).
  • Signing (provider + EVMAddress + pub) must be done locally/in the Agent; can be combined with nerve-sdk-js for local signing.

3. Pay after NerveSwap

  • Quote: swap.getSwapInfo({ fromAssetKey, toAssetKey, amount, direction }) (key format chainId-assetId).
  • Swap: swap.swapTrade({ provider, from, fromAssetKey, toAssetKey, amount, slippage, remark, EVMAddress, pub }).
  • Transfer: nerveswap.transfer.transfer(...) to send the swapped asset to the receiver.

All signing is done locally; the private key never leaves the device.

Protocol and accounts

  • Decentralized: Nerve is a public chain; assets and txs are confirmed on-chain.
  • Accounts: Generated and managed locally (nerve-sdk-js or wallet); no custodial service.
  • Receive: Share Nerve address and use RPC MCP to query balance and currency.
  • Pay: Pay from address assets directly or after NerveSwap; signing is local.

MCP tools quick reference

ToolUse
nerve_infoChain info, default asset, chainId
nerve_validate_addressValidate Nerve address
nerve_get_balance_listAll asset balances for an address (receive/pay)
nerve_get_account_balanceSingle asset balance for an address
nerve_get_txTransaction by hash
nerve_jsonrpcCall any Nerve JSON-RPC method

Amounts and precision

  • On-chain amounts are usually in smallest units (e.g. 8 decimals ⇒ 1 NVT = 10^8). Use smallest units when calling RPC/SDK; divide by 10^decimals when showing to users.

Further reading