@0xsquid/react-hooks 8.9.1-beta.0 → 8.10.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/canton/cantonConnector.d.ts +28 -0
- package/dist/core/canton/cip103Client.d.ts +20 -0
- package/dist/core/client/index.d.ts +1 -0
- package/dist/core/connectors/bitcoin/errors/index.d.ts +0 -3
- package/dist/core/connectors/bitcoin/wallets/index.d.ts +0 -1
- package/dist/core/connectors/bitcoin/wallets/phantom.d.ts +26 -10
- package/dist/core/constants.d.ts +3 -0
- package/dist/core/fallbackWallets.d.ts +16 -0
- package/dist/core/providers/CantonProvider.d.ts +19 -0
- package/dist/core/types/canton.d.ts +58 -0
- package/dist/core/types/cosmos.d.ts +5 -0
- package/dist/core/types/wallet.d.ts +15 -7
- package/dist/core/wallets.d.ts +5 -0
- package/dist/hooks/canton/useCanton.d.ts +2 -0
- package/dist/hooks/canton/useCantonWallets.d.ts +8 -0
- package/dist/hooks/chains/useSquidChains.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/store/useDepositAddressStore.d.ts +18 -5
- package/dist/hooks/swap/useDepositAddress.d.ts +6 -7
- package/dist/hooks/tokens/useBalance.d.ts +1 -0
- package/dist/hooks/tokens/useNativeBalance.d.ts +1 -0
- package/dist/hooks/tokens/useSquidTokens.d.ts +1 -0
- package/dist/hooks/transaction/useDepositTransactionStatus.d.ts +20 -0
- package/dist/hooks/transaction/useSwapStatusQuery.d.ts +29 -0
- package/dist/hooks/wallet/useMultiChainWallet.d.ts +55 -29
- package/dist/hooks/wallet/useSigner.d.ts +1 -0
- package/dist/hooks/wallet/useWallet.d.ts +59 -29
- package/dist/hooks/xrpl/useXrplWallets.d.ts +2 -2
- package/dist/{index-Ypw6i6uY.js → index-BlB3yIoX.js} +1398 -294
- package/dist/index-BlB3yIoX.js.map +1 -0
- package/dist/{index-sCLxPcqi.js → index-Dzir2lUQ.js} +1383 -276
- package/dist/index-Dzir2lUQ.js.map +1 -0
- package/dist/{index.es-B2QD8f3q.js → index.es-BPXYaraD.js} +5 -4
- package/dist/index.es-BPXYaraD.js.map +1 -0
- package/dist/{index.es-Bot12hgd.js → index.es-DwtZr7bN.js} +5 -4
- package/dist/index.es-DwtZr7bN.js.map +1 -0
- package/dist/index.esm.js +4 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/{secretService-C3jMjsK0.js → secretService-ICina23f.js} +5 -4
- package/dist/{secretService-C3jMjsK0.js.map → secretService-ICina23f.js.map} +1 -1
- package/dist/{secretService-BAK4sBb7.js → secretService-eiBnD7dI.js} +5 -4
- package/dist/{secretService-BAK4sBb7.js.map → secretService-eiBnD7dI.js.map} +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.esm.js +7 -1
- package/dist/server.esm.js.map +1 -1
- package/dist/server.js +7 -0
- package/dist/server.js.map +1 -1
- package/dist/services/external/onrampAdapter.d.ts +3 -4
- package/dist/services/external/rpcService.d.ts +17 -0
- package/dist/services/internal/assetsService.d.ts +10 -1
- package/dist/services/internal/cantonDamlValue.d.ts +75 -0
- package/dist/services/internal/cantonService.d.ts +64 -0
- package/dist/services/internal/cantonTransferService.d.ts +93 -0
- package/dist/services/internal/transactionService.d.ts +5 -1
- package/dist/services/internal/walletService.d.ts +3 -6
- package/dist/{stellarService.client-SrhXgRGB.js → stellarService.client-Bjc92sC_.js} +6 -5
- package/dist/{stellarService.client-SrhXgRGB.js.map → stellarService.client-Bjc92sC_.js.map} +1 -1
- package/dist/{stellarService.client-DkJ6WAdl.js → stellarService.client-VOmCOPzL.js} +6 -5
- package/dist/{stellarService.client-DkJ6WAdl.js.map → stellarService.client-VOmCOPzL.js.map} +1 -1
- package/dist/tests/cantonService.test.d.ts +1 -0
- package/dist/tests/cantonTransferService.test.d.ts +1 -0
- package/dist/tests/cip103Client.test.d.ts +1 -0
- package/dist/tests/fallbackWallets.test.d.ts +1 -0
- package/dist/tests/wallets.test.d.ts +1 -0
- package/package.json +3 -2
- package/dist/core/connectors/bitcoin/bitcoinFeatures.d.ts +0 -53
- package/dist/core/connectors/bitcoin/wallets/standard.d.ts +0 -30
- package/dist/index-Ypw6i6uY.js.map +0 -1
- package/dist/index-sCLxPcqi.js.map +0 -1
- package/dist/index.es-B2QD8f3q.js.map +0 -1
- package/dist/index.es-Bot12hgd.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CantonAccount, CantonConnectResult, CantonConnector, CantonConnectorEvent, CantonConnectorEventHandler, CantonLedgerApiParams, CantonPrepareExecuteAndWaitResult, CantonPrepareExecuteParams } from "../types/canton";
|
|
2
|
+
import { AnnouncedCantonProvider } from "./cip103Client";
|
|
3
|
+
/**
|
|
4
|
+
* Browser-extension Canton connector: wraps one discovered CIP-103 provider
|
|
5
|
+
* (bound to its announce `target`) and exposes the lifecycle methods.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CantonBrowserConnector implements CantonConnector {
|
|
8
|
+
readonly providerId: string;
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly target: string | undefined;
|
|
11
|
+
private readonly client;
|
|
12
|
+
private readonly listeners;
|
|
13
|
+
private _accounts;
|
|
14
|
+
constructor(provider: AnnouncedCantonProvider, win?: Window);
|
|
15
|
+
get accounts(): CantonAccount[];
|
|
16
|
+
get address(): string | undefined;
|
|
17
|
+
connect(): Promise<CantonConnectResult>;
|
|
18
|
+
/** Silent connect: read accounts without prompting; throws if not connected. */
|
|
19
|
+
autoConnect(): Promise<CantonConnectResult>;
|
|
20
|
+
disconnect(): Promise<void>;
|
|
21
|
+
ledgerApi<T = unknown>(params: CantonLedgerApiParams): Promise<T>;
|
|
22
|
+
prepareExecuteAndWait(params: CantonPrepareExecuteParams): Promise<CantonPrepareExecuteAndWaitResult>;
|
|
23
|
+
getAccounts(): Promise<CantonAccount[]>;
|
|
24
|
+
on<E extends CantonConnectorEvent>(event: E, handler: CantonConnectorEventHandler<E>): void;
|
|
25
|
+
off<E extends CantonConnectorEvent>(event: E, handler: CantonConnectorEventHandler<E>): void;
|
|
26
|
+
private emit;
|
|
27
|
+
private refreshAccounts;
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const CANTON_REQUEST_PROVIDER_EVENT = "canton:requestProvider";
|
|
2
|
+
export declare const CANTON_ANNOUNCE_PROVIDER_EVENT = "canton:announceProvider";
|
|
3
|
+
export interface AnnouncedCantonProvider {
|
|
4
|
+
/** Stable identifier for the wallet/extension. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Display name for pickers. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Optional icon (data URL or https URL). */
|
|
9
|
+
icon?: string;
|
|
10
|
+
/** Routing key for the postMessage transport (defaults to `id`). */
|
|
11
|
+
target?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CIP-103 browser-wallet discovery (EIP-6963-style).
|
|
15
|
+
* The wallet dispatches `canton:announceProvider` and dApps
|
|
16
|
+
* dispatch `canton:requestProvider` to ask installed wallets to re-announce.
|
|
17
|
+
* Each announcement carries a `target` we route through Sigilry's `WindowTransport`,
|
|
18
|
+
* so multiple extensions coexist without contending on the `window.canton` global.
|
|
19
|
+
*/
|
|
20
|
+
export declare function discoverCantonProviders(timeoutMs?: number, win?: Window): Promise<AnnouncedCantonProvider[]>;
|
|
@@ -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 {};
|
|
@@ -10,7 +10,4 @@ export declare class BitcoinConnectorTransactionFailedError extends BitcoinConne
|
|
|
10
10
|
export declare class BitcoinConnectorInvalidAccountError extends BitcoinConnectorError {
|
|
11
11
|
constructor();
|
|
12
12
|
}
|
|
13
|
-
export declare class BitcoinConnectorFeatureNotSupportedError extends BitcoinConnectorError {
|
|
14
|
-
constructor(providerName: string, feature: string);
|
|
15
|
-
}
|
|
16
13
|
export {};
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* through the standard Bitcoin features. See {@link BitcoinStandardConnector}.
|
|
8
|
-
*/
|
|
9
|
-
export declare class PhantomConnector extends BitcoinStandardConnector {
|
|
10
|
-
constructor();
|
|
1
|
+
import { BitcoinConnector } from "../../../../core/types/bitcoin";
|
|
2
|
+
export interface PhantomBitcoinAccount {
|
|
3
|
+
address: string;
|
|
4
|
+
publicKey: string;
|
|
5
|
+
addressType: "p2tr" | "p2wpkh" | "p2sh" | "p2pkh";
|
|
6
|
+
purpose: "payment" | "ordinals";
|
|
11
7
|
}
|
|
8
|
+
interface PhantomProvider {
|
|
9
|
+
requestAccounts: () => Promise<PhantomBitcoinAccount[]>;
|
|
10
|
+
signPSBT: (psbt: Uint8Array, options: {
|
|
11
|
+
inputsToSign: {
|
|
12
|
+
address: string;
|
|
13
|
+
signingIndexes: number[];
|
|
14
|
+
}[];
|
|
15
|
+
}) => Promise<Uint8Array>;
|
|
16
|
+
}
|
|
17
|
+
export declare class PhantomConnector implements BitcoinConnector {
|
|
18
|
+
get getProvider(): PhantomProvider;
|
|
19
|
+
requestAccount(): Promise<{
|
|
20
|
+
address: string;
|
|
21
|
+
}>;
|
|
22
|
+
sendBTC(to: string, amount: number): Promise<{
|
|
23
|
+
txHash: string;
|
|
24
|
+
}>;
|
|
25
|
+
private signPsbt;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
package/dist/core/constants.d.ts
CHANGED
|
@@ -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";
|
|
@@ -28,6 +29,7 @@ export declare const gasRefundMultiplier = 25;
|
|
|
28
29
|
export declare const internalSquidApiBaseUrl = "https://app.squidrouter.com/api";
|
|
29
30
|
export declare const XAMAN_API_URL: string;
|
|
30
31
|
export declare const TOKEN_PRICE_API_URL: string;
|
|
32
|
+
export declare const CANTON_AMULET_REGISTRY_URL: string;
|
|
31
33
|
export declare const DEFAULT_ROUTE_REFETCH_INTERVAL = 30000;
|
|
32
34
|
export declare const SOLANA_RPC_URL = "https://meredith-ute2ko-fast-mainnet.helius-rpc.com";
|
|
33
35
|
export declare const INTEGRATOR_ID = "squid-widget-playground-local-cd33cba6-7e12-4fcc-8d5d-35e286f655ea";
|
|
@@ -80,6 +82,7 @@ export declare const CHAIN_IDS: {
|
|
|
80
82
|
readonly XRPL_TESTNET: "xrpl-testnet";
|
|
81
83
|
readonly STELLAR: "stellar-mainnet";
|
|
82
84
|
readonly STELLAR_TESTNET: "stellar-testnet";
|
|
85
|
+
readonly CANTON: "canton";
|
|
83
86
|
};
|
|
84
87
|
export declare const chainTypeToDefaultChainIdMap: Record<ChainType, string>;
|
|
85
88
|
export declare const chainTypeToNativeTokenAddressMap: Record<ChainType, string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChainType } from "@0xsquid/squid-types";
|
|
2
|
+
import type { WalletLinks } from "./types/wallet";
|
|
3
|
+
export type FallbackWalletConfig = {
|
|
4
|
+
chainType: ChainType;
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
connectorName: string;
|
|
8
|
+
icon: string;
|
|
9
|
+
links: WalletLinks;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Wallets to show regardless of whether they're detected.
|
|
13
|
+
* Useful when we want to link to the browser extension store
|
|
14
|
+
* for wallets that are automatically discovered (i.e. EVM, SOLANA, CANTON...)
|
|
15
|
+
*/
|
|
16
|
+
export declare const fallbackWallets: FallbackWalletConfig[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChainType } from "@0xsquid/squid-types";
|
|
2
|
+
import { UseMutationResult } from "@tanstack/react-query";
|
|
3
|
+
import React, { ReactNode } from "react";
|
|
4
|
+
import { CantonConnector } from "../types/canton";
|
|
5
|
+
import { CantonWallet, ConnectWalletResult } from "../types/wallet";
|
|
6
|
+
export interface ICantonContextData {
|
|
7
|
+
connectCanton: UseMutationResult<ConnectWalletResult<ChainType.CANTON>, unknown, {
|
|
8
|
+
wallet: CantonWallet;
|
|
9
|
+
}, unknown>;
|
|
10
|
+
disconnectCanton: () => Promise<void>;
|
|
11
|
+
autoConnectCanton: () => Promise<void>;
|
|
12
|
+
signer: CantonConnector | undefined;
|
|
13
|
+
wallets: CantonWallet[];
|
|
14
|
+
}
|
|
15
|
+
export declare const CantonContext: React.Context<ICantonContextData | undefined>;
|
|
16
|
+
export declare const CantonProvider: React.FC<{
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const useCantonContext: () => ICantonContextData;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CantonClient } from "@sigilry/dapp";
|
|
2
|
+
export interface CantonLedgerApiParams {
|
|
3
|
+
requestMethod: "get" | "post" | "patch" | "put" | "delete";
|
|
4
|
+
resource: string;
|
|
5
|
+
body?: Record<string, unknown>;
|
|
6
|
+
query?: Record<string, unknown>;
|
|
7
|
+
path?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export interface CantonAccount {
|
|
10
|
+
partyId: string;
|
|
11
|
+
primary?: boolean;
|
|
12
|
+
hint?: string;
|
|
13
|
+
namespace?: string;
|
|
14
|
+
networkId?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CantonInstrument {
|
|
17
|
+
admin: string;
|
|
18
|
+
id: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CantonHolding {
|
|
21
|
+
contractId: string;
|
|
22
|
+
instrument: CantonInstrument;
|
|
23
|
+
amount: string;
|
|
24
|
+
locked: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface CantonDisclosedContract {
|
|
27
|
+
templateId?: string;
|
|
28
|
+
contractId?: string;
|
|
29
|
+
createdEventBlob: string;
|
|
30
|
+
synchronizerId?: string;
|
|
31
|
+
}
|
|
32
|
+
export type CantonPrepareExecuteParams = Parameters<CantonClient["prepareExecuteAndWait"]>[0];
|
|
33
|
+
export type CantonPrepareExecuteAndWaitResult = Awaited<ReturnType<CantonClient["prepareExecuteAndWait"]>>;
|
|
34
|
+
export interface CantonConnectorEventMap {
|
|
35
|
+
connect: [address: string];
|
|
36
|
+
disconnect: [];
|
|
37
|
+
}
|
|
38
|
+
export type CantonConnectorEvent = keyof CantonConnectorEventMap;
|
|
39
|
+
export type CantonConnectorEventHandler<E extends CantonConnectorEvent> = (...args: CantonConnectorEventMap[E]) => void;
|
|
40
|
+
export interface CantonConnectResult {
|
|
41
|
+
address: string;
|
|
42
|
+
accounts: CantonAccount[];
|
|
43
|
+
}
|
|
44
|
+
export interface CantonConnector {
|
|
45
|
+
readonly providerId: string;
|
|
46
|
+
readonly name: string;
|
|
47
|
+
readonly target: string | undefined;
|
|
48
|
+
connect(): Promise<CantonConnectResult>;
|
|
49
|
+
autoConnect(): Promise<CantonConnectResult>;
|
|
50
|
+
disconnect(): Promise<void>;
|
|
51
|
+
ledgerApi<T = unknown>(params: CantonLedgerApiParams): Promise<T>;
|
|
52
|
+
prepareExecuteAndWait(params: CantonPrepareExecuteParams): Promise<CantonPrepareExecuteAndWaitResult>;
|
|
53
|
+
getAccounts(): Promise<CantonAccount[]>;
|
|
54
|
+
on<E extends CantonConnectorEvent>(event: E, handler: CantonConnectorEventHandler<E>): void;
|
|
55
|
+
off<E extends CantonConnectorEvent>(event: E, handler: CantonConnectorEventHandler<E>): void;
|
|
56
|
+
readonly accounts: CantonAccount[];
|
|
57
|
+
readonly address: string | undefined;
|
|
58
|
+
}
|
|
@@ -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:
|
|
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[];
|
|
@@ -71,6 +72,11 @@ export type NetworkConfig = {
|
|
|
71
72
|
connector: ConnectorByChainType[T];
|
|
72
73
|
};
|
|
73
74
|
}[ChainType];
|
|
75
|
+
export type WalletLinks = {
|
|
76
|
+
website?: string;
|
|
77
|
+
chrome?: string;
|
|
78
|
+
firefox?: string;
|
|
79
|
+
};
|
|
74
80
|
export type Wallet = {
|
|
75
81
|
name: string;
|
|
76
82
|
connectorId: ConnectorID;
|
|
@@ -82,7 +88,7 @@ export type Wallet = {
|
|
|
82
88
|
isInstalled?: () => boolean;
|
|
83
89
|
skipInstallCheck?: boolean;
|
|
84
90
|
rdns?: string;
|
|
85
|
-
|
|
91
|
+
links?: WalletLinks;
|
|
86
92
|
} & ({
|
|
87
93
|
isMultiChain: true;
|
|
88
94
|
supportedNetworks: NetworkConfig[];
|
|
@@ -137,6 +143,7 @@ export interface ChainTypeToWalletState {
|
|
|
137
143
|
[ChainType.SUI]: BaseWalletState<SuiWallet> & SuiAccount;
|
|
138
144
|
[ChainType.XRPL]: BaseWalletState<XrplWallet>;
|
|
139
145
|
[ChainType.STELLAR]: BaseWalletState<StellarWallet>;
|
|
146
|
+
[ChainType.CANTON]: BaseWalletState<CantonWallet>;
|
|
140
147
|
}
|
|
141
148
|
interface ConnectorByChainType extends Record<ChainType, unknown> {
|
|
142
149
|
[ChainType.EVM]: EvmConnector;
|
|
@@ -146,5 +153,6 @@ interface ConnectorByChainType extends Record<ChainType, unknown> {
|
|
|
146
153
|
[ChainType.SUI]: SuiConnector;
|
|
147
154
|
[ChainType.XRPL]: XrplConnector;
|
|
148
155
|
[ChainType.STELLAR]: StellarConnector;
|
|
156
|
+
[ChainType.CANTON]: CantonConnector;
|
|
149
157
|
}
|
|
150
158
|
export {};
|
package/dist/core/wallets.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { ConnectorID } from "./types";
|
|
2
2
|
import { Wallet, XrplWallet } from "./types/wallet";
|
|
3
3
|
export declare const walletIconBaseUrl = "https://raw.githubusercontent.com/0xsquid/assets/main/images/webp128/wallets";
|
|
4
|
+
/**
|
|
5
|
+
* Dynamically accesses a nested property of an object based on a dot-separated string path.
|
|
6
|
+
* Returns the value of the property if found, otherwise undefined.
|
|
7
|
+
*/
|
|
8
|
+
export declare const accessProperty: (object: Record<string, any>, path: string) => any;
|
|
4
9
|
export declare const xrplWallets: XrplWallet[];
|
|
5
10
|
export declare const multiChainWallets: Wallet[];
|
|
6
11
|
export declare const singleChainWallets: Wallet[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CantonWallet } from "../../core/types/wallet";
|
|
2
|
+
/**
|
|
3
|
+
* Discovers Canton browser-extension wallets via the CIP-103 announce protocol
|
|
4
|
+
* (on mount and on window focus) and maps each to a {@link CantonWallet}.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useCantonWallets(): {
|
|
7
|
+
wallets: CantonWallet[];
|
|
8
|
+
};
|
|
@@ -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
|
};
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -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,9 +1,22 @@
|
|
|
1
|
-
|
|
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
|
+
}
|
|
14
|
+
export type PaymentMethod = "connectedWallet" | "depositAddress";
|
|
2
15
|
interface DepositAddressStore {
|
|
3
|
-
deposit:
|
|
4
|
-
|
|
5
|
-
setDeposit(data:
|
|
6
|
-
|
|
16
|
+
deposit: DepositData | null;
|
|
17
|
+
selectedPaymentMethod: PaymentMethod;
|
|
18
|
+
setDeposit(data: DepositData | null): void;
|
|
19
|
+
setPaymentMethod(method: PaymentMethod): void;
|
|
7
20
|
}
|
|
8
21
|
export declare const useDepositAddressStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DepositAddressStore>>;
|
|
9
22
|
export {};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { RouteResponse } from "@0xsquid/squid-types";
|
|
2
|
+
import { PaymentMethod } from "../store/useDepositAddressStore";
|
|
2
3
|
export declare function useDepositAddress(squidRoute?: RouteResponse["route"]): {
|
|
3
|
-
|
|
4
|
+
paymentMethod: PaymentMethod;
|
|
5
|
+
isDepositAddressActive: boolean;
|
|
4
6
|
isAvailableAsPaymentMethod: boolean;
|
|
5
7
|
swapWillGenerateDepositAddress: boolean;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
getRouteWithDeposit: import("@tanstack/react-query").UseMutationResult<{
|
|
9
|
-
depositAddress: import("@0xsquid/squid-types").ChainflipDepositAddressResponse;
|
|
10
|
-
}, unknown, {
|
|
8
|
+
setPaymentMethod: (method: PaymentMethod) => void;
|
|
9
|
+
getRouteWithDeposit: import("@tanstack/react-query").UseMutationResult<void, unknown, {
|
|
11
10
|
route: RouteResponse["route"];
|
|
12
11
|
}, unknown>;
|
|
13
12
|
depositAddress: string | undefined;
|
|
14
13
|
closeDepositChannel: () => void;
|
|
15
|
-
depositData: import("
|
|
14
|
+
depositData: import("../store/useDepositAddressStore").DepositData | null;
|
|
16
15
|
};
|
|
@@ -17,4 +17,5 @@ export declare const useBitcoinBalance: ({ userAddress, chain, }: UseBalanceOpti
|
|
|
17
17
|
export declare const useSuiBalance: ({ chain, token, userAddress, enabled, refreshIntervalMs, }: UseBalanceOptions) => UseBalanceResult;
|
|
18
18
|
export declare const useXrplBalance: ({ userAddress, chain, enabled, token, refreshIntervalMs, }: UseBalanceOptions) => UseBalanceResult;
|
|
19
19
|
export declare const useStellarBalance: ({ userAddress, chain, enabled, token, refreshIntervalMs, }: UseBalanceOptions) => UseBalanceResult;
|
|
20
|
+
export declare const useCantonBalance: ({ chain, token, userAddress, enabled, refreshIntervalMs, }: UseBalanceOptions) => UseBalanceResult;
|
|
20
21
|
export {};
|
|
@@ -18,6 +18,7 @@ export declare const useSolanaNativeBalance: ({ chain, address, }: UseNativeBala
|
|
|
18
18
|
export declare const useSuiNativeBalance: ({ address, chain, }: UseNativeBalanceOptions) => UseNativeBalanceResult;
|
|
19
19
|
export declare const useXrplNativeBalance: ({ address, chain, }: UseNativeBalanceOptions) => UseNativeBalanceResult;
|
|
20
20
|
export declare const useStellarNativeBalance: ({ address, chain, }: UseNativeBalanceOptions) => UseNativeBalanceResult;
|
|
21
|
+
export declare const useCantonNativeBalance: ({ address, chain, }: UseNativeBalanceOptions) => UseNativeBalanceResult;
|
|
21
22
|
export declare const useNativeBalance: (chain?: ChainData) => {
|
|
22
23
|
nativeBalance: Balance | undefined;
|
|
23
24
|
nativeBalanceFormatted: string | undefined;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
onReceived?: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Tracks a deposit address intent before it becomes a persisted swap history item.
|
|
13
|
+
*
|
|
14
|
+
* Once the source deposit is received, it registers the transaction in the transaction
|
|
15
|
+
* and history stores, then signals the view via `onReceived` to navigate.
|
|
16
|
+
*/
|
|
17
|
+
export declare const useDepositTransactionStatus: ({ transaction, route, retry, refetchOnWindowFocus, enabled, onReceived, }: UseDepositTransactionStatusParams) => {
|
|
18
|
+
transactionStatusQuery: import("@tanstack/react-query").UseQueryResult<import("@0xsquid/squid-types").StatusResponse, Error>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Fires on terminal status transitions
|
|
18
|
+
*/
|
|
19
|
+
onEndStatus?: (params: {
|
|
20
|
+
status: TransactionStatus;
|
|
21
|
+
statusResponse: StatusResponse;
|
|
22
|
+
}) => void;
|
|
23
|
+
onNotFound?: () => void;
|
|
24
|
+
onError?: () => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const useSwapStatusQuery: ({ transaction, retry, refetchOnWindowFocus, enabled, onStatus, onEndStatus, onNotFound, onError, }: UseSwapStatusQueryParams) => {
|
|
27
|
+
transactionStatusQuery: import("@tanstack/react-query").UseQueryResult<StatusResponse, Error>;
|
|
28
|
+
};
|
|
29
|
+
export {};
|