@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.
@@ -1432,6 +1432,15 @@ function createChainClient(chainId) {
1432
1432
  transport: rpcs.length === 1 ? viem.http(rpcs[0]) : viem.fallback(rpcs.map((url) => viem.http(url)))
1433
1433
  });
1434
1434
  }
1435
+ var SYMBOL_ABI = [{ name: "symbol", type: "function", stateMutability: "view", inputs: [], outputs: [{ type: "string" }] }];
1436
+ async function readTokenSymbol(client, token, fallbackSymbol) {
1437
+ if (!client) return fallbackSymbol;
1438
+ try {
1439
+ return await client.readContract({ address: token, abi: SYMBOL_ABI, functionName: "symbol" });
1440
+ } catch {
1441
+ return fallbackSymbol;
1442
+ }
1443
+ }
1435
1444
  Object.fromEntries(
1436
1445
  Object.entries(PUBLIC_RPCS).map(([k, v]) => [k, v[0]])
1437
1446
  );
@@ -1467,26 +1476,31 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
1467
1476
  if (!client) return;
1468
1477
  try {
1469
1478
  const receiverBytes32 = `0x${viem.getAddress(userAddress).slice(2).padStart(64, "0")}`;
1470
- const fee = await client.readContract({
1471
- address: viem.getAddress(spokeEntry.oft),
1472
- abi: OFT_ABI,
1473
- functionName: "quoteSend",
1474
- args: [{
1475
- dstEid: hubEid,
1476
- to: receiverBytes32,
1477
- amountLD: 1000000n,
1478
- minAmountLD: 0n,
1479
- extraOptions: "0x",
1480
- composeMsg: "0x",
1481
- oftCmd
1482
- }, false]
1483
- });
1479
+ const spokeTokenAddr = viem.getAddress(spokeEntry.token);
1480
+ const [fee, sourceTokenSymbol] = await Promise.all([
1481
+ client.readContract({
1482
+ address: viem.getAddress(spokeEntry.oft),
1483
+ abi: OFT_ABI,
1484
+ functionName: "quoteSend",
1485
+ args: [{
1486
+ dstEid: hubEid,
1487
+ to: receiverBytes32,
1488
+ amountLD: 1000000n,
1489
+ minAmountLD: 0n,
1490
+ extraOptions: "0x",
1491
+ composeMsg: "0x",
1492
+ oftCmd
1493
+ }, false]
1494
+ }),
1495
+ readTokenSymbol(client, spokeTokenAddr, symbol)
1496
+ ]);
1484
1497
  results.push({
1485
1498
  symbol,
1486
1499
  spokeChainId,
1487
1500
  depositType: "oft-compose",
1488
1501
  spokeOft: viem.getAddress(spokeEntry.oft),
1489
- spokeToken: viem.getAddress(spokeEntry.token),
1502
+ spokeToken: spokeTokenAddr,
1503
+ sourceTokenSymbol,
1490
1504
  hubOft: viem.getAddress(hubEntry.oft),
1491
1505
  oftCmd,
1492
1506
  lzFeeEstimate: fee.nativeFee,
@@ -1500,12 +1514,15 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
1500
1514
  for (const [symbol, chainMap] of Object.entries(OFT_ROUTES)) {
1501
1515
  const hubEntry = chainMap[hubChainId];
1502
1516
  if (hubEntry && viem.getAddress(hubEntry.token) === viem.getAddress(vaultAsset)) {
1517
+ const hubTokenAddr = viem.getAddress(hubEntry.token);
1518
+ const sourceTokenSymbol = await readTokenSymbol(hubClient, hubTokenAddr, symbol);
1503
1519
  results.unshift({
1504
1520
  symbol,
1505
1521
  spokeChainId: hubChainId,
1506
1522
  depositType: "direct",
1507
1523
  spokeOft: null,
1508
- spokeToken: viem.getAddress(hubEntry.token),
1524
+ spokeToken: hubTokenAddr,
1525
+ sourceTokenSymbol,
1509
1526
  hubOft: null,
1510
1527
  oftCmd: "0x",
1511
1528
  lzFeeEstimate: 0n,