@oydual31/more-vaults-sdk 0.1.13 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react/index.cjs +33 -16
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +33 -16
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-CQeExpAR.d.cts → spokeRoutes-BFIxGa1h.d.cts} +8 -1
- package/dist/{spokeRoutes-CQeExpAR.d.ts → spokeRoutes-BFIxGa1h.d.ts} +8 -1
- package/dist/viem/index.cjs +33 -16
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +1 -1
- package/dist/viem/index.d.ts +1 -1
- package/dist/viem/index.js +33 -16
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/spokeRoutes.ts +56 -29
package/dist/react/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { h as VaultStatus, f as VaultMetadata, e as UserPosition, a as AsyncRequestStatusInfo, j as VaultTopology, V as VaultDistribution, c as InboundRouteWithBalance } from '../spokeRoutes-
|
|
2
|
+
import { h as VaultStatus, f as VaultMetadata, e as UserPosition, a as AsyncRequestStatusInfo, j as VaultTopology, V as VaultDistribution, c as InboundRouteWithBalance } from '../spokeRoutes-BFIxGa1h.cjs';
|
|
3
3
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import { h as VaultStatus, f as VaultMetadata, e as UserPosition, a as AsyncRequestStatusInfo, j as VaultTopology, V as VaultDistribution, c as InboundRouteWithBalance } from '../spokeRoutes-
|
|
2
|
+
import { h as VaultStatus, f as VaultMetadata, e as UserPosition, a as AsyncRequestStatusInfo, j as VaultTopology, V as VaultDistribution, c as InboundRouteWithBalance } from '../spokeRoutes-BFIxGa1h.js';
|
|
3
3
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
|
package/dist/react/index.js
CHANGED
|
@@ -1430,6 +1430,15 @@ function createChainClient(chainId) {
|
|
|
1430
1430
|
transport: rpcs.length === 1 ? http(rpcs[0]) : fallback(rpcs.map((url) => http(url)))
|
|
1431
1431
|
});
|
|
1432
1432
|
}
|
|
1433
|
+
var SYMBOL_ABI = [{ name: "symbol", type: "function", stateMutability: "view", inputs: [], outputs: [{ type: "string" }] }];
|
|
1434
|
+
async function readTokenSymbol(client, token, fallbackSymbol) {
|
|
1435
|
+
if (!client) return fallbackSymbol;
|
|
1436
|
+
try {
|
|
1437
|
+
return await client.readContract({ address: token, abi: SYMBOL_ABI, functionName: "symbol" });
|
|
1438
|
+
} catch {
|
|
1439
|
+
return fallbackSymbol;
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1433
1442
|
Object.fromEntries(
|
|
1434
1443
|
Object.entries(PUBLIC_RPCS).map(([k, v]) => [k, v[0]])
|
|
1435
1444
|
);
|
|
@@ -1465,26 +1474,31 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
|
|
|
1465
1474
|
if (!client) return;
|
|
1466
1475
|
try {
|
|
1467
1476
|
const receiverBytes32 = `0x${getAddress(userAddress).slice(2).padStart(64, "0")}`;
|
|
1468
|
-
const
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1477
|
+
const spokeTokenAddr = getAddress(spokeEntry.token);
|
|
1478
|
+
const [fee, sourceTokenSymbol] = await Promise.all([
|
|
1479
|
+
client.readContract({
|
|
1480
|
+
address: getAddress(spokeEntry.oft),
|
|
1481
|
+
abi: OFT_ABI,
|
|
1482
|
+
functionName: "quoteSend",
|
|
1483
|
+
args: [{
|
|
1484
|
+
dstEid: hubEid,
|
|
1485
|
+
to: receiverBytes32,
|
|
1486
|
+
amountLD: 1000000n,
|
|
1487
|
+
minAmountLD: 0n,
|
|
1488
|
+
extraOptions: "0x",
|
|
1489
|
+
composeMsg: "0x",
|
|
1490
|
+
oftCmd
|
|
1491
|
+
}, false]
|
|
1492
|
+
}),
|
|
1493
|
+
readTokenSymbol(client, spokeTokenAddr, symbol)
|
|
1494
|
+
]);
|
|
1482
1495
|
results.push({
|
|
1483
1496
|
symbol,
|
|
1484
1497
|
spokeChainId,
|
|
1485
1498
|
depositType: "oft-compose",
|
|
1486
1499
|
spokeOft: getAddress(spokeEntry.oft),
|
|
1487
|
-
spokeToken:
|
|
1500
|
+
spokeToken: spokeTokenAddr,
|
|
1501
|
+
sourceTokenSymbol,
|
|
1488
1502
|
hubOft: getAddress(hubEntry.oft),
|
|
1489
1503
|
oftCmd,
|
|
1490
1504
|
lzFeeEstimate: fee.nativeFee,
|
|
@@ -1498,12 +1512,15 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
|
|
|
1498
1512
|
for (const [symbol, chainMap] of Object.entries(OFT_ROUTES)) {
|
|
1499
1513
|
const hubEntry = chainMap[hubChainId];
|
|
1500
1514
|
if (hubEntry && getAddress(hubEntry.token) === getAddress(vaultAsset)) {
|
|
1515
|
+
const hubTokenAddr = getAddress(hubEntry.token);
|
|
1516
|
+
const sourceTokenSymbol = await readTokenSymbol(hubClient, hubTokenAddr, symbol);
|
|
1501
1517
|
results.unshift({
|
|
1502
1518
|
symbol,
|
|
1503
1519
|
spokeChainId: hubChainId,
|
|
1504
1520
|
depositType: "direct",
|
|
1505
1521
|
spokeOft: null,
|
|
1506
|
-
spokeToken:
|
|
1522
|
+
spokeToken: hubTokenAddr,
|
|
1523
|
+
sourceTokenSymbol,
|
|
1507
1524
|
hubOft: null,
|
|
1508
1525
|
oftCmd: "0x",
|
|
1509
1526
|
lzFeeEstimate: 0n,
|