@oydual31/more-vaults-sdk 0.4.2 → 0.5.0
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/README.md +44 -0
- package/dist/{spokeRoutes-B8Lnk-t4.d.cts → curatorBridge-DTW1lPF7.d.cts} +130 -1
- package/dist/{spokeRoutes-B8Lnk-t4.d.ts → curatorBridge-DTW1lPF7.d.ts} +130 -1
- package/dist/ethers/index.cjs +73 -0
- package/dist/ethers/index.cjs.map +1 -1
- package/dist/ethers/index.d.cts +103 -1
- package/dist/ethers/index.d.ts +103 -1
- package/dist/ethers/index.js +71 -2
- package/dist/ethers/index.js.map +1 -1
- package/dist/react/index.cjs +163 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +214 -2
- package/dist/react/index.d.ts +214 -2
- package/dist/react/index.js +162 -1
- package/dist/react/index.js.map +1 -1
- package/dist/viem/index.cjs +91 -0
- package/dist/viem/index.cjs.map +1 -1
- package/dist/viem/index.d.cts +2 -2
- package/dist/viem/index.d.ts +2 -2
- package/dist/viem/index.js +88 -1
- package/dist/viem/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ethers/curatorBridge.ts +235 -0
- package/src/ethers/index.ts +9 -0
- package/src/react/index.ts +4 -0
- package/src/react/useCuratorBridgeQuote.ts +43 -0
- package/src/react/useExecuteBridge.ts +50 -0
- package/src/viem/curatorBridge.ts +288 -0
- package/src/viem/index.ts +7 -0
package/dist/viem/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VaultAddresses, A as AsyncRequestResult, D as DepositResult, S as SpokeDepositResult, C as ComposeData, R as RedeemResult, a as CuratorVaultStatus, P as PendingAction, b as VaultAnalysis, c as VaultAssetBreakdown, d as CuratorAction, e as SubmitActionsResult } from '../
|
|
2
|
-
export { f as ActionType, g as ActionTypeValue, h as AssetBalance, i as AssetInfo, j as AsyncRequestFinalResult, k as AsyncRequestStatus, l as AsyncRequestStatusInfo, B as BatchSwapParams, m as BridgeParams, n as CrossChainRequestInfo, o as
|
|
1
|
+
import { V as VaultAddresses, A as AsyncRequestResult, D as DepositResult, S as SpokeDepositResult, C as ComposeData, R as RedeemResult, a as CuratorVaultStatus, P as PendingAction, b as VaultAnalysis, c as VaultAssetBreakdown, d as CuratorAction, e as SubmitActionsResult } from '../curatorBridge-DTW1lPF7.cjs';
|
|
2
|
+
export { f as ActionType, g as ActionTypeValue, h as AssetBalance, i as AssetInfo, j as AsyncRequestFinalResult, k as AsyncRequestStatus, l as AsyncRequestStatusInfo, B as BatchSwapParams, m as BridgeParams, n as CrossChainRequestInfo, o as CuratorBridgeParams, p as DepositBlockReason, q as DepositEligibility, I as InboundRoute, r as InboundRouteWithBalance, M as MaxWithdrawable, s as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, t as OutboundRoute, u as SpokeBalance, v as SwapParams, U as UserBalances, w as UserPosition, x as VaultDistribution, y as VaultMetadata, z as VaultMode, E as VaultStatus, F as VaultSummary, G as VaultTopology, H as canDeposit, J as detectStargateOft, K as discoverVaultTopology, L as encodeBridgeParams, Q as ensureAllowance, T as executeCuratorBridge, W as findBridgeRoute, X as getAllVaultChainIds, Y as getAsyncRequestStatus, Z as getAsyncRequestStatusLabel, _ as getFullVaultTopology, $ as getInboundRoutes, a0 as getMaxWithdrawable, a1 as getOutboundRoutes, a2 as getUserBalances, a3 as getUserBalancesForRoutes, a4 as getUserPosition, a5 as getUserPositionMultiChain, a6 as getVaultDistribution, a7 as getVaultDistributionWithTopology, a8 as getVaultMetadata, a9 as getVaultStatus, aa as getVaultSummary, ab as getVaultTopology, ac as isAsyncMode, ad as isOnHubChain, ae as previewDeposit, af as previewRedeem, ag as quoteCuratorBridgeFee, ah as quoteLzFee, ai as quoteRouteDepositFee, aj as waitForAsyncRequest, ak as waitForTx } from '../curatorBridge-DTW1lPF7.cjs';
|
|
3
3
|
import { WalletClient, PublicClient, Address, Hash } from 'viem';
|
|
4
4
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
5
5
|
|
package/dist/viem/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VaultAddresses, A as AsyncRequestResult, D as DepositResult, S as SpokeDepositResult, C as ComposeData, R as RedeemResult, a as CuratorVaultStatus, P as PendingAction, b as VaultAnalysis, c as VaultAssetBreakdown, d as CuratorAction, e as SubmitActionsResult } from '../
|
|
2
|
-
export { f as ActionType, g as ActionTypeValue, h as AssetBalance, i as AssetInfo, j as AsyncRequestFinalResult, k as AsyncRequestStatus, l as AsyncRequestStatusInfo, B as BatchSwapParams, m as BridgeParams, n as CrossChainRequestInfo, o as
|
|
1
|
+
import { V as VaultAddresses, A as AsyncRequestResult, D as DepositResult, S as SpokeDepositResult, C as ComposeData, R as RedeemResult, a as CuratorVaultStatus, P as PendingAction, b as VaultAnalysis, c as VaultAssetBreakdown, d as CuratorAction, e as SubmitActionsResult } from '../curatorBridge-DTW1lPF7.js';
|
|
2
|
+
export { f as ActionType, g as ActionTypeValue, h as AssetBalance, i as AssetInfo, j as AsyncRequestFinalResult, k as AsyncRequestStatus, l as AsyncRequestStatusInfo, B as BatchSwapParams, m as BridgeParams, n as CrossChainRequestInfo, o as CuratorBridgeParams, p as DepositBlockReason, q as DepositEligibility, I as InboundRoute, r as InboundRouteWithBalance, M as MaxWithdrawable, s as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, t as OutboundRoute, u as SpokeBalance, v as SwapParams, U as UserBalances, w as UserPosition, x as VaultDistribution, y as VaultMetadata, z as VaultMode, E as VaultStatus, F as VaultSummary, G as VaultTopology, H as canDeposit, J as detectStargateOft, K as discoverVaultTopology, L as encodeBridgeParams, Q as ensureAllowance, T as executeCuratorBridge, W as findBridgeRoute, X as getAllVaultChainIds, Y as getAsyncRequestStatus, Z as getAsyncRequestStatusLabel, _ as getFullVaultTopology, $ as getInboundRoutes, a0 as getMaxWithdrawable, a1 as getOutboundRoutes, a2 as getUserBalances, a3 as getUserBalancesForRoutes, a4 as getUserPosition, a5 as getUserPositionMultiChain, a6 as getVaultDistribution, a7 as getVaultDistributionWithTopology, a8 as getVaultMetadata, a9 as getVaultStatus, aa as getVaultSummary, ab as getVaultTopology, ac as isAsyncMode, ad as isOnHubChain, ae as previewDeposit, af as previewRedeem, ag as quoteCuratorBridgeFee, ah as quoteLzFee, ai as quoteRouteDepositFee, aj as waitForAsyncRequest, ak as waitForTx } from '../curatorBridge-DTW1lPF7.js';
|
|
3
3
|
import { WalletClient, PublicClient, Address, Hash } from 'viem';
|
|
4
4
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
5
5
|
|
package/dist/viem/index.js
CHANGED
|
@@ -3945,6 +3945,93 @@ function buildUniswapV3Swap(params) {
|
|
|
3945
3945
|
}
|
|
3946
3946
|
};
|
|
3947
3947
|
}
|
|
3948
|
+
function encodeBridgeParams(params) {
|
|
3949
|
+
return encodeAbiParameters(
|
|
3950
|
+
[
|
|
3951
|
+
{ type: "address" },
|
|
3952
|
+
{ type: "uint32" },
|
|
3953
|
+
{ type: "uint256" },
|
|
3954
|
+
{ type: "address" },
|
|
3955
|
+
{ type: "address" }
|
|
3956
|
+
],
|
|
3957
|
+
[
|
|
3958
|
+
getAddress(params.oftToken),
|
|
3959
|
+
params.dstEid,
|
|
3960
|
+
params.amount,
|
|
3961
|
+
getAddress(params.dstVault),
|
|
3962
|
+
getAddress(params.refundAddress)
|
|
3963
|
+
]
|
|
3964
|
+
);
|
|
3965
|
+
}
|
|
3966
|
+
function encodeBridgeParamsForQuote(params) {
|
|
3967
|
+
return encodeAbiParameters(
|
|
3968
|
+
[
|
|
3969
|
+
{ type: "address" },
|
|
3970
|
+
{ type: "uint32" },
|
|
3971
|
+
{ type: "uint256" },
|
|
3972
|
+
{ type: "address" }
|
|
3973
|
+
],
|
|
3974
|
+
[
|
|
3975
|
+
getAddress(params.oftToken),
|
|
3976
|
+
params.dstEid,
|
|
3977
|
+
params.amount,
|
|
3978
|
+
getAddress(params.dstVault)
|
|
3979
|
+
]
|
|
3980
|
+
);
|
|
3981
|
+
}
|
|
3982
|
+
function findBridgeRoute(srcChainId, dstChainId, tokenAddress) {
|
|
3983
|
+
const normalizedToken = getAddress(tokenAddress);
|
|
3984
|
+
for (const [symbol, chains] of Object.entries(OFT_ROUTES)) {
|
|
3985
|
+
const srcEntry = chains[srcChainId];
|
|
3986
|
+
const dstEntry = chains[dstChainId];
|
|
3987
|
+
if (!srcEntry || !dstEntry) continue;
|
|
3988
|
+
const srcToken = getAddress(srcEntry.token);
|
|
3989
|
+
const srcOft = getAddress(srcEntry.oft);
|
|
3990
|
+
if (srcToken === normalizedToken || srcOft === normalizedToken) {
|
|
3991
|
+
return {
|
|
3992
|
+
oftSrc: srcOft,
|
|
3993
|
+
oftDst: getAddress(dstEntry.oft),
|
|
3994
|
+
symbol
|
|
3995
|
+
};
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
return null;
|
|
3999
|
+
}
|
|
4000
|
+
async function quoteCuratorBridgeFee(publicClient, vault, params) {
|
|
4001
|
+
const status = await getCuratorVaultStatus(publicClient, vault);
|
|
4002
|
+
const lzAdapter = status.lzAdapter;
|
|
4003
|
+
const bridgeSpecificParams = encodeBridgeParamsForQuote(params);
|
|
4004
|
+
const nativeFee = await publicClient.readContract({
|
|
4005
|
+
address: lzAdapter,
|
|
4006
|
+
abi: LZ_ADAPTER_ABI,
|
|
4007
|
+
functionName: "quoteBridgeFee",
|
|
4008
|
+
args: [bridgeSpecificParams]
|
|
4009
|
+
});
|
|
4010
|
+
return nativeFee;
|
|
4011
|
+
}
|
|
4012
|
+
async function executeCuratorBridge(walletClient, publicClient, vault, token, params) {
|
|
4013
|
+
const account = walletClient.account;
|
|
4014
|
+
const v = getAddress(vault);
|
|
4015
|
+
const status = await getCuratorVaultStatus(publicClient, vault);
|
|
4016
|
+
const lzAdapter = status.lzAdapter;
|
|
4017
|
+
const fee = await quoteCuratorBridgeFee(publicClient, vault, params);
|
|
4018
|
+
const bridgeSpecificParams = encodeBridgeParams(params);
|
|
4019
|
+
const txHash = await walletClient.writeContract({
|
|
4020
|
+
address: v,
|
|
4021
|
+
abi: BRIDGE_FACET_ABI,
|
|
4022
|
+
functionName: "executeBridging",
|
|
4023
|
+
args: [
|
|
4024
|
+
lzAdapter,
|
|
4025
|
+
getAddress(token),
|
|
4026
|
+
params.amount,
|
|
4027
|
+
bridgeSpecificParams
|
|
4028
|
+
],
|
|
4029
|
+
value: fee,
|
|
4030
|
+
account,
|
|
4031
|
+
chain: walletClient.chain
|
|
4032
|
+
});
|
|
4033
|
+
return txHash;
|
|
4034
|
+
}
|
|
3948
4035
|
|
|
3949
4036
|
// src/viem/wagmiCompat.ts
|
|
3950
4037
|
function asSdkClient(client) {
|
|
@@ -3952,6 +4039,6 @@ function asSdkClient(client) {
|
|
|
3952
4039
|
return client;
|
|
3953
4040
|
}
|
|
3954
4041
|
|
|
3955
|
-
export { ActionType, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, DEX_ABI, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, REGISTRY_ABI, STARGATE_TAXI_CMD, UNISWAP_V3_ROUTERS, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VAULT_ANALYSIS_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, detectStargateOft, discoverVaultTopology, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultAnalysis, getVaultAssetBreakdown, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
4042
|
+
export { ActionType, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, DEX_ABI, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NATIVE_SYMBOL, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, OMNI_FACTORY_ADDRESS, REGISTRY_ABI, STARGATE_TAXI_CMD, UNISWAP_V3_ROUTERS, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VAULT_ANALYSIS_ABI, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, canDeposit, checkProtocolWhitelist, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, detectStargateOft, discoverVaultTopology, encodeBridgeParams, encodeCuratorAction, encodeUniswapV3SwapCalldata, ensureAllowance, executeActions, executeCompose, executeCuratorBridge, findBridgeRoute, getAllVaultChainIds, getAsyncRequestStatus, getAsyncRequestStatusLabel, getCuratorVaultStatus, getFullVaultTopology, getInboundRoutes, getMaxWithdrawable, getOutboundRoutes, getPendingActions, getUserBalances, getUserBalancesForRoutes, getUserPosition, getUserPositionMultiChain, getVaultAnalysis, getVaultAssetBreakdown, getVaultDistribution, getVaultDistributionWithTopology, getVaultMetadata, getVaultStatus, getVaultSummary, getVaultTopology, getWithdrawalRequest, isAsyncMode, isCurator, isOnHubChain, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, previewDeposit, previewRedeem, quoteComposeFee, quoteCuratorBridgeFee, quoteDepositFromSpokeFee, quoteLzFee, quoteRouteDepositFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForAsyncRequest, waitForCompose, waitForTx, withdrawAssets };
|
|
3956
4043
|
//# sourceMappingURL=index.js.map
|
|
3957
4044
|
//# sourceMappingURL=index.js.map
|