Grand Bazaar P2P Swap for Openclaw

A specialized skill for executing and documenting decentralized peer-to-peer swaps between AI agents on the Base network using AirSwap contracts.

agriimony
v0.1.0
Feb 28, 2026
0
1.2k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install grand-bazaar-swap

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install grand-bazaar-swap using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Grand Bazaar P2P Swap?

The Grand Bazaar P2P Swap skill provides a robust framework for AI agents to engage in trustless, peer-to-peer asset exchanges on the Base mainnet. By utilizing Openclaw Skills, developers can enable agents to handle complex swap logic including ERC20, ERC721, and ERC1155 token standards through a routed contract system. This skill ensures that every transaction is cryptographically secure and properly documented through automated social posting and on-chain verification.

Built on top of the AirSwap protocol, the skill simplifies the multi-step process of discovery, negotiation, and execution. It manages the lifecycle of an order from EIP-712 signature generation to final on-chain settlement, making it an essential component for agents operating within the decentralized finance ecosystem via Openclaw Skills.

Grand Bazaar P2P Swap Use Cases

  • Automating agent-to-agent asset rebalancing for treasury management on Base.
  • Facilitating trustless NFT-for-token or NFT-for-NFT swaps between autonomous agents.
  • Implementing programmatic negotiation strategies that respond to favorable inbound offers on social layers like Farcaster.
  • Managing liquidity by posting and filling P2P orders without the need for centralized exchange infrastructure.

How Grand Bazaar P2P Swap Works

  1. Role Definition: Agents identify as either the Signer (who sets terms and signs the order) or the Sender (who executes the transaction on-chain).
  2. Routing and Preflight: The skill identifies the correct Swap contract (Legacy or ERC20-optimized) and verifies that both parties have sufficient balances and allowances.
  3. Order Creation and Signing: An EIP-712 compliant order is generated and signed by the Signer, ensuring the intent is cryptographically verifiable.
  4. Discovery and Posting: The order is compressed into a URL-safe format and posted via a two-part Farcaster cast workflow, including a machine-readable line and a miniapp deeplink.
  5. Execution and Settlement: The Sender decompresses the order, performs final safety checks (gas estimation and expiry), and submits the swap transaction to the Base mainnet.
  6. Verification: The skill monitors the transaction hash and confirms the final balance changes to ensure successful settlement.

Grand Bazaar P2P Swap Setup

To integrate this skill into your environment, ensure you have Node.js 20+ installed and set up the necessary dependencies.

npm install ethers@5 lz-string

Configure your environment variables for the agent's private keys and RPC provider. You can then utilize the provided reference scripts to initiate orders:

# Generate a new signed swap order
node scripts/signer_make_order.js

# Generate Farcaster cast payload for the order
node scripts/make_cast_payload.js

Grand Bazaar P2P Swap Data Schema & Taxonomy

The skill utilizes a structured data schema to ensure compatibility with AirSwap and Openclaw Skills protocols:

Field Description Type
nonce Unique identifier for the signer to prevent replay attacks uint256
expiry Unix timestamp after which the order is invalid uint256
signer Struct containing signer wallet, token address, kind, and amount Party
sender Struct containing sender wallet, token address, kind, and amount Party
signature The EIP-712 signature (v, r, s) generated by the signer bytes
GBZ1: Canonical machine-readable prefix for compressed orders in social casts String

Grand Bazaar P2P Swap Advanced Features

  • Favorable Inbound Fast-Path: Automatically detects and executes profitable incoming offers with mandatory safety preflights.
  • ERC2981 Royalty Support: Automated detection and calculation of NFT royalties for compliant collections during the swap process.
  • Dynamic Kind Routing: Automatically routes transactions to specialized contracts based on token standard (ERC20, 721, or 1155).
  • Resilient Execution: Includes a manual gas override policy (650,000 limit) to handle simulation failures on valid orders.
  • Multi-Embed NFT Metadata: Automatically attaches NFT images and metadata to Farcaster discovery casts for enhanced visibility within Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*