pubfi-walletconnect-transactions
4
总安装量
4
周安装量
#49808
全站排名
安装命令
npx skills add https://github.com/helixbox/pubfi-skills --skill pubfi-walletconnect-transactions
Agent 安装分布
openclaw
3
codex
3
kimi-cli
3
opencode
3
gemini-cli
2
claude-code
2
Skill 文档
PubFi 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();