@0xsquid/react-hooks 8.3.1-beta-update-ethers.0 → 8.3.1-beta-stellar-issued-assets.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/dist/core/constants.d.ts +1 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/queries/queries-keys.d.ts +5 -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/core/types/transaction.d.ts +19 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/stellar/useStellarTrustLine.d.ts +13 -0
- package/dist/hooks/transaction/useGetRoute.d.ts +18 -7
- package/dist/{index-qAOvcSon.js → index-xSvE7oVI.js} +743 -329
- package/dist/index-xSvE7oVI.js.map +1 -0
- package/dist/{index-CMrdTYeW.js → index-z1TwF4-p.js} +730 -331
- package/dist/index-z1TwF4-p.js.map +1 -0
- package/dist/{index.es-Cu_QQTg-.js → index.es-CtYD1WrB.js} +2 -2
- package/dist/{index.es-Cu_QQTg-.js.map → index.es-CtYD1WrB.js.map} +1 -1
- package/dist/{index.es-DRgOycmm.js → index.es-Rc3LIf6Y.js} +2 -2
- package/dist/{index.es-DRgOycmm.js.map → index.es-Rc3LIf6Y.js.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +16 -1
- package/dist/index.js.map +1 -1
- package/dist/{secretService-B_-XWo1F.js → secretService-BEEQh-7r.js} +2 -2
- package/dist/{secretService-B_-XWo1F.js.map → secretService-BEEQh-7r.js.map} +1 -1
- package/dist/{secretService-B3sc6ibT.js → secretService-aK5p-g0D.js} +2 -2
- package/dist/{secretService-B3sc6ibT.js.map → secretService-aK5p-g0D.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 +2 -0
- package/dist/services/internal/routeService.d.ts +8 -0
- package/dist/services/internal/stellarService.d.ts +9 -0
- package/dist/services/internal/transactionService.d.ts +14 -1
- package/dist/services/internal/xrplService.d.ts +2 -0
- package/dist/{stellarService.client-Ciqw9lmL.js → stellarService.client-BB88L49R.js} +2 -2
- package/dist/{stellarService.client-Ciqw9lmL.js.map → stellarService.client-BB88L49R.js.map} +1 -1
- package/dist/{stellarService.client-sRzC5VSD.js → stellarService.client-Dl_XfhX_.js} +2 -2
- package/dist/{stellarService.client-sRzC5VSD.js.map → stellarService.client-Dl_XfhX_.js.map} +1 -1
- package/package.json +5 -5
- package/dist/index-CMrdTYeW.js.map +0 -1
- package/dist/index-qAOvcSon.js.map +0 -1
package/dist/core/constants.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare const gasRefundMultiplier = 25;
|
|
|
28
28
|
export declare const internalSquidApiBaseUrl = "https://app.squidrouter.com/api";
|
|
29
29
|
export declare const XAMAN_API_URL: string;
|
|
30
30
|
export declare const TOKEN_PRICE_API_URL: string;
|
|
31
|
+
export declare const DEFAULT_ROUTE_REFETCH_INTERVAL = 30000;
|
|
31
32
|
export declare const SOLANA_RPC_URL = "https://meredith-ute2ko-fast-mainnet.helius-rpc.com";
|
|
32
33
|
export declare const INTEGRATOR_ID = "squid-widget-playground-local-cd33cba6-7e12-4fcc-8d5d-35e286f655ea";
|
|
33
34
|
export declare const DEFAULT_COUNTRY_CODE = "US";
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CHAIN_IDS, chainTypeToNativeTokenAddressMap, chainTypeToZeroAddressMap, DEFAULT_LOCALE, destinationAddressResetValue, fallbackAddressResetValue, nativeBitcoinTokenAddress, nativeCosmosTokenAddress, nativeEvmTokenAddress, nativeSolanaTokenAddress, nativeStellarTokenAddress, nativeSuiTokenAddress, nativeXrplTokenAddress, } from "./constants";
|
|
1
|
+
export { CHAIN_IDS, chainTypeToNativeTokenAddressMap, chainTypeToZeroAddressMap, DEFAULT_LOCALE, DEFAULT_ROUTE_REFETCH_INTERVAL, destinationAddressResetValue, fallbackAddressResetValue, nativeBitcoinTokenAddress, nativeCosmosTokenAddress, nativeEvmTokenAddress, nativeSolanaTokenAddress, nativeStellarTokenAddress, nativeSuiTokenAddress, nativeXrplTokenAddress, } from "./constants";
|
|
2
2
|
export { CosmosProvider, useCosmosContext } from "./providers/CosmosProvider";
|
|
3
3
|
export { QueryKeys } from "./queries/queries-keys";
|
|
4
4
|
export * from "./types";
|
|
@@ -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"
|
|
@@ -59,7 +61,7 @@ export declare const keys: () => {
|
|
|
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
|
+
}
|
|
@@ -46,11 +46,24 @@ export interface TransactionParams {
|
|
|
46
46
|
fromChain?: ChainData;
|
|
47
47
|
toChain?: ChainData;
|
|
48
48
|
nonce?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Some transactions require a special transactionId instead of the source tx hash
|
|
51
|
+
* to be passed to the status endpoint (i.e Chainflip transactions)
|
|
52
|
+
*/
|
|
49
53
|
transactionIdForStatus?: string;
|
|
50
54
|
transactionId: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* quoteId is used to correlate /route and /status requests
|
|
57
|
+
*/
|
|
51
58
|
quoteId: string;
|
|
52
59
|
timestamp?: number;
|
|
60
|
+
/**
|
|
61
|
+
* The source chain transaction status
|
|
62
|
+
*/
|
|
53
63
|
sourceStatus?: TransactionStatus;
|
|
64
|
+
/**
|
|
65
|
+
* Cross-chain transaction Status
|
|
66
|
+
*/
|
|
54
67
|
status: TransactionStatus;
|
|
55
68
|
error?: TransactionErrorWithMessage;
|
|
56
69
|
fromAddress?: string;
|
|
@@ -58,6 +71,11 @@ export interface TransactionParams {
|
|
|
58
71
|
axelarUrl?: string;
|
|
59
72
|
sourceTxExplorerUrl?: string;
|
|
60
73
|
sourceExplorerImgUrl?: string;
|
|
74
|
+
/**
|
|
75
|
+
* User signature, sent to Status API for deposit verification
|
|
76
|
+
* Only used for deposit-with-signature routes
|
|
77
|
+
*/
|
|
78
|
+
depositTxVerificationSignature?: string;
|
|
61
79
|
}
|
|
62
80
|
export type SwapTransactionForHistoryStore = TransactionParams & Pick<RouteResponse["route"], "params" | "estimate">;
|
|
63
81
|
export interface StepStatusGetterProps {
|
|
@@ -69,7 +87,7 @@ export interface PatchedRouteActionResponse extends Omit<RouteActionResponse, "d
|
|
|
69
87
|
data?: RouteActionResponse["data"];
|
|
70
88
|
coralV2Order?: Record<string, never>;
|
|
71
89
|
}
|
|
72
|
-
export type SwapTransactionForStatus = Pick<SwapTransactionHistory, "fromChain" | "transactionId" | "toChain" | "status" | "fromAddress" | "bridgeType" | "transactionIdForStatus" | "actions" | "quoteId">;
|
|
90
|
+
export type SwapTransactionForStatus = Pick<SwapTransactionHistory, "fromChain" | "transactionId" | "toChain" | "status" | "fromAddress" | "bridgeType" | "transactionIdForStatus" | "actions" | "quoteId"> & Pick<TransactionParams, "depositTxVerificationSignature">;
|
|
73
91
|
export type SimplifiedRouteAction = Pick<PatchedRouteActionResponse, "type" | "provider"> & {
|
|
74
92
|
data?: any;
|
|
75
93
|
isCoralV2?: boolean;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./onramp/useFiatToCrypto";
|
|
|
8
8
|
export { useSquidQueryClient } from "./query/useSquidQueryClient";
|
|
9
9
|
export { useSquid } from "./squid/useSquid";
|
|
10
10
|
export { useStellarAccountActivation } from "./stellar/useStellarAccountActivation";
|
|
11
|
+
export { useStellarTrustLine } from "./stellar/useStellarTrustLine";
|
|
11
12
|
export { useAddressBookStore } from "./store/useAddressBookStore";
|
|
12
13
|
export { useAssetsColorsStore } from "./store/useAssetsColorsStore";
|
|
13
14
|
export { useFavoriteTokensStore, type FavoriteToken, } from "./store/useFavoriteTokensStore";
|
|
@@ -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 {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { RouteResponse } from "@0xsquid/sdk/dist/types";
|
|
1
2
|
import { ChainType, Token } from "@0xsquid/squid-types";
|
|
3
|
+
import { QueryObserverOptions } from "@tanstack/react-query";
|
|
2
4
|
import type { AppConfig } from "../../core/types/config";
|
|
3
5
|
import { RouteRequest } from "../../core/types/route";
|
|
4
6
|
export declare const useGetRoute: () => import("@tanstack/react-query").UseMutationResult<{
|
|
@@ -21,13 +23,22 @@ export declare const useGetRoute: () => import("@tanstack/react-query").UseMutat
|
|
|
21
23
|
postHook: AppConfig["postHook"];
|
|
22
24
|
overrideGasRefundAddress: AppConfig["overrideGasRefundAddress"];
|
|
23
25
|
}, unknown>;
|
|
24
|
-
export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refetchOnWindowFocus, refetchIntervalInBackground, refetchInterval, quoteOnly, }: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
export declare const useGetRouteWrapper: ({ enabled, cacheTime, staleTime, refetchOnWindowFocus, refetchIntervalInBackground, refetchInterval, quoteOnly, }: Pick<QueryObserverOptions<{
|
|
27
|
+
estimate: import("@0xsquid/squid-types").Estimate;
|
|
28
|
+
transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
|
|
29
|
+
params: import("@0xsquid/squid-types").RouteRequest;
|
|
30
|
+
quoteId: string;
|
|
31
|
+
} | undefined, unknown, {
|
|
32
|
+
estimate: import("@0xsquid/squid-types").Estimate;
|
|
33
|
+
transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
|
|
34
|
+
params: import("@0xsquid/squid-types").RouteRequest;
|
|
35
|
+
quoteId: string;
|
|
36
|
+
} | undefined, {
|
|
37
|
+
estimate: import("@0xsquid/squid-types").Estimate;
|
|
38
|
+
transactionRequest?: import("@0xsquid/squid-types").SquidData | undefined;
|
|
39
|
+
params: import("@0xsquid/squid-types").RouteRequest;
|
|
40
|
+
quoteId: string;
|
|
41
|
+
} | undefined, import("@tanstack/react-query").QueryKey>, "cacheTime" | "enabled" | "staleTime" | "refetchInterval" | "refetchIntervalInBackground" | "refetchOnWindowFocus"> & {
|
|
31
42
|
quoteOnly?: boolean | undefined;
|
|
32
43
|
}) => {
|
|
33
44
|
squidRoute: import("@tanstack/react-query").UseQueryResult<{
|