@sodax/dapp-kit 0.0.1-rc.9 → 1.0.0-rc.2
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 +142 -44
- package/dist/index.d.mts +1514 -0
- package/dist/index.d.ts +1514 -4
- package/dist/index.js +997 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +957 -84
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -8
- package/src/contexts/index.ts +3 -2
- 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 +4 -0
- package/src/hooks/migrate/index.ts +4 -0
- package/src/hooks/migrate/types.ts +15 -0
- package/src/hooks/migrate/useMigrate.tsx +110 -0
- package/src/hooks/migrate/useMigrationAllowance.tsx +79 -0
- package/src/hooks/migrate/useMigrationApprove.tsx +129 -0
- package/src/hooks/mm/useMMAllowance.ts +2 -1
- package/src/hooks/mm/useMMApprove.ts +2 -1
- package/src/hooks/mm/useReservesData.ts +1 -8
- 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/useUserFormattedSummary.ts +54 -0
- package/src/hooks/mm/useUserReservesData.ts +30 -31
- package/src/hooks/provider/useHubProvider.ts +3 -3
- package/src/hooks/provider/useSpokeProvider.ts +45 -21
- package/src/hooks/shared/index.ts +4 -0
- package/src/hooks/shared/useDeriveUserWalletAddress.ts +44 -0
- package/src/hooks/shared/useEstimateGas.ts +18 -0
- package/src/hooks/shared/useRequestTrustline.ts +103 -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 +2 -1
- package/src/hooks/swap/useCancelSwap.ts +44 -0
- package/src/hooks/swap/useQuote.ts +16 -2
- package/src/hooks/swap/useStatus.ts +1 -1
- package/src/hooks/swap/{useCreateIntentOrder.ts → useSwap.ts} +16 -11
- package/src/hooks/swap/useSwapAllowance.ts +5 -1
- package/src/hooks/swap/useSwapApprove.ts +14 -14
- package/src/providers/SodaxProvider.tsx +8 -20
- package/dist/contexts/index.d.ts +0 -8
- package/dist/contexts/index.d.ts.map +0 -1
- package/dist/core/index.d.ts +0 -3
- 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 -9
- package/dist/hooks/mm/index.d.ts.map +0 -1
- package/dist/hooks/mm/useBorrow.d.ts +0 -35
- package/dist/hooks/mm/useBorrow.d.ts.map +0 -1
- package/dist/hooks/mm/useMMAllowance.d.ts +0 -26
- package/dist/hooks/mm/useMMAllowance.d.ts.map +0 -1
- package/dist/hooks/mm/useMMApprove.d.ts +0 -27
- package/dist/hooks/mm/useMMApprove.d.ts.map +0 -1
- package/dist/hooks/mm/useRepay.d.ts +0 -35
- package/dist/hooks/mm/useRepay.d.ts.map +0 -1
- package/dist/hooks/mm/useReservesData.d.ts +0 -19
- package/dist/hooks/mm/useReservesData.d.ts.map +0 -1
- package/dist/hooks/mm/useSupply.d.ts +0 -34
- package/dist/hooks/mm/useSupply.d.ts.map +0 -1
- package/dist/hooks/mm/useUserReservesData.d.ts +0 -3
- package/dist/hooks/mm/useUserReservesData.d.ts.map +0 -1
- package/dist/hooks/mm/useWithdraw.d.ts +0 -33
- 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 -18
- package/dist/hooks/provider/useSpokeProvider.d.ts.map +0 -1
- package/dist/hooks/shared/index.d.ts +0 -2
- package/dist/hooks/shared/index.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 -6
- 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/hooks/swap/useSwapAllowance.d.ts +0 -23
- package/dist/hooks/swap/useSwapAllowance.d.ts.map +0 -1
- package/dist/hooks/swap/useSwapApprove.d.ts +0 -26
- package/dist/hooks/swap/useSwapApprove.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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2025] [Sodax]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -10,23 +10,60 @@ dApp Kit is a collection of React components, hooks, and utilities designed to s
|
|
|
10
10
|
- Withdraw tokens from the money market (`useWithdraw`)
|
|
11
11
|
- Borrow tokens from the money market (`useBorrow`)
|
|
12
12
|
- Repay borrowed tokens (`useRepay`)
|
|
13
|
-
- Get user reserves data (`useUserReservesData`)
|
|
14
|
-
- Get reserves data (`useReservesData`)
|
|
15
13
|
- Check token allowance (`useMMAllowance`)
|
|
16
14
|
- Approve token spending (`useMMApprove`)
|
|
15
|
+
- Get user reserves data (`useUserReservesData`)
|
|
16
|
+
- Get reserves data (`useReservesData`)
|
|
17
|
+
- Get humanized reserves data (`useReservesHumanized`)
|
|
18
|
+
- Get list of reserves (`useReservesList`)
|
|
19
|
+
- Get USD formatted reserves data (`useReservesUsdFormat`)
|
|
20
|
+
- Get formatted user portfolio summary (`useUserFormattedSummary`)
|
|
17
21
|
|
|
18
22
|
- Swap/Intent
|
|
19
23
|
- Get quote for an intent order (`useQuote`)
|
|
20
|
-
- Create and submit an intent order (`
|
|
24
|
+
- Create and submit an swap intent order (`useSwap`)
|
|
21
25
|
- Get status of an intent order (`useStatus`)
|
|
22
26
|
- Check token allowance (`useSwapAllowance`)
|
|
23
27
|
- Approve token spending (`useSwapApprove`)
|
|
28
|
+
- Cancel a swap intent order (`useCancelSwap`)
|
|
24
29
|
|
|
25
30
|
- Provider
|
|
26
31
|
- Get hub chain provider (`useHubProvider`)
|
|
27
32
|
- Get spoke chain provider (`useSpokeProvider`)
|
|
28
33
|
- Get wallet provider (`useWalletProvider`)
|
|
29
34
|
|
|
35
|
+
- Bridge
|
|
36
|
+
- Bridge tokens between chains (`useBridge`)
|
|
37
|
+
- Check token allowance for bridging (`useBridgeAllowance`)
|
|
38
|
+
- Approve source token for bridging (`useBridgeApprove`)
|
|
39
|
+
- Get max amount available to be bridged (`useGetBridgeableAmount`)
|
|
40
|
+
- Get available destination tokens based on provided source token (`useGetBridgeableTokens`)
|
|
41
|
+
|
|
42
|
+
- Shared
|
|
43
|
+
- Derive user wallet address for hub abstraction (`useDeriveUserWalletAddress`)
|
|
44
|
+
- Check if Stellar trustline is established for an asset (`useStellarTrustlineCheck`)
|
|
45
|
+
- Request creation of Stellar trustline line for an asset (`useRequestTrustline`)
|
|
46
|
+
|
|
47
|
+
- Staking
|
|
48
|
+
- Stake SODA tokens to receive xSODA shares (`useStake`)
|
|
49
|
+
- Unstake xSODA shares (`useUnstake`)
|
|
50
|
+
- Instant unstake xSODA shares with penalty (`useInstantUnstake`)
|
|
51
|
+
- Claim unstaked SODA tokens after unstaking period (`useClaim`)
|
|
52
|
+
- Cancel unstake request (`useCancelUnstake`)
|
|
53
|
+
- Check SODA token allowance for staking (`useStakeAllowance`)
|
|
54
|
+
- Approve SODA token spending for staking (`useStakeApprove`)
|
|
55
|
+
- Check xSODA token allowance for unstaking (`useUnstakeAllowance`)
|
|
56
|
+
- Approve xSODA token spending for unstaking (`useUnstakeApprove`)
|
|
57
|
+
- Check xSODA token allowance for instant unstaking (`useInstantUnstakeAllowance`)
|
|
58
|
+
- Approve xSODA token spending for instant unstaking (`useInstantUnstakeApprove`)
|
|
59
|
+
- Get comprehensive staking information (`useStakingInfo`)
|
|
60
|
+
- Get unstaking information with penalty details (`useUnstakingInfoWithPenalty`)
|
|
61
|
+
- Get unstaking information (`useUnstakingInfo`)
|
|
62
|
+
- Get staking configuration (`useStakingConfig`)
|
|
63
|
+
- Get stake ratio (SODA to xSODA conversion rate) (`useStakeRatio`)
|
|
64
|
+
- Get instant unstake ratio (xSODA to SODA conversion rate with penalty) (`useInstantUnstakeRatio`)
|
|
65
|
+
- Get converted assets amount for xSODA shares (`useConvertedAssets`)
|
|
66
|
+
|
|
30
67
|
## Installation
|
|
31
68
|
|
|
32
69
|
```bash
|
|
@@ -42,56 +79,43 @@ pnpm add @sodax/dapp-kit
|
|
|
42
79
|
1. First, install the required dependencies:
|
|
43
80
|
|
|
44
81
|
```bash
|
|
45
|
-
|
|
82
|
+
pnpm install @sodax/dapp-kit @tanstack/react-query @sodax/wallet-sdk-react
|
|
46
83
|
```
|
|
47
84
|
|
|
48
85
|
2. Set up the providers in your app:
|
|
49
86
|
|
|
50
87
|
```typescript
|
|
51
88
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
52
|
-
import {
|
|
89
|
+
import { SodaxWalletProvider } from '@sodax/wallet-sdk-react';
|
|
53
90
|
import { SodaxProvider } from '@sodax/dapp-kit';
|
|
54
|
-
import {
|
|
91
|
+
import type { RpcConfig } from '@sodax/types';
|
|
55
92
|
|
|
56
93
|
const queryClient = new QueryClient();
|
|
57
94
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
relayerApiEndpoint: 'https://xcall-relay.nw.iconblockchain.xyz',
|
|
95
|
+
const rpcConfig: RpcConfig = {
|
|
96
|
+
// EVM chains
|
|
97
|
+
sonic: 'https://rpc.soniclabs.com',
|
|
98
|
+
'0xa86a.avax': 'https://api.avax.network/ext/bc/C/rpc',
|
|
99
|
+
'0xa4b1.arbitrum': 'https://arb1.arbitrum.io/rpc',
|
|
100
|
+
'0x2105.base': 'https://mainnet.base.org',
|
|
101
|
+
'0x38.bsc': 'https://bsc-dataseed1.binance.org',
|
|
102
|
+
'0xa.optimism': 'https://mainnet.optimism.io',
|
|
103
|
+
'0x89.polygon': 'https://polygon-rpc.com',
|
|
104
|
+
|
|
105
|
+
// Other chains
|
|
106
|
+
'0x1.icon': 'https://ctz.solidwallet.io/api/v3',
|
|
107
|
+
solana: 'https://solana-mainnet.g.alchemy.com/v2/your-api-key',
|
|
108
|
+
sui: 'https://fullnode.mainnet.sui.io',
|
|
109
|
+
'injective-1': 'https://sentry.tm.injective.network:26657',
|
|
74
110
|
};
|
|
75
111
|
|
|
76
112
|
function App() {
|
|
77
113
|
return (
|
|
78
|
-
<SodaxProvider testnet={false}
|
|
114
|
+
<SodaxProvider testnet={false} rpcConfig={rpcConfig}>
|
|
79
115
|
<QueryClientProvider client={queryClient}>
|
|
80
|
-
<
|
|
81
|
-
config={{
|
|
82
|
-
EVM: {
|
|
83
|
-
wagmiConfig: wagmiConfig,
|
|
84
|
-
},
|
|
85
|
-
SUI: {
|
|
86
|
-
isMainnet: true,
|
|
87
|
-
},
|
|
88
|
-
SOLANA: {
|
|
89
|
-
endpoint: 'https://solana-mainnet.g.alchemy.com/v2/your-api-key',
|
|
90
|
-
},
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
116
|
+
<SodaxWalletProvider rpcConfig={rpcConfig}>
|
|
93
117
|
<YourApp />
|
|
94
|
-
</
|
|
118
|
+
</SodaxWalletProvider>
|
|
95
119
|
</QueryClientProvider>
|
|
96
120
|
</SodaxProvider>
|
|
97
121
|
);
|
|
@@ -102,7 +126,7 @@ function App() {
|
|
|
102
126
|
|
|
103
127
|
```typescript
|
|
104
128
|
// Connect Wallet Operations
|
|
105
|
-
import { useXConnectors, useXConnect, useXAccount } from '@sodax/wallet-sdk';
|
|
129
|
+
import { useXConnectors, useXConnect, useXAccount } from '@sodax/wallet-sdk-react';
|
|
106
130
|
const evmConnectors = useXConnectors('EVM');
|
|
107
131
|
const { mutateAsync: connect, isPending } = useXConnect();
|
|
108
132
|
const account = useXAccount('EVM');
|
|
@@ -158,8 +182,26 @@ function TokenManagementComponent() {
|
|
|
158
182
|
};
|
|
159
183
|
}
|
|
160
184
|
|
|
185
|
+
// Wallet Address Derivation
|
|
186
|
+
import { useDeriveUserWalletAddress, useSpokeProvider } from '@sodax/dapp-kit';
|
|
187
|
+
|
|
188
|
+
function WalletAddressComponent() {
|
|
189
|
+
const spokeProvider = useSpokeProvider(chainId, walletProvider);
|
|
190
|
+
|
|
191
|
+
// Derive user wallet address for hub abstraction
|
|
192
|
+
const { data: derivedAddress, isLoading, error } = useDeriveUserWalletAddress(spokeProvider, userAddress);
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<div>
|
|
196
|
+
{isLoading && <div>Deriving wallet address...</div>}
|
|
197
|
+
{error && <div>Error: {error.message}</div>}
|
|
198
|
+
{derivedAddress && <div>Derived Address: {derivedAddress}</div>}
|
|
199
|
+
</div>
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
|
|
161
203
|
// Swap Operations
|
|
162
|
-
import { useQuote,
|
|
204
|
+
import { useQuote, useSwap, useStatus } from '@sodax/dapp-kit';
|
|
163
205
|
|
|
164
206
|
function SwapComponent() {
|
|
165
207
|
// Get quote for an intent order
|
|
@@ -173,9 +215,9 @@ function SwapComponent() {
|
|
|
173
215
|
});
|
|
174
216
|
|
|
175
217
|
// Create and submit an intent order
|
|
176
|
-
const { mutateAsync:
|
|
177
|
-
const
|
|
178
|
-
const order = await
|
|
218
|
+
const { mutateAsync: swap, isPending: isCreating } = useSwap();
|
|
219
|
+
const handleSwap = async () => {
|
|
220
|
+
const order = await swap({
|
|
179
221
|
token_src: '0x...',
|
|
180
222
|
token_src_blockchain_id: '0xa86a.avax',
|
|
181
223
|
token_dst: '0x...',
|
|
@@ -188,6 +230,53 @@ function SwapComponent() {
|
|
|
188
230
|
// Get status of an intent order
|
|
189
231
|
const { data: orderStatus } = useStatus('0x...');
|
|
190
232
|
}
|
|
233
|
+
|
|
234
|
+
// Bridge Operations
|
|
235
|
+
import { useBridge, useBridgeAllowance, useBridgeApprove, useGetBridgeableAmount, useGetBridgeableTokens } from '@sodax/dapp-kit';
|
|
236
|
+
|
|
237
|
+
function BridgeComponent() {
|
|
238
|
+
const spokeProvider = useSpokeProvider(chainId, walletProvider);
|
|
239
|
+
|
|
240
|
+
// Get available destination tokens for bridging
|
|
241
|
+
const { data: bridgeableTokens, isLoading: isTokensLoading } = useGetBridgeableTokens(
|
|
242
|
+
'0x2105.base', // from chain
|
|
243
|
+
'0x89.polygon', // to chain
|
|
244
|
+
'0x...' // source token address
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
// Get maximum amount available to bridge
|
|
248
|
+
const { data: bridgeableAmount } = useGetBridgeableAmount(
|
|
249
|
+
{ address: '0x...', xChainId: '0x2105.base' }, // from token
|
|
250
|
+
{ address: '0x...', xChainId: '0x89.polygon' } // to token
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
// Check token allowance for bridge
|
|
254
|
+
const { data: hasAllowed } = useBridgeAllowance(bridgeParams, spokeProvider);
|
|
255
|
+
|
|
256
|
+
// Approve tokens for bridge
|
|
257
|
+
const { approve: approveBridge, isLoading: isApproving } = useBridgeApprove(spokeProvider);
|
|
258
|
+
const handleApprove = async () => {
|
|
259
|
+
await approveBridge(bridgeParams);
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// Execute bridge transaction
|
|
263
|
+
const { mutateAsync: bridge, isPending: isBridging } = useBridge(spokeProvider);
|
|
264
|
+
const handleBridge = async () => {
|
|
265
|
+
const result = await bridge({
|
|
266
|
+
srcChainId: '0x2105.base',
|
|
267
|
+
srcAsset: '0x...',
|
|
268
|
+
amount: 1000n,
|
|
269
|
+
dstChainId: '0x89.polygon',
|
|
270
|
+
dstAsset: '0x...',
|
|
271
|
+
recipient: '0x...'
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
console.log('Bridge transaction hashes:', {
|
|
275
|
+
spokeTxHash: result.value[0],
|
|
276
|
+
hubTxHash: result.value[1]
|
|
277
|
+
});
|
|
278
|
+
};
|
|
279
|
+
}
|
|
191
280
|
```
|
|
192
281
|
|
|
193
282
|
## Requirements
|
|
@@ -216,14 +305,23 @@ function SwapComponent() {
|
|
|
216
305
|
|
|
217
306
|
#### Swap Hooks
|
|
218
307
|
- [`useQuote()`](./src/hooks/swap/useQuote.ts) - Get quote for an intent order
|
|
219
|
-
- [`
|
|
308
|
+
- [`useSwap()`](./src/hooks/swap/useSwap.ts) - Create and submit an intent order
|
|
220
309
|
- [`useStatus()`](./src/hooks/swap/useStatus.ts) - Get status of an intent order
|
|
221
310
|
- [`useSwapAllowance()`](./src/hooks/swap/useSwapAllowance.ts) - Check token allowance for an intent order
|
|
222
311
|
- [`useSwapApprove()`](./src/hooks/swap/useSwapApprove.ts) - Approve token spending
|
|
312
|
+
- [`useCancelSwap()`](./src/hooks/swap/useCancelSwap.ts) - Cancel a swap intent order
|
|
223
313
|
|
|
224
314
|
#### Shared Hooks
|
|
225
315
|
- [`useSodaxContext()`](./src/hooks/shared/useSodaxContext.ts) - Access Sodax context and configuration
|
|
226
|
-
|
|
316
|
+
- [`useEstimateGas()`](./src/hooks/shared/useEstimateGas.ts) - Estimate gas costs for transactions
|
|
317
|
+
- [`useDeriveUserWalletAddress()`](./src/hooks/shared/useDeriveUserWalletAddress.ts) - Derive user wallet address for hub abstraction
|
|
318
|
+
|
|
319
|
+
#### Bridge Hooks
|
|
320
|
+
- [`useBridge()`](./src/hooks/bridge/useBridge.ts) - Execute bridge transactions to transfer tokens between chains
|
|
321
|
+
- [`useBridgeAllowance()`](./src/hooks/bridge/useBridgeAllowance.ts) - Check token allowance for bridge operations
|
|
322
|
+
- [`useBridgeApprove()`](./src/hooks/bridge/useBridgeApprove.ts) - Approve token spending for bridge actions
|
|
323
|
+
- [`useGetBridgeableAmount()`](./src/hooks/bridge/useGetBridgeableAmount.ts) - Get maximum amount available to be bridged
|
|
324
|
+
- [`useGetBridgeableTokens()`](./src/hooks/bridge/useGetBridgeableTokens.ts) - Get available destination tokens for bridging
|
|
227
325
|
|
|
228
326
|
## Contributing
|
|
229
327
|
|