@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.
@@ -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-CQeExpAR.cjs';
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
 
@@ -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-CQeExpAR.js';
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
 
@@ -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 fee = await client.readContract({
1469
- address: getAddress(spokeEntry.oft),
1470
- abi: OFT_ABI,
1471
- functionName: "quoteSend",
1472
- args: [{
1473
- dstEid: hubEid,
1474
- to: receiverBytes32,
1475
- amountLD: 1000000n,
1476
- minAmountLD: 0n,
1477
- extraOptions: "0x",
1478
- composeMsg: "0x",
1479
- oftCmd
1480
- }, false]
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: getAddress(spokeEntry.token),
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: getAddress(hubEntry.token),
1522
+ spokeToken: hubTokenAddr,
1523
+ sourceTokenSymbol,
1507
1524
  hubOft: null,
1508
1525
  oftCmd: "0x",
1509
1526
  lzFeeEstimate: 0n,