pubfi-walletconnect-transactions
Scannednpx machina-cli add skill helixbox/pubfi-skills/pubfi-walletconnect-transactions --openclawPubFi WalletConnect Transactions
Connect wallet via QR code and execute blockchain transactions with WalletConnect
Overview
This skill enables users to:
- Connect their crypto wallet by scanning a WalletConnect QR code
- Execute blockchain transactions using standard ethers.TransactionRequest format
- Sign and broadcast transactions for any Ethereum-compatible operations
- 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
- No Mock Data: All transactions must be real blockchain operations
- User Confirmation Required: Never auto-sign; always request user signature approval
- Network Validation: Verify wallet is connected to the correct network before transaction
- Gas Estimation: Always estimate gas and show costs before signing
- Real-time Data: All transaction data must be current (prices, balances, etc.)
- 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
- Default:
Environment Variables
-
WALLETCONNECT_PROJECT_ID (required): WalletConnect Cloud project ID
- Obtain from: https://cloud.walletconnect.com/
-
RPC_ENDPOINT_ETHEREUM (optional): Custom Ethereum RPC endpoint
- Default: Public RPC endpoint
Execution Workflow
Step 1: Initialize WalletConnect Session
- Load WalletConnect project ID from environment
- Create SignClient instance with metadata
- Generate pairing URI and display QR code in terminal
- Wait for user to scan QR code with wallet app
- Establish session and retrieve connected wallet address
- Verify connected chain matches requested chain
Step 2: Prepare Transaction
- Accept standard ethers.TransactionRequest object
- Set default values if not provided:
from: Use connected wallet addresschainId: Use selected chain IDgasLimit: Estimate gas if not providedgasPriceor EIP-1559 fees: Fetch current network fees
- Validate transaction parameters
Step 3: Request Signature
- Format transaction request according to WalletConnect JSON-RPC spec
- Display transaction summary to user:
- From: Connected wallet address
- To: Recipient or contract address
- Value: ETH amount
- Gas Limit: Estimated gas limit
- Send
eth_sendTransactionrequest via WalletConnect - Wait for user to approve/reject in wallet app
- Handle user response (approved or rejected)
Step 4: Broadcast and Confirm
- If approved, receive signed transaction hash from wallet
- Broadcast transaction to blockchain network
- Monitor transaction status (pending → confirmed)
- Wait for transaction confirmation (1+ blocks)
- Generate output report with transaction details
Step 5: Close Session (Optional)
- Keep session active for subsequent transactions
- Allow user to disconnect when done
- 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 Type | Condition | Action |
|---|---|---|
| Missing Project ID | WALLETCONNECT_PROJECT_ID not set | Return error message with setup instructions |
| Connection Timeout | No wallet connects within timeout period | Return error and suggest checking wallet app |
| User Rejection | User declines connection or signature | Return message indicating user cancelled action |
| Insufficient Balance | Wallet lacks funds for transaction + gas | Return error with current balance and required amount |
| Invalid Address | Recipient address malformed or invalid | Return error and request valid address format |
| Network Mismatch | Wallet on different chain than requested | Prompt user to switch network in wallet |
| Gas Estimation Failed | Cannot estimate gas for transaction | Return error with possible reasons (contract issue, etc.) |
| Transaction Reverted | On-chain transaction failed | Return revert reason and transaction hash for debugging |
| RPC Error | Network connectivity or RPC issues | Return error and suggest checking network connection |
| Unsupported Chain | Requested chain not supported | Return list of supported chains |
| Invalid Transaction | Transaction parameters invalid | Return 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
datafield - 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
- Never Store Private Keys: All key management handled by user's wallet
- Verify Addresses: Always display full addresses before signing
- Gas Limits: Set reasonable limits to prevent excessive costs
- Contract Verification: Only interact with verified contracts
- 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
- This skill requires Node.js runtime (v16+ recommended)
- Scripts are written in TypeScript and compiled to JavaScript
- Users must have a WalletConnect-compatible wallet (MetaMask, Rainbow, etc.)
- Session can persist for multiple transactions until disconnected
- All timestamps are in UTC with ISO 8601 format
- Transaction encoding/preparation is handled by the caller
- 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
- Step 1: Set WALLETCONNECT_PROJECT_ID in your environment (and configure optional RPC endpoints).
- Step 2: Initialize WalletConnect SignClient, generate a pairing QR code, and scan with your wallet app.
- 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.