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