@0xsquid/react-hooks 8.7.2 → 8.8.1-beta-canton.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.
Files changed (45) hide show
  1. package/dist/core/client/index.d.ts +1 -0
  2. package/dist/core/constants.d.ts +2 -0
  3. package/dist/core/types/canton.d.ts +2 -0
  4. package/dist/core/types/cosmos.d.ts +5 -0
  5. package/dist/core/types/wallet.d.ts +9 -6
  6. package/dist/hooks/chains/useSquidChains.d.ts +1 -0
  7. package/dist/hooks/index.d.ts +1 -0
  8. package/dist/hooks/store/useDepositAddressStore.d.ts +15 -3
  9. package/dist/hooks/swap/useDepositAddress.d.ts +2 -4
  10. package/dist/hooks/tokens/useSquidTokens.d.ts +1 -0
  11. package/dist/hooks/transaction/useDepositTransactionStatus.d.ts +25 -0
  12. package/dist/hooks/transaction/useSwapStatusQuery.d.ts +26 -0
  13. package/dist/hooks/wallet/useMultiChainWallet.d.ts +41 -15
  14. package/dist/hooks/wallet/useWallet.d.ts +45 -15
  15. package/dist/{index-DaYYG81O.js → index-CtTVUC-R.js} +331 -169
  16. package/dist/index-CtTVUC-R.js.map +1 -0
  17. package/dist/{index-D3bbd13Z.js → index-D1udDcRZ.js} +334 -169
  18. package/dist/index-D1udDcRZ.js.map +1 -0
  19. package/dist/{index.es-Bn83pLT9.js → index.es-DFjaMQJG.js} +2 -2
  20. package/dist/{index.es-Bn83pLT9.js.map → index.es-DFjaMQJG.js.map} +1 -1
  21. package/dist/{index.es-Ds1lt_e4.js → index.es-Q71H7cJa.js} +2 -2
  22. package/dist/{index.es-Ds1lt_e4.js.map → index.es-Q71H7cJa.js.map} +1 -1
  23. package/dist/index.esm.js +1 -1
  24. package/dist/index.js +5 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/{secretService-CM6noWhX.js → secretService-BJNdJc-J.js} +2 -2
  27. package/dist/{secretService-CM6noWhX.js.map → secretService-BJNdJc-J.js.map} +1 -1
  28. package/dist/{secretService-CKReaNYo.js → secretService-Dg5_VwtW.js} +2 -2
  29. package/dist/{secretService-CKReaNYo.js.map → secretService-Dg5_VwtW.js.map} +1 -1
  30. package/dist/server.d.ts +1 -1
  31. package/dist/server.esm.js +8 -1
  32. package/dist/server.esm.js.map +1 -1
  33. package/dist/server.js +8 -0
  34. package/dist/server.js.map +1 -1
  35. package/dist/services/internal/assetsService.d.ts +1 -1
  36. package/dist/services/internal/cantonService.d.ts +2 -0
  37. package/dist/services/internal/estimateService.d.ts +18 -8
  38. package/dist/services/internal/transactionService.d.ts +12 -2
  39. package/dist/{stellarService.client-Ko2roGXL.js → stellarService.client-B9xCCNV0.js} +2 -2
  40. package/dist/{stellarService.client-Ko2roGXL.js.map → stellarService.client-B9xCCNV0.js.map} +1 -1
  41. package/dist/{stellarService.client-0dfuo3PJ.js → stellarService.client-BFUfF3-j.js} +2 -2
  42. package/dist/{stellarService.client-0dfuo3PJ.js.map → stellarService.client-BFUfF3-j.js.map} +1 -1
  43. package/package.json +2 -2
  44. package/dist/index-D3bbd13Z.js.map +0 -1
  45. package/dist/index-DaYYG81O.js.map +0 -1
@@ -13,6 +13,7 @@ type ChainTypeToClient = {
13
13
  [ChainType.SUI]: SuiClient;
14
14
  [ChainType.XRPL]: XrplRpcClient;
15
15
  [ChainType.STELLAR]: StellarRpcClient;
16
+ [ChainType.CANTON]: null;
16
17
  };
17
18
  export declare function getClient<T extends ChainType>(chain: ChainData): Promise<ChainTypeToClient[T]>;
18
19
  export {};
@@ -21,6 +21,7 @@ export declare const nativeBitcoinTokenAddress = "satoshi";
21
21
  export declare const nativeSuiTokenAddress = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
22
22
  export declare const nativeXrplTokenAddress = "xrp";
23
23
  export declare const nativeStellarTokenAddress = "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA";
24
+ export declare const nativeCantonTokenAddress = "DSO::1220b1431ef217342db44d516bb9befde802be7d8899637d290895fa58880f19accc";
24
25
  export declare const defaultSlippage: SlippageOption;
25
26
  export declare const destinationAddressResetValue = "null";
26
27
  export declare const fallbackAddressResetValue = "null";
@@ -80,6 +81,7 @@ export declare const CHAIN_IDS: {
80
81
  readonly XRPL_TESTNET: "xrpl-testnet";
81
82
  readonly STELLAR: "stellar-mainnet";
82
83
  readonly STELLAR_TESTNET: "stellar-testnet";
84
+ readonly CANTON: "canton";
83
85
  };
84
86
  export declare const chainTypeToDefaultChainIdMap: Record<ChainType, string>;
85
87
  export declare const chainTypeToNativeTokenAddressMap: Record<ChainType, string>;
@@ -0,0 +1,2 @@
1
+ export interface CantonConnector {
2
+ }
@@ -0,0 +1,5 @@
1
+ export type CosmosConnector = () => {
2
+ id: string;
3
+ name: string;
4
+ provider: any;
5
+ };
@@ -1,5 +1,7 @@
1
1
  import type { ChainType } from "@0xsquid/squid-types";
2
2
  import { BitcoinConnector } from "./bitcoin";
3
+ import { CantonConnector } from "./canton";
4
+ import { CosmosConnector } from "./cosmos";
3
5
  import { EvmConnector } from "./evm";
4
6
  import { SolanaConnector } from "./solana";
5
7
  import { StellarConnector } from "./stellar";
@@ -30,12 +32,7 @@ export declare enum WindowWalletFlag {
30
32
  export type ConnectorID = "metamask" | "coinbase" | "walletConnect" | "keplr" | "cosmostation" | "leap" | "ctrl" | "bitget" | "rabby" | "okx" | "injected" | "trustwallet" | "exodus" | "rainbow" | "phantom" | "backpack" | "unisat" | "xrpl-metamask-snap" | "crossmark" | "xaman-xapp" | "xaman-qr" | "joey" | "girin" | "bifrost" | "brave" | "tokenpocket" | "nightly" | "cryptodotcom" | "freighter" | "xBull" | "lobstr" | "albedo" | "hanaWallet" | "hotWallet";
31
33
  export type EvmWallet = Wallet & {
32
34
  type: ChainType.EVM;
33
- connector: EvmConnector;
34
- };
35
- type CosmosConnector = () => {
36
- id: string;
37
- name: string;
38
- provider: any;
35
+ connector: ConnectorByChainType[ChainType.EVM];
39
36
  };
40
37
  export type CosmosWallet = Wallet & {
41
38
  type: ChainType.COSMOS;
@@ -61,6 +58,10 @@ export type StellarWallet = Wallet & {
61
58
  type: ChainType.STELLAR;
62
59
  connector: ConnectorByChainType[ChainType.STELLAR];
63
60
  };
61
+ export type CantonWallet = Wallet & {
62
+ type: ChainType.CANTON;
63
+ connector: ConnectorByChainType[ChainType.CANTON];
64
+ };
64
65
  export type SupportedChain = {
65
66
  chainType: ChainType;
66
67
  chains?: string[];
@@ -137,6 +138,7 @@ export interface ChainTypeToWalletState {
137
138
  [ChainType.SUI]: BaseWalletState<SuiWallet> & SuiAccount;
138
139
  [ChainType.XRPL]: BaseWalletState<XrplWallet>;
139
140
  [ChainType.STELLAR]: BaseWalletState<StellarWallet>;
141
+ [ChainType.CANTON]: BaseWalletState<CantonWallet>;
140
142
  }
141
143
  interface ConnectorByChainType extends Record<ChainType, unknown> {
142
144
  [ChainType.EVM]: EvmConnector;
@@ -146,5 +148,6 @@ interface ConnectorByChainType extends Record<ChainType, unknown> {
146
148
  [ChainType.SUI]: SuiConnector;
147
149
  [ChainType.XRPL]: XrplConnector;
148
150
  [ChainType.STELLAR]: StellarConnector;
151
+ [ChainType.CANTON]: CantonConnector;
149
152
  }
150
153
  export {};
@@ -12,6 +12,7 @@ export declare const useSquidChains: (direction?: SwapDirection) => {
12
12
  suiChains: ChainData[];
13
13
  xrplChains: ChainData[];
14
14
  stellarChains: ChainData[];
15
+ cantonChains: ChainData[];
15
16
  getChainType: (chainId?: string) => ChainType | undefined;
16
17
  findChain: (chainId: string | undefined) => ChainData | undefined;
17
18
  };
@@ -37,6 +37,7 @@ export { useSendTransaction } from "./transaction/send/useSendTransaction";
37
37
  export { useSendTransactionGas } from "./transaction/send/useSendTransactionGas";
38
38
  export { useAllTransactionsStatus } from "./transaction/useAllTransactionsStatus";
39
39
  export { useApproval } from "./transaction/useApproval";
40
+ export { useDepositTransactionStatus } from "./transaction/useDepositTransactionStatus";
40
41
  export { useEstimate } from "./transaction/useEstimate";
41
42
  export { useEstimatePriceImpact } from "./transaction/useEstimatePriceImpact";
42
43
  export { useExecuteTransaction } from "./transaction/useExecuteTransaction";
@@ -1,8 +1,20 @@
1
- import { DepositAddressResponse } from "@0xsquid/squid-types";
1
+ export interface DepositData {
2
+ depositAddress: string;
3
+ amount: string;
4
+ /**
5
+ * Identifier sent to backend to check for deposit status
6
+ */
7
+ statusTrackingId: string;
8
+ /**
9
+ * Memo to be sent with the deposit transaction on-chain
10
+ * Used by backend to track and index deposits
11
+ */
12
+ memo?: string;
13
+ }
2
14
  interface DepositAddressStore {
3
- deposit: DepositAddressResponse | null;
15
+ deposit: DepositData | null;
4
16
  isEnabled: boolean;
5
- setDeposit(data: DepositAddressResponse | null): void;
17
+ setDeposit(data: DepositData | null): void;
6
18
  toggleDepositFlow(enabled: boolean): void;
7
19
  }
8
20
  export declare const useDepositAddressStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DepositAddressStore>>;
@@ -5,12 +5,10 @@ export declare function useDepositAddress(squidRoute?: RouteResponse["route"]):
5
5
  swapWillGenerateDepositAddress: boolean;
6
6
  enable: () => void;
7
7
  disable: () => void;
8
- getRouteWithDeposit: import("@tanstack/react-query").UseMutationResult<{
9
- depositAddress: import("@0xsquid/squid-types").ChainflipDepositAddressResponse;
10
- }, unknown, {
8
+ getRouteWithDeposit: import("@tanstack/react-query").UseMutationResult<void, unknown, {
11
9
  route: RouteResponse["route"];
12
10
  }, unknown>;
13
11
  depositAddress: string | undefined;
14
12
  closeDepositChannel: () => void;
15
- depositData: import("@0xsquid/squid-types").ChainflipDepositAddressResponse | null;
13
+ depositData: import("../store/useDepositAddressStore").DepositData | null;
16
14
  };
@@ -13,4 +13,5 @@ export declare const useSquidTokens: (direction?: SwapDirection) => {
13
13
  suiTokens: Token[];
14
14
  xrplTokens: Token[];
15
15
  stellarTokens: Token[];
16
+ cantonTokens: Token[];
16
17
  };
@@ -0,0 +1,25 @@
1
+ import { RouteResponse } from "@0xsquid/squid-types";
2
+ import { SwapTransactionForStatus } from "../../core/types/transaction";
3
+ interface UseDepositTransactionStatusParams {
4
+ transaction?: SwapTransactionForStatus;
5
+ route?: RouteResponse["route"];
6
+ retry?: number;
7
+ refetchOnWindowFocus?: "always" | boolean;
8
+ enabled?: boolean;
9
+ /**
10
+ * Called once the source deposit has been received, after the transaction has
11
+ * been registered in the stores. The view uses it to navigate.
12
+ */
13
+ onReceived?: () => void;
14
+ }
15
+ /**
16
+ * Tracks a generated deposit address before it becomes a persisted swap history item.
17
+ *
18
+ * Mirrors the hooks-first pattern of `useExecuteTransaction`: once the source deposit
19
+ * is received, it registers the transaction in the transaction + history stores, then
20
+ * signals the view (via `onReceived`) to navigate. The view never writes to the stores.
21
+ */
22
+ export declare const useDepositTransactionStatus: ({ transaction, route, retry, refetchOnWindowFocus, enabled, onReceived, }: UseDepositTransactionStatusParams) => {
23
+ transactionStatusQuery: import("@tanstack/react-query").UseQueryResult<import("@0xsquid/squid-types").StatusResponse, Error>;
24
+ };
25
+ export {};
@@ -0,0 +1,26 @@
1
+ import { StatusResponse } from "@0xsquid/squid-types";
2
+ import { SwapTransactionForStatus, TransactionStatus } from "../../core/types/transaction";
3
+ interface UseSwapStatusQueryParams {
4
+ transaction?: SwapTransactionForStatus;
5
+ retry?: number;
6
+ refetchOnWindowFocus?: "always" | boolean;
7
+ enabled?: boolean;
8
+ /**
9
+ * Fires on every successful status response, with the raw status string.
10
+ * Use for non-terminal transitions (e.g. a deposit being received).
11
+ */
12
+ onStatus?: (params: {
13
+ status: string;
14
+ statusResponse: StatusResponse;
15
+ }) => void;
16
+ onEndStatus?: (params: {
17
+ status: TransactionStatus;
18
+ statusResponse: StatusResponse;
19
+ }) => void;
20
+ onNotFound?: () => void;
21
+ onError?: () => void;
22
+ }
23
+ export declare const useSwapStatusQuery: ({ transaction, retry, refetchOnWindowFocus, enabled, onStatus, onEndStatus, onNotFound, onError, }: UseSwapStatusQueryParams) => {
24
+ transactionStatusQuery: import("@tanstack/react-query").UseQueryResult<StatusResponse, Error>;
25
+ };
26
+ export {};
@@ -65,11 +65,7 @@ export declare const useMultiChainWallet: (chain: ChainData | undefined) => {
65
65
  supportedNetworks: import("../../core/types/wallet").NetworkConfig[];
66
66
  } & {
67
67
  type: ChainType.COSMOS;
68
- connector: () => {
69
- id: string;
70
- name: string;
71
- provider: any;
72
- };
68
+ connector: import("../../core/types/cosmos").CosmosConnector;
73
69
  }) | ({
74
70
  name: string;
75
71
  connectorId: import("../../core/types/wallet").ConnectorID;
@@ -86,18 +82,10 @@ export declare const useMultiChainWallet: (chain: ChainData | undefined) => {
86
82
  isMultiChain?: false | undefined;
87
83
  } & {
88
84
  type: ChainType.COSMOS;
89
- connector: () => {
90
- id: string;
91
- name: string;
92
- provider: any;
93
- };
85
+ connector: import("../../core/types/cosmos").CosmosConnector;
94
86
  } & {
95
87
  type: ChainType.COSMOS;
96
- connector: () => {
97
- id: string;
98
- name: string;
99
- provider: any;
100
- };
88
+ connector: import("../../core/types/cosmos").CosmosConnector;
101
89
  }) | ({
102
90
  name: string;
103
91
  connectorId: import("../../core/types/wallet").ConnectorID;
@@ -288,5 +276,43 @@ export declare const useMultiChainWallet: (chain: ChainData | undefined) => {
288
276
  } & {
289
277
  type: ChainType.STELLAR;
290
278
  connector: import("../../core/types/stellar").StellarConnector;
279
+ }) | ({
280
+ name: string;
281
+ connectorId: import("../../core/types/wallet").ConnectorID;
282
+ connectorName: string;
283
+ icon: string | undefined;
284
+ windowFlag: import("../../core/types/wallet").WindowWalletFlag;
285
+ isMobile?: boolean | undefined;
286
+ isQrWallet?: boolean | undefined;
287
+ isInstalled?: (() => boolean) | undefined;
288
+ skipInstallCheck?: boolean | undefined;
289
+ rdns?: string | undefined;
290
+ url?: string | undefined;
291
+ } & {
292
+ isMultiChain: true;
293
+ supportedNetworks: import("../../core/types/wallet").NetworkConfig[];
294
+ } & {
295
+ type: ChainType.CANTON;
296
+ connector: import("../../core/types/canton").CantonConnector;
297
+ }) | ({
298
+ name: string;
299
+ connectorId: import("../../core/types/wallet").ConnectorID;
300
+ connectorName: string;
301
+ icon: string | undefined;
302
+ windowFlag: import("../../core/types/wallet").WindowWalletFlag;
303
+ isMobile?: boolean | undefined;
304
+ isQrWallet?: boolean | undefined;
305
+ isInstalled?: (() => boolean) | undefined;
306
+ skipInstallCheck?: boolean | undefined;
307
+ rdns?: string | undefined;
308
+ url?: string | undefined;
309
+ } & {
310
+ isMultiChain?: false | undefined;
311
+ } & {
312
+ type: ChainType.CANTON;
313
+ connector: import("../../core/types/canton").CantonConnector;
314
+ } & {
315
+ type: ChainType.CANTON;
316
+ connector: import("../../core/types/canton").CantonConnector;
291
317
  }) | undefined;
292
318
  };
@@ -65,11 +65,7 @@ export declare const useWallet: () => {
65
65
  supportedNetworks: import("../../core/types/wallet").NetworkConfig[];
66
66
  } & {
67
67
  type: ChainType.COSMOS;
68
- connector: () => {
69
- id: string;
70
- name: string;
71
- provider: any;
72
- };
68
+ connector: import("../../core/types/cosmos").CosmosConnector;
73
69
  }) | ({
74
70
  name: string;
75
71
  connectorId: import("../../core/types/wallet").ConnectorID;
@@ -86,18 +82,10 @@ export declare const useWallet: () => {
86
82
  isMultiChain?: false | undefined;
87
83
  } & {
88
84
  type: ChainType.COSMOS;
89
- connector: () => {
90
- id: string;
91
- name: string;
92
- provider: any;
93
- };
85
+ connector: import("../../core/types/cosmos").CosmosConnector;
94
86
  } & {
95
87
  type: ChainType.COSMOS;
96
- connector: () => {
97
- id: string;
98
- name: string;
99
- provider: any;
100
- };
88
+ connector: import("../../core/types/cosmos").CosmosConnector;
101
89
  });
102
90
  address: string;
103
91
  }>;
@@ -311,6 +299,48 @@ export declare const useWallet: () => {
311
299
  });
312
300
  address: string;
313
301
  }>;
302
+ canton: Partial<{
303
+ wallet: ({
304
+ name: string;
305
+ connectorId: import("../../core/types/wallet").ConnectorID;
306
+ connectorName: string;
307
+ icon: string | undefined;
308
+ windowFlag: import("../../core/types/wallet").WindowWalletFlag;
309
+ isMobile?: boolean | undefined;
310
+ isQrWallet?: boolean | undefined;
311
+ isInstalled?: (() => boolean) | undefined;
312
+ skipInstallCheck?: boolean | undefined;
313
+ rdns?: string | undefined;
314
+ url?: string | undefined;
315
+ } & {
316
+ isMultiChain: true;
317
+ supportedNetworks: import("../../core/types/wallet").NetworkConfig[];
318
+ } & {
319
+ type: ChainType.CANTON;
320
+ connector: import("../../core/types/canton").CantonConnector;
321
+ }) | ({
322
+ name: string;
323
+ connectorId: import("../../core/types/wallet").ConnectorID;
324
+ connectorName: string;
325
+ icon: string | undefined;
326
+ windowFlag: import("../../core/types/wallet").WindowWalletFlag;
327
+ isMobile?: boolean | undefined;
328
+ isQrWallet?: boolean | undefined;
329
+ isInstalled?: (() => boolean) | undefined;
330
+ skipInstallCheck?: boolean | undefined;
331
+ rdns?: string | undefined;
332
+ url?: string | undefined;
333
+ } & {
334
+ isMultiChain?: false | undefined;
335
+ } & {
336
+ type: ChainType.CANTON;
337
+ connector: import("../../core/types/canton").CantonConnector;
338
+ } & {
339
+ type: ChainType.CANTON;
340
+ connector: import("../../core/types/canton").CantonConnector;
341
+ });
342
+ address: string;
343
+ }>;
314
344
  };
315
345
  connectedAddresses: Record<ChainType, string | undefined>;
316
346
  connectingWalletState: import("../store/useWalletStore").ConnectingWalletState;