@0xsquid/react-hooks 8.8.1-beta-canton.1 → 8.8.1-beta-canton.3
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/hooks/store/useDepositAddressStore.d.ts +8 -2
- package/dist/hooks/swap/useDepositAddress.d.ts +4 -3
- package/dist/{index-BOyZL5gB.js → index-BXuWPj5X.js} +24 -21
- package/dist/{index-BOyZL5gB.js.map → index-BXuWPj5X.js.map} +1 -1
- package/dist/{index-C6O8biTF.js → index-DSDEoKAQ.js} +24 -21
- package/dist/{index-C6O8biTF.js.map → index-DSDEoKAQ.js.map} +1 -1
- package/dist/{index.es-CjEZHrFG.js → index.es-C7vw_7iQ.js} +2 -2
- package/dist/{index.es-CjEZHrFG.js.map → index.es-C7vw_7iQ.js.map} +1 -1
- package/dist/{index.es-DXtULgAw.js → index.es-CP6uAXkL.js} +2 -2
- package/dist/{index.es-DXtULgAw.js.map → index.es-CP6uAXkL.js.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{secretService-DQhP5g0c.js → secretService-BaRVTuK5.js} +2 -2
- package/dist/{secretService-DQhP5g0c.js.map → secretService-BaRVTuK5.js.map} +1 -1
- package/dist/{secretService-s34iHqOe.js → secretService-L7xBX95y.js} +2 -2
- package/dist/{secretService-s34iHqOe.js.map → secretService-L7xBX95y.js.map} +1 -1
- package/dist/{stellarService.client-DlaL8w0o.js → stellarService.client-Cnzwca-X.js} +2 -2
- package/dist/{stellarService.client-DlaL8w0o.js.map → stellarService.client-Cnzwca-X.js.map} +1 -1
- package/dist/{stellarService.client-BQrRZDwB.js → stellarService.client-SFl8OhRJ.js} +2 -2
- package/dist/{stellarService.client-BQrRZDwB.js.map → stellarService.client-SFl8OhRJ.js.map} +1 -1
- package/package.json +1 -1
|
@@ -11,11 +11,17 @@ export interface DepositData {
|
|
|
11
11
|
*/
|
|
12
12
|
memo?: string;
|
|
13
13
|
}
|
|
14
|
+
export type PaymentMethod = "connectedWallet" | "depositAddress";
|
|
14
15
|
interface DepositAddressStore {
|
|
15
16
|
deposit: DepositData | null;
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Raw user intent — which payment method the user picked.
|
|
19
|
+
* NOT whether deposit is actually usable on the current source chain;
|
|
20
|
+
* that is derived in `useDepositAddress` via `isDepositAddressActive`.
|
|
21
|
+
*/
|
|
22
|
+
selectedPaymentMethod: PaymentMethod;
|
|
17
23
|
setDeposit(data: DepositData | null): void;
|
|
18
|
-
|
|
24
|
+
setPaymentMethod(method: PaymentMethod): void;
|
|
19
25
|
}
|
|
20
26
|
export declare const useDepositAddressStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DepositAddressStore>>;
|
|
21
27
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
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
|
-
disable: () => void;
|
|
8
|
+
setPaymentMethod: (method: PaymentMethod) => void;
|
|
8
9
|
getRouteWithDeposit: import("@tanstack/react-query").UseMutationResult<void, unknown, {
|
|
9
10
|
route: RouteResponse["route"];
|
|
10
11
|
}, unknown>;
|
|
@@ -23375,7 +23375,7 @@ const filterViewableTokens = (tokens, config, direction) => {
|
|
|
23375
23375
|
};
|
|
23376
23376
|
const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
|
|
23377
23377
|
const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
|
|
23378
|
-
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-
|
|
23378
|
+
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-BaRVTuK5.js'); });
|
|
23379
23379
|
return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
|
|
23380
23380
|
};
|
|
23381
23381
|
function getTokenAssetsKey(token) {
|
|
@@ -26784,7 +26784,7 @@ function useStellarWallets() {
|
|
|
26784
26784
|
try {
|
|
26785
26785
|
const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
|
|
26786
26786
|
const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module.mjs');
|
|
26787
|
-
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-
|
|
26787
|
+
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-SFl8OhRJ.js'); });
|
|
26788
26788
|
const modules = [...initializeAllModules(), new LedgerModule()];
|
|
26789
26789
|
const promises = modules.map(async (module) => {
|
|
26790
26790
|
const isAvailable = await module.isAvailable();
|
|
@@ -30134,7 +30134,7 @@ function hederaWalletConnect(parameters) {
|
|
|
30134
30134
|
const optionalChains = config.chains.map((x) => x.id);
|
|
30135
30135
|
if (!optionalChains.length)
|
|
30136
30136
|
return;
|
|
30137
|
-
const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-
|
|
30137
|
+
const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-C7vw_7iQ.js'); });
|
|
30138
30138
|
const rawProvider = await EthereumProvider.init({
|
|
30139
30139
|
...restParameters,
|
|
30140
30140
|
disableProviderPing: true,
|
|
@@ -30815,21 +30815,21 @@ const useSendTransactionStore = zustand.create((set, get) => ({
|
|
|
30815
30815
|
|
|
30816
30816
|
const useDepositAddressStore = zustand.create((set) => ({
|
|
30817
30817
|
deposit: null,
|
|
30818
|
-
|
|
30818
|
+
selectedPaymentMethod: "connectedWallet",
|
|
30819
30819
|
setDeposit: (data) => {
|
|
30820
30820
|
set({ deposit: data });
|
|
30821
30821
|
},
|
|
30822
|
-
|
|
30823
|
-
set({
|
|
30822
|
+
setPaymentMethod: (method) => {
|
|
30823
|
+
set({ selectedPaymentMethod: method });
|
|
30824
30824
|
},
|
|
30825
30825
|
}));
|
|
30826
30826
|
|
|
30827
30827
|
function useDepositAddress(squidRoute) {
|
|
30828
|
-
const {
|
|
30829
|
-
|
|
30828
|
+
const { selectedPaymentMethod, depositAddress } = useDepositAddressStore((state) => ({
|
|
30829
|
+
selectedPaymentMethod: state.selectedPaymentMethod,
|
|
30830
30830
|
depositAddress: state.deposit?.depositAddress,
|
|
30831
30831
|
}));
|
|
30832
|
-
const { setDeposit,
|
|
30832
|
+
const { setDeposit, setPaymentMethod, deposit } = useDepositAddressStore();
|
|
30833
30833
|
const { squid } = useSquidStore();
|
|
30834
30834
|
const { fromChain } = useSwap();
|
|
30835
30835
|
const isAvailableAsPaymentMethod = React.useMemo(() => {
|
|
@@ -30846,12 +30846,14 @@ function useDepositAddress(squidRoute) {
|
|
|
30846
30846
|
return (squidRoute?.transactionRequest?.type ===
|
|
30847
30847
|
squidTypes.SquidDataType.ChainflipDepositAddress);
|
|
30848
30848
|
}, [squidRoute?.transactionRequest?.type]);
|
|
30849
|
-
|
|
30850
|
-
|
|
30851
|
-
|
|
30852
|
-
|
|
30853
|
-
|
|
30854
|
-
|
|
30849
|
+
// Effective payment method: the user's intent clamped by what the current
|
|
30850
|
+
// source chain can actually do. Reading this (instead of raw intent) is what
|
|
30851
|
+
// keeps every consumer in sync — if the source chain can't use a deposit
|
|
30852
|
+
// address, the effective method is "connectedWallet" immediately at read time.
|
|
30853
|
+
const paymentMethod = isAvailableAsPaymentMethod
|
|
30854
|
+
? selectedPaymentMethod
|
|
30855
|
+
: "connectedWallet";
|
|
30856
|
+
const isDepositAddressActive = paymentMethod === "depositAddress";
|
|
30855
30857
|
const closeDepositChannel = React.useCallback(() => {
|
|
30856
30858
|
setDeposit(null);
|
|
30857
30859
|
}, [setDeposit]);
|
|
@@ -30883,11 +30885,11 @@ function useDepositAddress(squidRoute) {
|
|
|
30883
30885
|
}
|
|
30884
30886
|
});
|
|
30885
30887
|
return {
|
|
30886
|
-
|
|
30888
|
+
paymentMethod,
|
|
30889
|
+
isDepositAddressActive,
|
|
30887
30890
|
isAvailableAsPaymentMethod,
|
|
30888
30891
|
swapWillGenerateDepositAddress,
|
|
30889
|
-
|
|
30890
|
-
disable,
|
|
30892
|
+
setPaymentMethod,
|
|
30891
30893
|
getRouteWithDeposit,
|
|
30892
30894
|
depositAddress,
|
|
30893
30895
|
closeDepositChannel,
|
|
@@ -33062,6 +33064,7 @@ const sourceReceivedStatuses = [
|
|
|
33062
33064
|
"COMPLETE",
|
|
33063
33065
|
// Canton (Squid Intents)
|
|
33064
33066
|
"awaiting",
|
|
33067
|
+
"success",
|
|
33065
33068
|
];
|
|
33066
33069
|
/**
|
|
33067
33070
|
* Tracks a generated deposit address before it becomes a persisted swap history item.
|
|
@@ -36976,7 +36979,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
|
|
|
36976
36979
|
const squid = useSquidStore((state) => state.squid);
|
|
36977
36980
|
const fallbackAddress = useSwapRoutePersistStore((store) => store.swapRoute?.fallbackAddress);
|
|
36978
36981
|
const depositRefundAddress = useSwapRoutePersistStore((store) => store.swapRoute?.depositRefundAddress);
|
|
36979
|
-
const {
|
|
36982
|
+
const { isDepositAddressActive } = useDepositAddress();
|
|
36980
36983
|
const getRouteMutation = useGetRoute();
|
|
36981
36984
|
const { fromChain, toChain, fromPrice, destinationAddress: { address: destinationAddress } = {}, fromToken, toToken, } = useSwap();
|
|
36982
36985
|
const { connectedAddress: { address: sourceConnectedAddress }, } = useMultiChainWallet(fromChain);
|
|
@@ -36984,7 +36987,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
|
|
|
36984
36987
|
// Tokens will be sent to this address in case of swap failure
|
|
36985
36988
|
//
|
|
36986
36989
|
// If deposit address is not selected, we use the connected address as the source address instead
|
|
36987
|
-
const sourceUserAddress =
|
|
36990
|
+
const sourceUserAddress = isDepositAddressActive
|
|
36988
36991
|
? depositRefundAddress ?? sourceConnectedAddress
|
|
36989
36992
|
: sourceConnectedAddress;
|
|
36990
36993
|
const squidRouteQueryKeys = React.useMemo(() => keys().transaction(fromChain?.chainId, toChain?.chainId, toToken?.address, fromToken?.address, fromPrice, config.slippage, sourceUserAddress, config.degenMode, destinationAddress, fallbackAddress, quoteOnly, fromChain?.chainType, config.preHook, config.postHook, config.overrideGasRefundAddress), [
|
|
@@ -37915,4 +37918,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
|
|
|
37915
37918
|
exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
|
|
37916
37919
|
exports.walletIconBaseUrl = walletIconBaseUrl;
|
|
37917
37920
|
exports.walletSupportsChainType = walletSupportsChainType;
|
|
37918
|
-
//# sourceMappingURL=index-
|
|
37921
|
+
//# sourceMappingURL=index-BXuWPj5X.js.map
|