@sodax/dapp-kit 2.1.0-rc.1 → 2.1.0-rc.3
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/dist/index.d.ts +225 -3
- package/dist/index.mjs +220 -4
- package/package.json +2 -2
- package/src/hooks/_mutationContract.test.ts +4 -0
- package/src/hooks/backend/README.md +1 -1
- package/src/hooks/bridgeApi/index.ts +13 -0
- package/src/hooks/bridgeApi/useBridgeApiAllowance.ts +42 -0
- package/src/hooks/bridgeApi/useBridgeApiApprove.ts +42 -0
- package/src/hooks/bridgeApi/useBridgeApiBridgeableAmount.ts +45 -0
- package/src/hooks/bridgeApi/useBridgeApiCreateBridgeIntent.ts +42 -0
- package/src/hooks/bridgeApi/useBridgeApiFee.ts +44 -0
- package/src/hooks/bridgeApi/useBridgeApiIsBridgeable.ts +45 -0
- package/src/hooks/bridgeApi/useBridgeApiSubmitTx.ts +50 -0
- package/src/hooks/bridgeApi/useBridgeApiSubmitTxStatus.ts +60 -0
- package/src/hooks/bridgeApi/useBridgeApiTokens.ts +35 -0
- package/src/hooks/bridgeApi/useBridgeApiTokensByChain.ts +40 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/swapsApi/index.ts +1 -0
- package/src/hooks/swapsApi/useSwapsApiApproveAndBroadcast.test.ts +192 -0
- package/src/hooks/swapsApi/useSwapsApiApproveAndBroadcast.ts +132 -0
- package/src/hooks/swapsApi/useSwapsApiSubmitTxStatus.ts +6 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UseMutationOptions, UseQueryOptions, UseMutationResult, MutateOptions, UseQueryResult, QueryClientConfig, QueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, StellarChainKey, IStellarWalletProvider, INearWalletProvider, GetWalletProviderType, StellarAccountStatus, ActivateStellarAccountResult, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, IWalletProvider, RadfiUtxo, MoneyMarketBorrowActionParams, TxHashPair, MoneyMarketRepayActionParams, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, Hex, CreateIntentParams, CreateLimitOrderParams, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, GetSwapTokensResponseV2, RequestOverrideConfig, GetSwapTokensByChainResponseV2, QuoteResponseV2, QuoteRequestV2, QuoteQueryV2, DeadlineResponseV2, DeadlineQueryV2, AllowanceCheckResponseV2, CreateIntentParamsV2, ApproveResponseV2, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusResponseV2, SwapIntentStatusCodeV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashResponseV2, IntentRequestV2, IntentPacketResponseV2, IntentPacketRequestV2, IntentExtraDataResponseV2, IntentExtraDataRequestV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateResponseV2, GasEstimateRequestV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusResponseV2, BridgeParams, CreateBridgeIntentParams, BridgeLimit, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, PartnerFeeClaimCancelAction, GetUserIntentParams, HubAssetBalance, WithdrawHubAssetAction, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, LeverageYieldEffectiveApr, LeverageYieldPosition, LeverageYieldSwapDepositParams, LeverageYieldSwapPayload, SolverExecutionRequest, SolverExecutionResponse, VaultSwapActionParams, VaultSwapResponse, LeverageYieldSwapWithdrawParams, ActivateStellarAccountParams, StellarSponsorConfig, SodaxOptions } from '@sodax/sdk';
|
|
2
|
+
import { Result, Sodax, SpokeChainKey, GetEstimateGasReturnType, EstimateGasParams, StellarChainKey, IStellarWalletProvider, INearWalletProvider, GetWalletProviderType, StellarAccountStatus, ActivateStellarAccountResult, IXServiceBase, XToken, EvmHubProvider, IBitcoinWalletProvider, RadfiWalletBalance, IWalletProvider, RadfiUtxo, MoneyMarketBorrowActionParams, TxHashPair, MoneyMarketRepayActionParams, MoneyMarketSupplyActionParams, MoneyMarketWithdrawActionParams, UserReserveData, AggregatedReserveData, BaseCurrencyInfo, ReservesDataHumanized, Address as Address$1, MoneyMarketParams, MoneyMarketApproveActionParams, TxReturnType, Erc20Token, ChainKey, ReserveDataHumanized, FormatReserveUSDResponse, FormatUserSummaryResponse, SolverIntentQuoteResponse, SolverErrorResponse, SolverIntentQuoteRequest, SwapActionParams, SwapResponse, SolverIntentStatusResponse, Hex, CreateIntentParams, CreateLimitOrderParams, Intent, LimitOrderActionParams, IntentResponse, UserIntentsResponse, OrderbookResponse, MoneyMarketPosition, MoneyMarketAsset, MoneyMarketAssetBorrowers, MoneyMarketAssetSuppliers, MoneyMarketBorrowers, GetSwapTokensResponseV2, RequestOverrideConfig, GetSwapTokensByChainResponseV2, QuoteResponseV2, QuoteRequestV2, QuoteQueryV2, DeadlineResponseV2, DeadlineQueryV2, AllowanceCheckResponseV2, CreateIntentParamsV2, ApproveResponseV2, CreateIntentResponseV2, SubmitIntentRequestV2, SubmitIntentResponseV2, StatusResponseV2, SwapIntentStatusCodeV2, CancelIntentRequestV2, CancelIntentResponseV2, IntentHashResponseV2, IntentRequestV2, IntentPacketResponseV2, IntentPacketRequestV2, IntentExtraDataResponseV2, IntentExtraDataRequestV2, IntentStateV2, GetIntentResponseV2, CreateLimitOrderParamsV2, CreateLimitOrderResponseV2, GasEstimateResponseV2, GasEstimateRequestV2, FeeResponseV2, SubmitTxRequestV2, SubmitTxResponseV2, SubmitTxStatusResponseV2, BridgeParams, CreateBridgeIntentParams, BridgeLimit, BridgeAllowanceCheckResponseV2, CreateBridgeIntentParamsV2, BridgeApproveResponseV2, BridgeableAmountResponseV2, BridgeQuoteRequestV2, CreateBridgeIntentResponseV2, BridgeFeeResponseV2, BridgeFeeRequestV2, BridgeableCheckResponseV2, BridgeSubmitTxRequestV2, BridgeSubmitTxResponseV2, BridgeSubmitTxStatusResponseV2, GetBridgeTokensResponseV2, GetBridgeTokensByChainResponseV2, StakeAction, StakeParams, UnstakeAction, ClaimAction, CancelUnstakeAction, StakingInfo, UnstakingInfo, UnstakeRequestWithPenalty, StakingConfig, InstantUnstakeAction, UnstakeParams, InstantUnstakeParams, PartnerFeeClaimAssetBalance, AutoSwapPreferences, FeeTokenApproveParams, FeeTokenApproveAction, HubChainKey, SetSwapPreferenceAction, PartnerFeeClaimSwapAction, IntentAutoSwapResult, PartnerFeeClaimCancelAction, GetUserIntentParams, HubAssetBalance, WithdrawHubAssetAction, IcxMigrateAction, IcxRevertMigrationAction, UnifiedBnUSDMigrateAction, BalnMigrateAction, MigrationAction, IcxMigrateParams, IcxCreateRevertMigrationParams, UnifiedBnUSDMigrateParams, BalnMigrateParams, PoolKey, PoolData, ClPositionInfo, AssetDepositAction, AssetWithdrawAction, CreateAssetDepositParams, ClSupplyParams, ClIncreaseLiquidityParams, ClLiquidityDecreaseLiquidityAction, ClDecreaseLiquidityParams, CreateAssetWithdrawParams, PoolSpokeAssets, DestinationParamsType, ClLiquidityClaimRewardsAction, LeverageYieldEffectiveApr, LeverageYieldPosition, LeverageYieldSwapDepositParams, LeverageYieldSwapPayload, SolverExecutionRequest, SolverExecutionResponse, VaultSwapActionParams, VaultSwapResponse, LeverageYieldSwapWithdrawParams, ActivateStellarAccountParams, StellarSponsorConfig, SodaxOptions } from '@sodax/sdk';
|
|
3
3
|
export * from '@sodax/sdk';
|
|
4
4
|
import { Address } from 'viem';
|
|
5
5
|
import { ReactNode, ReactElement } from 'react';
|
|
@@ -1065,6 +1065,42 @@ type UseSwapsApiApproveVars = {
|
|
|
1065
1065
|
*/
|
|
1066
1066
|
declare const useSwapsApiApprove: ({ mutationOptions, }?: MutationHookParams<ApproveResponseV2, UseSwapsApiApproveVars>) => SafeUseMutationResult<ApproveResponseV2, Error, UseSwapsApiApproveVars>;
|
|
1067
1067
|
|
|
1068
|
+
/** Hashes of the transactions this hook broadcast, in the order they were sent. */
|
|
1069
|
+
type SwapsApiApprovalHashes = {
|
|
1070
|
+
/** Present only when the source token needed its stale allowance cleared first. */
|
|
1071
|
+
readonly resetTxHash?: string;
|
|
1072
|
+
readonly approveTxHash: string;
|
|
1073
|
+
};
|
|
1074
|
+
type UseSwapsApiApproveAndBroadcastVars<K extends SpokeChainKey = SpokeChainKey> = {
|
|
1075
|
+
body: CreateIntentParamsV2;
|
|
1076
|
+
walletProvider: GetWalletProviderType<K>;
|
|
1077
|
+
apiConfig?: RequestOverrideConfig;
|
|
1078
|
+
};
|
|
1079
|
+
/**
|
|
1080
|
+
* React hook that runs the whole swaps-API approval: asks the API for the transactions, then signs,
|
|
1081
|
+
* broadcasts, and waits for each one.
|
|
1082
|
+
*
|
|
1083
|
+
* Prefer this over {@link useSwapsApiApprove}, which returns the unsigned `{ tx, resetTx? }` and
|
|
1084
|
+
* leaves the rest to you. A source token of the 2017 TetherToken lineage rejects an allowance change
|
|
1085
|
+
* from one non-zero value to another, so the API can hand back a **reset** transaction that must be
|
|
1086
|
+
* mined **before** the approve is even a valid state transition. Broadcasting them out of order, or
|
|
1087
|
+
* without waiting, spends the user's gas on a transaction that is certain to revert — and that is
|
|
1088
|
+
* ordering the package should own rather than every integration re-deriving it.
|
|
1089
|
+
*
|
|
1090
|
+
* Because confirmation now happens inside the hook, it can invalidate `['swapsApi','allowance']`
|
|
1091
|
+
* itself; callers of `useSwapsApiApprove` have to refetch by hand.
|
|
1092
|
+
*
|
|
1093
|
+
* Supports the chains the swaps API can approve on — the hub (Sonic), EVM spokes, and Stellar.
|
|
1094
|
+
* Every other chain reports its allowance as always sufficient, so approval never runs for it.
|
|
1095
|
+
*
|
|
1096
|
+
* @example
|
|
1097
|
+
* const { mutateAsyncSafe: approve } = useSwapsApiApproveAndBroadcast();
|
|
1098
|
+
* const result = await approve({ body: createIntentParams, walletProvider });
|
|
1099
|
+
* if (!result.ok) return;
|
|
1100
|
+
* const { resetTxHash, approveTxHash } = result.value; // resetTxHash only on a guarded token
|
|
1101
|
+
*/
|
|
1102
|
+
declare const useSwapsApiApproveAndBroadcast: <K extends SpokeChainKey = "0xa86a.avax" | "0xa4b1.arbitrum" | "0x2105.base" | "0x38.bsc" | "injective-1" | "sonic" | "0x1.icon" | "sui" | "0xa.optimism" | "0x89.polygon" | "solana" | "stellar" | "hyper" | "lightlink" | "near" | "ethereum" | "bitcoin" | "redbelly" | "0x2019.kaia" | "stacks" | "hedera">({ mutationOptions, }?: MutationHookParams<SwapsApiApprovalHashes, UseSwapsApiApproveAndBroadcastVars<K>>) => SafeUseMutationResult<SwapsApiApprovalHashes, Error, UseSwapsApiApproveAndBroadcastVars<K>>;
|
|
1103
|
+
|
|
1068
1104
|
/**
|
|
1069
1105
|
* Mutation variables for {@link useSwapsApiCreateIntent}. The per-request `apiConfig` override
|
|
1070
1106
|
* belongs here rather than at the hook level.
|
|
@@ -1319,7 +1355,8 @@ type UseSwapsApiSubmitTxStatusParams = ReadHookParams<SubmitTxStatusResponseV2 |
|
|
|
1319
1355
|
* });
|
|
1320
1356
|
*
|
|
1321
1357
|
* @remarks
|
|
1322
|
-
* - Default refetch interval is 1 second; stops on 'solved' or 'failed' status
|
|
1358
|
+
* - Default refetch interval is 1 second; stops on 'solved' or 'failed' status, or when the
|
|
1359
|
+
* backend marks the submission abandoned (`abandonedAt`) while `status` stays non-terminal.
|
|
1323
1360
|
*/
|
|
1324
1361
|
declare const useSwapsApiSubmitTxStatus: ({ params, queryOptions, }?: UseSwapsApiSubmitTxStatusParams) => UseQueryResult<SubmitTxStatusResponseV2 | undefined, Error>;
|
|
1325
1362
|
|
|
@@ -1372,6 +1409,191 @@ type UseGetBridgeableTokensParams = ReadHookParams<XToken[], {
|
|
|
1372
1409
|
}>;
|
|
1373
1410
|
declare function useGetBridgeableTokens({ params, queryOptions, }?: UseGetBridgeableTokensParams): UseQueryResult<XToken[], Error>;
|
|
1374
1411
|
|
|
1412
|
+
type UseBridgeApiAllowanceParams = ReadHookParams<BridgeAllowanceCheckResponseV2 | undefined, {
|
|
1413
|
+
body: CreateBridgeIntentParamsV2 | undefined;
|
|
1414
|
+
apiConfig?: RequestOverrideConfig;
|
|
1415
|
+
}>;
|
|
1416
|
+
/**
|
|
1417
|
+
* React hook to check whether the source-token allowance is already sufficient for a bridge via
|
|
1418
|
+
* the bridge API — `sodax.api.bridge.checkAllowance`. Returns `{ valid }`.
|
|
1419
|
+
*
|
|
1420
|
+
* The `body` uses the wire DTO field names (`inputToken`/`inputAmount`).
|
|
1421
|
+
*
|
|
1422
|
+
* @example
|
|
1423
|
+
* const { data: allowance } = useBridgeApiAllowance({ params: { body: createBridgeIntentParams } });
|
|
1424
|
+
*/
|
|
1425
|
+
declare const useBridgeApiAllowance: ({ params, queryOptions, }?: UseBridgeApiAllowanceParams) => UseQueryResult<BridgeAllowanceCheckResponseV2 | undefined, Error>;
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
* Mutation variables for {@link useBridgeApiApprove}. The per-request `apiConfig` override belongs
|
|
1429
|
+
* here rather than at the hook level — different calls in the same component can target different
|
|
1430
|
+
* endpoints without re-rendering.
|
|
1431
|
+
*/
|
|
1432
|
+
type UseBridgeApiApproveVars = {
|
|
1433
|
+
body: CreateBridgeIntentParamsV2;
|
|
1434
|
+
apiConfig?: RequestOverrideConfig;
|
|
1435
|
+
};
|
|
1436
|
+
/**
|
|
1437
|
+
* React hook to build an unsigned token-approval transaction for the source token via the bridge
|
|
1438
|
+
* API — `sodax.api.bridge.approve`. Returns `{ tx }` (chain-specific unsigned tx) to sign and
|
|
1439
|
+
* broadcast yourself; it does not change state, so no queries are invalidated.
|
|
1440
|
+
*
|
|
1441
|
+
* @example
|
|
1442
|
+
* const { mutateAsync: approve } = useBridgeApiApprove();
|
|
1443
|
+
* const { tx } = await approve({ body: createBridgeIntentParams });
|
|
1444
|
+
*/
|
|
1445
|
+
declare const useBridgeApiApprove: ({ mutationOptions, }?: MutationHookParams<BridgeApproveResponseV2, UseBridgeApiApproveVars>) => SafeUseMutationResult<BridgeApproveResponseV2, Error, UseBridgeApiApproveVars>;
|
|
1446
|
+
|
|
1447
|
+
type UseBridgeApiBridgeableAmountParams = ReadHookParams<BridgeableAmountResponseV2 | undefined, {
|
|
1448
|
+
body: BridgeQuoteRequestV2 | undefined;
|
|
1449
|
+
apiConfig?: RequestOverrideConfig;
|
|
1450
|
+
}>;
|
|
1451
|
+
/**
|
|
1452
|
+
* React hook to fetch the deposit capacity / withdrawal liquidity limit for a (from, to) token pair
|
|
1453
|
+
* via the bridge API — `sodax.api.bridge.getBridgeableAmount`. Returns `{ limit }`.
|
|
1454
|
+
*
|
|
1455
|
+
* Computable client-side from config + vault reserves — prefer `sodax.bridge.getBridgeableAmount`
|
|
1456
|
+
* for a no-round-trip read; this HTTP variant mirrors the `/bridge/bridgeable-amount` endpoint.
|
|
1457
|
+
*
|
|
1458
|
+
* The `body` uses the wire DTO field names (`srcChainKey`/`dstChainKey`/`inputToken`/`outputToken`).
|
|
1459
|
+
*
|
|
1460
|
+
* @example
|
|
1461
|
+
* const { data } = useBridgeApiBridgeableAmount({ params: { body: quote } });
|
|
1462
|
+
*/
|
|
1463
|
+
declare const useBridgeApiBridgeableAmount: ({ params, queryOptions, }?: UseBridgeApiBridgeableAmountParams) => UseQueryResult<BridgeableAmountResponseV2 | undefined, Error>;
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* Mutation variables for {@link useBridgeApiCreateBridgeIntent}. The per-request `apiConfig`
|
|
1467
|
+
* override belongs here rather than at the hook level.
|
|
1468
|
+
*/
|
|
1469
|
+
type UseBridgeApiCreateBridgeIntentVars = {
|
|
1470
|
+
body: CreateBridgeIntentParamsV2;
|
|
1471
|
+
apiConfig?: RequestOverrideConfig;
|
|
1472
|
+
};
|
|
1473
|
+
/**
|
|
1474
|
+
* React hook to build an unsigned spoke-deposit (create-bridge-intent) transaction via the bridge
|
|
1475
|
+
* API — `sodax.api.bridge.createBridgeIntent`. Returns `{ tx, relayData }` (no `intent` struct —
|
|
1476
|
+
* bridge is vault-backed) to sign and broadcast yourself; it does not change state, so no queries
|
|
1477
|
+
* are invalidated.
|
|
1478
|
+
*
|
|
1479
|
+
* @example
|
|
1480
|
+
* const { mutateAsync: createBridgeIntent } = useBridgeApiCreateBridgeIntent();
|
|
1481
|
+
* const { tx, relayData } = await createBridgeIntent({ body: createBridgeIntentParams });
|
|
1482
|
+
*/
|
|
1483
|
+
declare const useBridgeApiCreateBridgeIntent: ({ mutationOptions, }?: MutationHookParams<CreateBridgeIntentResponseV2, UseBridgeApiCreateBridgeIntentVars>) => SafeUseMutationResult<CreateBridgeIntentResponseV2, Error, UseBridgeApiCreateBridgeIntentVars>;
|
|
1484
|
+
|
|
1485
|
+
type UseBridgeApiFeeParams = ReadHookParams<BridgeFeeResponseV2 | undefined, {
|
|
1486
|
+
body: BridgeFeeRequestV2 | undefined;
|
|
1487
|
+
apiConfig?: RequestOverrideConfig;
|
|
1488
|
+
}>;
|
|
1489
|
+
/**
|
|
1490
|
+
* React hook to fetch the bridge partner fee for an input amount via the bridge API (uses a per-request
|
|
1491
|
+
* `body.partnerFee` override when supplied, else the backend-configured fee) —
|
|
1492
|
+
* `sodax.api.bridge.getFee`. Returns `{ fee }` (smallest unit, decimal string).
|
|
1493
|
+
*
|
|
1494
|
+
* The fee is computable client-side (config-driven, token-independent) — prefer `sodax.bridge.getFee`
|
|
1495
|
+
* for a no-round-trip read; this HTTP variant mirrors the `/bridge/fee` endpoint for parity.
|
|
1496
|
+
*
|
|
1497
|
+
* @example
|
|
1498
|
+
* const { data: fee } = useBridgeApiFee({ params: { body: { inputAmount } } });
|
|
1499
|
+
*/
|
|
1500
|
+
declare const useBridgeApiFee: ({ params, queryOptions, }?: UseBridgeApiFeeParams) => UseQueryResult<BridgeFeeResponseV2 | undefined, Error>;
|
|
1501
|
+
|
|
1502
|
+
type UseBridgeApiIsBridgeableParams = ReadHookParams<BridgeableCheckResponseV2 | undefined, {
|
|
1503
|
+
body: BridgeQuoteRequestV2 | undefined;
|
|
1504
|
+
apiConfig?: RequestOverrideConfig;
|
|
1505
|
+
}>;
|
|
1506
|
+
/**
|
|
1507
|
+
* React hook to check whether a (from, to) token pair is bridgeable via the bridge API —
|
|
1508
|
+
* `sodax.api.bridge.isBridgeable`. Returns `{ bridgeable }`.
|
|
1509
|
+
*
|
|
1510
|
+
* Computable client-side from config + vault reserves — prefer `sodax.bridge.isBridgeable`
|
|
1511
|
+
* for a no-round-trip read; this HTTP variant mirrors the `/bridge/bridgeable/check` endpoint.
|
|
1512
|
+
*
|
|
1513
|
+
* The `body` uses the wire DTO field names (`srcChainKey`/`dstChainKey`/`inputToken`/`outputToken`).
|
|
1514
|
+
*
|
|
1515
|
+
* @example
|
|
1516
|
+
* const { data } = useBridgeApiIsBridgeable({ params: { body: quote } });
|
|
1517
|
+
*/
|
|
1518
|
+
declare const useBridgeApiIsBridgeable: ({ params, queryOptions, }?: UseBridgeApiIsBridgeableParams) => UseQueryResult<BridgeableCheckResponseV2 | undefined, Error>;
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* Mutation variables for {@link useBridgeApiSubmitTx}. The per-request `apiConfig` override
|
|
1522
|
+
* (e.g. base URL) belongs here rather than at the hook level — different submissions in the same
|
|
1523
|
+
* component can target different endpoints without re-rendering.
|
|
1524
|
+
*/
|
|
1525
|
+
type UseBridgeApiSubmitTxVars = {
|
|
1526
|
+
request: BridgeSubmitTxRequestV2;
|
|
1527
|
+
apiConfig?: RequestOverrideConfig;
|
|
1528
|
+
};
|
|
1529
|
+
/**
|
|
1530
|
+
* React hook for submitting a broadcast bridge (spoke-deposit) transaction to be processed
|
|
1531
|
+
* (relayed server-side) via the bridge API — `sodax.api.bridge.submitTx`. Called AFTER signing +
|
|
1532
|
+
* broadcasting the spoke-deposit tx, handing it (with the FULL `relayData { address, payload }`
|
|
1533
|
+
* envelope) to the backend.
|
|
1534
|
+
*
|
|
1535
|
+
* Pure mutation: pass `{ request, apiConfig? }` to `mutate({...})`. Default `retry: 3` is applied
|
|
1536
|
+
* at the hook level — consumers can override via `mutationOptions.retry`.
|
|
1537
|
+
*
|
|
1538
|
+
* @example
|
|
1539
|
+
* const { mutateAsync: submitBridgeTx, isPending, error } = useBridgeApiSubmitTx();
|
|
1540
|
+
*
|
|
1541
|
+
* const result = await submitBridgeTx({
|
|
1542
|
+
* request: { txHash: '0x123...', srcChainKey: '0xa4b1.arbitrum', walletAddress: '0xabc...', relayData: { address: '0x...', payload: '0x...' } },
|
|
1543
|
+
* apiConfig: { baseURL: 'https://...' },
|
|
1544
|
+
* });
|
|
1545
|
+
*/
|
|
1546
|
+
declare const useBridgeApiSubmitTx: ({ mutationOptions, }?: MutationHookParams<BridgeSubmitTxResponseV2, UseBridgeApiSubmitTxVars>) => SafeUseMutationResult<BridgeSubmitTxResponseV2, Error, UseBridgeApiSubmitTxVars>;
|
|
1547
|
+
|
|
1548
|
+
type UseBridgeApiSubmitTxStatusParams = ReadHookParams<BridgeSubmitTxStatusResponseV2 | undefined, {
|
|
1549
|
+
txHash: string | undefined;
|
|
1550
|
+
srcChainKey?: string;
|
|
1551
|
+
apiConfig?: RequestOverrideConfig;
|
|
1552
|
+
}>;
|
|
1553
|
+
/**
|
|
1554
|
+
* React hook for polling the processing status of a submitted bridge transaction via the bridge
|
|
1555
|
+
* API — `sodax.api.bridge.getSubmitTxStatus`. Both `txHash` and `srcChainKey` are required for the
|
|
1556
|
+
* query to run.
|
|
1557
|
+
*
|
|
1558
|
+
* @example
|
|
1559
|
+
* const { data: status } = useBridgeApiSubmitTxStatus({
|
|
1560
|
+
* params: { txHash: '0x123...', srcChainKey: '0xa4b1.arbitrum' },
|
|
1561
|
+
* });
|
|
1562
|
+
*
|
|
1563
|
+
* @remarks
|
|
1564
|
+
* - Default refetch interval is 1 second; stops on 'executed' or 'failed' status, or when the
|
|
1565
|
+
* backend marks the submission abandoned (`abandonedAt`) while `status` stays non-terminal —
|
|
1566
|
+
* mirroring the SDK's backend submit-tx poll (no solver `posting_execution` state — bridge has
|
|
1567
|
+
* no post-execution).
|
|
1568
|
+
*/
|
|
1569
|
+
declare const useBridgeApiSubmitTxStatus: ({ params, queryOptions, }?: UseBridgeApiSubmitTxStatusParams) => UseQueryResult<BridgeSubmitTxStatusResponseV2 | undefined, Error>;
|
|
1570
|
+
|
|
1571
|
+
type UseBridgeApiTokensParams = ReadHookParams<GetBridgeTokensResponseV2, {
|
|
1572
|
+
apiConfig?: RequestOverrideConfig;
|
|
1573
|
+
}>;
|
|
1574
|
+
/**
|
|
1575
|
+
* React hook to fetch all supported bridge tokens grouped by SpokeChainKey via the bridge API —
|
|
1576
|
+
* `sodax.api.bridge.getTokens`. The token list is backend-served; the bridgeable-amount quote is
|
|
1577
|
+
* computable client-side via `useGetBridgeableAmount` (also mirrored by `useBridgeApiBridgeableAmount`).
|
|
1578
|
+
*
|
|
1579
|
+
* @example
|
|
1580
|
+
* const { data: tokensByChain } = useBridgeApiTokens();
|
|
1581
|
+
*/
|
|
1582
|
+
declare const useBridgeApiTokens: ({ params, queryOptions, }?: UseBridgeApiTokensParams) => UseQueryResult<GetBridgeTokensResponseV2, Error>;
|
|
1583
|
+
|
|
1584
|
+
type UseBridgeApiTokensByChainParams = ReadHookParams<GetBridgeTokensByChainResponseV2 | undefined, {
|
|
1585
|
+
chainKey: string | undefined;
|
|
1586
|
+
apiConfig?: RequestOverrideConfig;
|
|
1587
|
+
}>;
|
|
1588
|
+
/**
|
|
1589
|
+
* React hook to fetch supported bridge tokens for a single SpokeChainKey via the bridge API —
|
|
1590
|
+
* `sodax.api.bridge.getTokensByChain`. Use `useBridgeApiTokens` for every chain at once.
|
|
1591
|
+
*
|
|
1592
|
+
* @example
|
|
1593
|
+
* const { data: tokens } = useBridgeApiTokensByChain({ params: { chainKey: '0xa4b1.arbitrum' } });
|
|
1594
|
+
*/
|
|
1595
|
+
declare const useBridgeApiTokensByChain: ({ params, queryOptions, }?: UseBridgeApiTokensByChainParams) => UseQueryResult<GetBridgeTokensByChainResponseV2 | undefined, Error>;
|
|
1596
|
+
|
|
1375
1597
|
/**
|
|
1376
1598
|
* Mutation variables for {@link useStake}. Generic over `K extends SpokeChainKey` (defaults to
|
|
1377
1599
|
* the full union). Sophisticated callers can lock K at the hook call site to narrow the
|
|
@@ -2430,4 +2652,4 @@ interface NearStorageGateState {
|
|
|
2430
2652
|
*/
|
|
2431
2653
|
declare function resolveNearStorageGate(chainKey: SpokeChainKey, check: NearStorageCheckResult): NearStorageGateState;
|
|
2432
2654
|
|
|
2433
|
-
export { type ATokenData, type BackendPaginationParams, type BitcoinTradingSetup, type CreateSodaxQueryClientOptions, type DecreaseLiquidityParamsCore, type DepositParamsCore, type LeverageYieldShareHolder, type LeverageYieldShareHolding, type MutationHookOptions, type MutationHookParams, type NearStorageCheckResult, type NearStorageGateState, type RadfiSession, type ReadHookParams, type ReadQueryOptions, type ReserveUsdFormat, type SafeUseMutationResult, SodaxProvider, type StellarCheckResult, type StellarGate, type StellarGateInputs, type StellarGateState, type UseATokenParams, type UseATokensBalancesParams, type UseActivateStellarAccountVars, type UseApproveTokenVars, type UseBitcoinBalanceParams, type UseBitcoinTradingSetupParams, type UseBorrowVars, type UseBridgeAllowanceParams, type UseBridgeApproveVars, type UseBridgeVars, type UseClaimRewardsVars, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateLimitOrderVars, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityVars, type UseDeriveUserWalletAddressParams, type UseDexAllowanceParams, type UseDexApproveVars, type UseDexDepositVars, type UseDexWithdrawVars, type UseEnsureRadfiAccessTokenVars, type UseEstablishTrustlineVars, type UseExpiredUtxosParams, type UseFeeClaimSwapVars, type UseFeeClaimWithdrawVars, type UseFetchAssetsBalancesParams, type UseFundTradingWalletVars, type UseGetAutoSwapPreferencesParams, type UseGetBridgeableAmountParams, type UseGetBridgeableTokensParams, type UseGetIntentDetailsParams, type UseGetUserHubWalletAddressParams, type UseGetUserIntentParams, type UseHubAssetBalancesParams, type UseIsTokenApprovedParams, type UseLeverageYieldDepositVars, type UseLeverageYieldEffectiveAprParams, type UseLeverageYieldNotifySolverVars, type UseLeverageYieldPositionParams, type UseLeverageYieldPreviewRedeemParams, type UseLeverageYieldShareBalancesParams, type UseLeverageYieldTotalAssetsParams, type UseLeverageYieldVaultSwapVars, type UseLeverageYieldWithdrawVars, type UseLiquidityAmountsResult, type UseMMAllowanceParams, type UseMMApproveVars, type UseMigrateBalnVars, type UseMigrateIcxToSodaVars, type UseMigratebnUSDVars, type UseMigrationAllowanceInputs, type UseMigrationAllowanceParams, type UseMigrationApproveVars, type UseNearStorageCheckParams, type UsePartnerCancelIntentVars, type UsePoolBalancesParams, type UsePoolBalancesResponse, type UsePoolDataParams, type UsePoolsParams, type UsePositionInfoParams, type UsePositionInfoResponse, type UseQuoteParams, type UseRadfiAuthVars, type UseRadfiSessionReturn, type UseRadfiWithdrawVars, type UseRegisterNearStorageVars, type UseRenewUtxosVars, type UseRepayVars, type UseReservesDataParams, type UseReservesHumanizedParams, type UseReservesListParams, type UseReservesUsdFormatParams, type UseRevertMigrateSodaToIcxVars, type UseSetSwapPreferenceVars, type UseSetSwapPreferenceVarsHub, type UseSponsorConfigParams, type UseStatusParams, type UseStellarAccountActiveParams, type UseStellarAccountStatusParams, type UseStellarGateParams, type UseStellarTrustlineCheckParams, type UseSupplyLiquidityVars, type UseSupplyVars, type UseSwapAllowanceParams, type UseSwapApproveVars, type UseSwapVars, type UseSwapsApiAllowanceParams, type UseSwapsApiApproveVars, type UseSwapsApiCancelIntentVars, type UseSwapsApiCreateIntentVars, type UseSwapsApiCreateLimitOrderVars, type UseSwapsApiDeadlineParams, type UseSwapsApiEstimateGasParams, type UseSwapsApiFilledIntentParams, type UseSwapsApiIntentExtraDataParams, type UseSwapsApiIntentHashParams, type UseSwapsApiIntentPacketParams, type UseSwapsApiIntentParams, type UseSwapsApiPartnerFeeParams, type UseSwapsApiQuoteParams, type UseSwapsApiSolverFeeParams, type UseSwapsApiStatusParams, type UseSwapsApiSubmitIntentVars, type UseSwapsApiSubmitTxStatusParams, type UseSwapsApiSubmitTxVars, type UseSwapsApiTokensByChainParams, type UseSwapsApiTokensParams, type UseTradingWalletBalanceParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawHubAssetVars, type UseWithdrawVars, type UseXBalancesParams, type WithdrawParamsCore, type XBalancesInputs, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getXBalancesQueryOptions, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, 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, useLeverageYieldDeposit, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, 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, 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 };
|
|
2655
|
+
export { type ATokenData, type BackendPaginationParams, type BitcoinTradingSetup, type CreateSodaxQueryClientOptions, type DecreaseLiquidityParamsCore, type DepositParamsCore, type LeverageYieldShareHolder, type LeverageYieldShareHolding, type MutationHookOptions, type MutationHookParams, type NearStorageCheckResult, type NearStorageGateState, type RadfiSession, type ReadHookParams, type ReadQueryOptions, type ReserveUsdFormat, type SafeUseMutationResult, SodaxProvider, type StellarCheckResult, type StellarGate, type StellarGateInputs, type StellarGateState, type SwapsApiApprovalHashes, type UseATokenParams, type UseATokensBalancesParams, type UseActivateStellarAccountVars, type UseApproveTokenVars, type UseBitcoinBalanceParams, type UseBitcoinTradingSetupParams, type UseBorrowVars, type UseBridgeAllowanceParams, type UseBridgeApiAllowanceParams, type UseBridgeApiApproveVars, type UseBridgeApiBridgeableAmountParams, type UseBridgeApiCreateBridgeIntentVars, type UseBridgeApiFeeParams, type UseBridgeApiIsBridgeableParams, type UseBridgeApiSubmitTxStatusParams, type UseBridgeApiSubmitTxVars, type UseBridgeApiTokensByChainParams, type UseBridgeApiTokensParams, type UseBridgeApproveVars, type UseBridgeVars, type UseClaimRewardsVars, type UseCreateDecreaseLiquidityParamsProps, type UseCreateDepositParamsProps, type UseCreateLimitOrderVars, type UseCreateSupplyLiquidityParamsProps, type UseCreateSupplyLiquidityParamsResult, type UseCreateWithdrawParamsProps, type UseDecreaseLiquidityVars, type UseDeriveUserWalletAddressParams, type UseDexAllowanceParams, type UseDexApproveVars, type UseDexDepositVars, type UseDexWithdrawVars, type UseEnsureRadfiAccessTokenVars, type UseEstablishTrustlineVars, type UseExpiredUtxosParams, type UseFeeClaimSwapVars, type UseFeeClaimWithdrawVars, type UseFetchAssetsBalancesParams, type UseFundTradingWalletVars, type UseGetAutoSwapPreferencesParams, type UseGetBridgeableAmountParams, type UseGetBridgeableTokensParams, type UseGetIntentDetailsParams, type UseGetUserHubWalletAddressParams, type UseGetUserIntentParams, type UseHubAssetBalancesParams, type UseIsTokenApprovedParams, type UseLeverageYieldDepositVars, type UseLeverageYieldEffectiveAprParams, type UseLeverageYieldNotifySolverVars, type UseLeverageYieldPositionParams, type UseLeverageYieldPreviewRedeemParams, type UseLeverageYieldShareBalancesParams, type UseLeverageYieldTotalAssetsParams, type UseLeverageYieldVaultSwapVars, type UseLeverageYieldWithdrawVars, type UseLiquidityAmountsResult, type UseMMAllowanceParams, type UseMMApproveVars, type UseMigrateBalnVars, type UseMigrateIcxToSodaVars, type UseMigratebnUSDVars, type UseMigrationAllowanceInputs, type UseMigrationAllowanceParams, type UseMigrationApproveVars, type UseNearStorageCheckParams, type UsePartnerCancelIntentVars, type UsePoolBalancesParams, type UsePoolBalancesResponse, type UsePoolDataParams, type UsePoolsParams, type UsePositionInfoParams, type UsePositionInfoResponse, type UseQuoteParams, type UseRadfiAuthVars, type UseRadfiSessionReturn, type UseRadfiWithdrawVars, type UseRegisterNearStorageVars, type UseRenewUtxosVars, type UseRepayVars, type UseReservesDataParams, type UseReservesHumanizedParams, type UseReservesListParams, type UseReservesUsdFormatParams, type UseRevertMigrateSodaToIcxVars, type UseSetSwapPreferenceVars, type UseSetSwapPreferenceVarsHub, type UseSponsorConfigParams, type UseStatusParams, type UseStellarAccountActiveParams, type UseStellarAccountStatusParams, type UseStellarGateParams, type UseStellarTrustlineCheckParams, type UseSupplyLiquidityVars, type UseSupplyVars, type UseSwapAllowanceParams, type UseSwapApproveVars, type UseSwapVars, type UseSwapsApiAllowanceParams, type UseSwapsApiApproveAndBroadcastVars, type UseSwapsApiApproveVars, type UseSwapsApiCancelIntentVars, type UseSwapsApiCreateIntentVars, type UseSwapsApiCreateLimitOrderVars, type UseSwapsApiDeadlineParams, type UseSwapsApiEstimateGasParams, type UseSwapsApiFilledIntentParams, type UseSwapsApiIntentExtraDataParams, type UseSwapsApiIntentHashParams, type UseSwapsApiIntentPacketParams, type UseSwapsApiIntentParams, type UseSwapsApiPartnerFeeParams, type UseSwapsApiQuoteParams, type UseSwapsApiSolverFeeParams, type UseSwapsApiStatusParams, type UseSwapsApiSubmitIntentVars, type UseSwapsApiSubmitTxStatusParams, type UseSwapsApiSubmitTxVars, type UseSwapsApiTokensByChainParams, type UseSwapsApiTokensParams, type UseTradingWalletBalanceParams, type UseUserFormattedSummaryParams, type UseUserReservesDataParams, type UseWithdrawHubAssetVars, type UseWithdrawVars, type UseXBalancesParams, type WithdrawParamsCore, type XBalancesInputs, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getXBalancesQueryOptions, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, 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, useLeverageYieldDeposit, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, 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 };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isSodaxError, ChainKeys, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, RadfiApiError, normalizePsbtToBase64, ClService, SPONSOR_CONFIG_TTL_MS, Sodax } from '@sodax/sdk';
|
|
1
|
+
import { isSodaxError, ChainKeys, STELLAR_TRUSTLINE_MIN_XLM_STROOPS, RadfiApiError, normalizePsbtToBase64, isHubChainKeyType, isEvmSpokeOnlyChainKeyType, isStellarChainKeyType, ClService, SPONSOR_CONFIG_TTL_MS, Sodax } 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';
|
|
@@ -1492,6 +1492,56 @@ var useSwapsApiApprove = ({
|
|
|
1492
1492
|
mutationFn: async ({ body, apiConfig }) => unwrapResult(await sodax.api.swaps.approve(body, apiConfig))
|
|
1493
1493
|
});
|
|
1494
1494
|
};
|
|
1495
|
+
var isRevertedEvmReceiptStatus = (status) => status === "reverted" || status === "0x0";
|
|
1496
|
+
var useSwapsApiApproveAndBroadcast = ({
|
|
1497
|
+
mutationOptions
|
|
1498
|
+
} = {}) => {
|
|
1499
|
+
const { sodax } = useSodaxContext();
|
|
1500
|
+
const queryClient = useQueryClient();
|
|
1501
|
+
return useSafeMutation({
|
|
1502
|
+
mutationKey: ["swapsApi", "approveAndBroadcast"],
|
|
1503
|
+
...mutationOptions,
|
|
1504
|
+
mutationFn: async ({ body, walletProvider, apiConfig }) => {
|
|
1505
|
+
const { tx, resetTx } = unwrapResult(await sodax.api.swaps.approve(body, apiConfig));
|
|
1506
|
+
const srcChainKey = body.srcChainKey;
|
|
1507
|
+
const sendAndWait = async (raw, step) => {
|
|
1508
|
+
if (isHubChainKeyType(srcChainKey) || isEvmSpokeOnlyChainKeyType(srcChainKey)) {
|
|
1509
|
+
const evm = walletProvider;
|
|
1510
|
+
const hash = await evm.sendTransaction(raw);
|
|
1511
|
+
const receipt = await evm.waitForTransactionReceipt(hash);
|
|
1512
|
+
if (isRevertedEvmReceiptStatus(receipt.status)) {
|
|
1513
|
+
throw new Error(`[useSwapsApiApproveAndBroadcast] the ${step} transaction ${hash} reverted on chain.`);
|
|
1514
|
+
}
|
|
1515
|
+
return hash;
|
|
1516
|
+
}
|
|
1517
|
+
if (isStellarChainKeyType(srcChainKey)) {
|
|
1518
|
+
const stellar = walletProvider;
|
|
1519
|
+
if (!stellar.signAndSendTransaction) {
|
|
1520
|
+
throw new Error(
|
|
1521
|
+
"[useSwapsApiApproveAndBroadcast] this Stellar wallet provider does not implement signAndSendTransaction."
|
|
1522
|
+
);
|
|
1523
|
+
}
|
|
1524
|
+
const hash = await stellar.signAndSendTransaction(raw);
|
|
1525
|
+
const receipt = await stellar.waitForTransactionReceipt(hash);
|
|
1526
|
+
if (receipt.successful === false) {
|
|
1527
|
+
throw new Error(`[useSwapsApiApproveAndBroadcast] the ${step} transaction ${hash} failed on chain.`);
|
|
1528
|
+
}
|
|
1529
|
+
return hash;
|
|
1530
|
+
}
|
|
1531
|
+
throw new Error(
|
|
1532
|
+
`[useSwapsApiApproveAndBroadcast] ${srcChainKey} cannot be approved \u2014 the swaps API supports the hub (Sonic), EVM spokes, and Stellar.`
|
|
1533
|
+
);
|
|
1534
|
+
};
|
|
1535
|
+
const resetTxHash = resetTx === void 0 ? void 0 : await sendAndWait(resetTx, "allowance reset");
|
|
1536
|
+
const approveTxHash = await sendAndWait(tx, "approve");
|
|
1537
|
+
return resetTxHash === void 0 ? { approveTxHash } : { resetTxHash, approveTxHash };
|
|
1538
|
+
},
|
|
1539
|
+
onSuccess: async (data, vars, ctx) => {
|
|
1540
|
+
queryClient.invalidateQueries({ queryKey: ["swapsApi", "allowance"] });
|
|
1541
|
+
await mutationOptions?.onSuccess?.(data, vars, ctx);
|
|
1542
|
+
}
|
|
1543
|
+
});
|
|
1544
|
+
};
|
|
1495
1545
|
|
|
1496
1546
|
// src/hooks/swapsApi/useSwapsApiCreateIntent.ts
|
|
1497
1547
|
var useSwapsApiCreateIntent = ({
|
|
@@ -1742,8 +1792,8 @@ var useSwapsApiSubmitTxStatus = ({
|
|
|
1742
1792
|
enabled: !!txHash && txHash.length > 0 && !!srcChainKey,
|
|
1743
1793
|
retry: 3,
|
|
1744
1794
|
refetchInterval: (query) => {
|
|
1745
|
-
const
|
|
1746
|
-
if (status === "solved" || status === "failed") return false;
|
|
1795
|
+
const data = query.state.data?.data;
|
|
1796
|
+
if (data?.status === "solved" || data?.status === "failed" || data?.abandonedAt) return false;
|
|
1747
1797
|
return 1e3;
|
|
1748
1798
|
},
|
|
1749
1799
|
...queryOptions
|
|
@@ -1862,6 +1912,172 @@ function useGetBridgeableTokens({
|
|
|
1862
1912
|
...queryOptions
|
|
1863
1913
|
});
|
|
1864
1914
|
}
|
|
1915
|
+
var useBridgeApiAllowance = ({
|
|
1916
|
+
params,
|
|
1917
|
+
queryOptions
|
|
1918
|
+
} = {}) => {
|
|
1919
|
+
const { sodax } = useSodaxContext();
|
|
1920
|
+
const body = params?.body;
|
|
1921
|
+
const apiConfig = params?.apiConfig;
|
|
1922
|
+
return useQuery({
|
|
1923
|
+
queryKey: ["bridgeApi", "allowance", body?.srcChainKey, body?.inputToken, body?.inputAmount, body?.srcAddress],
|
|
1924
|
+
queryFn: async () => {
|
|
1925
|
+
if (!body) return void 0;
|
|
1926
|
+
return unwrapResult(await sodax.api.bridge.checkAllowance(body, apiConfig));
|
|
1927
|
+
},
|
|
1928
|
+
enabled: !!body,
|
|
1929
|
+
retry: 3,
|
|
1930
|
+
...queryOptions
|
|
1931
|
+
});
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
// src/hooks/bridgeApi/useBridgeApiApprove.ts
|
|
1935
|
+
var useBridgeApiApprove = ({
|
|
1936
|
+
mutationOptions
|
|
1937
|
+
} = {}) => {
|
|
1938
|
+
const { sodax } = useSodaxContext();
|
|
1939
|
+
return useSafeMutation({
|
|
1940
|
+
mutationKey: ["bridgeApi", "approve"],
|
|
1941
|
+
retry: 3,
|
|
1942
|
+
...mutationOptions,
|
|
1943
|
+
mutationFn: async ({ body, apiConfig }) => unwrapResult(await sodax.api.bridge.approve(body, apiConfig))
|
|
1944
|
+
});
|
|
1945
|
+
};
|
|
1946
|
+
var useBridgeApiBridgeableAmount = ({
|
|
1947
|
+
params,
|
|
1948
|
+
queryOptions
|
|
1949
|
+
} = {}) => {
|
|
1950
|
+
const { sodax } = useSodaxContext();
|
|
1951
|
+
const body = params?.body;
|
|
1952
|
+
const apiConfig = params?.apiConfig;
|
|
1953
|
+
return useQuery({
|
|
1954
|
+
queryKey: ["bridgeApi", "bridgeableAmount", body?.srcChainKey, body?.dstChainKey, body?.inputToken, body?.outputToken],
|
|
1955
|
+
queryFn: async () => {
|
|
1956
|
+
if (!body) return void 0;
|
|
1957
|
+
return unwrapResult(await sodax.api.bridge.getBridgeableAmount(body, apiConfig));
|
|
1958
|
+
},
|
|
1959
|
+
enabled: !!body,
|
|
1960
|
+
retry: 3,
|
|
1961
|
+
...queryOptions
|
|
1962
|
+
});
|
|
1963
|
+
};
|
|
1964
|
+
|
|
1965
|
+
// src/hooks/bridgeApi/useBridgeApiCreateBridgeIntent.ts
|
|
1966
|
+
var useBridgeApiCreateBridgeIntent = ({
|
|
1967
|
+
mutationOptions
|
|
1968
|
+
} = {}) => {
|
|
1969
|
+
const { sodax } = useSodaxContext();
|
|
1970
|
+
return useSafeMutation({
|
|
1971
|
+
mutationKey: ["bridgeApi", "createBridgeIntent"],
|
|
1972
|
+
retry: 3,
|
|
1973
|
+
...mutationOptions,
|
|
1974
|
+
mutationFn: async ({ body, apiConfig }) => unwrapResult(await sodax.api.bridge.createBridgeIntent(body, apiConfig))
|
|
1975
|
+
});
|
|
1976
|
+
};
|
|
1977
|
+
var useBridgeApiFee = ({
|
|
1978
|
+
params,
|
|
1979
|
+
queryOptions
|
|
1980
|
+
} = {}) => {
|
|
1981
|
+
const { sodax } = useSodaxContext();
|
|
1982
|
+
const body = params?.body;
|
|
1983
|
+
const apiConfig = params?.apiConfig;
|
|
1984
|
+
return useQuery({
|
|
1985
|
+
queryKey: ["bridgeApi", "fee", body?.inputAmount, body?.partnerFee],
|
|
1986
|
+
queryFn: async () => {
|
|
1987
|
+
if (!body) return void 0;
|
|
1988
|
+
return unwrapResult(await sodax.api.bridge.getFee(body, apiConfig));
|
|
1989
|
+
},
|
|
1990
|
+
enabled: !!body,
|
|
1991
|
+
retry: 3,
|
|
1992
|
+
...queryOptions
|
|
1993
|
+
});
|
|
1994
|
+
};
|
|
1995
|
+
var useBridgeApiIsBridgeable = ({
|
|
1996
|
+
params,
|
|
1997
|
+
queryOptions
|
|
1998
|
+
} = {}) => {
|
|
1999
|
+
const { sodax } = useSodaxContext();
|
|
2000
|
+
const body = params?.body;
|
|
2001
|
+
const apiConfig = params?.apiConfig;
|
|
2002
|
+
return useQuery({
|
|
2003
|
+
queryKey: ["bridgeApi", "bridgeable", body?.srcChainKey, body?.dstChainKey, body?.inputToken, body?.outputToken],
|
|
2004
|
+
queryFn: async () => {
|
|
2005
|
+
if (!body) return void 0;
|
|
2006
|
+
return unwrapResult(await sodax.api.bridge.isBridgeable(body, apiConfig));
|
|
2007
|
+
},
|
|
2008
|
+
enabled: !!body,
|
|
2009
|
+
retry: 3,
|
|
2010
|
+
...queryOptions
|
|
2011
|
+
});
|
|
2012
|
+
};
|
|
2013
|
+
|
|
2014
|
+
// src/hooks/bridgeApi/useBridgeApiSubmitTx.ts
|
|
2015
|
+
var useBridgeApiSubmitTx = ({
|
|
2016
|
+
mutationOptions
|
|
2017
|
+
} = {}) => {
|
|
2018
|
+
const { sodax } = useSodaxContext();
|
|
2019
|
+
return useSafeMutation({
|
|
2020
|
+
mutationKey: ["bridgeApi", "submitTx"],
|
|
2021
|
+
retry: 3,
|
|
2022
|
+
...mutationOptions,
|
|
2023
|
+
mutationFn: async ({ request, apiConfig }) => unwrapResult(await sodax.api.bridge.submitTx(request, apiConfig))
|
|
2024
|
+
});
|
|
2025
|
+
};
|
|
2026
|
+
var useBridgeApiSubmitTxStatus = ({
|
|
2027
|
+
params,
|
|
2028
|
+
queryOptions
|
|
2029
|
+
} = {}) => {
|
|
2030
|
+
const { sodax } = useSodaxContext();
|
|
2031
|
+
const txHash = params?.txHash;
|
|
2032
|
+
const srcChainKey = params?.srcChainKey;
|
|
2033
|
+
const apiConfig = params?.apiConfig;
|
|
2034
|
+
return useQuery({
|
|
2035
|
+
queryKey: ["bridgeApi", "submitTx", "status", txHash, srcChainKey],
|
|
2036
|
+
queryFn: async () => {
|
|
2037
|
+
if (!txHash || !srcChainKey) return void 0;
|
|
2038
|
+
return unwrapResult(await sodax.api.bridge.getSubmitTxStatus({ txHash, srcChainKey }, apiConfig));
|
|
2039
|
+
},
|
|
2040
|
+
enabled: !!txHash && txHash.length > 0 && !!srcChainKey,
|
|
2041
|
+
retry: 3,
|
|
2042
|
+
refetchInterval: (query) => {
|
|
2043
|
+
const data = query.state.data?.data;
|
|
2044
|
+
if (data?.status === "executed" || data?.status === "failed" || data?.abandonedAt) return false;
|
|
2045
|
+
return 1e3;
|
|
2046
|
+
},
|
|
2047
|
+
...queryOptions
|
|
2048
|
+
});
|
|
2049
|
+
};
|
|
2050
|
+
var useBridgeApiTokens = ({
|
|
2051
|
+
params,
|
|
2052
|
+
queryOptions
|
|
2053
|
+
} = {}) => {
|
|
2054
|
+
const { sodax } = useSodaxContext();
|
|
2055
|
+
const apiConfig = params?.apiConfig;
|
|
2056
|
+
return useQuery({
|
|
2057
|
+
queryKey: ["bridgeApi", "tokens"],
|
|
2058
|
+
queryFn: async () => unwrapResult(await sodax.api.bridge.getTokens(apiConfig)),
|
|
2059
|
+
retry: 3,
|
|
2060
|
+
...queryOptions
|
|
2061
|
+
});
|
|
2062
|
+
};
|
|
2063
|
+
var useBridgeApiTokensByChain = ({
|
|
2064
|
+
params,
|
|
2065
|
+
queryOptions
|
|
2066
|
+
} = {}) => {
|
|
2067
|
+
const { sodax } = useSodaxContext();
|
|
2068
|
+
const chainKey = params?.chainKey;
|
|
2069
|
+
const apiConfig = params?.apiConfig;
|
|
2070
|
+
return useQuery({
|
|
2071
|
+
queryKey: ["bridgeApi", "tokens", chainKey],
|
|
2072
|
+
queryFn: async () => {
|
|
2073
|
+
if (!chainKey) return void 0;
|
|
2074
|
+
return unwrapResult(await sodax.api.bridge.getTokensByChain(chainKey, apiConfig));
|
|
2075
|
+
},
|
|
2076
|
+
enabled: !!chainKey && chainKey.length > 0,
|
|
2077
|
+
retry: 3,
|
|
2078
|
+
...queryOptions
|
|
2079
|
+
});
|
|
2080
|
+
};
|
|
1865
2081
|
function useStake({
|
|
1866
2082
|
mutationOptions
|
|
1867
2083
|
} = {}) {
|
|
@@ -3419,4 +3635,4 @@ function createSodaxQueryClient({
|
|
|
3419
3635
|
});
|
|
3420
3636
|
}
|
|
3421
3637
|
|
|
3422
|
-
export { SodaxProvider, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getXBalancesQueryOptions, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, 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, useLeverageYieldDeposit, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, 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, 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 };
|
|
3638
|
+
export { SodaxProvider, clearRadfiSession, createDecreaseLiquidityParamsProps, createDepositParamsProps, createSodaxQueryClient, createSupplyLiquidityParamsProps, createWithdrawParamsProps, getSponsorConfigQueryOptions, getStellarAccountActiveQueryOptions, getStellarAccountStatusQueryOptions, getStellarTrustlineCheckQueryOptions, getXBalancesQueryOptions, isTerminalSwapIntentStatus, isUserRejectedError, loadRadfiSession, resolveNearStorageGate, resolveStellarGate, saveRadfiSession, toResult, unwrapResult, useAToken, useATokensBalances, useActivateStellarAccount, useApproveToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBackendUserIntents, useBitcoinBalance, useBitcoinTradingSetup, useBorrow, useBridge, useBridgeAllowance, useBridgeApiAllowance, useBridgeApiApprove, useBridgeApiBridgeableAmount, useBridgeApiCreateBridgeIntent, useBridgeApiFee, useBridgeApiIsBridgeable, useBridgeApiSubmitTx, useBridgeApiSubmitTxStatus, useBridgeApiTokens, useBridgeApiTokensByChain, useBridgeApprove, useCancelLimitOrder, useCancelSwap, useCancelUnstake, useClaim, useClaimRewards, useConvertedAssets, useCreateDecreaseLiquidityParams, useCreateDepositParams, useCreateLimitOrder, useCreateSupplyLiquidityParams, useCreateWithdrawParams, useDecreaseLiquidity, useDeriveUserWalletAddress, 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, useLeverageYieldDeposit, useLeverageYieldEffectiveApr, useLeverageYieldNotifySolver, useLeverageYieldPosition, useLeverageYieldPreviewRedeem, 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 };
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"version": "2.1.0-rc.
|
|
8
|
+
"version": "2.1.0-rc.3",
|
|
9
9
|
"description": "React hooks for building dApps on the SODAX cross-chain DeFi platform",
|
|
10
10
|
"keywords": [
|
|
11
11
|
"sodax",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"viem": "2.29.2",
|
|
37
|
-
"@sodax/sdk": "2.1.0-rc.
|
|
37
|
+
"@sodax/sdk": "2.1.0-rc.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@arethetypeswrong/cli": "0.17.4",
|
|
@@ -64,11 +64,15 @@ const HOOKS: Array<{ path: string; nativeThrow?: true }> = [
|
|
|
64
64
|
{ path: 'swap/useSwap.ts' },
|
|
65
65
|
{ path: 'swap/useSwapApprove.ts' },
|
|
66
66
|
{ path: 'swapsApi/useSwapsApiApprove.ts' },
|
|
67
|
+
{ path: 'swapsApi/useSwapsApiApproveAndBroadcast.ts' },
|
|
67
68
|
{ path: 'swapsApi/useSwapsApiCancelIntent.ts' },
|
|
68
69
|
{ path: 'swapsApi/useSwapsApiCreateIntent.ts' },
|
|
69
70
|
{ path: 'swapsApi/useSwapsApiCreateLimitOrder.ts' },
|
|
70
71
|
{ path: 'swapsApi/useSwapsApiSubmitIntent.ts' },
|
|
71
72
|
{ path: 'swapsApi/useSwapsApiSubmitTx.ts' },
|
|
73
|
+
{ path: 'bridgeApi/useBridgeApiApprove.ts' },
|
|
74
|
+
{ path: 'bridgeApi/useBridgeApiCreateBridgeIntent.ts' },
|
|
75
|
+
{ path: 'bridgeApi/useBridgeApiSubmitTx.ts' },
|
|
72
76
|
];
|
|
73
77
|
|
|
74
78
|
describe.each(HOOKS)('mutation hook contract: $path', ({ path, nativeThrow }) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Backend API Hooks
|
|
2
2
|
|
|
3
|
-
This directory contains React hooks for interacting with the
|
|
3
|
+
This directory contains React hooks for interacting with the SODAX Backend API through the `BackendApiService`. These hooks provide a React-friendly interface with automatic caching, error handling, and loading states using React Query.
|
|
4
4
|
|
|
5
5
|
## Available Hooks
|
|
6
6
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// bridgeApi/ — React Query hooks over the HTTP Bridge API (`sodax.api.bridge.*`).
|
|
2
|
+
// Distinct from the on-chain `bridge/` hooks (which call `sodax.bridge.*` directly).
|
|
3
|
+
|
|
4
|
+
export * from './useBridgeApiAllowance.js'; // query
|
|
5
|
+
export * from './useBridgeApiApprove.js'; // mutation
|
|
6
|
+
export * from './useBridgeApiBridgeableAmount.js'; // query (deposit capacity / withdrawal liquidity)
|
|
7
|
+
export * from './useBridgeApiCreateBridgeIntent.js'; // mutation
|
|
8
|
+
export * from './useBridgeApiFee.js'; // query (partner fee — per-request override or configured default)
|
|
9
|
+
export * from './useBridgeApiIsBridgeable.js'; // query (pair bridgeable?)
|
|
10
|
+
export * from './useBridgeApiSubmitTx.js'; // mutation
|
|
11
|
+
export * from './useBridgeApiSubmitTxStatus.js'; // query (poll)
|
|
12
|
+
export * from './useBridgeApiTokens.js'; // query (backend-served token list)
|
|
13
|
+
export * from './useBridgeApiTokensByChain.js'; // query (backend-served token list for one chain)
|