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