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