@1llet.xyz/erc4337-gasless-sdk 0.4.51 → 0.4.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +348 -308
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +349 -309
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as StellarSdk from 'stellar-sdk';
|
|
2
2
|
import { Networks } from 'stellar-sdk';
|
|
3
|
-
import { gnosis,
|
|
3
|
+
import { gnosis, avalanche, monad, unichain, arbitrum, polygon, bsc, optimism, baseSepolia, base, optimismSepolia, worldchain } from 'viem/chains';
|
|
4
4
|
import { createPublicClient, http, createWalletClient, decodeErrorResult, maxUint256, encodeFunctionData, encodeAbiParameters, keccak256, padHex } from 'viem';
|
|
5
5
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
6
6
|
import axios from 'axios';
|
|
@@ -410,6 +410,7 @@ var BundlerClient = class {
|
|
|
410
410
|
},
|
|
411
411
|
this.entryPointAddress
|
|
412
412
|
]);
|
|
413
|
+
console.log("DEBUG: estimateGas result:", result);
|
|
413
414
|
return {
|
|
414
415
|
callGasLimit: result.callGasLimit,
|
|
415
416
|
verificationGasLimit: result.verificationGasLimit,
|
|
@@ -1271,285 +1272,133 @@ var BASE_SEPOLIA = {
|
|
|
1271
1272
|
factoryAddress: "0x9406Cc6185a346906296840746125a0E44976454"
|
|
1272
1273
|
// Paymaster optional
|
|
1273
1274
|
}};
|
|
1274
|
-
|
|
1275
|
-
// src/chains.ts
|
|
1276
|
-
init_Stellar();
|
|
1277
|
-
function mapToSDKConfig(data) {
|
|
1278
|
-
if (data.nonEvm) {
|
|
1279
|
-
return {
|
|
1280
|
-
chain: { id: 9e3, name: "Stellar" },
|
|
1281
|
-
// Custom ID for Stellar
|
|
1282
|
-
tokens: data.assets.map((a) => ({
|
|
1283
|
-
symbol: a.name,
|
|
1284
|
-
decimals: a.decimals,
|
|
1285
|
-
address: a.address
|
|
1286
|
-
}))
|
|
1287
|
-
};
|
|
1288
|
-
}
|
|
1289
|
-
if (!data.evm) throw new Error("Non-EVM config used in EVM SDK");
|
|
1290
|
-
return {
|
|
1291
|
-
chain: data.evm.chain,
|
|
1292
|
-
rpcUrl: data.evm.rpcUrl || void 0,
|
|
1293
|
-
bundlerUrl: data.evm.bundlerUrl,
|
|
1294
|
-
entryPointAddress: data.evm.entryPointAddress,
|
|
1295
|
-
factoryAddress: data.evm.factoryAddress,
|
|
1296
|
-
paymasterAddress: data.evm.paymasterAddress,
|
|
1297
|
-
tokens: data.assets.map((a) => ({
|
|
1298
|
-
symbol: a.name,
|
|
1299
|
-
decimals: a.decimals,
|
|
1300
|
-
address: a.address
|
|
1301
|
-
}))
|
|
1302
|
-
};
|
|
1303
|
-
}
|
|
1304
|
-
var BASE_MAINNET = mapToSDKConfig(BASE);
|
|
1305
|
-
var OPTIMISM_MAINNET = mapToSDKConfig(OPTIMISM);
|
|
1306
|
-
var GNOSIS_MAINNET = mapToSDKConfig(GNOSIS);
|
|
1307
|
-
var BASE_SEPOLIA2 = mapToSDKConfig(BASE_SEPOLIA);
|
|
1308
|
-
var STELLAR_MAINNET = mapToSDKConfig(STELLAR);
|
|
1309
|
-
var CHAIN_CONFIGS = {
|
|
1310
|
-
[base.id]: BASE_MAINNET,
|
|
1311
|
-
[baseSepolia.id]: BASE_SEPOLIA2,
|
|
1312
|
-
[gnosis.id]: GNOSIS_MAINNET,
|
|
1313
|
-
[optimism.id]: OPTIMISM_MAINNET,
|
|
1314
|
-
9e3: STELLAR_MAINNET
|
|
1315
|
-
};
|
|
1316
|
-
|
|
1317
|
-
// src/constants/chains.ts
|
|
1318
|
-
var CHAIN_ID_TO_KEY = {
|
|
1319
|
-
"8453": "Base",
|
|
1320
|
-
"84532": "Base",
|
|
1321
|
-
"100": "Gnosis",
|
|
1322
|
-
"10": "Optimism",
|
|
1323
|
-
"11155420": "Optimism",
|
|
1324
|
-
"42161": "Arbitrum",
|
|
1325
|
-
"9000": "Stellar"
|
|
1326
|
-
};
|
|
1327
|
-
|
|
1328
|
-
// src/index.ts
|
|
1329
|
-
init_StellarService();
|
|
1330
|
-
init_Stellar();
|
|
1331
|
-
|
|
1332
|
-
// src/services/cctp.ts
|
|
1333
|
-
init_facilitator();
|
|
1334
|
-
init_facilitator();
|
|
1335
|
-
|
|
1336
|
-
// src/constants/abis.ts
|
|
1337
|
-
var usdcErc3009Abi = [
|
|
1338
|
-
{
|
|
1339
|
-
inputs: [
|
|
1340
|
-
{ name: "from", type: "address" },
|
|
1341
|
-
{ name: "to", type: "address" },
|
|
1342
|
-
{ name: "value", type: "uint256" },
|
|
1343
|
-
{ name: "validAfter", type: "uint256" },
|
|
1344
|
-
{ name: "validBefore", type: "uint256" },
|
|
1345
|
-
{ name: "nonce", type: "bytes32" },
|
|
1346
|
-
{ name: "v", type: "uint8" },
|
|
1347
|
-
{ name: "r", type: "bytes32" },
|
|
1348
|
-
{ name: "s", type: "bytes32" }
|
|
1349
|
-
],
|
|
1350
|
-
name: "transferWithAuthorization",
|
|
1351
|
-
outputs: [],
|
|
1352
|
-
stateMutability: "nonpayable",
|
|
1353
|
-
type: "function"
|
|
1354
|
-
},
|
|
1355
|
-
{
|
|
1356
|
-
inputs: [{ name: "account", type: "address" }],
|
|
1357
|
-
name: "balanceOf",
|
|
1358
|
-
outputs: [{ name: "", type: "uint256" }],
|
|
1359
|
-
stateMutability: "view",
|
|
1360
|
-
type: "function"
|
|
1361
|
-
},
|
|
1362
|
-
{
|
|
1363
|
-
inputs: [
|
|
1364
|
-
{ name: "spender", type: "address" },
|
|
1365
|
-
{ name: "amount", type: "uint256" }
|
|
1366
|
-
],
|
|
1367
|
-
name: "approve",
|
|
1368
|
-
outputs: [{ name: "", type: "bool" }],
|
|
1369
|
-
stateMutability: "nonpayable",
|
|
1370
|
-
type: "function"
|
|
1371
|
-
},
|
|
1372
|
-
{
|
|
1373
|
-
inputs: [
|
|
1374
|
-
{ name: "to", type: "address" },
|
|
1375
|
-
{ name: "amount", type: "uint256" }
|
|
1376
|
-
],
|
|
1377
|
-
name: "transfer",
|
|
1378
|
-
outputs: [{ name: "", type: "bool" }],
|
|
1379
|
-
stateMutability: "nonpayable",
|
|
1380
|
-
type: "function"
|
|
1381
|
-
}
|
|
1382
|
-
];
|
|
1383
|
-
var tokenMessengerAbi = [
|
|
1384
|
-
{
|
|
1385
|
-
inputs: [
|
|
1386
|
-
{ name: "amount", type: "uint256" },
|
|
1387
|
-
{ name: "destinationDomain", type: "uint32" },
|
|
1388
|
-
{ name: "mintRecipient", type: "bytes32" },
|
|
1389
|
-
{ name: "burnToken", type: "address" },
|
|
1390
|
-
{ name: "destinationCaller", type: "bytes32" },
|
|
1391
|
-
{ name: "maxFee", type: "uint256" },
|
|
1392
|
-
// Suspected wrapper arg
|
|
1393
|
-
{ name: "minFinalityThreshold", type: "uint32" }
|
|
1394
|
-
// Suspected wrapper arg
|
|
1395
|
-
],
|
|
1396
|
-
name: "depositForBurn",
|
|
1397
|
-
outputs: [{ name: "_nonce", type: "uint64" }],
|
|
1398
|
-
stateMutability: "nonpayable",
|
|
1399
|
-
type: "function"
|
|
1400
|
-
},
|
|
1401
|
-
// Alternative overload often used:
|
|
1402
|
-
{
|
|
1403
|
-
inputs: [
|
|
1404
|
-
{ name: "amount", type: "uint256" },
|
|
1405
|
-
{ name: "destinationDomain", type: "uint32" },
|
|
1406
|
-
{ name: "mintRecipient", type: "bytes32" },
|
|
1407
|
-
{ name: "burnToken", type: "address" }
|
|
1408
|
-
],
|
|
1409
|
-
name: "depositForBurn",
|
|
1410
|
-
outputs: [{ name: "_nonce", type: "uint64" }],
|
|
1411
|
-
stateMutability: "nonpayable",
|
|
1412
|
-
type: "function"
|
|
1413
|
-
}
|
|
1414
|
-
];
|
|
1415
|
-
var messageTransmitterAbi = [
|
|
1416
|
-
{
|
|
1417
|
-
inputs: [
|
|
1418
|
-
{ name: "message", type: "bytes" },
|
|
1419
|
-
{ name: "attestation", type: "bytes" }
|
|
1420
|
-
],
|
|
1421
|
-
name: "receiveMessage",
|
|
1422
|
-
outputs: [{ name: "success", type: "bool" }],
|
|
1423
|
-
stateMutability: "nonpayable",
|
|
1424
|
-
type: "function"
|
|
1425
|
-
}
|
|
1426
|
-
];
|
|
1427
|
-
var createRetrieveAttestation = async (transactionHash, chainId, timeout = 6e4) => {
|
|
1428
|
-
const baseUrl = "https://iris-api.circle.com";
|
|
1429
|
-
const url = `${baseUrl}/v2/messages/${chainId}?transactionHash=${transactionHash}`;
|
|
1430
|
-
const start = Date.now();
|
|
1431
|
-
const FIVE_SECONDS = 5e3;
|
|
1432
|
-
while (true) {
|
|
1433
|
-
const elapsed = Date.now() - start;
|
|
1434
|
-
if (elapsed > timeout) {
|
|
1435
|
-
throw new Error(
|
|
1436
|
-
"Timeout: Attestation not retrieved within the expected time."
|
|
1437
|
-
);
|
|
1438
|
-
}
|
|
1439
|
-
try {
|
|
1440
|
-
const response = await axios.get(url);
|
|
1441
|
-
const message = response.data?.messages?.[0];
|
|
1442
|
-
if (message?.status === "complete") {
|
|
1443
|
-
console.log("Attestation retrieved successfully!");
|
|
1444
|
-
return message;
|
|
1445
|
-
}
|
|
1446
|
-
console.log("Waiting for attestation...");
|
|
1447
|
-
} catch (error) {
|
|
1448
|
-
const status = error.response?.status;
|
|
1449
|
-
if (status === 404) {
|
|
1450
|
-
console.log("Waiting for attestation...");
|
|
1451
|
-
} else {
|
|
1452
|
-
console.error("Error fetching attestation:", error.message);
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
await new Promise((resolve) => setTimeout(resolve, FIVE_SECONDS));
|
|
1456
|
-
}
|
|
1457
|
-
};
|
|
1458
|
-
var ARBITRUM = {
|
|
1275
|
+
var AVALANCHE = {
|
|
1459
1276
|
assets: [
|
|
1460
1277
|
{
|
|
1461
1278
|
name: "USDC",
|
|
1462
1279
|
decimals: 6,
|
|
1463
|
-
address: "
|
|
1280
|
+
address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
1464
1281
|
coingeckoId: "usd-coin"
|
|
1465
1282
|
},
|
|
1466
1283
|
{
|
|
1467
|
-
name: "
|
|
1468
|
-
decimals: 6,
|
|
1469
|
-
address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
|
1470
|
-
coingeckoId: "tether"
|
|
1471
|
-
},
|
|
1472
|
-
{
|
|
1473
|
-
name: "ARB",
|
|
1284
|
+
name: "AVAX",
|
|
1474
1285
|
decimals: 18,
|
|
1475
|
-
address: "
|
|
1476
|
-
coingeckoId: "
|
|
1286
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
1287
|
+
coingeckoId: "avalanche-2"
|
|
1477
1288
|
},
|
|
1478
1289
|
{
|
|
1479
|
-
name: "
|
|
1480
|
-
decimals:
|
|
1481
|
-
address: "
|
|
1482
|
-
coingeckoId: "
|
|
1290
|
+
name: "USDT",
|
|
1291
|
+
decimals: 6,
|
|
1292
|
+
address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",
|
|
1293
|
+
coingeckoId: "tether"
|
|
1483
1294
|
}
|
|
1484
1295
|
],
|
|
1485
1296
|
evm: {
|
|
1486
|
-
chain:
|
|
1487
|
-
rpcUrl:
|
|
1488
|
-
supports7702:
|
|
1489
|
-
|
|
1297
|
+
chain: avalanche,
|
|
1298
|
+
rpcUrl: avalanche.rpcUrls.default.http[0],
|
|
1299
|
+
supports7702: false,
|
|
1300
|
+
bundlerUrl: `${BUNDLER_URL}/rpc?chain=avalanche`,
|
|
1301
|
+
erc4337: false,
|
|
1302
|
+
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
1303
|
+
factoryAddress: "0x5D1D71FE2De5D1C52c7c11311332eC7f0CBf88aF",
|
|
1304
|
+
paymasterAddress: "0x6c0de464F2203FE089FF719Acf425dFfE6ac1EE5"
|
|
1490
1305
|
},
|
|
1491
1306
|
crossChainInformation: {
|
|
1492
1307
|
circleInformation: {
|
|
1493
1308
|
supportCirclePaymaster: true,
|
|
1494
|
-
aproxFromFee: 0,
|
|
1495
1309
|
cCTPInformation: {
|
|
1496
1310
|
supportCCTP: true,
|
|
1497
|
-
domain:
|
|
1498
|
-
}
|
|
1311
|
+
domain: 1
|
|
1312
|
+
},
|
|
1313
|
+
aproxFromFee: 0
|
|
1499
1314
|
},
|
|
1500
1315
|
nearIntentInformation: {
|
|
1501
1316
|
support: true,
|
|
1502
1317
|
assetsId: [
|
|
1503
1318
|
{
|
|
1504
|
-
assetId: "
|
|
1319
|
+
assetId: "nep245:v2_1.omni.hot.tg:43114_3atVJH3r5c4GqiSYmg9fECvjc47o",
|
|
1505
1320
|
name: "USDC",
|
|
1506
1321
|
decimals: 6
|
|
1507
1322
|
},
|
|
1508
1323
|
{
|
|
1509
|
-
assetId: "
|
|
1510
|
-
name: "
|
|
1511
|
-
decimals: 6
|
|
1512
|
-
},
|
|
1513
|
-
{
|
|
1514
|
-
assetId: "nep141:arb.omft.near",
|
|
1515
|
-
name: "ETH",
|
|
1324
|
+
assetId: "nep245:v2_1.omni.hot.tg:43114_11111111111111111111",
|
|
1325
|
+
name: "AVAX",
|
|
1516
1326
|
decimals: 18
|
|
1517
1327
|
},
|
|
1518
1328
|
{
|
|
1519
|
-
assetId: "
|
|
1520
|
-
name: "
|
|
1521
|
-
decimals:
|
|
1329
|
+
assetId: "nep245:v2_1.omni.hot.tg:43114_372BeH7ENZieCaabwkbWkBiTTgXp",
|
|
1330
|
+
name: "USDT",
|
|
1331
|
+
decimals: 6
|
|
1522
1332
|
}
|
|
1523
1333
|
],
|
|
1524
1334
|
needMemo: false
|
|
1525
1335
|
}
|
|
1526
1336
|
}
|
|
1527
1337
|
};
|
|
1528
|
-
var
|
|
1338
|
+
var BNB = {
|
|
1529
1339
|
assets: [
|
|
1530
1340
|
{
|
|
1531
1341
|
name: "USDC",
|
|
1532
|
-
decimals:
|
|
1533
|
-
address: "
|
|
1342
|
+
decimals: 18,
|
|
1343
|
+
address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
1344
|
+
// BSC Mainnet USDC
|
|
1534
1345
|
coingeckoId: "usd-coin"
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
name: "USDT",
|
|
1349
|
+
decimals: 18,
|
|
1350
|
+
address: "0x55d398326f99059fF775485246999027B3197955",
|
|
1351
|
+
// BSC Mainnet USDT
|
|
1352
|
+
coingeckoId: "tether"
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
name: "BNB",
|
|
1356
|
+
decimals: 18,
|
|
1357
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
1358
|
+
// Native
|
|
1359
|
+
coingeckoId: "binancecoin"
|
|
1535
1360
|
}
|
|
1536
1361
|
],
|
|
1537
1362
|
evm: {
|
|
1538
|
-
chain:
|
|
1539
|
-
rpcUrl: "https://
|
|
1363
|
+
chain: bsc,
|
|
1364
|
+
rpcUrl: "https://bsc-dataseed.binance.org",
|
|
1540
1365
|
supports7702: true,
|
|
1541
|
-
|
|
1366
|
+
bundlerUrl: `${BUNDLER_URL}/rpc?chain=bsc`,
|
|
1367
|
+
erc4337: false,
|
|
1368
|
+
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
1369
|
+
factoryAddress: "0x2d5dBD90d3aB35614cdf686a67A9889E56B20b27",
|
|
1370
|
+
paymasterAddress: "0x460593321DdbE4e1038666Ad07Fc1F817dfA02DB"
|
|
1542
1371
|
},
|
|
1543
1372
|
crossChainInformation: {
|
|
1544
1373
|
circleInformation: {
|
|
1545
|
-
supportCirclePaymaster:
|
|
1374
|
+
supportCirclePaymaster: false,
|
|
1375
|
+
aproxFromFee: 0,
|
|
1546
1376
|
cCTPInformation: {
|
|
1547
|
-
supportCCTP:
|
|
1548
|
-
domain:
|
|
1549
|
-
}
|
|
1550
|
-
aproxFromFee: 0
|
|
1377
|
+
supportCCTP: false,
|
|
1378
|
+
domain: 0
|
|
1379
|
+
}
|
|
1551
1380
|
},
|
|
1552
|
-
nearIntentInformation:
|
|
1381
|
+
nearIntentInformation: {
|
|
1382
|
+
support: true,
|
|
1383
|
+
needMemo: false,
|
|
1384
|
+
assetsId: [
|
|
1385
|
+
{
|
|
1386
|
+
name: "USDC",
|
|
1387
|
+
assetId: "nep245:v2_1.omni.hot.tg:56_2w93GqMcEmQFDru84j3HZZWt557r",
|
|
1388
|
+
decimals: 18
|
|
1389
|
+
},
|
|
1390
|
+
{
|
|
1391
|
+
name: "USDT",
|
|
1392
|
+
assetId: "nep245:v2_1.omni.hot.tg:56_2CMMyVTGZkeyNZTSvS5sarzfir6g",
|
|
1393
|
+
decimals: 18
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
name: "BNB",
|
|
1397
|
+
assetId: "nep245:v2_1.omni.hot.tg:56_11111111111111111111",
|
|
1398
|
+
decimals: 18
|
|
1399
|
+
}
|
|
1400
|
+
]
|
|
1401
|
+
}
|
|
1553
1402
|
}
|
|
1554
1403
|
};
|
|
1555
1404
|
var POLYGON = {
|
|
@@ -1577,7 +1426,11 @@ var POLYGON = {
|
|
|
1577
1426
|
chain: polygon,
|
|
1578
1427
|
rpcUrl: "https://polygon-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN",
|
|
1579
1428
|
supports7702: true,
|
|
1580
|
-
erc4337: false
|
|
1429
|
+
erc4337: false,
|
|
1430
|
+
bundlerUrl: `${BUNDLER_URL}/rpc?chain=polygon`,
|
|
1431
|
+
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
1432
|
+
factoryAddress: "0x31D1C59fcf5B78FE2a86187a53c84DcDa5B80EF6",
|
|
1433
|
+
paymasterAddress: "0x24C82C9381F4615f1a73a5CdBB0Ffd5a432fA54C"
|
|
1581
1434
|
},
|
|
1582
1435
|
crossChainInformation: {
|
|
1583
1436
|
circleInformation: {
|
|
@@ -1611,95 +1464,111 @@ var POLYGON = {
|
|
|
1611
1464
|
}
|
|
1612
1465
|
}
|
|
1613
1466
|
};
|
|
1614
|
-
var
|
|
1467
|
+
var ARBITRUM = {
|
|
1615
1468
|
assets: [
|
|
1616
1469
|
{
|
|
1617
1470
|
name: "USDC",
|
|
1618
1471
|
decimals: 6,
|
|
1619
|
-
address: "
|
|
1472
|
+
address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
1620
1473
|
coingeckoId: "usd-coin"
|
|
1621
1474
|
},
|
|
1622
|
-
{
|
|
1623
|
-
name: "AVAX",
|
|
1624
|
-
decimals: 18,
|
|
1625
|
-
address: "0x0000000000000000000000000000000000000000",
|
|
1626
|
-
coingeckoId: "avalanche-2"
|
|
1627
|
-
},
|
|
1628
1475
|
{
|
|
1629
1476
|
name: "USDT",
|
|
1630
1477
|
decimals: 6,
|
|
1631
|
-
address: "
|
|
1478
|
+
address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
|
|
1632
1479
|
coingeckoId: "tether"
|
|
1480
|
+
},
|
|
1481
|
+
{
|
|
1482
|
+
name: "ARB",
|
|
1483
|
+
decimals: 18,
|
|
1484
|
+
address: "0x912CE59144191C1204E64559FE8253a0e49E6548",
|
|
1485
|
+
coingeckoId: "arbitrum"
|
|
1486
|
+
},
|
|
1487
|
+
{
|
|
1488
|
+
name: "ETH",
|
|
1489
|
+
decimals: 18,
|
|
1490
|
+
address: "0x0000000000000000000000000000000000000000",
|
|
1491
|
+
coingeckoId: "ethereum"
|
|
1633
1492
|
}
|
|
1634
1493
|
],
|
|
1635
1494
|
evm: {
|
|
1636
|
-
chain:
|
|
1637
|
-
rpcUrl:
|
|
1638
|
-
|
|
1639
|
-
|
|
1495
|
+
chain: arbitrum,
|
|
1496
|
+
rpcUrl: "https://arb-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN",
|
|
1497
|
+
bundlerUrl: `${BUNDLER_URL}/rpc?chain=arbitrum`,
|
|
1498
|
+
supports7702: true,
|
|
1499
|
+
erc4337: false,
|
|
1500
|
+
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
1501
|
+
factoryAddress: "0xEEba846e0177CD7b2F023feaa44F9B2a9183327A",
|
|
1502
|
+
paymasterAddress: "0x41d236E76eCEC3b90554d0b504ac2EEce93A2AE1"
|
|
1640
1503
|
},
|
|
1641
1504
|
crossChainInformation: {
|
|
1642
1505
|
circleInformation: {
|
|
1643
1506
|
supportCirclePaymaster: true,
|
|
1507
|
+
aproxFromFee: 0,
|
|
1644
1508
|
cCTPInformation: {
|
|
1645
1509
|
supportCCTP: true,
|
|
1646
|
-
domain:
|
|
1647
|
-
}
|
|
1648
|
-
aproxFromFee: 0
|
|
1510
|
+
domain: 3
|
|
1511
|
+
}
|
|
1649
1512
|
},
|
|
1650
1513
|
nearIntentInformation: {
|
|
1651
1514
|
support: true,
|
|
1652
1515
|
assetsId: [
|
|
1653
1516
|
{
|
|
1654
|
-
assetId: "
|
|
1517
|
+
assetId: "nep141:arb-0xaf88d065e77c8cc2239327c5edb3a432268e5831.omft.near",
|
|
1655
1518
|
name: "USDC",
|
|
1656
1519
|
decimals: 6
|
|
1657
1520
|
},
|
|
1658
1521
|
{
|
|
1659
|
-
assetId: "
|
|
1660
|
-
name: "
|
|
1522
|
+
assetId: "nep141:arb-0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9.omft.near",
|
|
1523
|
+
name: "USDT",
|
|
1524
|
+
decimals: 6
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
assetId: "nep141:arb.omft.near",
|
|
1528
|
+
name: "ETH",
|
|
1661
1529
|
decimals: 18
|
|
1662
1530
|
},
|
|
1663
1531
|
{
|
|
1664
|
-
assetId: "
|
|
1665
|
-
name: "
|
|
1666
|
-
decimals:
|
|
1532
|
+
assetId: "nep141:arb-0x912ce59144191c1204e64559fe8253a0e49e6548.omft.near",
|
|
1533
|
+
name: "ARB",
|
|
1534
|
+
decimals: 18
|
|
1667
1535
|
}
|
|
1668
1536
|
],
|
|
1669
1537
|
needMemo: false
|
|
1670
1538
|
}
|
|
1671
1539
|
}
|
|
1672
1540
|
};
|
|
1673
|
-
var
|
|
1541
|
+
var UNICHAIN = {
|
|
1674
1542
|
assets: [
|
|
1675
1543
|
{
|
|
1676
1544
|
name: "USDC",
|
|
1677
1545
|
decimals: 6,
|
|
1678
|
-
address: "
|
|
1546
|
+
address: "0x078D782b760474a361dDA0AF3839290b0EF57AD6",
|
|
1679
1547
|
coingeckoId: "usd-coin"
|
|
1680
1548
|
}
|
|
1681
1549
|
],
|
|
1682
1550
|
evm: {
|
|
1683
|
-
chain:
|
|
1684
|
-
rpcUrl:
|
|
1551
|
+
chain: unichain,
|
|
1552
|
+
rpcUrl: "https://unichain-mainnet.g.alchemy.com/v2/49fUGmuW05ynCui0VEvDN",
|
|
1553
|
+
bundlerUrl: `${BUNDLER_URL}/rpc?chain=unichain`,
|
|
1685
1554
|
supports7702: true,
|
|
1686
|
-
erc4337: false
|
|
1555
|
+
erc4337: false,
|
|
1556
|
+
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
1557
|
+
factoryAddress: "0xB2E45aCbB68f3e98C87B6df16625f22e11728556",
|
|
1558
|
+
paymasterAddress: "0x7A92b3Fee017E3E181a51D9045AACE30eC2B387D"
|
|
1687
1559
|
},
|
|
1688
1560
|
crossChainInformation: {
|
|
1689
1561
|
circleInformation: {
|
|
1690
|
-
supportCirclePaymaster:
|
|
1562
|
+
supportCirclePaymaster: true,
|
|
1691
1563
|
cCTPInformation: {
|
|
1692
1564
|
supportCCTP: true,
|
|
1693
|
-
domain:
|
|
1565
|
+
domain: 10
|
|
1694
1566
|
},
|
|
1695
1567
|
aproxFromFee: 0
|
|
1696
1568
|
},
|
|
1697
1569
|
nearIntentInformation: null
|
|
1698
1570
|
}
|
|
1699
1571
|
};
|
|
1700
|
-
|
|
1701
|
-
// src/chains/index.ts
|
|
1702
|
-
init_Stellar();
|
|
1703
1572
|
var Monad = {
|
|
1704
1573
|
assets: [
|
|
1705
1574
|
{
|
|
@@ -1725,7 +1594,11 @@ var Monad = {
|
|
|
1725
1594
|
chain: monad,
|
|
1726
1595
|
rpcUrl: monad.rpcUrls.default.http[0],
|
|
1727
1596
|
supports7702: true,
|
|
1728
|
-
erc4337: false
|
|
1597
|
+
erc4337: false,
|
|
1598
|
+
bundlerUrl: `${BUNDLER_URL}/rpc?chain=monad`,
|
|
1599
|
+
entryPointAddress: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
1600
|
+
factoryAddress: "0xaaeA6D8f377e62599Aad75376F0C5e4F7EBF8f84",
|
|
1601
|
+
paymasterAddress: "0xeA82B63e8dE3BFBd321A681D4511BC596E323162"
|
|
1729
1602
|
},
|
|
1730
1603
|
crossChainInformation: {
|
|
1731
1604
|
circleInformation: {
|
|
@@ -1759,69 +1632,236 @@ var Monad = {
|
|
|
1759
1632
|
}
|
|
1760
1633
|
}
|
|
1761
1634
|
};
|
|
1762
|
-
|
|
1635
|
+
|
|
1636
|
+
// src/chains.ts
|
|
1637
|
+
init_Stellar();
|
|
1638
|
+
function mapToSDKConfig(data) {
|
|
1639
|
+
if (data.nonEvm) {
|
|
1640
|
+
return {
|
|
1641
|
+
chain: { id: 9e3, name: "Stellar" },
|
|
1642
|
+
// Custom ID for Stellar
|
|
1643
|
+
tokens: data.assets.map((a) => ({
|
|
1644
|
+
symbol: a.name,
|
|
1645
|
+
decimals: a.decimals,
|
|
1646
|
+
address: a.address
|
|
1647
|
+
}))
|
|
1648
|
+
};
|
|
1649
|
+
}
|
|
1650
|
+
if (!data.evm) throw new Error("Non-EVM config used in EVM SDK");
|
|
1651
|
+
return {
|
|
1652
|
+
chain: data.evm.chain,
|
|
1653
|
+
rpcUrl: data.evm.rpcUrl || void 0,
|
|
1654
|
+
bundlerUrl: data.evm.bundlerUrl,
|
|
1655
|
+
entryPointAddress: data.evm.entryPointAddress,
|
|
1656
|
+
factoryAddress: data.evm.factoryAddress,
|
|
1657
|
+
paymasterAddress: data.evm.paymasterAddress,
|
|
1658
|
+
tokens: data.assets.map((a) => ({
|
|
1659
|
+
symbol: a.name,
|
|
1660
|
+
decimals: a.decimals,
|
|
1661
|
+
address: a.address
|
|
1662
|
+
}))
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
var BASE_MAINNET = mapToSDKConfig(BASE);
|
|
1666
|
+
var OPTIMISM_MAINNET = mapToSDKConfig(OPTIMISM);
|
|
1667
|
+
var GNOSIS_MAINNET = mapToSDKConfig(GNOSIS);
|
|
1668
|
+
var BASE_SEPOLIA2 = mapToSDKConfig(BASE_SEPOLIA);
|
|
1669
|
+
var AVALANCHE_MAINNET = mapToSDKConfig(AVALANCHE);
|
|
1670
|
+
var BSC_MAINNET = mapToSDKConfig(BNB);
|
|
1671
|
+
var POLYGON_MAINNET = mapToSDKConfig(POLYGON);
|
|
1672
|
+
var ARBITRUM_MAINNET = mapToSDKConfig(ARBITRUM);
|
|
1673
|
+
var UNICHAIN_MAINNET = mapToSDKConfig(UNICHAIN);
|
|
1674
|
+
var MONAD_MAINNET = mapToSDKConfig(Monad);
|
|
1675
|
+
var STELLAR_MAINNET = mapToSDKConfig(STELLAR);
|
|
1676
|
+
var CHAIN_CONFIGS = {
|
|
1677
|
+
[base.id]: BASE_MAINNET,
|
|
1678
|
+
[baseSepolia.id]: BASE_SEPOLIA2,
|
|
1679
|
+
[gnosis.id]: GNOSIS_MAINNET,
|
|
1680
|
+
[optimism.id]: OPTIMISM_MAINNET,
|
|
1681
|
+
[avalanche.id]: AVALANCHE_MAINNET,
|
|
1682
|
+
[bsc.id]: BSC_MAINNET,
|
|
1683
|
+
[polygon.id]: POLYGON_MAINNET,
|
|
1684
|
+
[arbitrum.id]: ARBITRUM_MAINNET,
|
|
1685
|
+
[unichain.id]: UNICHAIN_MAINNET,
|
|
1686
|
+
[monad.id]: MONAD_MAINNET,
|
|
1687
|
+
9e3: STELLAR_MAINNET
|
|
1688
|
+
};
|
|
1689
|
+
var CHAIN_ID_TO_KEY = {
|
|
1690
|
+
[base.id]: "Base",
|
|
1691
|
+
[baseSepolia.id]: "Base",
|
|
1692
|
+
[gnosis.id]: "Gnosis",
|
|
1693
|
+
[optimism.id]: "Optimism",
|
|
1694
|
+
[optimismSepolia.id]: "Optimism",
|
|
1695
|
+
[arbitrum.id]: "Arbitrum",
|
|
1696
|
+
[polygon.id]: "Polygon",
|
|
1697
|
+
[bsc.id]: "Binance",
|
|
1698
|
+
[avalanche.id]: "Avalanche",
|
|
1699
|
+
[unichain.id]: "Unichain",
|
|
1700
|
+
[monad.id]: "Monad",
|
|
1701
|
+
"9000": "Stellar"
|
|
1702
|
+
};
|
|
1703
|
+
|
|
1704
|
+
// src/index.ts
|
|
1705
|
+
init_StellarService();
|
|
1706
|
+
init_Stellar();
|
|
1707
|
+
|
|
1708
|
+
// src/services/cctp.ts
|
|
1709
|
+
init_facilitator();
|
|
1710
|
+
init_facilitator();
|
|
1711
|
+
|
|
1712
|
+
// src/constants/abis.ts
|
|
1713
|
+
var usdcErc3009Abi = [
|
|
1714
|
+
{
|
|
1715
|
+
inputs: [
|
|
1716
|
+
{ name: "from", type: "address" },
|
|
1717
|
+
{ name: "to", type: "address" },
|
|
1718
|
+
{ name: "value", type: "uint256" },
|
|
1719
|
+
{ name: "validAfter", type: "uint256" },
|
|
1720
|
+
{ name: "validBefore", type: "uint256" },
|
|
1721
|
+
{ name: "nonce", type: "bytes32" },
|
|
1722
|
+
{ name: "v", type: "uint8" },
|
|
1723
|
+
{ name: "r", type: "bytes32" },
|
|
1724
|
+
{ name: "s", type: "bytes32" }
|
|
1725
|
+
],
|
|
1726
|
+
name: "transferWithAuthorization",
|
|
1727
|
+
outputs: [],
|
|
1728
|
+
stateMutability: "nonpayable",
|
|
1729
|
+
type: "function"
|
|
1730
|
+
},
|
|
1731
|
+
{
|
|
1732
|
+
inputs: [{ name: "account", type: "address" }],
|
|
1733
|
+
name: "balanceOf",
|
|
1734
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
1735
|
+
stateMutability: "view",
|
|
1736
|
+
type: "function"
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
inputs: [
|
|
1740
|
+
{ name: "spender", type: "address" },
|
|
1741
|
+
{ name: "amount", type: "uint256" }
|
|
1742
|
+
],
|
|
1743
|
+
name: "approve",
|
|
1744
|
+
outputs: [{ name: "", type: "bool" }],
|
|
1745
|
+
stateMutability: "nonpayable",
|
|
1746
|
+
type: "function"
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
inputs: [
|
|
1750
|
+
{ name: "to", type: "address" },
|
|
1751
|
+
{ name: "amount", type: "uint256" }
|
|
1752
|
+
],
|
|
1753
|
+
name: "transfer",
|
|
1754
|
+
outputs: [{ name: "", type: "bool" }],
|
|
1755
|
+
stateMutability: "nonpayable",
|
|
1756
|
+
type: "function"
|
|
1757
|
+
}
|
|
1758
|
+
];
|
|
1759
|
+
var tokenMessengerAbi = [
|
|
1760
|
+
{
|
|
1761
|
+
inputs: [
|
|
1762
|
+
{ name: "amount", type: "uint256" },
|
|
1763
|
+
{ name: "destinationDomain", type: "uint32" },
|
|
1764
|
+
{ name: "mintRecipient", type: "bytes32" },
|
|
1765
|
+
{ name: "burnToken", type: "address" },
|
|
1766
|
+
{ name: "destinationCaller", type: "bytes32" },
|
|
1767
|
+
{ name: "maxFee", type: "uint256" },
|
|
1768
|
+
// Suspected wrapper arg
|
|
1769
|
+
{ name: "minFinalityThreshold", type: "uint32" }
|
|
1770
|
+
// Suspected wrapper arg
|
|
1771
|
+
],
|
|
1772
|
+
name: "depositForBurn",
|
|
1773
|
+
outputs: [{ name: "_nonce", type: "uint64" }],
|
|
1774
|
+
stateMutability: "nonpayable",
|
|
1775
|
+
type: "function"
|
|
1776
|
+
},
|
|
1777
|
+
// Alternative overload often used:
|
|
1778
|
+
{
|
|
1779
|
+
inputs: [
|
|
1780
|
+
{ name: "amount", type: "uint256" },
|
|
1781
|
+
{ name: "destinationDomain", type: "uint32" },
|
|
1782
|
+
{ name: "mintRecipient", type: "bytes32" },
|
|
1783
|
+
{ name: "burnToken", type: "address" }
|
|
1784
|
+
],
|
|
1785
|
+
name: "depositForBurn",
|
|
1786
|
+
outputs: [{ name: "_nonce", type: "uint64" }],
|
|
1787
|
+
stateMutability: "nonpayable",
|
|
1788
|
+
type: "function"
|
|
1789
|
+
}
|
|
1790
|
+
];
|
|
1791
|
+
var messageTransmitterAbi = [
|
|
1792
|
+
{
|
|
1793
|
+
inputs: [
|
|
1794
|
+
{ name: "message", type: "bytes" },
|
|
1795
|
+
{ name: "attestation", type: "bytes" }
|
|
1796
|
+
],
|
|
1797
|
+
name: "receiveMessage",
|
|
1798
|
+
outputs: [{ name: "success", type: "bool" }],
|
|
1799
|
+
stateMutability: "nonpayable",
|
|
1800
|
+
type: "function"
|
|
1801
|
+
}
|
|
1802
|
+
];
|
|
1803
|
+
var createRetrieveAttestation = async (transactionHash, chainId, timeout = 6e4) => {
|
|
1804
|
+
const baseUrl = "https://iris-api.circle.com";
|
|
1805
|
+
const url = `${baseUrl}/v2/messages/${chainId}?transactionHash=${transactionHash}`;
|
|
1806
|
+
const start = Date.now();
|
|
1807
|
+
const FIVE_SECONDS = 5e3;
|
|
1808
|
+
while (true) {
|
|
1809
|
+
const elapsed = Date.now() - start;
|
|
1810
|
+
if (elapsed > timeout) {
|
|
1811
|
+
throw new Error(
|
|
1812
|
+
"Timeout: Attestation not retrieved within the expected time."
|
|
1813
|
+
);
|
|
1814
|
+
}
|
|
1815
|
+
try {
|
|
1816
|
+
const response = await axios.get(url);
|
|
1817
|
+
const message = response.data?.messages?.[0];
|
|
1818
|
+
if (message?.status === "complete") {
|
|
1819
|
+
console.log("Attestation retrieved successfully!");
|
|
1820
|
+
return message;
|
|
1821
|
+
}
|
|
1822
|
+
console.log("Waiting for attestation...");
|
|
1823
|
+
} catch (error) {
|
|
1824
|
+
const status = error.response?.status;
|
|
1825
|
+
if (status === 404) {
|
|
1826
|
+
console.log("Waiting for attestation...");
|
|
1827
|
+
} else {
|
|
1828
|
+
console.error("Error fetching attestation:", error.message);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
await new Promise((resolve) => setTimeout(resolve, FIVE_SECONDS));
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
var WORLD_CHAIN = {
|
|
1763
1835
|
assets: [
|
|
1764
1836
|
{
|
|
1765
1837
|
name: "USDC",
|
|
1766
|
-
decimals:
|
|
1767
|
-
address: "
|
|
1768
|
-
// BSC Mainnet USDC
|
|
1838
|
+
decimals: 6,
|
|
1839
|
+
address: "0x79A02482A880bCe3F13E09da970dC34dB4cD24D1",
|
|
1769
1840
|
coingeckoId: "usd-coin"
|
|
1770
|
-
},
|
|
1771
|
-
{
|
|
1772
|
-
name: "USDT",
|
|
1773
|
-
decimals: 18,
|
|
1774
|
-
address: "0x55d398326f99059fF775485246999027B3197955",
|
|
1775
|
-
// BSC Mainnet USDT
|
|
1776
|
-
coingeckoId: "tether"
|
|
1777
|
-
},
|
|
1778
|
-
{
|
|
1779
|
-
name: "BNB",
|
|
1780
|
-
decimals: 18,
|
|
1781
|
-
address: "0x0000000000000000000000000000000000000000",
|
|
1782
|
-
// Native
|
|
1783
|
-
coingeckoId: "binancecoin"
|
|
1784
1841
|
}
|
|
1785
1842
|
],
|
|
1786
1843
|
evm: {
|
|
1787
|
-
chain:
|
|
1788
|
-
rpcUrl:
|
|
1844
|
+
chain: worldchain,
|
|
1845
|
+
rpcUrl: worldchain.rpcUrls.default.http[0],
|
|
1789
1846
|
supports7702: true,
|
|
1790
1847
|
erc4337: false
|
|
1791
1848
|
},
|
|
1792
1849
|
crossChainInformation: {
|
|
1793
1850
|
circleInformation: {
|
|
1794
1851
|
supportCirclePaymaster: false,
|
|
1795
|
-
aproxFromFee: 0,
|
|
1796
1852
|
cCTPInformation: {
|
|
1797
|
-
supportCCTP:
|
|
1798
|
-
domain:
|
|
1799
|
-
}
|
|
1853
|
+
supportCCTP: true,
|
|
1854
|
+
domain: 14
|
|
1855
|
+
},
|
|
1856
|
+
aproxFromFee: 0
|
|
1800
1857
|
},
|
|
1801
|
-
nearIntentInformation:
|
|
1802
|
-
support: true,
|
|
1803
|
-
needMemo: false,
|
|
1804
|
-
assetsId: [
|
|
1805
|
-
{
|
|
1806
|
-
name: "USDC",
|
|
1807
|
-
assetId: "nep245:v2_1.omni.hot.tg:56_2w93GqMcEmQFDru84j3HZZWt557r",
|
|
1808
|
-
decimals: 18
|
|
1809
|
-
},
|
|
1810
|
-
{
|
|
1811
|
-
name: "USDT",
|
|
1812
|
-
assetId: "nep245:v2_1.omni.hot.tg:56_2CMMyVTGZkeyNZTSvS5sarzfir6g",
|
|
1813
|
-
decimals: 18
|
|
1814
|
-
},
|
|
1815
|
-
{
|
|
1816
|
-
name: "BNB",
|
|
1817
|
-
assetId: "nep245:v2_1.omni.hot.tg:56_11111111111111111111",
|
|
1818
|
-
decimals: 18
|
|
1819
|
-
}
|
|
1820
|
-
]
|
|
1821
|
-
}
|
|
1858
|
+
nearIntentInformation: null
|
|
1822
1859
|
}
|
|
1823
1860
|
};
|
|
1824
1861
|
|
|
1862
|
+
// src/chains/index.ts
|
|
1863
|
+
init_Stellar();
|
|
1864
|
+
|
|
1825
1865
|
// src/constants/chainsInformation.ts
|
|
1826
1866
|
var NETWORKS = {
|
|
1827
1867
|
Optimism: OPTIMISM,
|