@0xsquid/react-hooks 8.5.0 → 8.5.1-beta-stellar-tempo.0
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/core/constants.d.ts +3 -0
- package/dist/core/queries/queries-keys.d.ts +6 -2
- package/dist/core/types/config.d.ts +0 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/stellar.d.ts +52 -0
- package/dist/core/types/tokens.d.ts +4 -0
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/stellar/useStellarTrustLine.d.ts +13 -0
- package/dist/hooks/tokens/useSourceChainGasToken.d.ts +10 -0
- package/dist/hooks/transaction/send/useEstimateSendTransactionGas.d.ts +10 -2
- package/dist/hooks/transaction/useEstimate.d.ts +7 -12
- package/dist/hooks/transaction/useTempoFeeCheck.d.ts +11 -0
- package/dist/{index-5cyMUZhY.js → index-BSX11dad.js} +1552 -1109
- package/dist/index-BSX11dad.js.map +1 -0
- package/dist/{index-BGVXRZI6.js → index-XR8ODWxH.js} +1545 -1113
- package/dist/index-XR8ODWxH.js.map +1 -0
- package/dist/{index.es-BfdAGErV.js → index.es-CczeKjuj.js} +3 -3
- package/dist/{index.es-BfdAGErV.js.map → index.es-CczeKjuj.js.map} +1 -1
- package/dist/{index.es-CeHwkxPw.js → index.es-CkrP1GZJ.js} +3 -3
- package/dist/{index.es-CeHwkxPw.js.map → index.es-CkrP1GZJ.js.map} +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/{secretService-D_d3CFdp.js → secretService-ChCrHmS3.js} +3 -3
- package/dist/{secretService-D_d3CFdp.js.map → secretService-ChCrHmS3.js.map} +1 -1
- package/dist/{secretService-BMYOBXhv.js → secretService-ScgDU3bX.js} +3 -3
- package/dist/{secretService-BMYOBXhv.js.map → secretService-ScgDU3bX.js.map} +1 -1
- package/dist/services/external/rpcService.d.ts +1 -1
- package/dist/services/external/stellarApiClient.d.ts +4 -0
- package/dist/services/external/stellarRpcClient.d.ts +2 -2
- package/dist/services/external/xrplRpcClient.d.ts +2 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/internal/assetsService.d.ts +2 -2
- package/dist/services/internal/estimateService.d.ts +15 -28
- package/dist/services/internal/stellarService.d.ts +9 -0
- package/dist/services/internal/tempoService.d.ts +38 -0
- package/dist/services/internal/xrplService.d.ts +2 -0
- package/dist/{stellarService.client-DOrCdvCd.js → stellarService.client-BaDOSK8x.js} +3 -3
- package/dist/{stellarService.client-DOrCdvCd.js.map → stellarService.client-BaDOSK8x.js.map} +1 -1
- package/dist/{stellarService.client-CIkvwxPo.js → stellarService.client-D65n-wCV.js} +3 -3
- package/dist/{stellarService.client-CIkvwxPo.js.map → stellarService.client-D65n-wCV.js.map} +1 -1
- package/package.json +1 -1
- package/dist/hooks/user/useUserParams.d.ts +0 -4
- package/dist/index-5cyMUZhY.js.map +0 -1
- package/dist/index-BGVXRZI6.js.map +0 -1
package/dist/core/constants.d.ts
CHANGED
|
@@ -69,6 +69,9 @@ export declare const CHAIN_IDS: {
|
|
|
69
69
|
readonly SONEIUM: "1868";
|
|
70
70
|
readonly PEAQ: "3338";
|
|
71
71
|
readonly HEDERA: "295";
|
|
72
|
+
readonly MANTRA: "5888";
|
|
73
|
+
readonly CITREA: "4114";
|
|
74
|
+
readonly TEMPO: "4217";
|
|
72
75
|
readonly BITCOIN: "bitcoin";
|
|
73
76
|
readonly SOLANA: "solana-mainnet-beta";
|
|
74
77
|
readonly SUI: "sui-mainnet";
|
|
@@ -34,6 +34,8 @@ export declare enum QueryKeys {
|
|
|
34
34
|
XrplAccountActivatedInfo = "xrplAccountActivatedInfo",
|
|
35
35
|
FiatToCryptoPaymentMethods = "fiatToCryptoPaymentMethods",
|
|
36
36
|
Stellar = "stellar",
|
|
37
|
+
StellarTrustLine = "stellarTrustLine",
|
|
38
|
+
IsStellarTrustLineApproved = "isStellarTrustLineApproved",
|
|
37
39
|
StellarAccountActivatedInfo = "stellarAccountActivatedInfo",
|
|
38
40
|
Hedera = "hedera",
|
|
39
41
|
IsHederaTokenAssociated = "isHederaTokenAssociated"
|
|
@@ -54,12 +56,12 @@ export declare const keys: () => {
|
|
|
54
56
|
tokenData: (token?: TokenWithBalance) => (string | undefined)[];
|
|
55
57
|
balance: (chainId?: number | string, tokenAddress?: string, userAddress?: string) => (string | number | undefined)[];
|
|
56
58
|
allTokensBalance: (address: string | undefined, chainType: ChainType | undefined, direction?: SwapDirection) => (string | undefined)[];
|
|
57
|
-
transaction: (fromChainId: string | undefined, toChainId: string | undefined, toTokenAddress: string | undefined, fromTokenAddress: string | undefined, price: string | undefined, slippage: SlippageOption | undefined,
|
|
59
|
+
transaction: (fromChainId: string | undefined, toChainId: string | undefined, toTokenAddress: string | undefined, fromTokenAddress: string | undefined, price: string | undefined, slippage: SlippageOption | undefined, sourceUserAddress: string | undefined, degenMode: boolean | undefined, destinationAddress: string | undefined, fallbackAddress: string | undefined, quoteOnly: boolean | undefined, fromChainType: ChainType | undefined, preHook: AppConfig["preHook"] | undefined, postHook: AppConfig["postHook"] | undefined, overrideGasRefundAddress: AppConfig["overrideGasRefundAddress"] | undefined) => (string | number | boolean | Omit<import("@0xsquid/squid-types").Hook, "fundAmount" | "fundToken"> | undefined)[];
|
|
58
60
|
swapTransactionStatus: (transactionId: string | undefined) => (string | undefined)[];
|
|
59
61
|
fiatToCryptoStatus: (transactionId?: string) => (string | undefined)[];
|
|
60
62
|
sendTransactionStatus: (txHash: string | undefined, chainId: string | undefined) => (string | undefined)[];
|
|
61
63
|
allTransactionsStatus: (transactions: HistoryTransaction[] | undefined) => string[];
|
|
62
|
-
routeApproved: (routeData: RouteResponse["route"] | undefined, allowanceInWei: bigint | undefined) => (string | undefined)[];
|
|
64
|
+
routeApproved: (routeData: RouteResponse["route"] | undefined, allowanceInWei: bigint | undefined, isAllowanceQueryEnabled: boolean | undefined, hasAllowance: boolean | undefined) => (string | boolean | undefined)[];
|
|
63
65
|
sendTransactionGas: (chainId: string | undefined, tokenAddress: string | undefined, from: string | undefined) => (string | undefined)[];
|
|
64
66
|
ensData: (address?: string) => (string | undefined)[];
|
|
65
67
|
ensSearch: (query?: string) => (string | undefined)[];
|
|
@@ -71,6 +73,8 @@ export declare const keys: () => {
|
|
|
71
73
|
xrplTrustLine: (tokenAddress: string | undefined, chainId: string | undefined, address: string | undefined) => (string | undefined)[];
|
|
72
74
|
isXrplTrustLineApproved: (address: string | undefined, chainId: string | undefined, chainType: ChainType | undefined, tokenAddress: string | undefined, trustLineLimit: string | undefined, amountToApprove: bigint | undefined) => (string | undefined)[];
|
|
73
75
|
xrplAccountActivatedInfo: (destinationAddress: string | undefined, toChainId: string | undefined, toChainType: ChainType | undefined) => (string | undefined)[];
|
|
76
|
+
stellarTrustLine: (tokenAddress: string | undefined, chainId: string | undefined, address: string | undefined) => (string | undefined)[];
|
|
77
|
+
isStellarTrustLineApproved: (address: string | undefined, chainId: string | undefined, chainType: ChainType | undefined, tokenAddress: string | undefined, trustLineLimit: string | undefined, amountToApprove: bigint | undefined) => (string | undefined)[];
|
|
74
78
|
stellarAccountActivatedInfo: (address: string | undefined, chainId: string | undefined, chainType: ChainType | undefined) => (string | undefined)[];
|
|
75
79
|
isHederaTokenAssociated: (address: string | undefined, chainId: string | undefined, chainType: ChainType | undefined, tokenAddress: string | undefined) => (string | undefined)[];
|
|
76
80
|
};
|
|
@@ -4,7 +4,7 @@ export type { QrCodeData } from "./event";
|
|
|
4
4
|
export * from "./history";
|
|
5
5
|
export type * from "./onramps/";
|
|
6
6
|
export type { SwapParams } from "./swap";
|
|
7
|
-
export type { Chain, Token } from "./tokens";
|
|
7
|
+
export type { Chain, Token, TrustLineAsset } from "./tokens";
|
|
8
8
|
export { AxelarStatusResponseType, SendTransactionStatus, TransactionStatus, type PatchedRouteActionResponse, type TransactionParams, } from "./transaction";
|
|
9
9
|
export type { AddressWithEns, BitcoinWallet, ConnectorID, CosmosWallet, EnsData, EnsSearchResult, FullAddressData, NetworkConfig, SolanaWallet, SupportedChain, Wallet, } from "./wallet";
|
|
10
10
|
export { XamanXrplNetwork } from "./xrpl";
|
|
@@ -1,3 +1,55 @@
|
|
|
1
|
+
import { BaseChain } from "@0xsquid/squid-types";
|
|
1
2
|
import type { ModuleInterface } from "@creit.tech/stellar-wallets-kit";
|
|
3
|
+
import { Token } from "./tokens";
|
|
2
4
|
export interface StellarConnector extends ModuleInterface {
|
|
3
5
|
}
|
|
6
|
+
export declare enum StellarHorizonAssetType {
|
|
7
|
+
/**
|
|
8
|
+
* XLM native token
|
|
9
|
+
*/
|
|
10
|
+
NATIVE = "native",
|
|
11
|
+
/**
|
|
12
|
+
* 1-4 char asset code (e.g. USDC)
|
|
13
|
+
*/
|
|
14
|
+
ALPHANUM4 = "credit_alphanum4",
|
|
15
|
+
/**
|
|
16
|
+
* 5-12 char asset code (e.g. wstETH)
|
|
17
|
+
*/
|
|
18
|
+
ALPHANUM12 = "credit_alphanum12"
|
|
19
|
+
}
|
|
20
|
+
export interface StellarHorizonNativeAsset {
|
|
21
|
+
balance: string;
|
|
22
|
+
asset_type: StellarHorizonAssetType.NATIVE;
|
|
23
|
+
}
|
|
24
|
+
export interface StellarHorizonIssuedAsset {
|
|
25
|
+
balance: string;
|
|
26
|
+
asset_type: Exclude<StellarHorizonAssetType, StellarHorizonAssetType.NATIVE>;
|
|
27
|
+
asset_code: string;
|
|
28
|
+
asset_issuer: string;
|
|
29
|
+
limit: string;
|
|
30
|
+
}
|
|
31
|
+
export type StellarTrustLine = StellarHorizonIssuedAsset;
|
|
32
|
+
export declare enum StellarTokenType {
|
|
33
|
+
NATIVE_TOKEN = "nativeToken",
|
|
34
|
+
ISSUER_TOKEN = "issuerToken",
|
|
35
|
+
CONTRACT_TOKEN = "contractToken"
|
|
36
|
+
}
|
|
37
|
+
export interface StellarToken extends Token {
|
|
38
|
+
chainAssetConfig: {
|
|
39
|
+
stellar: {
|
|
40
|
+
assetType: StellarTokenType;
|
|
41
|
+
contractAddress: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export interface StellarIssuedToken extends StellarToken {
|
|
46
|
+
chainAssetConfig: {
|
|
47
|
+
stellar: {
|
|
48
|
+
assetType: StellarTokenType.ISSUER_TOKEN;
|
|
49
|
+
contractAddress: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export interface StellarChain extends BaseChain {
|
|
54
|
+
horizonRpcList: string[];
|
|
55
|
+
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,13 +2,14 @@ export { useTrackSearchEmpty } from "./analytics/useTrackSearchEmpty";
|
|
|
2
2
|
export { useSquidChains } from "./chains/useSquidChains";
|
|
3
3
|
export { useClient } from "./client/useClient";
|
|
4
4
|
export { useCosmosForChain } from "./cosmos/useCosmosForChain";
|
|
5
|
+
export { useHederaAccountActivation } from "./hedera/useHederaAccountActivation";
|
|
5
6
|
export { useHederaTokenAssociations } from "./hedera/useHederaTokenAssociations";
|
|
6
7
|
export { useKeyboardNavigation } from "./navigation/useKeyboardNavigation";
|
|
7
8
|
export * from "./onramp/useFiatToCrypto";
|
|
8
9
|
export { useSquidQueryClient } from "./query/useSquidQueryClient";
|
|
9
10
|
export { useSquid } from "./squid/useSquid";
|
|
10
11
|
export { useStellarAccountActivation } from "./stellar/useStellarAccountActivation";
|
|
11
|
-
export {
|
|
12
|
+
export { useStellarTrustLine } from "./stellar/useStellarTrustLine";
|
|
12
13
|
export { useAddressBookStore } from "./store/useAddressBookStore";
|
|
13
14
|
export { useAssetsColorsStore } from "./store/useAssetsColorsStore";
|
|
14
15
|
export { useFavoriteTokensStore, type FavoriteToken, } from "./store/useFavoriteTokensStore";
|
|
@@ -27,6 +28,7 @@ export { useMultipleTokenPrices } from "./tokens/useMultipleTokenPrices";
|
|
|
27
28
|
export { useBitcoinNativeBalance, useCosmosNativeBalance, useEvmNativeBalance, useNativeBalance, useSolanaNativeBalance, useStellarNativeBalance, useSuiNativeBalance, useXrplNativeBalance, } from "./tokens/useNativeBalance";
|
|
28
29
|
export { useNativeTokenForChain } from "./tokens/useNativeTokenForChain";
|
|
29
30
|
export { useSingleTokenPrice } from "./tokens/useSingleTokenPrice";
|
|
31
|
+
export { useSourceChainGasToken } from "./tokens/useSourceChainGasToken";
|
|
30
32
|
export { useSquidTokens } from "./tokens/useSquidTokens";
|
|
31
33
|
export { useHistoricalData, useTokensData, } from "./tokens/useTokenHistoricalData";
|
|
32
34
|
export { useEstimateSendTransaction } from "./transaction/send/useEstimateSendTransactionGas";
|
|
@@ -43,7 +45,6 @@ export { useSendTransactionStatus } from "./transaction/useSendTransactionStatus
|
|
|
43
45
|
export { useSwapTransactionStatus } from "./transaction/useSwapTransactionStatus";
|
|
44
46
|
export { useAvatar } from "./user/useAvatar";
|
|
45
47
|
export { useHistory } from "./user/useHistory";
|
|
46
|
-
export { useUserParams } from "./user/useUserParams";
|
|
47
48
|
export { useDebouncedValue } from "./utils/useUtils";
|
|
48
49
|
export { useAddToken } from "./wallet/useAddToken";
|
|
49
50
|
export { useAutoConnect } from "./wallet/useAutoConnect";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChainData, Token } from "@0xsquid/squid-types";
|
|
2
|
+
interface Params {
|
|
3
|
+
address: string | undefined;
|
|
4
|
+
token: Token | undefined;
|
|
5
|
+
chain: ChainData | undefined;
|
|
6
|
+
amount: bigint | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare function useStellarTrustLine({ address, chain, token, amount }: Params): {
|
|
9
|
+
createTrustLine: import("@tanstack/react-query").UseMutationResult<boolean, unknown, void, unknown>;
|
|
10
|
+
trustLineQuery: import("@tanstack/react-query").UseQueryResult<import("../../core/types/stellar").StellarHorizonIssuedAsset | null, unknown>;
|
|
11
|
+
isTrustLineApproved: import("@tanstack/react-query").UseQueryResult<boolean, unknown>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChainData } from "@0xsquid/squid-types";
|
|
2
|
+
import { Token } from "../../core";
|
|
3
|
+
import { ChainFeeParams } from "../../services/internal/tempoService";
|
|
4
|
+
export declare function useSourceChainGasToken({ fromChain, fromToken, }: {
|
|
5
|
+
fromChain: ChainData | undefined;
|
|
6
|
+
fromToken: Token | undefined;
|
|
7
|
+
}): {
|
|
8
|
+
gasToken: Token | undefined;
|
|
9
|
+
chainFeeParams: ChainFeeParams | null;
|
|
10
|
+
};
|
|
@@ -6,9 +6,9 @@ interface UseEstimateSendReturnType {
|
|
|
6
6
|
estimatedGas: bigint | undefined;
|
|
7
7
|
isLoading: boolean;
|
|
8
8
|
/**
|
|
9
|
-
* Whether the
|
|
9
|
+
* Whether the gas token balance is enough to pay for the network gas fees
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
isGasBalanceEnough: boolean;
|
|
12
12
|
/**
|
|
13
13
|
* Whether the balance of the selected token is enough to send the requested `amount`.
|
|
14
14
|
*/
|
|
@@ -17,6 +17,14 @@ interface UseEstimateSendReturnType {
|
|
|
17
17
|
* The safe amount the user can send to have enough balance to pay for the network gas fees
|
|
18
18
|
*/
|
|
19
19
|
minAmountValueWarnMsg: string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the selected token pays the network fee
|
|
22
|
+
*/
|
|
23
|
+
tokenPaysNetworkFee: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* TODO: add description
|
|
26
|
+
*/
|
|
27
|
+
gasBalanceNeeded: string | undefined;
|
|
20
28
|
}
|
|
21
29
|
export declare function useEstimateSendTransaction({ chain, token, amount, balance, from, }: {
|
|
22
30
|
chain: ChainData | undefined;
|
|
@@ -5,25 +5,20 @@ type FeeFormatted = {
|
|
|
5
5
|
imageUrl: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const useEstimate: (squidRoute?: RouteResponse["route"]) => {
|
|
8
|
-
|
|
8
|
+
fromBalanceFormatted: string;
|
|
9
9
|
slippageFormatted: string;
|
|
10
10
|
totalWithRefundEstimate: {
|
|
11
11
|
totalAmount: string;
|
|
12
12
|
totalAmountUSD: number;
|
|
13
13
|
feeToken: import("@0xsquid/squid-types").Token | undefined;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
value: number;
|
|
17
|
-
currency: string | undefined;
|
|
18
|
-
};
|
|
19
|
-
enoughBalanceToSwap: boolean;
|
|
15
|
+
fromBalanceEnoughToSwap: boolean;
|
|
20
16
|
feeCostsFormatted: FeeFormatted[];
|
|
21
17
|
totalFeeCostsUsd: string;
|
|
22
|
-
|
|
18
|
+
gasToken: import("../..").Token | undefined;
|
|
19
|
+
fromToken: import("@0xsquid/squid-types").Token | undefined;
|
|
23
20
|
fromAmount: string | undefined;
|
|
24
21
|
fromAmountFormatted: string;
|
|
25
|
-
sourceChainNativeToken: import("@0xsquid/squid-types").Token | undefined;
|
|
26
|
-
destChainNativeToken: import("@0xsquid/squid-types").Token | undefined;
|
|
27
22
|
toAmountUSD: string | undefined;
|
|
28
23
|
exchangeRate: string;
|
|
29
24
|
toAmountMinUSD: string;
|
|
@@ -38,14 +33,14 @@ export declare const useEstimate: (squidRoute?: RouteResponse["route"]) => {
|
|
|
38
33
|
expectedGasRefundCost: bigint;
|
|
39
34
|
expectedGasRefundCostUSD: string;
|
|
40
35
|
sameTokenBetweenFees: boolean;
|
|
41
|
-
|
|
36
|
+
fromTokenPaysNetworkFee: boolean;
|
|
42
37
|
totalNativeFees: bigint;
|
|
43
|
-
|
|
44
|
-
fromBalanceEnoughToSwap: boolean;
|
|
38
|
+
gasBalanceEnough: boolean;
|
|
45
39
|
minAmountValueWarnMsg: string | undefined;
|
|
46
40
|
estimatedRouteDuration: {
|
|
47
41
|
seconds: number;
|
|
48
42
|
format: (sTemplate?: string | undefined, mTemplate?: string | undefined, hTemplate?: string | undefined) => string;
|
|
49
43
|
};
|
|
44
|
+
gasBalanceNeeded: string | undefined;
|
|
50
45
|
};
|
|
51
46
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChainData } from "@0xsquid/squid-types";
|
|
2
|
+
import { Token } from "../../core/types";
|
|
3
|
+
import { TempoFeeData } from "../../services/internal/tempoService";
|
|
4
|
+
/**
|
|
5
|
+
* Returns raw on-chain gas token data for Tempo chains, or null when the source
|
|
6
|
+
* chain is not Tempo.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useTempoFeeCheck: ({ fromChain, fromToken, }: {
|
|
9
|
+
fromChain: ChainData | undefined;
|
|
10
|
+
fromToken: Token | undefined;
|
|
11
|
+
}) => TempoFeeData | null;
|