Get the FREE Ultimate OpenClaw Setup Guide →

pubfi-walletconnect-transactions

Scanned
npx machina-cli add skill helixbox/pubfi-skills/pubfi-walletconnect-transactions --openclaw
Files (1)
SKILL.md
8.4 KB

PubFi WalletConnect Transactions

Connect wallet via QR code and execute blockchain transactions with WalletConnect

Overview

This skill enables users to:

  1. Connect their crypto wallet by scanning a WalletConnect QR code
  2. Execute blockchain transactions using standard ethers.TransactionRequest format
  3. Sign and broadcast transactions for any Ethereum-compatible operations
  4. Receive transaction confirmations with block explorer links

The skill uses WalletConnect v2 protocol for secure wallet connections and supports Ethereum and EVM-compatible chains.

Rules

  1. No Mock Data: All transactions must be real blockchain operations
  2. User Confirmation Required: Never auto-sign; always request user signature approval
  3. Network Validation: Verify wallet is connected to the correct network before transaction
  4. Gas Estimation: Always estimate gas and show costs before signing
  5. Real-time Data: All transaction data must be current (prices, balances, etc.)
  6. Security First: Never request or store private keys; WalletConnect handles key management

Inputs

Required Parameters

  • transaction: Standard ethers.TransactionRequest object
    • Format: JSON object with transaction parameters
    • Example:
      {
        to: '0x932460072495a5eaa5029289b342c6186715f5a0',
        value: ethers.parseEther('0.0001'),
        data: '0x...' // optional contract call data
      }
      

Optional Parameters

  • chain: Blockchain network
    • Default: ethereum (mainnet)
    • Supported: ethereum, polygon, arbitrum, optimism, base

Environment Variables

  • WALLETCONNECT_PROJECT_ID (required): WalletConnect Cloud project ID

  • RPC_ENDPOINT_ETHEREUM (optional): Custom Ethereum RPC endpoint

    • Default: Public RPC endpoint

Execution Workflow

Step 1: Initialize WalletConnect Session

  1. Load WalletConnect project ID from environment
  2. Create SignClient instance with metadata
  3. Generate pairing URI and display QR code in terminal
  4. Wait for user to scan QR code with wallet app
  5. Establish session and retrieve connected wallet address
  6. Verify connected chain matches requested chain

Step 2: Prepare Transaction

  1. Accept standard ethers.TransactionRequest object
  2. Set default values if not provided:
    • from: Use connected wallet address
    • chainId: Use selected chain ID
    • gasLimit: Estimate gas if not provided
    • gasPrice or EIP-1559 fees: Fetch current network fees
  3. Validate transaction parameters

Step 3: Request Signature

  1. Format transaction request according to WalletConnect JSON-RPC spec
  2. Display transaction summary to user:
    • From: Connected wallet address
    • To: Recipient or contract address
    • Value: ETH amount
    • Gas Limit: Estimated gas limit
  3. Send eth_sendTransaction request via WalletConnect
  4. Wait for user to approve/reject in wallet app
  5. Handle user response (approved or rejected)

Step 4: Broadcast and Confirm

  1. If approved, receive signed transaction hash from wallet
  2. Broadcast transaction to blockchain network
  3. Monitor transaction status (pending → confirmed)
  4. Wait for transaction confirmation (1+ blocks)
  5. Generate output report with transaction details

Step 5: Close Session (Optional)

  1. Keep session active for subsequent transactions
  2. Allow user to disconnect when done
  3. Clean up resources and close WalletConnect client

Output Format

# WalletConnect Transaction Report

> **Chain**: {chain_name} | **Wallet**: {wallet_address} | **Status**: {status}
> **Timestamp**: {utc_timestamp}

---

## Transaction Details

| Field | Value |
|-------|-------|
| **From** | {from_address} |
| **To** | {to_address} |
| **Value** | {value} ETH |
| **Gas Used** | {gas_used} |
| **Transaction Hash** | {tx_hash} |
| **Block Number** | {block_number} |

**Block Explorer**: [View Transaction]({explorer_url})

---

## Summary

{transaction_summary}

- **Executed At**: {utc_timestamp}

---

*Generated by PubFi WalletConnect Transactions*

Example Output

# WalletConnect Transaction Report

> **Chain**: Ethereum Mainnet | **Wallet**: 0x742d...8a9c | **Status**: SUCCESS
> **Timestamp**: 2026-02-09T10:30:45Z

---

## Transaction Details

| Field | Value |
|-------|-------|
| **From** | 0x932460072495a5eaa5029289b342c6186715f5a0 |
| **To** | 0x932460072495a5eaa5029289b342c6186715f5a0 |
| **Value** | 0.0001 ETH |
| **Gas Used** | 21000 |
| **Transaction Hash** | 0xabc123...def456 |
| **Block Number** | 19123456 |

**Block Explorer**: [View Transaction](https://etherscan.io/tx/0xabc123...def456)

---

## Summary

Successfully executed transaction on Ethereum Mainnet

- **Executed At**: 2026-02-09T10:30:45Z

---

*Generated by PubFi WalletConnect Transactions*

Error Handling

Error TypeConditionAction
Missing Project IDWALLETCONNECT_PROJECT_ID not setReturn error message with setup instructions
Connection TimeoutNo wallet connects within timeout periodReturn error and suggest checking wallet app
User RejectionUser declines connection or signatureReturn message indicating user cancelled action
Insufficient BalanceWallet lacks funds for transaction + gasReturn error with current balance and required amount
Invalid AddressRecipient address malformed or invalidReturn error and request valid address format
Network MismatchWallet on different chain than requestedPrompt user to switch network in wallet
Gas Estimation FailedCannot estimate gas for transactionReturn error with possible reasons (contract issue, etc.)
Transaction RevertedOn-chain transaction failedReturn revert reason and transaction hash for debugging
RPC ErrorNetwork connectivity or RPC issuesReturn error and suggest checking network connection
Unsupported ChainRequested chain not supportedReturn list of supported chains
Invalid TransactionTransaction parameters invalidReturn error with validation details

Supported Operations

This skill accepts any valid ethers.TransactionRequest, supporting:

  • ETH Transfers: Simple value transfers
  • Contract Interactions: Any contract call via data field
  • ERC20 Operations: Token transfers, approvals (user provides encoded data)
  • DeFi Interactions: Any protocol interaction (user provides encoded data)
  • Custom Transactions: Any Ethereum-compatible transaction

Security Considerations

  1. Never Store Private Keys: All key management handled by user's wallet
  2. Verify Addresses: Always display full addresses before signing
  3. Gas Limits: Set reasonable limits to prevent excessive costs
  4. Contract Verification: Only interact with verified contracts
  5. Amount Validation: Double-check amounts to prevent decimal errors

Dependencies

  • @walletconnect/sign-client: WalletConnect v2 SDK
  • ethers: Ethereum library for transaction building
  • qrcode-terminal: Display QR codes in CLI
  • dotenv: Environment variable management

Implementation Notes

  1. This skill requires Node.js runtime (v16+ recommended)
  2. Scripts are written in TypeScript and compiled to JavaScript
  3. Users must have a WalletConnect-compatible wallet (MetaMask, Rainbow, etc.)
  4. Session can persist for multiple transactions until disconnected
  5. All timestamps are in UTC with ISO 8601 format
  6. Transaction encoding/preparation is handled by the caller
  7. The skill focuses on core WalletConnect connection and transaction signing

Usage Example

import { WalletConnectTransactionManager } from './walletconnect_transactions';
import { ethers } from 'ethers';

const manager = new WalletConnectTransactionManager('ethereum');

// Connect wallet
await manager.connect();

// Send ETH
const tx: ethers.TransactionRequest = {
  to: '0x932460072495a5eaa5029289b342c6186715f5a0',
  value: ethers.parseEther('0.0001')
};

const result = await manager.sendTransaction(tx);

// Generate report
const report = manager.generateReport(result, tx);
console.log(report);

// Disconnect
await manager.disconnect();

Source

git clone https://github.com/helixbox/pubfi-skills/blob/main/skills/pubfi-walletconnect-transactions/SKILL.mdView on GitHub

Overview

Connect your wallet by scanning a WalletConnect QR code and send ETH or ERC20 tokens on Ethereum and other EVM chains like Polygon, Arbitrum, Optimism, and Base. Transactions are built as standard transaction requests, signed via WalletConnect, and confirmed with block explorer links. The flow emphasizes network validation and real-time gas estimation for safe, transparent transfers.

How This Skill Works

Uses WalletConnect v2 to establish a secure session, then prepares a standard transaction request with from, to, value and data. It asks the user to approve in their wallet app, signs, and broadcasts the transaction on the selected chain, providing a status update and explorer link.

When to Use It

  • Sending ETH or ERC20 tokens on Ethereum or compatible chains (Polygon, Arbitrum, Optimism, Base).
  • You want wallet custody without exposing private keys since WalletConnect handles signing.
  • You need to sign transactions via a QR code from a terminal or a non-wallet app.
  • You require real-time gas estimation and fee visibility before approving.
  • You want a full transaction lifecycle with confirmations and explorer links.

Quick Start

  1. Step 1: Set WALLETCONNECT_PROJECT_ID in your environment (and configure optional RPC endpoints).
  2. Step 2: Initialize WalletConnect SignClient, generate a pairing QR code, and scan with your wallet app.
  3. Step 3: Create a transaction object, review details in your wallet, approve, and monitor the broadcast.

Best Practices

  • Always confirm that the connected wallet is on the intended network before signing.
  • Estimate gas and review the gas price or fee forecast prior to approval.
  • Never share or store private keys; rely on WalletConnect for signing.
  • Double check the recipient address and amount in the wallet before approving.
  • Disconnect and clean up the WalletConnect session after completing a transaction.

Example Use Cases

  • Send 0.01 ETH to 0xRecipient on Ethereum mainnet via WalletConnect.
  • Transfer 100 USDC to 0xRecipient on Polygon.
  • Send 0.5 ETH to 0xRecipient on Arbitrum.
  • Pay 0.3 ETH to 0xRecipient on Optimism.
  • Send 50 USDT to 0xRecipient on Base.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers