@sodax/dapp-kit 2.2.0-rc.5 → 2.2.0-rc.7
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 +77 -7
- package/dist/index.d.ts +382 -14
- package/dist/index.mjs +336 -38
- package/package.json +4 -4
- package/src/hooks/_mutationContract.test.ts +4 -0
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.test.ts +144 -0
- package/src/hooks/bridge/getBridgeDetailedStatusRefetchInterval.ts +52 -0
- package/src/hooks/bridge/index.ts +2 -0
- package/src/hooks/bridge/useBridgeDetailedStatus.test.ts +93 -0
- package/src/hooks/bridge/useBridgeDetailedStatus.ts +79 -0
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.test.ts +81 -0
- package/src/hooks/bridgeApi/getBridgeSubmitTxStatusRefetchInterval.ts +25 -0
- package/src/hooks/bridgeApi/useBridgeApiAllowance.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiApprove.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiBridgeableAmount.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiCreateBridgeIntent.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiFee.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiIsBridgeable.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiSubmitTx.ts +5 -3
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.test.ts +63 -0
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts +7 -10
- package/src/hooks/bridgeApi/useBridgeApiTokens.ts +2 -1
- package/src/hooks/bridgeApi/useBridgeApiTokensByChain.ts +2 -1
- package/src/hooks/leverageYield/index.ts +13 -0
- package/src/hooks/leverageYield/useApproveLeveragePositionFunding.ts +48 -0
- package/src/hooks/leverageYield/useLeveragePositionAccount.ts +45 -0
- package/src/hooks/leverageYield/useLeveragePositionCollateral.ts +47 -0
- package/src/hooks/leverageYield/useLeveragePositionFundingAllowance.ts +51 -0
- package/src/hooks/leverageYield/useLeveragePositionInfo.ts +39 -0
- package/src/hooks/leverageYield/useLeveragePositionPayoutAddress.ts +36 -0
- package/src/hooks/leverageYield/useLeveragePositionPending.ts +48 -0
- package/src/hooks/leverageYield/useLeveragePositions.ts +41 -0
- package/src/hooks/leverageYield/useLeveragePositionsForUser.ts +45 -0
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.test.ts +131 -0
- package/src/hooks/leverageYield/useLeverageYieldDetailedStatus.ts +83 -0
- package/src/hooks/leverageYield/useLeverageYieldVaultSwap.ts +13 -3
- package/src/hooks/leverageYield/useOpenLeveragePosition.ts +59 -0
- package/src/hooks/leverageYield/useRunLeveragePositionOperation.ts +63 -0
- package/src/hooks/leverageYield/useSubmitLeveragePositionIntent.ts +55 -0
- package/src/hooks/leverageYieldApi/index.ts +2 -2
- package/src/hooks/mm/index.ts +1 -0
- package/src/hooks/mm/useEModes.ts +31 -0
- package/src/hooks/shared/notFoundStreak.ts +59 -0
- package/src/hooks/shared/retryUnlessAuthFailure.ts +1 -1
- package/src/hooks/{swap/getSwapStatusRefetchInterval.test.ts → shared/solverStatusPolicy.test.ts} +25 -25
- package/src/hooks/shared/solverStatusPolicy.ts +117 -0
- package/src/hooks/swap/useDetailedStatus.test.ts +65 -21
- package/src/hooks/swap/useDetailedStatus.ts +9 -9
- package/src/hooks/swap/useStatus.ts +4 -7
- package/src/hooks/swapsApi/index.ts +2 -2
- package/src/hooks/swapsApi/useSwapsApiSubmitTxStatus.ts +2 -2
- package/src/hooks/swap/getSwapStatusRefetchInterval.ts +0 -126
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSodaxError, isAuthFailure, ChainKeys, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, RadfiApiError, normalizePsbtToBase64, ClService, SPONSOR_CONFIG_TTL_MS, Sodax, SolverIntentStatusCode,
|
|
1
|
+
import { isSodaxError, isAuthFailure, ChainKeys, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, RadfiApiError, normalizePsbtToBase64, DETAILED_STATUS_NOT_DELIVERED, ClService, SPONSOR_CONFIG_TTL_MS, Sodax, SolverIntentStatusCode, isApprovalSupportedChainKeyType, isHubChainKeyType, isEvmSpokeOnlyChainKeyType, getEvmViemChain, isStellarChainKeyType } from '@sodax/sdk';
|
|
2
2
|
export * from '@sodax/sdk';
|
|
3
3
|
import { useMutation, useQuery, useQueryClient, useQueries, QueryClient, MutationCache } from '@tanstack/react-query';
|
|
4
4
|
import { createContext, useCallback, useContext, useRef, useState, useEffect, useMemo } from 'react';
|
|
@@ -1087,6 +1087,14 @@ function useUserFormattedSummary({
|
|
|
1087
1087
|
...queryOptions
|
|
1088
1088
|
});
|
|
1089
1089
|
}
|
|
1090
|
+
function useEModes({ queryOptions } = {}) {
|
|
1091
|
+
const { sodax } = useSodaxContext();
|
|
1092
|
+
return useQuery({
|
|
1093
|
+
queryKey: ["moneyMarket", "eModes"],
|
|
1094
|
+
queryFn: () => sodax.moneyMarket.data.getEModesHumanized(),
|
|
1095
|
+
...queryOptions
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1090
1098
|
function feeKeyPart(fee) {
|
|
1091
1099
|
if (!fee) return void 0;
|
|
1092
1100
|
return "amount" in fee ? { ...fee, amount: fee.amount.toString() } : fee;
|
|
@@ -1141,6 +1149,8 @@ function useSwap({
|
|
|
1141
1149
|
}
|
|
1142
1150
|
});
|
|
1143
1151
|
}
|
|
1152
|
+
|
|
1153
|
+
// src/hooks/shared/notFoundStreak.ts
|
|
1144
1154
|
var STATUS_POLL_MS = 3e3;
|
|
1145
1155
|
var MAX_NOT_FOUND_POLLS = 40;
|
|
1146
1156
|
var INITIAL_NOT_FOUND_STREAK = {
|
|
@@ -1148,21 +1158,10 @@ var INITIAL_NOT_FOUND_STREAK = {
|
|
|
1148
1158
|
seenUpdates: 0,
|
|
1149
1159
|
consecutiveNotFound: 0
|
|
1150
1160
|
};
|
|
1151
|
-
function
|
|
1152
|
-
|
|
1153
|
-
if (status === SolverIntentStatusCode.SOLVED || status === SolverIntentStatusCode.FAILED) {
|
|
1154
|
-
return false;
|
|
1155
|
-
}
|
|
1156
|
-
if (status === SolverIntentStatusCode.NOT_FOUND && consecutiveNotFound >= MAX_NOT_FOUND_POLLS) {
|
|
1157
|
-
return false;
|
|
1158
|
-
}
|
|
1159
|
-
return STATUS_POLL_MS;
|
|
1160
|
-
}
|
|
1161
|
-
function nextNotFoundStreak(data, previousStreak) {
|
|
1162
|
-
const status = data?.ok ? data.value.status : void 0;
|
|
1163
|
-
return status === SolverIntentStatusCode.NOT_FOUND ? previousStreak + 1 : 0;
|
|
1161
|
+
function nextNotFoundStreak(isAmbiguousMiss, previousStreak) {
|
|
1162
|
+
return isAmbiguousMiss ? previousStreak + 1 : 0;
|
|
1164
1163
|
}
|
|
1165
|
-
function advanceNotFoundStreak(state, pollKey,
|
|
1164
|
+
function advanceNotFoundStreak(state, pollKey, isAmbiguousMiss, dataUpdateCount) {
|
|
1166
1165
|
if (state.pollKey !== pollKey) {
|
|
1167
1166
|
state = { pollKey, seenUpdates: 0, consecutiveNotFound: 0 };
|
|
1168
1167
|
}
|
|
@@ -1172,9 +1171,22 @@ function advanceNotFoundStreak(state, pollKey, data, dataUpdateCount) {
|
|
|
1172
1171
|
return {
|
|
1173
1172
|
pollKey,
|
|
1174
1173
|
seenUpdates: dataUpdateCount,
|
|
1175
|
-
consecutiveNotFound: nextNotFoundStreak(
|
|
1174
|
+
consecutiveNotFound: nextNotFoundStreak(isAmbiguousMiss, state.consecutiveNotFound)
|
|
1176
1175
|
};
|
|
1177
1176
|
}
|
|
1177
|
+
function getSolverStatusRefetchInterval(data, consecutiveNotFound) {
|
|
1178
|
+
const status = data?.ok ? data.value.status : void 0;
|
|
1179
|
+
if (status === SolverIntentStatusCode.SOLVED || status === SolverIntentStatusCode.FAILED) {
|
|
1180
|
+
return false;
|
|
1181
|
+
}
|
|
1182
|
+
if (status === SolverIntentStatusCode.NOT_FOUND && consecutiveNotFound >= MAX_NOT_FOUND_POLLS) {
|
|
1183
|
+
return false;
|
|
1184
|
+
}
|
|
1185
|
+
return STATUS_POLL_MS;
|
|
1186
|
+
}
|
|
1187
|
+
function isSolverNotFound(data) {
|
|
1188
|
+
return (data?.ok ? data.value.status : void 0) === SolverIntentStatusCode.NOT_FOUND;
|
|
1189
|
+
}
|
|
1178
1190
|
function toNotFoundBudgetRead(data) {
|
|
1179
1191
|
if (data === void 0) return void 0;
|
|
1180
1192
|
if (data.ok) {
|
|
@@ -1182,12 +1194,13 @@ function toNotFoundBudgetRead(data) {
|
|
|
1182
1194
|
}
|
|
1183
1195
|
return data.error?.context?.reason === DETAILED_STATUS_NOT_DELIVERED ? { ok: true, value: { status: SolverIntentStatusCode.NOT_FOUND } } : void 0;
|
|
1184
1196
|
}
|
|
1185
|
-
function
|
|
1197
|
+
function getSolverDetailedStatusRefetchInterval(data, consecutiveNotFound) {
|
|
1198
|
+
if (data && !data.ok && isAuthFailure(data.error)) return false;
|
|
1186
1199
|
if (data?.ok && data.value.source === "backend") {
|
|
1187
1200
|
const { status } = data.value.data;
|
|
1188
1201
|
return status === "solved" || status === "failed" ? false : STATUS_POLL_MS;
|
|
1189
1202
|
}
|
|
1190
|
-
return
|
|
1203
|
+
return getSolverStatusRefetchInterval(toNotFoundBudgetRead(data), consecutiveNotFound);
|
|
1191
1204
|
}
|
|
1192
1205
|
|
|
1193
1206
|
// src/hooks/swap/useStatus.ts
|
|
@@ -1209,10 +1222,10 @@ var useStatus = ({
|
|
|
1209
1222
|
notFoundStreakRef.current = advanceNotFoundStreak(
|
|
1210
1223
|
notFoundStreakRef.current,
|
|
1211
1224
|
intentTxHash,
|
|
1212
|
-
query.state.data,
|
|
1225
|
+
isSolverNotFound(query.state.data),
|
|
1213
1226
|
query.state.dataUpdateCount
|
|
1214
1227
|
);
|
|
1215
|
-
return
|
|
1228
|
+
return getSolverStatusRefetchInterval(query.state.data, notFoundStreakRef.current.consecutiveNotFound);
|
|
1216
1229
|
},
|
|
1217
1230
|
...queryOptions
|
|
1218
1231
|
});
|
|
@@ -1237,10 +1250,10 @@ var useDetailedStatus = ({
|
|
|
1237
1250
|
notFoundStreakRef.current = advanceNotFoundStreak(
|
|
1238
1251
|
notFoundStreakRef.current,
|
|
1239
1252
|
pollKey,
|
|
1240
|
-
toNotFoundBudgetRead(query.state.data),
|
|
1253
|
+
isSolverNotFound(toNotFoundBudgetRead(query.state.data)),
|
|
1241
1254
|
query.state.dataUpdateCount
|
|
1242
1255
|
);
|
|
1243
|
-
return
|
|
1256
|
+
return getSolverDetailedStatusRefetchInterval(query.state.data, notFoundStreakRef.current.consecutiveNotFound);
|
|
1244
1257
|
},
|
|
1245
1258
|
...queryOptions
|
|
1246
1259
|
});
|
|
@@ -2029,6 +2042,19 @@ var useSwapsApiSubmitTxStatus = ({
|
|
|
2029
2042
|
...queryOptions
|
|
2030
2043
|
});
|
|
2031
2044
|
};
|
|
2045
|
+
function isBridgeNotDelivered(data) {
|
|
2046
|
+
return data !== void 0 && !data.ok && data.error?.context?.reason === DETAILED_STATUS_NOT_DELIVERED;
|
|
2047
|
+
}
|
|
2048
|
+
function getBridgeDetailedStatusRefetchInterval(data, consecutiveNotFound) {
|
|
2049
|
+
if (data?.ok) {
|
|
2050
|
+
if (data.value.source === "relay") return false;
|
|
2051
|
+
const { status, abandonedAt } = data.value.data;
|
|
2052
|
+
return status === "executed" || status === "failed" || abandonedAt ? false : STATUS_POLL_MS;
|
|
2053
|
+
}
|
|
2054
|
+
if (data && !data.ok && isAuthFailure(data.error)) return false;
|
|
2055
|
+
if (isBridgeNotDelivered(data) && consecutiveNotFound >= MAX_NOT_FOUND_POLLS) return false;
|
|
2056
|
+
return STATUS_POLL_MS;
|
|
2057
|
+
}
|
|
2032
2058
|
function useBridge({
|
|
2033
2059
|
mutationOptions
|
|
2034
2060
|
} = {}) {
|
|
@@ -2044,6 +2070,35 @@ function useBridge({
|
|
|
2044
2070
|
}
|
|
2045
2071
|
});
|
|
2046
2072
|
}
|
|
2073
|
+
var useBridgeDetailedStatus = ({
|
|
2074
|
+
params,
|
|
2075
|
+
queryOptions
|
|
2076
|
+
} = {}) => {
|
|
2077
|
+
const { sodax } = useSodaxContext();
|
|
2078
|
+
const srcChainKey = params?.srcChainKey;
|
|
2079
|
+
const srcTxHash = params?.srcTxHash;
|
|
2080
|
+
const apiConfig = params?.apiConfig;
|
|
2081
|
+
const pollKey = srcChainKey && srcTxHash ? `${srcChainKey}:${srcTxHash}` : void 0;
|
|
2082
|
+
const notFoundStreakRef = useRef({ ...INITIAL_NOT_FOUND_STREAK });
|
|
2083
|
+
return useQuery({
|
|
2084
|
+
queryKey: ["bridge", "detailedStatus", srcChainKey, srcTxHash],
|
|
2085
|
+
queryFn: async () => {
|
|
2086
|
+
if (!srcChainKey || !srcTxHash) return void 0;
|
|
2087
|
+
return sodax.bridge.getDetailedStatus({ srcChainKey, srcTxHash }, apiConfig);
|
|
2088
|
+
},
|
|
2089
|
+
enabled: !!srcChainKey && !!srcTxHash,
|
|
2090
|
+
refetchInterval: (query) => {
|
|
2091
|
+
notFoundStreakRef.current = advanceNotFoundStreak(
|
|
2092
|
+
notFoundStreakRef.current,
|
|
2093
|
+
pollKey,
|
|
2094
|
+
isBridgeNotDelivered(query.state.data),
|
|
2095
|
+
query.state.dataUpdateCount
|
|
2096
|
+
);
|
|
2097
|
+
return getBridgeDetailedStatusRefetchInterval(query.state.data, notFoundStreakRef.current.consecutiveNotFound);
|
|
2098
|
+
},
|
|
2099
|
+
...queryOptions
|
|
2100
|
+
});
|
|
2101
|
+
};
|
|
2047
2102
|
function useBridgeAllowance({
|
|
2048
2103
|
params,
|
|
2049
2104
|
queryOptions
|
|
@@ -2155,7 +2210,7 @@ var useBridgeApiAllowance = ({
|
|
|
2155
2210
|
return unwrapResult(await sodax.api.bridge.checkAllowance(body, apiConfig));
|
|
2156
2211
|
},
|
|
2157
2212
|
enabled: !!body,
|
|
2158
|
-
retry:
|
|
2213
|
+
retry: retryUnlessAuthFailure,
|
|
2159
2214
|
...queryOptions
|
|
2160
2215
|
});
|
|
2161
2216
|
};
|
|
@@ -2167,7 +2222,7 @@ var useBridgeApiApprove = ({
|
|
|
2167
2222
|
const { sodax } = useSodaxContext();
|
|
2168
2223
|
return useSafeMutation({
|
|
2169
2224
|
mutationKey: ["bridgeApi", "approve"],
|
|
2170
|
-
retry:
|
|
2225
|
+
retry: retryUnlessAuthFailure,
|
|
2171
2226
|
...mutationOptions,
|
|
2172
2227
|
mutationFn: async ({ body, apiConfig }) => unwrapResult(await sodax.api.bridge.approve(body, apiConfig))
|
|
2173
2228
|
});
|
|
@@ -2210,7 +2265,7 @@ var useBridgeApiBridgeableAmount = ({
|
|
|
2210
2265
|
return unwrapResult(await sodax.api.bridge.getBridgeableAmount(body, apiConfig));
|
|
2211
2266
|
},
|
|
2212
2267
|
enabled: !!body,
|
|
2213
|
-
retry:
|
|
2268
|
+
retry: retryUnlessAuthFailure,
|
|
2214
2269
|
...queryOptions
|
|
2215
2270
|
});
|
|
2216
2271
|
};
|
|
@@ -2222,7 +2277,7 @@ var useBridgeApiCreateBridgeIntent = ({
|
|
|
2222
2277
|
const { sodax } = useSodaxContext();
|
|
2223
2278
|
return useSafeMutation({
|
|
2224
2279
|
mutationKey: ["bridgeApi", "createBridgeIntent"],
|
|
2225
|
-
retry:
|
|
2280
|
+
retry: retryUnlessAuthFailure,
|
|
2226
2281
|
...mutationOptions,
|
|
2227
2282
|
mutationFn: async ({ body, apiConfig }) => unwrapResult(await sodax.api.bridge.createBridgeIntent(body, apiConfig))
|
|
2228
2283
|
});
|
|
@@ -2241,7 +2296,7 @@ var useBridgeApiFee = ({
|
|
|
2241
2296
|
return unwrapResult(await sodax.api.bridge.getFee(body, apiConfig));
|
|
2242
2297
|
},
|
|
2243
2298
|
enabled: !!body,
|
|
2244
|
-
retry:
|
|
2299
|
+
retry: retryUnlessAuthFailure,
|
|
2245
2300
|
...queryOptions
|
|
2246
2301
|
});
|
|
2247
2302
|
};
|
|
@@ -2259,7 +2314,7 @@ var useBridgeApiIsBridgeable = ({
|
|
|
2259
2314
|
return unwrapResult(await sodax.api.bridge.isBridgeable(body, apiConfig));
|
|
2260
2315
|
},
|
|
2261
2316
|
enabled: !!body,
|
|
2262
|
-
retry:
|
|
2317
|
+
retry: retryUnlessAuthFailure,
|
|
2263
2318
|
...queryOptions
|
|
2264
2319
|
});
|
|
2265
2320
|
};
|
|
@@ -2271,11 +2326,19 @@ var useBridgeApiSubmitTx = ({
|
|
|
2271
2326
|
const { sodax } = useSodaxContext();
|
|
2272
2327
|
return useSafeMutation({
|
|
2273
2328
|
mutationKey: ["bridgeApi", "submitTx"],
|
|
2274
|
-
retry:
|
|
2329
|
+
retry: retryUnlessAuthFailure,
|
|
2275
2330
|
...mutationOptions,
|
|
2276
2331
|
mutationFn: async ({ request, apiConfig }) => unwrapResult(await sodax.api.bridge.submitTx(request, apiConfig))
|
|
2277
2332
|
});
|
|
2278
2333
|
};
|
|
2334
|
+
var BRIDGE_SUBMIT_TX_STATUS_POLL_MS = 1e3;
|
|
2335
|
+
function getBridgeSubmitTxStatusRefetchInterval(error, data) {
|
|
2336
|
+
if (isAuthFailure(error)) return false;
|
|
2337
|
+
if (data?.status === "executed" || data?.status === "failed" || data?.abandonedAt) return false;
|
|
2338
|
+
return BRIDGE_SUBMIT_TX_STATUS_POLL_MS;
|
|
2339
|
+
}
|
|
2340
|
+
|
|
2341
|
+
// src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts
|
|
2279
2342
|
var useBridgeApiSubmitTxStatus = ({
|
|
2280
2343
|
params,
|
|
2281
2344
|
queryOptions
|
|
@@ -2291,12 +2354,8 @@ var useBridgeApiSubmitTxStatus = ({
|
|
|
2291
2354
|
return unwrapResult(await sodax.api.bridge.getSubmitTxStatus({ txHash, srcChainKey }, apiConfig));
|
|
2292
2355
|
},
|
|
2293
2356
|
enabled: !!txHash && txHash.length > 0 && !!srcChainKey,
|
|
2294
|
-
retry:
|
|
2295
|
-
refetchInterval: (query) =>
|
|
2296
|
-
const data = query.state.data?.data;
|
|
2297
|
-
if (data?.status === "executed" || data?.status === "failed" || data?.abandonedAt) return false;
|
|
2298
|
-
return 1e3;
|
|
2299
|
-
},
|
|
2357
|
+
retry: retryUnlessAuthFailure,
|
|
2358
|
+
refetchInterval: (query) => getBridgeSubmitTxStatusRefetchInterval(query.state.error, query.state.data?.data),
|
|
2300
2359
|
...queryOptions
|
|
2301
2360
|
});
|
|
2302
2361
|
};
|
|
@@ -2309,7 +2368,7 @@ var useBridgeApiTokens = ({
|
|
|
2309
2368
|
return useQuery({
|
|
2310
2369
|
queryKey: ["bridgeApi", "tokens"],
|
|
2311
2370
|
queryFn: async () => unwrapResult(await sodax.api.bridge.getTokens(apiConfig)),
|
|
2312
|
-
retry:
|
|
2371
|
+
retry: retryUnlessAuthFailure,
|
|
2313
2372
|
...queryOptions
|
|
2314
2373
|
});
|
|
2315
2374
|
};
|
|
@@ -2327,7 +2386,7 @@ var useBridgeApiTokensByChain = ({
|
|
|
2327
2386
|
return unwrapResult(await sodax.api.bridge.getTokensByChain(chainKey, apiConfig));
|
|
2328
2387
|
},
|
|
2329
2388
|
enabled: !!chainKey && chainKey.length > 0,
|
|
2330
|
-
retry:
|
|
2389
|
+
retry: retryUnlessAuthFailure,
|
|
2331
2390
|
...queryOptions
|
|
2332
2391
|
});
|
|
2333
2392
|
};
|
|
@@ -3821,6 +3880,35 @@ function useLeverageYieldNotifySolver({
|
|
|
3821
3880
|
mutationFn: async (vars) => unwrapResult(await sodax.leverageYield.notifySolver(vars))
|
|
3822
3881
|
});
|
|
3823
3882
|
}
|
|
3883
|
+
var useLeverageYieldDetailedStatus = ({
|
|
3884
|
+
params,
|
|
3885
|
+
queryOptions
|
|
3886
|
+
} = {}) => {
|
|
3887
|
+
const { sodax } = useSodaxContext();
|
|
3888
|
+
const srcChainKey = params?.srcChainKey;
|
|
3889
|
+
const srcTxHash = params?.srcTxHash;
|
|
3890
|
+
const apiConfig = params?.apiConfig;
|
|
3891
|
+
const pollKey = srcChainKey && srcTxHash ? `${srcChainKey}:${srcTxHash}` : void 0;
|
|
3892
|
+
const notFoundStreakRef = useRef({ ...INITIAL_NOT_FOUND_STREAK });
|
|
3893
|
+
return useQuery({
|
|
3894
|
+
queryKey: ["leverageYield", "detailedStatus", srcChainKey, srcTxHash],
|
|
3895
|
+
queryFn: async () => {
|
|
3896
|
+
if (!srcChainKey || !srcTxHash) return void 0;
|
|
3897
|
+
return sodax.leverageYield.getDetailedStatus({ srcChainKey, srcTxHash }, apiConfig);
|
|
3898
|
+
},
|
|
3899
|
+
enabled: !!srcChainKey && !!srcTxHash,
|
|
3900
|
+
refetchInterval: (query) => {
|
|
3901
|
+
notFoundStreakRef.current = advanceNotFoundStreak(
|
|
3902
|
+
notFoundStreakRef.current,
|
|
3903
|
+
pollKey,
|
|
3904
|
+
isSolverNotFound(toNotFoundBudgetRead(query.state.data)),
|
|
3905
|
+
query.state.dataUpdateCount
|
|
3906
|
+
);
|
|
3907
|
+
return getSolverDetailedStatusRefetchInterval(query.state.data, notFoundStreakRef.current.consecutiveNotFound);
|
|
3908
|
+
},
|
|
3909
|
+
...queryOptions
|
|
3910
|
+
});
|
|
3911
|
+
};
|
|
3824
3912
|
function useLeverageYieldVaultSwap({
|
|
3825
3913
|
mutationOptions
|
|
3826
3914
|
} = {}) {
|
|
@@ -3848,6 +3936,216 @@ function useLeverageYieldWithdraw({
|
|
|
3848
3936
|
mutationFn: async (vars) => unwrapResult(await sodax.leverageYield.withdraw(vars))
|
|
3849
3937
|
});
|
|
3850
3938
|
}
|
|
3939
|
+
function useLeveragePositions({
|
|
3940
|
+
params,
|
|
3941
|
+
queryOptions
|
|
3942
|
+
} = {}) {
|
|
3943
|
+
const { sodax } = useSodaxContext();
|
|
3944
|
+
const owner = params?.owner;
|
|
3945
|
+
return useQuery({
|
|
3946
|
+
queryKey: ["leverageYield", "positions", owner],
|
|
3947
|
+
queryFn: async () => {
|
|
3948
|
+
if (!owner) throw new Error("owner is required");
|
|
3949
|
+
const result = await sodax.leverageYield.listPositions(owner);
|
|
3950
|
+
if (!result.ok) throw result.error;
|
|
3951
|
+
return result.value;
|
|
3952
|
+
},
|
|
3953
|
+
enabled: !!owner,
|
|
3954
|
+
...queryOptions
|
|
3955
|
+
});
|
|
3956
|
+
}
|
|
3957
|
+
function useLeveragePositionAccount({
|
|
3958
|
+
params,
|
|
3959
|
+
queryOptions
|
|
3960
|
+
} = {}) {
|
|
3961
|
+
const { sodax } = useSodaxContext();
|
|
3962
|
+
const position = params?.position;
|
|
3963
|
+
return useQuery({
|
|
3964
|
+
queryKey: ["leverageYield", "positionAccount", position],
|
|
3965
|
+
queryFn: async () => {
|
|
3966
|
+
if (!position) throw new Error("position is required");
|
|
3967
|
+
const result = await sodax.leverageYield.getPositionAccount(position);
|
|
3968
|
+
if (!result.ok) throw result.error;
|
|
3969
|
+
return result.value;
|
|
3970
|
+
},
|
|
3971
|
+
enabled: !!position,
|
|
3972
|
+
refetchInterval: 3e4,
|
|
3973
|
+
...queryOptions
|
|
3974
|
+
});
|
|
3975
|
+
}
|
|
3976
|
+
function useLeveragePositionCollateral({
|
|
3977
|
+
params,
|
|
3978
|
+
queryOptions
|
|
3979
|
+
} = {}) {
|
|
3980
|
+
const { sodax } = useSodaxContext();
|
|
3981
|
+
const position = params?.position;
|
|
3982
|
+
const collateral = params?.collateral;
|
|
3983
|
+
return useQuery({
|
|
3984
|
+
queryKey: ["leverageYield", "positionCollateral", position, collateral],
|
|
3985
|
+
queryFn: async () => {
|
|
3986
|
+
if (!position) throw new Error("position is required");
|
|
3987
|
+
const result = await sodax.leverageYield.getPositionCollateralBalance(position, collateral);
|
|
3988
|
+
if (!result.ok) throw result.error;
|
|
3989
|
+
return result.value;
|
|
3990
|
+
},
|
|
3991
|
+
enabled: !!position,
|
|
3992
|
+
// Interest accrues into the balance continuously, so match the account snapshot's cadence.
|
|
3993
|
+
refetchInterval: 3e4,
|
|
3994
|
+
...queryOptions
|
|
3995
|
+
});
|
|
3996
|
+
}
|
|
3997
|
+
function useLeveragePositionInfo({
|
|
3998
|
+
params,
|
|
3999
|
+
queryOptions
|
|
4000
|
+
} = {}) {
|
|
4001
|
+
const { sodax } = useSodaxContext();
|
|
4002
|
+
const position = params?.position;
|
|
4003
|
+
return useQuery({
|
|
4004
|
+
queryKey: ["leverageYield", "positionInfo", position],
|
|
4005
|
+
queryFn: async () => {
|
|
4006
|
+
if (!position) throw new Error("position is required");
|
|
4007
|
+
const result = await sodax.leverageYield.getPositionInfo(position);
|
|
4008
|
+
if (!result.ok) throw result.error;
|
|
4009
|
+
return result.value;
|
|
4010
|
+
},
|
|
4011
|
+
enabled: !!position,
|
|
4012
|
+
...queryOptions
|
|
4013
|
+
});
|
|
4014
|
+
}
|
|
4015
|
+
function useLeveragePositionPending({
|
|
4016
|
+
params,
|
|
4017
|
+
queryOptions
|
|
4018
|
+
} = {}) {
|
|
4019
|
+
const { sodax } = useSodaxContext();
|
|
4020
|
+
const position = params?.position;
|
|
4021
|
+
return useQuery({
|
|
4022
|
+
queryKey: ["leverageYield", "positionPending", position],
|
|
4023
|
+
queryFn: async () => {
|
|
4024
|
+
if (!position) throw new Error("position is required");
|
|
4025
|
+
const result = await sodax.leverageYield.getPositionPendingState(position);
|
|
4026
|
+
if (!result.ok) throw result.error;
|
|
4027
|
+
return result.value;
|
|
4028
|
+
},
|
|
4029
|
+
enabled: !!position,
|
|
4030
|
+
refetchInterval: 15e3,
|
|
4031
|
+
...queryOptions
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
function useLeveragePositionsForUser({
|
|
4035
|
+
params,
|
|
4036
|
+
queryOptions
|
|
4037
|
+
} = {}) {
|
|
4038
|
+
const { sodax } = useSodaxContext();
|
|
4039
|
+
const spokeChainKey = params?.spokeChainKey;
|
|
4040
|
+
const spokeAddress = params?.spokeAddress;
|
|
4041
|
+
return useQuery({
|
|
4042
|
+
queryKey: ["leverageYield", "positionsForUser", spokeChainKey, spokeAddress],
|
|
4043
|
+
queryFn: async () => {
|
|
4044
|
+
if (!spokeChainKey || !spokeAddress) throw new Error("spokeChainKey and spokeAddress are required");
|
|
4045
|
+
const result = await sodax.leverageYield.listPositionsForUser(spokeChainKey, spokeAddress);
|
|
4046
|
+
if (!result.ok) throw result.error;
|
|
4047
|
+
return result.value;
|
|
4048
|
+
},
|
|
4049
|
+
enabled: !!spokeChainKey && !!spokeAddress,
|
|
4050
|
+
...queryOptions
|
|
4051
|
+
});
|
|
4052
|
+
}
|
|
4053
|
+
function useOpenLeveragePosition({
|
|
4054
|
+
mutationOptions
|
|
4055
|
+
} = {}) {
|
|
4056
|
+
const { sodax } = useSodaxContext();
|
|
4057
|
+
const queryClient = useQueryClient();
|
|
4058
|
+
return useSafeMutation({
|
|
4059
|
+
mutationKey: ["leverageYield", "openPosition"],
|
|
4060
|
+
...mutationOptions,
|
|
4061
|
+
mutationFn: async (vars) => unwrapResult(await sodax.leverageYield.openLeveragePosition({ ...vars, raw: false })),
|
|
4062
|
+
onSuccess: async (data, vars, ctx) => {
|
|
4063
|
+
invalidateBalances(queryClient, vars.params.srcChainKey);
|
|
4064
|
+
queryClient.invalidateQueries({ queryKey: ["leverageYield"] });
|
|
4065
|
+
await mutationOptions?.onSuccess?.(data, vars, ctx);
|
|
4066
|
+
}
|
|
4067
|
+
});
|
|
4068
|
+
}
|
|
4069
|
+
function useSubmitLeveragePositionIntent({
|
|
4070
|
+
mutationOptions
|
|
4071
|
+
} = {}) {
|
|
4072
|
+
const { sodax } = useSodaxContext();
|
|
4073
|
+
const queryClient = useQueryClient();
|
|
4074
|
+
return useSafeMutation({
|
|
4075
|
+
mutationKey: ["leverageYield", "submitPositionIntent"],
|
|
4076
|
+
...mutationOptions,
|
|
4077
|
+
mutationFn: async (vars) => unwrapResult(await sodax.leverageYield.submitLeveragePositionIntent({ ...vars, raw: false })),
|
|
4078
|
+
onSuccess: async (data, vars, ctx) => {
|
|
4079
|
+
queryClient.invalidateQueries({ queryKey: ["leverageYield"] });
|
|
4080
|
+
await mutationOptions?.onSuccess?.(data, vars, ctx);
|
|
4081
|
+
}
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
4084
|
+
function useRunLeveragePositionOperation({
|
|
4085
|
+
mutationOptions
|
|
4086
|
+
} = {}) {
|
|
4087
|
+
const { sodax } = useSodaxContext();
|
|
4088
|
+
const queryClient = useQueryClient();
|
|
4089
|
+
return useSafeMutation({
|
|
4090
|
+
mutationKey: ["leverageYield", "runPositionOperation"],
|
|
4091
|
+
...mutationOptions,
|
|
4092
|
+
mutationFn: async (vars) => unwrapResult(await sodax.leverageYield.runLeveragePositionOperation({ ...vars, raw: false })),
|
|
4093
|
+
onSuccess: async (data, vars, ctx) => {
|
|
4094
|
+
invalidateBalances(queryClient, vars.params.srcChainKey);
|
|
4095
|
+
queryClient.invalidateQueries({ queryKey: ["leverageYield"] });
|
|
4096
|
+
await mutationOptions?.onSuccess?.(data, vars, ctx);
|
|
4097
|
+
}
|
|
4098
|
+
});
|
|
4099
|
+
}
|
|
4100
|
+
|
|
4101
|
+
// src/hooks/leverageYield/useLeveragePositionPayoutAddress.ts
|
|
4102
|
+
function useLeveragePositionPayoutAddress({
|
|
4103
|
+
params
|
|
4104
|
+
} = {}) {
|
|
4105
|
+
const { sodax } = useSodaxContext();
|
|
4106
|
+
if (!params) return void 0;
|
|
4107
|
+
return params.chainKey === sodax.hubProvider.chainConfig.chain.key ? params.signerAddress : params.owner;
|
|
4108
|
+
}
|
|
4109
|
+
function useLeveragePositionFundingAllowance({
|
|
4110
|
+
params,
|
|
4111
|
+
queryOptions
|
|
4112
|
+
} = {}) {
|
|
4113
|
+
const { sodax } = useSodaxContext();
|
|
4114
|
+
const { srcChainKey, srcAddress, token, amount } = params ?? {};
|
|
4115
|
+
return useQuery({
|
|
4116
|
+
queryKey: ["leverageYield", "positionFundingAllowance", srcChainKey, srcAddress, token, amount?.toString()],
|
|
4117
|
+
queryFn: async () => {
|
|
4118
|
+
if (!srcChainKey || !srcAddress || !token || !amount) throw new Error("allowance params are incomplete");
|
|
4119
|
+
const result = await sodax.leverageYield.isPositionFundingAllowanceValid({
|
|
4120
|
+
srcChainKey,
|
|
4121
|
+
srcAddress,
|
|
4122
|
+
token,
|
|
4123
|
+
amount
|
|
4124
|
+
});
|
|
4125
|
+
if (!result.ok) throw result.error;
|
|
4126
|
+
return result.value;
|
|
4127
|
+
},
|
|
4128
|
+
enabled: !!srcChainKey && !!srcAddress && !!token && !!amount && amount > 0n,
|
|
4129
|
+
...queryOptions
|
|
4130
|
+
});
|
|
4131
|
+
}
|
|
4132
|
+
function useApproveLeveragePositionFunding({
|
|
4133
|
+
mutationOptions
|
|
4134
|
+
} = {}) {
|
|
4135
|
+
const { sodax } = useSodaxContext();
|
|
4136
|
+
const queryClient = useQueryClient();
|
|
4137
|
+
return useSafeMutation({
|
|
4138
|
+
mutationKey: ["leverageYield", "approvePositionFunding"],
|
|
4139
|
+
...mutationOptions,
|
|
4140
|
+
mutationFn: async (vars) => unwrapResult(await sodax.leverageYield.approvePositionFunding(vars)),
|
|
4141
|
+
onSuccess: async (data, vars, ctx) => {
|
|
4142
|
+
queryClient.invalidateQueries({
|
|
4143
|
+
queryKey: ["leverageYield", "positionFundingAllowance", vars.srcChainKey, vars.srcAddress, vars.token]
|
|
4144
|
+
});
|
|
4145
|
+
await mutationOptions?.onSuccess?.(data, vars, ctx);
|
|
4146
|
+
}
|
|
4147
|
+
});
|
|
4148
|
+
}
|
|
3851
4149
|
var useLeverageYieldApiVaults = ({
|
|
3852
4150
|
params,
|
|
3853
4151
|
queryOptions
|
|
@@ -4527,4 +4825,4 @@ function createSodaxQueryClient({
|
|
|
4527
4825
|
});
|
|
4528
4826
|
}
|
|
4529
4827
|
|
|
4530
|
-
export { SodaxProvider, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getBalancesQueryOptions, getLeverageYieldQuoteQueryOptions, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getSwapQuoteQueryOptions, getXBalancesQueryOptions, invalidateBalances, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, retryUnlessAuthFailure, runApprovalPlan, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOracleCandles, useBackendOracleMarkets, useBackendOrderbook, useBackendUserIntents, useBalances, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiApproveAndBroadcast, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDetailedStatus, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEnsureRadfiAccessToken, useEstablishTrustline, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFeeClaimWithdraw, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetIntentDetails, useGetUserHubWalletAddress, useGetUserIntent, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLeverageYieldApiAllowance, useLeverageYieldApiApprove, useLeverageYieldApiApproveAndBroadcast, useLeverageYieldApiApr, useLeverageYieldApiAsset, useLeverageYieldApiCancelIntent, useLeverageYieldApiCreateDepositIntent, useLeverageYieldApiCreateWithdrawIntent, useLeverageYieldApiDeadline, useLeverageYieldApiDepositQuote, useLeverageYieldApiEffectiveApr, useLeverageYieldApiEstimateGas, useLeverageYieldApiFilledIntent, useLeverageYieldApiIntent, useLeverageYieldApiIntentExtraData, useLeverageYieldApiIntentHash, useLeverageYieldApiIntentPacket, useLeverageYieldApiLsdApr, useLeverageYieldApiMaxWithdraw, useLeverageYieldApiPartnerFee, useLeverageYieldApiPosition, useLeverageYieldApiPreviewDeposit, useLeverageYieldApiPreviewRedeem, useLeverageYieldApiPreviewWithdraw, useLeverageYieldApiShareBalance, useLeverageYieldApiSolverFee, useLeverageYieldApiStatus, useLeverageYieldApiSubmitIntent, useLeverageYieldApiSubmitTx, useLeverageYieldApiSubmitTxStatus, useLeverageYieldApiTotalAssets, useLeverageYieldApiVault, useLeverageYieldApiVaults, useLeverageYieldApiWithdrawQuote, useLeverageYieldDeposit, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, useLeverageYieldQuote, useLeverageYieldShareBalances, useLeverageYieldTotalAssets, useLeverageYieldVaultSwap, useLeverageYieldWithdraw, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, useNearStorageCheck, useNearStorageGate, usePartnerCancelIntent, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRegisterNearStorage, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useSafeMutation, useSetSwapPreference, useSodaxContext, useSponsorConfig, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarAccountActive, useStellarAccountStatus, useStellarGate, useStellarTrustlineCheck, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprove, useSwapsApiAllowance, useSwapsApiApprove, useSwapsApiApproveAndBroadcast, useSwapsApiCancelIntent, useSwapsApiCreateIntent, useSwapsApiCreateLimitOrder, useSwapsApiDeadline, useSwapsApiEstimateGas, useSwapsApiFilledIntent, useSwapsApiIntent, useSwapsApiIntentExtraData, useSwapsApiIntentHash, useSwapsApiIntentPacket, useSwapsApiPartnerFee, useSwapsApiQuote, useSwapsApiSolverFee, useSwapsApiStatus, useSwapsApiSubmitIntent, useSwapsApiSubmitTx, useSwapsApiSubmitTxStatus, useSwapsApiTokens, useSwapsApiTokensByChain, useTradingWallet, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw, useWithdrawHubAsset, useXBalances };
|
|
4828
|
+
export { SodaxProvider, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getBalancesQueryOptions, getBridgeDetailedStatusRefetchInterval, getLeverageYieldQuoteQueryOptions, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getSwapQuoteQueryOptions, getXBalancesQueryOptions, invalidateBalances, isBridgeNotDelivered, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, retryUnlessAuthFailure, runApprovalPlan, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveLeveragePositionFunding, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOracleCandles, useBackendOracleMarkets, useBackendOrderbook, useBackendUserIntents, useBalances, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiApproveAndBroadcast, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprove, useBridgeDetailedStatus, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, useDetailedStatus, useDexAllowance, useDexApprove, useDexDeposit, useDexWithdraw, useEModes, useEnsureRadfiAccessToken, useEstablishTrustline, useEstimateGas, useExpiredUtxos, useFeeClaimSwap, useFeeClaimWithdraw, useFetchAssetsBalances, useFundTradingWallet, useGetAutoSwapPreferences, useGetBridgeableAmount, useGetBridgeableTokens, useGetIntentDetails, useGetUserHubWalletAddress, useGetUserIntent, useHubAssetBalances, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useIsTokenApproved, useLeveragePositionAccount, useLeveragePositionCollateral, useLeveragePositionFundingAllowance, useLeveragePositionInfo, useLeveragePositionPayoutAddress, useLeveragePositionPending, useLeveragePositions, useLeveragePositionsForUser, useLeverageYieldApiAllowance, useLeverageYieldApiApprove, useLeverageYieldApiApproveAndBroadcast, useLeverageYieldApiApr, useLeverageYieldApiAsset, useLeverageYieldApiCancelIntent, useLeverageYieldApiCreateDepositIntent, useLeverageYieldApiCreateWithdrawIntent, useLeverageYieldApiDeadline, useLeverageYieldApiDepositQuote, useLeverageYieldApiEffectiveApr, useLeverageYieldApiEstimateGas, useLeverageYieldApiFilledIntent, useLeverageYieldApiIntent, useLeverageYieldApiIntentExtraData, useLeverageYieldApiIntentHash, useLeverageYieldApiIntentPacket, useLeverageYieldApiLsdApr, useLeverageYieldApiMaxWithdraw, useLeverageYieldApiPartnerFee, useLeverageYieldApiPosition, useLeverageYieldApiPreviewDeposit, useLeverageYieldApiPreviewRedeem, useLeverageYieldApiPreviewWithdraw, useLeverageYieldApiShareBalance, useLeverageYieldApiSolverFee, useLeverageYieldApiStatus, useLeverageYieldApiSubmitIntent, useLeverageYieldApiSubmitTx, useLeverageYieldApiSubmitTxStatus, useLeverageYieldApiTotalAssets, useLeverageYieldApiVault, useLeverageYieldApiVaults, useLeverageYieldApiWithdrawQuote, useLeverageYieldDeposit, useLeverageYieldDetailedStatus, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, useLeverageYieldQuote, useLeverageYieldShareBalances, useLeverageYieldTotalAssets, useLeverageYieldVaultSwap, useLeverageYieldWithdraw, useLiquidityAmounts, useMMAllowance, useMMApprove, useMigrateBaln, useMigrateIcxToSoda, useMigratebnUSD, useMigrationAllowance, useMigrationApprove, useNearStorageCheck, useNearStorageGate, useOpenLeveragePosition, usePartnerCancelIntent, usePoolBalances, usePoolData, usePools, usePositionInfo, useQuote, useRadfiAuth, useRadfiSession, useRadfiWithdraw, useRegisterNearStorage, useRenewUtxos, useRepay, useRequestTrustline, useReservesData, useReservesHumanized, useReservesList, useReservesUsdFormat, useRevertMigrateSodaToIcx, useRunLeveragePositionOperation, useSafeMutation, useSetSwapPreference, useSodaxContext, useSponsorConfig, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarAccountActive, useStellarAccountStatus, useStellarGate, useStellarTrustlineCheck, useSubmitLeveragePositionIntent, useSupply, useSupplyLiquidity, useSwap, useSwapAllowance, useSwapApprove, useSwapsApiAllowance, useSwapsApiApprove, useSwapsApiApproveAndBroadcast, useSwapsApiCancelIntent, useSwapsApiCreateIntent, useSwapsApiCreateLimitOrder, useSwapsApiDeadline, useSwapsApiEstimateGas, useSwapsApiFilledIntent, useSwapsApiIntent, useSwapsApiIntentExtraData, useSwapsApiIntentHash, useSwapsApiIntentPacket, useSwapsApiPartnerFee, useSwapsApiQuote, useSwapsApiSolverFee, useSwapsApiStatus, useSwapsApiSubmitIntent, useSwapsApiSubmitTx, useSwapsApiSubmitTxStatus, useSwapsApiTokens, useSwapsApiTokensByChain, useTradingWallet, useTradingWalletBalance, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserFormattedSummary, useUserReservesData, useWithdraw, useWithdrawHubAsset, useXBalances };
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "2.2.0-rc.
|
|
8
|
+
"version": "2.2.0-rc.7",
|
|
9
9
|
"description": "React hooks for building dApps on the SODAX cross-chain DeFi platform",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"sodax",
|
|
@@ -34,17 +34,17 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"viem": "2.29.2",
|
|
37
|
-
"@sodax/sdk": "2.2.0-rc.
|
|
37
|
+
"@sodax/sdk": "2.2.0-rc.7"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@arethetypeswrong/cli": "0.17.4",
|
|
41
41
|
"@tanstack/react-query": "5.87.4",
|
|
42
42
|
"@types/react": "19.0.8",
|
|
43
|
-
"knip": "5.
|
|
43
|
+
"knip": "5.88.1",
|
|
44
44
|
"tslib": "2.8.1",
|
|
45
45
|
"tsup": "8.5.0",
|
|
46
46
|
"typescript": "5.5.4",
|
|
47
|
-
"vitest": "
|
|
47
|
+
"vitest": "4.1.11"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@tanstack/react-query": "5.x",
|
|
@@ -26,10 +26,14 @@ const HOOKS: Array<{ path: string; nativeThrow?: true }> = [
|
|
|
26
26
|
{ path: 'dex/useDexDeposit.ts' },
|
|
27
27
|
{ path: 'dex/useDexWithdraw.ts' },
|
|
28
28
|
{ path: 'dex/useSupplyLiquidity.ts' },
|
|
29
|
+
{ path: 'leverageYield/useRunLeveragePositionOperation.ts' },
|
|
29
30
|
{ path: 'leverageYield/useLeverageYieldDeposit.ts' },
|
|
30
31
|
{ path: 'leverageYield/useLeverageYieldNotifySolver.ts' },
|
|
31
32
|
{ path: 'leverageYield/useLeverageYieldVaultSwap.ts' },
|
|
32
33
|
{ path: 'leverageYield/useLeverageYieldWithdraw.ts' },
|
|
34
|
+
{ path: 'leverageYield/useApproveLeveragePositionFunding.ts' },
|
|
35
|
+
{ path: 'leverageYield/useOpenLeveragePosition.ts' },
|
|
36
|
+
{ path: 'leverageYield/useSubmitLeveragePositionIntent.ts' },
|
|
33
37
|
{ path: 'leverageYieldApi/useLeverageYieldApiApprove.ts' },
|
|
34
38
|
{ path: 'leverageYieldApi/useLeverageYieldApiApproveAndBroadcast.ts' },
|
|
35
39
|
{ path: 'leverageYieldApi/useLeverageYieldApiCancelIntent.ts' },
|