@sodax/dapp-kit 1.0.0-rc.6 → 1.0.0-rc.8
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.mts +31 -11
- package/dist/index.d.ts +31 -11
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/hooks/backend/useBackendIntentByTxHash.ts +11 -6
- package/src/hooks/mm/index.ts +2 -1
- package/src/index.ts +0 -1
- package/src/core/index.ts +0 -12
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { createContext, useContext, useState, useCallback, useMemo, useRef, useEffect } from 'react';
|
|
2
|
-
import { SpokeService, deriveUserWalletAddress, STELLAR_MAINNET_CHAIN_ID, StellarSpokeProvider, StellarSpokeService, spokeChainConfig, SONIC_MAINNET_CHAIN_ID, SonicSpokeProvider, EvmSpokeProvider, SuiSpokeProvider, IconSpokeProvider, InjectiveSpokeProvider, SolanaSpokeProvider, isLegacybnUSDToken, Sodax
|
|
2
|
+
import { SpokeService, deriveUserWalletAddress, STELLAR_MAINNET_CHAIN_ID, StellarSpokeProvider, StellarSpokeService, spokeChainConfig, SONIC_MAINNET_CHAIN_ID, SonicSpokeProvider, EvmSpokeProvider, SuiSpokeProvider, IconSpokeProvider, InjectiveSpokeProvider, SolanaSpokeProvider, isLegacybnUSDToken, Sodax } from '@sodax/sdk';
|
|
3
3
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
4
4
|
import { parseUnits } from 'viem';
|
|
5
5
|
import { ICON_MAINNET_CHAIN_ID } from '@sodax/types';
|
|
@@ -368,6 +368,16 @@ function useAToken(aToken) {
|
|
|
368
368
|
enabled: !!aToken
|
|
369
369
|
});
|
|
370
370
|
}
|
|
371
|
+
function useReservesUsdFormat() {
|
|
372
|
+
const { sodax } = useSodaxContext();
|
|
373
|
+
return useQuery({
|
|
374
|
+
queryKey: ["reservesUsdFormat"],
|
|
375
|
+
queryFn: async () => {
|
|
376
|
+
const reserves = await sodax.moneyMarket.data.getReservesHumanized();
|
|
377
|
+
return sodax.moneyMarket.data.formatReservesUSD(sodax.moneyMarket.data.buildReserveDataWithPrice(reserves));
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
371
381
|
var useQuote = (payload) => {
|
|
372
382
|
const { sodax } = useSodaxContext();
|
|
373
383
|
const queryKey = useMemo(() => {
|
|
@@ -489,7 +499,7 @@ function useCancelSwap(spokeProvider) {
|
|
|
489
499
|
}
|
|
490
500
|
});
|
|
491
501
|
}
|
|
492
|
-
var useBackendIntentByTxHash = (txHash) => {
|
|
502
|
+
var useBackendIntentByTxHash = (txHash, refetchInterval = 1e3) => {
|
|
493
503
|
const { sodax } = useSodaxContext();
|
|
494
504
|
return useQuery({
|
|
495
505
|
queryKey: ["backend", "intent", "txHash", txHash],
|
|
@@ -499,6 +509,7 @@ var useBackendIntentByTxHash = (txHash) => {
|
|
|
499
509
|
}
|
|
500
510
|
return sodax.backendApi.getIntentByTxHash(txHash);
|
|
501
511
|
},
|
|
512
|
+
refetchInterval,
|
|
502
513
|
enabled: !!txHash && txHash.length > 0,
|
|
503
514
|
retry: 3
|
|
504
515
|
});
|
|
@@ -1258,14 +1269,7 @@ var SodaxProvider = ({ children, testnet = false, config, rpcConfig }) => {
|
|
|
1258
1269
|
const sodax = new Sodax(config);
|
|
1259
1270
|
return /* @__PURE__ */ React.createElement(SodaxContext.Provider, { value: { sodax, testnet, rpcConfig } }, children);
|
|
1260
1271
|
};
|
|
1261
|
-
var getSpokeTokenAddressByVault = (spokeChainId, vault) => {
|
|
1262
|
-
const tokens = hubAssets[spokeChainId];
|
|
1263
|
-
const address = Object.keys(tokens).find(
|
|
1264
|
-
(tokenAddress) => tokens[tokenAddress].vault.toLowerCase() === vault.toLowerCase()
|
|
1265
|
-
);
|
|
1266
|
-
return address;
|
|
1267
|
-
};
|
|
1268
1272
|
|
|
1269
|
-
export { MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, SodaxProvider,
|
|
1273
|
+
export { MIGRATION_MODE_BNUSD, MIGRATION_MODE_ICX_SODA, SodaxProvider, useAToken, useBackendAllMoneyMarketAssets, useBackendAllMoneyMarketBorrowers, useBackendIntentByHash, useBackendIntentByTxHash, useBackendMoneyMarketAsset, useBackendMoneyMarketAssetBorrowers, useBackendMoneyMarketAssetSuppliers, useBackendMoneyMarketPosition, useBackendOrderbook, useBorrow, useBridge, useBridgeAllowance, useBridgeApprove, useCancelSwap, useCancelUnstake, useClaim, useConvertedAssets, useDeriveUserWalletAddress, useEstimateGas, useGetBridgeableAmount, useGetBridgeableTokens, useHubProvider, useInstantUnstake, useInstantUnstakeAllowance, useInstantUnstakeApprove, useInstantUnstakeRatio, useMMAllowance, useMMApprove, useMigrate, useMigrationAllowance, useMigrationApprove, useQuote, useRepay, useRequestTrustline, useReservesData, useReservesUsdFormat, useSodaxContext, useSpokeProvider, useStake, useStakeAllowance, useStakeApprove, useStakeRatio, useStakingConfig, useStakingInfo, useStatus, useStellarTrustlineCheck, useSupply, useSwap, useSwapAllowance, useSwapApprove, useUnstake, useUnstakeAllowance, useUnstakeApprove, useUnstakingInfo, useUnstakingInfoWithPenalty, useUserReservesData, useWithdraw };
|
|
1270
1274
|
//# sourceMappingURL=index.mjs.map
|
|
1271
1275
|
//# sourceMappingURL=index.mjs.map
|