@sodax/sdk 2.2.0 → 2.3.0-rc.1
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/README.md +6 -6
- package/dist/index.cjs +1972 -319
- package/dist/index.d.cts +428 -31
- package/dist/index.d.ts +428 -31
- package/dist/index.mjs +1961 -320
- package/package.json +8 -8
package/dist/index.mjs
CHANGED
|
@@ -96,8 +96,8 @@ function serializeCause(cause, depth) {
|
|
|
96
96
|
}
|
|
97
97
|
function sanitizeContext(value, depth) {
|
|
98
98
|
const out = {};
|
|
99
|
-
for (const [key,
|
|
100
|
-
out[key] = sanitizeValue(
|
|
99
|
+
for (const [key, v11] of Object.entries(value)) {
|
|
100
|
+
out[key] = sanitizeValue(v11, depth + 1);
|
|
101
101
|
}
|
|
102
102
|
return out;
|
|
103
103
|
}
|
|
@@ -108,13 +108,13 @@ function sanitizeValue(value, depth) {
|
|
|
108
108
|
if (t === "bigint") return value.toString();
|
|
109
109
|
if (t === "string" || t === "number" || t === "boolean") return value;
|
|
110
110
|
if (t === "function" || t === "symbol") return safeString(value);
|
|
111
|
-
if (Array.isArray(value)) return value.map((
|
|
111
|
+
if (Array.isArray(value)) return value.map((v11) => sanitizeValue(v11, depth + 1));
|
|
112
112
|
if (value instanceof Date) return value.toISOString();
|
|
113
113
|
if (value instanceof Map) {
|
|
114
|
-
return Array.from(value.entries()).map(([k,
|
|
114
|
+
return Array.from(value.entries()).map(([k, v11]) => [sanitizeValue(k, depth + 1), sanitizeValue(v11, depth + 1)]);
|
|
115
115
|
}
|
|
116
116
|
if (value instanceof Set) {
|
|
117
|
-
return Array.from(value.values()).map((
|
|
117
|
+
return Array.from(value.values()).map((v11) => sanitizeValue(v11, depth + 1));
|
|
118
118
|
}
|
|
119
119
|
if (value instanceof Error) return { name: value.name, message: value.message };
|
|
120
120
|
if (t === "object") {
|
|
@@ -126,9 +126,9 @@ function sanitizeValue(value, depth) {
|
|
|
126
126
|
}
|
|
127
127
|
return safeString(value);
|
|
128
128
|
}
|
|
129
|
-
function safeString(
|
|
129
|
+
function safeString(v11) {
|
|
130
130
|
try {
|
|
131
|
-
return String(
|
|
131
|
+
return String(v11);
|
|
132
132
|
} catch {
|
|
133
133
|
return "[unserializable]";
|
|
134
134
|
}
|
|
@@ -290,7 +290,7 @@ var CHAIN_KEYS = Object.values(ChainKeys);
|
|
|
290
290
|
var spokeChainKeysSet = new Set(CHAIN_KEYS);
|
|
291
291
|
|
|
292
292
|
// ../types/dist/chains/tokens.js
|
|
293
|
-
var TOKEN_LOGO_BASE_URL = "https://raw.githubusercontent.com/
|
|
293
|
+
var TOKEN_LOGO_BASE_URL = "https://raw.githubusercontent.com/gosodax/sodax-sdks/main/packages/assets/token";
|
|
294
294
|
var tokenLogoSlug = (symbol) => symbol.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
295
295
|
var tokenLogo = (symbol) => `${TOKEN_LOGO_BASE_URL}/${tokenLogoSlug(symbol)}.png`;
|
|
296
296
|
var StatATokenAddresses = {
|
|
@@ -351,7 +351,9 @@ var HubVaultSymbols = [
|
|
|
351
351
|
"TSM",
|
|
352
352
|
"AMD",
|
|
353
353
|
"INTC",
|
|
354
|
-
"BABA"
|
|
354
|
+
"BABA",
|
|
355
|
+
"sodaADA",
|
|
356
|
+
"sodaZEC"
|
|
355
357
|
];
|
|
356
358
|
var SodaTokens = {
|
|
357
359
|
sodaBNB: {
|
|
@@ -854,6 +856,24 @@ var SodaTokens = {
|
|
|
854
856
|
chainKey: ChainKeys.SONIC_MAINNET,
|
|
855
857
|
hubAsset: "0x1BeD0547D76F6424e9A3465b36F6dcDCF798A5cf",
|
|
856
858
|
vault: "0x1BeD0547D76F6424e9A3465b36F6dcDCF798A5cf"
|
|
859
|
+
},
|
|
860
|
+
sodaADA: {
|
|
861
|
+
symbol: "sodaADA",
|
|
862
|
+
name: "SODA ADA",
|
|
863
|
+
decimals: 18,
|
|
864
|
+
address: "0xa3e161c014b6285f06425f9fd78aa83b60c1ab9e",
|
|
865
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
866
|
+
hubAsset: "0xa3e161c014b6285f06425f9fd78aa83b60c1ab9e",
|
|
867
|
+
vault: "0xa3e161c014b6285f06425f9fd78aa83b60c1ab9e"
|
|
868
|
+
},
|
|
869
|
+
sodaZEC: {
|
|
870
|
+
symbol: "sodaZEC",
|
|
871
|
+
name: "SODA ZEC",
|
|
872
|
+
decimals: 18,
|
|
873
|
+
address: "0xf4af0aa80f079d5bff230c5b12109fa19b24f558",
|
|
874
|
+
chainKey: ChainKeys.SONIC_MAINNET,
|
|
875
|
+
hubAsset: "0xf4af0aa80f079d5bff230c5b12109fa19b24f558",
|
|
876
|
+
vault: "0xf4af0aa80f079d5bff230c5b12109fa19b24f558"
|
|
857
877
|
}
|
|
858
878
|
};
|
|
859
879
|
var LsodaSymbols = ["lsodaWEETH", "lsodaWSTETH", "lsodaJITOSOL", "lsodaSUSDS"];
|
|
@@ -1395,6 +1415,216 @@ var solanaSupportedTokens = {
|
|
|
1395
1415
|
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1396
1416
|
hubAsset: "0x0a3a93b7303a582b2ab84cfb3493fdb9d160a3ef",
|
|
1397
1417
|
vault: "0x0a3a93b7303a582b2ab84cfb3493fdb9d160a3ef"
|
|
1418
|
+
},
|
|
1419
|
+
"2Z": {
|
|
1420
|
+
symbol: "2Z",
|
|
1421
|
+
name: "DoubleZero",
|
|
1422
|
+
decimals: 8,
|
|
1423
|
+
address: "J6pQQ3FAcJQeWPPGppWRb4nM8jU3wLyYbRrLh7feMfvd",
|
|
1424
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1425
|
+
hubAsset: "0xe27f9c0e27a71743a1e43f585b9f17c6a9c2493f",
|
|
1426
|
+
vault: "0xe27f9c0e27a71743a1e43f585b9f17c6a9c2493f"
|
|
1427
|
+
},
|
|
1428
|
+
ANSEM: {
|
|
1429
|
+
symbol: "ANSEM",
|
|
1430
|
+
name: "The Black Bull",
|
|
1431
|
+
decimals: 6,
|
|
1432
|
+
address: "9cRCn9rGT8V2imeM2BaKs13yhMEais3ruM3rPvTGpump",
|
|
1433
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1434
|
+
hubAsset: "0x0392de493dc89cf5dac2f06ce4a60c590008e537",
|
|
1435
|
+
vault: "0x0392de493dc89cf5dac2f06ce4a60c590008e537"
|
|
1436
|
+
},
|
|
1437
|
+
BP: {
|
|
1438
|
+
symbol: "BP",
|
|
1439
|
+
name: "Backpack",
|
|
1440
|
+
decimals: 9,
|
|
1441
|
+
address: "BPxxfRCXkUVhig4HS1Lh7kZqV6SPJhzfEk4x6fVBjPCy",
|
|
1442
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1443
|
+
hubAsset: "0x9a1e90e1f591ac516781c5dc0523d998015dca74",
|
|
1444
|
+
vault: "0x9a1e90e1f591ac516781c5dc0523d998015dca74"
|
|
1445
|
+
},
|
|
1446
|
+
CARDS: {
|
|
1447
|
+
symbol: "CARDS",
|
|
1448
|
+
name: "Collector Crypt",
|
|
1449
|
+
decimals: 6,
|
|
1450
|
+
address: "CARDSccUMFKoPRZxt5vt3ksUbxEFEcnZ3H2pd3dKxYjp",
|
|
1451
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1452
|
+
hubAsset: "0xe639567bc448c8fe4c34b3c074fffea2047c77d2",
|
|
1453
|
+
vault: "0xe639567bc448c8fe4c34b3c074fffea2047c77d2"
|
|
1454
|
+
},
|
|
1455
|
+
CASH: {
|
|
1456
|
+
symbol: "CASH",
|
|
1457
|
+
name: "CASH",
|
|
1458
|
+
decimals: 6,
|
|
1459
|
+
address: "CASHx9KJUStyftLFWGvEVf59SGeG9sh5FfcnZMVPCASH",
|
|
1460
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1461
|
+
hubAsset: "0x28e5589c8030d0f53961db173e9bf1e0f59e716a",
|
|
1462
|
+
vault: "0x28e5589c8030d0f53961db173e9bf1e0f59e716a"
|
|
1463
|
+
},
|
|
1464
|
+
Fartcoin: {
|
|
1465
|
+
symbol: "Fartcoin",
|
|
1466
|
+
name: "Fartcoin",
|
|
1467
|
+
decimals: 6,
|
|
1468
|
+
address: "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
|
|
1469
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1470
|
+
hubAsset: "0x7127c0a5cab393a6b0b311684130c985a00eb06a",
|
|
1471
|
+
vault: "0x7127c0a5cab393a6b0b311684130c985a00eb06a"
|
|
1472
|
+
},
|
|
1473
|
+
GLDx: {
|
|
1474
|
+
symbol: "GLDx",
|
|
1475
|
+
isRwa: true,
|
|
1476
|
+
name: "Gold xStock",
|
|
1477
|
+
decimals: 8,
|
|
1478
|
+
address: "Xsv9hRk1z5ystj9MhnA7Lq4vjSsLwzL2nxrwmwtD3re",
|
|
1479
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1480
|
+
hubAsset: "0x236d062ba08cea4e28e006ab8d14c5b407bcfa0d",
|
|
1481
|
+
vault: "0x236d062ba08cea4e28e006ab8d14c5b407bcfa0d"
|
|
1482
|
+
},
|
|
1483
|
+
HOODx: {
|
|
1484
|
+
symbol: "HOODx",
|
|
1485
|
+
isRwa: true,
|
|
1486
|
+
name: "Robinhood xStock",
|
|
1487
|
+
decimals: 8,
|
|
1488
|
+
address: "XsvNBAYkrDRNhA7wPHQfX3ZUXZyZLdnCQDfHZ56bzpg",
|
|
1489
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1490
|
+
hubAsset: "0xd9c608fc37d1c7714ea1d1019197473d2b94e46e",
|
|
1491
|
+
vault: "0xd9c608fc37d1c7714ea1d1019197473d2b94e46e"
|
|
1492
|
+
},
|
|
1493
|
+
HYPE: {
|
|
1494
|
+
symbol: "HYPE",
|
|
1495
|
+
name: "Wormhole Bridged HYPE",
|
|
1496
|
+
decimals: 9,
|
|
1497
|
+
address: "98sMhvDwXj1RQi5c5Mndm3vPe9cBqPrbLaufMXFNMh5g",
|
|
1498
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1499
|
+
hubAsset: "0xe16bde1138dde975d84b43e99998fb6baee4bd8f",
|
|
1500
|
+
vault: SodaTokens.sodaHYPE.address
|
|
1501
|
+
},
|
|
1502
|
+
hyUSD: {
|
|
1503
|
+
symbol: "hyUSD",
|
|
1504
|
+
name: "Hylo USD",
|
|
1505
|
+
decimals: 6,
|
|
1506
|
+
address: "5YMkXAYccHSGnHn9nob9xEvv6Pvka9DZWH7nTbotTu9E",
|
|
1507
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1508
|
+
hubAsset: "0x5e2d86db5d93354de1ff2f70591509cf47cd878c",
|
|
1509
|
+
vault: "0x5e2d86db5d93354de1ff2f70591509cf47cd878c"
|
|
1510
|
+
},
|
|
1511
|
+
KMNO: {
|
|
1512
|
+
symbol: "KMNO",
|
|
1513
|
+
name: "Kamino",
|
|
1514
|
+
decimals: 6,
|
|
1515
|
+
address: "KMNo3nJsBXfcpJTVhZcXLW7RmTwTt4GVFE7suUBo9sS",
|
|
1516
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1517
|
+
hubAsset: "0x96e788fc83ef83c3201e4763fabe8e2dedf6eca7",
|
|
1518
|
+
vault: "0x96e788fc83ef83c3201e4763fabe8e2dedf6eca7"
|
|
1519
|
+
},
|
|
1520
|
+
LBTC: {
|
|
1521
|
+
symbol: "LBTC",
|
|
1522
|
+
name: "Lombard BTC",
|
|
1523
|
+
decimals: 8,
|
|
1524
|
+
address: "LBTCgU4b3wsFKsPwBn1rRZDx5DoFutM6RPiEt1TPDsY",
|
|
1525
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1526
|
+
hubAsset: "0x0abcce0b778587f9d6c83064d857027797220507",
|
|
1527
|
+
vault: SodaTokens.sodaBTC.address
|
|
1528
|
+
},
|
|
1529
|
+
MET: {
|
|
1530
|
+
symbol: "MET",
|
|
1531
|
+
name: "Meteora",
|
|
1532
|
+
decimals: 6,
|
|
1533
|
+
address: "METvsvVRapdj9cFLzq4Tr43xK4tAjQfwX76z3n6mWQL",
|
|
1534
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1535
|
+
hubAsset: "0xf6c71a67a7def6f87b0867113e366fcbba71b55f",
|
|
1536
|
+
vault: "0xf6c71a67a7def6f87b0867113e366fcbba71b55f"
|
|
1537
|
+
},
|
|
1538
|
+
ONYC: {
|
|
1539
|
+
symbol: "ONYC",
|
|
1540
|
+
name: "OnRe Tokenized Reinsurance",
|
|
1541
|
+
decimals: 9,
|
|
1542
|
+
address: "5Y8NV33Vv7WbnLfq3zBcKSdYPrk7g2KoiQoe7M2tcxp5",
|
|
1543
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1544
|
+
hubAsset: "0xacc1adb3095706e0fd7b70b2cab2b331bc95d32a",
|
|
1545
|
+
vault: "0xacc1adb3095706e0fd7b70b2cab2b331bc95d32a"
|
|
1546
|
+
},
|
|
1547
|
+
PENGU: {
|
|
1548
|
+
symbol: "PENGU",
|
|
1549
|
+
name: "Pudgy Penguins",
|
|
1550
|
+
decimals: 6,
|
|
1551
|
+
address: "2zMMhcVQEXDtdE6vsFS7S7D5oUodfJHE8vd1gnBouauv",
|
|
1552
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1553
|
+
hubAsset: "0x0cea0541b3790e8b54eef79fe243b9d1ba909add",
|
|
1554
|
+
vault: "0x0cea0541b3790e8b54eef79fe243b9d1ba909add"
|
|
1555
|
+
},
|
|
1556
|
+
PRIME: {
|
|
1557
|
+
symbol: "PRIME",
|
|
1558
|
+
name: "Hastra PRIME",
|
|
1559
|
+
decimals: 6,
|
|
1560
|
+
address: "3b8X44fLF9ooXaUm3hhSgjpmVs6rZZ3pPoGnGahc3Uu7",
|
|
1561
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1562
|
+
hubAsset: "0xc848404d5c99c10a554094a53e71d0305fbac518",
|
|
1563
|
+
vault: "0xc848404d5c99c10a554094a53e71d0305fbac518"
|
|
1564
|
+
},
|
|
1565
|
+
SPCXx: {
|
|
1566
|
+
symbol: "SPCXx",
|
|
1567
|
+
isRwa: true,
|
|
1568
|
+
name: "SpaceX xStock",
|
|
1569
|
+
decimals: 8,
|
|
1570
|
+
address: "Xs3oZwbHvqis4NYcf4YKWmEia2eC84wSiVrcYcTqpH8",
|
|
1571
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1572
|
+
hubAsset: "0x760bc9d7dede486a235e58992815ff54bc1b3269",
|
|
1573
|
+
vault: "0x760bc9d7dede486a235e58992815ff54bc1b3269"
|
|
1574
|
+
},
|
|
1575
|
+
STONK: {
|
|
1576
|
+
symbol: "STONK",
|
|
1577
|
+
name: "STONK",
|
|
1578
|
+
decimals: 9,
|
|
1579
|
+
address: "6GmAFSYs4gk3FDao5FzzySQpPZaWsa4rUJHacpMpUNgx",
|
|
1580
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1581
|
+
hubAsset: "0x02a88631e2fe0dd2169b6e9452e65e98b2c6f27e",
|
|
1582
|
+
vault: "0x02a88631e2fe0dd2169b6e9452e65e98b2c6f27e"
|
|
1583
|
+
},
|
|
1584
|
+
syrupUSDC: {
|
|
1585
|
+
symbol: "syrupUSDC",
|
|
1586
|
+
name: "syrupUSDC",
|
|
1587
|
+
decimals: 6,
|
|
1588
|
+
address: "AvZZF1YaZDziPY2RCK4oJrRVrbN3mTD9NL24hPeaZeUj",
|
|
1589
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1590
|
+
hubAsset: "0x2941198088fdac45d983798d1246f073fc36330f",
|
|
1591
|
+
vault: "0x2941198088fdac45d983798d1246f073fc36330f"
|
|
1592
|
+
},
|
|
1593
|
+
TRUMP: {
|
|
1594
|
+
symbol: "TRUMP",
|
|
1595
|
+
name: "Official Trump",
|
|
1596
|
+
decimals: 6,
|
|
1597
|
+
address: "6p6xgHyF7AeE6TZkSmFsko444wqoP15icUSqi2jfGiPN",
|
|
1598
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1599
|
+
hubAsset: "0xf5291267892347830b1a7b92a4061e8c28cc06fb",
|
|
1600
|
+
vault: "0xf5291267892347830b1a7b92a4061e8c28cc06fb"
|
|
1601
|
+
},
|
|
1602
|
+
USX: {
|
|
1603
|
+
symbol: "USX",
|
|
1604
|
+
name: "USX",
|
|
1605
|
+
decimals: 6,
|
|
1606
|
+
address: "6FrrzDk5mQARGc1TDYoyVnSyRdds1t4PbtohCD6p3tgG",
|
|
1607
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1608
|
+
hubAsset: "0x4f8b6611700fbf8aabfbcd595e0b33d23de89dd5",
|
|
1609
|
+
vault: "0x4f8b6611700fbf8aabfbcd595e0b33d23de89dd5"
|
|
1610
|
+
},
|
|
1611
|
+
xBTC: {
|
|
1612
|
+
symbol: "xBTC",
|
|
1613
|
+
name: "OKX Wrapped BTC",
|
|
1614
|
+
decimals: 8,
|
|
1615
|
+
address: "CtzPWv73Sn1dMGVU3ZtLv9yWSyUAanBni19YWDaznnkn",
|
|
1616
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1617
|
+
hubAsset: "0x4a47a698603c31e59d4c464d86dc6d54c60106df",
|
|
1618
|
+
vault: SodaTokens.sodaBTC.address
|
|
1619
|
+
},
|
|
1620
|
+
ZEC: {
|
|
1621
|
+
symbol: "ZEC",
|
|
1622
|
+
name: "OmniBridge Bridged Zcash (Solana)",
|
|
1623
|
+
decimals: 8,
|
|
1624
|
+
address: "A7bdiYdS5GjqGFtxf17ppRHtDKPkkRqbKtR27dxvQXaS",
|
|
1625
|
+
chainKey: ChainKeys.SOLANA_MAINNET,
|
|
1626
|
+
hubAsset: "0xdfce285d5bb2da89fab4212d06683a4699e90560",
|
|
1627
|
+
vault: SodaTokens.sodaZEC.address
|
|
1398
1628
|
}
|
|
1399
1629
|
};
|
|
1400
1630
|
var avalancheSupportedTokens = {
|
|
@@ -1662,6 +1892,24 @@ var arbitrumSupportedTokens = {
|
|
|
1662
1892
|
chainKey: ChainKeys.ARBITRUM_MAINNET,
|
|
1663
1893
|
hubAsset: "0x68ff591a66f6b6c77bdf6463d88e8cb5578c8a53",
|
|
1664
1894
|
vault: "0x68ff591a66f6b6c77bdf6463d88e8cb5578c8a53"
|
|
1895
|
+
},
|
|
1896
|
+
CHIP: {
|
|
1897
|
+
symbol: "CHIP",
|
|
1898
|
+
name: "USD.AI",
|
|
1899
|
+
decimals: 18,
|
|
1900
|
+
address: "0x0c1c1c109fe34733fca54b82d7b46b75cfb71f6e",
|
|
1901
|
+
chainKey: ChainKeys.ARBITRUM_MAINNET,
|
|
1902
|
+
hubAsset: "0x87a879e35027f55655a3b4540cf71e27c28e8116",
|
|
1903
|
+
vault: "0x87a879e35027f55655a3b4540cf71e27c28e8116"
|
|
1904
|
+
},
|
|
1905
|
+
RAIN: {
|
|
1906
|
+
symbol: "RAIN",
|
|
1907
|
+
name: "Rain",
|
|
1908
|
+
decimals: 18,
|
|
1909
|
+
address: "0x25118290e6a5f4139381d072181157035864099d",
|
|
1910
|
+
chainKey: ChainKeys.ARBITRUM_MAINNET,
|
|
1911
|
+
hubAsset: "0x1ec7afdbd09dcd9e7bc9ec651a0826aa6bfd3ede",
|
|
1912
|
+
vault: "0x1ec7afdbd09dcd9e7bc9ec651a0826aa6bfd3ede"
|
|
1665
1913
|
}
|
|
1666
1914
|
};
|
|
1667
1915
|
var baseSupportedTokens = {
|
|
@@ -1800,6 +2048,51 @@ var baseSupportedTokens = {
|
|
|
1800
2048
|
chainKey: ChainKeys.BASE_MAINNET,
|
|
1801
2049
|
hubAsset: "0x7e1af5084ac6f15afa97a5525b2e35a804e80b01",
|
|
1802
2050
|
vault: "0x7e1af5084ac6f15afa97a5525b2e35a804e80b01"
|
|
2051
|
+
},
|
|
2052
|
+
AAVE: {
|
|
2053
|
+
symbol: "AAVE",
|
|
2054
|
+
name: "Aave",
|
|
2055
|
+
decimals: 18,
|
|
2056
|
+
address: "0x63706e401c06ac8513145b7687a14804d17f814b",
|
|
2057
|
+
chainKey: ChainKeys.BASE_MAINNET,
|
|
2058
|
+
hubAsset: "0x4e525b4b09092ef4b8e142daf13eb20e0b2191c3",
|
|
2059
|
+
vault: "0x4e525b4b09092ef4b8e142daf13eb20e0b2191c3"
|
|
2060
|
+
},
|
|
2061
|
+
JitoSOL: {
|
|
2062
|
+
symbol: "JitoSOL",
|
|
2063
|
+
name: "Jito Staked SOL",
|
|
2064
|
+
decimals: 9,
|
|
2065
|
+
address: "0x97be14dd8f994a5364573bc035d85309e7cb34de",
|
|
2066
|
+
chainKey: ChainKeys.BASE_MAINNET,
|
|
2067
|
+
hubAsset: "0x16153346be11f0a3bfd586d4bd087199a94dae3c",
|
|
2068
|
+
vault: SodaTokens.sodaJITOSOL.address
|
|
2069
|
+
},
|
|
2070
|
+
SOL: {
|
|
2071
|
+
symbol: "SOL",
|
|
2072
|
+
name: "Base Bridged SOL (Base)",
|
|
2073
|
+
decimals: 9,
|
|
2074
|
+
address: "0x311935cd80b76769bf2ecc9d8ab7635b2139cf82",
|
|
2075
|
+
chainKey: ChainKeys.BASE_MAINNET,
|
|
2076
|
+
hubAsset: "0x53b6274b1d0d655084dda1c0a9f2330256374b84",
|
|
2077
|
+
vault: SodaTokens.sodaSOL.address
|
|
2078
|
+
},
|
|
2079
|
+
VVV: {
|
|
2080
|
+
symbol: "VVV",
|
|
2081
|
+
name: "Venice Token",
|
|
2082
|
+
decimals: 18,
|
|
2083
|
+
address: "0xacfe6019ed1a7dc6f7b508c02d1b04ec88cc21bf",
|
|
2084
|
+
chainKey: ChainKeys.BASE_MAINNET,
|
|
2085
|
+
hubAsset: "0x8451569f3b251670df4fef74721517bcbd4af00e",
|
|
2086
|
+
vault: "0x8451569f3b251670df4fef74721517bcbd4af00e"
|
|
2087
|
+
},
|
|
2088
|
+
ZEN: {
|
|
2089
|
+
symbol: "ZEN",
|
|
2090
|
+
name: "Horizen",
|
|
2091
|
+
decimals: 18,
|
|
2092
|
+
address: "0xf43eb8de897fbc7f2502483b2bef7bb9ea179229",
|
|
2093
|
+
chainKey: ChainKeys.BASE_MAINNET,
|
|
2094
|
+
hubAsset: "0x61d95d519907daa3cf505420b0d3c8607cd9f921",
|
|
2095
|
+
vault: "0x61d95d519907daa3cf505420b0d3c8607cd9f921"
|
|
1803
2096
|
}
|
|
1804
2097
|
};
|
|
1805
2098
|
var optimismSupportedTokens = {
|
|
@@ -2065,6 +2358,51 @@ var bscSupportedTokens = {
|
|
|
2065
2358
|
chainKey: ChainKeys.BSC_MAINNET,
|
|
2066
2359
|
hubAsset: "0xdab003b59749fe08fad6e0e7685f31bbcf4cbd6e",
|
|
2067
2360
|
vault: "0xdab003b59749fe08fad6e0e7685f31bbcf4cbd6e"
|
|
2361
|
+
},
|
|
2362
|
+
FF: {
|
|
2363
|
+
symbol: "FF",
|
|
2364
|
+
name: "Falcon Finance",
|
|
2365
|
+
decimals: 18,
|
|
2366
|
+
address: "0xac23b90a79504865d52b49b327328411a23d4db2",
|
|
2367
|
+
chainKey: ChainKeys.BSC_MAINNET,
|
|
2368
|
+
hubAsset: "0x2a3c409f26b0ac54889172f20441c25941b3c745",
|
|
2369
|
+
vault: "0x2a3c409f26b0ac54889172f20441c25941b3c745"
|
|
2370
|
+
},
|
|
2371
|
+
PENDLE: {
|
|
2372
|
+
symbol: "PENDLE",
|
|
2373
|
+
name: "Pendle",
|
|
2374
|
+
decimals: 18,
|
|
2375
|
+
address: "0xb3ed0a426155b79b898849803e3b36552f7ed507",
|
|
2376
|
+
chainKey: ChainKeys.BSC_MAINNET,
|
|
2377
|
+
hubAsset: "0xc059a10554d4e9a1dc4792db40ddf5137973b473",
|
|
2378
|
+
vault: "0xc059a10554d4e9a1dc4792db40ddf5137973b473"
|
|
2379
|
+
},
|
|
2380
|
+
STABLE: {
|
|
2381
|
+
symbol: "STABLE",
|
|
2382
|
+
name: "Stable",
|
|
2383
|
+
decimals: 18,
|
|
2384
|
+
address: "0x011ebe7d75e2c9d1e0bd0be0bef5c36f0a90075f",
|
|
2385
|
+
chainKey: ChainKeys.BSC_MAINNET,
|
|
2386
|
+
hubAsset: "0x4b7f7a7fcb3b45d41ab6c6727b0c1aeedc62aea7",
|
|
2387
|
+
vault: "0x4b7f7a7fcb3b45d41ab6c6727b0c1aeedc62aea7"
|
|
2388
|
+
},
|
|
2389
|
+
TUSD: {
|
|
2390
|
+
symbol: "TUSD",
|
|
2391
|
+
name: "TrueUSD",
|
|
2392
|
+
decimals: 18,
|
|
2393
|
+
address: "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9",
|
|
2394
|
+
chainKey: ChainKeys.BSC_MAINNET,
|
|
2395
|
+
hubAsset: "0x0ab0d545288137382d388ec679641de9f231f7fa",
|
|
2396
|
+
vault: "0x0ab0d545288137382d388ec679641de9f231f7fa"
|
|
2397
|
+
},
|
|
2398
|
+
U: {
|
|
2399
|
+
symbol: "U",
|
|
2400
|
+
name: "United Stables",
|
|
2401
|
+
decimals: 18,
|
|
2402
|
+
address: "0xce24439f2d9c6a2289f741120fe202248b666666",
|
|
2403
|
+
chainKey: ChainKeys.BSC_MAINNET,
|
|
2404
|
+
hubAsset: "0xd0c38d58d592ef223c5331673a189795e0f5510c",
|
|
2405
|
+
vault: "0xd0c38d58d592ef223c5331673a189795e0f5510c"
|
|
2068
2406
|
}
|
|
2069
2407
|
};
|
|
2070
2408
|
var polygonSupportedTokens = {
|
|
@@ -3048,6 +3386,15 @@ var suiSupportedTokens = {
|
|
|
3048
3386
|
chainKey: ChainKeys.SUI_MAINNET,
|
|
3049
3387
|
hubAsset: "0x2037d840f01e903e09e33b146f2dd3fa4a4d2c21",
|
|
3050
3388
|
vault: "0x2037d840f01e903e09e33b146f2dd3fa4a4d2c21"
|
|
3389
|
+
},
|
|
3390
|
+
USDY: {
|
|
3391
|
+
symbol: "USDY",
|
|
3392
|
+
name: "Ondo US Dollar Yield",
|
|
3393
|
+
decimals: 6,
|
|
3394
|
+
address: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY",
|
|
3395
|
+
chainKey: ChainKeys.SUI_MAINNET,
|
|
3396
|
+
hubAsset: "0x04dc969dc822f1b45d354b8fc296b23f5b924176",
|
|
3397
|
+
vault: "0x04dc969dc822f1b45d354b8fc296b23f5b924176"
|
|
3051
3398
|
}
|
|
3052
3399
|
};
|
|
3053
3400
|
var iconSupportedTokens = {
|
|
@@ -3446,6 +3793,123 @@ var ethereumSupportedTokens = {
|
|
|
3446
3793
|
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3447
3794
|
hubAsset: "0x081e274ec570bdb023f1b41c54df0f3f73da8924",
|
|
3448
3795
|
vault: "0x081e274ec570bdb023f1b41c54df0f3f73da8924"
|
|
3796
|
+
},
|
|
3797
|
+
AUSD: {
|
|
3798
|
+
symbol: "AUSD",
|
|
3799
|
+
name: "AUSD",
|
|
3800
|
+
decimals: 6,
|
|
3801
|
+
address: "0x00000000efe302beaa2b3e6e1b18d08d69a9012a",
|
|
3802
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3803
|
+
hubAsset: "0xa5c8482ba138872dc844dd4b15aaa21490d064ec",
|
|
3804
|
+
vault: "0xa5c8482ba138872dc844dd4b15aaa21490d064ec"
|
|
3805
|
+
},
|
|
3806
|
+
cirBTC: {
|
|
3807
|
+
symbol: "cirBTC",
|
|
3808
|
+
name: "Circle Wrapped BTC",
|
|
3809
|
+
decimals: 8,
|
|
3810
|
+
address: "0x72dfb2e44f59c5ad2bafe84314e5b99a7cd5075e",
|
|
3811
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3812
|
+
hubAsset: "0x1316179f1c6b6f2658f96bfe0bab59d0b03c7fd3",
|
|
3813
|
+
vault: SodaTokens.sodaBTC.address
|
|
3814
|
+
},
|
|
3815
|
+
CRV: {
|
|
3816
|
+
symbol: "CRV",
|
|
3817
|
+
name: "Curve DAO",
|
|
3818
|
+
decimals: 18,
|
|
3819
|
+
address: "0xd533a949740bb3306d119cc777fa900ba034cd52",
|
|
3820
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3821
|
+
hubAsset: "0x0f39fe572ff21675ba88dab6a60f824eae12a897",
|
|
3822
|
+
vault: "0x0f39fe572ff21675ba88dab6a60f824eae12a897"
|
|
3823
|
+
},
|
|
3824
|
+
EURC: {
|
|
3825
|
+
symbol: "EURC",
|
|
3826
|
+
name: "EURC",
|
|
3827
|
+
decimals: 6,
|
|
3828
|
+
address: "0x1abaea1f7c830bd89acc67ec4af516284b1bc33c",
|
|
3829
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3830
|
+
hubAsset: "0x0e5bf34dfd21c45934c342c3bc6bc76bf467b365",
|
|
3831
|
+
vault: "0x0e5bf34dfd21c45934c342c3bc6bc76bf467b365"
|
|
3832
|
+
},
|
|
3833
|
+
ICP: {
|
|
3834
|
+
symbol: "ICP",
|
|
3835
|
+
name: "Internet Computer",
|
|
3836
|
+
decimals: 8,
|
|
3837
|
+
address: "0x00f3c42833c3170159af4e92dbb451fb3f708917",
|
|
3838
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3839
|
+
hubAsset: "0x33ffb6bbe55f7e1081efe5ce95c2767937154b52",
|
|
3840
|
+
vault: "0x33ffb6bbe55f7e1081efe5ce95c2767937154b52"
|
|
3841
|
+
},
|
|
3842
|
+
kBTC: {
|
|
3843
|
+
symbol: "kBTC",
|
|
3844
|
+
name: "Kraken Wrapped BTC",
|
|
3845
|
+
decimals: 8,
|
|
3846
|
+
address: "0x73e0c0d45e048d25fc26fa3159b0aa04bfa4db98",
|
|
3847
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3848
|
+
hubAsset: "0xa42f8bae7a463f492ca81df8ab319a1177df586c",
|
|
3849
|
+
vault: SodaTokens.sodaBTC.address
|
|
3850
|
+
},
|
|
3851
|
+
NEAR: {
|
|
3852
|
+
symbol: "NEAR",
|
|
3853
|
+
name: "Rainbow Bridged Near (Ethereum)",
|
|
3854
|
+
decimals: 24,
|
|
3855
|
+
address: "0x85f17cf997934a597031b2e18a9ab6ebd4b9f6a4",
|
|
3856
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3857
|
+
hubAsset: "0x9295415078420d6d736aafa303430e24e89b0740",
|
|
3858
|
+
vault: SodaTokens.sodaNEAR.address
|
|
3859
|
+
},
|
|
3860
|
+
ONDO: {
|
|
3861
|
+
symbol: "ONDO",
|
|
3862
|
+
name: "Ondo",
|
|
3863
|
+
decimals: 18,
|
|
3864
|
+
address: "0xfaba6f8e4a5e8ab82f62fe7c39859fa577269be3",
|
|
3865
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3866
|
+
hubAsset: "0xe1fc12564dfb98c5aca98354ae4810d608600fa4",
|
|
3867
|
+
vault: "0xe1fc12564dfb98c5aca98354ae4810d608600fa4"
|
|
3868
|
+
},
|
|
3869
|
+
QNT: {
|
|
3870
|
+
symbol: "QNT",
|
|
3871
|
+
name: "Quant",
|
|
3872
|
+
decimals: 18,
|
|
3873
|
+
address: "0x4a220e6096b25eadb88358cb44068a3248254675",
|
|
3874
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3875
|
+
hubAsset: "0x65094257d27a71ffe4d7e9fef63c5243c885a7d1",
|
|
3876
|
+
vault: "0x65094257d27a71ffe4d7e9fef63c5243c885a7d1"
|
|
3877
|
+
},
|
|
3878
|
+
SOL: {
|
|
3879
|
+
symbol: "SOL",
|
|
3880
|
+
name: "Wormhole Bridged WSOL",
|
|
3881
|
+
decimals: 9,
|
|
3882
|
+
address: "0xd31a59c85ae9d8edefec411d448f90841571b89c",
|
|
3883
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3884
|
+
hubAsset: "0x3bb9c57dc70f33aa67fc33d7f88b9a2c5b1b392f",
|
|
3885
|
+
vault: SodaTokens.sodaSOL.address
|
|
3886
|
+
},
|
|
3887
|
+
tBTC: {
|
|
3888
|
+
symbol: "tBTC",
|
|
3889
|
+
name: "tBTC",
|
|
3890
|
+
decimals: 18,
|
|
3891
|
+
address: "0x18084fba666a33d37592fa2633fd49a74dd93a88",
|
|
3892
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3893
|
+
hubAsset: "0x79ce2f30c941308286f09ef5d815a14ad5830be3",
|
|
3894
|
+
vault: SodaTokens.sodaBTC.address
|
|
3895
|
+
},
|
|
3896
|
+
wM: {
|
|
3897
|
+
symbol: "wM",
|
|
3898
|
+
name: "WrappedM by M0",
|
|
3899
|
+
decimals: 6,
|
|
3900
|
+
address: "0x437cc33344a0b27a429f795ff6b469c72698b291",
|
|
3901
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3902
|
+
hubAsset: "0x512188ae67298355088c659c29bb2f78650c066a",
|
|
3903
|
+
vault: "0x512188ae67298355088c659c29bb2f78650c066a"
|
|
3904
|
+
},
|
|
3905
|
+
wTAO: {
|
|
3906
|
+
symbol: "wTAO",
|
|
3907
|
+
name: "Wrapped TAO",
|
|
3908
|
+
decimals: 9,
|
|
3909
|
+
address: "0x77e06c9eccf2e797fd462a92b6d7642ef85b0a44",
|
|
3910
|
+
chainKey: ChainKeys.ETHEREUM_MAINNET,
|
|
3911
|
+
hubAsset: "0xf0db27b881f28794b3a18bee0be18570ca60b966",
|
|
3912
|
+
vault: "0xf0db27b881f28794b3a18bee0be18570ca60b966"
|
|
3449
3913
|
}
|
|
3450
3914
|
};
|
|
3451
3915
|
var kaiaSupportedTokens = {
|
|
@@ -4162,6 +4626,33 @@ var robinhoodSupportedTokens = {
|
|
|
4162
4626
|
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
4163
4627
|
hubAsset: "0x9cf6640c73dd4c278cfa08a8b8773e7b22420582",
|
|
4164
4628
|
vault: "0x9cf6640c73dd4c278cfa08a8b8773e7b22420582"
|
|
4629
|
+
},
|
|
4630
|
+
AI: {
|
|
4631
|
+
symbol: "AI",
|
|
4632
|
+
name: "Artificial Inu",
|
|
4633
|
+
decimals: 18,
|
|
4634
|
+
address: "0x2e8c31162b855a2ffa90f6f8634643ad6f111e18",
|
|
4635
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
4636
|
+
hubAsset: "0x1c56aaf3fc5a4517132d8bdc636a798f31ccf4b0",
|
|
4637
|
+
vault: "0x1c56aaf3fc5a4517132d8bdc636a798f31ccf4b0"
|
|
4638
|
+
},
|
|
4639
|
+
CASHCAT: {
|
|
4640
|
+
symbol: "CASHCAT",
|
|
4641
|
+
name: "Cash Cat",
|
|
4642
|
+
decimals: 18,
|
|
4643
|
+
address: "0x020bfc650a365f8bb26819deaabf3e21291018b4",
|
|
4644
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
4645
|
+
hubAsset: "0x79150886ae702f6de9d36eb8748fcb9fcb483c2b",
|
|
4646
|
+
vault: "0x79150886ae702f6de9d36eb8748fcb9fcb483c2b"
|
|
4647
|
+
},
|
|
4648
|
+
TAO: {
|
|
4649
|
+
symbol: "TAO",
|
|
4650
|
+
name: "ForeverMoney Wrapped TAO",
|
|
4651
|
+
decimals: 18,
|
|
4652
|
+
address: "0xf3081494b87e8d5fb7960f066e931d1d0e6e3d67",
|
|
4653
|
+
chainKey: ChainKeys.ROBINHOOD_MAINNET,
|
|
4654
|
+
hubAsset: "0x4318e2fb5192256106e624565a64b6bb1c41e807",
|
|
4655
|
+
vault: "0x4318e2fb5192256106e624565a64b6bb1c41e807"
|
|
4165
4656
|
}
|
|
4166
4657
|
};
|
|
4167
4658
|
var stacksSupportedTokens = {
|
|
@@ -4273,7 +4764,7 @@ var RelayChainIdMap = {
|
|
|
4273
4764
|
};
|
|
4274
4765
|
var INTENT_CHAIN_IDS = Object.values(RelayChainIdMap);
|
|
4275
4766
|
var IntentRelayChainIdToChainKey = new Map(Object.entries(RelayChainIdMap).map(([chainKey, chainId]) => [chainId, chainKey]));
|
|
4276
|
-
var CHAIN_LOGO_BASE_URL = "https://raw.githubusercontent.com/
|
|
4767
|
+
var CHAIN_LOGO_BASE_URL = "https://raw.githubusercontent.com/gosodax/sodax-sdks/main/packages/assets/chain";
|
|
4277
4768
|
var chainLogo = (key) => `${CHAIN_LOGO_BASE_URL}/${key}.png`;
|
|
4278
4769
|
var baseChainInfo = {
|
|
4279
4770
|
[ChainKeys.SONIC_MAINNET]: {
|
|
@@ -6146,41 +6637,98 @@ var swapSupportedTokens = {
|
|
|
6146
6637
|
]
|
|
6147
6638
|
};
|
|
6148
6639
|
var stagingSwapSupportedTokens = {
|
|
6149
|
-
[ChainKeys.SONIC_MAINNET]: [],
|
|
6640
|
+
[ChainKeys.SONIC_MAINNET]: [SodaTokens.sodaADA],
|
|
6150
6641
|
[ChainKeys.AVALANCHE_MAINNET]: [],
|
|
6151
|
-
[ChainKeys.ARBITRUM_MAINNET]: [
|
|
6642
|
+
[ChainKeys.ARBITRUM_MAINNET]: [
|
|
6643
|
+
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.CHIP,
|
|
6644
|
+
spokeChainConfig[ChainKeys.ARBITRUM_MAINNET].supportedTokens.RAIN
|
|
6645
|
+
],
|
|
6152
6646
|
[ChainKeys.BASE_MAINNET]: [
|
|
6153
6647
|
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.bnUSD,
|
|
6154
|
-
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.AERO
|
|
6648
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.AERO,
|
|
6649
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.AAVE,
|
|
6650
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.JitoSOL,
|
|
6651
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.SOL,
|
|
6652
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.VVV,
|
|
6653
|
+
spokeChainConfig[ChainKeys.BASE_MAINNET].supportedTokens.ZEN
|
|
6155
6654
|
],
|
|
6156
6655
|
[ChainKeys.OPTIMISM_MAINNET]: [],
|
|
6157
6656
|
[ChainKeys.POLYGON_MAINNET]: [
|
|
6158
6657
|
spokeChainConfig[ChainKeys.POLYGON_MAINNET].supportedTokens.USDT,
|
|
6159
6658
|
spokeChainConfig[ChainKeys.POLYGON_MAINNET].supportedTokens.wstETH
|
|
6160
6659
|
],
|
|
6161
|
-
[ChainKeys.BSC_MAINNET]: [
|
|
6660
|
+
[ChainKeys.BSC_MAINNET]: [
|
|
6661
|
+
spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.FF,
|
|
6662
|
+
spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.PENDLE,
|
|
6663
|
+
spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.STABLE,
|
|
6664
|
+
spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.TUSD,
|
|
6665
|
+
spokeChainConfig[ChainKeys.BSC_MAINNET].supportedTokens.U
|
|
6666
|
+
],
|
|
6162
6667
|
[ChainKeys.HYPEREVM_MAINNET]: [],
|
|
6163
6668
|
[ChainKeys.LIGHTLINK_MAINNET]: [
|
|
6164
6669
|
spokeChainConfig[ChainKeys.LIGHTLINK_MAINNET].supportedTokens["HYPE.LL"]
|
|
6165
6670
|
],
|
|
6166
|
-
[ChainKeys.SOLANA_MAINNET]: [
|
|
6671
|
+
[ChainKeys.SOLANA_MAINNET]: [
|
|
6672
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens["2Z"],
|
|
6673
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.ANSEM,
|
|
6674
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.BP,
|
|
6675
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.CARDS,
|
|
6676
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.CASH,
|
|
6677
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.Fartcoin,
|
|
6678
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.GLDx,
|
|
6679
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.HOODx,
|
|
6680
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.HYPE,
|
|
6681
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.hyUSD,
|
|
6682
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.KMNO,
|
|
6683
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.LBTC,
|
|
6684
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.MET,
|
|
6685
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.ONYC,
|
|
6686
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.PENGU,
|
|
6687
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.PRIME,
|
|
6688
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.SPCXx,
|
|
6689
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.STONK,
|
|
6690
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.syrupUSDC,
|
|
6691
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.TRUMP,
|
|
6692
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.USX,
|
|
6693
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.xBTC,
|
|
6694
|
+
spokeChainConfig[ChainKeys.SOLANA_MAINNET].supportedTokens.ZEC
|
|
6695
|
+
],
|
|
6167
6696
|
[ChainKeys.ICON_MAINNET]: [],
|
|
6168
6697
|
[ChainKeys.STELLAR_MAINNET]: [],
|
|
6169
|
-
[ChainKeys.SUI_MAINNET]: [
|
|
6698
|
+
[ChainKeys.SUI_MAINNET]: [
|
|
6699
|
+
spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.USDT,
|
|
6700
|
+
spokeChainConfig[ChainKeys.SUI_MAINNET].supportedTokens.USDY
|
|
6701
|
+
],
|
|
6170
6702
|
[ChainKeys.INJECTIVE_MAINNET]: [],
|
|
6171
6703
|
[ChainKeys.NEAR_MAINNET]: [],
|
|
6172
6704
|
[ChainKeys.BITCOIN_MAINNET]: [],
|
|
6173
6705
|
[ChainKeys.ETHEREUM_MAINNET]: [
|
|
6174
6706
|
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.wstETH,
|
|
6175
|
-
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.weETH
|
|
6707
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.weETH,
|
|
6708
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.AUSD,
|
|
6709
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.cirBTC,
|
|
6710
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.CRV,
|
|
6711
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.EURC,
|
|
6712
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.ICP,
|
|
6713
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.kBTC,
|
|
6714
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.NEAR,
|
|
6715
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.ONDO,
|
|
6716
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.QNT,
|
|
6717
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.SOL,
|
|
6718
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.tBTC,
|
|
6719
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.wM,
|
|
6720
|
+
spokeChainConfig[ChainKeys.ETHEREUM_MAINNET].supportedTokens.wTAO
|
|
6176
6721
|
],
|
|
6177
6722
|
[ChainKeys.REDBELLY_MAINNET]: [],
|
|
6178
6723
|
[ChainKeys.KAIA_MAINNET]: [],
|
|
6179
6724
|
[ChainKeys.STACKS_MAINNET]: [],
|
|
6180
6725
|
// Hedera promoted to production — see swapSupportedTokens
|
|
6181
6726
|
[ChainKeys.HEDERA_MAINNET]: [],
|
|
6182
|
-
|
|
6183
|
-
|
|
6727
|
+
[ChainKeys.ROBINHOOD_MAINNET]: [
|
|
6728
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.AI,
|
|
6729
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.CASHCAT,
|
|
6730
|
+
spokeChainConfig[ChainKeys.ROBINHOOD_MAINNET].supportedTokens.TAO
|
|
6731
|
+
]
|
|
6184
6732
|
};
|
|
6185
6733
|
var swapsConfig = {
|
|
6186
6734
|
supportedTokens: swapSupportedTokens
|
|
@@ -6487,7 +7035,7 @@ function isValidWalletProviderForChainKey(chainKey, walletProvider) {
|
|
|
6487
7035
|
}
|
|
6488
7036
|
|
|
6489
7037
|
// ../types/dist/index.js
|
|
6490
|
-
var CONFIG_VERSION =
|
|
7038
|
+
var CONFIG_VERSION = 2030001;
|
|
6491
7039
|
var RC_STABLE = 99;
|
|
6492
7040
|
var MIN_CONFIG_VERSION = 1e6;
|
|
6493
7041
|
var MAX_CONFIG_VERSION = 99999999;
|
|
@@ -6740,12 +7288,12 @@ function canonicalizeBitcoinAddress(address$1) {
|
|
|
6740
7288
|
}
|
|
6741
7289
|
}
|
|
6742
7290
|
function normalizePsbtToBase64(signedPsbt) {
|
|
6743
|
-
const
|
|
6744
|
-
return
|
|
7291
|
+
const isHex4 = /^[0-9a-fA-F]+$/.test(signedPsbt);
|
|
7292
|
+
return isHex4 ? Buffer.from(signedPsbt, "hex").toString("base64") : signedPsbt;
|
|
6745
7293
|
}
|
|
6746
7294
|
function normalizeSignatureToBase64(signature) {
|
|
6747
|
-
const
|
|
6748
|
-
return
|
|
7295
|
+
const isHex4 = /^[0-9a-fA-F]+$/.test(signature);
|
|
7296
|
+
return isHex4 ? Buffer.from(signature, "hex").toString("base64") : signature;
|
|
6749
7297
|
}
|
|
6750
7298
|
function isNativeBitcoinTransfer(config, chainKey, token) {
|
|
6751
7299
|
return isBitcoinChainKeyType(chainKey) && !!token && isNativeBitcoinToken(config.getChainConfig(chainKey), token.address);
|
|
@@ -7150,7 +7698,8 @@ function mapRelayFailure(error, ctx) {
|
|
|
7150
7698
|
const baseCtx = {
|
|
7151
7699
|
action: ctx.action,
|
|
7152
7700
|
srcChainKey: ctx.srcChainKey,
|
|
7153
|
-
dstChainKey: ctx.dstChainKey
|
|
7701
|
+
dstChainKey: ctx.dstChainKey,
|
|
7702
|
+
...ctx.srcTxHash !== void 0 && { srcTxHash: ctx.srcTxHash }
|
|
7154
7703
|
};
|
|
7155
7704
|
if (message === RELAY_ERROR_CODES.RELAY_TIMEOUT) {
|
|
7156
7705
|
return new SodaxError("RELAY_TIMEOUT", "Relay packet did not arrive within timeout", {
|
|
@@ -7235,9 +7784,11 @@ function isWalletRejection(error) {
|
|
|
7235
7784
|
if (typeof error !== "object") return false;
|
|
7236
7785
|
const o = error;
|
|
7237
7786
|
if (o.name === "UserRejectedRequestError") return true;
|
|
7787
|
+
if (o.name === "AtomicReadyWalletRejectedUpgradeError") return true;
|
|
7238
7788
|
if (o.name === "WalletSignTransactionError" && matchRejectionText(o.message)) return true;
|
|
7239
7789
|
if (o.name === "WalletConnectionError" && matchRejectionText(o.message)) return true;
|
|
7240
7790
|
if (o.code === 4001) return true;
|
|
7791
|
+
if (o.code === 5750) return true;
|
|
7241
7792
|
if (o.code === "ACTION_REJECTED") return true;
|
|
7242
7793
|
if (o.code === "CANCEL_SIGNING") return true;
|
|
7243
7794
|
if (o.code === "CANCEL_JSON-RPC") return true;
|
|
@@ -7299,6 +7850,13 @@ function allowanceCheckFailed(feature, cause, context) {
|
|
|
7299
7850
|
context: { phase: "allowanceCheck", ...context }
|
|
7300
7851
|
});
|
|
7301
7852
|
}
|
|
7853
|
+
function withErrorContext(error, context) {
|
|
7854
|
+
return new SodaxError(error.code, error.message, {
|
|
7855
|
+
feature: error.feature,
|
|
7856
|
+
cause: error.cause,
|
|
7857
|
+
context: { ...error.context, ...context }
|
|
7858
|
+
});
|
|
7859
|
+
}
|
|
7302
7860
|
function gasEstimationFailed(feature, cause, context) {
|
|
7303
7861
|
return new SodaxError("GAS_ESTIMATION_FAILED", messageOf(cause, "Gas estimation failed"), {
|
|
7304
7862
|
feature,
|
|
@@ -16619,7 +17177,7 @@ function mergeSodaxConfig(base2, override) {
|
|
|
16619
17177
|
}
|
|
16620
17178
|
function encodeContractCalls(calls) {
|
|
16621
17179
|
return encodeAbiParameters(parseAbiParameters("(address,uint256,bytes)[]"), [
|
|
16622
|
-
calls.map((
|
|
17180
|
+
calls.map((v11) => [v11.address, v11.value, v11.data])
|
|
16623
17181
|
]);
|
|
16624
17182
|
}
|
|
16625
17183
|
async function waitForTransactionReceipt(hash, provider) {
|
|
@@ -16732,6 +17290,172 @@ function getEvmViemChain(key) {
|
|
|
16732
17290
|
}
|
|
16733
17291
|
}
|
|
16734
17292
|
}
|
|
17293
|
+
|
|
17294
|
+
// src/shared/utils/evmAtomicBatch.ts
|
|
17295
|
+
function canSendAtomicBatch(walletProvider) {
|
|
17296
|
+
return typeof walletProvider.getAtomicBatchSupport === "function" && typeof walletProvider.sendAtomicBatch === "function" && typeof walletProvider.waitForBatch === "function";
|
|
17297
|
+
}
|
|
17298
|
+
async function readAtomicBatchSupport(walletProvider, chainId) {
|
|
17299
|
+
try {
|
|
17300
|
+
return await walletProvider.getAtomicBatchSupport(chainId);
|
|
17301
|
+
} catch {
|
|
17302
|
+
return "unsupported";
|
|
17303
|
+
}
|
|
17304
|
+
}
|
|
17305
|
+
var BATCH_REFUSED_CODES = /* @__PURE__ */ new Set([4200, -32601, 5700, 5710, 5740, 5760]);
|
|
17306
|
+
var MAX_CAUSE_DEPTH2 = 5;
|
|
17307
|
+
var UPGRADE_DECLINED_CODE = 5750;
|
|
17308
|
+
function isAtomicBatchRefused(error) {
|
|
17309
|
+
return hasErrorCode(error, (code) => BATCH_REFUSED_CODES.has(code));
|
|
17310
|
+
}
|
|
17311
|
+
function isAccountUpgradeDeclined(error) {
|
|
17312
|
+
return hasErrorCode(error, (code) => code === UPGRADE_DECLINED_CODE);
|
|
17313
|
+
}
|
|
17314
|
+
function hasErrorCode(error, matches) {
|
|
17315
|
+
let current = error;
|
|
17316
|
+
for (let depth = 0; depth < MAX_CAUSE_DEPTH2 && typeof current === "object" && current !== null; depth++) {
|
|
17317
|
+
const code = "code" in current ? current.code : void 0;
|
|
17318
|
+
if (typeof code === "number" && matches(code)) return true;
|
|
17319
|
+
current = "cause" in current ? current.cause : void 0;
|
|
17320
|
+
}
|
|
17321
|
+
return false;
|
|
17322
|
+
}
|
|
17323
|
+
|
|
17324
|
+
// src/shared/utils/approvalBatch.ts
|
|
17325
|
+
function approvalBatchWaitMs(timeout) {
|
|
17326
|
+
return Math.max(resolveTimeoutMs(timeout, DEFAULT_RELAY_TX_TIMEOUT), DEFAULT_RELAY_TX_TIMEOUT);
|
|
17327
|
+
}
|
|
17328
|
+
var ATOMIC_BATCH_REFUSED = "atomic-batch-refused";
|
|
17329
|
+
var ATOMIC_BATCH_UNCONFIRMED = "atomic-batch-unconfirmed";
|
|
17330
|
+
var ACCOUNT_UPGRADE_DECLINED = "account-upgrade-declined";
|
|
17331
|
+
var BATCH_NOTHING_LANDED_CODES = /* @__PURE__ */ new Set([400, 500]);
|
|
17332
|
+
async function resolveApprovalStrategy({
|
|
17333
|
+
srcChainKey,
|
|
17334
|
+
walletProvider,
|
|
17335
|
+
allowAccountUpgrade = true
|
|
17336
|
+
}) {
|
|
17337
|
+
if (isEvmSpokeOnlyChainKeyType(srcChainKey) && isEvmWalletProviderType(walletProvider) && canSendAtomicBatch(walletProvider)) {
|
|
17338
|
+
const support = await readAtomicBatchSupport(walletProvider, getEvmViemChain(srcChainKey).id);
|
|
17339
|
+
if (support === "supported" || support === "ready" && allowAccountUpgrade) return "atomic-batch";
|
|
17340
|
+
}
|
|
17341
|
+
return "sequential";
|
|
17342
|
+
}
|
|
17343
|
+
async function sendApprovalBatch({
|
|
17344
|
+
walletProvider,
|
|
17345
|
+
srcChainKey,
|
|
17346
|
+
txs,
|
|
17347
|
+
timeoutMs,
|
|
17348
|
+
feature,
|
|
17349
|
+
context,
|
|
17350
|
+
onBatchSent
|
|
17351
|
+
}) {
|
|
17352
|
+
if (!canSendAtomicBatch(walletProvider)) {
|
|
17353
|
+
return {
|
|
17354
|
+
ok: false,
|
|
17355
|
+
error: new SodaxError("INTENT_CREATION_FAILED", "Wallet provider does not implement EIP-5792 batches", {
|
|
17356
|
+
feature,
|
|
17357
|
+
context: { ...context, phase: "intentCreation", reason: ATOMIC_BATCH_REFUSED }
|
|
17358
|
+
})
|
|
17359
|
+
};
|
|
17360
|
+
}
|
|
17361
|
+
let batchId;
|
|
17362
|
+
try {
|
|
17363
|
+
batchId = await walletProvider.sendAtomicBatch(txs, { expectedChainId: getEvmViemChain(srcChainKey).id });
|
|
17364
|
+
} catch (error) {
|
|
17365
|
+
const reason = isAtomicBatchRefused(error) ? ATOMIC_BATCH_REFUSED : isAccountUpgradeDeclined(error) ? ACCOUNT_UPGRADE_DECLINED : void 0;
|
|
17366
|
+
return { ok: false, error: intentCreationFailed(feature, error, { ...context, ...reason && { reason } }) };
|
|
17367
|
+
}
|
|
17368
|
+
try {
|
|
17369
|
+
onBatchSent?.(batchId);
|
|
17370
|
+
} catch {
|
|
17371
|
+
}
|
|
17372
|
+
return confirmApprovalBatch({ walletProvider, batchId, callCount: txs.length, timeoutMs, feature, context });
|
|
17373
|
+
}
|
|
17374
|
+
async function confirmApprovalBatch({
|
|
17375
|
+
walletProvider,
|
|
17376
|
+
batchId,
|
|
17377
|
+
callCount,
|
|
17378
|
+
timeoutMs,
|
|
17379
|
+
feature,
|
|
17380
|
+
context
|
|
17381
|
+
}) {
|
|
17382
|
+
const unconfirmed = (cause) => ({
|
|
17383
|
+
ok: false,
|
|
17384
|
+
error: new SodaxError("TX_VERIFICATION_FAILED", "Atomic approval batch was sent but not confirmed", {
|
|
17385
|
+
feature,
|
|
17386
|
+
cause,
|
|
17387
|
+
context: {
|
|
17388
|
+
...context,
|
|
17389
|
+
phase: "verify",
|
|
17390
|
+
reason: ATOMIC_BATCH_UNCONFIRMED,
|
|
17391
|
+
batchId,
|
|
17392
|
+
...callCount !== void 0 && { callCount }
|
|
17393
|
+
}
|
|
17394
|
+
})
|
|
17395
|
+
});
|
|
17396
|
+
if (!canSendAtomicBatch(walletProvider)) return unconfirmed();
|
|
17397
|
+
try {
|
|
17398
|
+
const batch = await walletProvider.waitForBatch(batchId, { timeout: Math.max(1, timeoutMs) });
|
|
17399
|
+
if (batch.status !== "success" && !BATCH_NOTHING_LANDED_CODES.has(batch.statusCode)) return unconfirmed();
|
|
17400
|
+
if (batch.status !== "success") {
|
|
17401
|
+
return {
|
|
17402
|
+
ok: false,
|
|
17403
|
+
error: new SodaxError("INTENT_CREATION_FAILED", "Atomic approval batch did not succeed", {
|
|
17404
|
+
feature,
|
|
17405
|
+
context: {
|
|
17406
|
+
...context,
|
|
17407
|
+
phase: "intentCreation",
|
|
17408
|
+
reason: "atomic-batch-failed",
|
|
17409
|
+
batchId,
|
|
17410
|
+
statusCode: batch.statusCode
|
|
17411
|
+
}
|
|
17412
|
+
})
|
|
17413
|
+
};
|
|
17414
|
+
}
|
|
17415
|
+
const { receipts } = batch;
|
|
17416
|
+
const oneTx = new Set(receipts.map((receipt) => receipt.transactionHash)).size === 1;
|
|
17417
|
+
const depositReceipt = oneTx || receipts.length === callCount ? receipts.at(-1) : void 0;
|
|
17418
|
+
if (depositReceipt?.status !== "success") return unconfirmed();
|
|
17419
|
+
return { ok: true, value: { txHash: depositReceipt.transactionHash, batchId } };
|
|
17420
|
+
} catch (error) {
|
|
17421
|
+
return unconfirmed(error);
|
|
17422
|
+
}
|
|
17423
|
+
}
|
|
17424
|
+
async function confirmApproval({
|
|
17425
|
+
waitForTxReceipt,
|
|
17426
|
+
txHash,
|
|
17427
|
+
chainKey,
|
|
17428
|
+
feature,
|
|
17429
|
+
context
|
|
17430
|
+
}) {
|
|
17431
|
+
const receipt = await waitForTxReceipt({ txHash, chainKey });
|
|
17432
|
+
if (receipt.ok && receipt.value.status === "success") return { ok: true, value: void 0 };
|
|
17433
|
+
return {
|
|
17434
|
+
ok: false,
|
|
17435
|
+
error: new SodaxError("APPROVE_FAILED", `Approval transaction ${txHash} did not confirm`, {
|
|
17436
|
+
feature,
|
|
17437
|
+
cause: receipt.ok ? receipt.value : receipt.error,
|
|
17438
|
+
context: { ...context, phase: "approve", reason: "approve-not-confirmed", approveTxHash: txHash }
|
|
17439
|
+
})
|
|
17440
|
+
};
|
|
17441
|
+
}
|
|
17442
|
+
function isAtomicBatchRefusal(error) {
|
|
17443
|
+
return isSodaxError(error) && error.code === "INTENT_CREATION_FAILED" && error.context?.reason === ATOMIC_BATCH_REFUSED;
|
|
17444
|
+
}
|
|
17445
|
+
async function runWithApproval({
|
|
17446
|
+
strategy,
|
|
17447
|
+
notRequired,
|
|
17448
|
+
atomicBatch,
|
|
17449
|
+
sequential,
|
|
17450
|
+
onBatchRefused
|
|
17451
|
+
}) {
|
|
17452
|
+
if (strategy === "not-required") return { result: await notRequired(), approvalStrategy: strategy };
|
|
17453
|
+
if (strategy === "sequential") return { result: await sequential(false), approvalStrategy: strategy };
|
|
17454
|
+
const batched = await atomicBatch();
|
|
17455
|
+
if (batched.ok || !isAtomicBatchRefusal(batched.error)) return { result: batched, approvalStrategy: "atomic-batch" };
|
|
17456
|
+
onBatchRefused?.(batched.error);
|
|
17457
|
+
return { result: await sequential(true), approvalStrategy: "sequential" };
|
|
17458
|
+
}
|
|
16735
17459
|
var EvmVaultTokenService = class {
|
|
16736
17460
|
constructor() {
|
|
16737
17461
|
}
|
|
@@ -17717,7 +18441,11 @@ var StacksSpokeService = class {
|
|
|
17717
18441
|
async getWalletBalances(params) {
|
|
17718
18442
|
const { srcChainKey, srcAddress, tokens } = params;
|
|
17719
18443
|
const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
|
|
17720
|
-
await settleWalletBalances(
|
|
18444
|
+
await settleWalletBalances(
|
|
18445
|
+
collector,
|
|
18446
|
+
tokens,
|
|
18447
|
+
(token) => this.getWalletBalance({ srcChainKey, srcAddress, token })
|
|
18448
|
+
);
|
|
17721
18449
|
return collector.finish();
|
|
17722
18450
|
}
|
|
17723
18451
|
/**
|
|
@@ -19522,22 +20250,22 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
19522
20250
|
const byte0 = Uint8Array.of(0);
|
|
19523
20251
|
const byte1 = Uint8Array.of(1);
|
|
19524
20252
|
const _maxDrbgIters = 1e3;
|
|
19525
|
-
let
|
|
20253
|
+
let v11 = u8n(hashLen);
|
|
19526
20254
|
let k = u8n(hashLen);
|
|
19527
20255
|
let i = 0;
|
|
19528
20256
|
const reset = () => {
|
|
19529
|
-
|
|
20257
|
+
v11.fill(1);
|
|
19530
20258
|
k.fill(0);
|
|
19531
20259
|
i = 0;
|
|
19532
20260
|
};
|
|
19533
|
-
const h = (...msgs) => hmacFn(k, concatBytes(
|
|
20261
|
+
const h = (...msgs) => hmacFn(k, concatBytes(v11, ...msgs));
|
|
19534
20262
|
const reseed = (seed = NULL) => {
|
|
19535
20263
|
k = h(byte0, seed);
|
|
19536
|
-
|
|
20264
|
+
v11 = h();
|
|
19537
20265
|
if (seed.length === 0)
|
|
19538
20266
|
return;
|
|
19539
20267
|
k = h(byte1, seed);
|
|
19540
|
-
|
|
20268
|
+
v11 = h();
|
|
19541
20269
|
};
|
|
19542
20270
|
const gen = () => {
|
|
19543
20271
|
if (i++ >= _maxDrbgIters)
|
|
@@ -19545,10 +20273,10 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) {
|
|
|
19545
20273
|
let len = 0;
|
|
19546
20274
|
const out = [];
|
|
19547
20275
|
while (len < qByteLen) {
|
|
19548
|
-
|
|
19549
|
-
const sl =
|
|
20276
|
+
v11 = h();
|
|
20277
|
+
const sl = v11.slice();
|
|
19550
20278
|
out.push(sl);
|
|
19551
|
-
len +=
|
|
20279
|
+
len += v11.length;
|
|
19552
20280
|
}
|
|
19553
20281
|
return concatBytes(...out);
|
|
19554
20282
|
};
|
|
@@ -19574,7 +20302,7 @@ function validateObject(object4, fields = {}, optFields = {}) {
|
|
|
19574
20302
|
if (current !== expectedType || val === null)
|
|
19575
20303
|
throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`);
|
|
19576
20304
|
}
|
|
19577
|
-
const iter = (f, isOpt) => Object.entries(f).forEach(([k,
|
|
20305
|
+
const iter = (f, isOpt) => Object.entries(f).forEach(([k, v11]) => checkField(k, v11, isOpt));
|
|
19578
20306
|
iter(fields, false);
|
|
19579
20307
|
iter(optFields, true);
|
|
19580
20308
|
}
|
|
@@ -19645,9 +20373,9 @@ function sqrt3mod4(Fp, n) {
|
|
|
19645
20373
|
function sqrt5mod8(Fp, n) {
|
|
19646
20374
|
const p5div8 = (Fp.ORDER - _5n) / _8n;
|
|
19647
20375
|
const n2 = Fp.mul(n, _2n);
|
|
19648
|
-
const
|
|
19649
|
-
const nv = Fp.mul(n,
|
|
19650
|
-
const i = Fp.mul(Fp.mul(nv, _2n),
|
|
20376
|
+
const v11 = Fp.pow(n2, p5div8);
|
|
20377
|
+
const nv = Fp.mul(n, v11);
|
|
20378
|
+
const i = Fp.mul(Fp.mul(nv, _2n), v11);
|
|
19651
20379
|
const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));
|
|
19652
20380
|
assertIsSquare(Fp, root, n);
|
|
19653
20381
|
return root;
|
|
@@ -20229,9 +20957,9 @@ function edwards(params, extraOpts = {}) {
|
|
|
20229
20957
|
validateObject(extraOpts, {}, { uvRatio: "function" });
|
|
20230
20958
|
const MASK = _2n2 << BigInt(Fn.BYTES * 8) - _1n4;
|
|
20231
20959
|
const modP = (n) => Fp.create(n);
|
|
20232
|
-
const uvRatio2 = extraOpts.uvRatio || ((u,
|
|
20960
|
+
const uvRatio2 = extraOpts.uvRatio || ((u, v11) => {
|
|
20233
20961
|
try {
|
|
20234
|
-
return { isValid: true, value: Fp.sqrt(Fp.div(u,
|
|
20962
|
+
return { isValid: true, value: Fp.sqrt(Fp.div(u, v11)) };
|
|
20235
20963
|
} catch (e) {
|
|
20236
20964
|
return { isValid: false, value: _0n4 };
|
|
20237
20965
|
}
|
|
@@ -20327,8 +21055,8 @@ function edwards(params, extraOpts = {}) {
|
|
|
20327
21055
|
aInRange("point.y", y, _0n4, max);
|
|
20328
21056
|
const y2 = modP(y * y);
|
|
20329
21057
|
const u = modP(y2 - _1n4);
|
|
20330
|
-
const
|
|
20331
|
-
let { isValid, value: x } = uvRatio2(u,
|
|
21058
|
+
const v11 = modP(d * y2 - a);
|
|
21059
|
+
let { isValid, value: x } = uvRatio2(u, v11);
|
|
20332
21060
|
if (!isValid)
|
|
20333
21061
|
throw new Error("bad point: invalid y coordinate");
|
|
20334
21062
|
const isXOdd = (x & _1n4) === _1n4;
|
|
@@ -20668,13 +21396,13 @@ function adjustScalarBytes(bytes) {
|
|
|
20668
21396
|
return bytes;
|
|
20669
21397
|
}
|
|
20670
21398
|
var ED25519_SQRT_M1 = /* @__PURE__ */ BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");
|
|
20671
|
-
function uvRatio(u,
|
|
21399
|
+
function uvRatio(u, v11) {
|
|
20672
21400
|
const P = ed25519_CURVE_p;
|
|
20673
|
-
const v32 = mod(
|
|
20674
|
-
const v72 = mod(v32 * v32 *
|
|
21401
|
+
const v32 = mod(v11 * v11 * v11, P);
|
|
21402
|
+
const v72 = mod(v32 * v32 * v11, P);
|
|
20675
21403
|
const pow = ed25519_pow_2_252_3(u * v72).pow_p_5_8;
|
|
20676
21404
|
let x = mod(u * v32 * pow, P);
|
|
20677
|
-
const vx2 = mod(
|
|
21405
|
+
const vx2 = mod(v11 * x * x, P);
|
|
20678
21406
|
const root1 = x;
|
|
20679
21407
|
const root2 = mod(x * ED25519_SQRT_M1, P);
|
|
20680
21408
|
const useRoot1 = vx2 === u;
|
|
@@ -21005,7 +21733,7 @@ function findSeatPrice(validators, maxNumberOfSeats, minimumStakeRatio, protocol
|
|
|
21005
21733
|
return findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumStakeRatio);
|
|
21006
21734
|
}
|
|
21007
21735
|
function findSeatPriceForProtocolBefore49(validators, numSeats) {
|
|
21008
|
-
const stakes = validators.map((
|
|
21736
|
+
const stakes = validators.map((v11) => BigInt(v11.stake)).sort(sortBigIntAsc);
|
|
21009
21737
|
const num = BigInt(numSeats);
|
|
21010
21738
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
21011
21739
|
if (stakesSum < num) {
|
|
@@ -21034,7 +21762,7 @@ function findSeatPriceForProtocolAfter49(validators, maxNumberOfSeats, minimumSt
|
|
|
21034
21762
|
if (minimumStakeRatio.length != 2) {
|
|
21035
21763
|
throw Error("minimumStakeRatio should have 2 elements");
|
|
21036
21764
|
}
|
|
21037
|
-
const stakes = validators.map((
|
|
21765
|
+
const stakes = validators.map((v11) => BigInt(v11.stake)).sort(sortBigIntAsc);
|
|
21038
21766
|
const stakesSum = stakes.reduce((a, b) => a + b);
|
|
21039
21767
|
if (validators.length < maxNumberOfSeats) {
|
|
21040
21768
|
return stakesSum * BigInt(minimumStakeRatio[0]) / BigInt(minimumStakeRatio[1]);
|
|
@@ -21206,10 +21934,10 @@ var DER = {
|
|
|
21206
21934
|
if (length < 128)
|
|
21207
21935
|
throw new E("tlv.decode(long): not minimal encoding");
|
|
21208
21936
|
}
|
|
21209
|
-
const
|
|
21210
|
-
if (
|
|
21937
|
+
const v11 = data.subarray(pos, pos + length);
|
|
21938
|
+
if (v11.length !== length)
|
|
21211
21939
|
throw new E("tlv.decode: wrong value length");
|
|
21212
|
-
return { v:
|
|
21940
|
+
return { v: v11, l: data.subarray(pos + length) };
|
|
21213
21941
|
}
|
|
21214
21942
|
},
|
|
21215
21943
|
// https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,
|
|
@@ -21956,14 +22684,14 @@ function ecdsa(Point, hash, ecdsaOpts = {}) {
|
|
|
21956
22684
|
return false;
|
|
21957
22685
|
const { r, s } = sig;
|
|
21958
22686
|
const h = bits2int_modN(message);
|
|
21959
|
-
const
|
|
21960
|
-
const u1 = Fn.create(h *
|
|
21961
|
-
const u2 = Fn.create(r *
|
|
22687
|
+
const is4 = Fn.inv(s);
|
|
22688
|
+
const u1 = Fn.create(h * is4);
|
|
22689
|
+
const u2 = Fn.create(r * is4);
|
|
21962
22690
|
const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2));
|
|
21963
22691
|
if (R.is0())
|
|
21964
22692
|
return false;
|
|
21965
|
-
const
|
|
21966
|
-
return
|
|
22693
|
+
const v11 = Fn.create(R.x);
|
|
22694
|
+
return v11 === r;
|
|
21967
22695
|
} catch (e) {
|
|
21968
22696
|
return false;
|
|
21969
22697
|
}
|
|
@@ -24858,7 +25586,11 @@ var NearSpokeService = class {
|
|
|
24858
25586
|
async getWalletBalances(params) {
|
|
24859
25587
|
const { srcChainKey, srcAddress, tokens } = params;
|
|
24860
25588
|
const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
|
|
24861
|
-
await settleWalletBalances(
|
|
25589
|
+
await settleWalletBalances(
|
|
25590
|
+
collector,
|
|
25591
|
+
tokens,
|
|
25592
|
+
(token) => this.getWalletBalance({ srcChainKey, srcAddress, token })
|
|
25593
|
+
);
|
|
24862
25594
|
return collector.finish();
|
|
24863
25595
|
}
|
|
24864
25596
|
/**
|
|
@@ -27141,7 +27873,11 @@ var SolanaSpokeService = class _SolanaSpokeService {
|
|
|
27141
27873
|
async getWalletBalances(params) {
|
|
27142
27874
|
const { srcChainKey, srcAddress, tokens } = params;
|
|
27143
27875
|
const collector = createBalanceCollector({ logger: this.config.logger, chainKey: srcChainKey });
|
|
27144
|
-
await settleWalletBalances(
|
|
27876
|
+
await settleWalletBalances(
|
|
27877
|
+
collector,
|
|
27878
|
+
tokens,
|
|
27879
|
+
(token) => this.getWalletBalance({ srcChainKey, srcAddress, token })
|
|
27880
|
+
);
|
|
27145
27881
|
return collector.finish();
|
|
27146
27882
|
}
|
|
27147
27883
|
/**
|
|
@@ -27997,9 +28733,9 @@ var SpokeService = class _SpokeService {
|
|
|
27997
28733
|
* Sign and broadcast the approval plan for an ERC-20 on the hub or an EVM spoke.
|
|
27998
28734
|
*
|
|
27999
28735
|
* A token of the TetherToken lineage rejects an allowance change from one non-zero value to
|
|
28000
|
-
* another, so a wallet holding a stale allowance needs `approve(0)` first.
|
|
28001
|
-
*
|
|
28002
|
-
*
|
|
28736
|
+
* another, so a wallet holding a stale allowance needs `approve(0)` first. Sent as separate
|
|
28737
|
+
* transactions, each is only valid once its predecessor has been mined, so this waits between them
|
|
28738
|
+
* (an EIP-5792 atomic batch can carry both, in order). The hash of the last is returned.
|
|
28003
28739
|
*/
|
|
28004
28740
|
async executeErc20ApprovalPlan(params) {
|
|
28005
28741
|
const { walletProvider } = params;
|
|
@@ -29872,12 +30608,195 @@ var EvmHubProvider = class {
|
|
|
29872
30608
|
});
|
|
29873
30609
|
}
|
|
29874
30610
|
};
|
|
30611
|
+
var ChainKeySchema = v.custom((input) => typeof input === "string");
|
|
30612
|
+
var SpokeChainKeySchema = v.custom((input) => typeof input === "string");
|
|
30613
|
+
var AddressSchema = v.custom((input) => typeof input === "string");
|
|
30614
|
+
var XTokenSchema = v.object({
|
|
30615
|
+
symbol: v.string(),
|
|
30616
|
+
name: v.string(),
|
|
30617
|
+
decimals: v.number(),
|
|
30618
|
+
address: v.string(),
|
|
30619
|
+
chainKey: ChainKeySchema,
|
|
30620
|
+
hubAsset: AddressSchema,
|
|
30621
|
+
vault: AddressSchema,
|
|
30622
|
+
access: v.optional(v.picklist(["withdrawOnly", "depositOnly"]))
|
|
30623
|
+
});
|
|
30624
|
+
var IntentStructSchema = v.object({
|
|
30625
|
+
intentId: v.string(),
|
|
30626
|
+
creator: v.string(),
|
|
30627
|
+
inputToken: v.string(),
|
|
30628
|
+
outputToken: v.string(),
|
|
30629
|
+
inputAmount: v.string(),
|
|
30630
|
+
minOutputAmount: v.string(),
|
|
30631
|
+
deadline: v.string(),
|
|
30632
|
+
allowPartialFill: v.boolean(),
|
|
30633
|
+
srcChain: v.number(),
|
|
30634
|
+
dstChain: v.number(),
|
|
30635
|
+
srcAddress: v.string(),
|
|
30636
|
+
dstAddress: v.string(),
|
|
30637
|
+
solver: v.string(),
|
|
30638
|
+
data: v.string()
|
|
30639
|
+
});
|
|
30640
|
+
var FillEventSchema = v.object({
|
|
30641
|
+
eventType: v.literal("intent-filled"),
|
|
30642
|
+
// The hub-chain fill tx; an empty one is no use as `fill_tx_hash`.
|
|
30643
|
+
txHash: v.pipe(v.string(), v.nonEmpty()),
|
|
30644
|
+
// Terminality. An intent created with `allowPartialFill` emits a fill event per fill, so the
|
|
30645
|
+
// event alone does not mean the intent is done — only `remainingInput === '0'` does. Required:
|
|
30646
|
+
// without it there is no proof of completion, and claiming SOLVED on a partial fill would report
|
|
30647
|
+
// an unfinished swap as complete.
|
|
30648
|
+
intentState: v.object({
|
|
30649
|
+
remainingInput: v.string()
|
|
30650
|
+
})
|
|
30651
|
+
});
|
|
30652
|
+
var IntentEventTypeSchema = v.object({ eventType: v.string() });
|
|
30653
|
+
var IntentResponseSchema = v.object({
|
|
30654
|
+
intentHash: v.string(),
|
|
30655
|
+
txHash: v.string(),
|
|
30656
|
+
logIndex: v.number(),
|
|
30657
|
+
chainId: v.number(),
|
|
30658
|
+
blockNumber: v.number(),
|
|
30659
|
+
open: v.boolean(),
|
|
30660
|
+
intent: IntentStructSchema,
|
|
30661
|
+
events: v.array(v.unknown())
|
|
30662
|
+
});
|
|
30663
|
+
var UserIntentsResponseSchema = v.object({
|
|
30664
|
+
total: v.number(),
|
|
30665
|
+
offset: v.number(),
|
|
30666
|
+
limit: v.number(),
|
|
30667
|
+
items: v.array(IntentResponseSchema)
|
|
30668
|
+
});
|
|
30669
|
+
var OrderbookResponseSchema = v.object({
|
|
30670
|
+
total: v.number(),
|
|
30671
|
+
data: v.array(
|
|
30672
|
+
v.object({
|
|
30673
|
+
intentState: v.object({
|
|
30674
|
+
exists: v.boolean(),
|
|
30675
|
+
remainingInput: v.string(),
|
|
30676
|
+
receivedOutput: v.string(),
|
|
30677
|
+
pendingPayment: v.boolean()
|
|
30678
|
+
}),
|
|
30679
|
+
intentData: v.object({
|
|
30680
|
+
intentId: v.string(),
|
|
30681
|
+
creator: v.string(),
|
|
30682
|
+
inputToken: v.string(),
|
|
30683
|
+
outputToken: v.string(),
|
|
30684
|
+
inputAmount: v.string(),
|
|
30685
|
+
minOutputAmount: v.string(),
|
|
30686
|
+
deadline: v.string(),
|
|
30687
|
+
allowPartialFill: v.boolean(),
|
|
30688
|
+
srcChain: v.number(),
|
|
30689
|
+
dstChain: v.number(),
|
|
30690
|
+
srcAddress: v.string(),
|
|
30691
|
+
dstAddress: v.string(),
|
|
30692
|
+
solver: v.string(),
|
|
30693
|
+
data: v.string(),
|
|
30694
|
+
intentHash: v.string(),
|
|
30695
|
+
txHash: v.string(),
|
|
30696
|
+
blockNumber: v.number()
|
|
30697
|
+
})
|
|
30698
|
+
})
|
|
30699
|
+
)
|
|
30700
|
+
});
|
|
30701
|
+
var MoneyMarketPositionSchema = v.object({
|
|
30702
|
+
userAddress: v.string(),
|
|
30703
|
+
positions: v.array(
|
|
30704
|
+
v.object({
|
|
30705
|
+
reserveAddress: v.string(),
|
|
30706
|
+
aTokenAddress: v.string(),
|
|
30707
|
+
variableDebtTokenAddress: v.string(),
|
|
30708
|
+
aTokenBalance: v.string(),
|
|
30709
|
+
variableDebtTokenBalance: v.string(),
|
|
30710
|
+
blockNumber: v.number()
|
|
30711
|
+
})
|
|
30712
|
+
)
|
|
30713
|
+
});
|
|
30714
|
+
var MoneyMarketAssetSchema = v.object({
|
|
30715
|
+
reserveAddress: v.string(),
|
|
30716
|
+
aTokenAddress: v.string(),
|
|
30717
|
+
totalATokenBalance: v.string(),
|
|
30718
|
+
variableDebtTokenAddress: v.string(),
|
|
30719
|
+
totalVariableDebtTokenBalance: v.string(),
|
|
30720
|
+
liquidityRate: v.string(),
|
|
30721
|
+
symbol: v.string(),
|
|
30722
|
+
totalSuppliers: v.number(),
|
|
30723
|
+
totalBorrowers: v.number(),
|
|
30724
|
+
variableBorrowRate: v.string(),
|
|
30725
|
+
stableBorrowRate: v.string(),
|
|
30726
|
+
liquidityIndex: v.string(),
|
|
30727
|
+
variableBorrowIndex: v.string(),
|
|
30728
|
+
blockNumber: v.number()
|
|
30729
|
+
});
|
|
30730
|
+
var MoneyMarketAssetsSchema = v.array(MoneyMarketAssetSchema);
|
|
30731
|
+
var MoneyMarketAssetBorrowersSchema = v.object({
|
|
30732
|
+
borrowers: v.array(v.string()),
|
|
30733
|
+
total: v.number(),
|
|
30734
|
+
offset: v.number(),
|
|
30735
|
+
limit: v.number()
|
|
30736
|
+
});
|
|
30737
|
+
var MoneyMarketAssetSuppliersSchema = v.object({
|
|
30738
|
+
suppliers: v.array(v.string()),
|
|
30739
|
+
total: v.number(),
|
|
30740
|
+
offset: v.number(),
|
|
30741
|
+
limit: v.number()
|
|
30742
|
+
});
|
|
30743
|
+
var MoneyMarketBorrowersSchema = v.object({
|
|
30744
|
+
borrowers: v.array(v.string()),
|
|
30745
|
+
total: v.number(),
|
|
30746
|
+
offset: v.number(),
|
|
30747
|
+
limit: v.number()
|
|
30748
|
+
});
|
|
30749
|
+
var GetChainsResponseSchema = v.array(SpokeChainKeySchema);
|
|
30750
|
+
var TokensByChainMapSchema = v.custom(
|
|
30751
|
+
(input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v.is(XTokenSchema, t)))
|
|
30752
|
+
);
|
|
30753
|
+
var TokensListSchema = v.array(XTokenSchema);
|
|
30754
|
+
var ReserveAssetsSchema = v.array(AddressSchema);
|
|
30755
|
+
var ORACLE_CANDLE_INTERVALS = ["1m", "5m", "1h", "1d"];
|
|
30756
|
+
var OracleCandleIntervalSchema = v.picklist(ORACLE_CANDLE_INTERVALS);
|
|
30757
|
+
var OracleMarketsResponseSchema = v.object({
|
|
30758
|
+
quote: v.string(),
|
|
30759
|
+
intervals: v.array(
|
|
30760
|
+
v.object({
|
|
30761
|
+
key: v.string(),
|
|
30762
|
+
label: v.string(),
|
|
30763
|
+
seconds: v.number()
|
|
30764
|
+
})
|
|
30765
|
+
),
|
|
30766
|
+
symbols: v.array(v.string())
|
|
30767
|
+
});
|
|
30768
|
+
var OracleCandlesResponseSchema = v.object({
|
|
30769
|
+
symbol: v.string(),
|
|
30770
|
+
quote: v.string(),
|
|
30771
|
+
interval: OracleCandleIntervalSchema,
|
|
30772
|
+
candles: v.array(
|
|
30773
|
+
v.object({
|
|
30774
|
+
timestamp: v.number(),
|
|
30775
|
+
open: v.string(),
|
|
30776
|
+
high: v.string(),
|
|
30777
|
+
low: v.string(),
|
|
30778
|
+
close: v.string(),
|
|
30779
|
+
final: v.optional(v.boolean())
|
|
30780
|
+
})
|
|
30781
|
+
)
|
|
30782
|
+
});
|
|
30783
|
+
var isFillEvent = (value) => v.is(FillEventSchema, value);
|
|
30784
|
+
var isOracleCandleInterval = (value) => v.is(OracleCandleIntervalSchema, value);
|
|
29875
30785
|
|
|
29876
30786
|
// src/backendApi/detailedStatusRouting.ts
|
|
29877
30787
|
var DETAILED_STATUS_NOT_DELIVERED = "relay_not_delivered";
|
|
29878
30788
|
function isBackendSubmitTxAbandoned(data) {
|
|
29879
30789
|
return data.status === "failed" || Boolean(data.abandonedAt);
|
|
29880
30790
|
}
|
|
30791
|
+
function readIntentJournalOutcome(intent) {
|
|
30792
|
+
const settled = intent.events.filter(isFillEvent).find((fill) => fill.intentState.remainingInput === "0");
|
|
30793
|
+
if (settled) return { kind: "solved", fillTxHash: settled.txHash };
|
|
30794
|
+
const eventTypes = intent.events.flatMap((event) => v.is(IntentEventTypeSchema, event) ? [event.eventType] : []);
|
|
30795
|
+
if (!intent.open && eventTypes.includes("intent-cancelled") && !eventTypes.includes("intent-filled")) {
|
|
30796
|
+
return { kind: "cancelled" };
|
|
30797
|
+
}
|
|
30798
|
+
return void 0;
|
|
30799
|
+
}
|
|
29881
30800
|
async function resolveDeliveredPacket(params) {
|
|
29882
30801
|
const { srcChainKey, srcTxHash, relayerApiEndpoint, backendAnswered } = params;
|
|
29883
30802
|
const relayChainId = getIntentRelayChainId(srcChainKey);
|
|
@@ -30308,181 +31227,6 @@ async function runBackendSubmitTx({
|
|
|
30308
31227
|
});
|
|
30309
31228
|
return polled.ok ? { ok: true, value: polled.value } : { ok: false, cause: polled.cause };
|
|
30310
31229
|
}
|
|
30311
|
-
var ChainKeySchema = v.custom((input) => typeof input === "string");
|
|
30312
|
-
var SpokeChainKeySchema = v.custom((input) => typeof input === "string");
|
|
30313
|
-
var AddressSchema = v.custom((input) => typeof input === "string");
|
|
30314
|
-
var XTokenSchema = v.object({
|
|
30315
|
-
symbol: v.string(),
|
|
30316
|
-
name: v.string(),
|
|
30317
|
-
decimals: v.number(),
|
|
30318
|
-
address: v.string(),
|
|
30319
|
-
chainKey: ChainKeySchema,
|
|
30320
|
-
hubAsset: AddressSchema,
|
|
30321
|
-
vault: AddressSchema,
|
|
30322
|
-
access: v.optional(v.picklist(["withdrawOnly", "depositOnly"]))
|
|
30323
|
-
});
|
|
30324
|
-
var IntentStructSchema = v.object({
|
|
30325
|
-
intentId: v.string(),
|
|
30326
|
-
creator: v.string(),
|
|
30327
|
-
inputToken: v.string(),
|
|
30328
|
-
outputToken: v.string(),
|
|
30329
|
-
inputAmount: v.string(),
|
|
30330
|
-
minOutputAmount: v.string(),
|
|
30331
|
-
deadline: v.string(),
|
|
30332
|
-
allowPartialFill: v.boolean(),
|
|
30333
|
-
srcChain: v.number(),
|
|
30334
|
-
dstChain: v.number(),
|
|
30335
|
-
srcAddress: v.string(),
|
|
30336
|
-
dstAddress: v.string(),
|
|
30337
|
-
solver: v.string(),
|
|
30338
|
-
data: v.string()
|
|
30339
|
-
});
|
|
30340
|
-
var FillEventSchema = v.object({
|
|
30341
|
-
eventType: v.literal("intent-filled"),
|
|
30342
|
-
// The hub-chain fill tx; an empty one is no use as `fill_tx_hash`.
|
|
30343
|
-
txHash: v.pipe(v.string(), v.nonEmpty()),
|
|
30344
|
-
// Terminality. An intent created with `allowPartialFill` emits a fill event per fill, so the
|
|
30345
|
-
// event alone does not mean the intent is done — only `remainingInput === '0'` does. Required:
|
|
30346
|
-
// without it there is no proof of completion, and claiming SOLVED on a partial fill would report
|
|
30347
|
-
// an unfinished swap as complete.
|
|
30348
|
-
intentState: v.object({
|
|
30349
|
-
remainingInput: v.string()
|
|
30350
|
-
})
|
|
30351
|
-
});
|
|
30352
|
-
var IntentResponseSchema = v.object({
|
|
30353
|
-
intentHash: v.string(),
|
|
30354
|
-
txHash: v.string(),
|
|
30355
|
-
logIndex: v.number(),
|
|
30356
|
-
chainId: v.number(),
|
|
30357
|
-
blockNumber: v.number(),
|
|
30358
|
-
open: v.boolean(),
|
|
30359
|
-
intent: IntentStructSchema,
|
|
30360
|
-
events: v.array(v.unknown())
|
|
30361
|
-
});
|
|
30362
|
-
var UserIntentsResponseSchema = v.object({
|
|
30363
|
-
total: v.number(),
|
|
30364
|
-
offset: v.number(),
|
|
30365
|
-
limit: v.number(),
|
|
30366
|
-
items: v.array(IntentResponseSchema)
|
|
30367
|
-
});
|
|
30368
|
-
var OrderbookResponseSchema = v.object({
|
|
30369
|
-
total: v.number(),
|
|
30370
|
-
data: v.array(
|
|
30371
|
-
v.object({
|
|
30372
|
-
intentState: v.object({
|
|
30373
|
-
exists: v.boolean(),
|
|
30374
|
-
remainingInput: v.string(),
|
|
30375
|
-
receivedOutput: v.string(),
|
|
30376
|
-
pendingPayment: v.boolean()
|
|
30377
|
-
}),
|
|
30378
|
-
intentData: v.object({
|
|
30379
|
-
intentId: v.string(),
|
|
30380
|
-
creator: v.string(),
|
|
30381
|
-
inputToken: v.string(),
|
|
30382
|
-
outputToken: v.string(),
|
|
30383
|
-
inputAmount: v.string(),
|
|
30384
|
-
minOutputAmount: v.string(),
|
|
30385
|
-
deadline: v.string(),
|
|
30386
|
-
allowPartialFill: v.boolean(),
|
|
30387
|
-
srcChain: v.number(),
|
|
30388
|
-
dstChain: v.number(),
|
|
30389
|
-
srcAddress: v.string(),
|
|
30390
|
-
dstAddress: v.string(),
|
|
30391
|
-
solver: v.string(),
|
|
30392
|
-
data: v.string(),
|
|
30393
|
-
intentHash: v.string(),
|
|
30394
|
-
txHash: v.string(),
|
|
30395
|
-
blockNumber: v.number()
|
|
30396
|
-
})
|
|
30397
|
-
})
|
|
30398
|
-
)
|
|
30399
|
-
});
|
|
30400
|
-
var MoneyMarketPositionSchema = v.object({
|
|
30401
|
-
userAddress: v.string(),
|
|
30402
|
-
positions: v.array(
|
|
30403
|
-
v.object({
|
|
30404
|
-
reserveAddress: v.string(),
|
|
30405
|
-
aTokenAddress: v.string(),
|
|
30406
|
-
variableDebtTokenAddress: v.string(),
|
|
30407
|
-
aTokenBalance: v.string(),
|
|
30408
|
-
variableDebtTokenBalance: v.string(),
|
|
30409
|
-
blockNumber: v.number()
|
|
30410
|
-
})
|
|
30411
|
-
)
|
|
30412
|
-
});
|
|
30413
|
-
var MoneyMarketAssetSchema = v.object({
|
|
30414
|
-
reserveAddress: v.string(),
|
|
30415
|
-
aTokenAddress: v.string(),
|
|
30416
|
-
totalATokenBalance: v.string(),
|
|
30417
|
-
variableDebtTokenAddress: v.string(),
|
|
30418
|
-
totalVariableDebtTokenBalance: v.string(),
|
|
30419
|
-
liquidityRate: v.string(),
|
|
30420
|
-
symbol: v.string(),
|
|
30421
|
-
totalSuppliers: v.number(),
|
|
30422
|
-
totalBorrowers: v.number(),
|
|
30423
|
-
variableBorrowRate: v.string(),
|
|
30424
|
-
stableBorrowRate: v.string(),
|
|
30425
|
-
liquidityIndex: v.string(),
|
|
30426
|
-
variableBorrowIndex: v.string(),
|
|
30427
|
-
blockNumber: v.number()
|
|
30428
|
-
});
|
|
30429
|
-
var MoneyMarketAssetsSchema = v.array(MoneyMarketAssetSchema);
|
|
30430
|
-
var MoneyMarketAssetBorrowersSchema = v.object({
|
|
30431
|
-
borrowers: v.array(v.string()),
|
|
30432
|
-
total: v.number(),
|
|
30433
|
-
offset: v.number(),
|
|
30434
|
-
limit: v.number()
|
|
30435
|
-
});
|
|
30436
|
-
var MoneyMarketAssetSuppliersSchema = v.object({
|
|
30437
|
-
suppliers: v.array(v.string()),
|
|
30438
|
-
total: v.number(),
|
|
30439
|
-
offset: v.number(),
|
|
30440
|
-
limit: v.number()
|
|
30441
|
-
});
|
|
30442
|
-
var MoneyMarketBorrowersSchema = v.object({
|
|
30443
|
-
borrowers: v.array(v.string()),
|
|
30444
|
-
total: v.number(),
|
|
30445
|
-
offset: v.number(),
|
|
30446
|
-
limit: v.number()
|
|
30447
|
-
});
|
|
30448
|
-
var GetChainsResponseSchema = v.array(SpokeChainKeySchema);
|
|
30449
|
-
var TokensByChainMapSchema = v.custom(
|
|
30450
|
-
(input) => typeof input === "object" && input !== null && Object.values(input).every((tokens) => Array.isArray(tokens) && tokens.every((t) => v.is(XTokenSchema, t)))
|
|
30451
|
-
);
|
|
30452
|
-
var TokensListSchema = v.array(XTokenSchema);
|
|
30453
|
-
var ReserveAssetsSchema = v.array(AddressSchema);
|
|
30454
|
-
var ORACLE_CANDLE_INTERVALS = ["1m", "5m", "1h", "1d"];
|
|
30455
|
-
var OracleCandleIntervalSchema = v.picklist(ORACLE_CANDLE_INTERVALS);
|
|
30456
|
-
var OracleMarketsResponseSchema = v.object({
|
|
30457
|
-
quote: v.string(),
|
|
30458
|
-
intervals: v.array(
|
|
30459
|
-
v.object({
|
|
30460
|
-
key: v.string(),
|
|
30461
|
-
label: v.string(),
|
|
30462
|
-
seconds: v.number()
|
|
30463
|
-
})
|
|
30464
|
-
),
|
|
30465
|
-
symbols: v.array(v.string())
|
|
30466
|
-
});
|
|
30467
|
-
var OracleCandlesResponseSchema = v.object({
|
|
30468
|
-
symbol: v.string(),
|
|
30469
|
-
quote: v.string(),
|
|
30470
|
-
interval: OracleCandleIntervalSchema,
|
|
30471
|
-
candles: v.array(
|
|
30472
|
-
v.object({
|
|
30473
|
-
timestamp: v.number(),
|
|
30474
|
-
open: v.string(),
|
|
30475
|
-
high: v.string(),
|
|
30476
|
-
low: v.string(),
|
|
30477
|
-
close: v.string(),
|
|
30478
|
-
final: v.optional(v.boolean())
|
|
30479
|
-
})
|
|
30480
|
-
)
|
|
30481
|
-
});
|
|
30482
|
-
|
|
30483
|
-
// src/backendApi/guards.ts
|
|
30484
|
-
var isFillEvent = (value) => v.is(FillEventSchema, value);
|
|
30485
|
-
var isOracleCandleInterval = (value) => v.is(OracleCandleIntervalSchema, value);
|
|
30486
31230
|
function decodePacketIntentTarget(payload) {
|
|
30487
31231
|
try {
|
|
30488
31232
|
const hex = payload.startsWith("0x") ? payload.slice(2) : payload;
|
|
@@ -30502,6 +31246,11 @@ function selectSolvedIntentPacket(packets, intentsContract) {
|
|
|
30502
31246
|
return packets.reduce((highest, packet) => packet.conn_sn > highest.conn_sn ? packet : highest);
|
|
30503
31247
|
}
|
|
30504
31248
|
|
|
31249
|
+
// src/swap/intentDepositSpender.ts
|
|
31250
|
+
function intentDepositSpender(config, srcChainKey) {
|
|
31251
|
+
return isHubChainKeyType(srcChainKey) ? config.solver.intentsContract : config.getChainConfig(srcChainKey).addresses.assetManager;
|
|
31252
|
+
}
|
|
31253
|
+
|
|
30505
31254
|
// src/swap/speed-tier.ts
|
|
30506
31255
|
var SPEED_TIER_SECONDS = {
|
|
30507
31256
|
/** Either token's vault is a money-market-reserve (sodaAsset). */
|
|
@@ -30529,6 +31278,25 @@ function estimateSwapSpeedTier({ srcToken, dstToken }, isSodaAssetRelated) {
|
|
|
30529
31278
|
}
|
|
30530
31279
|
return { tier: secondsToTier(estimatedSeconds), estimatedSeconds };
|
|
30531
31280
|
}
|
|
31281
|
+
function summarizeSwapStatus(status) {
|
|
31282
|
+
if (status.source === "backend") {
|
|
31283
|
+
const { status: backendStatus, result } = status.data;
|
|
31284
|
+
return {
|
|
31285
|
+
state: backendStatus === "solved" || backendStatus === "failed" ? backendStatus : "pending",
|
|
31286
|
+
hubTxHash: asHex(result?.dstIntentTxHash),
|
|
31287
|
+
fillTxHash: asHex(result?.fillTxHash)
|
|
31288
|
+
};
|
|
31289
|
+
}
|
|
31290
|
+
const { status: solverStatus, fill_tx_hash } = status.data;
|
|
31291
|
+
return {
|
|
31292
|
+
state: solverStatus === SolverIntentStatusCode.SOLVED ? "solved" : solverStatus === SolverIntentStatusCode.FAILED ? "failed" : "pending",
|
|
31293
|
+
hubTxHash: status.dstTxHash,
|
|
31294
|
+
fillTxHash: asHex(fill_tx_hash)
|
|
31295
|
+
};
|
|
31296
|
+
}
|
|
31297
|
+
function asHex(value) {
|
|
31298
|
+
return value && isHex(value) ? value : void 0;
|
|
31299
|
+
}
|
|
30532
31300
|
|
|
30533
31301
|
// src/swap/errors.ts
|
|
30534
31302
|
var swapInvariant = createInvariant("swap");
|
|
@@ -30552,6 +31320,9 @@ var SWAP_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
30552
31320
|
var isSwapCreateIntentError = isCodeMember(CREATE_INTENT_CODES);
|
|
30553
31321
|
var isPostExecutionError = isCodeMember(POST_EXECUTION_ERROR_CODES);
|
|
30554
31322
|
var isSwapError = isCodeMember(SWAP_ERROR_CODES);
|
|
31323
|
+
var isSwapWithApprovalError = isCodeMember(
|
|
31324
|
+
/* @__PURE__ */ new Set([...SWAP_ERROR_CODES, "APPROVE_FAILED", "ALLOWANCE_CHECK_FAILED"])
|
|
31325
|
+
);
|
|
30555
31326
|
|
|
30556
31327
|
// src/swap/SwapService.ts
|
|
30557
31328
|
var RECONCILE_TIMEOUT_MS = 5e3;
|
|
@@ -30566,13 +31337,14 @@ var SwapService = class {
|
|
|
30566
31337
|
relayerApiEndpoint;
|
|
30567
31338
|
// backend swaps-API client
|
|
30568
31339
|
backendApi;
|
|
31340
|
+
useBackendSubmitTxOverride;
|
|
30569
31341
|
/**
|
|
30570
31342
|
* Effective 2-step submit-tx flow (`swaps.useBackendSubmitTx`, default on). Read live off
|
|
30571
31343
|
* `ConfigService`, like {@link SwapService.partnerFee}, so the config object and the behavior can
|
|
30572
|
-
* never disagree.
|
|
31344
|
+
* never disagree — unless a direct constructor caller passed the deprecated override.
|
|
30573
31345
|
*/
|
|
30574
31346
|
get useBackendSubmitTx() {
|
|
30575
|
-
return this.config.swapUseBackendSubmitTx;
|
|
31347
|
+
return this.useBackendSubmitTxOverride ?? this.config.swapUseBackendSubmitTx;
|
|
30576
31348
|
}
|
|
30577
31349
|
/**
|
|
30578
31350
|
* Effective swap partner fee (`swaps.partnerFee`, else the global `fee`). Read live off
|
|
@@ -30583,13 +31355,14 @@ var SwapService = class {
|
|
|
30583
31355
|
get partnerFee() {
|
|
30584
31356
|
return this.config.swapPartnerFee;
|
|
30585
31357
|
}
|
|
30586
|
-
constructor({ config, hubProvider, spoke, backendApi }) {
|
|
31358
|
+
constructor({ config, hubProvider, spoke, backendApi, useBackendSubmitTx }) {
|
|
30587
31359
|
this.solver = config.solver;
|
|
30588
31360
|
this.relayerApiEndpoint = config.relay.relayerApiEndpoint;
|
|
30589
31361
|
this.config = config;
|
|
30590
31362
|
this.hubProvider = hubProvider;
|
|
30591
31363
|
this.spoke = spoke;
|
|
30592
31364
|
this.backendApi = backendApi;
|
|
31365
|
+
this.useBackendSubmitTxOverride = useBackendSubmitTx;
|
|
30593
31366
|
}
|
|
30594
31367
|
/**
|
|
30595
31368
|
* Estimates the gas cost for a raw (unsigned) transaction on a spoke chain.
|
|
@@ -30676,10 +31449,14 @@ var SwapService = class {
|
|
|
30676
31449
|
* polled and passes {@link DETAILED_STATUS_SOLVER_TIMEOUT_MS}. Both go through here so the
|
|
30677
31450
|
* durable-intent reconcile below is written once.
|
|
30678
31451
|
*
|
|
30679
|
-
* `timeoutMs` bounds the solver request alone. The reconcile that a
|
|
30680
|
-
*
|
|
31452
|
+
* `timeoutMs` bounds the solver request alone. The reconcile that a non-final solver read falls
|
|
31453
|
+
* through to carries its own {@link RECONCILE_TIMEOUT_MS}, so a bounded call can cost both.
|
|
31454
|
+
*
|
|
31455
|
+
* `reconcileNonFinal` is for `getDetailedStatus` alone: it reconciles an in-flight answer as well as
|
|
31456
|
+
* a `NOT_FOUND`, and reads a journal cancel as `FAILED`. The solver can keep reporting a cancelled
|
|
31457
|
+
* intent in flight, and nothing else ends that poll. `getStatus` leaves it off and keeps its answers.
|
|
30681
31458
|
*/
|
|
30682
|
-
async resolveSolverStatus(request, timeoutMs) {
|
|
31459
|
+
async resolveSolverStatus(request, { timeoutMs, reconcileNonFinal = false } = {}) {
|
|
30683
31460
|
const solverResult = await SolverApiService.getStatus(
|
|
30684
31461
|
request,
|
|
30685
31462
|
this.solver,
|
|
@@ -30687,12 +31464,20 @@ var SwapService = class {
|
|
|
30687
31464
|
timeoutMs,
|
|
30688
31465
|
this.config.apiKey
|
|
30689
31466
|
);
|
|
30690
|
-
const
|
|
30691
|
-
if (
|
|
31467
|
+
const status = solverResult.ok ? solverResult.value.status : void 0;
|
|
31468
|
+
if (status === SolverIntentStatusCode.SOLVED || status === SolverIntentStatusCode.FAILED) return solverResult;
|
|
31469
|
+
const forgotten = !solverResult.ok || status === SolverIntentStatusCode.NOT_FOUND;
|
|
31470
|
+
if (!forgotten && !reconcileNonFinal) return solverResult;
|
|
30692
31471
|
const timeout = Math.min(RECONCILE_TIMEOUT_MS, this.backendApi.requestTimeoutMs);
|
|
30693
31472
|
const intent = await this.backendApi.getIntentByTxHash(request.intent_tx_hash, { timeout });
|
|
30694
|
-
const
|
|
30695
|
-
if (
|
|
31473
|
+
const outcome = intent.ok ? readIntentJournalOutcome(intent.value) : void 0;
|
|
31474
|
+
if (outcome?.kind === "solved") {
|
|
31475
|
+
return { ok: true, value: { status: SolverIntentStatusCode.SOLVED, fill_tx_hash: outcome.fillTxHash } };
|
|
31476
|
+
}
|
|
31477
|
+
if (outcome?.kind === "cancelled" && reconcileNonFinal) {
|
|
31478
|
+
return { ok: true, value: { status: SolverIntentStatusCode.FAILED } };
|
|
31479
|
+
}
|
|
31480
|
+
if (!forgotten) return solverResult;
|
|
30696
31481
|
const backendAnswered = intent.ok || isSodaxError(intent.error) && intent.error.context?.status === 404;
|
|
30697
31482
|
if (solverResult.ok && !backendAnswered) {
|
|
30698
31483
|
return {
|
|
@@ -30710,9 +31495,14 @@ var SwapService = class {
|
|
|
30710
31495
|
/**
|
|
30711
31496
|
* Reads a swap's status from its source-chain transaction — the identifier a caller always holds.
|
|
30712
31497
|
*
|
|
30713
|
-
* **Routes;
|
|
30714
|
-
* otherwise the solver's answer via the hub tx hash resolved from the relay packet. The result
|
|
30715
|
-
* tagged with `source` (discriminate on it)
|
|
31498
|
+
* **Routes; defines no status of its own.** Returns the backend submit-tx record while it is in
|
|
31499
|
+
* play, otherwise the solver's answer via the hub tx hash resolved from the relay packet. The result
|
|
31500
|
+
* is tagged with `source` (discriminate on it).
|
|
31501
|
+
*
|
|
31502
|
+
* The solver arm is reconciled against the backend's durable intent record: a settling fill reads
|
|
31503
|
+
* `SOLVED`, and a cancel with nothing filled reads `FAILED` even while the solver still reports the
|
|
31504
|
+
* intent in flight. A cancelled intent is already refunded, so do not offer to cancel it again.
|
|
31505
|
+
* Otherwise it carries the solver's answer unmodified, and the backend arm its record unmodified.
|
|
30716
31506
|
*
|
|
30717
31507
|
* **Any** unusable backend response routes to the solver — a 404, a transport or server error, or
|
|
30718
31508
|
* a record the backend gave up on. See `docs/SWAPS.md` § Get Detailed Status for why.
|
|
@@ -30746,7 +31536,7 @@ var SwapService = class {
|
|
|
30746
31536
|
if (!dstTxHash.ok) return dstTxHash;
|
|
30747
31537
|
const solver = await this.resolveSolverStatus(
|
|
30748
31538
|
{ intent_tx_hash: dstTxHash.value },
|
|
30749
|
-
DETAILED_STATUS_SOLVER_TIMEOUT_MS
|
|
31539
|
+
{ timeoutMs: DETAILED_STATUS_SOLVER_TIMEOUT_MS, reconcileNonFinal: true }
|
|
30750
31540
|
);
|
|
30751
31541
|
if (!solver.ok) {
|
|
30752
31542
|
return { ok: false, error: this.detailedStatusLookupFailed(solver.error, params.srcChainKey) };
|
|
@@ -30916,19 +31706,7 @@ var SwapService = class {
|
|
|
30916
31706
|
if (!createIntentResult.ok) {
|
|
30917
31707
|
return { ok: false, error: createIntentResult.error };
|
|
30918
31708
|
}
|
|
30919
|
-
|
|
30920
|
-
const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
|
|
30921
|
-
if (this.useBackendSubmitTx) {
|
|
30922
|
-
const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
|
|
30923
|
-
if (submitted.ok) return submitted;
|
|
30924
|
-
this.config.logger.warn(
|
|
30925
|
-
"[swap] backend submit-tx did not complete; falling back to the client-side relay",
|
|
30926
|
-
{
|
|
30927
|
-
error: submitted.error
|
|
30928
|
-
}
|
|
30929
|
-
);
|
|
30930
|
-
}
|
|
30931
|
-
return this.fallbackSwapSteps(_params, created, timeoutMs);
|
|
31709
|
+
return await this.completeSwap(_params, createIntentResult.value);
|
|
30932
31710
|
} catch (error) {
|
|
30933
31711
|
if (isSwapError(error)) return { ok: false, error };
|
|
30934
31712
|
return {
|
|
@@ -30954,6 +31732,262 @@ var SwapService = class {
|
|
|
30954
31732
|
}
|
|
30955
31733
|
);
|
|
30956
31734
|
}
|
|
31735
|
+
/**
|
|
31736
|
+
* Which approval path {@link swapWithApproval} would take for these params, so a UI can say up front
|
|
31737
|
+
* whether the swap costs one signature or two. Read-only; sends nothing.
|
|
31738
|
+
*
|
|
31739
|
+
* `'atomic-batch'` needs an EVM spoke source and a wallet that reports EIP-5792 atomic support for
|
|
31740
|
+
* that chain — `'supported'`, or `'ready'` (the wallet asks the user to upgrade the account on the
|
|
31741
|
+
* first batch; pass `allowAccountUpgrade: false` to treat such a wallet as unable to batch). The Sonic
|
|
31742
|
+
* hub, a Stellar source that needs a trustline, and wallets without batch support get `'sequential'`;
|
|
31743
|
+
* other non-EVM sources have no allowance and get `'not-required'`.
|
|
31744
|
+
*
|
|
31745
|
+
* @returns `ALLOWANCE_CHECK_FAILED` when the allowance read fails; otherwise the strategy.
|
|
31746
|
+
*/
|
|
31747
|
+
async getApprovalStrategy(_params) {
|
|
31748
|
+
const { params, walletProvider, allowAccountUpgrade = true } = _params;
|
|
31749
|
+
const srcChainKey = params.srcChainKey;
|
|
31750
|
+
const allowance = await this.isAllowanceValid(_params);
|
|
31751
|
+
if (!allowance.ok) {
|
|
31752
|
+
return {
|
|
31753
|
+
ok: false,
|
|
31754
|
+
error: allowanceCheckFailed("swap", allowance.error, {
|
|
31755
|
+
srcChainKey,
|
|
31756
|
+
dstChainKey: params.dstChainKey,
|
|
31757
|
+
action: "swapWithApproval"
|
|
31758
|
+
})
|
|
31759
|
+
};
|
|
31760
|
+
}
|
|
31761
|
+
if (allowance.value) return { ok: true, value: "not-required" };
|
|
31762
|
+
return { ok: true, value: await resolveApprovalStrategy({ srcChainKey, walletProvider, allowAccountUpgrade }) };
|
|
31763
|
+
}
|
|
31764
|
+
/**
|
|
31765
|
+
* {@link swap} with the source-token approval folded in. Picks a path with
|
|
31766
|
+
* {@link getApprovalStrategy}: no approval when the allowance already suffices; on an EIP-5792
|
|
31767
|
+
* wallet, approve and the swap transaction as **one atomic batch — one signature**; otherwise
|
|
31768
|
+
* approve, wait for it to confirm, then the swap transaction. Completion (backend submit-tx with
|
|
31769
|
+
* the client-side relay fallback) is exactly `swap()`'s.
|
|
31770
|
+
*
|
|
31771
|
+
* A wallet that refuses the batch before signing anything (e.g. EIP-5792 5760, atomicity not
|
|
31772
|
+
* supported) falls back to the two-step path. A batch the user saw is never retried as separate
|
|
31773
|
+
* transactions:
|
|
31774
|
+
* - rejected → `USER_REJECTED`; a declined account upgrade (5750) adds `context.reason:`
|
|
31775
|
+
* {@link ACCOUNT_UPGRADE_DECLINED}, after which `allowAccountUpgrade: false` swaps without one;
|
|
31776
|
+
* - never included or fully reverted (EIP-5792 400 / 500) → `INTENT_CREATION_FAILED` with
|
|
31777
|
+
* `context.reason: 'atomic-batch-failed'`;
|
|
31778
|
+
* - anything else short of a confirmed deposit receipt (not confirmed within `timeout`, a partial
|
|
31779
|
+
* revert, receipts that do not identify the deposit) → `TX_VERIFICATION_FAILED` with
|
|
31780
|
+
* `context.reason:` {@link ATOMIC_BATCH_UNCONFIRMED}, `context.batchId` and `context.callCount`. It may
|
|
31781
|
+
* have landed — do not send it again; call again with `resumeBatchId` and `resumeBatchCallCount` to
|
|
31782
|
+
* finish it once it does.
|
|
31783
|
+
*
|
|
31784
|
+
* @returns A `Result<SwapWithApprovalResponse, SwapWithApprovalError>` — `swap()`'s response plus the
|
|
31785
|
+
* `approvalStrategy` that ran. Errors are `swap()`'s codes plus `APPROVE_FAILED` and
|
|
31786
|
+
* `ALLOWANCE_CHECK_FAILED`.
|
|
31787
|
+
*/
|
|
31788
|
+
async swapWithApproval(_params) {
|
|
31789
|
+
const { params } = _params;
|
|
31790
|
+
const srcChainKey = params.srcChainKey;
|
|
31791
|
+
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "swapWithApproval" };
|
|
31792
|
+
return this.config.analytics.trackResult(
|
|
31793
|
+
"swap",
|
|
31794
|
+
"swapWithApproval",
|
|
31795
|
+
async () => {
|
|
31796
|
+
try {
|
|
31797
|
+
if (_params.resumeBatchId !== void 0) return await this.resumeAtomicBatch(_params, _params.resumeBatchId);
|
|
31798
|
+
const strategy = await this.getApprovalStrategy(_params);
|
|
31799
|
+
if (!strategy.ok) return strategy;
|
|
31800
|
+
const { result: created, approvalStrategy } = await runWithApproval({
|
|
31801
|
+
strategy: strategy.value,
|
|
31802
|
+
notRequired: () => this.createIntent(_params),
|
|
31803
|
+
atomicBatch: () => this.createIntentInAtomicBatch(_params),
|
|
31804
|
+
sequential: (afterRefusedBatch) => this.approveThenCreateIntent(_params, afterRefusedBatch),
|
|
31805
|
+
onBatchRefused: (error) => this.config.logger.warn("[swapWithApproval] wallet refused the atomic batch; approving separately", {
|
|
31806
|
+
error
|
|
31807
|
+
})
|
|
31808
|
+
});
|
|
31809
|
+
if (!created.ok) return created;
|
|
31810
|
+
const completed = await this.completeSwap(_params, created.value);
|
|
31811
|
+
if (!completed.ok) return completed;
|
|
31812
|
+
return { ok: true, value: { ...completed.value, approvalStrategy } };
|
|
31813
|
+
} catch (error) {
|
|
31814
|
+
if (isSwapWithApprovalError(error)) return { ok: false, error };
|
|
31815
|
+
return { ok: false, error: unknownFailed("swap", error, baseCtx) };
|
|
31816
|
+
}
|
|
31817
|
+
},
|
|
31818
|
+
{
|
|
31819
|
+
start: () => ({
|
|
31820
|
+
srcChainKey,
|
|
31821
|
+
dstChainKey: params.dstChainKey,
|
|
31822
|
+
srcAddress: params.srcAddress,
|
|
31823
|
+
dstAddress: params.dstAddress
|
|
31824
|
+
}),
|
|
31825
|
+
success: (value) => ({
|
|
31826
|
+
srcChainKey,
|
|
31827
|
+
dstChainKey: params.dstChainKey,
|
|
31828
|
+
srcTxHash: value.intentDeliveryInfo.srcTxHash,
|
|
31829
|
+
dstTxHash: value.intentDeliveryInfo.dstTxHash,
|
|
31830
|
+
approvalStrategy: value.approvalStrategy
|
|
31831
|
+
}),
|
|
31832
|
+
failure: (error) => ({ code: error.code })
|
|
31833
|
+
}
|
|
31834
|
+
);
|
|
31835
|
+
}
|
|
31836
|
+
/**
|
|
31837
|
+
* Approve + deposit as one EIP-5792 atomic batch, in broadcast order (`[reset?, approve, deposit]`),
|
|
31838
|
+
* then hand back the batch's transaction hash as the intent tx, for {@link completeSwap}.
|
|
31839
|
+
*/
|
|
31840
|
+
async createIntentInAtomicBatch(_params) {
|
|
31841
|
+
const { params, walletProvider, extras, skipSimulation } = _params;
|
|
31842
|
+
const srcChainKey = params.srcChainKey;
|
|
31843
|
+
swapInvariant(
|
|
31844
|
+
isEvmSpokeOnlyChainKeyType(srcChainKey) && isEvmWalletProviderType(walletProvider),
|
|
31845
|
+
"Atomic batches need an EVM spoke source and an EVM wallet provider"
|
|
31846
|
+
);
|
|
31847
|
+
swapInvariant(canSendAtomicBatch(walletProvider), "Wallet provider does not implement EIP-5792 batches");
|
|
31848
|
+
const ctx = {
|
|
31849
|
+
srcChainKey,
|
|
31850
|
+
dstChainKey: params.dstChainKey,
|
|
31851
|
+
action: "swapWithApproval",
|
|
31852
|
+
approvalStrategy: "atomic-batch"
|
|
31853
|
+
};
|
|
31854
|
+
const [approval, created] = await Promise.all([
|
|
31855
|
+
this.buildApproveTxs({ params, raw: true }),
|
|
31856
|
+
this.createIntent({ params, extras, skipSimulation, raw: true })
|
|
31857
|
+
]);
|
|
31858
|
+
if (!approval.ok) {
|
|
31859
|
+
return {
|
|
31860
|
+
ok: false,
|
|
31861
|
+
error: isSwapWithApprovalError(approval.error) ? withErrorContext(approval.error, ctx) : approveFailed("swap", approval.error, ctx)
|
|
31862
|
+
};
|
|
31863
|
+
}
|
|
31864
|
+
if (!created.ok) return created;
|
|
31865
|
+
const { resetTx, approveTx } = approval.value;
|
|
31866
|
+
const depositTx = created.value.tx;
|
|
31867
|
+
const txs = resetTx ? [resetTx, approveTx, depositTx] : [approveTx, depositTx];
|
|
31868
|
+
const sent = await sendApprovalBatch({
|
|
31869
|
+
walletProvider,
|
|
31870
|
+
srcChainKey,
|
|
31871
|
+
txs,
|
|
31872
|
+
timeoutMs: approvalBatchWaitMs(_params.timeout),
|
|
31873
|
+
feature: "swap",
|
|
31874
|
+
context: ctx
|
|
31875
|
+
});
|
|
31876
|
+
if (!sent.ok) return sent;
|
|
31877
|
+
return {
|
|
31878
|
+
ok: true,
|
|
31879
|
+
value: {
|
|
31880
|
+
tx: sent.value.txHash,
|
|
31881
|
+
intent: created.value.intent,
|
|
31882
|
+
relayData: created.value.relayData
|
|
31883
|
+
}
|
|
31884
|
+
};
|
|
31885
|
+
}
|
|
31886
|
+
/**
|
|
31887
|
+
* Finishes a batch an earlier call left {@link ATOMIC_BATCH_UNCONFIRMED}, without sending anything to
|
|
31888
|
+
* the wallet: waits for it again, relays its deposit client-side and notifies the solver. The
|
|
31889
|
+
* original intent went with that call, so it is read back from the hub tx the relay delivers.
|
|
31890
|
+
*/
|
|
31891
|
+
async resumeAtomicBatch(_params, batchId) {
|
|
31892
|
+
const { params, walletProvider } = _params;
|
|
31893
|
+
const srcChainKey = params.srcChainKey;
|
|
31894
|
+
swapInvariant(
|
|
31895
|
+
isEvmSpokeOnlyChainKeyType(srcChainKey) && isEvmWalletProviderType(walletProvider) && canSendAtomicBatch(walletProvider),
|
|
31896
|
+
"Resuming an atomic batch needs an EVM spoke source and an EIP-5792 wallet provider"
|
|
31897
|
+
);
|
|
31898
|
+
const ctx = {
|
|
31899
|
+
srcChainKey,
|
|
31900
|
+
dstChainKey: params.dstChainKey,
|
|
31901
|
+
action: "swapWithApproval",
|
|
31902
|
+
approvalStrategy: "atomic-batch"
|
|
31903
|
+
};
|
|
31904
|
+
const timeoutMs = approvalBatchWaitMs(_params.timeout);
|
|
31905
|
+
const deposit = await confirmApprovalBatch({
|
|
31906
|
+
walletProvider,
|
|
31907
|
+
batchId,
|
|
31908
|
+
callCount: _params.resumeBatchCallCount,
|
|
31909
|
+
timeoutMs,
|
|
31910
|
+
feature: "swap",
|
|
31911
|
+
context: ctx
|
|
31912
|
+
});
|
|
31913
|
+
if (!deposit.ok) return deposit;
|
|
31914
|
+
const srcTxHash = deposit.value.txHash;
|
|
31915
|
+
const txCtx = { ...ctx, srcTxHash };
|
|
31916
|
+
const packet = await relayTxAndWaitPacket({
|
|
31917
|
+
srcTxHash,
|
|
31918
|
+
chainKey: srcChainKey,
|
|
31919
|
+
relayerApiEndpoint: this.relayerApiEndpoint,
|
|
31920
|
+
timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
|
|
31921
|
+
});
|
|
31922
|
+
if (!packet.ok) return { ok: false, error: mapRelayFailure(packet.error, { feature: "swap", ...txCtx }) };
|
|
31923
|
+
const dstTxHash = packet.value.dst_tx_hash;
|
|
31924
|
+
const intent = await this.getIntent(dstTxHash);
|
|
31925
|
+
if (!intent.ok) return { ok: false, error: unknownFailed("swap", intent.error, txCtx) };
|
|
31926
|
+
const solved = await this.postExecution({ intent_tx_hash: dstTxHash });
|
|
31927
|
+
if (!solved.ok) return { ok: false, error: withErrorContext(solved.error, { srcChainKey, srcTxHash, dstTxHash }) };
|
|
31928
|
+
return {
|
|
31929
|
+
ok: true,
|
|
31930
|
+
value: {
|
|
31931
|
+
solverExecutionResponse: solved.value,
|
|
31932
|
+
intent: intent.value,
|
|
31933
|
+
intentDeliveryInfo: {
|
|
31934
|
+
srcChainKey,
|
|
31935
|
+
srcTxHash,
|
|
31936
|
+
srcAddress: params.srcAddress,
|
|
31937
|
+
dstChainKey: params.dstChainKey,
|
|
31938
|
+
dstTxHash,
|
|
31939
|
+
dstAddress: params.dstAddress
|
|
31940
|
+
},
|
|
31941
|
+
approvalStrategy: "atomic-batch"
|
|
31942
|
+
}
|
|
31943
|
+
};
|
|
31944
|
+
}
|
|
31945
|
+
/** Approve, wait for the approval to confirm, then create the intent — two or more signatures. */
|
|
31946
|
+
async approveThenCreateIntent(_params, validated = false) {
|
|
31947
|
+
const { params, extras, skipSimulation } = _params;
|
|
31948
|
+
const ctx = {
|
|
31949
|
+
srcChainKey: params.srcChainKey,
|
|
31950
|
+
dstChainKey: params.dstChainKey,
|
|
31951
|
+
action: "swapWithApproval",
|
|
31952
|
+
approvalStrategy: "sequential"
|
|
31953
|
+
};
|
|
31954
|
+
if (!validated) {
|
|
31955
|
+
const preflight = await this.createIntent({ params, extras, skipSimulation, raw: true });
|
|
31956
|
+
if (!preflight.ok) return preflight;
|
|
31957
|
+
}
|
|
31958
|
+
const approved = await this.approve(_params);
|
|
31959
|
+
if (!approved.ok) {
|
|
31960
|
+
return {
|
|
31961
|
+
ok: false,
|
|
31962
|
+
error: isSwapWithApprovalError(approved.error) ? withErrorContext(approved.error, ctx) : approveFailed("swap", approved.error, ctx)
|
|
31963
|
+
};
|
|
31964
|
+
}
|
|
31965
|
+
const confirmed = await confirmApproval({
|
|
31966
|
+
waitForTxReceipt: (receiptParams) => this.spoke.waitForTxReceipt(receiptParams),
|
|
31967
|
+
txHash: approved.value,
|
|
31968
|
+
chainKey: params.srcChainKey,
|
|
31969
|
+
feature: "swap",
|
|
31970
|
+
context: ctx
|
|
31971
|
+
});
|
|
31972
|
+
if (!confirmed.ok) return confirmed;
|
|
31973
|
+
return this.createIntent(_params);
|
|
31974
|
+
}
|
|
31975
|
+
/**
|
|
31976
|
+
* Completes a swap whose intent tx is already broadcast: the backend 2-step attempt when
|
|
31977
|
+
* `useBackendSubmitTx` is on, falling back to {@link fallbackSwapSteps} on any non-success.
|
|
31978
|
+
* Shared by `swap()` and `swapWithApproval()`, which differ only in how the intent tx is created.
|
|
31979
|
+
*/
|
|
31980
|
+
async completeSwap(_params, created) {
|
|
31981
|
+
const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
|
|
31982
|
+
if (this.useBackendSubmitTx) {
|
|
31983
|
+
const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
|
|
31984
|
+
if (submitted.ok) return submitted;
|
|
31985
|
+
this.config.logger.warn("[swap] backend submit-tx did not complete; falling back to the client-side relay", {
|
|
31986
|
+
error: submitted.error
|
|
31987
|
+
});
|
|
31988
|
+
}
|
|
31989
|
+
return this.fallbackSwapSteps(_params, created, timeoutMs);
|
|
31990
|
+
}
|
|
30957
31991
|
/**
|
|
30958
31992
|
* Client-side swap completion (opt-out via `swaps.useBackendSubmitTx: false`): verify the broadcast intent
|
|
30959
31993
|
* tx landed, then relay it to the hub — or use it directly when the source IS the hub — then notify the
|
|
@@ -30967,14 +32001,14 @@ var SwapService = class {
|
|
|
30967
32001
|
async fallbackSwapSteps(_params, created, timeoutMs) {
|
|
30968
32002
|
const { params } = _params;
|
|
30969
32003
|
const srcChainKey = params.srcChainKey;
|
|
30970
|
-
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey };
|
|
30971
32004
|
const { tx: spokeTxHash, intent, relayData } = created;
|
|
32005
|
+
const txCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "swap", srcTxHash: spokeTxHash };
|
|
30972
32006
|
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
30973
32007
|
txHash: created.tx,
|
|
30974
32008
|
chainKey: srcChainKey
|
|
30975
32009
|
});
|
|
30976
32010
|
if (!verifyTxHashResult.ok) {
|
|
30977
|
-
return { ok: false, error: verifyFailed("swap", verifyTxHashResult.error,
|
|
32011
|
+
return { ok: false, error: verifyFailed("swap", verifyTxHashResult.error, txCtx) };
|
|
30978
32012
|
}
|
|
30979
32013
|
let dstIntentTxHash;
|
|
30980
32014
|
if (isHubChainKeyType(srcChainKey)) {
|
|
@@ -30993,7 +32027,7 @@ var SwapService = class {
|
|
|
30993
32027
|
timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
|
|
30994
32028
|
});
|
|
30995
32029
|
if (!packet.ok) {
|
|
30996
|
-
return { ok: false, error: mapRelayFailure(packet.error, { feature: "swap",
|
|
32030
|
+
return { ok: false, error: mapRelayFailure(packet.error, { feature: "swap", ...txCtx }) };
|
|
30997
32031
|
}
|
|
30998
32032
|
dstIntentTxHash = packet.value.dst_tx_hash;
|
|
30999
32033
|
}
|
|
@@ -31001,7 +32035,14 @@ var SwapService = class {
|
|
|
31001
32035
|
intent_tx_hash: dstIntentTxHash
|
|
31002
32036
|
});
|
|
31003
32037
|
if (!postExecResult.ok) {
|
|
31004
|
-
return {
|
|
32038
|
+
return {
|
|
32039
|
+
ok: false,
|
|
32040
|
+
error: withErrorContext(postExecResult.error, {
|
|
32041
|
+
srcChainKey,
|
|
32042
|
+
srcTxHash: spokeTxHash,
|
|
32043
|
+
dstTxHash: dstIntentTxHash
|
|
32044
|
+
})
|
|
32045
|
+
};
|
|
31005
32046
|
}
|
|
31006
32047
|
return {
|
|
31007
32048
|
ok: true,
|
|
@@ -31107,7 +32148,7 @@ var SwapService = class {
|
|
|
31107
32148
|
token: params.inputToken,
|
|
31108
32149
|
amount: params.inputAmount,
|
|
31109
32150
|
owner: params.srcAddress,
|
|
31110
|
-
spender: this.
|
|
32151
|
+
spender: intentDepositSpender(this.config, srcChainKey)
|
|
31111
32152
|
});
|
|
31112
32153
|
}
|
|
31113
32154
|
if (isEvmSpokeOnlyChainKeyType(srcChainKey)) {
|
|
@@ -31116,7 +32157,7 @@ var SwapService = class {
|
|
|
31116
32157
|
token: params.inputToken,
|
|
31117
32158
|
amount: params.inputAmount,
|
|
31118
32159
|
owner: params.srcAddress,
|
|
31119
|
-
spender: this.config
|
|
32160
|
+
spender: intentDepositSpender(this.config, srcChainKey)
|
|
31120
32161
|
});
|
|
31121
32162
|
}
|
|
31122
32163
|
if (isStellarChainKeyType(srcChainKey)) {
|
|
@@ -31160,7 +32201,7 @@ var SwapService = class {
|
|
|
31160
32201
|
isOptionalEvmWalletProviderType(_params.walletProvider),
|
|
31161
32202
|
"Invalid wallet provider. Expected Evm wallet provider."
|
|
31162
32203
|
);
|
|
31163
|
-
const spender =
|
|
32204
|
+
const spender = intentDepositSpender(this.config, params.srcChainKey);
|
|
31164
32205
|
const coreParams = {
|
|
31165
32206
|
srcChainKey: params.srcChainKey,
|
|
31166
32207
|
owner: params.srcAddress,
|
|
@@ -31231,7 +32272,7 @@ var SwapService = class {
|
|
|
31231
32272
|
const wrapApproveFailure = (cause) => approveFailed("swap", cause);
|
|
31232
32273
|
try {
|
|
31233
32274
|
if (isHubChainKeyType(params.srcChainKey) || isEvmSpokeOnlyChainKeyType(params.srcChainKey)) {
|
|
31234
|
-
const spender =
|
|
32275
|
+
const spender = intentDepositSpender(this.config, params.srcChainKey);
|
|
31235
32276
|
const result = await this.spoke.buildApproveTxs({
|
|
31236
32277
|
srcChainKey: params.srcChainKey,
|
|
31237
32278
|
owner: params.srcAddress,
|
|
@@ -35724,6 +36765,9 @@ var BRIDGE_CODES = /* @__PURE__ */ new Set([
|
|
|
35724
36765
|
"UNKNOWN"
|
|
35725
36766
|
]);
|
|
35726
36767
|
var isBridgeOrchestrationError = isCodeMember(ORCHESTRATION_CODES);
|
|
36768
|
+
var isBridgeWithApprovalError = isCodeMember(
|
|
36769
|
+
/* @__PURE__ */ new Set([...ORCHESTRATION_CODES, "APPROVE_FAILED", "ALLOWANCE_CHECK_FAILED"])
|
|
36770
|
+
);
|
|
35727
36771
|
var isBridgeCreateIntentError = isCodeMember(CREATE_INTENT_CODES);
|
|
35728
36772
|
var isBridgeApproveError = isCodeMember(APPROVE_CODES);
|
|
35729
36773
|
var isBridgeAllowanceCheckError = isCodeMember(ALLOWANCE_CHECK_CODES);
|
|
@@ -36028,16 +37072,7 @@ var BridgeService = class {
|
|
|
36028
37072
|
try {
|
|
36029
37073
|
const created = await this.createBridgeIntent(_params);
|
|
36030
37074
|
if (!created.ok) return { ok: false, error: created.error };
|
|
36031
|
-
|
|
36032
|
-
if (this.useBackendSubmitTx) {
|
|
36033
|
-
const submitted = await this.submitTx(_params, created.value, createSubmitTxAttempt(timeoutMs));
|
|
36034
|
-
if (submitted.ok) return submitted;
|
|
36035
|
-
this.config.logger.warn(
|
|
36036
|
-
"[bridge] backend submit-tx did not complete; falling back to the client-side relay",
|
|
36037
|
-
{ error: submitted.error }
|
|
36038
|
-
);
|
|
36039
|
-
}
|
|
36040
|
-
return this.fallbackBridgeSteps(_params, created.value, timeoutMs);
|
|
37075
|
+
return await this.completeBridge(_params, created.value);
|
|
36041
37076
|
} catch (error) {
|
|
36042
37077
|
if (isBridgeOrchestrationError(error)) return { ok: false, error };
|
|
36043
37078
|
return {
|
|
@@ -36064,6 +37099,229 @@ var BridgeService = class {
|
|
|
36064
37099
|
}
|
|
36065
37100
|
);
|
|
36066
37101
|
}
|
|
37102
|
+
/**
|
|
37103
|
+
* Which approval path {@link bridgeWithApproval} would take for these params, so a UI can say up
|
|
37104
|
+
* front whether the bridge costs one signature or two. Read-only; sends nothing.
|
|
37105
|
+
*
|
|
37106
|
+
* `'atomic-batch'` needs an EVM spoke source and a wallet that reports EIP-5792 atomic support for
|
|
37107
|
+
* that chain (`'supported'`, or `'ready'` unless `allowAccountUpgrade: false`). The Sonic hub,
|
|
37108
|
+
* Stellar and wallets without batch support get `'sequential'`; other non-EVM sources have no
|
|
37109
|
+
* allowance and get `'not-required'`.
|
|
37110
|
+
*
|
|
37111
|
+
* @returns `isAllowanceValid`'s error — `VALIDATION_FAILED` for invalid params, `ALLOWANCE_CHECK_FAILED`
|
|
37112
|
+
* when the read fails — or the strategy.
|
|
37113
|
+
*/
|
|
37114
|
+
async getApprovalStrategy(_params) {
|
|
37115
|
+
const { params, walletProvider, allowAccountUpgrade = true } = _params;
|
|
37116
|
+
const allowance = await this.isAllowanceValid(_params);
|
|
37117
|
+
if (!allowance.ok) {
|
|
37118
|
+
return {
|
|
37119
|
+
ok: false,
|
|
37120
|
+
error: withErrorContext(allowance.error, {
|
|
37121
|
+
srcChainKey: params.srcChainKey,
|
|
37122
|
+
dstChainKey: params.dstChainKey,
|
|
37123
|
+
action: "bridgeWithApproval"
|
|
37124
|
+
})
|
|
37125
|
+
};
|
|
37126
|
+
}
|
|
37127
|
+
if (allowance.value) return { ok: true, value: "not-required" };
|
|
37128
|
+
return {
|
|
37129
|
+
ok: true,
|
|
37130
|
+
value: await resolveApprovalStrategy({ srcChainKey: params.srcChainKey, walletProvider, allowAccountUpgrade })
|
|
37131
|
+
};
|
|
37132
|
+
}
|
|
37133
|
+
/**
|
|
37134
|
+
* {@link bridge} with the source-token approval folded in. Picks a path with
|
|
37135
|
+
* {@link getApprovalStrategy}: no approval when the allowance already suffices; on an EIP-5792
|
|
37136
|
+
* wallet, approve and the deposit as **one atomic batch — one signature**; otherwise approve, wait
|
|
37137
|
+
* for it to confirm, then the deposit. Completion is exactly `bridge()`'s.
|
|
37138
|
+
*
|
|
37139
|
+
* A wallet that refuses the batch before signing anything falls back to the two-step path. A batch
|
|
37140
|
+
* the user saw is never retried as separate transactions:
|
|
37141
|
+
* - rejected → `USER_REJECTED`; a declined account upgrade (5750) adds `context.reason:
|
|
37142
|
+
* 'account-upgrade-declined'`, after which `allowAccountUpgrade: false` bridges without one;
|
|
37143
|
+
* - never included or fully reverted (EIP-5792 400 / 500) → `INTENT_CREATION_FAILED` with
|
|
37144
|
+
* `context.reason: 'atomic-batch-failed'`;
|
|
37145
|
+
* - anything else short of a confirmed deposit receipt → `TX_VERIFICATION_FAILED` with
|
|
37146
|
+
* `context.reason:` {@link ATOMIC_BATCH_UNCONFIRMED}, `context.batchId` and `context.callCount`. It may
|
|
37147
|
+
* have landed — do not send it again; call again with `resumeBatchId` and `resumeBatchCallCount` to
|
|
37148
|
+
* finish it once it does.
|
|
37149
|
+
*
|
|
37150
|
+
* @returns `bridge()`'s `TxHashPair` plus the `approvalStrategy` that ran. Errors are `bridge()`'s
|
|
37151
|
+
* codes plus `APPROVE_FAILED` and `ALLOWANCE_CHECK_FAILED`.
|
|
37152
|
+
*/
|
|
37153
|
+
async bridgeWithApproval(_params) {
|
|
37154
|
+
const { params } = _params;
|
|
37155
|
+
const baseCtx = { srcChainKey: params.srcChainKey, dstChainKey: params.dstChainKey, action: "bridgeWithApproval" };
|
|
37156
|
+
return this.config.analytics.trackResult(
|
|
37157
|
+
"bridge",
|
|
37158
|
+
"bridgeWithApproval",
|
|
37159
|
+
async () => {
|
|
37160
|
+
try {
|
|
37161
|
+
if (_params.resumeBatchId !== void 0) return await this.resumeAtomicBatch(_params, _params.resumeBatchId);
|
|
37162
|
+
const strategy = await this.getApprovalStrategy(_params);
|
|
37163
|
+
if (!strategy.ok) return strategy;
|
|
37164
|
+
const { result: created, approvalStrategy } = await runWithApproval({
|
|
37165
|
+
strategy: strategy.value,
|
|
37166
|
+
notRequired: () => this.createBridgeIntent(_params),
|
|
37167
|
+
atomicBatch: () => this.createBridgeIntentInAtomicBatch(_params),
|
|
37168
|
+
sequential: (afterRefusedBatch) => this.approveThenCreateBridgeIntent(_params, afterRefusedBatch),
|
|
37169
|
+
onBatchRefused: (error) => this.config.logger.warn("[bridgeWithApproval] wallet refused the atomic batch; approving separately", {
|
|
37170
|
+
error
|
|
37171
|
+
})
|
|
37172
|
+
});
|
|
37173
|
+
if (!created.ok) return created;
|
|
37174
|
+
const completed = await this.completeBridge(_params, created.value);
|
|
37175
|
+
if (!completed.ok) return completed;
|
|
37176
|
+
return { ok: true, value: { ...completed.value, approvalStrategy } };
|
|
37177
|
+
} catch (error) {
|
|
37178
|
+
if (isBridgeWithApprovalError(error)) return { ok: false, error };
|
|
37179
|
+
return { ok: false, error: executionFailed("bridge", error, baseCtx) };
|
|
37180
|
+
}
|
|
37181
|
+
},
|
|
37182
|
+
{
|
|
37183
|
+
start: () => ({
|
|
37184
|
+
srcChainKey: params.srcChainKey,
|
|
37185
|
+
dstChainKey: params.dstChainKey,
|
|
37186
|
+
srcToken: params.srcToken,
|
|
37187
|
+
dstToken: params.dstToken,
|
|
37188
|
+
amount: params.amount,
|
|
37189
|
+
srcAddress: params.srcAddress,
|
|
37190
|
+
recipient: params.recipient
|
|
37191
|
+
}),
|
|
37192
|
+
success: (value) => ({
|
|
37193
|
+
srcChainTxHash: value.srcChainTxHash,
|
|
37194
|
+
dstChainTxHash: value.dstChainTxHash,
|
|
37195
|
+
approvalStrategy: value.approvalStrategy
|
|
37196
|
+
}),
|
|
37197
|
+
failure: (error) => ({ code: error.code })
|
|
37198
|
+
}
|
|
37199
|
+
);
|
|
37200
|
+
}
|
|
37201
|
+
/**
|
|
37202
|
+
* Approve + deposit as one EIP-5792 atomic batch, in broadcast order (`[reset?, approve, deposit]`),
|
|
37203
|
+
* then hand back the batch's transaction hash as the deposit tx, for {@link completeBridge}.
|
|
37204
|
+
*/
|
|
37205
|
+
async createBridgeIntentInAtomicBatch(_params) {
|
|
37206
|
+
const { params, walletProvider, extras, skipSimulation } = _params;
|
|
37207
|
+
const srcChainKey = params.srcChainKey;
|
|
37208
|
+
bridgeInvariant(
|
|
37209
|
+
isEvmSpokeOnlyChainKeyType(srcChainKey) && isEvmWalletProviderType(walletProvider),
|
|
37210
|
+
"Atomic batches need an EVM spoke source and an EVM wallet provider"
|
|
37211
|
+
);
|
|
37212
|
+
const ctx = {
|
|
37213
|
+
srcChainKey,
|
|
37214
|
+
dstChainKey: params.dstChainKey,
|
|
37215
|
+
action: "bridgeWithApproval",
|
|
37216
|
+
approvalStrategy: "atomic-batch"
|
|
37217
|
+
};
|
|
37218
|
+
const [approval, created] = await Promise.all([
|
|
37219
|
+
this.buildApproveTxs({ params, raw: true }),
|
|
37220
|
+
this.createBridgeIntent({ params, extras, skipSimulation, raw: true })
|
|
37221
|
+
]);
|
|
37222
|
+
if (!approval.ok) return { ok: false, error: withErrorContext(approval.error, ctx) };
|
|
37223
|
+
if (!created.ok) return { ok: false, error: withErrorContext(created.error, ctx) };
|
|
37224
|
+
const { resetTx, approveTx } = approval.value;
|
|
37225
|
+
const depositTx = created.value.tx;
|
|
37226
|
+
const sent = await sendApprovalBatch({
|
|
37227
|
+
walletProvider,
|
|
37228
|
+
srcChainKey,
|
|
37229
|
+
txs: resetTx ? [resetTx, approveTx, depositTx] : [approveTx, depositTx],
|
|
37230
|
+
timeoutMs: approvalBatchWaitMs(_params.timeout),
|
|
37231
|
+
feature: "bridge",
|
|
37232
|
+
context: ctx
|
|
37233
|
+
});
|
|
37234
|
+
if (!sent.ok) return sent;
|
|
37235
|
+
return {
|
|
37236
|
+
ok: true,
|
|
37237
|
+
value: {
|
|
37238
|
+
tx: sent.value.txHash,
|
|
37239
|
+
relayData: created.value.relayData
|
|
37240
|
+
}
|
|
37241
|
+
};
|
|
37242
|
+
}
|
|
37243
|
+
/**
|
|
37244
|
+
* Finishes a batch an earlier call left {@link ATOMIC_BATCH_UNCONFIRMED}, without sending anything to
|
|
37245
|
+
* the wallet: waits for it again, then relays its deposit client-side and waits for the settlement packet.
|
|
37246
|
+
*/
|
|
37247
|
+
async resumeAtomicBatch(_params, batchId) {
|
|
37248
|
+
const { params, walletProvider } = _params;
|
|
37249
|
+
const srcChainKey = params.srcChainKey;
|
|
37250
|
+
bridgeInvariant(
|
|
37251
|
+
isEvmSpokeOnlyChainKeyType(srcChainKey) && isEvmWalletProviderType(walletProvider) && canSendAtomicBatch(walletProvider),
|
|
37252
|
+
"Resuming an atomic batch needs an EVM spoke source and an EIP-5792 wallet provider"
|
|
37253
|
+
);
|
|
37254
|
+
const ctx = {
|
|
37255
|
+
srcChainKey,
|
|
37256
|
+
dstChainKey: params.dstChainKey,
|
|
37257
|
+
action: "bridgeWithApproval",
|
|
37258
|
+
approvalStrategy: "atomic-batch"
|
|
37259
|
+
};
|
|
37260
|
+
const timeoutMs = approvalBatchWaitMs(_params.timeout);
|
|
37261
|
+
const deposit = await confirmApprovalBatch({
|
|
37262
|
+
walletProvider,
|
|
37263
|
+
batchId,
|
|
37264
|
+
callCount: _params.resumeBatchCallCount,
|
|
37265
|
+
timeoutMs,
|
|
37266
|
+
feature: "bridge",
|
|
37267
|
+
context: ctx
|
|
37268
|
+
});
|
|
37269
|
+
if (!deposit.ok) return deposit;
|
|
37270
|
+
const srcTxHash = deposit.value.txHash;
|
|
37271
|
+
const txCtx = { ...ctx, srcTxHash };
|
|
37272
|
+
const packet = await relayTxAndWaitPacket({
|
|
37273
|
+
srcTxHash,
|
|
37274
|
+
chainKey: srcChainKey,
|
|
37275
|
+
relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
|
|
37276
|
+
timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
|
|
37277
|
+
});
|
|
37278
|
+
if (!packet.ok) return { ok: false, error: mapRelayFailure(packet.error, { feature: "bridge", ...txCtx }) };
|
|
37279
|
+
return {
|
|
37280
|
+
ok: true,
|
|
37281
|
+
value: { srcChainTxHash: srcTxHash, dstChainTxHash: packet.value.dst_tx_hash, approvalStrategy: "atomic-batch" }
|
|
37282
|
+
};
|
|
37283
|
+
}
|
|
37284
|
+
/** Approve, wait for the approval to confirm, then send the deposit — two or more signatures. */
|
|
37285
|
+
async approveThenCreateBridgeIntent(_params, validated = false) {
|
|
37286
|
+
const { params, extras, skipSimulation } = _params;
|
|
37287
|
+
const ctx = {
|
|
37288
|
+
srcChainKey: params.srcChainKey,
|
|
37289
|
+
dstChainKey: params.dstChainKey,
|
|
37290
|
+
action: "bridgeWithApproval",
|
|
37291
|
+
approvalStrategy: "sequential"
|
|
37292
|
+
};
|
|
37293
|
+
if (!validated) {
|
|
37294
|
+
const preflight = await this.createBridgeIntent({ params, extras, skipSimulation, raw: true });
|
|
37295
|
+
if (!preflight.ok) return { ok: false, error: withErrorContext(preflight.error, ctx) };
|
|
37296
|
+
}
|
|
37297
|
+
const approved = await this.approve(_params);
|
|
37298
|
+
if (!approved.ok) return { ok: false, error: withErrorContext(approved.error, ctx) };
|
|
37299
|
+
const confirmed = await confirmApproval({
|
|
37300
|
+
waitForTxReceipt: (receiptParams) => this.spoke.waitForTxReceipt(receiptParams),
|
|
37301
|
+
txHash: approved.value,
|
|
37302
|
+
chainKey: params.srcChainKey,
|
|
37303
|
+
feature: "bridge",
|
|
37304
|
+
context: ctx
|
|
37305
|
+
});
|
|
37306
|
+
if (!confirmed.ok) return confirmed;
|
|
37307
|
+
return this.createBridgeIntent(_params);
|
|
37308
|
+
}
|
|
37309
|
+
/**
|
|
37310
|
+
* Completes a bridge whose deposit tx is already broadcast: the backend submit-tx attempt when
|
|
37311
|
+
* `useBackendSubmitTx` is on, falling back to {@link fallbackBridgeSteps} on any non-success.
|
|
37312
|
+
* Shared by `bridge()` and `bridgeWithApproval()`, which differ only in how the deposit is sent.
|
|
37313
|
+
*/
|
|
37314
|
+
async completeBridge(_params, created) {
|
|
37315
|
+
const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
|
|
37316
|
+
if (this.useBackendSubmitTx) {
|
|
37317
|
+
const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
|
|
37318
|
+
if (submitted.ok) return submitted;
|
|
37319
|
+
this.config.logger.warn("[bridge] backend submit-tx did not complete; falling back to the client-side relay", {
|
|
37320
|
+
error: submitted.error
|
|
37321
|
+
});
|
|
37322
|
+
}
|
|
37323
|
+
return this.fallbackBridgeSteps(_params, created, timeoutMs);
|
|
37324
|
+
}
|
|
36067
37325
|
/**
|
|
36068
37326
|
* Client-side bridge completion (opt-out via `bridge.useBackendSubmitTx: false`): verify the broadcast
|
|
36069
37327
|
* spoke-deposit tx, then relay it to the hub and wait for the settlement packet. Extracted verbatim from
|
|
@@ -36076,13 +37334,18 @@ var BridgeService = class {
|
|
|
36076
37334
|
*/
|
|
36077
37335
|
async fallbackBridgeSteps(_params, created, timeoutMs) {
|
|
36078
37336
|
const { params } = _params;
|
|
36079
|
-
const
|
|
37337
|
+
const txCtx = {
|
|
37338
|
+
srcChainKey: params.srcChainKey,
|
|
37339
|
+
dstChainKey: params.dstChainKey,
|
|
37340
|
+
action: "bridge",
|
|
37341
|
+
srcTxHash: created.tx
|
|
37342
|
+
};
|
|
36080
37343
|
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
36081
37344
|
txHash: created.tx,
|
|
36082
37345
|
chainKey: params.srcChainKey
|
|
36083
37346
|
});
|
|
36084
37347
|
if (!verifyTxHashResult.ok) {
|
|
36085
|
-
return { ok: false, error: verifyFailed("bridge", verifyTxHashResult.error,
|
|
37348
|
+
return { ok: false, error: verifyFailed("bridge", verifyTxHashResult.error, txCtx) };
|
|
36086
37349
|
}
|
|
36087
37350
|
const packetResult = await relayTxAndWaitPacket({
|
|
36088
37351
|
srcTxHash: created.tx,
|
|
@@ -36098,15 +37361,7 @@ var BridgeService = class {
|
|
|
36098
37361
|
timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
|
|
36099
37362
|
});
|
|
36100
37363
|
if (!packetResult.ok) {
|
|
36101
|
-
return {
|
|
36102
|
-
ok: false,
|
|
36103
|
-
error: mapRelayFailure(packetResult.error, {
|
|
36104
|
-
feature: "bridge",
|
|
36105
|
-
action: "bridge",
|
|
36106
|
-
srcChainKey: baseCtx.srcChainKey,
|
|
36107
|
-
dstChainKey: baseCtx.dstChainKey
|
|
36108
|
-
})
|
|
36109
|
-
};
|
|
37364
|
+
return { ok: false, error: mapRelayFailure(packetResult.error, { feature: "bridge", ...txCtx }) };
|
|
36110
37365
|
}
|
|
36111
37366
|
return {
|
|
36112
37367
|
ok: true,
|
|
@@ -44653,6 +45908,9 @@ var isLeverageYieldPostExecutionError = isCodeMember(
|
|
|
44653
45908
|
LEVERAGE_YIELD_POST_EXECUTION_CODES
|
|
44654
45909
|
);
|
|
44655
45910
|
var isLeverageYieldSwapError = isCodeMember(LEVERAGE_YIELD_SWAP_CODES);
|
|
45911
|
+
var isVaultSwapWithApprovalError = isCodeMember(
|
|
45912
|
+
/* @__PURE__ */ new Set([...LEVERAGE_YIELD_SWAP_CODES, "APPROVE_FAILED", "ALLOWANCE_CHECK_FAILED"])
|
|
45913
|
+
);
|
|
44656
45914
|
var isLeverageYieldError = isCodeMember(LEVERAGE_YIELD_CODES);
|
|
44657
45915
|
|
|
44658
45916
|
// src/leverageYield/positionFunding.ts
|
|
@@ -44765,7 +46023,7 @@ var LeverageYieldService = class {
|
|
|
44765
46023
|
}
|
|
44766
46024
|
/** Looks up a vault by its `name` field. Returns `undefined` when not registered. */
|
|
44767
46025
|
getVault(name) {
|
|
44768
|
-
return this.listVaults().find((
|
|
46026
|
+
return this.listVaults().find((v11) => v11.name === name);
|
|
44769
46027
|
}
|
|
44770
46028
|
/**
|
|
44771
46029
|
* Looks up a registered vault by its on-chain proxy address (case-insensitive).
|
|
@@ -44773,7 +46031,7 @@ var LeverageYieldService = class {
|
|
|
44773
46031
|
*/
|
|
44774
46032
|
getVaultByAddress(address) {
|
|
44775
46033
|
const normalized = address.toLowerCase();
|
|
44776
|
-
return this.listVaults().find((
|
|
46034
|
+
return this.listVaults().find((v11) => v11.vault.toLowerCase() === normalized);
|
|
44777
46035
|
}
|
|
44778
46036
|
/**
|
|
44779
46037
|
* Resolves the intent `deadline`: returns the caller-supplied value verbatim, otherwise
|
|
@@ -45200,17 +46458,7 @@ var LeverageYieldService = class {
|
|
|
45200
46458
|
if (!createIntentResult.ok) {
|
|
45201
46459
|
return { ok: false, error: createIntentResult.error };
|
|
45202
46460
|
}
|
|
45203
|
-
|
|
45204
|
-
const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
|
|
45205
|
-
if (this.useBackendSubmitTx) {
|
|
45206
|
-
const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
|
|
45207
|
-
if (submitted.ok) return submitted;
|
|
45208
|
-
this.config.logger.warn(
|
|
45209
|
-
"[leverageYield] backend submit-tx did not complete; falling back to the client-side relay",
|
|
45210
|
-
{ error: submitted.error }
|
|
45211
|
-
);
|
|
45212
|
-
}
|
|
45213
|
-
return this.fallbackVaultSwapSteps(_params, created, timeoutMs);
|
|
46461
|
+
return await this.completeVaultSwap(_params, createIntentResult.value);
|
|
45214
46462
|
} catch (error) {
|
|
45215
46463
|
if (isLeverageYieldSwapError(error)) return { ok: false, error };
|
|
45216
46464
|
return {
|
|
@@ -45238,6 +46486,374 @@ var LeverageYieldService = class {
|
|
|
45238
46486
|
}
|
|
45239
46487
|
);
|
|
45240
46488
|
}
|
|
46489
|
+
/**
|
|
46490
|
+
* Which approval path {@link vaultSwapWithApproval} would take for a vault swap's source token, so a
|
|
46491
|
+
* UI can say up front whether a deposit costs one signature or two. Read-only; sends nothing. Not
|
|
46492
|
+
* the hub-side {@link approve} / {@link isAllowanceValid}, which cover depositing into a vault directly.
|
|
46493
|
+
*
|
|
46494
|
+
* A withdraw (`hubWalletSwap`) spends from the hub wallet and is always `'not-required'`. A deposit
|
|
46495
|
+
* approves the same spender a swap does. `'atomic-batch'` needs an EVM spoke source and a wallet
|
|
46496
|
+
* that reports EIP-5792 atomic support for that chain (`'supported'`, or `'ready'` unless
|
|
46497
|
+
* `allowAccountUpgrade: false`); the Sonic hub, Stellar and wallets without batch support get
|
|
46498
|
+
* `'sequential'`.
|
|
46499
|
+
*
|
|
46500
|
+
* @returns `ALLOWANCE_CHECK_FAILED` when the allowance read fails; otherwise the strategy.
|
|
46501
|
+
*/
|
|
46502
|
+
async getApprovalStrategy(_params) {
|
|
46503
|
+
const { params, walletProvider, hubWalletSwap, allowAccountUpgrade = true } = _params;
|
|
46504
|
+
if (hubWalletSwap) return { ok: true, value: "not-required" };
|
|
46505
|
+
const allowance = await this.isDepositAllowanceValid(params);
|
|
46506
|
+
if (!allowance.ok) {
|
|
46507
|
+
return {
|
|
46508
|
+
ok: false,
|
|
46509
|
+
error: allowanceCheckFailed("leverageYield", allowance.error, {
|
|
46510
|
+
srcChainKey: params.srcChainKey,
|
|
46511
|
+
dstChainKey: params.dstChainKey,
|
|
46512
|
+
action: "vaultSwapWithApproval"
|
|
46513
|
+
})
|
|
46514
|
+
};
|
|
46515
|
+
}
|
|
46516
|
+
if (allowance.value) return { ok: true, value: "not-required" };
|
|
46517
|
+
return {
|
|
46518
|
+
ok: true,
|
|
46519
|
+
value: await resolveApprovalStrategy({ srcChainKey: params.srcChainKey, walletProvider, allowAccountUpgrade })
|
|
46520
|
+
};
|
|
46521
|
+
}
|
|
46522
|
+
/**
|
|
46523
|
+
* {@link vaultSwap} with a deposit's source-token approval folded in. Picks a path with
|
|
46524
|
+
* {@link getApprovalStrategy}: none when the allowance already suffices (and never for a withdraw);
|
|
46525
|
+
* on an EIP-5792 wallet, approve and the deposit as **one atomic batch — one signature**; otherwise
|
|
46526
|
+
* approve, wait for it to confirm, then the deposit. Intent creation, the leverage-yield partner fee
|
|
46527
|
+
* and completion (backend submit-tx with its `operation`, then the client-side fallback) are exactly
|
|
46528
|
+
* `vaultSwap()`'s.
|
|
46529
|
+
*
|
|
46530
|
+
* A wallet that refuses the batch before signing anything falls back to the two-step path. A batch
|
|
46531
|
+
* the user saw is never retried as separate transactions:
|
|
46532
|
+
* - rejected → `USER_REJECTED`; a declined account upgrade (5750) adds `context.reason:
|
|
46533
|
+
* 'account-upgrade-declined'`, after which `allowAccountUpgrade: false` deposits without one;
|
|
46534
|
+
* - never included or fully reverted (EIP-5792 400 / 500) → `INTENT_CREATION_FAILED` with
|
|
46535
|
+
* `context.reason: 'atomic-batch-failed'`;
|
|
46536
|
+
* - anything else short of a confirmed deposit receipt → `TX_VERIFICATION_FAILED` with
|
|
46537
|
+
* `context.reason:` {@link ATOMIC_BATCH_UNCONFIRMED}, `context.batchId` and `context.callCount`. It may
|
|
46538
|
+
* have landed — do not send it again; call again with `resumeBatchId` and `resumeBatchCallCount` to
|
|
46539
|
+
* finish it once it does.
|
|
46540
|
+
*
|
|
46541
|
+
* @returns `vaultSwap()`'s response plus the `approvalStrategy` that ran. Errors are `vaultSwap()`'s
|
|
46542
|
+
* codes plus `APPROVE_FAILED` and `ALLOWANCE_CHECK_FAILED`.
|
|
46543
|
+
*/
|
|
46544
|
+
async vaultSwapWithApproval(_params) {
|
|
46545
|
+
const { params } = _params;
|
|
46546
|
+
const baseCtx = {
|
|
46547
|
+
srcChainKey: params.srcChainKey,
|
|
46548
|
+
dstChainKey: params.dstChainKey,
|
|
46549
|
+
action: "vaultSwapWithApproval"
|
|
46550
|
+
};
|
|
46551
|
+
return this.config.analytics.trackResult(
|
|
46552
|
+
"leverageYield",
|
|
46553
|
+
"vaultSwapWithApproval",
|
|
46554
|
+
async () => {
|
|
46555
|
+
try {
|
|
46556
|
+
if (_params.resumeBatchId !== void 0) return await this.resumeAtomicBatch(_params, _params.resumeBatchId);
|
|
46557
|
+
const strategy = await this.getApprovalStrategy(_params);
|
|
46558
|
+
if (!strategy.ok) return strategy;
|
|
46559
|
+
const { result: created, approvalStrategy } = await runWithApproval({
|
|
46560
|
+
strategy: strategy.value,
|
|
46561
|
+
notRequired: () => this.createVaultIntent(_params),
|
|
46562
|
+
atomicBatch: () => this.createVaultIntentInAtomicBatch(_params),
|
|
46563
|
+
sequential: (afterRefusedBatch) => this.approveThenCreateVaultIntent(_params, afterRefusedBatch),
|
|
46564
|
+
onBatchRefused: (error) => this.config.logger.warn("[vaultSwapWithApproval] wallet refused the atomic batch; approving separately", {
|
|
46565
|
+
error
|
|
46566
|
+
})
|
|
46567
|
+
});
|
|
46568
|
+
if (!created.ok) return created;
|
|
46569
|
+
const completed = await this.completeVaultSwap(_params, created.value);
|
|
46570
|
+
if (!completed.ok) return completed;
|
|
46571
|
+
return { ok: true, value: { ...completed.value, approvalStrategy } };
|
|
46572
|
+
} catch (error) {
|
|
46573
|
+
if (isVaultSwapWithApprovalError(error)) return { ok: false, error };
|
|
46574
|
+
return { ok: false, error: unknownFailed("leverageYield", error, baseCtx) };
|
|
46575
|
+
}
|
|
46576
|
+
},
|
|
46577
|
+
{
|
|
46578
|
+
start: () => ({
|
|
46579
|
+
srcChainKey: params.srcChainKey,
|
|
46580
|
+
dstChainKey: params.dstChainKey,
|
|
46581
|
+
srcAddress: params.srcAddress,
|
|
46582
|
+
dstAddress: params.dstAddress,
|
|
46583
|
+
inputToken: params.inputToken,
|
|
46584
|
+
outputToken: params.outputToken,
|
|
46585
|
+
inputAmount: params.inputAmount
|
|
46586
|
+
}),
|
|
46587
|
+
success: (value) => ({
|
|
46588
|
+
intentId: value.intent.intentId,
|
|
46589
|
+
srcTxHash: value.intentDeliveryInfo.srcTxHash,
|
|
46590
|
+
dstTxHash: value.intentDeliveryInfo.dstTxHash,
|
|
46591
|
+
approvalStrategy: value.approvalStrategy
|
|
46592
|
+
}),
|
|
46593
|
+
failure: (error) => ({ code: error.code })
|
|
46594
|
+
}
|
|
46595
|
+
);
|
|
46596
|
+
}
|
|
46597
|
+
/**
|
|
46598
|
+
* Approve + deposit as one EIP-5792 atomic batch, in broadcast order (`[reset?, approve, deposit]`),
|
|
46599
|
+
* then hand back the batch's transaction hash as the intent tx, for {@link completeVaultSwap}.
|
|
46600
|
+
*/
|
|
46601
|
+
async createVaultIntentInAtomicBatch(_params) {
|
|
46602
|
+
const { params, walletProvider, extras, skipSimulation, partnerFee } = _params;
|
|
46603
|
+
const srcChainKey = params.srcChainKey;
|
|
46604
|
+
leverageYieldInvariant(
|
|
46605
|
+
isEvmSpokeOnlyChainKeyType(srcChainKey) && isEvmWalletProviderType(walletProvider),
|
|
46606
|
+
"Atomic batches need an EVM spoke source and an EVM wallet provider"
|
|
46607
|
+
);
|
|
46608
|
+
const ctx = {
|
|
46609
|
+
srcChainKey,
|
|
46610
|
+
dstChainKey: params.dstChainKey,
|
|
46611
|
+
action: "vaultSwapWithApproval",
|
|
46612
|
+
approvalStrategy: "atomic-batch"
|
|
46613
|
+
};
|
|
46614
|
+
const [approval, created] = await Promise.all([
|
|
46615
|
+
this.buildDepositApproveTxs(params, srcChainKey),
|
|
46616
|
+
this.createVaultIntent({ params, extras, skipSimulation, partnerFee, raw: true })
|
|
46617
|
+
]);
|
|
46618
|
+
if (!approval.ok) return { ok: false, error: approveFailed("leverageYield", approval.error, ctx) };
|
|
46619
|
+
if (!created.ok) return { ok: false, error: withErrorContext(created.error, ctx) };
|
|
46620
|
+
const { resetTx, approveTx } = approval.value;
|
|
46621
|
+
const depositTx = created.value.tx;
|
|
46622
|
+
const sent = await sendApprovalBatch({
|
|
46623
|
+
walletProvider,
|
|
46624
|
+
srcChainKey,
|
|
46625
|
+
txs: resetTx ? [resetTx, approveTx, depositTx] : [approveTx, depositTx],
|
|
46626
|
+
timeoutMs: approvalBatchWaitMs(_params.timeout),
|
|
46627
|
+
feature: "leverageYield",
|
|
46628
|
+
context: ctx
|
|
46629
|
+
});
|
|
46630
|
+
if (!sent.ok) return sent;
|
|
46631
|
+
return {
|
|
46632
|
+
ok: true,
|
|
46633
|
+
value: {
|
|
46634
|
+
tx: sent.value.txHash,
|
|
46635
|
+
intent: created.value.intent,
|
|
46636
|
+
relayData: created.value.relayData
|
|
46637
|
+
}
|
|
46638
|
+
};
|
|
46639
|
+
}
|
|
46640
|
+
/**
|
|
46641
|
+
* Finishes a batch an earlier call left {@link ATOMIC_BATCH_UNCONFIRMED}, without sending anything to
|
|
46642
|
+
* the wallet: waits for it again, relays its deposit client-side and notifies the solver. The
|
|
46643
|
+
* original intent went with that call, so it is read back from the hub tx the relay delivers.
|
|
46644
|
+
*/
|
|
46645
|
+
async resumeAtomicBatch(_params, batchId) {
|
|
46646
|
+
const { params, walletProvider } = _params;
|
|
46647
|
+
const srcChainKey = params.srcChainKey;
|
|
46648
|
+
leverageYieldInvariant(
|
|
46649
|
+
isEvmSpokeOnlyChainKeyType(srcChainKey) && isEvmWalletProviderType(walletProvider) && canSendAtomicBatch(walletProvider),
|
|
46650
|
+
"Resuming an atomic batch needs an EVM spoke source and an EIP-5792 wallet provider"
|
|
46651
|
+
);
|
|
46652
|
+
const ctx = {
|
|
46653
|
+
srcChainKey,
|
|
46654
|
+
dstChainKey: params.dstChainKey,
|
|
46655
|
+
action: "vaultSwapWithApproval",
|
|
46656
|
+
approvalStrategy: "atomic-batch"
|
|
46657
|
+
};
|
|
46658
|
+
const timeoutMs = approvalBatchWaitMs(_params.timeout);
|
|
46659
|
+
const deposit = await confirmApprovalBatch({
|
|
46660
|
+
walletProvider,
|
|
46661
|
+
batchId,
|
|
46662
|
+
callCount: _params.resumeBatchCallCount,
|
|
46663
|
+
timeoutMs,
|
|
46664
|
+
feature: "leverageYield",
|
|
46665
|
+
context: ctx
|
|
46666
|
+
});
|
|
46667
|
+
if (!deposit.ok) return deposit;
|
|
46668
|
+
const srcTxHash = deposit.value.txHash;
|
|
46669
|
+
const txCtx = { ...ctx, srcTxHash };
|
|
46670
|
+
const packet = await relayTxAndWaitPacket({
|
|
46671
|
+
srcTxHash,
|
|
46672
|
+
chainKey: srcChainKey,
|
|
46673
|
+
relayerApiEndpoint: this.config.relay.relayerApiEndpoint,
|
|
46674
|
+
timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
|
|
46675
|
+
});
|
|
46676
|
+
if (!packet.ok) return { ok: false, error: mapRelayFailure(packet.error, { feature: "leverageYield", ...txCtx }) };
|
|
46677
|
+
const dstTxHash = packet.value.dst_tx_hash;
|
|
46678
|
+
let intent;
|
|
46679
|
+
try {
|
|
46680
|
+
intent = await EvmSolverService.getIntent(dstTxHash, this.config, this.hubProvider.publicClient);
|
|
46681
|
+
} catch (error) {
|
|
46682
|
+
return { ok: false, error: unknownFailed("leverageYield", error, { ...txCtx, dstTxHash }) };
|
|
46683
|
+
}
|
|
46684
|
+
const solved = await this.notifySolver({ intent_tx_hash: dstTxHash });
|
|
46685
|
+
if (!solved.ok) return { ok: false, error: withErrorContext(solved.error, { srcChainKey, srcTxHash, dstTxHash }) };
|
|
46686
|
+
return {
|
|
46687
|
+
ok: true,
|
|
46688
|
+
value: {
|
|
46689
|
+
solverExecutionResponse: solved.value,
|
|
46690
|
+
intent,
|
|
46691
|
+
intentDeliveryInfo: {
|
|
46692
|
+
srcChainKey,
|
|
46693
|
+
srcTxHash,
|
|
46694
|
+
srcAddress: params.srcAddress,
|
|
46695
|
+
dstChainKey: params.dstChainKey,
|
|
46696
|
+
dstTxHash,
|
|
46697
|
+
dstAddress: params.dstAddress
|
|
46698
|
+
},
|
|
46699
|
+
approvalStrategy: "atomic-batch"
|
|
46700
|
+
}
|
|
46701
|
+
};
|
|
46702
|
+
}
|
|
46703
|
+
/** Approve, wait for the approval to confirm, then send the deposit — two or more signatures. */
|
|
46704
|
+
async approveThenCreateVaultIntent(_params, validated = false) {
|
|
46705
|
+
const { params, extras, skipSimulation, partnerFee } = _params;
|
|
46706
|
+
const ctx = {
|
|
46707
|
+
srcChainKey: params.srcChainKey,
|
|
46708
|
+
dstChainKey: params.dstChainKey,
|
|
46709
|
+
action: "vaultSwapWithApproval",
|
|
46710
|
+
approvalStrategy: "sequential"
|
|
46711
|
+
};
|
|
46712
|
+
if (!validated) {
|
|
46713
|
+
const preflight = await this.createVaultIntent({
|
|
46714
|
+
params,
|
|
46715
|
+
extras,
|
|
46716
|
+
skipSimulation,
|
|
46717
|
+
partnerFee,
|
|
46718
|
+
raw: true
|
|
46719
|
+
});
|
|
46720
|
+
if (!preflight.ok) return { ok: false, error: withErrorContext(preflight.error, ctx) };
|
|
46721
|
+
}
|
|
46722
|
+
const approved = await this.approveDeposit(_params);
|
|
46723
|
+
if (!approved.ok) {
|
|
46724
|
+
return {
|
|
46725
|
+
ok: false,
|
|
46726
|
+
error: isLeverageYieldApproveError(approved.error) ? withErrorContext(approved.error, ctx) : approveFailed("leverageYield", approved.error, ctx)
|
|
46727
|
+
};
|
|
46728
|
+
}
|
|
46729
|
+
const confirmed = await confirmApproval({
|
|
46730
|
+
waitForTxReceipt: (receiptParams) => this.spoke.waitForTxReceipt(receiptParams),
|
|
46731
|
+
txHash: approved.value,
|
|
46732
|
+
chainKey: params.srcChainKey,
|
|
46733
|
+
feature: "leverageYield",
|
|
46734
|
+
context: ctx
|
|
46735
|
+
});
|
|
46736
|
+
if (!confirmed.ok) return confirmed;
|
|
46737
|
+
return this.createVaultIntent(_params);
|
|
46738
|
+
}
|
|
46739
|
+
/** Whether the deposit's source-token allowance already covers `inputAmount`. */
|
|
46740
|
+
async isDepositAllowanceValid(params) {
|
|
46741
|
+
try {
|
|
46742
|
+
const { srcChainKey } = params;
|
|
46743
|
+
if (isHubChainKeyType(srcChainKey)) {
|
|
46744
|
+
return await this.spoke.isAllowanceValid({
|
|
46745
|
+
srcChainKey,
|
|
46746
|
+
token: params.inputToken,
|
|
46747
|
+
amount: params.inputAmount,
|
|
46748
|
+
owner: params.srcAddress,
|
|
46749
|
+
spender: intentDepositSpender(this.config, srcChainKey)
|
|
46750
|
+
});
|
|
46751
|
+
}
|
|
46752
|
+
if (isEvmSpokeOnlyChainKeyType(srcChainKey)) {
|
|
46753
|
+
return await this.spoke.isAllowanceValid({
|
|
46754
|
+
srcChainKey,
|
|
46755
|
+
token: params.inputToken,
|
|
46756
|
+
amount: params.inputAmount,
|
|
46757
|
+
owner: params.srcAddress,
|
|
46758
|
+
spender: intentDepositSpender(this.config, srcChainKey)
|
|
46759
|
+
});
|
|
46760
|
+
}
|
|
46761
|
+
if (isStellarChainKeyType(srcChainKey)) {
|
|
46762
|
+
return await this.spoke.isAllowanceValid({
|
|
46763
|
+
srcChainKey,
|
|
46764
|
+
token: params.inputToken,
|
|
46765
|
+
amount: params.inputAmount,
|
|
46766
|
+
owner: params.srcAddress
|
|
46767
|
+
});
|
|
46768
|
+
}
|
|
46769
|
+
return { ok: true, value: true };
|
|
46770
|
+
} catch (error) {
|
|
46771
|
+
return { ok: false, error };
|
|
46772
|
+
}
|
|
46773
|
+
}
|
|
46774
|
+
/** The deposit's unsigned approval leg(s) on an EVM spoke, for the atomic batch. */
|
|
46775
|
+
async buildDepositApproveTxs(params, srcChainKey) {
|
|
46776
|
+
try {
|
|
46777
|
+
return await this.spoke.buildApproveTxs({
|
|
46778
|
+
srcChainKey,
|
|
46779
|
+
owner: params.srcAddress,
|
|
46780
|
+
token: params.inputToken,
|
|
46781
|
+
amount: params.inputAmount,
|
|
46782
|
+
spender: intentDepositSpender(this.config, srcChainKey),
|
|
46783
|
+
raw: true
|
|
46784
|
+
});
|
|
46785
|
+
} catch (error) {
|
|
46786
|
+
return { ok: false, error };
|
|
46787
|
+
}
|
|
46788
|
+
}
|
|
46789
|
+
/** Signs and sends the deposit's approval (hub, EVM spoke or Stellar); resolves at broadcast. */
|
|
46790
|
+
async approveDeposit(_params) {
|
|
46791
|
+
const { params, walletProvider } = _params;
|
|
46792
|
+
try {
|
|
46793
|
+
if (isHubChainKeyType(params.srcChainKey) || isEvmSpokeOnlyChainKeyType(params.srcChainKey)) {
|
|
46794
|
+
leverageYieldInvariant(
|
|
46795
|
+
isOptionalEvmWalletProviderType(walletProvider),
|
|
46796
|
+
"Invalid wallet provider. Expected Evm wallet provider."
|
|
46797
|
+
);
|
|
46798
|
+
const result = await this.spoke.approve({
|
|
46799
|
+
srcChainKey: params.srcChainKey,
|
|
46800
|
+
owner: params.srcAddress,
|
|
46801
|
+
token: params.inputToken,
|
|
46802
|
+
amount: params.inputAmount,
|
|
46803
|
+
spender: intentDepositSpender(this.config, params.srcChainKey),
|
|
46804
|
+
raw: false,
|
|
46805
|
+
walletProvider
|
|
46806
|
+
});
|
|
46807
|
+
if (!result.ok) return result;
|
|
46808
|
+
return {
|
|
46809
|
+
ok: true,
|
|
46810
|
+
value: result.value
|
|
46811
|
+
};
|
|
46812
|
+
}
|
|
46813
|
+
if (isStellarChainKeyType(params.srcChainKey)) {
|
|
46814
|
+
leverageYieldInvariant(
|
|
46815
|
+
isOptionalStellarWalletProviderType(walletProvider),
|
|
46816
|
+
"Invalid wallet provider. Expected Stellar wallet provider."
|
|
46817
|
+
);
|
|
46818
|
+
const result = await this.spoke.approve({
|
|
46819
|
+
srcChainKey: params.srcChainKey,
|
|
46820
|
+
token: params.inputToken,
|
|
46821
|
+
amount: params.inputAmount,
|
|
46822
|
+
owner: params.srcAddress,
|
|
46823
|
+
raw: false,
|
|
46824
|
+
walletProvider
|
|
46825
|
+
});
|
|
46826
|
+
if (!result.ok) return result;
|
|
46827
|
+
return {
|
|
46828
|
+
ok: true,
|
|
46829
|
+
value: result.value
|
|
46830
|
+
};
|
|
46831
|
+
}
|
|
46832
|
+
leverageYieldInvariant(false, "Approve only supported for hub (Sonic), EVM spokes, and Stellar", {
|
|
46833
|
+
srcChainKey: params.srcChainKey,
|
|
46834
|
+
field: "srcChainKey"
|
|
46835
|
+
});
|
|
46836
|
+
} catch (error) {
|
|
46837
|
+
return { ok: false, error };
|
|
46838
|
+
}
|
|
46839
|
+
}
|
|
46840
|
+
/**
|
|
46841
|
+
* Completes a vault swap whose intent tx is already broadcast: the backend submit-tx attempt when
|
|
46842
|
+
* `useBackendSubmitTx` is on, falling back to {@link fallbackVaultSwapSteps} on any non-success.
|
|
46843
|
+
* Shared by `vaultSwap()` and `vaultSwapWithApproval()`, which differ only in how the intent tx is sent.
|
|
46844
|
+
*/
|
|
46845
|
+
async completeVaultSwap(_params, created) {
|
|
46846
|
+
const timeoutMs = resolveTimeoutMs(_params.timeout, DEFAULT_RELAY_TX_TIMEOUT);
|
|
46847
|
+
if (this.useBackendSubmitTx) {
|
|
46848
|
+
const submitted = await this.submitTx(_params, created, createSubmitTxAttempt(timeoutMs));
|
|
46849
|
+
if (submitted.ok) return submitted;
|
|
46850
|
+
this.config.logger.warn(
|
|
46851
|
+
"[leverageYield] backend submit-tx did not complete; falling back to the client-side relay",
|
|
46852
|
+
{ error: submitted.error }
|
|
46853
|
+
);
|
|
46854
|
+
}
|
|
46855
|
+
return this.fallbackVaultSwapSteps(_params, created, timeoutMs);
|
|
46856
|
+
}
|
|
45241
46857
|
/**
|
|
45242
46858
|
* Client-side vault-swap completion (the opt-out path, and the fallback): verify the broadcast
|
|
45243
46859
|
* intent tx landed,
|
|
@@ -45249,14 +46865,19 @@ var LeverageYieldService = class {
|
|
|
45249
46865
|
async fallbackVaultSwapSteps(_params, created, timeoutMs) {
|
|
45250
46866
|
const { params } = _params;
|
|
45251
46867
|
const srcChainKey = params.srcChainKey;
|
|
45252
|
-
const baseCtx = { srcChainKey, dstChainKey: params.dstChainKey, action: "vaultSwap" };
|
|
45253
46868
|
const { tx: spokeTxHash, intent, relayData } = created;
|
|
46869
|
+
const txCtx = {
|
|
46870
|
+
srcChainKey,
|
|
46871
|
+
dstChainKey: params.dstChainKey,
|
|
46872
|
+
action: "vaultSwap",
|
|
46873
|
+
srcTxHash: spokeTxHash
|
|
46874
|
+
};
|
|
45254
46875
|
const verifyTxHashResult = await this.spoke.verifyTxHash({
|
|
45255
46876
|
txHash: spokeTxHash,
|
|
45256
46877
|
chainKey: srcChainKey
|
|
45257
46878
|
});
|
|
45258
46879
|
if (!verifyTxHashResult.ok) {
|
|
45259
|
-
return { ok: false, error: verifyFailed("leverageYield", verifyTxHashResult.error,
|
|
46880
|
+
return { ok: false, error: verifyFailed("leverageYield", verifyTxHashResult.error, txCtx) };
|
|
45260
46881
|
}
|
|
45261
46882
|
let dstIntentTxHash;
|
|
45262
46883
|
if (isHubChainKeyType(srcChainKey)) {
|
|
@@ -45274,7 +46895,7 @@ var LeverageYieldService = class {
|
|
|
45274
46895
|
timeout: Math.max(timeoutMs, RELAY_FALLBACK_FLOOR_MS)
|
|
45275
46896
|
});
|
|
45276
46897
|
if (!packet.ok) {
|
|
45277
|
-
return { ok: false, error: mapRelayFailure(packet.error, { feature: "leverageYield", ...
|
|
46898
|
+
return { ok: false, error: mapRelayFailure(packet.error, { feature: "leverageYield", ...txCtx }) };
|
|
45278
46899
|
}
|
|
45279
46900
|
dstIntentTxHash = packet.value.dst_tx_hash;
|
|
45280
46901
|
}
|
|
@@ -45282,7 +46903,14 @@ var LeverageYieldService = class {
|
|
|
45282
46903
|
intent_tx_hash: dstIntentTxHash
|
|
45283
46904
|
});
|
|
45284
46905
|
if (!postExecResult.ok) {
|
|
45285
|
-
return {
|
|
46906
|
+
return {
|
|
46907
|
+
ok: false,
|
|
46908
|
+
error: withErrorContext(postExecResult.error, {
|
|
46909
|
+
srcChainKey,
|
|
46910
|
+
srcTxHash: spokeTxHash,
|
|
46911
|
+
dstTxHash: dstIntentTxHash
|
|
46912
|
+
})
|
|
46913
|
+
};
|
|
45286
46914
|
}
|
|
45287
46915
|
return {
|
|
45288
46916
|
ok: true,
|
|
@@ -45483,17 +47111,25 @@ var LeverageYieldService = class {
|
|
|
45483
47111
|
* unreadable backend into an error, which is right for a polled read that would otherwise spend a
|
|
45484
47112
|
* budget on an unverified miss, and wrong to impose on a surface that already ships without it.
|
|
45485
47113
|
*
|
|
47114
|
+
* Every non-final answer is reconciled, an in-flight one included, and a journal cancel reads
|
|
47115
|
+
* `FAILED`: the solver can keep reporting a cancelled intent in flight, and nothing else ends that poll.
|
|
47116
|
+
*
|
|
45486
47117
|
* `timeoutMs` bounds the solver request alone. The reconcile carries its own
|
|
45487
47118
|
* {@link RECONCILE_TIMEOUT_MS}, so a bounded call can cost both.
|
|
45488
47119
|
*/
|
|
45489
47120
|
async resolveSolverStatus(request, timeoutMs, apiKey) {
|
|
45490
47121
|
const solverResult = await this.solverStatus(request, timeoutMs, apiKey);
|
|
45491
|
-
const
|
|
45492
|
-
if (
|
|
47122
|
+
const status = solverResult.ok ? solverResult.value.status : void 0;
|
|
47123
|
+
if (status === SolverIntentStatusCode.SOLVED || status === SolverIntentStatusCode.FAILED) return solverResult;
|
|
47124
|
+
const forgotten = !solverResult.ok || status === SolverIntentStatusCode.NOT_FOUND;
|
|
45493
47125
|
const timeout = Math.min(RECONCILE_TIMEOUT_MS2, this.backendApi.requestTimeoutMs);
|
|
45494
47126
|
const intent = await this.backendApi.getIntentByTxHash(request.intent_tx_hash, { timeout, apiKey });
|
|
45495
|
-
const
|
|
45496
|
-
if (
|
|
47127
|
+
const outcome = intent.ok ? readIntentJournalOutcome(intent.value) : void 0;
|
|
47128
|
+
if (outcome?.kind === "solved") {
|
|
47129
|
+
return { ok: true, value: { status: SolverIntentStatusCode.SOLVED, fill_tx_hash: outcome.fillTxHash } };
|
|
47130
|
+
}
|
|
47131
|
+
if (outcome?.kind === "cancelled") return { ok: true, value: { status: SolverIntentStatusCode.FAILED } };
|
|
47132
|
+
if (!forgotten) return solverResult;
|
|
45497
47133
|
const backendAnswered = intent.ok || isSodaxError(intent.error) && intent.error.context?.status === 404;
|
|
45498
47134
|
if (solverResult.ok && !backendAnswered) {
|
|
45499
47135
|
return {
|
|
@@ -45512,9 +47148,14 @@ var LeverageYieldService = class {
|
|
|
45512
47148
|
* Reads a vault swap's status from its source-chain transaction — the identifier a caller always
|
|
45513
47149
|
* holds after `vaultSwap()`.
|
|
45514
47150
|
*
|
|
45515
|
-
* **Routes;
|
|
45516
|
-
* otherwise the solver's answer via the hub tx hash resolved from the relay packet. The result
|
|
45517
|
-
* tagged with `source` (discriminate on it)
|
|
47151
|
+
* **Routes; defines no status of its own.** Returns the backend submit-tx record while it is in
|
|
47152
|
+
* play, otherwise the solver's answer via the hub tx hash resolved from the relay packet. The result
|
|
47153
|
+
* is tagged with `source` (discriminate on it).
|
|
47154
|
+
*
|
|
47155
|
+
* The solver arm is reconciled against the backend's durable intent record: a settling fill reads
|
|
47156
|
+
* `SOLVED`, and a cancel with nothing filled reads `FAILED` even while the solver still reports the
|
|
47157
|
+
* intent in flight. Otherwise it carries the solver's answer unmodified, and the backend arm its
|
|
47158
|
+
* record unmodified.
|
|
45518
47159
|
*
|
|
45519
47160
|
* `sodax.api.leverageYield.getSubmitTxStatus` cannot answer for every vault swap. Sometimes there
|
|
45520
47161
|
* is no record — `useBackendSubmitTx: false`, or the submit was rejected. More often the record
|
|
@@ -45534,8 +47175,8 @@ var LeverageYieldService = class {
|
|
|
45534
47175
|
*
|
|
45535
47176
|
* @param params - `srcChainKey` and `srcTxHash` of the source-chain vault-swap transaction.
|
|
45536
47177
|
* @param config - Optional per-request override. Its `apiKey` reaches every keyed leg — the
|
|
45537
|
-
* submit-tx record read, the solver read, and the durable-intent read a solver
|
|
45538
|
-
* back to — so one override keys the whole call. The relay leg is unauthenticated and takes none.
|
|
47178
|
+
* submit-tx record read, the solver read, and the durable-intent read a non-final solver answer
|
|
47179
|
+
* falls back to — so one override keys the whole call. The relay leg is unauthenticated and takes none.
|
|
45539
47180
|
* @returns A `Result` containing a {@link DetailedLeverageYieldStatus}. Fails with `LOOKUP_FAILED`
|
|
45540
47181
|
* when no source can answer yet. Branch on `error.context.reason`:
|
|
45541
47182
|
* `DETAILED_STATUS_NOT_DELIVERED` is the ambiguous miss a caller should bound with a retry
|
|
@@ -47956,4 +49597,4 @@ function isNoRouteRefusal(error) {
|
|
|
47956
49597
|
(*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
47957
49598
|
*/
|
|
47958
49599
|
|
|
47959
|
-
export { ALLOWANCE_CHECK_CODES, APPROVE_CODES, AssetService, BACKEND_API_BASE_PATH, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BITCOIN_DUST_SATS, BOUND_API_HOST, BOUND_COMPANION_HOSTS, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BackendHttpError, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeApiService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_API_BASE_URL, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DEFAULT_SPONSORING_API_ENDPOINT, DEPRECATED_BOUND_HOSTS, DETAILED_STATUS_NOT_DELIVERED, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldApiService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_POSITION_FEE_BPS, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, ORACLE_CANDLE_INTERVALS, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RELAY_FALLBACK_FLOOR_MS, RELAY_REQUEST_TIMEOUT_MS, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SDK_VERSION, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, SPEED_TIER_SECONDS, SPEED_TIER_THRESHOLDS, SPONSORING_API_ERROR_CODES, SPONSORING_API_STELLAR_BASE_PATH, SPONSOR_CONFIG_TTL_MS, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_BASE_RESERVE_TTL_MS, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, SponsoringApiService, SponsoringService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiGrpcTransport, SuiSpokeService, SupportedMigrationTokens, SwapService, SwapsApiService, TOKEN_LOGO_BASE_URL, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, canonicalizeBitcoinAddress, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, classifySponsorError, concentratedLiquidityConfig, configVersionFor, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createBalanceCollector, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, encodeTokenIdentifier, erc20Abi, erc4626Abi, estimateBitcoinTxSize, estimateSwapSpeedTier, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatConfigVersion, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hederaSupportedTokens, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isApprovalSupportedChainKeyType, isAuthFailure, isAuthStatus, isBackendHttpError, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isFillEvent, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeBitcoinToken, isNativeBitcoinTransfer, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isNoRouteRefusal, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isOracleCandleInterval, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRealWorldAsset, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isSponsoringConfigError, isSponsoringLookupError, isSponsoringOrchestrationError, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidBitcoinAddress, isValidInjectiveAddress, isValidNearAccountId, isValidWalletProviderForChainKey, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, leveragedNetApyPct, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseConfigVersion, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, projectLeverageLeg, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, reportPositionIntent, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveLogger, resolvePositionFundingAddress, retry, reverseEncodeAddress, robinhoodChain, robinhoodSupportedTokens, serializeAddressData, settleWalletBalances, silentLogger, sizeLeverageBorrow, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, sponsoringInvariant, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, timeToBreakevenYears, toCreateBridgeIntentParamsV2, toSuiExecutionResult, toSuiExecutionStatus, toSuiPaginatedCoins, tokenLogo, tokenLogoSlug, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, wrappedSonicAbi };
|
|
49600
|
+
export { ACCOUNT_UPGRADE_DECLINED, ALLOWANCE_CHECK_CODES, APPROVE_CODES, ATOMIC_BATCH_REFUSED, ATOMIC_BATCH_UNCONFIRMED, AssetService, BACKEND_API_BASE_PATH, BITCOIN_CHAIN_KEYS, BITCOIN_CHAIN_KEYS_SET, BITCOIN_DUST_SATS, BOUND_API_HOST, BOUND_COMPANION_HOSTS, BTC_WALLET_ADDRESS_TYPES, BackendApiService, BackendHttpError, BalnSwapService, BigIntToHex, BigNumberZeroDecimal, BitcoinSpokeService, BnUSDMigrationService, BridgeApiService, BridgeService, CHAIN_KEYS, CHAIN_LOGO_BASE_URL, CONFIG_VERSION, CREATE_INTENT_CODES, ChainKeys, ChainTypeArr, ClService, ConfigService, CustomSorobanServer, CustomStellarAccount, DEFAULT_API_BASE_URL, DEFAULT_BACKEND_API_ENDPOINT, DEFAULT_BACKEND_API_HEADERS, DEFAULT_BACKEND_API_TIMEOUT, DEFAULT_DEADLINE_OFFSET, DEFAULT_MAX_RETRY, DEFAULT_RELAYER_API_ENDPOINT, DEFAULT_RELAY_TX_TIMEOUT, DEFAULT_RETRY_DELAY_MS, DEFAULT_SPONSORING_API_ENDPOINT, DEPRECATED_BOUND_HOSTS, DETAILED_STATUS_NOT_DELIVERED, DexService, EVM_CHAIN_ID_TO_KEY, EVM_CHAIN_KEYS, EVM_CHAIN_KEYS_SET, EVM_SPOKE_ONLY_CHAIN_KEYS, EVM_SPOKE_ONLY_CHAIN_KEYS_SET, Erc20Service, Erc4626Service, EvmAssetManagerService, EvmHubProvider, EvmSolverService, EvmSpokeService, EvmVaultTokenService, FEE_PERCENTAGE_SCALE, GAS_ESTIMATION_CODES, HALF_RAY, HALF_WAD, HUB_CHAIN_KEY, HookKind, HookService, HttpRelayError, HubVaultSymbols, ICON_CHAIN_KEYS, ICON_CHAIN_KEYS_SET, ICON_TX_RESULT_WAIT_MAX_RETRY, INJECTIVE_CHAIN_KEYS, INJECTIVE_CHAIN_KEYS_SET, INTENT_CHAIN_IDS, IconSpokeService, IcxMigrationService, Injective20Token, InjectiveSpokeService, IntentCreatedEventAbi, IntentDataService, IntentDataType, IntentFilledEventAbi, IntentRelayChainIdToChainKey, IntentsAbi, LOOKUP_CODES, LTV_PRECISION, LendingPoolService, LeverageYieldApiService, LeverageYieldService, LockupMultiplier, LockupPeriod, LsodaSymbols, LsodaTokens, MAX_POSITION_FEE_BPS, MAX_UINT256, MigrationService, MintPositionEventAbi, MoneyMarketDataService, MoneyMarketService, NEAR_CHAIN_KEYS, NEAR_CHAIN_KEYS_SET, NEAR_DEFAULT_GAS, NEAR_STORAGE_DEPOSIT, NearSpokeService, ORACLE_CANDLE_INTERVALS, PartnerFeeClaimService, PartnerService, Permit2Service, ProtocolIntentsAbi, RAY, RAY_DECIMALS, RELAY_ERROR_CODES, RELAY_FALLBACK_FLOOR_MS, RELAY_REQUEST_TIMEOUT_MS, RadfiApiError, RadfiProvider, RecoveryService, RelayChainIdMap, SDK_VERSION, SECONDS_PER_YEAR, SODAX_ERROR_CODES, SODAX_FEATURES, SOLANA_CHAIN_KEYS, SOLANA_CHAIN_KEYS_SET, SONIC_CHAIN_KEYS, SONIC_CHAIN_KEYS_SET, SPEED_TIER_SECONDS, SPEED_TIER_THRESHOLDS, SPONSORING_API_ERROR_CODES, SPONSORING_API_STELLAR_BASE_PATH, SPONSOR_CONFIG_TTL_MS, STACKS_CHAIN_KEYS, STACKS_CHAIN_KEYS_SET, STELLAR_BASE_RESERVE_TTL_MS, STELLAR_CHAIN_KEYS, STELLAR_CHAIN_KEYS_SET, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, SUI_CHAIN_KEYS, SUI_CHAIN_KEYS_SET, SodaTokens, Sodax, SodaxError, SolanaSpokeService, SolverApiService, SolverIntentErrorCode, SolverIntentStatusCode, SonicSpokeService, SpokeService, SponsoringApiService, SponsoringService, StacksSpokeService, StakingLogic, StakingService, StatATokenAddresses, StellarSpokeService, SuiGrpcTransport, SuiSpokeService, SupportedMigrationTokens, SwapService, SwapsApiService, TOKEN_LOGO_BASE_URL, USD_DECIMALS, UiPoolDataProviderService, VAULT_TOKEN_DECIMALS, WAD, WAD_RAY_RATIO, WEI_DECIMALS, adjustAmountByFee, allowanceCheckFailed, apiConfig, approveFailed, arbitrumSupportedTokens, assetManagerAbi, avalancheSupportedTokens, balnSwapAbi, baseChainInfo, baseSupportedTokens, binomialApproximatedRayPow, bitcoinSupportedTokens, bnUSDLegacySpokeChainIds, bnUSDLegacyTokens, bridgeConfig, bridgeInvariant, bscSupportedTokens, calcOpReturnOutputVbytes, calculateAllReserveIncentives, calculateAllUserIncentives, calculateAvailableBorrowsMarketReferenceCurrency, calculateCompoundedInterest, calculateCompoundedRate, calculateFeeAmount, calculateHealthFactorFromBalances, calculateHealthFactorFromBalancesBigUnits, calculateLinearInterest, calculatePercentageFeeAmount, canonicalizeBitcoinAddress, clPoolAbi, clPoolManagerAbi, clPositionManagerAbi, clQuoterAbi, clRouterAbi, clTickLensAbi, classifySponsorError, concentratedLiquidityConfig, configVersionFor, confirmApprovalBatch, connectionAbi, consoleLogger, convertTransactionInstructionToRaw, createBalanceCollector, createInvariant, deepMerge, defaultHookAbi, detectBitcoinAddressType, dexConfig, dexInvariant, dexPools, encodeAddress, encodeBtcPayloadToBytes, encodeContractCalls, encodeTokenIdentifier, erc20Abi, erc4626Abi, estimateBitcoinTxSize, estimateSwapSpeedTier, ethereumSupportedTokens, executionFailed, formatBasisPoints, formatConfigVersion, formatEModeCategory, formatEModes, formatPercentage, formatReserve, formatReserveUSD, formatReserves, formatReservesAndIncentives, formatUserSummary, formatUserSummaryAndIncentives, gasEstimationFailed, getAllLegacybnUSDTokens, getAndFormatReserveEModes, getAssetManagerIdl, getAssetManagerProgram, getChainKeyFromRelayChainId, getChainType, getCompoundedBalance, getConcentratedLiquidityConfig, getConnectionIdl, getConnectionProgram, getEvmChainKeyByChainId, getEvmViemChain, getIconAddressBytes, getIntentRelayChainId, getLinearBalance, getMarketReferenceCurrencyAndUsdBalance, getPacket, getProvider, getRandomBytes, getReserveNormalizedIncome, getReservesEModes, getSolanaAddressBytes, getSolverConfig, getSpokeHook, getSpokeHooks, getStagingSolverTokens, getSupportedSolverTokens, getTransactionPackets, getbnUSDToken, hederaSupportedTokens, hexToBigInt, hexToSolanaAddress, hubConfig, hyper, hyperevmSupportedTokens, iconSupportedTokens, injectiveSupportedTokens, intentCreationFailed, isApprovalSupportedChainKeyType, isAtomicBatchRefusal, isAuthFailure, isAuthStatus, isBackendHttpError, isBalnMigrateParams, isBitcoinChainKey, isBitcoinChainKeyType, isBitcoinWalletProviderType, isBridgeAllowanceCheckError, isBridgeApproveError, isBridgeCreateIntentError, isBridgeError, isBridgeLookupError, isBridgeOrchestrationError, isBridgeWithApprovalError, isCodeMember, isDexApproveError, isDexCreateIntentError, isDexError, isEvmChainKey, isEvmChainKeyType, isEvmSpokeChainConfig, isEvmSpokeOnlyChainKey, isEvmSpokeOnlyChainKeyType, isEvmWalletProviderType, isFeatureError, isFillEvent, isHookSupportedToken, isHubChainKey, isHubChainKeyType, isIconAddress, isIconChainKey, isIconChainKeyType, isIcxCreateRevertMigrationParams, isIcxMigrateParams, isInjectiveChainKey, isInjectiveChainKeyType, isJsonRpcPayloadResponse, isLegacybnUSDChainId, isLegacybnUSDToken, isLeverageYieldAllowanceCheckError, isLeverageYieldApproveError, isLeverageYieldCreateIntentError, isLeverageYieldError, isLeverageYieldLookupError, isLeverageYieldPostExecutionError, isLeverageYieldSwapError, isMigrateOrchestrationError, isMigrationAllowanceCheckError, isMigrationApproveError, isMigrationCreateIntentError, isMigrationError, isMigrationLookupError, isMoneyMarketAllowanceCheckError, isMoneyMarketApproveError, isMoneyMarketCreateIntentError, isMoneyMarketError, isMoneyMarketGasEstimationError, isMoneyMarketOrchestrationError, isNativeBitcoinToken, isNativeBitcoinTransfer, isNativeToken, isNearChainKey, isNearChainKeyType, isNewbnUSDChainId, isNewbnUSDToken, isNoRouteRefusal, isOptionalBitcoinWalletProviderType, isOptionalEvmWalletProviderType, isOptionalStellarWalletProviderType, isOracleCandleInterval, isPartnerError, isPartnerFeeAmount, isPartnerFeePercentage, isPostExecutionError, isRawDestinationParams, isRealWorldAsset, isRecoveryError, isResponseAddressType, isResponseSigningType, isRevertMigrationOrchestrationError, isSodaxError, isSolanaChainKey, isSolanaChainKeyType, isSolanaNativeToken, isSonicChainKey, isSonicChainKeyType, isSpokeApproveParamsEvmSpoke, isSpokeApproveParamsHub, isSpokeApproveParamsStellar, isSpokeChainKey, isSpokeIsAllowanceValidParamsEvmSpoke, isSpokeIsAllowanceValidParamsHub, isSpokeIsAllowanceValidParamsStellar, isSponsoringConfigError, isSponsoringLookupError, isSponsoringOrchestrationError, isStacksChainKey, isStacksChainKeyType, isStakeOrchestrationError, isStakingAllowanceCheckError, isStakingApproveError, isStakingCreateIntentError, isStakingError, isStakingInfoFetchError, isStakingOrchestrationError, isStellarChainKey, isStellarChainKeyType, isStellarWalletProviderType, isSuiChainKey, isSuiChainKeyType, isSupportedBitcoinAddressType, isSwapCreateIntentError, isSwapError, isSwapSupportedToken, isSwapWithApprovalError, isUndefinedOrValidWalletProviderForChainKey, isUnifiedBnUSDMigrateParams, isValidBitcoinAddress, isValidInjectiveAddress, isValidNearAccountId, isValidWalletProviderForChainKey, isVaultSwapWithApprovalError, kaiaSupportedTokens, leverageYieldConfig, leverageYieldInvariant, leverageYieldVaults, leveragedNetApyPct, lightlinkSupportedTokens, lookupFailed, mapRelayFailure, mergeSodaxConfig, messageOf, migrationInvariant, mintPositionParamsAbi, mmInvariant, modifyLiquidityParamsAbi, moneyMarketConfig, moneyMarketReserveAssets, moneyMarketSupportedTokens, nativeToUSD, nearSupportedTokens, newbnUSDSpokeChainIds, noopAnalytics, normalize, normalizeBN, normalizePsbtToBase64, normalizeSignatureToBase64, normalizedToUsd, optimismSupportedTokens, pancakeSwapInfinityDefaultHookAbi, pancakeSwapInfinityPoolManagerAbi, pancakeSwapInfinityPositionManagerAbi, parseConfigVersion, parseToStroops, parseTokenArrayFromJson, partnerInvariant, permit2Abi, polygonSupportedTokens, poolAbi, poolKeyAbi, projectLeverageLeg, randomUint256, rayDiv, rayMul, rayPow, rayToWad, recoveryInvariant, redbellySupportedTokens, relayConfig, relayTxAndWaitPacket, reportPositionIntent, requestAddress, requestJsonRpc, requestSigning, resolveAnalytics, resolveApprovalStrategy, resolveLogger, resolvePositionFundingAddress, retry, reverseEncodeAddress, robinhoodChain, robinhoodSupportedTokens, sendApprovalBatch, serializeAddressData, settleWalletBalances, silentLogger, sizeLeverageBorrow, sleep, sodaxConfig, sodaxInvariant, solanaSupportedTokens, solverConfig, sonicSupportedTokens, sonicWalletFactoryAbi, spokeAssetManagerAbi, spokeChainConfig, spokeChainKeysSet, spokeHooks, sponsoringInvariant, stacksSupportedTokens, stagingSwapSupportedTokens, stakedSodaAbi, stakingInvariant, stakingRouterAbi, stataTokenFactoryAbi, stellarSupportedTokens, submitTransaction, suiSupportedTokens, summarizeSwapStatus, supportedSpokeChains, supportedTokensByChain, swapExactInSingleParamsAbi, swapInvariant, swapSupportedTokens, swapsConfig, timeToBreakevenYears, toCreateBridgeIntentParamsV2, toSuiExecutionResult, toSuiExecutionStatus, toSuiPaginatedCoins, tokenLogo, tokenLogoSlug, uiPoolDataAbi, universalRouterAbi, unknownFailed, usesBip322MessageSigning, valueToBigNumber, valueToZDBigNumber, variableDebtTokenAbi, vaultTokenAbi, verifyFailed, wadToRay, waitForStacksTransaction, waitForTransactionReceipt, waitUntilIntentExecuted, walletFactoryAbi, withErrorContext, wrappedSonicAbi };
|