|
3 | 3 | module X402 |
4 | 4 | # Chain configurations for supported networks |
5 | 5 | CHAINS = { |
| 6 | + # --- Base --- |
| 7 | + "base" => { |
| 8 | + chain_id: 8453, |
| 9 | + usdc_address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", |
| 10 | + explorer_url: "https://basescan.org", |
| 11 | + }, |
6 | 12 | "base-sepolia" => { |
7 | 13 | chain_id: 84532, |
8 | 14 | usdc_address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e", |
9 | | - explorer_url: "https://sepolia.basescan.org" |
| 15 | + explorer_url: "https://sepolia.basescan.org", |
10 | 16 | }, |
11 | | - "base" => { |
12 | | - chain_id: 8453, |
13 | | - usdc_address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", |
14 | | - explorer_url: "https://basescan.org" |
| 17 | + |
| 18 | + # --- Polygon --- |
| 19 | + "polygon" => { |
| 20 | + chain_id: 137, |
| 21 | + usdc_address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", |
| 22 | + explorer_url: "https://polygonscan.com", |
15 | 23 | }, |
16 | | - "avalanche-fuji" => { |
17 | | - chain_id: 43113, |
18 | | - usdc_address: "0x5425890298aed601595a70AB815c96711a31Bc65", |
19 | | - explorer_url: "https://testnet.snowtrace.io" |
| 24 | + "polygon-amoy" => { |
| 25 | + chain_id: 80002, |
| 26 | + usdc_address: "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582", |
| 27 | + explorer_url: "https://amoy.polygonscan.com", |
20 | 28 | }, |
| 29 | + |
| 30 | + # --- Avalanche --- |
21 | 31 | "avalanche" => { |
22 | 32 | chain_id: 43114, |
23 | 33 | usdc_address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", |
24 | | - explorer_url: "https://snowtrace.io" |
| 34 | + explorer_url: "https://snowtrace.io", |
25 | 35 | }, |
26 | | - "solana-devnet" => { |
27 | | - chain_id: 103, |
28 | | - usdc_address: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", |
29 | | - explorer_url: "https://explorer.solana.com/?cluster=devnet", |
30 | | - fee_payer: "CKPKJWNdJEqa81x7CkZ14BVPiY6y16Sxs7owznqtWYp5" |
| 36 | + "avalanche-fuji" => { |
| 37 | + chain_id: 43113, |
| 38 | + usdc_address: "0x5425890298aed601595a70AB815c96711a31Bc65", |
| 39 | + explorer_url: "https://testnet.snowtrace.io", |
| 40 | + }, |
| 41 | + |
| 42 | + # --- Sei --- |
| 43 | + "sei" => { |
| 44 | + chain_id: 1329, |
| 45 | + usdc_address: "0xe15fC38F6D8c56aF07bbCBe3BAf5708A2Bf42392", |
| 46 | + explorer_url: "https://seitrace.com", |
| 47 | + }, |
| 48 | + "sei-testnet" => { |
| 49 | + chain_id: 713715, |
| 50 | + explorer_url: "https://seitrace.com/?chain=arctic-1", |
31 | 51 | }, |
| 52 | + |
| 53 | + # --- X Layer --- |
| 54 | + "xlayer" => { |
| 55 | + chain_id: 196, |
| 56 | + explorer_url: "https://www.oklink.com/xlayer", |
| 57 | + }, |
| 58 | + "xlayer-testnet" => { |
| 59 | + chain_id: 1952, |
| 60 | + explorer_url: "https://www.oklink.com/xlayer-test", |
| 61 | + }, |
| 62 | + |
| 63 | + # --- SKALE --- |
| 64 | + "skale-base" => { |
| 65 | + chain_id: 1_187_947_933, |
| 66 | + explorer_url: "https://elated-tan-skat.explorer.mainnet.skalenodes.com", |
| 67 | + }, |
| 68 | + "skale-base-sepolia" => { |
| 69 | + chain_id: 324_705_682, |
| 70 | + explorer_url: "https://lanky-ill-funny-testnet.explorer.testnet.skalenodes.com", |
| 71 | + }, |
| 72 | + |
| 73 | + # --- KiteAI --- |
| 74 | + "kiteai" => { |
| 75 | + chain_id: 2366, |
| 76 | + explorer_url: "https://testnet.kitescan.ai", |
| 77 | + }, |
| 78 | + "kiteai-testnet" => { |
| 79 | + chain_id: 2368, |
| 80 | + explorer_url: "https://testnet.kitescan.ai", |
| 81 | + }, |
| 82 | + |
| 83 | + # --- IoTeX (mainnet only) --- |
| 84 | + "iotex" => { |
| 85 | + chain_id: 4689, |
| 86 | + explorer_url: "https://iotexscan.io", |
| 87 | + }, |
| 88 | + |
| 89 | + # --- Peaq (mainnet only) --- |
| 90 | + "peaq" => { |
| 91 | + chain_id: 3338, |
| 92 | + explorer_url: "https://peaq.subscan.io", |
| 93 | + }, |
| 94 | + |
| 95 | + # --- Solana --- |
| 96 | + # Default fee_payer is for the Coinbase facilitator (x402.org). |
| 97 | + # If using PayAI facilitator, set X402_SOLANA_FEE_PAYER or X402_SOLANA_DEVNET_FEE_PAYER |
| 98 | + # to PayAI's fee payer: 2wKupLR9q6wXYppw8Gr2NvWxKBUqm4PPJKkQfoxHDBg4 |
32 | 99 | "solana" => { |
33 | 100 | chain_id: 101, |
34 | 101 | usdc_address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", |
35 | 102 | explorer_url: "https://explorer.solana.com", |
36 | | - fee_payer: "CKPKJWNdJEqa81x7CkZ14BVPiY6y16Sxs7owznqtWYp5" |
37 | | - } |
| 103 | + fee_payer: "CKPKJWNdJEqa81x7CkZ14BVPiY6y16Sxs7owznqtWYp5", |
| 104 | + }, |
| 105 | + "solana-devnet" => { |
| 106 | + chain_id: 103, |
| 107 | + usdc_address: "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU", |
| 108 | + explorer_url: "https://explorer.solana.com/?cluster=devnet", |
| 109 | + fee_payer: "CKPKJWNdJEqa81x7CkZ14BVPiY6y16Sxs7owznqtWYp5", |
| 110 | + }, |
38 | 111 | }.freeze |
39 | 112 |
|
40 | 113 | # Currency configurations by chain |
41 | 114 | CURRENCY_BY_CHAIN = { |
42 | | - "base-sepolia" => { |
43 | | - symbol: "USDC", |
44 | | - decimals: 6, |
45 | | - name: "USDC", # Testnet uses "USDC" |
46 | | - version: "2" |
47 | | - }, |
48 | | - "base" => { |
49 | | - symbol: "USDC", |
50 | | - decimals: 6, |
51 | | - name: "USD Coin", # Mainnet uses "USD Coin" |
52 | | - version: "2" |
53 | | - }, |
54 | | - "avalanche-fuji" => { |
55 | | - symbol: "USDC", |
56 | | - decimals: 6, |
57 | | - name: "USD Coin", # Testnet uses "USD Coin" |
58 | | - version: "2" |
59 | | - }, |
60 | | - "avalanche" => { |
61 | | - symbol: "USDC", |
62 | | - decimals: 6, |
63 | | - name: "USDC", # Mainnet uses "USDC" |
64 | | - version: "2" |
65 | | - }, |
66 | | - "solana-devnet" => { |
67 | | - symbol: "USDC", |
68 | | - decimals: 6, |
69 | | - name: "USDC", |
70 | | - version: nil |
71 | | - }, |
72 | | - "solana" => { |
73 | | - symbol: "USDC", |
74 | | - decimals: 6, |
75 | | - name: "USD Coin", |
76 | | - version: nil |
77 | | - } |
| 115 | + "base" => { symbol: "USDC", decimals: 6, name: "USD Coin", version: "2" }, |
| 116 | + "base-sepolia" => { symbol: "USDC", decimals: 6, name: "USDC", version: "2" }, |
| 117 | + "polygon" => { symbol: "USDC", decimals: 6, name: "USD Coin", version: "2" }, |
| 118 | + "polygon-amoy" => { symbol: "USDC", decimals: 6, name: "USDC", version: "2" }, |
| 119 | + "avalanche" => { symbol: "USDC", decimals: 6, name: "USDC", version: "2" }, |
| 120 | + "avalanche-fuji" => { symbol: "USDC", decimals: 6, name: "USD Coin", version: "2" }, |
| 121 | + "sei" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 122 | + "sei-testnet" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 123 | + "xlayer" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 124 | + "xlayer-testnet" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 125 | + "skale-base" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 126 | + "skale-base-sepolia" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 127 | + "kiteai" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 128 | + "kiteai-testnet" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 129 | + "iotex" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 130 | + "peaq" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
| 131 | + "solana" => { symbol: "USDC", decimals: 6, name: "USD Coin", version: nil }, |
| 132 | + "solana-devnet" => { symbol: "USDC", decimals: 6, name: "USDC", version: nil }, |
78 | 133 | }.freeze |
79 | 134 |
|
80 | 135 | CAIP2_MAPPING = { |
81 | | - "base-sepolia" => "eip155:84532", |
| 136 | + # Base |
82 | 137 | "base" => "eip155:8453", |
83 | | - "avalanche-fuji" => "eip155:43113", |
| 138 | + "base-sepolia" => "eip155:84532", |
| 139 | + # Polygon |
| 140 | + "polygon" => "eip155:137", |
| 141 | + "polygon-amoy" => "eip155:80002", |
| 142 | + # Avalanche |
84 | 143 | "avalanche" => "eip155:43114", |
| 144 | + "avalanche-fuji" => "eip155:43113", |
| 145 | + # Sei |
| 146 | + "sei" => "eip155:1329", |
| 147 | + "sei-testnet" => "eip155:713715", |
| 148 | + # X Layer |
| 149 | + "xlayer" => "eip155:196", |
| 150 | + "xlayer-testnet" => "eip155:1952", |
| 151 | + # SKALE |
| 152 | + "skale-base" => "eip155:1187947933", |
| 153 | + "skale-base-sepolia" => "eip155:324705682", |
| 154 | + # KiteAI |
| 155 | + "kiteai" => "eip155:2366", |
| 156 | + "kiteai-testnet" => "eip155:2368", |
| 157 | + # IoTeX |
| 158 | + "iotex" => "eip155:4689", |
| 159 | + # Peaq |
| 160 | + "peaq" => "eip155:3338", |
| 161 | + # Solana |
| 162 | + "solana" => "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", |
85 | 163 | "solana-devnet" => "solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1", |
86 | | - "solana" => "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp" |
87 | 164 | }.freeze |
88 | 165 |
|
89 | 166 | REVERSE_CAIP2_MAPPING = CAIP2_MAPPING.invert.freeze |
|
0 commit comments