@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
|
@@ -426,7 +426,7 @@ interface OutboundRoute {
|
|
|
426
426
|
/** Native gas token symbol per chain ID — lzFeeEstimate is denominated in this token */
|
|
427
427
|
declare const NATIVE_SYMBOL: Partial<Record<number, string>>;
|
|
428
428
|
interface InboundRoute {
|
|
429
|
-
/**
|
|
429
|
+
/** Internal route identifier from OFT_ROUTES (e.g. 'stgUSDC') — do NOT show to users */
|
|
430
430
|
symbol: string;
|
|
431
431
|
/** Chain ID where user sends from */
|
|
432
432
|
spokeChainId: number;
|
|
@@ -440,6 +440,13 @@ interface InboundRoute {
|
|
|
440
440
|
spokeOft: Address | null;
|
|
441
441
|
/** Token user must approve on spoke chain (zeroAddress = native ETH) */
|
|
442
442
|
spokeToken: Address;
|
|
443
|
+
/**
|
|
444
|
+
* Human-readable symbol of the token the user needs to hold on the spoke chain.
|
|
445
|
+
* For OFTAdapters this is the underlying token symbol (e.g. 'USDC', 'weETH').
|
|
446
|
+
* For pure OFTs this is the OFT's own symbol (e.g. 'sUSDe', 'USDe').
|
|
447
|
+
* Use this — not `symbol` — when displaying the token name to users.
|
|
448
|
+
*/
|
|
449
|
+
sourceTokenSymbol: string;
|
|
443
450
|
/** OFT contract on hub chain — receives tokens for the composer. Null for direct deposits. */
|
|
444
451
|
hubOft: Address | null;
|
|
445
452
|
/** oftCmd to use in SendParam (0x01 for Stargate taxi, 0x for standard OFT) */
|
|
@@ -426,7 +426,7 @@ interface OutboundRoute {
|
|
|
426
426
|
/** Native gas token symbol per chain ID — lzFeeEstimate is denominated in this token */
|
|
427
427
|
declare const NATIVE_SYMBOL: Partial<Record<number, string>>;
|
|
428
428
|
interface InboundRoute {
|
|
429
|
-
/**
|
|
429
|
+
/** Internal route identifier from OFT_ROUTES (e.g. 'stgUSDC') — do NOT show to users */
|
|
430
430
|
symbol: string;
|
|
431
431
|
/** Chain ID where user sends from */
|
|
432
432
|
spokeChainId: number;
|
|
@@ -440,6 +440,13 @@ interface InboundRoute {
|
|
|
440
440
|
spokeOft: Address | null;
|
|
441
441
|
/** Token user must approve on spoke chain (zeroAddress = native ETH) */
|
|
442
442
|
spokeToken: Address;
|
|
443
|
+
/**
|
|
444
|
+
* Human-readable symbol of the token the user needs to hold on the spoke chain.
|
|
445
|
+
* For OFTAdapters this is the underlying token symbol (e.g. 'USDC', 'weETH').
|
|
446
|
+
* For pure OFTs this is the OFT's own symbol (e.g. 'sUSDe', 'USDe').
|
|
447
|
+
* Use this — not `symbol` — when displaying the token name to users.
|
|
448
|
+
*/
|
|
449
|
+
sourceTokenSymbol: string;
|
|
443
450
|
/** OFT contract on hub chain — receives tokens for the composer. Null for direct deposits. */
|
|
444
451
|
hubOft: Address | null;
|
|
445
452
|
/** oftCmd to use in SendParam (0x01 for Stargate taxi, 0x for standard OFT) */
|
package/dist/viem/index.cjs
CHANGED
|
@@ -1945,6 +1945,15 @@ function createChainClient(chainId) {
|
|
|
1945
1945
|
transport: rpcs.length === 1 ? viem.http(rpcs[0]) : viem.fallback(rpcs.map((url) => viem.http(url)))
|
|
1946
1946
|
});
|
|
1947
1947
|
}
|
|
1948
|
+
var SYMBOL_ABI = [{ name: "symbol", type: "function", stateMutability: "view", inputs: [], outputs: [{ type: "string" }] }];
|
|
1949
|
+
async function readTokenSymbol(client, token, fallbackSymbol) {
|
|
1950
|
+
if (!client) return fallbackSymbol;
|
|
1951
|
+
try {
|
|
1952
|
+
return await client.readContract({ address: token, abi: SYMBOL_ABI, functionName: "symbol" });
|
|
1953
|
+
} catch {
|
|
1954
|
+
return fallbackSymbol;
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1948
1957
|
Object.fromEntries(
|
|
1949
1958
|
Object.entries(PUBLIC_RPCS).map(([k, v]) => [k, v[0]])
|
|
1950
1959
|
);
|
|
@@ -1980,26 +1989,31 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
|
|
|
1980
1989
|
if (!client) return;
|
|
1981
1990
|
try {
|
|
1982
1991
|
const receiverBytes32 = `0x${viem.getAddress(userAddress).slice(2).padStart(64, "0")}`;
|
|
1983
|
-
const
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1992
|
+
const spokeTokenAddr = viem.getAddress(spokeEntry.token);
|
|
1993
|
+
const [fee, sourceTokenSymbol] = await Promise.all([
|
|
1994
|
+
client.readContract({
|
|
1995
|
+
address: viem.getAddress(spokeEntry.oft),
|
|
1996
|
+
abi: OFT_ABI,
|
|
1997
|
+
functionName: "quoteSend",
|
|
1998
|
+
args: [{
|
|
1999
|
+
dstEid: hubEid,
|
|
2000
|
+
to: receiverBytes32,
|
|
2001
|
+
amountLD: 1000000n,
|
|
2002
|
+
minAmountLD: 0n,
|
|
2003
|
+
extraOptions: "0x",
|
|
2004
|
+
composeMsg: "0x",
|
|
2005
|
+
oftCmd
|
|
2006
|
+
}, false]
|
|
2007
|
+
}),
|
|
2008
|
+
readTokenSymbol(client, spokeTokenAddr, symbol)
|
|
2009
|
+
]);
|
|
1997
2010
|
results.push({
|
|
1998
2011
|
symbol,
|
|
1999
2012
|
spokeChainId,
|
|
2000
2013
|
depositType: "oft-compose",
|
|
2001
2014
|
spokeOft: viem.getAddress(spokeEntry.oft),
|
|
2002
|
-
spokeToken:
|
|
2015
|
+
spokeToken: spokeTokenAddr,
|
|
2016
|
+
sourceTokenSymbol,
|
|
2003
2017
|
hubOft: viem.getAddress(hubEntry.oft),
|
|
2004
2018
|
oftCmd,
|
|
2005
2019
|
lzFeeEstimate: fee.nativeFee,
|
|
@@ -2013,12 +2027,15 @@ async function getInboundRoutes(hubChainId, vault, vaultAsset, userAddress) {
|
|
|
2013
2027
|
for (const [symbol, chainMap] of Object.entries(OFT_ROUTES)) {
|
|
2014
2028
|
const hubEntry = chainMap[hubChainId];
|
|
2015
2029
|
if (hubEntry && viem.getAddress(hubEntry.token) === viem.getAddress(vaultAsset)) {
|
|
2030
|
+
const hubTokenAddr = viem.getAddress(hubEntry.token);
|
|
2031
|
+
const sourceTokenSymbol = await readTokenSymbol(hubClient, hubTokenAddr, symbol);
|
|
2016
2032
|
results.unshift({
|
|
2017
2033
|
symbol,
|
|
2018
2034
|
spokeChainId: hubChainId,
|
|
2019
2035
|
depositType: "direct",
|
|
2020
2036
|
spokeOft: null,
|
|
2021
|
-
spokeToken:
|
|
2037
|
+
spokeToken: hubTokenAddr,
|
|
2038
|
+
sourceTokenSymbol,
|
|
2022
2039
|
hubOft: null,
|
|
2023
2040
|
oftCmd: "0x",
|
|
2024
2041
|
lzFeeEstimate: 0n,
|