@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/react/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { E as VaultStatus, y as VaultMetadata, w as UserPosition, s as MultiChainUserPosition, l as AsyncRequestStatusInfo, G as VaultTopology, x as VaultDistribution, r as InboundRouteWithBalance, a as CuratorVaultStatus, b as VaultAnalysis, c as VaultAssetBreakdown, P as PendingAction, e as SubmitActionsResult, d as CuratorAction, o as CuratorBridgeParams } from '../curatorBridge-DTW1lPF7.cjs';
|
|
3
3
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
|
|
@@ -645,4 +645,216 @@ declare function useVetoActions(vault: `0x${string}`, chainId: number): _tanstac
|
|
|
645
645
|
nonces: bigint[];
|
|
646
646
|
}, unknown>;
|
|
647
647
|
|
|
648
|
-
|
|
648
|
+
/**
|
|
649
|
+
* Quote the native fee required to bridge assets from the hub vault via LzAdapter.
|
|
650
|
+
*
|
|
651
|
+
* Refreshes every 60s — bridge fees fluctuate with LayerZero network demand.
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* ```tsx
|
|
655
|
+
* const { fee, isLoading } = useCuratorBridgeQuote('0xVAULT', 8453, {
|
|
656
|
+
* oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
657
|
+
* dstEid: 30101,
|
|
658
|
+
* amount: 1_000_000n,
|
|
659
|
+
* dstVault: '0xSpokeVault...',
|
|
660
|
+
* refundAddress: '0xCurator...',
|
|
661
|
+
* })
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
declare function useCuratorBridgeQuote(vault: `0x${string}` | undefined, chainId: number, params: CuratorBridgeParams | undefined): {
|
|
665
|
+
fee: bigint | undefined;
|
|
666
|
+
data: bigint;
|
|
667
|
+
error: Error;
|
|
668
|
+
isError: true;
|
|
669
|
+
isPending: false;
|
|
670
|
+
isLoading: false;
|
|
671
|
+
isLoadingError: false;
|
|
672
|
+
isRefetchError: true;
|
|
673
|
+
isSuccess: false;
|
|
674
|
+
isPlaceholderData: false;
|
|
675
|
+
status: "error";
|
|
676
|
+
dataUpdatedAt: number;
|
|
677
|
+
errorUpdatedAt: number;
|
|
678
|
+
failureCount: number;
|
|
679
|
+
failureReason: Error | null;
|
|
680
|
+
errorUpdateCount: number;
|
|
681
|
+
isFetched: boolean;
|
|
682
|
+
isFetchedAfterMount: boolean;
|
|
683
|
+
isFetching: boolean;
|
|
684
|
+
isInitialLoading: boolean;
|
|
685
|
+
isPaused: boolean;
|
|
686
|
+
isRefetching: boolean;
|
|
687
|
+
isStale: boolean;
|
|
688
|
+
isEnabled: boolean;
|
|
689
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
690
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
691
|
+
promise: Promise<bigint>;
|
|
692
|
+
} | {
|
|
693
|
+
fee: bigint | undefined;
|
|
694
|
+
data: bigint;
|
|
695
|
+
error: null;
|
|
696
|
+
isError: false;
|
|
697
|
+
isPending: false;
|
|
698
|
+
isLoading: false;
|
|
699
|
+
isLoadingError: false;
|
|
700
|
+
isRefetchError: false;
|
|
701
|
+
isSuccess: true;
|
|
702
|
+
isPlaceholderData: false;
|
|
703
|
+
status: "success";
|
|
704
|
+
dataUpdatedAt: number;
|
|
705
|
+
errorUpdatedAt: number;
|
|
706
|
+
failureCount: number;
|
|
707
|
+
failureReason: Error | null;
|
|
708
|
+
errorUpdateCount: number;
|
|
709
|
+
isFetched: boolean;
|
|
710
|
+
isFetchedAfterMount: boolean;
|
|
711
|
+
isFetching: boolean;
|
|
712
|
+
isInitialLoading: boolean;
|
|
713
|
+
isPaused: boolean;
|
|
714
|
+
isRefetching: boolean;
|
|
715
|
+
isStale: boolean;
|
|
716
|
+
isEnabled: boolean;
|
|
717
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
718
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
719
|
+
promise: Promise<bigint>;
|
|
720
|
+
} | {
|
|
721
|
+
fee: bigint | undefined;
|
|
722
|
+
data: undefined;
|
|
723
|
+
error: Error;
|
|
724
|
+
isError: true;
|
|
725
|
+
isPending: false;
|
|
726
|
+
isLoading: false;
|
|
727
|
+
isLoadingError: true;
|
|
728
|
+
isRefetchError: false;
|
|
729
|
+
isSuccess: false;
|
|
730
|
+
isPlaceholderData: false;
|
|
731
|
+
status: "error";
|
|
732
|
+
dataUpdatedAt: number;
|
|
733
|
+
errorUpdatedAt: number;
|
|
734
|
+
failureCount: number;
|
|
735
|
+
failureReason: Error | null;
|
|
736
|
+
errorUpdateCount: number;
|
|
737
|
+
isFetched: boolean;
|
|
738
|
+
isFetchedAfterMount: boolean;
|
|
739
|
+
isFetching: boolean;
|
|
740
|
+
isInitialLoading: boolean;
|
|
741
|
+
isPaused: boolean;
|
|
742
|
+
isRefetching: boolean;
|
|
743
|
+
isStale: boolean;
|
|
744
|
+
isEnabled: boolean;
|
|
745
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
746
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
747
|
+
promise: Promise<bigint>;
|
|
748
|
+
} | {
|
|
749
|
+
fee: bigint | undefined;
|
|
750
|
+
data: undefined;
|
|
751
|
+
error: null;
|
|
752
|
+
isError: false;
|
|
753
|
+
isPending: true;
|
|
754
|
+
isLoading: true;
|
|
755
|
+
isLoadingError: false;
|
|
756
|
+
isRefetchError: false;
|
|
757
|
+
isSuccess: false;
|
|
758
|
+
isPlaceholderData: false;
|
|
759
|
+
status: "pending";
|
|
760
|
+
dataUpdatedAt: number;
|
|
761
|
+
errorUpdatedAt: number;
|
|
762
|
+
failureCount: number;
|
|
763
|
+
failureReason: Error | null;
|
|
764
|
+
errorUpdateCount: number;
|
|
765
|
+
isFetched: boolean;
|
|
766
|
+
isFetchedAfterMount: boolean;
|
|
767
|
+
isFetching: boolean;
|
|
768
|
+
isInitialLoading: boolean;
|
|
769
|
+
isPaused: boolean;
|
|
770
|
+
isRefetching: boolean;
|
|
771
|
+
isStale: boolean;
|
|
772
|
+
isEnabled: boolean;
|
|
773
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
774
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
775
|
+
promise: Promise<bigint>;
|
|
776
|
+
} | {
|
|
777
|
+
fee: bigint | undefined;
|
|
778
|
+
data: undefined;
|
|
779
|
+
error: null;
|
|
780
|
+
isError: false;
|
|
781
|
+
isPending: true;
|
|
782
|
+
isLoadingError: false;
|
|
783
|
+
isRefetchError: false;
|
|
784
|
+
isSuccess: false;
|
|
785
|
+
isPlaceholderData: false;
|
|
786
|
+
status: "pending";
|
|
787
|
+
dataUpdatedAt: number;
|
|
788
|
+
errorUpdatedAt: number;
|
|
789
|
+
failureCount: number;
|
|
790
|
+
failureReason: Error | null;
|
|
791
|
+
errorUpdateCount: number;
|
|
792
|
+
isFetched: boolean;
|
|
793
|
+
isFetchedAfterMount: boolean;
|
|
794
|
+
isFetching: boolean;
|
|
795
|
+
isLoading: boolean;
|
|
796
|
+
isInitialLoading: boolean;
|
|
797
|
+
isPaused: boolean;
|
|
798
|
+
isRefetching: boolean;
|
|
799
|
+
isStale: boolean;
|
|
800
|
+
isEnabled: boolean;
|
|
801
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
802
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
803
|
+
promise: Promise<bigint>;
|
|
804
|
+
} | {
|
|
805
|
+
fee: bigint | undefined;
|
|
806
|
+
data: bigint;
|
|
807
|
+
isError: false;
|
|
808
|
+
error: null;
|
|
809
|
+
isPending: false;
|
|
810
|
+
isLoading: false;
|
|
811
|
+
isLoadingError: false;
|
|
812
|
+
isRefetchError: false;
|
|
813
|
+
isSuccess: true;
|
|
814
|
+
isPlaceholderData: true;
|
|
815
|
+
status: "success";
|
|
816
|
+
dataUpdatedAt: number;
|
|
817
|
+
errorUpdatedAt: number;
|
|
818
|
+
failureCount: number;
|
|
819
|
+
failureReason: Error | null;
|
|
820
|
+
errorUpdateCount: number;
|
|
821
|
+
isFetched: boolean;
|
|
822
|
+
isFetchedAfterMount: boolean;
|
|
823
|
+
isFetching: boolean;
|
|
824
|
+
isInitialLoading: boolean;
|
|
825
|
+
isPaused: boolean;
|
|
826
|
+
isRefetching: boolean;
|
|
827
|
+
isStale: boolean;
|
|
828
|
+
isEnabled: boolean;
|
|
829
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
830
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
831
|
+
promise: Promise<bigint>;
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Execute a curator bridge operation via BridgeFacet.executeBridging.
|
|
836
|
+
*
|
|
837
|
+
* This is a direct curator call (NOT via multicall). The vault pauses during
|
|
838
|
+
* bridging for security. Automatically quotes and includes the required
|
|
839
|
+
* LayerZero fee as msg.value.
|
|
840
|
+
*
|
|
841
|
+
* @param vault Hub vault address (diamond proxy)
|
|
842
|
+
* @param token Underlying ERC-20 token address to bridge (NOT the OFT address)
|
|
843
|
+
* @param chainId Chain ID of the hub vault
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* ```tsx
|
|
847
|
+
* const { mutateAsync, isPending } = useExecuteBridge('0xVAULT', USDC_ADDRESS, 8453)
|
|
848
|
+
*
|
|
849
|
+
* await mutateAsync({
|
|
850
|
+
* oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
851
|
+
* dstEid: 30101,
|
|
852
|
+
* amount: 1_000_000n,
|
|
853
|
+
* dstVault: '0xSpokeVault...',
|
|
854
|
+
* refundAddress: curatorAddress,
|
|
855
|
+
* })
|
|
856
|
+
* ```
|
|
857
|
+
*/
|
|
858
|
+
declare function useExecuteBridge(vault: `0x${string}`, token: Address, chainId: number): _tanstack_react_query.UseMutationResult<`0x${string}`, Error, CuratorBridgeParams, unknown>;
|
|
859
|
+
|
|
860
|
+
export { AsyncRequestStatusInfo, CuratorAction, CuratorVaultStatus, MultiChainUserPosition, PendingAction, UserPosition, VaultAnalysis, VaultAssetBreakdown, VaultMetadata, VaultStatus, VaultTopology, getRouteTokenDecimals, useAsyncRequestStatus, useCuratorBridgeQuote, useCuratorVaultStatus, useDepositSimple, useExecuteActions, useExecuteBridge, useInboundRoutes, useIsCurator, useLzFee, useOmniDeposit, useOmniRedeem, usePendingActions, useProtocolWhitelist, useRedeemShares, useSmartDeposit, useSmartRedeem, useSubmitActions, useUserPosition, useUserPositionMultiChain, useVaultAnalysis, useVaultAssetBreakdown, useVaultDistribution, useVaultMetadata, useVaultStatus, useVaultTopology, useVetoActions };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { E as VaultStatus, y as VaultMetadata, w as UserPosition, s as MultiChainUserPosition, l as AsyncRequestStatusInfo, G as VaultTopology, x as VaultDistribution, r as InboundRouteWithBalance, a as CuratorVaultStatus, b as VaultAnalysis, c as VaultAssetBreakdown, P as PendingAction, e as SubmitActionsResult, d as CuratorAction, o as CuratorBridgeParams } from '../curatorBridge-DTW1lPF7.js';
|
|
3
3
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
|
|
@@ -645,4 +645,216 @@ declare function useVetoActions(vault: `0x${string}`, chainId: number): _tanstac
|
|
|
645
645
|
nonces: bigint[];
|
|
646
646
|
}, unknown>;
|
|
647
647
|
|
|
648
|
-
|
|
648
|
+
/**
|
|
649
|
+
* Quote the native fee required to bridge assets from the hub vault via LzAdapter.
|
|
650
|
+
*
|
|
651
|
+
* Refreshes every 60s — bridge fees fluctuate with LayerZero network demand.
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* ```tsx
|
|
655
|
+
* const { fee, isLoading } = useCuratorBridgeQuote('0xVAULT', 8453, {
|
|
656
|
+
* oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
657
|
+
* dstEid: 30101,
|
|
658
|
+
* amount: 1_000_000n,
|
|
659
|
+
* dstVault: '0xSpokeVault...',
|
|
660
|
+
* refundAddress: '0xCurator...',
|
|
661
|
+
* })
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
declare function useCuratorBridgeQuote(vault: `0x${string}` | undefined, chainId: number, params: CuratorBridgeParams | undefined): {
|
|
665
|
+
fee: bigint | undefined;
|
|
666
|
+
data: bigint;
|
|
667
|
+
error: Error;
|
|
668
|
+
isError: true;
|
|
669
|
+
isPending: false;
|
|
670
|
+
isLoading: false;
|
|
671
|
+
isLoadingError: false;
|
|
672
|
+
isRefetchError: true;
|
|
673
|
+
isSuccess: false;
|
|
674
|
+
isPlaceholderData: false;
|
|
675
|
+
status: "error";
|
|
676
|
+
dataUpdatedAt: number;
|
|
677
|
+
errorUpdatedAt: number;
|
|
678
|
+
failureCount: number;
|
|
679
|
+
failureReason: Error | null;
|
|
680
|
+
errorUpdateCount: number;
|
|
681
|
+
isFetched: boolean;
|
|
682
|
+
isFetchedAfterMount: boolean;
|
|
683
|
+
isFetching: boolean;
|
|
684
|
+
isInitialLoading: boolean;
|
|
685
|
+
isPaused: boolean;
|
|
686
|
+
isRefetching: boolean;
|
|
687
|
+
isStale: boolean;
|
|
688
|
+
isEnabled: boolean;
|
|
689
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
690
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
691
|
+
promise: Promise<bigint>;
|
|
692
|
+
} | {
|
|
693
|
+
fee: bigint | undefined;
|
|
694
|
+
data: bigint;
|
|
695
|
+
error: null;
|
|
696
|
+
isError: false;
|
|
697
|
+
isPending: false;
|
|
698
|
+
isLoading: false;
|
|
699
|
+
isLoadingError: false;
|
|
700
|
+
isRefetchError: false;
|
|
701
|
+
isSuccess: true;
|
|
702
|
+
isPlaceholderData: false;
|
|
703
|
+
status: "success";
|
|
704
|
+
dataUpdatedAt: number;
|
|
705
|
+
errorUpdatedAt: number;
|
|
706
|
+
failureCount: number;
|
|
707
|
+
failureReason: Error | null;
|
|
708
|
+
errorUpdateCount: number;
|
|
709
|
+
isFetched: boolean;
|
|
710
|
+
isFetchedAfterMount: boolean;
|
|
711
|
+
isFetching: boolean;
|
|
712
|
+
isInitialLoading: boolean;
|
|
713
|
+
isPaused: boolean;
|
|
714
|
+
isRefetching: boolean;
|
|
715
|
+
isStale: boolean;
|
|
716
|
+
isEnabled: boolean;
|
|
717
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
718
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
719
|
+
promise: Promise<bigint>;
|
|
720
|
+
} | {
|
|
721
|
+
fee: bigint | undefined;
|
|
722
|
+
data: undefined;
|
|
723
|
+
error: Error;
|
|
724
|
+
isError: true;
|
|
725
|
+
isPending: false;
|
|
726
|
+
isLoading: false;
|
|
727
|
+
isLoadingError: true;
|
|
728
|
+
isRefetchError: false;
|
|
729
|
+
isSuccess: false;
|
|
730
|
+
isPlaceholderData: false;
|
|
731
|
+
status: "error";
|
|
732
|
+
dataUpdatedAt: number;
|
|
733
|
+
errorUpdatedAt: number;
|
|
734
|
+
failureCount: number;
|
|
735
|
+
failureReason: Error | null;
|
|
736
|
+
errorUpdateCount: number;
|
|
737
|
+
isFetched: boolean;
|
|
738
|
+
isFetchedAfterMount: boolean;
|
|
739
|
+
isFetching: boolean;
|
|
740
|
+
isInitialLoading: boolean;
|
|
741
|
+
isPaused: boolean;
|
|
742
|
+
isRefetching: boolean;
|
|
743
|
+
isStale: boolean;
|
|
744
|
+
isEnabled: boolean;
|
|
745
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
746
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
747
|
+
promise: Promise<bigint>;
|
|
748
|
+
} | {
|
|
749
|
+
fee: bigint | undefined;
|
|
750
|
+
data: undefined;
|
|
751
|
+
error: null;
|
|
752
|
+
isError: false;
|
|
753
|
+
isPending: true;
|
|
754
|
+
isLoading: true;
|
|
755
|
+
isLoadingError: false;
|
|
756
|
+
isRefetchError: false;
|
|
757
|
+
isSuccess: false;
|
|
758
|
+
isPlaceholderData: false;
|
|
759
|
+
status: "pending";
|
|
760
|
+
dataUpdatedAt: number;
|
|
761
|
+
errorUpdatedAt: number;
|
|
762
|
+
failureCount: number;
|
|
763
|
+
failureReason: Error | null;
|
|
764
|
+
errorUpdateCount: number;
|
|
765
|
+
isFetched: boolean;
|
|
766
|
+
isFetchedAfterMount: boolean;
|
|
767
|
+
isFetching: boolean;
|
|
768
|
+
isInitialLoading: boolean;
|
|
769
|
+
isPaused: boolean;
|
|
770
|
+
isRefetching: boolean;
|
|
771
|
+
isStale: boolean;
|
|
772
|
+
isEnabled: boolean;
|
|
773
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
774
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
775
|
+
promise: Promise<bigint>;
|
|
776
|
+
} | {
|
|
777
|
+
fee: bigint | undefined;
|
|
778
|
+
data: undefined;
|
|
779
|
+
error: null;
|
|
780
|
+
isError: false;
|
|
781
|
+
isPending: true;
|
|
782
|
+
isLoadingError: false;
|
|
783
|
+
isRefetchError: false;
|
|
784
|
+
isSuccess: false;
|
|
785
|
+
isPlaceholderData: false;
|
|
786
|
+
status: "pending";
|
|
787
|
+
dataUpdatedAt: number;
|
|
788
|
+
errorUpdatedAt: number;
|
|
789
|
+
failureCount: number;
|
|
790
|
+
failureReason: Error | null;
|
|
791
|
+
errorUpdateCount: number;
|
|
792
|
+
isFetched: boolean;
|
|
793
|
+
isFetchedAfterMount: boolean;
|
|
794
|
+
isFetching: boolean;
|
|
795
|
+
isLoading: boolean;
|
|
796
|
+
isInitialLoading: boolean;
|
|
797
|
+
isPaused: boolean;
|
|
798
|
+
isRefetching: boolean;
|
|
799
|
+
isStale: boolean;
|
|
800
|
+
isEnabled: boolean;
|
|
801
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
802
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
803
|
+
promise: Promise<bigint>;
|
|
804
|
+
} | {
|
|
805
|
+
fee: bigint | undefined;
|
|
806
|
+
data: bigint;
|
|
807
|
+
isError: false;
|
|
808
|
+
error: null;
|
|
809
|
+
isPending: false;
|
|
810
|
+
isLoading: false;
|
|
811
|
+
isLoadingError: false;
|
|
812
|
+
isRefetchError: false;
|
|
813
|
+
isSuccess: true;
|
|
814
|
+
isPlaceholderData: true;
|
|
815
|
+
status: "success";
|
|
816
|
+
dataUpdatedAt: number;
|
|
817
|
+
errorUpdatedAt: number;
|
|
818
|
+
failureCount: number;
|
|
819
|
+
failureReason: Error | null;
|
|
820
|
+
errorUpdateCount: number;
|
|
821
|
+
isFetched: boolean;
|
|
822
|
+
isFetchedAfterMount: boolean;
|
|
823
|
+
isFetching: boolean;
|
|
824
|
+
isInitialLoading: boolean;
|
|
825
|
+
isPaused: boolean;
|
|
826
|
+
isRefetching: boolean;
|
|
827
|
+
isStale: boolean;
|
|
828
|
+
isEnabled: boolean;
|
|
829
|
+
refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<bigint, Error>>;
|
|
830
|
+
fetchStatus: _tanstack_query_core.FetchStatus;
|
|
831
|
+
promise: Promise<bigint>;
|
|
832
|
+
};
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Execute a curator bridge operation via BridgeFacet.executeBridging.
|
|
836
|
+
*
|
|
837
|
+
* This is a direct curator call (NOT via multicall). The vault pauses during
|
|
838
|
+
* bridging for security. Automatically quotes and includes the required
|
|
839
|
+
* LayerZero fee as msg.value.
|
|
840
|
+
*
|
|
841
|
+
* @param vault Hub vault address (diamond proxy)
|
|
842
|
+
* @param token Underlying ERC-20 token address to bridge (NOT the OFT address)
|
|
843
|
+
* @param chainId Chain ID of the hub vault
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* ```tsx
|
|
847
|
+
* const { mutateAsync, isPending } = useExecuteBridge('0xVAULT', USDC_ADDRESS, 8453)
|
|
848
|
+
*
|
|
849
|
+
* await mutateAsync({
|
|
850
|
+
* oftToken: '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
|
|
851
|
+
* dstEid: 30101,
|
|
852
|
+
* amount: 1_000_000n,
|
|
853
|
+
* dstVault: '0xSpokeVault...',
|
|
854
|
+
* refundAddress: curatorAddress,
|
|
855
|
+
* })
|
|
856
|
+
* ```
|
|
857
|
+
*/
|
|
858
|
+
declare function useExecuteBridge(vault: `0x${string}`, token: Address, chainId: number): _tanstack_react_query.UseMutationResult<`0x${string}`, Error, CuratorBridgeParams, unknown>;
|
|
859
|
+
|
|
860
|
+
export { AsyncRequestStatusInfo, CuratorAction, CuratorVaultStatus, MultiChainUserPosition, PendingAction, UserPosition, VaultAnalysis, VaultAssetBreakdown, VaultMetadata, VaultStatus, VaultTopology, getRouteTokenDecimals, useAsyncRequestStatus, useCuratorBridgeQuote, useCuratorVaultStatus, useDepositSimple, useExecuteActions, useExecuteBridge, useInboundRoutes, useIsCurator, useLzFee, useOmniDeposit, useOmniRedeem, usePendingActions, useProtocolWhitelist, useRedeemShares, useSmartDeposit, useSmartRedeem, useSubmitActions, useUserPosition, useUserPositionMultiChain, useVaultAnalysis, useVaultAssetBreakdown, useVaultDistribution, useVaultMetadata, useVaultStatus, useVaultTopology, useVetoActions };
|
package/dist/react/index.js
CHANGED
|
@@ -908,6 +908,41 @@ var DEX_ABI = [
|
|
|
908
908
|
stateMutability: "nonpayable"
|
|
909
909
|
}
|
|
910
910
|
];
|
|
911
|
+
var BRIDGE_FACET_ABI = [
|
|
912
|
+
{
|
|
913
|
+
type: "function",
|
|
914
|
+
name: "executeBridging",
|
|
915
|
+
inputs: [
|
|
916
|
+
{ name: "adapter", type: "address" },
|
|
917
|
+
{ name: "token", type: "address" },
|
|
918
|
+
{ name: "amount", type: "uint256" },
|
|
919
|
+
{ name: "bridgeSpecificParams", type: "bytes" }
|
|
920
|
+
],
|
|
921
|
+
outputs: [],
|
|
922
|
+
stateMutability: "payable"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
type: "function",
|
|
926
|
+
name: "initVaultActionRequest",
|
|
927
|
+
inputs: [
|
|
928
|
+
{ name: "actionType", type: "uint8" },
|
|
929
|
+
{ name: "actionCallData", type: "bytes" },
|
|
930
|
+
{ name: "amountLimit", type: "uint256" },
|
|
931
|
+
{ name: "extraOptions", type: "bytes" }
|
|
932
|
+
],
|
|
933
|
+
outputs: [{ name: "guid", type: "bytes32" }],
|
|
934
|
+
stateMutability: "payable"
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
type: "function",
|
|
938
|
+
name: "executeRequest",
|
|
939
|
+
inputs: [
|
|
940
|
+
{ name: "guid", type: "bytes32" }
|
|
941
|
+
],
|
|
942
|
+
outputs: [],
|
|
943
|
+
stateMutability: "nonpayable"
|
|
944
|
+
}
|
|
945
|
+
];
|
|
911
946
|
var ERC7540_FACET_ABI = [
|
|
912
947
|
{
|
|
913
948
|
type: "function",
|
|
@@ -994,6 +1029,37 @@ var CURATOR_CONFIG_ABI = [
|
|
|
994
1029
|
stateMutability: "view"
|
|
995
1030
|
}
|
|
996
1031
|
];
|
|
1032
|
+
var LZ_ADAPTER_ABI = [
|
|
1033
|
+
{
|
|
1034
|
+
type: "function",
|
|
1035
|
+
name: "quoteBridgeFee",
|
|
1036
|
+
inputs: [
|
|
1037
|
+
{ name: "bridgeSpecificParams", type: "bytes" }
|
|
1038
|
+
],
|
|
1039
|
+
outputs: [{ name: "nativeFee", type: "uint256" }],
|
|
1040
|
+
stateMutability: "view"
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
type: "function",
|
|
1044
|
+
name: "quoteReadFee",
|
|
1045
|
+
inputs: [
|
|
1046
|
+
{ name: "vaults", type: "address[]" },
|
|
1047
|
+
{ name: "eids", type: "uint32[]" },
|
|
1048
|
+
{ name: "_extraOptions", type: "bytes" }
|
|
1049
|
+
],
|
|
1050
|
+
outputs: [
|
|
1051
|
+
{
|
|
1052
|
+
name: "fee",
|
|
1053
|
+
type: "tuple",
|
|
1054
|
+
components: [
|
|
1055
|
+
{ name: "nativeFee", type: "uint256" },
|
|
1056
|
+
{ name: "lzTokenFee", type: "uint256" }
|
|
1057
|
+
]
|
|
1058
|
+
}
|
|
1059
|
+
],
|
|
1060
|
+
stateMutability: "view"
|
|
1061
|
+
}
|
|
1062
|
+
];
|
|
997
1063
|
var ERC4626_FACET_ABI = [
|
|
998
1064
|
{
|
|
999
1065
|
type: "function",
|
|
@@ -2458,6 +2524,75 @@ async function vetoActions(walletClient, publicClient, vault, nonces) {
|
|
|
2458
2524
|
});
|
|
2459
2525
|
return { txHash };
|
|
2460
2526
|
}
|
|
2527
|
+
function encodeBridgeParams(params) {
|
|
2528
|
+
return encodeAbiParameters(
|
|
2529
|
+
[
|
|
2530
|
+
{ type: "address" },
|
|
2531
|
+
{ type: "uint32" },
|
|
2532
|
+
{ type: "uint256" },
|
|
2533
|
+
{ type: "address" },
|
|
2534
|
+
{ type: "address" }
|
|
2535
|
+
],
|
|
2536
|
+
[
|
|
2537
|
+
getAddress(params.oftToken),
|
|
2538
|
+
params.dstEid,
|
|
2539
|
+
params.amount,
|
|
2540
|
+
getAddress(params.dstVault),
|
|
2541
|
+
getAddress(params.refundAddress)
|
|
2542
|
+
]
|
|
2543
|
+
);
|
|
2544
|
+
}
|
|
2545
|
+
function encodeBridgeParamsForQuote(params) {
|
|
2546
|
+
return encodeAbiParameters(
|
|
2547
|
+
[
|
|
2548
|
+
{ type: "address" },
|
|
2549
|
+
{ type: "uint32" },
|
|
2550
|
+
{ type: "uint256" },
|
|
2551
|
+
{ type: "address" }
|
|
2552
|
+
],
|
|
2553
|
+
[
|
|
2554
|
+
getAddress(params.oftToken),
|
|
2555
|
+
params.dstEid,
|
|
2556
|
+
params.amount,
|
|
2557
|
+
getAddress(params.dstVault)
|
|
2558
|
+
]
|
|
2559
|
+
);
|
|
2560
|
+
}
|
|
2561
|
+
async function quoteCuratorBridgeFee(publicClient, vault, params) {
|
|
2562
|
+
const status = await getCuratorVaultStatus(publicClient, vault);
|
|
2563
|
+
const lzAdapter = status.lzAdapter;
|
|
2564
|
+
const bridgeSpecificParams = encodeBridgeParamsForQuote(params);
|
|
2565
|
+
const nativeFee = await publicClient.readContract({
|
|
2566
|
+
address: lzAdapter,
|
|
2567
|
+
abi: LZ_ADAPTER_ABI,
|
|
2568
|
+
functionName: "quoteBridgeFee",
|
|
2569
|
+
args: [bridgeSpecificParams]
|
|
2570
|
+
});
|
|
2571
|
+
return nativeFee;
|
|
2572
|
+
}
|
|
2573
|
+
async function executeCuratorBridge(walletClient, publicClient, vault, token, params) {
|
|
2574
|
+
const account = walletClient.account;
|
|
2575
|
+
const v = getAddress(vault);
|
|
2576
|
+
const status = await getCuratorVaultStatus(publicClient, vault);
|
|
2577
|
+
const lzAdapter = status.lzAdapter;
|
|
2578
|
+
const fee = await quoteCuratorBridgeFee(publicClient, vault, params);
|
|
2579
|
+
const bridgeSpecificParams = encodeBridgeParams(params);
|
|
2580
|
+
const txHash = await walletClient.writeContract({
|
|
2581
|
+
address: v,
|
|
2582
|
+
abi: BRIDGE_FACET_ABI,
|
|
2583
|
+
functionName: "executeBridging",
|
|
2584
|
+
args: [
|
|
2585
|
+
lzAdapter,
|
|
2586
|
+
getAddress(token),
|
|
2587
|
+
params.amount,
|
|
2588
|
+
bridgeSpecificParams
|
|
2589
|
+
],
|
|
2590
|
+
value: fee,
|
|
2591
|
+
account,
|
|
2592
|
+
chain: walletClient.chain
|
|
2593
|
+
});
|
|
2594
|
+
return txHash;
|
|
2595
|
+
}
|
|
2461
2596
|
|
|
2462
2597
|
// src/viem/wagmiCompat.ts
|
|
2463
2598
|
function asSdkClient(client) {
|
|
@@ -2918,7 +3053,33 @@ function useVetoActions(vault, chainId) {
|
|
|
2918
3053
|
}
|
|
2919
3054
|
});
|
|
2920
3055
|
}
|
|
3056
|
+
function useCuratorBridgeQuote(vault, chainId, params) {
|
|
3057
|
+
const publicClient = usePublicClient({ chainId });
|
|
3058
|
+
const query = useQuery({
|
|
3059
|
+
queryKey: ["curatorBridgeQuote", vault, chainId, params],
|
|
3060
|
+
queryFn: () => quoteCuratorBridgeFee(asSdkClient(publicClient), vault, params),
|
|
3061
|
+
enabled: !!vault && !!publicClient && !!params,
|
|
3062
|
+
refetchInterval: 6e4,
|
|
3063
|
+
staleTime: 3e4
|
|
3064
|
+
});
|
|
3065
|
+
return {
|
|
3066
|
+
...query,
|
|
3067
|
+
fee: query.data
|
|
3068
|
+
};
|
|
3069
|
+
}
|
|
3070
|
+
function useExecuteBridge(vault, token, chainId) {
|
|
3071
|
+
const publicClient = usePublicClient({ chainId });
|
|
3072
|
+
const { data: walletClient } = useWalletClient({ chainId });
|
|
3073
|
+
return useMutation({
|
|
3074
|
+
mutationFn: async (params) => {
|
|
3075
|
+
if (!walletClient || !publicClient) {
|
|
3076
|
+
throw new Error("Wallet or public client not available");
|
|
3077
|
+
}
|
|
3078
|
+
return executeCuratorBridge(walletClient, asSdkClient(publicClient), vault, token, params);
|
|
3079
|
+
}
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
2921
3082
|
|
|
2922
|
-
export { getRouteTokenDecimals, useAsyncRequestStatus, useCuratorVaultStatus, useDepositSimple, useExecuteActions, useInboundRoutes, useIsCurator, useLzFee, useOmniDeposit, useOmniRedeem, usePendingActions, useProtocolWhitelist, useRedeemShares, useSmartDeposit, useSmartRedeem, useSubmitActions, useUserPosition, useUserPositionMultiChain, useVaultAnalysis, useVaultAssetBreakdown, useVaultDistribution, useVaultMetadata, useVaultStatus, useVaultTopology, useVetoActions };
|
|
3083
|
+
export { getRouteTokenDecimals, useAsyncRequestStatus, useCuratorBridgeQuote, useCuratorVaultStatus, useDepositSimple, useExecuteActions, useExecuteBridge, useInboundRoutes, useIsCurator, useLzFee, useOmniDeposit, useOmniRedeem, usePendingActions, useProtocolWhitelist, useRedeemShares, useSmartDeposit, useSmartRedeem, useSubmitActions, useUserPosition, useUserPositionMultiChain, useVaultAnalysis, useVaultAssetBreakdown, useVaultDistribution, useVaultMetadata, useVaultStatus, useVaultTopology, useVetoActions };
|
|
2923
3084
|
//# sourceMappingURL=index.js.map
|
|
2924
3085
|
//# sourceMappingURL=index.js.map
|