@sodax/dapp-kit 1.5.6-beta → 2.0.0-rc.1
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 +300 -422
- package/ai-exported/AGENTS.md +134 -0
- package/ai-exported/integration/README.md +49 -0
- package/ai-exported/integration/ai-rules.md +79 -0
- package/ai-exported/integration/architecture.md +274 -0
- package/ai-exported/integration/features/README.md +29 -0
- package/ai-exported/integration/features/auxiliary-services.md +169 -0
- package/ai-exported/integration/features/bitcoin.md +87 -0
- package/ai-exported/integration/features/bridge.md +91 -0
- package/ai-exported/integration/features/dex.md +152 -0
- package/ai-exported/integration/features/migration.md +118 -0
- package/ai-exported/integration/features/money-market.md +116 -0
- package/ai-exported/integration/features/staking.md +123 -0
- package/ai-exported/integration/features/swap.md +101 -0
- package/ai-exported/integration/quickstart.md +187 -0
- package/ai-exported/integration/recipes/README.md +136 -0
- package/ai-exported/integration/recipes/backend-queries.md +157 -0
- package/ai-exported/integration/recipes/bitcoin.md +193 -0
- package/ai-exported/integration/recipes/bridge.md +174 -0
- package/ai-exported/integration/recipes/dex.md +204 -0
- package/ai-exported/integration/recipes/invalidations.md +115 -0
- package/ai-exported/integration/recipes/migration.md +212 -0
- package/ai-exported/integration/recipes/money-market.md +206 -0
- package/ai-exported/integration/recipes/mutation-error-handling.md +118 -0
- package/ai-exported/integration/recipes/observability.md +93 -0
- package/ai-exported/integration/recipes/setup.md +144 -0
- package/ai-exported/integration/recipes/staking.md +202 -0
- package/ai-exported/integration/recipes/swap.md +272 -0
- package/ai-exported/integration/recipes/wallet-connectivity.md +101 -0
- package/ai-exported/integration/reference/README.md +12 -0
- package/ai-exported/integration/reference/glossary.md +188 -0
- package/ai-exported/integration/reference/hooks-index.md +194 -0
- package/ai-exported/integration/reference/public-api.md +110 -0
- package/ai-exported/integration/reference/querykey-conventions.md +179 -0
- package/ai-exported/migration/README.md +60 -0
- package/ai-exported/migration/ai-rules.md +81 -0
- package/ai-exported/migration/breaking-changes/hook-signatures.md +233 -0
- package/ai-exported/migration/breaking-changes/querykey-conventions.md +108 -0
- package/ai-exported/migration/breaking-changes/result-handling.md +211 -0
- package/ai-exported/migration/breaking-changes/sdk-leakage.md +165 -0
- package/ai-exported/migration/checklist.md +89 -0
- package/ai-exported/migration/features/README.md +34 -0
- package/ai-exported/migration/features/auxiliary-services.md +114 -0
- package/ai-exported/migration/features/bitcoin.md +88 -0
- package/ai-exported/migration/features/bridge.md +123 -0
- package/ai-exported/migration/features/dex.md +101 -0
- package/ai-exported/migration/features/migration.md +120 -0
- package/ai-exported/migration/features/money-market.md +97 -0
- package/ai-exported/migration/features/staking.md +109 -0
- package/ai-exported/migration/features/swap.md +118 -0
- package/ai-exported/migration/recipes.md +188 -0
- package/ai-exported/migration/reference/README.md +15 -0
- package/ai-exported/migration/reference/deleted-hooks.md +110 -0
- package/ai-exported/migration/reference/error-shape-crosswalk.md +144 -0
- package/ai-exported/migration/reference/renamed-hooks.md +66 -0
- package/dist/index.cjs +2642 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1550 -0
- package/dist/index.d.ts +1020 -2051
- package/dist/index.mjs +1594 -1532
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -10
- package/src/contexts/index.ts +0 -3
- package/src/hooks/_mutationContract.test.ts +99 -0
- package/src/hooks/backend/README.md +2 -2
- package/src/hooks/backend/index.ts +13 -13
- package/src/hooks/backend/unwrapResult.ts +1 -0
- package/src/hooks/backend/useBackendAllMoneyMarketAssets.ts +13 -45
- package/src/hooks/backend/useBackendAllMoneyMarketBorrowers.ts +29 -59
- package/src/hooks/backend/useBackendIntentByHash.ts +21 -47
- package/src/hooks/backend/useBackendIntentByTxHash.ts +23 -50
- package/src/hooks/backend/useBackendMoneyMarketAsset.ts +21 -54
- package/src/hooks/backend/useBackendMoneyMarketAssetBorrowers.ts +30 -57
- package/src/hooks/backend/useBackendMoneyMarketAssetSuppliers.ts +31 -58
- package/src/hooks/backend/useBackendMoneyMarketPosition.ts +22 -38
- package/src/hooks/backend/useBackendOrderbook.ts +27 -49
- package/src/hooks/backend/useBackendSubmitSwapTx.ts +30 -36
- package/src/hooks/backend/useBackendSubmitSwapTxStatus.ts +38 -58
- package/src/hooks/backend/useBackendUserIntents.ts +25 -63
- package/src/hooks/bitcoin/index.ts +9 -8
- package/src/hooks/bitcoin/useBitcoinBalance.ts +20 -5
- package/src/hooks/bitcoin/useExpiredUtxos.ts +26 -16
- package/src/hooks/bitcoin/useFundTradingWallet.ts +33 -30
- package/src/hooks/bitcoin/useRadfiAuth.ts +43 -40
- package/src/hooks/bitcoin/useRadfiSession.ts +53 -59
- package/src/hooks/bitcoin/useRadfiWithdraw.ts +35 -53
- package/src/hooks/bitcoin/useRenewUtxos.ts +30 -50
- package/src/hooks/bitcoin/useTradingWallet.ts +1 -1
- package/src/hooks/bitcoin/useTradingWalletBalance.ts +25 -14
- package/src/hooks/bridge/index.ts +5 -5
- package/src/hooks/bridge/useBridge.ts +29 -55
- package/src/hooks/bridge/useBridgeAllowance.ts +38 -38
- package/src/hooks/bridge/useBridgeApprove.ts +32 -57
- package/src/hooks/bridge/useGetBridgeableAmount.ts +23 -37
- package/src/hooks/bridge/useGetBridgeableTokens.ts +27 -50
- package/src/hooks/dex/index.ts +16 -16
- package/src/hooks/dex/useClaimRewards.ts +35 -54
- package/src/hooks/dex/useCreateDecreaseLiquidityParams.ts +7 -20
- package/src/hooks/dex/useCreateDepositParams.ts +7 -21
- package/src/hooks/dex/useCreateSupplyLiquidityParams.ts +13 -28
- package/src/hooks/dex/useCreateWithdrawParams.ts +7 -20
- package/src/hooks/dex/useDecreaseLiquidity.ts +40 -66
- package/src/hooks/dex/useDexAllowance.ts +29 -75
- package/src/hooks/dex/useDexApprove.ts +32 -43
- package/src/hooks/dex/useDexDeposit.ts +42 -49
- package/src/hooks/dex/useDexWithdraw.ts +32 -43
- package/src/hooks/dex/useLiquidityAmounts.ts +27 -84
- package/src/hooks/dex/usePoolBalances.ts +50 -72
- package/src/hooks/dex/usePoolData.ts +17 -43
- package/src/hooks/dex/usePools.ts +11 -38
- package/src/hooks/dex/usePositionInfo.ts +27 -62
- package/src/hooks/dex/useSupplyLiquidity.ts +80 -75
- package/src/hooks/index.ts +12 -10
- package/src/hooks/migrate/index.ts +13 -4
- package/src/hooks/migrate/useMigrateBaln.ts +42 -0
- package/src/hooks/migrate/useMigrateIcxToSoda.ts +44 -0
- package/src/hooks/migrate/useMigratebnUSD.ts +47 -0
- package/src/hooks/migrate/useMigrationAllowance.ts +76 -0
- package/src/hooks/migrate/useMigrationApprove.ts +66 -0
- package/src/hooks/migrate/useRevertMigrateSodaToIcx.ts +39 -0
- package/src/hooks/mm/index.ts +14 -12
- package/src/hooks/mm/useAToken.ts +25 -41
- package/src/hooks/mm/useATokensBalances.ts +29 -60
- package/src/hooks/mm/useBorrow.ts +38 -56
- package/src/hooks/mm/useMMAllowance.ts +37 -73
- package/src/hooks/mm/useMMApprove.ts +36 -43
- package/src/hooks/mm/useRepay.ts +33 -53
- package/src/hooks/mm/useReservesData.ts +12 -38
- package/src/hooks/mm/useReservesHumanized.ts +12 -31
- package/src/hooks/mm/useReservesList.ts +11 -31
- package/src/hooks/mm/useReservesUsdFormat.ts +15 -35
- package/src/hooks/mm/useSupply.ts +45 -51
- package/src/hooks/mm/useUserFormattedSummary.ts +32 -84
- package/src/hooks/mm/useUserReservesData.ts +27 -77
- package/src/hooks/mm/useWithdraw.ts +38 -54
- package/src/hooks/partner/index.ts +6 -0
- package/src/hooks/partner/useApproveToken.ts +42 -0
- package/src/hooks/partner/useFeeClaimSwap.ts +38 -0
- package/src/hooks/partner/useFetchAssetsBalances.ts +37 -0
- package/src/hooks/partner/useGetAutoSwapPreferences.ts +37 -0
- package/src/hooks/partner/useIsTokenApproved.ts +39 -0
- package/src/hooks/partner/useSetSwapPreference.ts +50 -0
- package/src/hooks/provider/index.ts +1 -2
- package/src/hooks/provider/useHubProvider.ts +1 -1
- package/src/hooks/recovery/index.ts +2 -0
- package/src/hooks/recovery/useHubAssetBalances.ts +43 -0
- package/src/hooks/recovery/useWithdrawHubAsset.ts +48 -0
- package/src/hooks/shared/index.ts +10 -6
- package/src/hooks/shared/types.ts +77 -0
- package/src/hooks/shared/unwrapResult.ts +19 -0
- package/src/hooks/shared/useDeriveUserWalletAddress.ts +22 -40
- package/src/hooks/shared/useEstimateGas.ts +18 -15
- package/src/hooks/shared/useGetUserHubWalletAddress.ts +25 -26
- package/src/hooks/shared/useRequestTrustline.ts +28 -61
- package/src/hooks/shared/useSafeMutation.test.ts +43 -0
- package/src/hooks/shared/useSafeMutation.ts +68 -0
- package/src/hooks/shared/useSodaxContext.ts +1 -1
- package/src/hooks/shared/useStellarTrustlineCheck.ts +30 -64
- package/src/hooks/shared/useXBalances.test.ts +113 -0
- package/src/hooks/shared/useXBalances.ts +61 -0
- package/src/hooks/staking/index.ts +18 -18
- package/src/hooks/staking/useCancelUnstake.ts +30 -41
- package/src/hooks/staking/useClaim.ts +27 -36
- package/src/hooks/staking/useConvertedAssets.ts +24 -34
- package/src/hooks/staking/useInstantUnstake.ts +33 -40
- package/src/hooks/staking/useInstantUnstakeAllowance.ts +37 -45
- package/src/hooks/staking/useInstantUnstakeApprove.ts +42 -42
- package/src/hooks/staking/useInstantUnstakeRatio.ts +24 -41
- package/src/hooks/staking/useStake.ts +32 -37
- package/src/hooks/staking/useStakeAllowance.ts +30 -43
- package/src/hooks/staking/useStakeApprove.ts +40 -40
- package/src/hooks/staking/useStakeRatio.ts +24 -40
- package/src/hooks/staking/useStakingConfig.ts +14 -27
- package/src/hooks/staking/useStakingInfo.ts +30 -38
- package/src/hooks/staking/useUnstake.ts +29 -43
- package/src/hooks/staking/useUnstakeAllowance.ts +37 -44
- package/src/hooks/staking/useUnstakeApprove.ts +40 -43
- package/src/hooks/staking/useUnstakingInfo.ts +29 -41
- package/src/hooks/staking/useUnstakingInfoWithPenalty.ts +31 -47
- package/src/hooks/swap/index.ts +8 -8
- package/src/hooks/swap/useCancelLimitOrder.ts +24 -41
- package/src/hooks/swap/useCancelSwap.ts +24 -33
- package/src/hooks/swap/useCreateLimitOrder.ts +29 -62
- package/src/hooks/swap/useQuote.ts +17 -43
- package/src/hooks/swap/useStatus.ts +22 -29
- package/src/hooks/swap/useSwap.ts +31 -49
- package/src/hooks/swap/useSwapAllowance.ts +38 -35
- package/src/hooks/swap/useSwapApprove.ts +48 -57
- package/src/index.ts +5 -3
- package/src/providers/SodaxProvider.tsx +17 -11
- package/src/providers/createSodaxQueryClient.ts +96 -0
- package/src/providers/index.ts +2 -1
- package/src/utils/dex-utils.ts +27 -5
- package/src/utils/index.ts +1 -1
- package/dist/index.d.mts +0 -2581
- package/dist/index.js +0 -2562
- package/dist/index.js.map +0 -1
- package/src/hooks/migrate/types.ts +0 -15
- package/src/hooks/migrate/useMigrate.tsx +0 -110
- package/src/hooks/migrate/useMigrationAllowance.tsx +0 -79
- package/src/hooks/migrate/useMigrationApprove.tsx +0 -129
- package/src/hooks/provider/useSpokeProvider.ts +0 -172
package/package.json
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sodax/dapp-kit",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0-rc.1",
|
|
5
5
|
"description": "dapp-kit of New World",
|
|
6
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.cjs",
|
|
7
8
|
"types": "dist/index.d.ts",
|
|
8
9
|
"module": "dist/index.mjs",
|
|
9
10
|
"files": [
|
|
10
11
|
"dist",
|
|
11
|
-
"src"
|
|
12
|
+
"src",
|
|
13
|
+
"ai-exported"
|
|
12
14
|
],
|
|
13
15
|
"repository": {
|
|
14
16
|
"type": "git",
|
|
15
|
-
"url": "https://github.com/icon-project/sodax-
|
|
17
|
+
"url": "https://github.com/icon-project/sodax-sdks"
|
|
16
18
|
},
|
|
17
19
|
"dependencies": {
|
|
18
20
|
"viem": "2.29.2",
|
|
19
|
-
"@sodax/sdk": "
|
|
20
|
-
"@sodax/types": "1.5.6-beta"
|
|
21
|
+
"@sodax/sdk": "2.0.0-rc.1"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
24
|
+
"@tanstack/react-query": "5.87.4",
|
|
23
25
|
"@types/react": "19.0.8",
|
|
24
26
|
"knip": "5.30.5",
|
|
25
27
|
"tsup": "8.5.0",
|
|
26
|
-
"typescript": "5.5.4"
|
|
28
|
+
"typescript": "5.5.4",
|
|
29
|
+
"vitest": "2.1.9"
|
|
27
30
|
},
|
|
28
31
|
"peerDependencies": {
|
|
29
32
|
"@tanstack/react-query": "5.x",
|
|
@@ -37,17 +40,24 @@
|
|
|
37
40
|
".": {
|
|
38
41
|
"types": "./dist/index.d.ts",
|
|
39
42
|
"import": "./dist/index.mjs",
|
|
40
|
-
"require": "./dist/index.
|
|
43
|
+
"require": "./dist/index.cjs"
|
|
41
44
|
}
|
|
42
45
|
},
|
|
43
46
|
"scripts": {
|
|
44
47
|
"build": "tsup",
|
|
45
48
|
"dev": "tsup --watch ./src",
|
|
46
|
-
"test": "
|
|
49
|
+
"test": "vitest run",
|
|
47
50
|
"clean": "rm -rf dist && rm -rf node_modules && rm -rf .turbo",
|
|
48
51
|
"pretty": "biome format . --write",
|
|
49
52
|
"checkTs": "tsc --noEmit",
|
|
50
53
|
"knip": "knip",
|
|
51
|
-
"lint": "biome lint . --write"
|
|
54
|
+
"lint": "biome lint . --write",
|
|
55
|
+
"check:ai-exported": "bash ./scripts/check-ai-exported.sh",
|
|
56
|
+
"check:ai-scope": "bash ./scripts/check-ai-scope.sh",
|
|
57
|
+
"check:ai-links": "bash ./scripts/check-ai-links.sh",
|
|
58
|
+
"check:ai-imports": "bash ./scripts/check-ai-imports.sh",
|
|
59
|
+
"check:ai-snippets": "bash ./scripts/check-ai-snippets.sh",
|
|
60
|
+
"check:ai-keys": "bash ./scripts/check-ai-keys.sh",
|
|
61
|
+
"check:ai-consistency": "bash ./scripts/check-ai-consistency.sh"
|
|
52
62
|
}
|
|
53
63
|
}
|
package/src/contexts/index.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
import type { Sodax } from '@sodax/sdk';
|
|
3
|
-
import type { RpcConfig } from '@sodax/types';
|
|
4
3
|
|
|
5
4
|
export interface SodaxContextType {
|
|
6
5
|
sodax: Sodax;
|
|
7
|
-
testnet: boolean;
|
|
8
|
-
rpcConfig: RpcConfig;
|
|
9
6
|
}
|
|
10
7
|
|
|
11
8
|
export const SodaxContext = createContext<SodaxContextType | null>(null);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
|
|
6
|
+
const HOOKS_DIR = resolve(fileURLToPath(import.meta.url), '..');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Manifest of every mutation hook. `nativeThrow: true` marks hooks whose underlying SDK methods
|
|
10
|
+
* throw natively (Radfi APIs) and so don't need `unwrapResult`.
|
|
11
|
+
*
|
|
12
|
+
* To add a new mutation hook, add its path here. The friction is intentional — it forces explicit
|
|
13
|
+
* registration so the contract is enforced from day one.
|
|
14
|
+
*/
|
|
15
|
+
const HOOKS: Array<{ path: string; nativeThrow?: true }> = [
|
|
16
|
+
{ path: 'backend/useBackendSubmitSwapTx.ts' },
|
|
17
|
+
{ path: 'bitcoin/useFundTradingWallet.ts', nativeThrow: true },
|
|
18
|
+
{ path: 'bitcoin/useRadfiAuth.ts', nativeThrow: true },
|
|
19
|
+
{ path: 'bitcoin/useRadfiWithdraw.ts', nativeThrow: true },
|
|
20
|
+
{ path: 'bitcoin/useRenewUtxos.ts', nativeThrow: true },
|
|
21
|
+
{ path: 'bridge/useBridge.ts' },
|
|
22
|
+
{ path: 'bridge/useBridgeApprove.ts' },
|
|
23
|
+
{ path: 'dex/useClaimRewards.ts' },
|
|
24
|
+
{ path: 'dex/useDecreaseLiquidity.ts' },
|
|
25
|
+
{ path: 'dex/useDexApprove.ts' },
|
|
26
|
+
{ path: 'dex/useDexDeposit.ts' },
|
|
27
|
+
{ path: 'dex/useDexWithdraw.ts' },
|
|
28
|
+
{ path: 'dex/useSupplyLiquidity.ts' },
|
|
29
|
+
{ path: 'migrate/useMigrateBaln.ts' },
|
|
30
|
+
{ path: 'migrate/useMigrateIcxToSoda.ts' },
|
|
31
|
+
{ path: 'migrate/useMigratebnUSD.ts' },
|
|
32
|
+
{ path: 'migrate/useMigrationApprove.ts' },
|
|
33
|
+
{ path: 'migrate/useRevertMigrateSodaToIcx.ts' },
|
|
34
|
+
{ path: 'mm/useBorrow.ts' },
|
|
35
|
+
{ path: 'mm/useMMApprove.ts' },
|
|
36
|
+
{ path: 'mm/useRepay.ts' },
|
|
37
|
+
{ path: 'mm/useSupply.ts' },
|
|
38
|
+
{ path: 'mm/useWithdraw.ts' },
|
|
39
|
+
{ path: 'partner/useApproveToken.ts' },
|
|
40
|
+
{ path: 'partner/useFeeClaimSwap.ts' },
|
|
41
|
+
{ path: 'partner/useSetSwapPreference.ts' },
|
|
42
|
+
{ path: 'recovery/useWithdrawHubAsset.ts' },
|
|
43
|
+
{ path: 'shared/useEstimateGas.ts' },
|
|
44
|
+
{ path: 'staking/useCancelUnstake.ts' },
|
|
45
|
+
{ path: 'staking/useClaim.ts' },
|
|
46
|
+
{ path: 'staking/useInstantUnstake.ts' },
|
|
47
|
+
{ path: 'staking/useInstantUnstakeApprove.ts' },
|
|
48
|
+
{ path: 'staking/useStake.ts' },
|
|
49
|
+
{ path: 'staking/useStakeApprove.ts' },
|
|
50
|
+
{ path: 'staking/useUnstake.ts' },
|
|
51
|
+
{ path: 'staking/useUnstakeApprove.ts' },
|
|
52
|
+
{ path: 'swap/useCancelLimitOrder.ts' },
|
|
53
|
+
{ path: 'swap/useCancelSwap.ts' },
|
|
54
|
+
{ path: 'swap/useCreateLimitOrder.ts' },
|
|
55
|
+
{ path: 'swap/useSwap.ts' },
|
|
56
|
+
{ path: 'swap/useSwapApprove.ts' },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
describe.each(HOOKS)('mutation hook contract: $path', ({ path, nativeThrow }) => {
|
|
60
|
+
const src = readFileSync(resolve(HOOKS_DIR, path), 'utf8');
|
|
61
|
+
|
|
62
|
+
it('uses useSafeMutation (not useMutation)', () => {
|
|
63
|
+
expect(src).toMatch(/useSafeMutation</);
|
|
64
|
+
// Negative lookbehind excludes useSafeMutation; catches a regression to bare useMutation.
|
|
65
|
+
expect(src).not.toMatch(/(?<!Safe)useMutation</);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('returns SafeUseMutationResult', () => {
|
|
69
|
+
expect(src).toMatch(/SafeUseMutationResult</);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('sets a default mutationKey before the mutationOptions spread', () => {
|
|
73
|
+
const keyIdx = src.search(/mutationKey:\s*\[/);
|
|
74
|
+
const spreadIdx = src.indexOf('...mutationOptions');
|
|
75
|
+
expect(keyIdx).toBeGreaterThan(-1);
|
|
76
|
+
expect(spreadIdx).toBeGreaterThan(-1);
|
|
77
|
+
expect(keyIdx).toBeLessThan(spreadIdx);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('mutationKey first segment matches feature directory', () => {
|
|
81
|
+
// Feature directory = first segment of `path`. e.g. `mm/useSupply.ts` → `mm`.
|
|
82
|
+
const featureDir = path.split('/')[0];
|
|
83
|
+
const match = src.match(/mutationKey:\s*\[\s*'([^']+)'/);
|
|
84
|
+
expect(match).not.toBeNull();
|
|
85
|
+
expect(match?.[1]).toBe(featureDir);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('defines mutationFn after the mutationOptions spread', () => {
|
|
89
|
+
const spreadIdx = src.indexOf('...mutationOptions');
|
|
90
|
+
const fnIdx = src.search(/\bmutationFn:/);
|
|
91
|
+
expect(fnIdx).toBeGreaterThan(spreadIdx);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (!nativeThrow) {
|
|
95
|
+
it('translates SDK Result via unwrapResult', () => {
|
|
96
|
+
expect(src).toMatch(/unwrapResult\(/);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
@@ -100,14 +100,14 @@ Fetches a user's money market position. The query is disabled if `userAddress` i
|
|
|
100
100
|
import { useBackendMoneyMarketPosition } from '@sodax/dapp-kit';
|
|
101
101
|
|
|
102
102
|
const { data: position, isLoading, error } = useBackendMoneyMarketPosition({
|
|
103
|
-
userAddress: '0x123...',
|
|
103
|
+
params: { userAddress: '0x123...' },
|
|
104
104
|
queryOptions: { staleTime: 60000 }, // optional
|
|
105
105
|
});
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
**Parameters:**
|
|
109
109
|
|
|
110
|
-
- `params.userAddress` (string | undefined): The user's wallet address to fetch positions for
|
|
110
|
+
- `params.params.userAddress` (string | undefined): The user's wallet address to fetch positions for
|
|
111
111
|
- `params.queryOptions` (optional): React Query options to customize behavior
|
|
112
112
|
|
|
113
113
|
#### `useBackendAllMoneyMarketAssets(params)`
|
|
@@ -8,22 +8,22 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
// Intent hooks
|
|
11
|
-
export { useBackendIntentByTxHash } from './useBackendIntentByTxHash';
|
|
12
|
-
export { useBackendIntentByHash } from './useBackendIntentByHash';
|
|
13
|
-
export { useBackendUserIntents } from './useBackendUserIntents';
|
|
11
|
+
export { useBackendIntentByTxHash } from './useBackendIntentByTxHash.js';
|
|
12
|
+
export { useBackendIntentByHash } from './useBackendIntentByHash.js';
|
|
13
|
+
export { useBackendUserIntents } from './useBackendUserIntents.js';
|
|
14
14
|
|
|
15
15
|
// Swap submit-tx hooks
|
|
16
|
-
export { useBackendSubmitSwapTx } from './useBackendSubmitSwapTx';
|
|
17
|
-
export { useBackendSubmitSwapTxStatus } from './useBackendSubmitSwapTxStatus';
|
|
16
|
+
export { useBackendSubmitSwapTx } from './useBackendSubmitSwapTx.js';
|
|
17
|
+
export { useBackendSubmitSwapTxStatus } from './useBackendSubmitSwapTxStatus.js';
|
|
18
18
|
|
|
19
19
|
// Solver hooks
|
|
20
|
-
export { useBackendOrderbook } from './useBackendOrderbook';
|
|
20
|
+
export { useBackendOrderbook } from './useBackendOrderbook.js';
|
|
21
21
|
|
|
22
22
|
// Money Market hooks
|
|
23
|
-
export { useBackendMoneyMarketPosition } from './useBackendMoneyMarketPosition';
|
|
24
|
-
export { useBackendAllMoneyMarketAssets } from './useBackendAllMoneyMarketAssets';
|
|
25
|
-
export { useBackendMoneyMarketAsset } from './useBackendMoneyMarketAsset';
|
|
26
|
-
export { useBackendMoneyMarketAssetBorrowers } from './useBackendMoneyMarketAssetBorrowers';
|
|
27
|
-
export { useBackendMoneyMarketAssetSuppliers } from './useBackendMoneyMarketAssetSuppliers';
|
|
28
|
-
export { useBackendAllMoneyMarketBorrowers } from './useBackendAllMoneyMarketBorrowers';
|
|
29
|
-
export * from './types';
|
|
23
|
+
export { useBackendMoneyMarketPosition } from './useBackendMoneyMarketPosition.js';
|
|
24
|
+
export { useBackendAllMoneyMarketAssets } from './useBackendAllMoneyMarketAssets.js';
|
|
25
|
+
export { useBackendMoneyMarketAsset } from './useBackendMoneyMarketAsset.js';
|
|
26
|
+
export { useBackendMoneyMarketAssetBorrowers } from './useBackendMoneyMarketAssetBorrowers.js';
|
|
27
|
+
export { useBackendMoneyMarketAssetSuppliers } from './useBackendMoneyMarketAssetSuppliers.js';
|
|
28
|
+
export { useBackendAllMoneyMarketBorrowers } from './useBackendAllMoneyMarketBorrowers.js';
|
|
29
|
+
export * from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { unwrapResult } from '../shared/unwrapResult.js';
|
|
@@ -1,60 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
import { useQuery, type UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
|
|
1
|
+
import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
|
3
2
|
import type { MoneyMarketAsset } from '@sodax/sdk';
|
|
4
|
-
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
3
|
+
import { useSodaxContext } from '../shared/useSodaxContext.js';
|
|
4
|
+
import { unwrapResult } from './unwrapResult.js';
|
|
5
|
+
import type { ReadHookParams } from '../shared/types.js';
|
|
5
6
|
|
|
6
|
-
export type UseBackendAllMoneyMarketAssetsParams =
|
|
7
|
-
queryOptions?: UseQueryOptions<MoneyMarketAsset[], Error>;
|
|
8
|
-
};
|
|
7
|
+
export type UseBackendAllMoneyMarketAssetsParams = ReadHookParams<MoneyMarketAsset[]>;
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* React hook to fetch all money market assets from the backend API.
|
|
12
11
|
*
|
|
13
|
-
* @param {UseBackendAllMoneyMarketAssetsParams | undefined} params - Optional parameters:
|
|
14
|
-
* - `queryOptions` (optional): React Query options to override default behavior (e.g., caching, retry, etc).
|
|
15
|
-
*
|
|
16
|
-
* @returns {UseQueryResult<MoneyMarketAsset[], Error>} React Query result object:
|
|
17
|
-
* - `data`: Array of all money market asset data when available.
|
|
18
|
-
* - `isLoading`: Boolean indicating if the request is in progress.
|
|
19
|
-
* - `error`: Error object if the request failed.
|
|
20
|
-
* - `refetch`: Function to manually trigger a data refresh.
|
|
21
|
-
*
|
|
22
12
|
* @example
|
|
23
13
|
* const { data: assets, isLoading, error } = useBackendAllMoneyMarketAssets();
|
|
24
|
-
*
|
|
25
|
-
* if (isLoading) return <div>Loading assets...</div>;
|
|
26
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
27
|
-
* if (assets) {
|
|
28
|
-
* console.log('Total assets:', assets.length);
|
|
29
|
-
* assets.forEach(asset => {
|
|
30
|
-
* console.log(`${asset.symbol}: ${asset.liquidityRate} liquidity rate`);
|
|
31
|
-
* });
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* @remarks
|
|
35
|
-
* - No required parameters — fetches all available money market assets from backend.
|
|
36
|
-
* - Uses React Query for caching, retries, and loading/error state management.
|
|
37
|
-
* - Supports overriding React Query config via `queryOptions`.
|
|
38
14
|
*/
|
|
39
|
-
export const useBackendAllMoneyMarketAssets = (
|
|
40
|
-
|
|
41
|
-
): UseQueryResult<MoneyMarketAsset[], Error> => {
|
|
15
|
+
export const useBackendAllMoneyMarketAssets = ({
|
|
16
|
+
queryOptions,
|
|
17
|
+
}: UseBackendAllMoneyMarketAssetsParams = {}): UseQueryResult<MoneyMarketAsset[], Error> => {
|
|
42
18
|
const { sodax } = useSodaxContext();
|
|
43
19
|
|
|
44
|
-
|
|
45
|
-
queryKey: ['
|
|
46
|
-
enabled: true,
|
|
47
|
-
retry: 3,
|
|
48
|
-
};
|
|
49
|
-
const queryOptions = {
|
|
50
|
-
...defaultQueryOptions,
|
|
51
|
-
...params?.queryOptions,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
return useQuery({
|
|
55
|
-
...queryOptions,
|
|
20
|
+
return useQuery<MoneyMarketAsset[], Error>({
|
|
21
|
+
queryKey: ['backend', 'mm', 'assets', 'all'],
|
|
56
22
|
queryFn: async (): Promise<MoneyMarketAsset[]> => {
|
|
57
|
-
return sodax.backendApi.getAllMoneyMarketAssets();
|
|
23
|
+
return unwrapResult(await sodax.backendApi.getAllMoneyMarketAssets());
|
|
58
24
|
},
|
|
25
|
+
retry: 3,
|
|
26
|
+
...queryOptions,
|
|
59
27
|
});
|
|
60
28
|
};
|
|
@@ -1,79 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
import { useQuery, type UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
|
|
1
|
+
import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
|
3
2
|
import type { MoneyMarketBorrowers } from '@sodax/sdk';
|
|
4
|
-
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
5
|
-
import
|
|
3
|
+
import { useSodaxContext } from '../shared/useSodaxContext.js';
|
|
4
|
+
import { unwrapResult } from './unwrapResult.js';
|
|
5
|
+
import type { BackendPaginationParams } from './types.js';
|
|
6
|
+
import type { ReadHookParams } from '../shared/types.js';
|
|
6
7
|
|
|
7
|
-
export type UseBackendAllMoneyMarketBorrowersParams =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export type UseBackendAllMoneyMarketBorrowersParams = ReadHookParams<
|
|
9
|
+
MoneyMarketBorrowers | undefined,
|
|
10
|
+
{
|
|
11
|
+
pagination: BackendPaginationParams;
|
|
12
|
+
}
|
|
13
|
+
>;
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* Hook for fetching all money market borrowers from the backend API.
|
|
14
17
|
*
|
|
15
|
-
* This hook provides access to the list of all borrowers across all money market assets,
|
|
16
|
-
* with pagination support. The data is automatically fetched and cached using React Query.
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} params - Pagination parameters for fetching all borrowers
|
|
19
|
-
* @param {string} params.offset - The offset for pagination (number as string)
|
|
20
|
-
* @param {string} params.limit - The limit for pagination (number as string)
|
|
21
|
-
*
|
|
22
|
-
* @returns {UseQueryResult<MoneyMarketBorrowers | undefined>} A query result object containing:
|
|
23
|
-
* - data: The all borrowers data when available
|
|
24
|
-
* - isLoading: Boolean indicating if the request is in progress
|
|
25
|
-
* - error: Error object if the request failed
|
|
26
|
-
* - refetch: Function to manually trigger a data refresh
|
|
27
|
-
*
|
|
28
18
|
* @example
|
|
29
19
|
* ```typescript
|
|
30
|
-
* const { data
|
|
31
|
-
* offset: '0',
|
|
32
|
-
* limit: '50'
|
|
20
|
+
* const { data, isLoading, error } = useBackendAllMoneyMarketBorrowers({
|
|
21
|
+
* params: { pagination: { offset: '0', limit: '50' } },
|
|
33
22
|
* });
|
|
34
|
-
*
|
|
35
|
-
* if (isLoading) return <div>Loading borrowers...</div>;
|
|
36
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
37
|
-
* if (borrowers) {
|
|
38
|
-
* console.log('Total borrowers:', borrowers.total);
|
|
39
|
-
* console.log('Borrowers:', borrowers.borrowers);
|
|
40
|
-
* }
|
|
41
23
|
* ```
|
|
42
|
-
*
|
|
43
|
-
* @remarks
|
|
44
|
-
* - The query is disabled when params are undefined or invalid
|
|
45
|
-
* - Uses React Query for efficient caching and state management
|
|
46
|
-
* - Automatically handles error states and loading indicators
|
|
47
|
-
* - Supports pagination through offset and limit parameters
|
|
48
|
-
* - Returns borrowers across all money market assets
|
|
49
24
|
*/
|
|
50
|
-
export const useBackendAllMoneyMarketBorrowers = (
|
|
51
|
-
params
|
|
52
|
-
|
|
25
|
+
export const useBackendAllMoneyMarketBorrowers = ({
|
|
26
|
+
params,
|
|
27
|
+
queryOptions,
|
|
28
|
+
}: UseBackendAllMoneyMarketBorrowersParams = {}): UseQueryResult<MoneyMarketBorrowers | undefined> => {
|
|
53
29
|
const { sodax } = useSodaxContext();
|
|
54
|
-
|
|
55
|
-
const defaultQueryOptions = {
|
|
56
|
-
queryKey: ['api', 'mm', 'borrowers', 'all', params],
|
|
57
|
-
enabled: !!params && !!params.pagination.offset && !!params.pagination.limit,
|
|
58
|
-
retry: 3,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const queryOptions = {
|
|
62
|
-
...defaultQueryOptions,
|
|
63
|
-
...params?.queryOptions,
|
|
64
|
-
};
|
|
30
|
+
const pagination = params?.pagination;
|
|
65
31
|
|
|
66
32
|
return useQuery({
|
|
67
|
-
|
|
33
|
+
queryKey: ['backend', 'mm', 'borrowers', 'all', pagination],
|
|
68
34
|
queryFn: async (): Promise<MoneyMarketBorrowers | undefined> => {
|
|
69
|
-
if (!
|
|
35
|
+
if (!pagination?.offset || !pagination?.limit) {
|
|
70
36
|
return undefined;
|
|
71
37
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
38
|
+
return unwrapResult(
|
|
39
|
+
await sodax.backendApi.getAllMoneyMarketBorrowers({
|
|
40
|
+
offset: pagination.offset,
|
|
41
|
+
limit: pagination.limit,
|
|
42
|
+
}),
|
|
43
|
+
);
|
|
77
44
|
},
|
|
45
|
+
enabled: !!pagination?.offset && !!pagination?.limit,
|
|
46
|
+
retry: 3,
|
|
47
|
+
...queryOptions,
|
|
78
48
|
});
|
|
79
49
|
};
|
|
@@ -1,63 +1,37 @@
|
|
|
1
|
-
import { useQuery, type
|
|
1
|
+
import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import type { IntentResponse } from '@sodax/sdk';
|
|
3
|
-
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
3
|
+
import { useSodaxContext } from '../shared/useSodaxContext.js';
|
|
4
|
+
import type { ReadHookParams } from '../shared/types.js';
|
|
4
5
|
|
|
5
|
-
export type UseBackendIntentByHashParams =
|
|
6
|
-
|
|
6
|
+
export type UseBackendIntentByHashParams = ReadHookParams<
|
|
7
|
+
IntentResponse | undefined,
|
|
8
|
+
{
|
|
7
9
|
intentHash: string | undefined;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
};
|
|
10
|
+
}
|
|
11
|
+
>;
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* React hook to fetch intent details from the backend API using an intent hash.
|
|
14
15
|
*
|
|
15
|
-
* @param {UseBackendIntentByHashParams | undefined} params - Parameters for the query:
|
|
16
|
-
* - params: { intentHash: string | undefined }
|
|
17
|
-
* - `intentHash`: The hash identifying the intent to fetch (disables query if undefined or empty).
|
|
18
|
-
* - queryOptions (optional): Options to customize React Query (e.g., staleTime, enabled).
|
|
19
|
-
*
|
|
20
|
-
* @returns {UseQueryResult<IntentResponse | undefined, Error>} React Query result containing intent response data, loading, error, and refetch states.
|
|
21
|
-
*
|
|
22
16
|
* @example
|
|
23
|
-
* const { data: intent
|
|
24
|
-
* params: { intentHash: '0xabc...' },
|
|
25
|
-
* });
|
|
26
|
-
*
|
|
27
|
-
* if (isLoading) return <div>Loading intent...</div>;
|
|
28
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
29
|
-
* if (intent) {
|
|
30
|
-
* console.log('Intent found:', intent.intentHash);
|
|
31
|
-
* }
|
|
32
|
-
*
|
|
33
|
-
* @remarks
|
|
34
|
-
* - Returns `undefined` data if no intentHash is provided or query is disabled.
|
|
35
|
-
* - Query is cached and managed using React Query.
|
|
36
|
-
* - Use `queryOptions` to customize caching, retry and fetch behavior.
|
|
17
|
+
* const { data: intent } = useBackendIntentByHash({ params: { intentHash: '0xabc...' } });
|
|
37
18
|
*/
|
|
38
|
-
export const useBackendIntentByHash = (
|
|
39
|
-
params
|
|
40
|
-
|
|
19
|
+
export const useBackendIntentByHash = ({
|
|
20
|
+
params,
|
|
21
|
+
queryOptions,
|
|
22
|
+
}: UseBackendIntentByHashParams = {}): UseQueryResult<IntentResponse | undefined, Error> => {
|
|
41
23
|
const { sodax } = useSodaxContext();
|
|
42
|
-
|
|
43
|
-
const defaultQueryOptions = {
|
|
44
|
-
queryKey: ['api', 'intent', 'hash', params?.params?.intentHash],
|
|
45
|
-
enabled: !!params?.params?.intentHash && params?.params?.intentHash.length > 0,
|
|
46
|
-
retry: 3,
|
|
47
|
-
};
|
|
48
|
-
const queryOptions = {
|
|
49
|
-
...defaultQueryOptions,
|
|
50
|
-
...params?.queryOptions,
|
|
51
|
-
};
|
|
24
|
+
const intentHash = params?.intentHash;
|
|
52
25
|
|
|
53
26
|
return useQuery({
|
|
54
|
-
|
|
27
|
+
queryKey: ['backend', 'intent', 'hash', intentHash],
|
|
55
28
|
queryFn: async (): Promise<IntentResponse | undefined> => {
|
|
56
|
-
if (!
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return sodax.backendApi.getIntentByHash(params.params.intentHash);
|
|
29
|
+
if (!intentHash) return undefined;
|
|
30
|
+
const result = await sodax.backendApi.getIntentByHash(intentHash);
|
|
31
|
+
return result.ok ? result.value : undefined;
|
|
61
32
|
},
|
|
33
|
+
enabled: !!intentHash && intentHash.length > 0,
|
|
34
|
+
retry: 3,
|
|
35
|
+
...queryOptions,
|
|
62
36
|
});
|
|
63
37
|
};
|
|
@@ -1,69 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
import { useQuery, type UseQueryOptions, type UseQueryResult } from '@tanstack/react-query';
|
|
1
|
+
import { useQuery, type UseQueryResult } from '@tanstack/react-query';
|
|
3
2
|
import type { IntentResponse } from '@sodax/sdk';
|
|
4
|
-
import { useSodaxContext } from '../shared/useSodaxContext';
|
|
3
|
+
import { useSodaxContext } from '../shared/useSodaxContext.js';
|
|
4
|
+
import type { ReadHookParams } from '../shared/types.js';
|
|
5
5
|
|
|
6
|
-
export type UseBackendIntentByTxHashParams =
|
|
7
|
-
|
|
6
|
+
export type UseBackendIntentByTxHashParams = ReadHookParams<
|
|
7
|
+
IntentResponse | undefined,
|
|
8
|
+
{
|
|
8
9
|
txHash: string | undefined;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
};
|
|
10
|
+
}
|
|
11
|
+
>;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* React hook for fetching intent details from the backend API using a transaction hash.
|
|
15
15
|
*
|
|
16
|
-
* @param {UseBackendIntentByTxHashParams | undefined} params - Parameters for the query:
|
|
17
|
-
* - params: { txHash: string | undefined }
|
|
18
|
-
* - `txHash`: Transaction hash used to retrieve the associated intent; query is disabled if undefined or empty.
|
|
19
|
-
* - queryOptions (optional): React Query options to customize request behavior (e.g., caching, retry, refetchInterval, etc.).
|
|
20
|
-
*
|
|
21
|
-
* @returns {UseQueryResult<IntentResponse | undefined, Error>} React Query result object, including:
|
|
22
|
-
* - `data`: The intent response or undefined if unavailable,
|
|
23
|
-
* - `isLoading`: Loading state,
|
|
24
|
-
* - `error`: Error (if request failed),
|
|
25
|
-
* - `refetch`: Function to refetch the data.
|
|
26
|
-
*
|
|
27
16
|
* @example
|
|
28
|
-
* const { data: intent
|
|
29
|
-
* params: { txHash: '0x123...' },
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* if (isLoading) return <div>Loading intent...</div>;
|
|
33
|
-
* if (error) return <div>Error: {error.message}</div>;
|
|
34
|
-
* if (intent) {
|
|
35
|
-
* console.log('Intent found:', intent.intentHash);
|
|
36
|
-
* }
|
|
17
|
+
* const { data: intent } = useBackendIntentByTxHash({ params: { txHash: '0x123...' } });
|
|
37
18
|
*
|
|
38
19
|
* @remarks
|
|
39
20
|
* - Intents are only created on the hub chain, so `txHash` must originate from there.
|
|
40
|
-
* -
|
|
41
|
-
* - Default refetch interval is 1 second. Uses React Query for state management, caching, and retries.
|
|
21
|
+
* - Default refetch interval is 1 second.
|
|
42
22
|
*/
|
|
43
|
-
export const useBackendIntentByTxHash = (
|
|
44
|
-
params
|
|
45
|
-
|
|
23
|
+
export const useBackendIntentByTxHash = ({
|
|
24
|
+
params,
|
|
25
|
+
queryOptions,
|
|
26
|
+
}: UseBackendIntentByTxHashParams = {}): UseQueryResult<IntentResponse | undefined, Error> => {
|
|
46
27
|
const { sodax } = useSodaxContext();
|
|
47
|
-
|
|
48
|
-
const defaultQueryOptions = {
|
|
49
|
-
queryKey: ['api', 'intent', 'txHash', params?.params?.txHash],
|
|
50
|
-
enabled: !!params?.params?.txHash && params?.params?.txHash.length > 0,
|
|
51
|
-
retry: 3,
|
|
52
|
-
refetchInterval: 1000,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const queryOptions = {
|
|
56
|
-
...defaultQueryOptions,
|
|
57
|
-
...params?.queryOptions,
|
|
58
|
-
};
|
|
28
|
+
const txHash = params?.txHash;
|
|
59
29
|
|
|
60
30
|
return useQuery({
|
|
61
|
-
|
|
31
|
+
queryKey: ['backend', 'intent', 'txHash', txHash],
|
|
62
32
|
queryFn: async (): Promise<IntentResponse | undefined> => {
|
|
63
|
-
if (!
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return sodax.backendApi.getIntentByTxHash(params.params.txHash);
|
|
33
|
+
if (!txHash) return undefined;
|
|
34
|
+
const result = await sodax.backendApi.getIntentByTxHash(txHash);
|
|
35
|
+
return result.ok ? result.value : undefined;
|
|
67
36
|
},
|
|
37
|
+
enabled: !!txHash && txHash.length > 0,
|
|
38
|
+
retry: 3,
|
|
39
|
+
refetchInterval: 1000,
|
|
40
|
+
...queryOptions,
|
|
68
41
|
});
|
|
69
42
|
};
|