@oydual31/more-vaults-sdk 0.2.7 → 0.2.9
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 +30 -8
- 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 +30 -8
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-z7s_5ooO.d.cts → spokeRoutes-FgKCJQYa.d.cts} +5 -2
- package/dist/{spokeRoutes-z7s_5ooO.d.ts → spokeRoutes-FgKCJQYa.d.ts} +5 -2
- package/dist/viem/index.cjs +51 -8
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +44 -14
- package/dist/viem/index.d.ts +44 -14
- package/dist/viem/index.js +51 -9
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/viem/chains.ts +16 -3
- package/src/viem/index.ts +1 -0
- package/src/viem/redeemFlows.ts +50 -10
- package/src/viem/userHelpers.ts +14 -8
package/dist/viem/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hash, Address, WalletClient, PublicClient } from 'viem';
|
|
2
2
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-
|
|
3
|
+
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-FgKCJQYa.cjs';
|
|
4
4
|
|
|
5
5
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
6
|
declare const CHAIN_IDS: {
|
|
@@ -101,10 +101,12 @@ declare const OFT_ROUTES: {
|
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* USDF — USD Flow OFT. Bridges PYUSD (Ethereum) ↔ USDF (Flow EVM).
|
|
105
|
+
* On Ethereum: underlying is PayPal USD (PYUSD, 0x6c3ea9...).
|
|
106
|
+
* On Flow: the OFT itself IS the token (USDF, 0x2aabea...).
|
|
105
107
|
* Routes verified: Eth→Flow ✓
|
|
106
108
|
*/
|
|
107
|
-
readonly
|
|
109
|
+
readonly USDF: {
|
|
108
110
|
readonly 747: {
|
|
109
111
|
readonly oft: `0x${string}`;
|
|
110
112
|
readonly token: `0x${string}`;
|
|
@@ -114,6 +116,23 @@ declare const OFT_ROUTES: {
|
|
|
114
116
|
readonly token: `0x${string}`;
|
|
115
117
|
};
|
|
116
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* PYUSD — PayPal USD bridged via OFTAdapter (Paxos / LayerZero).
|
|
121
|
+
* Lock/mint architecture: locks PYUSD on Arbitrum, mints PYUSD0 on Flow EVM.
|
|
122
|
+
* On Arbitrum: OFTAdapter wraps native PYUSD (0x46850a...).
|
|
123
|
+
* On Flow: OFTAdapter wraps PYUSD0 (0x99aF3E...), which is the native Paxos token.
|
|
124
|
+
* Routes verified: Arb↔Flow ✓ (EID 30336). No Eth or Base peers.
|
|
125
|
+
*/
|
|
126
|
+
readonly PYUSD: {
|
|
127
|
+
readonly 747: {
|
|
128
|
+
readonly oft: `0x${string}`;
|
|
129
|
+
readonly token: `0x${string}`;
|
|
130
|
+
};
|
|
131
|
+
readonly 42161: {
|
|
132
|
+
readonly oft: `0x${string}`;
|
|
133
|
+
readonly token: `0x${string}`;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
117
136
|
/**
|
|
118
137
|
* WFLOW — Wrapped FLOW NativeOFTAdapter (issued by Flow Foundation).
|
|
119
138
|
* Routes verified: Eth→Flow ✓
|
|
@@ -354,7 +373,7 @@ declare const OFT_ROUTES: {
|
|
|
354
373
|
/**
|
|
355
374
|
* oftCmd for Stargate v2 taxi mode (immediate per-message delivery).
|
|
356
375
|
* Pass as `oftCmd` in SendParam when using stgUSDC, USDT, or WETH OFT_ROUTES entries.
|
|
357
|
-
* Non-Stargate OFTs (
|
|
376
|
+
* Non-Stargate OFTs (USDF, WFLOW, sUSDe, USDe, weETH, rsETH) use empty bytes — pass `'0x'` instead.
|
|
358
377
|
*/
|
|
359
378
|
declare const STARGATE_TAXI_CMD: "0x01";
|
|
360
379
|
/**
|
|
@@ -1590,6 +1609,21 @@ declare function redeemAsync(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1590
1609
|
* @returns RedeemResult or AsyncRequestResult depending on vault mode
|
|
1591
1610
|
*/
|
|
1592
1611
|
declare function smartRedeem(walletClient: WalletClient, publicClient: PublicClient, addresses: VaultAddresses, shares: bigint, receiver: Address, owner: Address, extraOptions?: `0x${string}`): Promise<RedeemResult | AsyncRequestResult>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Quote the LZ fee for bridging shares from spoke to hub via SHARE_OFT.
|
|
1614
|
+
*
|
|
1615
|
+
* **IMPORTANT**: `amountLD` must be in SHARE_OFT native decimals (e.g. 18),
|
|
1616
|
+
* NOT vault decimals (e.g. 8). Use the raw `SHARE_OFT.balanceOf(user)` value,
|
|
1617
|
+
* or `getUserPositionMultiChain().rawSpokeShares[chainId]`.
|
|
1618
|
+
*
|
|
1619
|
+
* @param spokePublicClient Public client on the SPOKE chain
|
|
1620
|
+
* @param shareOFT SHARE_OFT address on the spoke chain
|
|
1621
|
+
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1622
|
+
* @param amountLD Shares in SHARE_OFT native decimals (raw balanceOf)
|
|
1623
|
+
* @param receiver Receiver address on the hub chain
|
|
1624
|
+
* @returns LZ native fee in wei
|
|
1625
|
+
*/
|
|
1626
|
+
declare function quoteShareBridgeFee(spokePublicClient: PublicClient, shareOFT: Address, hubChainEid: number, amountLD: bigint, receiver: Address): Promise<bigint>;
|
|
1593
1627
|
/**
|
|
1594
1628
|
* R6 — Bridge shares from spoke to hub chain via OFT.
|
|
1595
1629
|
*
|
|
@@ -1598,24 +1632,20 @@ declare function smartRedeem(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1598
1632
|
* 2. `smartRedeem()` — redeem shares on hub → underlying (auto-detects async)
|
|
1599
1633
|
* 3. `bridgeAssetsToSpoke()` — bridge assets from hub → spoke via asset OFT
|
|
1600
1634
|
*
|
|
1601
|
-
* The
|
|
1602
|
-
*
|
|
1635
|
+
* **IMPORTANT**: The `shares` parameter must be in SHARE_OFT decimals (the raw
|
|
1636
|
+
* `balanceOf` from the spoke OFT), NOT in vault decimals. Use the user's actual
|
|
1637
|
+
* SHARE_OFT balance, or convert with `vaultShares * 10^(oftDecimals - vaultDecimals)`.
|
|
1603
1638
|
*
|
|
1604
1639
|
* **User transactions on spoke chain**: 1 approve (shares to shareOFT) + 1 OFT.send().
|
|
1605
1640
|
* **Gas**: Requires native token on spoke for LZ fees, and gas on hub for steps 2+3.
|
|
1606
1641
|
*
|
|
1607
|
-
* ## Tested flows
|
|
1608
|
-
*
|
|
1609
|
-
* - [x] SHARE_OFT bridge (Eth→Base, vault 0x8f74...ba6):
|
|
1610
|
-
* Delivery ~7 min. Required enforcedOptions on Eth SHARE_OFT for dstEid=30184.
|
|
1611
|
-
*
|
|
1612
1642
|
* @param walletClient Wallet client on the SPOKE chain
|
|
1613
1643
|
* @param publicClient Public client on the SPOKE chain
|
|
1614
1644
|
* @param shareOFT OFTAdapter address for vault shares on the spoke chain
|
|
1615
1645
|
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1616
|
-
* @param shares Amount of
|
|
1646
|
+
* @param shares Amount of shares in SHARE_OFT decimals (use raw balanceOf)
|
|
1617
1647
|
* @param receiver Receiver address on the HUB chain
|
|
1618
|
-
* @param lzFee msg.value for OFT send (
|
|
1648
|
+
* @param lzFee msg.value for OFT send (from quoteShareBridgeFee)
|
|
1619
1649
|
* @returns Transaction hash of the OFT.send() call
|
|
1620
1650
|
*/
|
|
1621
1651
|
declare function bridgeSharesToHub(walletClient: WalletClient, publicClient: PublicClient, shareOFT: Address, hubChainEid: number, shares: bigint, receiver: Address, lzFee: bigint): Promise<{
|
|
@@ -1830,4 +1860,4 @@ declare function preflightSpokeRedeem(route: {
|
|
|
1830
1860
|
*/
|
|
1831
1861
|
declare function asSdkClient(client: unknown): PublicClient;
|
|
1832
1862
|
|
|
1833
|
-
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
|
1863
|
+
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
package/dist/viem/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hash, Address, WalletClient, PublicClient } from 'viem';
|
|
2
2
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-
|
|
3
|
+
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as discoverVaultTopology, o as ensureAllowance, p as getAllVaultChainIds, q as getAsyncRequestStatus, r as getAsyncRequestStatusLabel, s as getFullVaultTopology, t as getInboundRoutes, u as getMaxWithdrawable, v as getOutboundRoutes, w as getUserBalances, x as getUserBalancesForRoutes, y as getUserPosition, z as getUserPositionMultiChain, B as getVaultDistribution, C as getVaultDistributionWithTopology, E as getVaultMetadata, F as getVaultStatus, G as getVaultSummary, H as getVaultTopology, J as isAsyncMode, K as isOnHubChain, L as previewDeposit, P as previewRedeem, Q as quoteLzFee, R as quoteRouteDepositFee, T as waitForAsyncRequest, W as waitForTx } from '../spokeRoutes-FgKCJQYa.js';
|
|
4
4
|
|
|
5
5
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
6
|
declare const CHAIN_IDS: {
|
|
@@ -101,10 +101,12 @@ declare const OFT_ROUTES: {
|
|
|
101
101
|
};
|
|
102
102
|
};
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* USDF — USD Flow OFT. Bridges PYUSD (Ethereum) ↔ USDF (Flow EVM).
|
|
105
|
+
* On Ethereum: underlying is PayPal USD (PYUSD, 0x6c3ea9...).
|
|
106
|
+
* On Flow: the OFT itself IS the token (USDF, 0x2aabea...).
|
|
105
107
|
* Routes verified: Eth→Flow ✓
|
|
106
108
|
*/
|
|
107
|
-
readonly
|
|
109
|
+
readonly USDF: {
|
|
108
110
|
readonly 747: {
|
|
109
111
|
readonly oft: `0x${string}`;
|
|
110
112
|
readonly token: `0x${string}`;
|
|
@@ -114,6 +116,23 @@ declare const OFT_ROUTES: {
|
|
|
114
116
|
readonly token: `0x${string}`;
|
|
115
117
|
};
|
|
116
118
|
};
|
|
119
|
+
/**
|
|
120
|
+
* PYUSD — PayPal USD bridged via OFTAdapter (Paxos / LayerZero).
|
|
121
|
+
* Lock/mint architecture: locks PYUSD on Arbitrum, mints PYUSD0 on Flow EVM.
|
|
122
|
+
* On Arbitrum: OFTAdapter wraps native PYUSD (0x46850a...).
|
|
123
|
+
* On Flow: OFTAdapter wraps PYUSD0 (0x99aF3E...), which is the native Paxos token.
|
|
124
|
+
* Routes verified: Arb↔Flow ✓ (EID 30336). No Eth or Base peers.
|
|
125
|
+
*/
|
|
126
|
+
readonly PYUSD: {
|
|
127
|
+
readonly 747: {
|
|
128
|
+
readonly oft: `0x${string}`;
|
|
129
|
+
readonly token: `0x${string}`;
|
|
130
|
+
};
|
|
131
|
+
readonly 42161: {
|
|
132
|
+
readonly oft: `0x${string}`;
|
|
133
|
+
readonly token: `0x${string}`;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
117
136
|
/**
|
|
118
137
|
* WFLOW — Wrapped FLOW NativeOFTAdapter (issued by Flow Foundation).
|
|
119
138
|
* Routes verified: Eth→Flow ✓
|
|
@@ -354,7 +373,7 @@ declare const OFT_ROUTES: {
|
|
|
354
373
|
/**
|
|
355
374
|
* oftCmd for Stargate v2 taxi mode (immediate per-message delivery).
|
|
356
375
|
* Pass as `oftCmd` in SendParam when using stgUSDC, USDT, or WETH OFT_ROUTES entries.
|
|
357
|
-
* Non-Stargate OFTs (
|
|
376
|
+
* Non-Stargate OFTs (USDF, WFLOW, sUSDe, USDe, weETH, rsETH) use empty bytes — pass `'0x'` instead.
|
|
358
377
|
*/
|
|
359
378
|
declare const STARGATE_TAXI_CMD: "0x01";
|
|
360
379
|
/**
|
|
@@ -1590,6 +1609,21 @@ declare function redeemAsync(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1590
1609
|
* @returns RedeemResult or AsyncRequestResult depending on vault mode
|
|
1591
1610
|
*/
|
|
1592
1611
|
declare function smartRedeem(walletClient: WalletClient, publicClient: PublicClient, addresses: VaultAddresses, shares: bigint, receiver: Address, owner: Address, extraOptions?: `0x${string}`): Promise<RedeemResult | AsyncRequestResult>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Quote the LZ fee for bridging shares from spoke to hub via SHARE_OFT.
|
|
1614
|
+
*
|
|
1615
|
+
* **IMPORTANT**: `amountLD` must be in SHARE_OFT native decimals (e.g. 18),
|
|
1616
|
+
* NOT vault decimals (e.g. 8). Use the raw `SHARE_OFT.balanceOf(user)` value,
|
|
1617
|
+
* or `getUserPositionMultiChain().rawSpokeShares[chainId]`.
|
|
1618
|
+
*
|
|
1619
|
+
* @param spokePublicClient Public client on the SPOKE chain
|
|
1620
|
+
* @param shareOFT SHARE_OFT address on the spoke chain
|
|
1621
|
+
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1622
|
+
* @param amountLD Shares in SHARE_OFT native decimals (raw balanceOf)
|
|
1623
|
+
* @param receiver Receiver address on the hub chain
|
|
1624
|
+
* @returns LZ native fee in wei
|
|
1625
|
+
*/
|
|
1626
|
+
declare function quoteShareBridgeFee(spokePublicClient: PublicClient, shareOFT: Address, hubChainEid: number, amountLD: bigint, receiver: Address): Promise<bigint>;
|
|
1593
1627
|
/**
|
|
1594
1628
|
* R6 — Bridge shares from spoke to hub chain via OFT.
|
|
1595
1629
|
*
|
|
@@ -1598,24 +1632,20 @@ declare function smartRedeem(walletClient: WalletClient, publicClient: PublicCli
|
|
|
1598
1632
|
* 2. `smartRedeem()` — redeem shares on hub → underlying (auto-detects async)
|
|
1599
1633
|
* 3. `bridgeAssetsToSpoke()` — bridge assets from hub → spoke via asset OFT
|
|
1600
1634
|
*
|
|
1601
|
-
* The
|
|
1602
|
-
*
|
|
1635
|
+
* **IMPORTANT**: The `shares` parameter must be in SHARE_OFT decimals (the raw
|
|
1636
|
+
* `balanceOf` from the spoke OFT), NOT in vault decimals. Use the user's actual
|
|
1637
|
+
* SHARE_OFT balance, or convert with `vaultShares * 10^(oftDecimals - vaultDecimals)`.
|
|
1603
1638
|
*
|
|
1604
1639
|
* **User transactions on spoke chain**: 1 approve (shares to shareOFT) + 1 OFT.send().
|
|
1605
1640
|
* **Gas**: Requires native token on spoke for LZ fees, and gas on hub for steps 2+3.
|
|
1606
1641
|
*
|
|
1607
|
-
* ## Tested flows
|
|
1608
|
-
*
|
|
1609
|
-
* - [x] SHARE_OFT bridge (Eth→Base, vault 0x8f74...ba6):
|
|
1610
|
-
* Delivery ~7 min. Required enforcedOptions on Eth SHARE_OFT for dstEid=30184.
|
|
1611
|
-
*
|
|
1612
1642
|
* @param walletClient Wallet client on the SPOKE chain
|
|
1613
1643
|
* @param publicClient Public client on the SPOKE chain
|
|
1614
1644
|
* @param shareOFT OFTAdapter address for vault shares on the spoke chain
|
|
1615
1645
|
* @param hubChainEid LayerZero Endpoint ID for the hub chain
|
|
1616
|
-
* @param shares Amount of
|
|
1646
|
+
* @param shares Amount of shares in SHARE_OFT decimals (use raw balanceOf)
|
|
1617
1647
|
* @param receiver Receiver address on the HUB chain
|
|
1618
|
-
* @param lzFee msg.value for OFT send (
|
|
1648
|
+
* @param lzFee msg.value for OFT send (from quoteShareBridgeFee)
|
|
1619
1649
|
* @returns Transaction hash of the OFT.send() call
|
|
1620
1650
|
*/
|
|
1621
1651
|
declare function bridgeSharesToHub(walletClient: WalletClient, publicClient: PublicClient, shareOFT: Address, hubChainEid: number, shares: bigint, receiver: Address, lzFee: bigint): Promise<{
|
|
@@ -1830,4 +1860,4 @@ declare function preflightSpokeRedeem(route: {
|
|
|
1830
1860
|
*/
|
|
1831
1861
|
declare function asSdkClient(client: unknown): PublicClient;
|
|
1832
1862
|
|
|
1833
|
-
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
|
1863
|
+
export { ActionType, type ActionTypeValue, type AsyncRequestResult, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, type ComposeData, type CrossChainRequestInfo, type DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, type RedeemResult, STARGATE_TAXI_CMD, type SpokeDepositResult, type SpokeRedeemRoute, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, type VaultAddresses, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, executeCompose, getWithdrawalRequest, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForCompose, withdrawAssets };
|
package/dist/viem/index.js
CHANGED
|
@@ -96,10 +96,12 @@ var OFT_ROUTES = {
|
|
|
96
96
|
]: { oft: "0x19cFCE47eD54a88614648DC3f19A5980097007dD", token: "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58" }
|
|
97
97
|
},
|
|
98
98
|
/**
|
|
99
|
-
*
|
|
99
|
+
* USDF — USD Flow OFT. Bridges PYUSD (Ethereum) ↔ USDF (Flow EVM).
|
|
100
|
+
* On Ethereum: underlying is PayPal USD (PYUSD, 0x6c3ea9...).
|
|
101
|
+
* On Flow: the OFT itself IS the token (USDF, 0x2aabea...).
|
|
100
102
|
* Routes verified: Eth→Flow ✓
|
|
101
103
|
*/
|
|
102
|
-
|
|
104
|
+
USDF: {
|
|
103
105
|
[
|
|
104
106
|
747
|
|
105
107
|
/* flowEVMMainnet */
|
|
@@ -109,6 +111,23 @@ var OFT_ROUTES = {
|
|
|
109
111
|
/* ethereum */
|
|
110
112
|
]: { oft: "0xfa0e06b54986ad96de87a8c56fea76fbd8d493f8", token: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8" }
|
|
111
113
|
},
|
|
114
|
+
/**
|
|
115
|
+
* PYUSD — PayPal USD bridged via OFTAdapter (Paxos / LayerZero).
|
|
116
|
+
* Lock/mint architecture: locks PYUSD on Arbitrum, mints PYUSD0 on Flow EVM.
|
|
117
|
+
* On Arbitrum: OFTAdapter wraps native PYUSD (0x46850a...).
|
|
118
|
+
* On Flow: OFTAdapter wraps PYUSD0 (0x99aF3E...), which is the native Paxos token.
|
|
119
|
+
* Routes verified: Arb↔Flow ✓ (EID 30336). No Eth or Base peers.
|
|
120
|
+
*/
|
|
121
|
+
PYUSD: {
|
|
122
|
+
[
|
|
123
|
+
747
|
|
124
|
+
/* flowEVMMainnet */
|
|
125
|
+
]: { oft: "0x26d27d5AF2F6f1c14F40013C8619d97aaf015509", token: "0x99aF3EeA856556646C98c8B9b2548Fe815240750" },
|
|
126
|
+
[
|
|
127
|
+
42161
|
|
128
|
+
/* arbitrum */
|
|
129
|
+
]: { oft: "0x3CD2b89C49D130C08f1d683225b2e5DeB63ff876", token: "0x46850aD61C2B7d64d08c9C754F45254596696984" }
|
|
130
|
+
},
|
|
112
131
|
/**
|
|
113
132
|
* WFLOW — Wrapped FLOW NativeOFTAdapter (issued by Flow Foundation).
|
|
114
133
|
* Routes verified: Eth→Flow ✓
|
|
@@ -2585,6 +2604,26 @@ async function smartRedeem(walletClient, publicClient, addresses, shares, receiv
|
|
|
2585
2604
|
}
|
|
2586
2605
|
return redeemShares(walletClient, publicClient, addresses, shares, receiver, owner);
|
|
2587
2606
|
}
|
|
2607
|
+
async function quoteShareBridgeFee(spokePublicClient, shareOFT, hubChainEid, amountLD, receiver) {
|
|
2608
|
+
const oft = getAddress(shareOFT);
|
|
2609
|
+
const toBytes32 = pad(getAddress(receiver), { size: 32 });
|
|
2610
|
+
const sendParam = {
|
|
2611
|
+
dstEid: hubChainEid,
|
|
2612
|
+
to: toBytes32,
|
|
2613
|
+
amountLD,
|
|
2614
|
+
minAmountLD: amountLD,
|
|
2615
|
+
extraOptions: "0x",
|
|
2616
|
+
composeMsg: "0x",
|
|
2617
|
+
oftCmd: "0x"
|
|
2618
|
+
};
|
|
2619
|
+
const feeResult = await spokePublicClient.readContract({
|
|
2620
|
+
address: oft,
|
|
2621
|
+
abi: OFT_ABI,
|
|
2622
|
+
functionName: "quoteSend",
|
|
2623
|
+
args: [sendParam, false]
|
|
2624
|
+
});
|
|
2625
|
+
return feeResult.nativeFee;
|
|
2626
|
+
}
|
|
2588
2627
|
async function bridgeSharesToHub(walletClient, publicClient, shareOFT, hubChainEid, shares, receiver, lzFee) {
|
|
2589
2628
|
const account = walletClient.account;
|
|
2590
2629
|
const oft = getAddress(shareOFT);
|
|
@@ -3018,6 +3057,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3018
3057
|
});
|
|
3019
3058
|
const [withdrawShares, timelockEndsAt] = withdrawalRequest;
|
|
3020
3059
|
const spokeShares = {};
|
|
3060
|
+
const rawSpokeShares = {};
|
|
3021
3061
|
if (topo.spokeChainIds.length > 0) {
|
|
3022
3062
|
let hubShareOft = null;
|
|
3023
3063
|
try {
|
|
@@ -3040,7 +3080,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3040
3080
|
const spokePromises = topo.spokeChainIds.map(async (spokeChainId) => {
|
|
3041
3081
|
try {
|
|
3042
3082
|
const spokeEid = CHAIN_ID_TO_EID[spokeChainId];
|
|
3043
|
-
if (!spokeEid) return { chainId: spokeChainId, balance: 0n };
|
|
3083
|
+
if (!spokeEid) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3044
3084
|
const spokeOftBytes32 = await hubClient.readContract({
|
|
3045
3085
|
address: hubShareOft,
|
|
3046
3086
|
abi: OFT_ABI,
|
|
@@ -3049,10 +3089,10 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3049
3089
|
});
|
|
3050
3090
|
const spokeOft = getAddress(`0x${spokeOftBytes32.slice(-40)}`);
|
|
3051
3091
|
if (spokeOft === "0x0000000000000000000000000000000000000000") {
|
|
3052
|
-
return { chainId: spokeChainId, balance: 0n };
|
|
3092
|
+
return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3053
3093
|
}
|
|
3054
3094
|
const spokeClient = createChainClient(spokeChainId);
|
|
3055
|
-
if (!spokeClient) return { chainId: spokeChainId, balance: 0n };
|
|
3095
|
+
if (!spokeClient) return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3056
3096
|
const [rawBalance, spokeOftDecimals] = await spokeClient.multicall({
|
|
3057
3097
|
contracts: [
|
|
3058
3098
|
{ address: spokeOft, abi: ERC20_ABI, functionName: "balanceOf", args: [u] },
|
|
@@ -3068,14 +3108,15 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3068
3108
|
} else {
|
|
3069
3109
|
balance = rawBalance;
|
|
3070
3110
|
}
|
|
3071
|
-
return { chainId: spokeChainId, balance };
|
|
3111
|
+
return { chainId: spokeChainId, balance, rawBalance };
|
|
3072
3112
|
} catch {
|
|
3073
|
-
return { chainId: spokeChainId, balance: 0n };
|
|
3113
|
+
return { chainId: spokeChainId, balance: 0n, rawBalance: 0n };
|
|
3074
3114
|
}
|
|
3075
3115
|
});
|
|
3076
3116
|
const results = await Promise.all(spokePromises);
|
|
3077
|
-
for (const { chainId, balance } of results) {
|
|
3117
|
+
for (const { chainId, balance, rawBalance } of results) {
|
|
3078
3118
|
spokeShares[chainId] = balance;
|
|
3119
|
+
rawSpokeShares[chainId] = rawBalance;
|
|
3079
3120
|
}
|
|
3080
3121
|
}
|
|
3081
3122
|
}
|
|
@@ -3095,6 +3136,7 @@ async function getUserPositionMultiChain(vault, user) {
|
|
|
3095
3136
|
return {
|
|
3096
3137
|
hubShares,
|
|
3097
3138
|
spokeShares,
|
|
3139
|
+
rawSpokeShares,
|
|
3098
3140
|
totalShares,
|
|
3099
3141
|
estimatedAssets,
|
|
3100
3142
|
sharePrice,
|
|
@@ -3166,6 +3208,6 @@ function asSdkClient(client) {
|
|
|
3166
3208
|
return client;
|
|
3167
3209
|
}
|
|
3168
3210
|
|
|
3169
|
-
export { ActionType, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, STARGATE_TAXI_CMD, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, canDeposit, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, ensureAllowance, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3211
|
+
export { ActionType, BRIDGE_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CapacityFullError, EID_TO_CHAIN_ID, ERC20_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, STARGATE_TAXI_CMD, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, canDeposit, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, discoverVaultTopology, ensureAllowance, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3170
3212
|
//# sourceMappingURL=index.js.map
|
|
3171
3213
|
//# sourceMappingURL=index.js.map
|