@sodax/dapp-kit 0.0.1-rc.3 → 0.0.1-rc.30
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/LICENSE +21 -0
- package/README.md +152 -53
- package/dist/index.d.mts +1425 -0
- package/dist/index.d.ts +1425 -4
- package/dist/index.js +931 -194
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +890 -191
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -8
- package/src/contexts/index.ts +2 -0
- package/src/core/index.ts +5 -33
- package/src/hooks/backend/README.md +135 -0
- package/src/hooks/backend/index.ts +23 -0
- package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +49 -0
- package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +61 -0
- package/src/hooks/backend/useBackendIntentByHash.ts +53 -0
- package/src/hooks/backend/useBackendIntentByTxHash.ts +52 -0
- package/src/hooks/backend/useBackendMoneyMarketAsset.ts +57 -0
- package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +67 -0
- package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +67 -0
- package/src/hooks/backend/useBackendMoneyMarketPosition.ts +56 -0
- package/src/hooks/backend/useBackendOrderbook.ts +63 -0
- package/src/hooks/bridge/index.ts +5 -0
- package/src/hooks/bridge/useBridge.ts +57 -0
- package/src/hooks/bridge/useBridgeAllowance.ts +49 -0
- package/src/hooks/bridge/useBridgeApprove.ts +68 -0
- package/src/hooks/bridge/useGetBridgeableAmount.ts +50 -0
- package/src/hooks/bridge/useGetBridgeableTokens.ts +62 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/mm/index.ts +3 -1
- package/src/hooks/mm/useBorrow.ts +20 -10
- package/src/hooks/mm/useMMAllowance.ts +55 -0
- package/src/hooks/mm/useMMApprove.ts +67 -0
- package/src/hooks/mm/useRepay.ts +20 -10
- package/src/hooks/mm/useReservesData.ts +30 -0
- package/src/hooks/mm/useReservesHumanized.ts +30 -0
- package/src/hooks/mm/useReservesList.ts +29 -0
- package/src/hooks/mm/useReservesUsdFormat.ts +38 -0
- package/src/hooks/mm/useSupply.ts +9 -6
- package/src/hooks/mm/useUserFormattedSummary.ts +54 -0
- package/src/hooks/mm/useUserReservesData.ts +30 -48
- package/src/hooks/mm/useWithdraw.ts +17 -11
- package/src/hooks/provider/useHubProvider.ts +3 -21
- package/src/hooks/provider/useSpokeProvider.ts +97 -6
- package/src/hooks/shared/index.ts +4 -2
- package/src/hooks/shared/useDeriveUserWalletAddress.ts +44 -0
- package/src/hooks/shared/useEstimateGas.ts +18 -0
- package/src/hooks/shared/useRequestTrustline.ts +82 -0
- package/src/hooks/shared/useStellarTrustlineCheck.ts +71 -0
- package/src/hooks/staking/index.ts +19 -0
- package/src/hooks/staking/useCancelUnstake.ts +52 -0
- package/src/hooks/staking/useClaim.ts +46 -0
- package/src/hooks/staking/useConvertedAssets.ts +47 -0
- package/src/hooks/staking/useInstantUnstake.ts +50 -0
- package/src/hooks/staking/useInstantUnstakeAllowance.ts +59 -0
- package/src/hooks/staking/useInstantUnstakeApprove.ts +52 -0
- package/src/hooks/staking/useInstantUnstakeRatio.ts +54 -0
- package/src/hooks/staking/useStake.ts +47 -0
- package/src/hooks/staking/useStakeAllowance.ts +57 -0
- package/src/hooks/staking/useStakeApprove.ts +50 -0
- package/src/hooks/staking/useStakeRatio.ts +53 -0
- package/src/hooks/staking/useStakingConfig.ts +40 -0
- package/src/hooks/staking/useStakingInfo.ts +50 -0
- package/src/hooks/staking/useUnstake.ts +54 -0
- package/src/hooks/staking/useUnstakeAllowance.ts +58 -0
- package/src/hooks/staking/useUnstakeApprove.ts +52 -0
- package/src/hooks/staking/useUnstakingInfo.ts +53 -0
- package/src/hooks/staking/useUnstakingInfoWithPenalty.ts +59 -0
- package/src/hooks/swap/index.ts +4 -1
- package/src/hooks/swap/useCancelSwap.ts +44 -0
- package/src/hooks/swap/useQuote.ts +20 -6
- package/src/hooks/swap/useStatus.ts +3 -3
- package/src/hooks/swap/{useCreateIntentOrder.ts → useSwap.ts} +22 -19
- package/src/hooks/swap/useSwapAllowance.ts +48 -0
- package/src/hooks/swap/useSwapApprove.ts +68 -0
- package/src/providers/SodaxProvider.tsx +7 -4
- package/dist/contexts/index.d.ts +0 -7
- package/dist/contexts/index.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -4
- package/dist/core/index.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -5
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/mm/index.d.ts +0 -7
- package/dist/hooks/mm/index.d.ts.map +0 -1
- package/dist/hooks/mm/useBorrow.d.ts +0 -26
- package/dist/hooks/mm/useBorrow.d.ts.map +0 -1
- package/dist/hooks/mm/useHubWalletAddress.d.ts +0 -24
- package/dist/hooks/mm/useHubWalletAddress.d.ts.map +0 -1
- package/dist/hooks/mm/useRepay.d.ts +0 -26
- package/dist/hooks/mm/useRepay.d.ts.map +0 -1
- package/dist/hooks/mm/useSupply.d.ts +0 -32
- package/dist/hooks/mm/useSupply.d.ts.map +0 -1
- package/dist/hooks/mm/useUserReservesData.d.ts +0 -9
- package/dist/hooks/mm/useUserReservesData.d.ts.map +0 -1
- package/dist/hooks/mm/useWithdraw.d.ts +0 -26
- package/dist/hooks/mm/useWithdraw.d.ts.map +0 -1
- package/dist/hooks/provider/index.d.ts +0 -3
- package/dist/hooks/provider/index.d.ts.map +0 -1
- package/dist/hooks/provider/useHubProvider.d.ts +0 -3
- package/dist/hooks/provider/useHubProvider.d.ts.map +0 -1
- package/dist/hooks/provider/useSpokeProvider.d.ts +0 -4
- package/dist/hooks/provider/useSpokeProvider.d.ts.map +0 -1
- package/dist/hooks/shared/index.d.ts +0 -4
- package/dist/hooks/shared/index.d.ts.map +0 -1
- package/dist/hooks/shared/useAllowance.d.ts +0 -3
- package/dist/hooks/shared/useAllowance.d.ts.map +0 -1
- package/dist/hooks/shared/useApprove.d.ts +0 -10
- package/dist/hooks/shared/useApprove.d.ts.map +0 -1
- package/dist/hooks/shared/useSodaxContext.d.ts +0 -8
- package/dist/hooks/shared/useSodaxContext.d.ts.map +0 -1
- package/dist/hooks/swap/index.d.ts +0 -4
- package/dist/hooks/swap/index.d.ts.map +0 -1
- package/dist/hooks/swap/useCreateIntentOrder.d.ts +0 -33
- package/dist/hooks/swap/useCreateIntentOrder.d.ts.map +0 -1
- package/dist/hooks/swap/useQuote.d.ts +0 -39
- package/dist/hooks/swap/useQuote.d.ts.map +0 -1
- package/dist/hooks/swap/useStatus.d.ts +0 -31
- package/dist/hooks/swap/useStatus.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/providers/SodaxProvider.d.ts +0 -10
- package/dist/providers/SodaxProvider.d.ts.map +0 -1
- package/dist/providers/index.d.ts +0 -2
- package/dist/providers/index.d.ts.map +0 -1
- package/src/hooks/mm/useHubWalletAddress.ts +0 -49
- package/src/hooks/shared/useAllowance.ts +0 -31
- package/src/hooks/shared/useApprove.ts +0 -53
package/dist/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var reactQuery = require('@tanstack/react-query');
|
|
5
4
|
var sdk = require('@sodax/sdk');
|
|
6
|
-
var
|
|
5
|
+
var reactQuery = require('@tanstack/react-query');
|
|
7
6
|
var viem = require('viem');
|
|
8
7
|
|
|
9
8
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -19,117 +18,154 @@ var useSodaxContext = () => {
|
|
|
19
18
|
}
|
|
20
19
|
return context;
|
|
21
20
|
};
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
sdk.spokeChainConfig[spokeChainId]
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
if (xChainType === "SUI") {
|
|
34
|
-
return new sdk.SuiSpokeProvider(
|
|
35
|
-
sdk.spokeChainConfig[spokeChainId],
|
|
36
|
-
walletProvider
|
|
37
|
-
);
|
|
21
|
+
function useEstimateGas(spokeProvider) {
|
|
22
|
+
return reactQuery.useMutation({
|
|
23
|
+
mutationFn: async (rawTx) => {
|
|
24
|
+
if (!spokeProvider) {
|
|
25
|
+
throw new Error("spokeProvider is not found");
|
|
26
|
+
}
|
|
27
|
+
const response = await sdk.SpokeService.estimateGas(rawTx, spokeProvider);
|
|
28
|
+
return response;
|
|
38
29
|
}
|
|
39
|
-
|
|
40
|
-
}, [walletProvider, xChainType, spokeChainId]);
|
|
41
|
-
return spokeProvider;
|
|
30
|
+
});
|
|
42
31
|
}
|
|
43
|
-
function
|
|
32
|
+
function useDeriveUserWalletAddress(spokeProvider, walletAddress) {
|
|
44
33
|
const { sodax } = useSodaxContext();
|
|
45
|
-
const spokeProvider = useSpokeProvider(token.xChainId);
|
|
46
34
|
return reactQuery.useQuery({
|
|
47
|
-
queryKey: ["
|
|
35
|
+
queryKey: ["deriveUserWalletAddress", spokeProvider?.chainConfig.chain.id, walletAddress],
|
|
48
36
|
queryFn: async () => {
|
|
49
37
|
if (!spokeProvider) {
|
|
50
|
-
|
|
38
|
+
throw new Error("Spoke provider is required");
|
|
51
39
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
return await sdk.deriveUserWalletAddress(spokeProvider, sodax.hubProvider, walletAddress);
|
|
41
|
+
},
|
|
42
|
+
enabled: !!spokeProvider,
|
|
43
|
+
refetchInterval: false
|
|
44
|
+
// This is a deterministic operation, no need to refetch
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function useStellarTrustlineCheck(token, amount, spokeProvider, chainId) {
|
|
48
|
+
return reactQuery.useQuery({
|
|
49
|
+
queryKey: ["stellar-trustline-check", token],
|
|
50
|
+
queryFn: async () => {
|
|
51
|
+
if (chainId !== sdk.STELLAR_MAINNET_CHAIN_ID) {
|
|
52
|
+
return true;
|
|
61
53
|
}
|
|
62
|
-
|
|
54
|
+
if (!spokeProvider || !token || !amount || !(spokeProvider instanceof sdk.StellarSpokeProvider)) {
|
|
55
|
+
console.error(
|
|
56
|
+
"Spoke provider, token or amount not found. Details: spokeProvider:",
|
|
57
|
+
spokeProvider,
|
|
58
|
+
"token:",
|
|
59
|
+
token,
|
|
60
|
+
"amount:",
|
|
61
|
+
amount
|
|
62
|
+
);
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
const response = await sdk.StellarSpokeService.hasSufficientTrustline(token, amount, spokeProvider);
|
|
66
|
+
return response;
|
|
63
67
|
},
|
|
64
|
-
enabled: !!spokeProvider
|
|
68
|
+
enabled: !!spokeProvider && !!token && !!amount
|
|
65
69
|
});
|
|
66
70
|
}
|
|
67
|
-
function
|
|
68
|
-
const { sodax } = useSodaxContext();
|
|
69
|
-
const spokeProvider = useSpokeProvider(token.xChainId);
|
|
71
|
+
function useRequestTrustline(token) {
|
|
70
72
|
const queryClient = reactQuery.useQueryClient();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
throw new Error("Spoke provider not found");
|
|
80
|
-
}
|
|
81
|
-
const allowance = await sodax.moneyMarket.approve(
|
|
82
|
-
token.address,
|
|
83
|
-
viem.parseUnits(amount, token.decimals),
|
|
84
|
-
spokeProvider.chainConfig.addresses.assetManager,
|
|
85
|
-
spokeProvider
|
|
86
|
-
);
|
|
87
|
-
if (!allowance.ok) {
|
|
88
|
-
throw new Error("Failed to approve tokens");
|
|
73
|
+
return reactQuery.useMutation({
|
|
74
|
+
mutationFn: async ({
|
|
75
|
+
token: token2,
|
|
76
|
+
amount,
|
|
77
|
+
spokeProvider
|
|
78
|
+
}) => {
|
|
79
|
+
if (!spokeProvider || !token2 || !amount || !(spokeProvider instanceof sdk.StellarSpokeProvider)) {
|
|
80
|
+
throw new Error("Spoke provider, token or amount not found");
|
|
89
81
|
}
|
|
90
|
-
return
|
|
82
|
+
return sdk.StellarSpokeService.requestTrustline(token2, amount, spokeProvider);
|
|
91
83
|
},
|
|
92
84
|
onSuccess: () => {
|
|
93
|
-
queryClient.invalidateQueries({ queryKey: ["
|
|
85
|
+
queryClient.invalidateQueries({ queryKey: ["stellar-trustline-check", token] });
|
|
94
86
|
}
|
|
95
87
|
});
|
|
96
|
-
return {
|
|
97
|
-
approve,
|
|
98
|
-
isLoading: isPending,
|
|
99
|
-
error,
|
|
100
|
-
resetError
|
|
101
|
-
};
|
|
102
88
|
}
|
|
89
|
+
|
|
90
|
+
// src/hooks/provider/useHubProvider.ts
|
|
103
91
|
function useHubProvider() {
|
|
104
92
|
const { sodax } = useSodaxContext();
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
93
|
+
return sodax.hubProvider;
|
|
94
|
+
}
|
|
95
|
+
function useSpokeProvider(spokeChainId, walletProvider) {
|
|
96
|
+
const { rpcConfig } = useSodaxContext();
|
|
97
|
+
const xChainType = spokeChainId ? sdk.spokeChainConfig[spokeChainId]?.chain.type : void 0;
|
|
98
|
+
const spokeProvider = React.useMemo(() => {
|
|
99
|
+
if (!walletProvider) return void 0;
|
|
100
|
+
if (!spokeChainId) return void 0;
|
|
101
|
+
if (!xChainType) return void 0;
|
|
102
|
+
if (!rpcConfig) return void 0;
|
|
103
|
+
if (xChainType === "EVM") {
|
|
104
|
+
if (spokeChainId === sdk.SONIC_MAINNET_CHAIN_ID) {
|
|
105
|
+
return new sdk.SonicSpokeProvider(
|
|
106
|
+
walletProvider,
|
|
107
|
+
sdk.spokeChainConfig[spokeChainId]
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return new sdk.EvmSpokeProvider(
|
|
111
|
+
walletProvider,
|
|
112
|
+
sdk.spokeChainConfig[spokeChainId]
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
if (xChainType === "SUI") {
|
|
116
|
+
return new sdk.SuiSpokeProvider(
|
|
117
|
+
sdk.spokeChainConfig[spokeChainId],
|
|
118
|
+
walletProvider
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (xChainType === "ICON") {
|
|
122
|
+
return new sdk.IconSpokeProvider(
|
|
123
|
+
walletProvider,
|
|
124
|
+
sdk.spokeChainConfig[spokeChainId]
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
if (xChainType === "INJECTIVE") {
|
|
128
|
+
return new sdk.InjectiveSpokeProvider(
|
|
129
|
+
sdk.spokeChainConfig[spokeChainId],
|
|
130
|
+
walletProvider
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
if (xChainType === "STELLAR") {
|
|
134
|
+
const stellarConfig = sdk.spokeChainConfig[spokeChainId];
|
|
135
|
+
return new sdk.StellarSpokeProvider(
|
|
136
|
+
walletProvider,
|
|
137
|
+
stellarConfig,
|
|
138
|
+
rpcConfig.stellar ? rpcConfig.stellar : {
|
|
139
|
+
horizonRpcUrl: stellarConfig.horizonRpcUrl,
|
|
140
|
+
sorobanRpcUrl: stellarConfig.sorobanRpcUrl
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
if (xChainType === "SOLANA") {
|
|
145
|
+
return new sdk.SolanaSpokeProvider(
|
|
146
|
+
walletProvider,
|
|
147
|
+
rpcConfig.solana ? {
|
|
148
|
+
...sdk.spokeChainConfig[spokeChainId],
|
|
149
|
+
rpcUrl: rpcConfig.solana
|
|
150
|
+
} : sdk.spokeChainConfig[spokeChainId]
|
|
151
|
+
);
|
|
116
152
|
}
|
|
117
153
|
return void 0;
|
|
118
|
-
}, [xChainType,
|
|
119
|
-
return
|
|
154
|
+
}, [spokeChainId, xChainType, walletProvider, rpcConfig]);
|
|
155
|
+
return spokeProvider;
|
|
120
156
|
}
|
|
121
|
-
function useBorrow(
|
|
157
|
+
function useBorrow(spokeToken, spokeProvider) {
|
|
122
158
|
const { sodax } = useSodaxContext();
|
|
123
|
-
const spokeProvider = useSpokeProvider(spokeChainId);
|
|
124
159
|
return reactQuery.useMutation({
|
|
125
160
|
mutationFn: async (amount) => {
|
|
126
161
|
if (!spokeProvider) {
|
|
127
162
|
throw new Error("spokeProvider is not found");
|
|
128
163
|
}
|
|
129
|
-
const response = await sodax.moneyMarket.
|
|
164
|
+
const response = await sodax.moneyMarket.borrow(
|
|
130
165
|
{
|
|
131
|
-
token:
|
|
132
|
-
amount: viem.parseUnits(amount,
|
|
166
|
+
token: spokeToken.address,
|
|
167
|
+
amount: viem.parseUnits(amount, 18),
|
|
168
|
+
action: "borrow"
|
|
133
169
|
},
|
|
134
170
|
spokeProvider
|
|
135
171
|
);
|
|
@@ -141,18 +177,18 @@ function useBorrow(hubToken, spokeChainId) {
|
|
|
141
177
|
}
|
|
142
178
|
});
|
|
143
179
|
}
|
|
144
|
-
function useRepay(
|
|
180
|
+
function useRepay(spokeToken, spokeProvider) {
|
|
145
181
|
const { sodax } = useSodaxContext();
|
|
146
|
-
const spokeProvider = useSpokeProvider(spokeChainId);
|
|
147
182
|
return reactQuery.useMutation({
|
|
148
183
|
mutationFn: async (amount) => {
|
|
149
184
|
if (!spokeProvider) {
|
|
150
185
|
throw new Error("spokeProvider is not found");
|
|
151
186
|
}
|
|
152
|
-
const response = await sodax.moneyMarket.
|
|
187
|
+
const response = await sodax.moneyMarket.repay(
|
|
153
188
|
{
|
|
154
|
-
token:
|
|
155
|
-
amount: viem.parseUnits(amount,
|
|
189
|
+
token: spokeToken.address,
|
|
190
|
+
amount: viem.parseUnits(amount, spokeToken.decimals),
|
|
191
|
+
action: "repay"
|
|
156
192
|
},
|
|
157
193
|
spokeProvider
|
|
158
194
|
);
|
|
@@ -164,18 +200,18 @@ function useRepay(hubToken, spokeChainId) {
|
|
|
164
200
|
}
|
|
165
201
|
});
|
|
166
202
|
}
|
|
167
|
-
function useSupply(spokeToken) {
|
|
203
|
+
function useSupply(spokeToken, spokeProvider) {
|
|
168
204
|
const { sodax } = useSodaxContext();
|
|
169
|
-
const spokeProvider = useSpokeProvider(spokeToken.xChainId);
|
|
170
205
|
return reactQuery.useMutation({
|
|
171
206
|
mutationFn: async (amount) => {
|
|
172
207
|
if (!spokeProvider) {
|
|
173
208
|
throw new Error("spokeProvider is not found");
|
|
174
209
|
}
|
|
175
|
-
const response = await sodax.moneyMarket.
|
|
210
|
+
const response = await sodax.moneyMarket.supply(
|
|
176
211
|
{
|
|
177
212
|
token: spokeToken.address,
|
|
178
|
-
amount: viem.parseUnits(amount, spokeToken.decimals)
|
|
213
|
+
amount: viem.parseUnits(amount, spokeToken.decimals),
|
|
214
|
+
action: "supply"
|
|
179
215
|
},
|
|
180
216
|
spokeProvider
|
|
181
217
|
);
|
|
@@ -187,18 +223,19 @@ function useSupply(spokeToken) {
|
|
|
187
223
|
}
|
|
188
224
|
});
|
|
189
225
|
}
|
|
190
|
-
function useWithdraw(
|
|
226
|
+
function useWithdraw(spokeToken, spokeProvider) {
|
|
191
227
|
const { sodax } = useSodaxContext();
|
|
192
|
-
const spokeProvider = useSpokeProvider(spokeChainId);
|
|
193
228
|
return reactQuery.useMutation({
|
|
194
229
|
mutationFn: async (amount) => {
|
|
195
230
|
if (!spokeProvider) {
|
|
196
231
|
throw new Error("spokeProvider is not found");
|
|
197
232
|
}
|
|
198
|
-
const response = await sodax.moneyMarket.
|
|
233
|
+
const response = await sodax.moneyMarket.withdraw(
|
|
199
234
|
{
|
|
200
|
-
token:
|
|
201
|
-
|
|
235
|
+
token: spokeToken.address,
|
|
236
|
+
// vault token on hub chain decimals is 18
|
|
237
|
+
amount: viem.parseUnits(amount, 18),
|
|
238
|
+
action: "withdraw"
|
|
202
239
|
},
|
|
203
240
|
spokeProvider
|
|
204
241
|
);
|
|
@@ -210,104 +247,102 @@ function useWithdraw(hubToken, spokeChainId) {
|
|
|
210
247
|
}
|
|
211
248
|
});
|
|
212
249
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const tokens = sdk.hubAssets[xChainId];
|
|
216
|
-
Object.keys(tokens).forEach((tokenAddress) => {
|
|
217
|
-
const token = tokens[tokenAddress];
|
|
218
|
-
allXTokens.push({
|
|
219
|
-
xChainId,
|
|
220
|
-
symbol: token.symbol,
|
|
221
|
-
name: token.name,
|
|
222
|
-
decimals: token.decimal,
|
|
223
|
-
address: tokenAddress
|
|
224
|
-
});
|
|
225
|
-
allXTokens.push({
|
|
226
|
-
xChainId: "sonic",
|
|
227
|
-
symbol: token.symbol,
|
|
228
|
-
name: token.name,
|
|
229
|
-
decimals: token.decimal,
|
|
230
|
-
address: token.vault
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
});
|
|
234
|
-
var getSpokeTokenAddressByVault = (spokeChainId, vault) => {
|
|
235
|
-
const tokens = sdk.hubAssets[spokeChainId];
|
|
236
|
-
const token = Object.keys(tokens).find((tokenAddress) => tokens[tokenAddress].vault === vault);
|
|
237
|
-
if (!token) {
|
|
238
|
-
throw new Error("Token not found");
|
|
239
|
-
}
|
|
240
|
-
return token;
|
|
241
|
-
};
|
|
242
|
-
function useHubWalletAddress(spokeChainId, address, hubProvider) {
|
|
250
|
+
function useUserReservesData(spokeProvider, address, refetchInterval = 5e3) {
|
|
251
|
+
const { sodax } = useSodaxContext();
|
|
243
252
|
return reactQuery.useQuery({
|
|
244
|
-
queryKey: ["
|
|
253
|
+
queryKey: ["userReserves", spokeProvider?.chainConfig.chain.id, address],
|
|
245
254
|
queryFn: async () => {
|
|
246
|
-
if (!
|
|
247
|
-
|
|
248
|
-
const hubWalletAddress = await sdk.EvmWalletAbstraction.getUserHubWalletAddress(
|
|
249
|
-
spokeChainId,
|
|
250
|
-
address,
|
|
251
|
-
hubProvider
|
|
252
|
-
);
|
|
253
|
-
return hubWalletAddress;
|
|
254
|
-
} catch (error) {
|
|
255
|
-
console.log("error", error);
|
|
256
|
-
return null;
|
|
255
|
+
if (!spokeProvider) {
|
|
256
|
+
throw new Error("Spoke provider or address is not defined");
|
|
257
257
|
}
|
|
258
|
+
return await sodax.moneyMarket.data.getUserReservesData(spokeProvider);
|
|
258
259
|
},
|
|
259
|
-
enabled: !!
|
|
260
|
+
enabled: !!spokeProvider && !!address,
|
|
261
|
+
refetchInterval
|
|
260
262
|
});
|
|
261
263
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
const hubChainId = sodax.config?.hubProviderConfig?.chainConfig.chain.id ?? "sonic";
|
|
267
|
-
const hubWalletProvider = walletSdk.useWalletProvider(hubChainId);
|
|
268
|
-
const hubProvider = useHubProvider();
|
|
269
|
-
const { address } = walletSdk.useXAccount(spokeChainId);
|
|
270
|
-
const { data: hubWalletAddress } = useHubWalletAddress(
|
|
271
|
-
spokeChainId,
|
|
272
|
-
address,
|
|
273
|
-
hubProvider
|
|
274
|
-
);
|
|
275
|
-
const { data: userReserves } = reactQuery.useQuery({
|
|
276
|
-
queryKey: ["userReserves", hubWalletAddress],
|
|
264
|
+
function useReservesData() {
|
|
265
|
+
const { sodax } = useSodaxContext();
|
|
266
|
+
return reactQuery.useQuery({
|
|
267
|
+
queryKey: ["reservesData"],
|
|
277
268
|
queryFn: async () => {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
269
|
+
return await sodax.moneyMarket.data.getReservesData();
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function useMMAllowance(token, amount, action, spokeProvider) {
|
|
274
|
+
const { sodax } = useSodaxContext();
|
|
275
|
+
return reactQuery.useQuery({
|
|
276
|
+
queryKey: ["allowance", token.address, amount, action],
|
|
277
|
+
queryFn: async () => {
|
|
278
|
+
if (!spokeProvider) throw new Error("Spoke provider is required");
|
|
279
|
+
const allowance = await sodax.moneyMarket.isAllowanceValid(
|
|
280
|
+
{
|
|
281
|
+
token: token.address,
|
|
282
|
+
amount: viem.parseUnits(amount, token.decimals),
|
|
283
|
+
action
|
|
284
|
+
},
|
|
285
|
+
spokeProvider
|
|
286
|
+
);
|
|
287
|
+
if (allowance.ok) {
|
|
288
|
+
return allowance.value;
|
|
289
|
+
}
|
|
290
|
+
return false;
|
|
291
|
+
},
|
|
292
|
+
enabled: !!spokeProvider
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function useMMApprove(token, spokeProvider) {
|
|
296
|
+
const { sodax } = useSodaxContext();
|
|
297
|
+
const queryClient = reactQuery.useQueryClient();
|
|
298
|
+
const {
|
|
299
|
+
mutateAsync: approve,
|
|
300
|
+
isPending,
|
|
301
|
+
error,
|
|
302
|
+
reset: resetError
|
|
303
|
+
} = reactQuery.useMutation({
|
|
304
|
+
mutationFn: async ({ amount, action }) => {
|
|
305
|
+
if (!spokeProvider) {
|
|
306
|
+
throw new Error("Spoke provider not found");
|
|
307
|
+
}
|
|
308
|
+
const allowance = await sodax.moneyMarket.approve(
|
|
309
|
+
{
|
|
310
|
+
token: token.address,
|
|
311
|
+
amount: viem.parseUnits(amount, token.decimals),
|
|
312
|
+
action
|
|
313
|
+
},
|
|
314
|
+
spokeProvider
|
|
315
|
+
);
|
|
316
|
+
if (!allowance.ok) {
|
|
317
|
+
throw new Error("Failed to approve tokens");
|
|
318
|
+
}
|
|
319
|
+
return allowance.ok;
|
|
320
|
+
},
|
|
321
|
+
onSuccess: () => {
|
|
322
|
+
queryClient.invalidateQueries({ queryKey: ["allowance", token.address] });
|
|
323
|
+
}
|
|
304
324
|
});
|
|
305
|
-
return
|
|
325
|
+
return {
|
|
326
|
+
approve,
|
|
327
|
+
isLoading: isPending,
|
|
328
|
+
error,
|
|
329
|
+
resetError
|
|
330
|
+
};
|
|
306
331
|
}
|
|
307
332
|
var useQuote = (payload) => {
|
|
308
333
|
const { sodax } = useSodaxContext();
|
|
334
|
+
const queryKey = React.useMemo(() => {
|
|
335
|
+
if (!payload) return ["quote", void 0];
|
|
336
|
+
return [
|
|
337
|
+
"quote",
|
|
338
|
+
{
|
|
339
|
+
...payload,
|
|
340
|
+
amount: payload.amount.toString()
|
|
341
|
+
}
|
|
342
|
+
];
|
|
343
|
+
}, [payload]);
|
|
309
344
|
return reactQuery.useQuery({
|
|
310
|
-
queryKey
|
|
345
|
+
queryKey,
|
|
311
346
|
queryFn: async () => {
|
|
312
347
|
if (!payload) {
|
|
313
348
|
return void 0;
|
|
@@ -318,15 +353,21 @@ var useQuote = (payload) => {
|
|
|
318
353
|
refetchInterval: 3e3
|
|
319
354
|
});
|
|
320
355
|
};
|
|
321
|
-
function
|
|
356
|
+
function useSwap(spokeProvider) {
|
|
322
357
|
const { sodax } = useSodaxContext();
|
|
323
|
-
const
|
|
358
|
+
const queryClient = reactQuery.useQueryClient();
|
|
324
359
|
return reactQuery.useMutation({
|
|
325
360
|
mutationFn: async (params) => {
|
|
326
361
|
if (!spokeProvider) {
|
|
327
362
|
throw new Error("Spoke provider not found");
|
|
328
363
|
}
|
|
329
|
-
return sodax.solver.
|
|
364
|
+
return sodax.solver.swap({
|
|
365
|
+
intentParams: params,
|
|
366
|
+
spokeProvider
|
|
367
|
+
});
|
|
368
|
+
},
|
|
369
|
+
onSuccess: () => {
|
|
370
|
+
queryClient.invalidateQueries({ queryKey: ["xBalances"] });
|
|
330
371
|
}
|
|
331
372
|
});
|
|
332
373
|
}
|
|
@@ -341,26 +382,722 @@ var useStatus = (intent_tx_hash) => {
|
|
|
341
382
|
// 3s
|
|
342
383
|
});
|
|
343
384
|
};
|
|
344
|
-
|
|
345
|
-
const sodax =
|
|
346
|
-
return
|
|
385
|
+
function useSwapAllowance(params, spokeProvider) {
|
|
386
|
+
const { sodax } = useSodaxContext();
|
|
387
|
+
return reactQuery.useQuery({
|
|
388
|
+
queryKey: ["allowance", params],
|
|
389
|
+
queryFn: async () => {
|
|
390
|
+
if (!spokeProvider || !params) {
|
|
391
|
+
return false;
|
|
392
|
+
}
|
|
393
|
+
const allowance = await sodax.solver.isAllowanceValid({
|
|
394
|
+
intentParams: params,
|
|
395
|
+
spokeProvider
|
|
396
|
+
});
|
|
397
|
+
if (allowance.ok) {
|
|
398
|
+
return allowance.value;
|
|
399
|
+
}
|
|
400
|
+
return false;
|
|
401
|
+
},
|
|
402
|
+
enabled: !!spokeProvider && !!params,
|
|
403
|
+
refetchInterval: 2e3
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
function useSwapApprove(params, spokeProvider) {
|
|
407
|
+
const { sodax } = useSodaxContext();
|
|
408
|
+
const queryClient = reactQuery.useQueryClient();
|
|
409
|
+
const {
|
|
410
|
+
mutateAsync: approve,
|
|
411
|
+
isPending,
|
|
412
|
+
error,
|
|
413
|
+
reset: resetError
|
|
414
|
+
} = reactQuery.useMutation({
|
|
415
|
+
mutationFn: async ({ params: params2 }) => {
|
|
416
|
+
if (!spokeProvider) {
|
|
417
|
+
throw new Error("Spoke provider not found");
|
|
418
|
+
}
|
|
419
|
+
if (!params2) {
|
|
420
|
+
throw new Error("Swap Params not found");
|
|
421
|
+
}
|
|
422
|
+
const allowance = await sodax.solver.approve({
|
|
423
|
+
intentParams: params2,
|
|
424
|
+
spokeProvider
|
|
425
|
+
});
|
|
426
|
+
if (!allowance.ok) {
|
|
427
|
+
throw new Error("Failed to approve input token");
|
|
428
|
+
}
|
|
429
|
+
return allowance.ok;
|
|
430
|
+
},
|
|
431
|
+
onSuccess: () => {
|
|
432
|
+
queryClient.invalidateQueries({ queryKey: ["allowance", params] });
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
return {
|
|
436
|
+
approve,
|
|
437
|
+
isLoading: isPending,
|
|
438
|
+
error,
|
|
439
|
+
resetError
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
function useCancelSwap(spokeProvider) {
|
|
443
|
+
const { sodax } = useSodaxContext();
|
|
444
|
+
return reactQuery.useMutation({
|
|
445
|
+
mutationFn: async ({ intent, raw = false }) => {
|
|
446
|
+
if (!spokeProvider) {
|
|
447
|
+
throw new Error("Spoke provider not found");
|
|
448
|
+
}
|
|
449
|
+
return sodax.solver.cancelIntent(intent, spokeProvider, raw);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
var useBackendIntentByTxHash = (txHash) => {
|
|
454
|
+
const { sodax } = useSodaxContext();
|
|
455
|
+
return reactQuery.useQuery({
|
|
456
|
+
queryKey: ["backend", "intent", "txHash", txHash],
|
|
457
|
+
queryFn: async () => {
|
|
458
|
+
if (!txHash) {
|
|
459
|
+
return void 0;
|
|
460
|
+
}
|
|
461
|
+
return sodax.backendApiService.getIntentByTxHash(txHash);
|
|
462
|
+
},
|
|
463
|
+
enabled: !!txHash && txHash.length > 0,
|
|
464
|
+
retry: 3
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
var useBackendIntentByHash = (intentHash) => {
|
|
468
|
+
const { sodax } = useSodaxContext();
|
|
469
|
+
return reactQuery.useQuery({
|
|
470
|
+
queryKey: ["backend", "intent", "hash", intentHash],
|
|
471
|
+
queryFn: async () => {
|
|
472
|
+
if (!intentHash) {
|
|
473
|
+
return void 0;
|
|
474
|
+
}
|
|
475
|
+
return sodax.backendApiService.getIntentByHash(intentHash);
|
|
476
|
+
},
|
|
477
|
+
enabled: !!intentHash && intentHash.length > 0,
|
|
478
|
+
retry: 3
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
var useBackendOrderbook = (params) => {
|
|
482
|
+
const { sodax } = useSodaxContext();
|
|
483
|
+
return reactQuery.useQuery({
|
|
484
|
+
queryKey: ["backend", "solver", "orderbook", params],
|
|
485
|
+
queryFn: async () => {
|
|
486
|
+
if (!params || !params.offset || !params.limit) {
|
|
487
|
+
return void 0;
|
|
488
|
+
}
|
|
489
|
+
return sodax.backendApiService.getOrderbook(params);
|
|
490
|
+
},
|
|
491
|
+
enabled: !!params && !!params.offset && !!params.limit,
|
|
492
|
+
staleTime: 30 * 1e3,
|
|
493
|
+
// 30 seconds for real-time data
|
|
494
|
+
retry: 3
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
var useBackendMoneyMarketPosition = (userAddress) => {
|
|
498
|
+
const { sodax } = useSodaxContext();
|
|
499
|
+
return reactQuery.useQuery({
|
|
500
|
+
queryKey: ["backend", "moneymarket", "position", userAddress],
|
|
501
|
+
queryFn: async () => {
|
|
502
|
+
if (!userAddress) {
|
|
503
|
+
return void 0;
|
|
504
|
+
}
|
|
505
|
+
return sodax.backendApiService.getMoneyMarketPosition(userAddress);
|
|
506
|
+
},
|
|
507
|
+
enabled: !!userAddress && userAddress.length > 0,
|
|
508
|
+
retry: 3
|
|
509
|
+
});
|
|
510
|
+
};
|
|
511
|
+
var useBackendAllMoneyMarketAssets = () => {
|
|
512
|
+
const { sodax } = useSodaxContext();
|
|
513
|
+
return reactQuery.useQuery({
|
|
514
|
+
queryKey: ["backend", "moneymarket", "assets", "all"],
|
|
515
|
+
queryFn: async () => {
|
|
516
|
+
return sodax.backendApiService.getAllMoneyMarketAssets();
|
|
517
|
+
},
|
|
518
|
+
retry: 3
|
|
519
|
+
});
|
|
520
|
+
};
|
|
521
|
+
var useBackendMoneyMarketAsset = (reserveAddress) => {
|
|
522
|
+
const { sodax } = useSodaxContext();
|
|
523
|
+
return reactQuery.useQuery({
|
|
524
|
+
queryKey: ["backend", "moneymarket", "asset", reserveAddress],
|
|
525
|
+
queryFn: async () => {
|
|
526
|
+
if (!reserveAddress) {
|
|
527
|
+
return void 0;
|
|
528
|
+
}
|
|
529
|
+
return sodax.backendApiService.getMoneyMarketAsset(reserveAddress);
|
|
530
|
+
},
|
|
531
|
+
enabled: !!reserveAddress && reserveAddress.length > 0,
|
|
532
|
+
retry: 3
|
|
533
|
+
});
|
|
534
|
+
};
|
|
535
|
+
var useBackendMoneyMarketAssetBorrowers = (params) => {
|
|
536
|
+
const { sodax } = useSodaxContext();
|
|
537
|
+
return reactQuery.useQuery({
|
|
538
|
+
queryKey: ["backend", "moneymarket", "asset", "borrowers", params],
|
|
539
|
+
queryFn: async () => {
|
|
540
|
+
if (!params.reserveAddress || !params.offset || !params.limit) {
|
|
541
|
+
return void 0;
|
|
542
|
+
}
|
|
543
|
+
return sodax.backendApiService.getMoneyMarketAssetBorrowers(params.reserveAddress, {
|
|
544
|
+
offset: params.offset,
|
|
545
|
+
limit: params.limit
|
|
546
|
+
});
|
|
547
|
+
},
|
|
548
|
+
enabled: !!params.reserveAddress && !!params.offset && !!params.limit,
|
|
549
|
+
retry: 3
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
var useBackendMoneyMarketAssetSuppliers = (params) => {
|
|
553
|
+
const { sodax } = useSodaxContext();
|
|
554
|
+
return reactQuery.useQuery({
|
|
555
|
+
queryKey: ["backend", "moneymarket", "asset", "suppliers", params],
|
|
556
|
+
queryFn: async () => {
|
|
557
|
+
if (!params.reserveAddress || !params.offset || !params.limit) {
|
|
558
|
+
return void 0;
|
|
559
|
+
}
|
|
560
|
+
return sodax.backendApiService.getMoneyMarketAssetSuppliers(params.reserveAddress, {
|
|
561
|
+
offset: params.offset,
|
|
562
|
+
limit: params.limit
|
|
563
|
+
});
|
|
564
|
+
},
|
|
565
|
+
enabled: !!params.reserveAddress && !!params.offset && !!params.limit,
|
|
566
|
+
retry: 3
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
var useBackendAllMoneyMarketBorrowers = (params) => {
|
|
570
|
+
const { sodax } = useSodaxContext();
|
|
571
|
+
return reactQuery.useQuery({
|
|
572
|
+
queryKey: ["backend", "moneymarket", "borrowers", "all", params],
|
|
573
|
+
queryFn: async () => {
|
|
574
|
+
if (!params || !params.offset || !params.limit) {
|
|
575
|
+
return void 0;
|
|
576
|
+
}
|
|
577
|
+
return sodax.backendApiService.getAllMoneyMarketBorrowers(params);
|
|
578
|
+
},
|
|
579
|
+
enabled: !!params && !!params.offset && !!params.limit,
|
|
580
|
+
retry: 3
|
|
581
|
+
});
|
|
582
|
+
};
|
|
583
|
+
function useBridgeAllowance(params, spokeProvider) {
|
|
584
|
+
const { sodax } = useSodaxContext();
|
|
585
|
+
return reactQuery.useQuery({
|
|
586
|
+
queryKey: ["bridge-allowance", params],
|
|
587
|
+
queryFn: async () => {
|
|
588
|
+
if (!spokeProvider || !params) {
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
const allowance = await sodax.bridge.isAllowanceValid({
|
|
592
|
+
params,
|
|
593
|
+
spokeProvider
|
|
594
|
+
});
|
|
595
|
+
if (allowance.ok) {
|
|
596
|
+
return allowance.value;
|
|
597
|
+
}
|
|
598
|
+
return false;
|
|
599
|
+
},
|
|
600
|
+
enabled: !!spokeProvider && !!params
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
function useBridgeApprove(spokeProvider) {
|
|
604
|
+
const { sodax } = useSodaxContext();
|
|
605
|
+
const queryClient = reactQuery.useQueryClient();
|
|
606
|
+
const {
|
|
607
|
+
mutateAsync: approve,
|
|
608
|
+
isPending,
|
|
609
|
+
error,
|
|
610
|
+
reset: resetError
|
|
611
|
+
} = reactQuery.useMutation({
|
|
612
|
+
mutationFn: async (params) => {
|
|
613
|
+
if (!spokeProvider) {
|
|
614
|
+
throw new Error("Spoke provider not found");
|
|
615
|
+
}
|
|
616
|
+
const allowance = await sodax.bridge.approve({
|
|
617
|
+
params,
|
|
618
|
+
spokeProvider
|
|
619
|
+
});
|
|
620
|
+
if (!allowance.ok) {
|
|
621
|
+
throw new Error("Failed to approve tokens for bridge");
|
|
622
|
+
}
|
|
623
|
+
return true;
|
|
624
|
+
},
|
|
625
|
+
onSuccess: (_, params) => {
|
|
626
|
+
queryClient.invalidateQueries({ queryKey: ["bridge-allowance", params] });
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
return {
|
|
630
|
+
approve,
|
|
631
|
+
isLoading: isPending,
|
|
632
|
+
error,
|
|
633
|
+
resetError
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function useBridge(spokeProvider) {
|
|
637
|
+
const { sodax } = useSodaxContext();
|
|
638
|
+
return reactQuery.useMutation({
|
|
639
|
+
mutationFn: async (params) => {
|
|
640
|
+
if (!spokeProvider) {
|
|
641
|
+
throw new Error("Spoke provider not found");
|
|
642
|
+
}
|
|
643
|
+
const result = await sodax.bridge.bridge({
|
|
644
|
+
params,
|
|
645
|
+
spokeProvider
|
|
646
|
+
});
|
|
647
|
+
if (!result.ok) {
|
|
648
|
+
throw new Error(`Bridge failed: ${result.error.code}`);
|
|
649
|
+
}
|
|
650
|
+
return result;
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
function useGetBridgeableAmount(from, to) {
|
|
655
|
+
const { sodax } = useSodaxContext();
|
|
656
|
+
return reactQuery.useQuery({
|
|
657
|
+
queryKey: ["spoke-asset-manager-token-balance", from, to],
|
|
658
|
+
queryFn: async () => {
|
|
659
|
+
if (!from || !to) {
|
|
660
|
+
return 0n;
|
|
661
|
+
}
|
|
662
|
+
const result = await sodax.bridge.getBridgeableAmount(from, to);
|
|
663
|
+
if (result.ok) {
|
|
664
|
+
return result.value;
|
|
665
|
+
}
|
|
666
|
+
console.error("Error getting bridgeable amount:", result.error);
|
|
667
|
+
return 0n;
|
|
668
|
+
},
|
|
669
|
+
enabled: !!from && !!to
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
function useGetBridgeableTokens(from, to, token) {
|
|
673
|
+
const { sodax } = useSodaxContext();
|
|
674
|
+
return reactQuery.useQuery({
|
|
675
|
+
queryKey: ["bridgeable-tokens", from, to, token],
|
|
676
|
+
queryFn: async () => {
|
|
677
|
+
if (!from || !to || !token) {
|
|
678
|
+
return [];
|
|
679
|
+
}
|
|
680
|
+
const result = sodax.bridge.getBridgeableTokens(from, to, token);
|
|
681
|
+
if (result.ok) {
|
|
682
|
+
return result.value;
|
|
683
|
+
}
|
|
684
|
+
console.error("Error getting bridgeable tokens:", result.error);
|
|
685
|
+
return [];
|
|
686
|
+
},
|
|
687
|
+
enabled: !!from && !!to && !!token
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
function useStake(spokeProvider) {
|
|
691
|
+
const { sodax } = useSodaxContext();
|
|
692
|
+
return reactQuery.useMutation({
|
|
693
|
+
mutationFn: async (params) => {
|
|
694
|
+
if (!spokeProvider) {
|
|
695
|
+
throw new Error("Spoke provider not found");
|
|
696
|
+
}
|
|
697
|
+
const result = await sodax.staking.stake(params, spokeProvider);
|
|
698
|
+
if (!result.ok) {
|
|
699
|
+
throw new Error(`Stake failed: ${result.error.code}`);
|
|
700
|
+
}
|
|
701
|
+
return result.value;
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
function useStakeApprove(spokeProvider) {
|
|
706
|
+
const { sodax } = useSodaxContext();
|
|
707
|
+
return reactQuery.useMutation({
|
|
708
|
+
mutationFn: async (params) => {
|
|
709
|
+
if (!spokeProvider) {
|
|
710
|
+
throw new Error("Spoke provider not found");
|
|
711
|
+
}
|
|
712
|
+
const result = await sodax.staking.approve({
|
|
713
|
+
params: { ...params, action: "stake" },
|
|
714
|
+
spokeProvider
|
|
715
|
+
});
|
|
716
|
+
if (!result.ok) {
|
|
717
|
+
throw new Error(`Stake approval failed: ${result.error.code}`);
|
|
718
|
+
}
|
|
719
|
+
return result.value;
|
|
720
|
+
}
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
function useStakeAllowance(params, spokeProvider) {
|
|
724
|
+
const { sodax } = useSodaxContext();
|
|
725
|
+
return reactQuery.useQuery({
|
|
726
|
+
queryKey: ["soda", "stakeAllowance", params, spokeProvider?.chainConfig.chain.id],
|
|
727
|
+
queryFn: async () => {
|
|
728
|
+
if (!params || !spokeProvider) {
|
|
729
|
+
return false;
|
|
730
|
+
}
|
|
731
|
+
const result = await sodax.staking.isAllowanceValid({
|
|
732
|
+
params: { ...params, action: "stake" },
|
|
733
|
+
spokeProvider
|
|
734
|
+
});
|
|
735
|
+
if (!result.ok) {
|
|
736
|
+
throw new Error(`Allowance check failed: ${result.error.code}`);
|
|
737
|
+
}
|
|
738
|
+
return result.value;
|
|
739
|
+
},
|
|
740
|
+
enabled: !!params && !!spokeProvider,
|
|
741
|
+
refetchInterval: 5e3
|
|
742
|
+
// Refetch every 5 seconds
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
function useUnstake(spokeProvider) {
|
|
746
|
+
const { sodax } = useSodaxContext();
|
|
747
|
+
const queryClient = reactQuery.useQueryClient();
|
|
748
|
+
return reactQuery.useMutation({
|
|
749
|
+
mutationFn: async (params) => {
|
|
750
|
+
if (!spokeProvider) {
|
|
751
|
+
throw new Error("Spoke provider not found");
|
|
752
|
+
}
|
|
753
|
+
const result = await sodax.staking.unstake({ ...params, action: "unstake" }, spokeProvider);
|
|
754
|
+
if (!result.ok) {
|
|
755
|
+
throw new Error(`Unstake failed: ${result.error.code}`);
|
|
756
|
+
}
|
|
757
|
+
return result.value;
|
|
758
|
+
},
|
|
759
|
+
onSuccess: () => {
|
|
760
|
+
queryClient.invalidateQueries({ queryKey: ["stakingInfo"] });
|
|
761
|
+
queryClient.invalidateQueries({ queryKey: ["unstakingInfo"] });
|
|
762
|
+
queryClient.invalidateQueries({ queryKey: ["unstakingInfoWithPenalty"] });
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
function useClaim(spokeProvider) {
|
|
767
|
+
const { sodax } = useSodaxContext();
|
|
768
|
+
return reactQuery.useMutation({
|
|
769
|
+
mutationFn: async (params) => {
|
|
770
|
+
if (!spokeProvider) {
|
|
771
|
+
throw new Error("Spoke provider not found");
|
|
772
|
+
}
|
|
773
|
+
const result = await sodax.staking.claim({ ...params, action: "claim" }, spokeProvider);
|
|
774
|
+
if (!result.ok) {
|
|
775
|
+
throw new Error(`Claim failed: ${result.error.code}`);
|
|
776
|
+
}
|
|
777
|
+
return result.value;
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
function useCancelUnstake(spokeProvider) {
|
|
782
|
+
const { sodax } = useSodaxContext();
|
|
783
|
+
const queryClient = reactQuery.useQueryClient();
|
|
784
|
+
return reactQuery.useMutation({
|
|
785
|
+
mutationFn: async (params) => {
|
|
786
|
+
if (!spokeProvider) {
|
|
787
|
+
throw new Error("Spoke provider not available");
|
|
788
|
+
}
|
|
789
|
+
const result = await sodax.staking.cancelUnstake({ ...params, action: "cancelUnstake" }, spokeProvider);
|
|
790
|
+
if (!result.ok) {
|
|
791
|
+
throw new Error(`Cancel unstake failed: ${result.error.code}`);
|
|
792
|
+
}
|
|
793
|
+
return result.value;
|
|
794
|
+
},
|
|
795
|
+
onSuccess: () => {
|
|
796
|
+
queryClient.invalidateQueries({ queryKey: ["stakingInfo"] });
|
|
797
|
+
queryClient.invalidateQueries({ queryKey: ["unstakingInfo"] });
|
|
798
|
+
queryClient.invalidateQueries({ queryKey: ["unstakingInfoWithPenalty"] });
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
function useStakingInfo(spokeProvider, refetchInterval = 5e3) {
|
|
803
|
+
const { sodax } = useSodaxContext();
|
|
804
|
+
return reactQuery.useQuery({
|
|
805
|
+
queryKey: ["soda", "stakingInfo", spokeProvider?.chainConfig.chain.id],
|
|
806
|
+
queryFn: async () => {
|
|
807
|
+
if (!spokeProvider) {
|
|
808
|
+
throw new Error("Spoke provider not found");
|
|
809
|
+
}
|
|
810
|
+
const result = await sodax.staking.getStakingInfoFromSpoke(spokeProvider);
|
|
811
|
+
if (!result.ok) {
|
|
812
|
+
throw new Error(`Failed to fetch staking info: ${result.error.code}`);
|
|
813
|
+
}
|
|
814
|
+
return result.value;
|
|
815
|
+
},
|
|
816
|
+
enabled: !!spokeProvider,
|
|
817
|
+
refetchInterval
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
function useUnstakingInfoWithPenalty(userAddress, spokeProvider, refetchInterval = 5e3) {
|
|
821
|
+
const { sodax } = useSodaxContext();
|
|
822
|
+
return reactQuery.useQuery({
|
|
823
|
+
queryKey: ["soda", "unstakingInfoWithPenalty", spokeProvider?.chainConfig.chain.id, userAddress],
|
|
824
|
+
queryFn: async () => {
|
|
825
|
+
if (!spokeProvider) {
|
|
826
|
+
throw new Error("Spoke provider not found");
|
|
827
|
+
}
|
|
828
|
+
const penaltyResult = await sodax.staking.getUnstakingInfoWithPenalty(spokeProvider);
|
|
829
|
+
if (!penaltyResult.ok) {
|
|
830
|
+
throw new Error(`Failed to fetch unstaking info with penalty: ${penaltyResult.error.code}`);
|
|
831
|
+
}
|
|
832
|
+
return penaltyResult.value;
|
|
833
|
+
},
|
|
834
|
+
enabled: !!spokeProvider && !!userAddress,
|
|
835
|
+
refetchInterval
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
function useStakingConfig(refetchInterval = 3e4) {
|
|
839
|
+
const { sodax } = useSodaxContext();
|
|
840
|
+
return reactQuery.useQuery({
|
|
841
|
+
queryKey: ["soda", "stakingConfig"],
|
|
842
|
+
queryFn: async () => {
|
|
843
|
+
const result = await sodax.staking.getStakingConfig();
|
|
844
|
+
if (!result.ok) {
|
|
845
|
+
throw new Error(`Failed to fetch staking config: ${result.error.code}`);
|
|
846
|
+
}
|
|
847
|
+
return result.value;
|
|
848
|
+
},
|
|
849
|
+
refetchInterval
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
function useStakeRatio(amount, refetchInterval = 1e4) {
|
|
853
|
+
const { sodax } = useSodaxContext();
|
|
854
|
+
return reactQuery.useQuery({
|
|
855
|
+
queryKey: ["soda", "stakeRatio", amount?.toString()],
|
|
856
|
+
queryFn: async () => {
|
|
857
|
+
if (!amount || amount <= 0n) {
|
|
858
|
+
throw new Error("Amount must be greater than 0");
|
|
859
|
+
}
|
|
860
|
+
if (!sodax?.staking) {
|
|
861
|
+
throw new Error("Staking service not available");
|
|
862
|
+
}
|
|
863
|
+
const result = await sodax.staking.getStakeRatio(amount);
|
|
864
|
+
if (!result.ok) {
|
|
865
|
+
throw new Error(`Failed to fetch stake ratio: ${result.error.code}`);
|
|
866
|
+
}
|
|
867
|
+
return result.value;
|
|
868
|
+
},
|
|
869
|
+
enabled: !!amount && amount > 0n && !!sodax?.staking,
|
|
870
|
+
refetchInterval
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
function useInstantUnstakeRatio(amount, refetchInterval = 1e4) {
|
|
874
|
+
const { sodax } = useSodaxContext();
|
|
875
|
+
console.log("useInstantUnstakeRatio hook called with:", { amount: amount?.toString(), sodax: !!sodax });
|
|
876
|
+
return reactQuery.useQuery({
|
|
877
|
+
queryKey: ["soda", "instantUnstakeRatio", amount?.toString()],
|
|
878
|
+
queryFn: async () => {
|
|
879
|
+
console.log("useInstantUnstakeRatio queryFn called with amount:", amount?.toString());
|
|
880
|
+
if (!amount || amount <= 0n) {
|
|
881
|
+
throw new Error("Amount must be greater than 0");
|
|
882
|
+
}
|
|
883
|
+
if (!sodax?.staking) {
|
|
884
|
+
throw new Error("Staking service not available");
|
|
885
|
+
}
|
|
886
|
+
const result = await sodax.staking.getInstantUnstakeRatio(amount);
|
|
887
|
+
if (!result.ok) {
|
|
888
|
+
throw new Error(`Failed to fetch instant unstake ratio: ${result.error.code}`);
|
|
889
|
+
}
|
|
890
|
+
return result.value;
|
|
891
|
+
},
|
|
892
|
+
enabled: !!amount && amount > 0n && !!sodax?.staking,
|
|
893
|
+
refetchInterval
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
function useConvertedAssets(amount, refetchInterval = 1e4) {
|
|
897
|
+
const { sodax } = useSodaxContext();
|
|
898
|
+
console.log("useConvertedAssets hook called with:", { amount: amount?.toString(), sodax: !!sodax });
|
|
899
|
+
return reactQuery.useQuery({
|
|
900
|
+
queryKey: ["soda", "convertedAssets", amount?.toString()],
|
|
901
|
+
queryFn: async () => {
|
|
902
|
+
console.log("useConvertedAssets queryFn called with amount:", amount?.toString());
|
|
903
|
+
if (!amount || amount <= 0n) {
|
|
904
|
+
throw new Error("Amount must be greater than 0");
|
|
905
|
+
}
|
|
906
|
+
const result = await sodax.staking.getConvertedAssets(amount);
|
|
907
|
+
if (!result.ok) {
|
|
908
|
+
throw new Error(`Failed to fetch converted assets: ${result.error.code}`);
|
|
909
|
+
}
|
|
910
|
+
return result.value;
|
|
911
|
+
},
|
|
912
|
+
enabled: !!amount && amount > 0n && !!sodax?.staking,
|
|
913
|
+
refetchInterval
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
function useInstantUnstake(spokeProvider) {
|
|
917
|
+
const { sodax } = useSodaxContext();
|
|
918
|
+
return reactQuery.useMutation({
|
|
919
|
+
mutationFn: async (params) => {
|
|
920
|
+
if (!spokeProvider) {
|
|
921
|
+
throw new Error("spokeProvider is not found");
|
|
922
|
+
}
|
|
923
|
+
const result = await sodax.staking.instantUnstake({ ...params, action: "instantUnstake" }, spokeProvider);
|
|
924
|
+
if (!result.ok) {
|
|
925
|
+
throw new Error(`Instant unstake failed: ${result.error.code}`);
|
|
926
|
+
}
|
|
927
|
+
return result.value;
|
|
928
|
+
},
|
|
929
|
+
onError: (error) => {
|
|
930
|
+
console.error("Instant unstake error:", error);
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
}
|
|
934
|
+
function useUnstakeAllowance(params, spokeProvider) {
|
|
935
|
+
const { sodax } = useSodaxContext();
|
|
936
|
+
return reactQuery.useQuery({
|
|
937
|
+
queryKey: ["soda", "unstakeAllowance", params, spokeProvider?.chainConfig.chain.id],
|
|
938
|
+
queryFn: async () => {
|
|
939
|
+
if (!params || !spokeProvider) {
|
|
940
|
+
return false;
|
|
941
|
+
}
|
|
942
|
+
const result = await sodax.staking.isAllowanceValid({
|
|
943
|
+
params: { ...params, action: "unstake" },
|
|
944
|
+
spokeProvider
|
|
945
|
+
});
|
|
946
|
+
if (!result.ok) {
|
|
947
|
+
console.error(`Unstake allowance check failed: ${result.error.code}, error: ${result.error.error}`);
|
|
948
|
+
throw new Error(`Unstake allowance check failed: ${result.error.code}`);
|
|
949
|
+
}
|
|
950
|
+
return result.value;
|
|
951
|
+
},
|
|
952
|
+
enabled: !!params && !!spokeProvider,
|
|
953
|
+
refetchInterval: 5e3
|
|
954
|
+
// Refetch every 5 seconds
|
|
955
|
+
});
|
|
956
|
+
}
|
|
957
|
+
function useUnstakeApprove(spokeProvider) {
|
|
958
|
+
const { sodax } = useSodaxContext();
|
|
959
|
+
return reactQuery.useMutation({
|
|
960
|
+
mutationFn: async (params) => {
|
|
961
|
+
console.log("useUnstakeApprove called with params:", params);
|
|
962
|
+
if (!spokeProvider) {
|
|
963
|
+
throw new Error("Spoke provider not found");
|
|
964
|
+
}
|
|
965
|
+
const result = await sodax.staking.approve({
|
|
966
|
+
params: { ...params, action: "unstake" },
|
|
967
|
+
spokeProvider
|
|
968
|
+
});
|
|
969
|
+
if (!result.ok) {
|
|
970
|
+
throw new Error(`Unstake approval failed: ${result.error.code}`);
|
|
971
|
+
}
|
|
972
|
+
return result.value;
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
}
|
|
976
|
+
function useUnstakingInfo(userAddress, spokeProvider, refetchInterval = 5e3) {
|
|
977
|
+
const { sodax } = useSodaxContext();
|
|
978
|
+
return reactQuery.useQuery({
|
|
979
|
+
queryKey: ["soda", "unstakingInfoWithPenalty", spokeProvider?.chainConfig.chain.id, userAddress],
|
|
980
|
+
queryFn: async () => {
|
|
981
|
+
if (!spokeProvider || !userAddress) {
|
|
982
|
+
throw new Error("Spoke provider or user address not found");
|
|
983
|
+
}
|
|
984
|
+
const result = await sodax.staking.getUnstakingInfo(spokeProvider);
|
|
985
|
+
if (!result.ok) {
|
|
986
|
+
throw new Error(`Failed to fetch unstaking info: ${result.error.code}`);
|
|
987
|
+
}
|
|
988
|
+
return result.value;
|
|
989
|
+
},
|
|
990
|
+
enabled: !!spokeProvider && !!userAddress,
|
|
991
|
+
refetchInterval
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
function useInstantUnstakeApprove(spokeProvider) {
|
|
995
|
+
const { sodax } = useSodaxContext();
|
|
996
|
+
return reactQuery.useMutation({
|
|
997
|
+
mutationFn: async (params) => {
|
|
998
|
+
console.log("useInstantUnstakeApprove called with params:", params);
|
|
999
|
+
if (!spokeProvider) {
|
|
1000
|
+
throw new Error("Spoke provider not found");
|
|
1001
|
+
}
|
|
1002
|
+
const result = await sodax.staking.approve({
|
|
1003
|
+
params: { ...params, action: "instantUnstake" },
|
|
1004
|
+
spokeProvider
|
|
1005
|
+
});
|
|
1006
|
+
if (!result.ok) {
|
|
1007
|
+
throw new Error(`Instant unstake approval failed: ${result.error.code}`);
|
|
1008
|
+
}
|
|
1009
|
+
return result.value;
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
function useInstantUnstakeAllowance(params, spokeProvider) {
|
|
1014
|
+
const { sodax } = useSodaxContext();
|
|
1015
|
+
return reactQuery.useQuery({
|
|
1016
|
+
queryKey: ["soda", "instantUnstakeAllowance", params, spokeProvider?.chainConfig.chain.id],
|
|
1017
|
+
queryFn: async () => {
|
|
1018
|
+
if (!params || !spokeProvider) {
|
|
1019
|
+
return false;
|
|
1020
|
+
}
|
|
1021
|
+
const result = await sodax.staking.isAllowanceValid({
|
|
1022
|
+
params: { ...params, action: "instantUnstake" },
|
|
1023
|
+
spokeProvider
|
|
1024
|
+
});
|
|
1025
|
+
if (!result.ok) {
|
|
1026
|
+
console.error(`Unstake allowance check failed: ${result.error.code}, error: ${result.error.error}`);
|
|
1027
|
+
throw new Error(`Unstake allowance check failed: ${result.error.code}`);
|
|
1028
|
+
}
|
|
1029
|
+
return result.value;
|
|
1030
|
+
},
|
|
1031
|
+
enabled: !!params && !!spokeProvider,
|
|
1032
|
+
refetchInterval: 5e3
|
|
1033
|
+
// Refetch every 5 seconds
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
var SodaxProvider = ({ children, testnet = false, config, rpcConfig }) => {
|
|
1037
|
+
const sodax = new sdk.Sodax(config);
|
|
1038
|
+
return /* @__PURE__ */ React__default.default.createElement(SodaxContext.Provider, { value: { sodax, testnet, rpcConfig } }, children);
|
|
1039
|
+
};
|
|
1040
|
+
var getSpokeTokenAddressByVault = (spokeChainId, vault) => {
|
|
1041
|
+
const tokens = sdk.hubAssets[spokeChainId];
|
|
1042
|
+
const address = Object.keys(tokens).find(
|
|
1043
|
+
(tokenAddress) => tokens[tokenAddress].vault.toLowerCase() === vault.toLowerCase()
|
|
1044
|
+
);
|
|
1045
|
+
return address;
|
|
347
1046
|
};
|
|
348
1047
|
|
|
349
1048
|
exports.SodaxProvider = SodaxProvider;
|
|
350
|
-
exports.allXTokens = allXTokens;
|
|
351
1049
|
exports.getSpokeTokenAddressByVault = getSpokeTokenAddressByVault;
|
|
352
|
-
exports.
|
|
353
|
-
exports.
|
|
1050
|
+
exports.useBackendAllMoneyMarketAssets = useBackendAllMoneyMarketAssets;
|
|
1051
|
+
exports.useBackendAllMoneyMarketBorrowers = useBackendAllMoneyMarketBorrowers;
|
|
1052
|
+
exports.useBackendIntentByHash = useBackendIntentByHash;
|
|
1053
|
+
exports.useBackendIntentByTxHash = useBackendIntentByTxHash;
|
|
1054
|
+
exports.useBackendMoneyMarketAsset = useBackendMoneyMarketAsset;
|
|
1055
|
+
exports.useBackendMoneyMarketAssetBorrowers = useBackendMoneyMarketAssetBorrowers;
|
|
1056
|
+
exports.useBackendMoneyMarketAssetSuppliers = useBackendMoneyMarketAssetSuppliers;
|
|
1057
|
+
exports.useBackendMoneyMarketPosition = useBackendMoneyMarketPosition;
|
|
1058
|
+
exports.useBackendOrderbook = useBackendOrderbook;
|
|
354
1059
|
exports.useBorrow = useBorrow;
|
|
355
|
-
exports.
|
|
1060
|
+
exports.useBridge = useBridge;
|
|
1061
|
+
exports.useBridgeAllowance = useBridgeAllowance;
|
|
1062
|
+
exports.useBridgeApprove = useBridgeApprove;
|
|
1063
|
+
exports.useCancelSwap = useCancelSwap;
|
|
1064
|
+
exports.useCancelUnstake = useCancelUnstake;
|
|
1065
|
+
exports.useClaim = useClaim;
|
|
1066
|
+
exports.useConvertedAssets = useConvertedAssets;
|
|
1067
|
+
exports.useDeriveUserWalletAddress = useDeriveUserWalletAddress;
|
|
1068
|
+
exports.useEstimateGas = useEstimateGas;
|
|
1069
|
+
exports.useGetBridgeableAmount = useGetBridgeableAmount;
|
|
1070
|
+
exports.useGetBridgeableTokens = useGetBridgeableTokens;
|
|
356
1071
|
exports.useHubProvider = useHubProvider;
|
|
357
|
-
exports.
|
|
1072
|
+
exports.useInstantUnstake = useInstantUnstake;
|
|
1073
|
+
exports.useInstantUnstakeAllowance = useInstantUnstakeAllowance;
|
|
1074
|
+
exports.useInstantUnstakeApprove = useInstantUnstakeApprove;
|
|
1075
|
+
exports.useInstantUnstakeRatio = useInstantUnstakeRatio;
|
|
1076
|
+
exports.useMMAllowance = useMMAllowance;
|
|
1077
|
+
exports.useMMApprove = useMMApprove;
|
|
358
1078
|
exports.useQuote = useQuote;
|
|
359
1079
|
exports.useRepay = useRepay;
|
|
1080
|
+
exports.useRequestTrustline = useRequestTrustline;
|
|
1081
|
+
exports.useReservesData = useReservesData;
|
|
360
1082
|
exports.useSodaxContext = useSodaxContext;
|
|
361
1083
|
exports.useSpokeProvider = useSpokeProvider;
|
|
1084
|
+
exports.useStake = useStake;
|
|
1085
|
+
exports.useStakeAllowance = useStakeAllowance;
|
|
1086
|
+
exports.useStakeApprove = useStakeApprove;
|
|
1087
|
+
exports.useStakeRatio = useStakeRatio;
|
|
1088
|
+
exports.useStakingConfig = useStakingConfig;
|
|
1089
|
+
exports.useStakingInfo = useStakingInfo;
|
|
362
1090
|
exports.useStatus = useStatus;
|
|
1091
|
+
exports.useStellarTrustlineCheck = useStellarTrustlineCheck;
|
|
363
1092
|
exports.useSupply = useSupply;
|
|
1093
|
+
exports.useSwap = useSwap;
|
|
1094
|
+
exports.useSwapAllowance = useSwapAllowance;
|
|
1095
|
+
exports.useSwapApprove = useSwapApprove;
|
|
1096
|
+
exports.useUnstake = useUnstake;
|
|
1097
|
+
exports.useUnstakeAllowance = useUnstakeAllowance;
|
|
1098
|
+
exports.useUnstakeApprove = useUnstakeApprove;
|
|
1099
|
+
exports.useUnstakingInfo = useUnstakingInfo;
|
|
1100
|
+
exports.useUnstakingInfoWithPenalty = useUnstakingInfoWithPenalty;
|
|
364
1101
|
exports.useUserReservesData = useUserReservesData;
|
|
365
1102
|
exports.useWithdraw = useWithdraw;
|
|
366
1103
|
//# sourceMappingURL=index.js.map
|