@0xsquid/react-hooks 8.8.1-beta-canton.4 → 8.8.1-beta-wallet-verification.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 (92) hide show
  1. package/dist/core/client/index.d.ts +0 -1
  2. package/dist/core/connectors/bitcoin/wallets/keplr.d.ts +2 -1
  3. package/dist/core/connectors/bitcoin/wallets/unisat.d.ts +3 -0
  4. package/dist/core/connectors/xrpl/CrossMark.d.ts +12 -0
  5. package/dist/core/connectors/xrpl/Xaman.d.ts +14 -0
  6. package/dist/core/connectors/xrpl/XamanQr.d.ts +20 -0
  7. package/dist/core/connectors/xrpl/XrplMetamaskSnap.d.ts +12 -0
  8. package/dist/core/connectors/xrpl/walletVerification.d.ts +2 -0
  9. package/dist/core/constants.d.ts +0 -2
  10. package/dist/core/types/bitcoin.d.ts +1 -0
  11. package/dist/core/types/config.d.ts +1 -0
  12. package/dist/core/types/event.d.ts +4 -1
  13. package/dist/core/types/index.d.ts +3 -2
  14. package/dist/core/types/solana.d.ts +11 -1
  15. package/dist/core/types/sui.d.ts +2 -1
  16. package/dist/core/types/wallet.d.ts +6 -9
  17. package/dist/core/types/walletVerificationSignature/bitcoin.d.ts +10 -0
  18. package/dist/core/types/walletVerificationSignature/chainTypes.d.ts +19 -0
  19. package/dist/core/types/walletVerificationSignature/cosmos.d.ts +10 -0
  20. package/dist/core/types/walletVerificationSignature/evm.d.ts +10 -0
  21. package/dist/core/types/walletVerificationSignature/index.d.ts +18 -0
  22. package/dist/core/types/walletVerificationSignature/request.d.ts +3 -0
  23. package/dist/core/types/walletVerificationSignature/sharedResult.d.ts +20 -0
  24. package/dist/core/types/walletVerificationSignature/solana.d.ts +10 -0
  25. package/dist/core/types/walletVerificationSignature/stellar.d.ts +10 -0
  26. package/dist/core/types/walletVerificationSignature/sui.d.ts +10 -0
  27. package/dist/core/types/walletVerificationSignature/types.d.ts +69 -0
  28. package/dist/core/types/walletVerificationSignature/xrpl.d.ts +12 -0
  29. package/dist/core/types/walletVerificationSignature.d.ts +1 -0
  30. package/dist/core/types/xrpl.d.ts +14 -0
  31. package/dist/hooks/chains/useSquidChains.d.ts +0 -1
  32. package/dist/hooks/index.d.ts +1 -1
  33. package/dist/hooks/store/useDepositAddressStore.d.ts +5 -23
  34. package/dist/hooks/store/useWalletStore.d.ts +1 -0
  35. package/dist/hooks/swap/useDepositAddress.d.ts +7 -6
  36. package/dist/hooks/tokens/useSquidTokens.d.ts +0 -1
  37. package/dist/hooks/wallet/useMultiChainWallet.d.ts +18 -44
  38. package/dist/hooks/wallet/useSigner.d.ts +1 -1
  39. package/dist/hooks/wallet/useWallet.d.ts +18 -48
  40. package/dist/hooks/wallet/useWalletVerificationSignature.d.ts +22 -0
  41. package/dist/hooks/wallet/useWalletVerificationSignature.test.d.ts +1 -0
  42. package/dist/hooks/wallet/walletVerification/signers/bitcoin.d.ts +2 -0
  43. package/dist/hooks/wallet/walletVerification/signers/cosmos.d.ts +2 -0
  44. package/dist/hooks/wallet/walletVerification/signers/evm.d.ts +2 -0
  45. package/dist/hooks/wallet/walletVerification/signers/index.d.ts +3 -0
  46. package/dist/hooks/wallet/walletVerification/signers/solana.d.ts +2 -0
  47. package/dist/hooks/wallet/walletVerification/signers/stellar.d.ts +2 -0
  48. package/dist/hooks/wallet/walletVerification/signers/sui.d.ts +2 -0
  49. package/dist/hooks/wallet/walletVerification/signers/types.d.ts +33 -0
  50. package/dist/hooks/wallet/walletVerification/signers/xrpl.d.ts +2 -0
  51. package/dist/{index-D5QOR7JT.js → index-CtXS5uny.js} +1424 -560
  52. package/dist/index-CtXS5uny.js.map +1 -0
  53. package/dist/{index-mgE1SeE-.js → index-z1nGQX9p.js} +1440 -560
  54. package/dist/index-z1nGQX9p.js.map +1 -0
  55. package/dist/{index.es-Cq4mUT_n.js → index.es-CBWh71yD.js} +2 -2
  56. package/dist/{index.es-Cq4mUT_n.js.map → index.es-CBWh71yD.js.map} +1 -1
  57. package/dist/{index.es-3JPbTFKq.js → index.es-D8CAnRf1.js} +2 -2
  58. package/dist/{index.es-3JPbTFKq.js.map → index.es-D8CAnRf1.js.map} +1 -1
  59. package/dist/index.esm.js +1 -1
  60. package/dist/index.js +30 -6
  61. package/dist/index.js.map +1 -1
  62. package/dist/{secretService-DOOg6zVn.js → secretService-B2i6U8uo.js} +2 -2
  63. package/dist/{secretService-DOOg6zVn.js.map → secretService-B2i6U8uo.js.map} +1 -1
  64. package/dist/{secretService-DWq78rM5.js → secretService-BFehLMb_.js} +2 -2
  65. package/dist/{secretService-DWq78rM5.js.map → secretService-BFehLMb_.js.map} +1 -1
  66. package/dist/server.d.ts +1 -1
  67. package/dist/server.esm.js +1 -8
  68. package/dist/server.esm.js.map +1 -1
  69. package/dist/server.js +0 -8
  70. package/dist/server.js.map +1 -1
  71. package/dist/services/external/index.d.ts +1 -1
  72. package/dist/services/external/xaman.d.ts +31 -11
  73. package/dist/services/external/xaman.test.d.ts +1 -0
  74. package/dist/services/index.d.ts +2 -0
  75. package/dist/services/internal/assetsService.d.ts +1 -10
  76. package/dist/services/internal/encodingService.d.ts +8 -0
  77. package/dist/services/internal/encodingService.test.d.ts +1 -0
  78. package/dist/services/internal/eventService.d.ts +3 -3
  79. package/dist/services/internal/evmService.d.ts +1 -0
  80. package/dist/services/internal/transactionService.d.ts +1 -5
  81. package/dist/{stellarService.client-C-pOt34O.js → stellarService.client-D20h9JPG.js} +2 -2
  82. package/dist/{stellarService.client-C-pOt34O.js.map → stellarService.client-D20h9JPG.js.map} +1 -1
  83. package/dist/{stellarService.client-DBROJ4yf.js → stellarService.client-yWCDuq6S.js} +2 -2
  84. package/dist/{stellarService.client-DBROJ4yf.js.map → stellarService.client-yWCDuq6S.js.map} +1 -1
  85. package/package.json +2 -2
  86. package/dist/core/types/canton.d.ts +0 -2
  87. package/dist/core/types/cosmos.d.ts +0 -5
  88. package/dist/hooks/transaction/useDepositTransactionStatus.d.ts +0 -25
  89. package/dist/hooks/transaction/useSwapStatusQuery.d.ts +0 -26
  90. package/dist/index-D5QOR7JT.js.map +0 -1
  91. package/dist/index-mgE1SeE-.js.map +0 -1
  92. package/dist/services/internal/cantonService.d.ts +0 -2
@@ -3,7 +3,7 @@ import { zeroAddress as zeroAddress$1, parseUnits, formatUnits, isAddress, Switc
3
3
  import React, { useMemo, useCallback, useState, useEffect, createContext, useContext, useRef } from 'react';
4
4
  import { useQuery, useMutation, useQueries, useQueryClient, QueryClient, QueryClientProvider } from '@tanstack/react-query';
5
5
  import { fromBech32 } from '@cosmjs/encoding';
6
- import * as bitcoin from 'bitcoinjs-lib';
6
+ import * as bitcoin$1 from 'bitcoinjs-lib';
7
7
  import { address } from 'bitcoinjs-lib';
8
8
  import * as ecc from '@bitcoinerlab/secp256k1';
9
9
  import axios, { AxiosError } from 'axios';
@@ -57,8 +57,6 @@ const solanaZeroAddress = "11111111111111111111111111111111";
57
57
  const suiZeroAddress = "0x0000000000000000000000000000000000000000";
58
58
  const xrplZeroAddress = "rrrrrrrrrrrrrrrrrrrrrhoLvTp";
59
59
  const stellarZeroAddress = "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF";
60
- // TODO: check
61
- const cantonZeroAddress = "none::12200000000000000000000000000000000000000000000000000000000000000000";
62
60
  const chainTypeToZeroAddressMap = {
63
61
  [ChainType.EVM]: zeroAddress$1,
64
62
  [ChainType.COSMOS]: cosmosZeroAddress,
@@ -67,7 +65,6 @@ const chainTypeToZeroAddressMap = {
67
65
  [ChainType.SUI]: suiZeroAddress,
68
66
  [ChainType.XRPL]: xrplZeroAddress,
69
67
  [ChainType.STELLAR]: stellarZeroAddress,
70
- [ChainType.CANTON]: cantonZeroAddress,
71
68
  };
72
69
  const nativeEvmTokenAddress = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
73
70
  const nativeCosmosTokenAddress = "uosmo";
@@ -76,7 +73,6 @@ const nativeBitcoinTokenAddress = "satoshi";
76
73
  const nativeSuiTokenAddress = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
77
74
  const nativeXrplTokenAddress = "xrp";
78
75
  const nativeStellarTokenAddress = "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA";
79
- const nativeCantonTokenAddress = "DSO::1220b1431ef217342db44d516bb9befde802be7d8899637d290895fa58880f19accc";
80
76
  // by setting slippage to undefined, it's set to "auto"
81
77
  const defaultSlippage = undefined;
82
78
  const destinationAddressResetValue = "null";
@@ -140,7 +136,6 @@ const CHAIN_IDS = {
140
136
  XRPL_TESTNET: "xrpl-testnet",
141
137
  STELLAR: "stellar-mainnet",
142
138
  STELLAR_TESTNET: "stellar-testnet",
143
- CANTON: "canton",
144
139
  };
145
140
  const chainTypeToDefaultChainIdMap = {
146
141
  [ChainType.EVM]: CHAIN_IDS.ETHEREUM,
@@ -150,7 +145,6 @@ const chainTypeToDefaultChainIdMap = {
150
145
  [ChainType.SUI]: CHAIN_IDS.SUI,
151
146
  [ChainType.XRPL]: CHAIN_IDS.XRPL,
152
147
  [ChainType.STELLAR]: CHAIN_IDS.STELLAR,
153
- [ChainType.CANTON]: CHAIN_IDS.CANTON,
154
148
  };
155
149
  const chainTypeToNativeTokenAddressMap = {
156
150
  [ChainType.EVM]: nativeEvmTokenAddress,
@@ -160,12 +154,12 @@ const chainTypeToNativeTokenAddressMap = {
160
154
  [ChainType.SUI]: nativeSuiTokenAddress,
161
155
  [ChainType.XRPL]: nativeXrplTokenAddress,
162
156
  [ChainType.STELLAR]: nativeStellarTokenAddress,
163
- [ChainType.CANTON]: nativeCantonTokenAddress,
164
157
  };
165
158
  const defaultConfigValues = {
166
159
  integratorId: INTEGRATOR_ID,
167
160
  slippage: defaultSlippage,
168
161
  apiUrl: squidApiBaseUrl,
162
+ xamanApiUrl: XAMAN_API_URL,
169
163
  priceImpactWarnings: {
170
164
  warning: 3,
171
165
  critical: 5,
@@ -4193,11 +4187,11 @@ class WidgetEvents extends EventTarget {
4193
4187
  this.dispatch("qrCodeGenerationFailedForSign", data);
4194
4188
  }
4195
4189
  /**
4196
- * Dispatches event after the QR code for signing a transaction is scanned
4197
- * and we're waiting for the user to approve or reject it.
4190
+ * Dispatches event after a QR code is scanned and we're waiting for the user
4191
+ * to approve or reject it.
4198
4192
  */
4199
- dispatchQrTxScannedAwaitingApproval(data) {
4200
- this.dispatch("qrTxScannedAwaitingUserApproval", data);
4193
+ dispatchQrScannedAwaitingApproval(data) {
4194
+ this.dispatch("qrScannedAwaitingUserApproval", data);
4201
4195
  }
4202
4196
  }
4203
4197
 
@@ -4695,6 +4689,193 @@ function extractRpcUrls(parameters) {
4695
4689
  return transports.map(({ value }) => value?.url || fallbackUrl);
4696
4690
  }
4697
4691
 
4692
+ var build = {};
4693
+
4694
+ var currency = {};
4695
+
4696
+ Object.defineProperty(currency, "__esModule", { value: true });
4697
+
4698
+ var bech32 = {};
4699
+
4700
+ Object.defineProperty(bech32, "__esModule", { value: true });
4701
+
4702
+ var bip44 = {};
4703
+
4704
+ Object.defineProperty(bip44, "__esModule", { value: true });
4705
+
4706
+ var chainInfo = {};
4707
+
4708
+ Object.defineProperty(chainInfo, "__esModule", { value: true });
4709
+
4710
+ var wallet = {};
4711
+
4712
+ var keplr = {};
4713
+
4714
+ Object.defineProperty(keplr, "__esModule", { value: true });
4715
+
4716
+ var eip6963 = {};
4717
+
4718
+ (function (exports) {
4719
+ Object.defineProperty(exports, "__esModule", { value: true });
4720
+ exports.EIP6963EventNames = void 0;
4721
+ (function (EIP6963EventNames) {
4722
+ EIP6963EventNames["Announce"] = "eip6963:announceProvider";
4723
+ EIP6963EventNames["Request"] = "eip6963:requestProvider";
4724
+ })(exports.EIP6963EventNames || (exports.EIP6963EventNames = {}));
4725
+
4726
+ } (eip6963));
4727
+
4728
+ var ethereum$1 = {};
4729
+
4730
+ Object.defineProperty(ethereum$1, "__esModule", { value: true });
4731
+
4732
+ var starknet = {};
4733
+
4734
+ Object.defineProperty(starknet, "__esModule", { value: true });
4735
+
4736
+ var bitcoin = {};
4737
+
4738
+ (function (exports) {
4739
+ Object.defineProperty(exports, "__esModule", { value: true });
4740
+ exports.CHAIN_TYPE_TO_GENESIS_HASH = exports.GENESIS_HASH_TO_CHAIN_TYPE = exports.NETWORK_TO_GENESIS_HASH = exports.GENESIS_HASH_TO_NETWORK = exports.ChainType = exports.Network = exports.GenesisHash = exports.BitcoinSignMessageType = void 0;
4741
+ (function (BitcoinSignMessageType) {
4742
+ BitcoinSignMessageType["ECDSA"] = "ecdsa";
4743
+ BitcoinSignMessageType["BIP322_SIMPLE"] = "bip322-simple";
4744
+ })(exports.BitcoinSignMessageType || (exports.BitcoinSignMessageType = {}));
4745
+ var GenesisHash;
4746
+ (function (GenesisHash) {
4747
+ GenesisHash["MAINNET"] = "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f";
4748
+ GenesisHash["TESTNET"] = "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943";
4749
+ GenesisHash["SIGNET"] = "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6";
4750
+ })(GenesisHash = exports.GenesisHash || (exports.GenesisHash = {}));
4751
+ var Network;
4752
+ (function (Network) {
4753
+ Network["MAINNET"] = "mainnet";
4754
+ Network["LIVENET"] = "livenet";
4755
+ Network["TESTNET"] = "testnet";
4756
+ Network["SIGNET"] = "signet";
4757
+ })(Network = exports.Network || (exports.Network = {}));
4758
+ var ChainType;
4759
+ (function (ChainType) {
4760
+ ChainType["BITCOIN_MAINNET"] = "BITCOIN_MAINNET";
4761
+ ChainType["BITCOIN_TESTNET"] = "BITCOIN_TESTNET";
4762
+ ChainType["BITCOIN_SIGNET"] = "BITCOIN_SIGNET";
4763
+ })(ChainType = exports.ChainType || (exports.ChainType = {}));
4764
+ exports.GENESIS_HASH_TO_NETWORK = {
4765
+ [GenesisHash.MAINNET]: Network.MAINNET,
4766
+ [GenesisHash.TESTNET]: Network.TESTNET,
4767
+ [GenesisHash.SIGNET]: Network.SIGNET,
4768
+ };
4769
+ exports.NETWORK_TO_GENESIS_HASH = {
4770
+ [Network.MAINNET]: GenesisHash.MAINNET,
4771
+ [Network.LIVENET]: GenesisHash.MAINNET,
4772
+ [Network.TESTNET]: GenesisHash.TESTNET,
4773
+ [Network.SIGNET]: GenesisHash.SIGNET,
4774
+ };
4775
+ exports.GENESIS_HASH_TO_CHAIN_TYPE = {
4776
+ [GenesisHash.MAINNET]: ChainType.BITCOIN_MAINNET,
4777
+ [GenesisHash.TESTNET]: ChainType.BITCOIN_TESTNET,
4778
+ [GenesisHash.SIGNET]: ChainType.BITCOIN_SIGNET,
4779
+ };
4780
+ exports.CHAIN_TYPE_TO_GENESIS_HASH = {
4781
+ [ChainType.BITCOIN_MAINNET]: GenesisHash.MAINNET,
4782
+ [ChainType.BITCOIN_TESTNET]: GenesisHash.TESTNET,
4783
+ [ChainType.BITCOIN_SIGNET]: GenesisHash.SIGNET,
4784
+ };
4785
+
4786
+ } (bitcoin));
4787
+
4788
+ (function (exports) {
4789
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4790
+ if (k2 === undefined) k2 = k;
4791
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4792
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4793
+ desc = { enumerable: true, get: function() { return m[k]; } };
4794
+ }
4795
+ Object.defineProperty(o, k2, desc);
4796
+ }) : (function(o, m, k, k2) {
4797
+ if (k2 === undefined) k2 = k;
4798
+ o[k2] = m[k];
4799
+ }));
4800
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4801
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4802
+ };
4803
+ Object.defineProperty(exports, "__esModule", { value: true });
4804
+ __exportStar(keplr, exports);
4805
+ __exportStar(eip6963, exports);
4806
+ __exportStar(ethereum$1, exports);
4807
+ __exportStar(starknet, exports);
4808
+ __exportStar(bitcoin, exports);
4809
+
4810
+ } (wallet));
4811
+
4812
+ var window$1 = {};
4813
+
4814
+ Object.defineProperty(window$1, "__esModule", { value: true });
4815
+
4816
+ var ethereum = {};
4817
+
4818
+ (function (exports) {
4819
+ Object.defineProperty(exports, "__esModule", { value: true });
4820
+ exports.EthTxStatus = exports.EthSignType = void 0;
4821
+ (function (EthSignType) {
4822
+ EthSignType["MESSAGE"] = "message";
4823
+ EthSignType["TRANSACTION"] = "transaction";
4824
+ EthSignType["EIP712"] = "eip-712";
4825
+ })(exports.EthSignType || (exports.EthSignType = {}));
4826
+ (function (EthTxStatus) {
4827
+ EthTxStatus["Success"] = "0x1";
4828
+ EthTxStatus["Failure"] = "0x0";
4829
+ })(exports.EthTxStatus || (exports.EthTxStatus = {}));
4830
+
4831
+ } (ethereum));
4832
+
4833
+ var cosmjs = {};
4834
+
4835
+ Object.defineProperty(cosmjs, "__esModule", { value: true });
4836
+
4837
+ var cosmjsAlt = {};
4838
+
4839
+ Object.defineProperty(cosmjsAlt, "__esModule", { value: true });
4840
+
4841
+ var secretjs = {};
4842
+
4843
+ Object.defineProperty(secretjs, "__esModule", { value: true });
4844
+
4845
+ var settled = {};
4846
+
4847
+ Object.defineProperty(settled, "__esModule", { value: true });
4848
+
4849
+ (function (exports) {
4850
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4851
+ if (k2 === undefined) k2 = k;
4852
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4853
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
4854
+ desc = { enumerable: true, get: function() { return m[k]; } };
4855
+ }
4856
+ Object.defineProperty(o, k2, desc);
4857
+ }) : (function(o, m, k, k2) {
4858
+ if (k2 === undefined) k2 = k;
4859
+ o[k2] = m[k];
4860
+ }));
4861
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
4862
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4863
+ };
4864
+ Object.defineProperty(exports, "__esModule", { value: true });
4865
+ __exportStar(currency, exports);
4866
+ __exportStar(bech32, exports);
4867
+ __exportStar(bip44, exports);
4868
+ __exportStar(chainInfo, exports);
4869
+ __exportStar(wallet, exports);
4870
+ __exportStar(window$1, exports);
4871
+ __exportStar(ethereum, exports);
4872
+ __exportStar(cosmjs, exports);
4873
+ __exportStar(cosmjsAlt, exports);
4874
+ __exportStar(secretjs, exports);
4875
+ __exportStar(settled, exports);
4876
+
4877
+ } (build));
4878
+
4698
4879
  class BitcoinConnectorError extends Error {
4699
4880
  constructor(message) {
4700
4881
  super(message);
@@ -4742,10 +4923,13 @@ class KeplrConnector {
4742
4923
  address: account,
4743
4924
  };
4744
4925
  }
4926
+ async signMessage(message) {
4927
+ return this.getProvider.signMessage(message, build.BitcoinSignMessageType.BIP322_SIMPLE);
4928
+ }
4745
4929
  }
4746
4930
 
4747
- bitcoin.initEccLib(ecc);
4748
- const network = bitcoin.networks.bitcoin;
4931
+ bitcoin$1.initEccLib(ecc);
4932
+ const network = bitcoin$1.networks.bitcoin;
4749
4933
  const fromHexString = (hexString) => {
4750
4934
  const matches = hexString.match(/.{1,2}/g);
4751
4935
  if (!matches) {
@@ -4780,11 +4964,11 @@ async function createSendBtcPsbt(senderAddress, recipientAddress, amount) {
4780
4964
  const transactionSize = inputs.length * 150 + outputsCount * 34 + 10;
4781
4965
  const fee = feeRate * transactionSize;
4782
4966
  const satsNeeded = fee + amount;
4783
- const psbt = new bitcoin.Psbt({ network });
4967
+ const psbt = new bitcoin$1.Psbt({ network });
4784
4968
  let amountGathered = 0;
4785
4969
  for (const utxo of sortedUtxos) {
4786
4970
  const { txid, vout, value } = utxo;
4787
- const script = bitcoin.address.toOutputScript(senderAddress, network);
4971
+ const script = bitcoin$1.address.toOutputScript(senderAddress, network);
4788
4972
  psbt.addInput({
4789
4973
  hash: txid,
4790
4974
  index: vout,
@@ -4832,7 +5016,7 @@ async function getTransactionStatus$1(txHash) {
4832
5016
  .then((response) => response.data);
4833
5017
  }
4834
5018
 
4835
- const MAINNET = bitcoin.networks.bitcoin;
5019
+ const MAINNET = bitcoin$1.networks.bitcoin;
4836
5020
  class PhantomConnector {
4837
5021
  get getProvider() {
4838
5022
  const provider = window?.phantom?.bitcoin;
@@ -4863,7 +5047,7 @@ class PhantomConnector {
4863
5047
  }
4864
5048
  async signPsbt(psbtHex) {
4865
5049
  const { address: paymentAddress } = await this.requestAccount();
4866
- const toSignPsbt = bitcoin.Psbt.fromHex(String(psbtHex), {
5050
+ const toSignPsbt = bitcoin$1.Psbt.fromHex(String(psbtHex), {
4867
5051
  network: MAINNET,
4868
5052
  });
4869
5053
  const inputs = toSignPsbt.data.inputs;
@@ -4877,7 +5061,7 @@ class PhantomConnector {
4877
5061
  const signedPsbtBytes = await this.getProvider.signPSBT(fromHexString(psbtHex), {
4878
5062
  inputsToSign,
4879
5063
  });
4880
- const signedPsbt = bitcoin.Psbt.fromBuffer(signedPsbtBytes);
5064
+ const signedPsbt = bitcoin$1.Psbt.fromBuffer(signedPsbtBytes);
4881
5065
  signedPsbt.finalizeAllInputs();
4882
5066
  const tx = signedPsbt.extractTransaction();
4883
5067
  const txId = await broadcastTx(tx.toHex());
@@ -4885,6 +5069,7 @@ class PhantomConnector {
4885
5069
  }
4886
5070
  }
4887
5071
 
5072
+ const UNISAT_BIP322_SIMPLE_SIGNATURE_TYPE = "bip322-simple";
4888
5073
  class UnisatConnector {
4889
5074
  get getProvider() {
4890
5075
  const provider = window?.unisat;
@@ -4910,8 +5095,220 @@ class UnisatConnector {
4910
5095
  address: account,
4911
5096
  };
4912
5097
  }
5098
+ async signMessage(message) {
5099
+ const signMessage = this.getProvider.signMessage;
5100
+ if (typeof signMessage !== "function") {
5101
+ throw new Error("Unisat does not expose Bitcoin message signing.");
5102
+ }
5103
+ return signMessage(message, UNISAT_BIP322_SIMPLE_SIGNATURE_TYPE);
5104
+ }
4913
5105
  }
4914
5106
 
5107
+ function encodeUtf8(value) {
5108
+ return new TextEncoder().encode(value);
5109
+ }
5110
+ function bytesToBase64(bytes) {
5111
+ if (typeof Buffer !== "undefined") {
5112
+ return Buffer.from(Uint8Array.from(bytes)).toString("base64");
5113
+ }
5114
+ let binary = "";
5115
+ for (let index = 0; index < bytes.length; index += 1) {
5116
+ binary += String.fromCharCode(bytes[index]);
5117
+ }
5118
+ return btoa(binary);
5119
+ }
5120
+ function isBase64(value) {
5121
+ const trimmedValue = value.trim();
5122
+ if (!trimmedValue) {
5123
+ return false;
5124
+ }
5125
+ try {
5126
+ if (typeof Buffer !== "undefined") {
5127
+ return (Buffer.from(trimmedValue, "base64")
5128
+ .toString("base64")
5129
+ .replace(/=+$/, "") === trimmedValue.replace(/=+$/, ""));
5130
+ }
5131
+ return (btoa(atob(trimmedValue)).replace(/=+$/, "") ===
5132
+ trimmedValue.replace(/=+$/, ""));
5133
+ }
5134
+ catch {
5135
+ return false;
5136
+ }
5137
+ }
5138
+ function base64StringOrBytes(value) {
5139
+ if (typeof value === "string") {
5140
+ return isBase64(value) ? value : bytesToBase64(encodeUtf8(value));
5141
+ }
5142
+ return bytesToBase64(value);
5143
+ }
5144
+ function normalizeBase64Ed25519Signature(signature) {
5145
+ if (!isBase64(signature) || typeof Buffer === "undefined") {
5146
+ return signature;
5147
+ }
5148
+ const decoded = Buffer.from(signature, "base64");
5149
+ if (decoded.length === 64) {
5150
+ return signature;
5151
+ }
5152
+ const nestedSignature = decoded.toString("utf8");
5153
+ return isBase64(nestedSignature) &&
5154
+ Buffer.from(nestedSignature, "base64").length === 64
5155
+ ? nestedSignature
5156
+ : signature;
5157
+ }
5158
+ function stringToUtf8Hex(value, { uppercase = false } = {}) {
5159
+ const hex = Array.from(encodeUtf8(value), (byte) => byte.toString(16).padStart(2, "0")).join("");
5160
+ return uppercase ? hex.toUpperCase() : hex;
5161
+ }
5162
+
5163
+ var WalletVerificationSignatureType;
5164
+ (function (WalletVerificationSignatureType) {
5165
+ WalletVerificationSignatureType["EVM"] = "eip191";
5166
+ WalletVerificationSignatureType["COSMOS"] = "cosmos-adr36";
5167
+ WalletVerificationSignatureType["BITCOIN"] = "bitcoin-bip322-simple";
5168
+ WalletVerificationSignatureType["SOLANA"] = "solana-ed25519";
5169
+ WalletVerificationSignatureType["SUI"] = "sui-personal-message";
5170
+ WalletVerificationSignatureType["XRPL"] = "xrpl-signin";
5171
+ WalletVerificationSignatureType["XAMAN"] = "xaman-signin";
5172
+ WalletVerificationSignatureType["STELLAR"] = "stellar-sep53";
5173
+ })(WalletVerificationSignatureType || (WalletVerificationSignatureType = {}));
5174
+ const WALLET_VERIFICATION_SIGNATURE_TYPE_BY_CHAIN_TYPE = {
5175
+ [ChainType.EVM]: WalletVerificationSignatureType.EVM,
5176
+ [ChainType.COSMOS]: WalletVerificationSignatureType.COSMOS,
5177
+ [ChainType.BTC]: WalletVerificationSignatureType.BITCOIN,
5178
+ [ChainType.SOLANA]: WalletVerificationSignatureType.SOLANA,
5179
+ [ChainType.SUI]: WalletVerificationSignatureType.SUI,
5180
+ [ChainType.XRPL]: WalletVerificationSignatureType.XRPL,
5181
+ [ChainType.STELLAR]: WalletVerificationSignatureType.STELLAR,
5182
+ };
5183
+
5184
+ function buildSignatureOnlyWalletVerificationSignatureResult({ chainType, signatureType, address, message, signature, }) {
5185
+ return {
5186
+ chainType,
5187
+ address,
5188
+ message,
5189
+ signedPayload: message,
5190
+ signature,
5191
+ signatureType,
5192
+ metadata: {},
5193
+ };
5194
+ }
5195
+ function buildSignedPayloadWalletVerificationSignatureResult({ chainType, signatureType, address, message, signedPayload, signature, publicKey, publicKeyEncoding, signedPayloadEncoding, signerAddress, }) {
5196
+ return {
5197
+ chainType,
5198
+ address,
5199
+ message,
5200
+ signedPayload,
5201
+ signature,
5202
+ signatureType,
5203
+ metadata: {
5204
+ signedPayloadEncoding,
5205
+ ...(publicKey ? { publicKey } : {}),
5206
+ ...(publicKeyEncoding ? { publicKeyEncoding } : {}),
5207
+ ...(signerAddress ? { signerAddress } : {}),
5208
+ },
5209
+ };
5210
+ }
5211
+
5212
+ const buildBitcoinWalletVerificationSignatureResult = (params) => buildSignedPayloadWalletVerificationSignatureResult({
5213
+ ...params,
5214
+ chainType: ChainType.BTC,
5215
+ signatureType: WalletVerificationSignatureType.BITCOIN,
5216
+ });
5217
+
5218
+ const buildCosmosWalletVerificationSignatureResult = (params) => buildSignedPayloadWalletVerificationSignatureResult({
5219
+ ...params,
5220
+ chainType: ChainType.COSMOS,
5221
+ signatureType: WalletVerificationSignatureType.COSMOS,
5222
+ });
5223
+
5224
+ const buildWalletVerificationSignatureResult = ({ address, message, signature, }) => buildSignatureOnlyWalletVerificationSignatureResult({
5225
+ chainType: ChainType.EVM,
5226
+ signatureType: WalletVerificationSignatureType.EVM,
5227
+ address,
5228
+ message,
5229
+ signature,
5230
+ });
5231
+
5232
+ var WalletVerificationSignatureErrorCode;
5233
+ (function (WalletVerificationSignatureErrorCode) {
5234
+ WalletVerificationSignatureErrorCode["INVALID_MESSAGE"] = "INVALID_MESSAGE";
5235
+ WalletVerificationSignatureErrorCode["UNSUPPORTED_CHAIN_TYPE"] = "UNSUPPORTED_CHAIN_TYPE";
5236
+ WalletVerificationSignatureErrorCode["WALLET_NOT_CONNECTED"] = "WALLET_NOT_CONNECTED";
5237
+ WalletVerificationSignatureErrorCode["SIGNER_UNAVAILABLE"] = "SIGNER_UNAVAILABLE";
5238
+ WalletVerificationSignatureErrorCode["ACTIVE_ACCOUNT_MISMATCH"] = "ACTIVE_ACCOUNT_MISMATCH";
5239
+ WalletVerificationSignatureErrorCode["SIGNATURE_REJECTED"] = "SIGNATURE_REJECTED";
5240
+ })(WalletVerificationSignatureErrorCode || (WalletVerificationSignatureErrorCode = {}));
5241
+ class WalletVerificationSignatureError extends Error {
5242
+ code;
5243
+ chainType;
5244
+ cause;
5245
+ constructor({ code, message, chainType, cause, }) {
5246
+ super(message);
5247
+ this.name = "WalletVerificationSignatureError";
5248
+ this.code = code;
5249
+ this.chainType = chainType;
5250
+ this.cause = cause;
5251
+ }
5252
+ }
5253
+
5254
+ const assertWalletVerificationSigningRequest = ({ message, chainType, }) => {
5255
+ if (message.trim().length === 0) {
5256
+ throw new WalletVerificationSignatureError({
5257
+ code: WalletVerificationSignatureErrorCode.INVALID_MESSAGE,
5258
+ chainType,
5259
+ message: "Invalid wallet verification message.",
5260
+ });
5261
+ }
5262
+ };
5263
+ const assertEvmVerificationSigningRequest = ({ message, chainType, }) => {
5264
+ if (chainType !== ChainType.EVM) {
5265
+ throw new WalletVerificationSignatureError({
5266
+ code: WalletVerificationSignatureErrorCode.UNSUPPORTED_CHAIN_TYPE,
5267
+ chainType,
5268
+ message: "Unsupported EVM wallet verification chain type.",
5269
+ });
5270
+ }
5271
+ assertWalletVerificationSigningRequest({ message, chainType });
5272
+ };
5273
+
5274
+ const buildSolanaWalletVerificationSignatureResult = ({ address, message, signedPayload, signature, publicKey, publicKeyEncoding, signedPayloadEncoding, }) => buildSignedPayloadWalletVerificationSignatureResult({
5275
+ chainType: ChainType.SOLANA,
5276
+ signatureType: WalletVerificationSignatureType.SOLANA,
5277
+ address,
5278
+ message,
5279
+ signedPayload,
5280
+ signature,
5281
+ publicKey,
5282
+ publicKeyEncoding,
5283
+ signedPayloadEncoding,
5284
+ });
5285
+
5286
+ const buildStellarWalletVerificationSignatureResult = (params) => buildSignedPayloadWalletVerificationSignatureResult({
5287
+ ...params,
5288
+ chainType: ChainType.STELLAR,
5289
+ signatureType: WalletVerificationSignatureType.STELLAR,
5290
+ });
5291
+
5292
+ const buildSuiWalletVerificationSignatureResult = ({ address, message, signedPayload, signature, publicKey, publicKeyEncoding, signedPayloadEncoding, }) => buildSignedPayloadWalletVerificationSignatureResult({
5293
+ chainType: ChainType.SUI,
5294
+ signatureType: WalletVerificationSignatureType.SUI,
5295
+ address,
5296
+ message,
5297
+ signedPayload,
5298
+ signature,
5299
+ publicKey,
5300
+ publicKeyEncoding,
5301
+ signedPayloadEncoding,
5302
+ });
5303
+
5304
+ const buildXrplWalletVerificationSignatureResult = (params) => {
5305
+ return buildSignedPayloadWalletVerificationSignatureResult({
5306
+ ...params,
5307
+ chainType: ChainType.XRPL,
5308
+ signatureType: params.signatureType,
5309
+ });
5310
+ };
5311
+
4915
5312
  var XrplTransactionType;
4916
5313
  (function (XrplTransactionType) {
4917
5314
  XrplTransactionType["PAYMENT"] = "Payment";
@@ -4958,6 +5355,14 @@ var XRPL_METHOD;
4958
5355
  XRPL_METHOD["SIGN_TRANSACTION"] = "xrpl_signTransaction";
4959
5356
  })(XRPL_METHOD || (XRPL_METHOD = {}));
4960
5357
 
5358
+ function createXrplActiveAccountMismatchError(walletName) {
5359
+ return new WalletVerificationSignatureError({
5360
+ code: WalletVerificationSignatureErrorCode.ACTIVE_ACCOUNT_MISMATCH,
5361
+ chainType: ChainType.XRPL,
5362
+ message: `${walletName} signed with a different active account. Reconnect the XRPL wallet and try again.`,
5363
+ });
5364
+ }
5365
+
4961
5366
  var NetworkLabel;
4962
5367
  (function (NetworkLabel) {
4963
5368
  NetworkLabel["XAHAU"] = "xahau";
@@ -5010,6 +5415,38 @@ class CrossmarkConnector {
5010
5415
  status: data.resp.result.meta.TransactionResult,
5011
5416
  };
5012
5417
  }
5418
+ async signOwnershipMessage({ address, message, }) {
5419
+ const provider = this.getProvider();
5420
+ if (!provider) {
5421
+ throw new Error("Crossmark provider not found");
5422
+ }
5423
+ const signedPayload = stringToUtf8Hex(message);
5424
+ const result = await provider.async.signInAndWait(signedPayload);
5425
+ const proof = result?.response.data;
5426
+ if (!proof) {
5427
+ throw new Error("Invalid Crossmark sign-in response");
5428
+ }
5429
+ if (proof.meta?.isRejected) {
5430
+ throw new Error("User rejected the request.");
5431
+ }
5432
+ if (proof.meta?.isError) {
5433
+ throw new Error(proof.errorMessage || "Error signing message");
5434
+ }
5435
+ if (proof.address.trim() !== address) {
5436
+ throw createXrplActiveAccountMismatchError("Crossmark");
5437
+ }
5438
+ if (!proof.publicKey || !proof.signature) {
5439
+ throw new Error("Invalid Crossmark sign-in response");
5440
+ }
5441
+ return {
5442
+ signedPayload,
5443
+ signedPayloadEncoding: "utf8-hex",
5444
+ signature: proof.signature,
5445
+ publicKey: proof.publicKey,
5446
+ publicKeyEncoding: "hex",
5447
+ signatureType: WalletVerificationSignatureType.XRPL,
5448
+ };
5449
+ }
5013
5450
  getActiveNetwork() {
5014
5451
  const provider = this.getProvider();
5015
5452
  if (!provider) {
@@ -20388,6 +20825,34 @@ class XrplMetamaskSnapConnector {
20388
20825
  status: txStatus,
20389
20826
  };
20390
20827
  }
20828
+ async signOwnershipMessage({ address, message, }) {
20829
+ await this.initialize();
20830
+ if (!this.provider)
20831
+ throw new Error("Provider not initialized");
20832
+ await this.requestSnap(snapId);
20833
+ const account = await this.getAccount();
20834
+ if (account.account !== address) {
20835
+ throw createXrplActiveAccountMismatchError("XRPL Snap");
20836
+ }
20837
+ const signedPayload = stringToUtf8Hex(message);
20838
+ const response = await this.invokeSnap({
20839
+ method: "xrpl_signMessage",
20840
+ params: {
20841
+ message: signedPayload,
20842
+ },
20843
+ });
20844
+ if (!account.publicKey || !response.signature) {
20845
+ throw new Error("Invalid XRPL Snap sign-message response");
20846
+ }
20847
+ return {
20848
+ signedPayload,
20849
+ signedPayloadEncoding: "utf8-hex",
20850
+ signature: response.signature,
20851
+ publicKey: account.publicKey,
20852
+ publicKeyEncoding: "hex",
20853
+ signatureType: WalletVerificationSignatureType.XRPL,
20854
+ };
20855
+ }
20391
20856
  // Cannot use constructor because of the async initialization
20392
20857
  async initialize() {
20393
20858
  this.provider = await this.getProvider();
@@ -20858,18 +21323,6 @@ const isBitcoinAddressValid = (address$1) => {
20858
21323
  }
20859
21324
  };
20860
21325
 
20861
- // Canton PartyID = address
20862
- const CANTON_PARTY_ID_SEPARATOR = "::";
20863
- function isCantonAddressValid(address) {
20864
- // Canton address format: `name::fingerprint`, where name is an arbitrary string
20865
- // and fingerprint is a 64-character hex string with a 1220 prefix (SHA-256 hash of the public key)
20866
- const parts = address.split(CANTON_PARTY_ID_SEPARATOR);
20867
- if (parts.length !== 2)
20868
- return false;
20869
- const [name, fingerprint] = parts;
20870
- return name.length > 0 && /^1220[0-9a-f]{64}$/.test(fingerprint);
20871
- }
20872
-
20873
21326
  var HistoryTxType;
20874
21327
  (function (HistoryTxType) {
20875
21328
  HistoryTxType[HistoryTxType["SWAP"] = 0] = "SWAP";
@@ -20983,7 +21436,6 @@ const getSourceExplorerTxUrl = (chain, txID) => {
20983
21436
  case CHAIN_IDS.AGORIC:
20984
21437
  case CHAIN_IDS.XRPL:
20985
21438
  case CHAIN_IDS.XRPL_TESTNET:
20986
- case CHAIN_IDS.CANTON:
20987
21439
  txSuffix = "/transactions/";
20988
21440
  break;
20989
21441
  case CHAIN_IDS.HEDERA:
@@ -21093,16 +21545,10 @@ const simplifyRouteAction = (action) => {
21093
21545
  };
21094
21546
  const fetchSwapTransactionStatus = async ({ transaction, integratorId, apiUrl, }) => {
21095
21547
  const statusEndpoint = `${apiUrl}/v2/status`;
21096
- const isCanton = transaction?.fromChain === CHAIN_IDS.CANTON;
21097
- // For Canton, the backend handles all tx detection/submission from the quoteId
21098
- // alone, so no transactionId is sent — only the quoteId param below.
21099
- const transactionId = isCanton
21100
- ? undefined
21101
- : transaction?.transactionIdForStatus ?? transaction?.transactionId;
21102
21548
  try {
21103
21549
  const response = await axios.get(statusEndpoint, {
21104
21550
  params: {
21105
- transactionId,
21551
+ transactionId: transaction?.transactionIdForStatus ?? transaction?.transactionId,
21106
21552
  fromChainId: transaction?.fromChain,
21107
21553
  toChainId: transaction?.toChain,
21108
21554
  bridgeType: transaction?.bridgeType,
@@ -21149,7 +21595,7 @@ function isActionCompletedOnSourceTx(action, fromChainId) {
21149
21595
  function sleep(ms) {
21150
21596
  return new Promise((resolve) => setTimeout(resolve, ms));
21151
21597
  }
21152
- const isChainflipDepositRoute = (route) => {
21598
+ const isDepositRoute = (route) => {
21153
21599
  return (!!route &&
21154
21600
  route.transactionRequest?.type === SquidDataType.ChainflipDepositAddress);
21155
21601
  };
@@ -21174,12 +21620,6 @@ function isOnChainTxData(squidData) {
21174
21620
  SquidDataType.DepositAddressWithMemo,
21175
21621
  ].includes(squidData.type);
21176
21622
  }
21177
- /**
21178
- * Checks if a route is of type DepositAddressDirectTransfer
21179
- */
21180
- function isDepositAddressDirectTransferRoute(squidData) {
21181
- return (squidData.type === SquidDataType.DepositAddressDirectTransfer);
21182
- }
21183
21623
  function getHistoryTransactionId(tx) {
21184
21624
  switch (tx.txType) {
21185
21625
  case HistoryTxType.SWAP:
@@ -21318,6 +21758,93 @@ const standardWalletOverrides = {
21318
21758
  }),
21319
21759
  };
21320
21760
 
21761
+ const EvmNetworkNotSupportedErrorCode = 4902;
21762
+ async function addEthereumChain({ chain, provider, }) {
21763
+ const chainName = chain.rpc.includes("tenderly")
21764
+ ? `${chain.networkName} Tenderly fork`
21765
+ : chain.networkName;
21766
+ const chainParameters = {
21767
+ chainId: `0x${parseInt(chain.chainId, 10).toString(16)}`,
21768
+ chainName,
21769
+ nativeCurrency: chain.nativeCurrency,
21770
+ rpcUrls: [chain.rpc],
21771
+ blockExplorerUrls: chain.blockExplorerUrls,
21772
+ iconUrls: [chain.chainIconURI],
21773
+ };
21774
+ try {
21775
+ return provider.request({
21776
+ method: "wallet_addEthereumChain",
21777
+ params: [chainParameters],
21778
+ });
21779
+ }
21780
+ catch (error) {
21781
+ console.debug("Error adding chain:", error);
21782
+ }
21783
+ }
21784
+ const parseEvmAddress = (address) => {
21785
+ if (address && isEvmAddressValid(address)) {
21786
+ return address;
21787
+ }
21788
+ };
21789
+ function isEvmAddressValid(address) {
21790
+ return isAddress(address);
21791
+ }
21792
+ /**
21793
+ * Formats a Wagmi connector into a Squid Wallet
21794
+ */
21795
+ function formatEvmWallet(connector) {
21796
+ const { icon, name: defaultName, id: wagmiConnectorId } = connector;
21797
+ const walletOverrides = standardWalletOverrides[wagmiConnectorId];
21798
+ const walletIcon = walletOverrides?.icon || icon;
21799
+ const name = walletOverrides?.name || defaultName;
21800
+ const connectorId = walletOverrides?.connectorId || wagmiConnectorId;
21801
+ const isNonInstallableWallet = [
21802
+ "injected",
21803
+ "walletConnect",
21804
+ "metaMaskSDK",
21805
+ "coinbaseWalletSDK",
21806
+ ].includes(wagmiConnectorId);
21807
+ return {
21808
+ connectorId,
21809
+ name,
21810
+ connectorName: name,
21811
+ type: ChainType.EVM,
21812
+ icon: walletIcon,
21813
+ rdns: wagmiConnectorId,
21814
+ windowFlag: name,
21815
+ // For non-installable wallets, we don't want to show the "Installed" label
21816
+ // but still want to allow the user to connect
21817
+ skipInstallCheck: isNonInstallableWallet,
21818
+ isInstalled: isNonInstallableWallet ? undefined : () => true,
21819
+ connector,
21820
+ isMobile: true,
21821
+ };
21822
+ }
21823
+ function filterWagmiConnector(connector) {
21824
+ // Safe is auto-connected when available, should not be listed as an available wallet
21825
+ return connector.id !== "safe";
21826
+ }
21827
+ /**
21828
+ * Waits for a transaction receipt, handling retries if indexing is in progress
21829
+ */
21830
+ async function waitForReceiptWithRetry(txResponse, retries = 5, delayMs = 2000) {
21831
+ let lastError;
21832
+ for (let i = 0; i < retries; i++) {
21833
+ try {
21834
+ return await txResponse.wait();
21835
+ }
21836
+ catch (error) {
21837
+ lastError = error;
21838
+ if (error?.message?.match(/transaction indexing is in progress/i)) {
21839
+ await sleep(delayMs);
21840
+ continue;
21841
+ }
21842
+ throw error;
21843
+ }
21844
+ }
21845
+ throw lastError;
21846
+ }
21847
+
21321
21848
  const SOLANA_FEATURES = ["solana:signTransaction"];
21322
21849
  /**
21323
21850
  * Validates that a given standard wallet has all the required features for a Solana wallet
@@ -21619,6 +22146,7 @@ function formatSuiWallet(wallet) {
21619
22146
  skipInstallCheck: isSlushWebWallet,
21620
22147
  connector: {
21621
22148
  signTransaction: features["sui:signTransaction"].signTransaction,
22149
+ signPersonalMessage: features["sui:signPersonalMessage"]?.signPersonalMessage,
21622
22150
  connect: async (params) => {
21623
22151
  const { accounts } = await features["standard:connect"].connect(params);
21624
22152
  if (!accounts.length) {
@@ -21682,17 +22210,7 @@ const chainTypeToTrimLength = {
21682
22210
  start: 4,
21683
22211
  end: 4,
21684
22212
  },
21685
- // abc...123::abc...123
21686
- [ChainType.CANTON]: {
21687
- start: 3,
21688
- end: 3,
21689
- },
21690
22213
  };
21691
- const truncateWithEllipsis = (value, startLength, endLength) => value.length <= startLength + endLength
21692
- ? value
21693
- : value.slice(0, startLength) +
21694
- "..." +
21695
- value.slice(value.length - endLength);
21696
22214
  const formatHash = ({ chainType, hash }) => {
21697
22215
  if (!hash)
21698
22216
  return "";
@@ -21705,22 +22223,21 @@ const formatHash = ({ chainType, hash }) => {
21705
22223
  chainTypeFormat = ChainType.COSMOS;
21706
22224
  }
21707
22225
  }
21708
- const { start, end } = chainTypeToTrimLength[chainTypeFormat];
21709
- if (chainTypeFormat === ChainType.CANTON &&
21710
- hash.includes(CANTON_PARTY_ID_SEPARATOR)) {
21711
- const [namespace, identifier] = hash.split(CANTON_PARTY_ID_SEPARATOR);
21712
- return (truncateWithEllipsis(namespace, start, end) +
21713
- CANTON_PARTY_ID_SEPARATOR +
21714
- truncateWithEllipsis(identifier, start, end));
21715
- }
21716
- return truncateWithEllipsis(hash, start, end);
22226
+ const trimLengthStart = chainTypeToTrimLength[chainTypeFormat].start;
22227
+ const trimLengthEnd = chainTypeToTrimLength[chainTypeFormat].end;
22228
+ // return the same hash if its length is less than the trim length
22229
+ if (hash.length <= trimLengthStart + trimLengthEnd)
22230
+ return hash;
22231
+ return (hash.slice(0, trimLengthStart) +
22232
+ "..." +
22233
+ hash.slice(hash.length - trimLengthEnd, hash.length));
21717
22234
  };
21718
22235
  const isWalletAddressValid = (chainData, address) => {
21719
22236
  if (!address || !chainData?.chainType)
21720
22237
  return false;
21721
22238
  switch (chainData.chainType) {
21722
22239
  case ChainType.EVM:
21723
- return isAddress(address);
22240
+ return isEvmAddressValid(address);
21724
22241
  case ChainType.COSMOS:
21725
22242
  return isCosmosAddressValid(chainData.bech32Config.bech32PrefixAccAddr, address);
21726
22243
  case ChainType.BTC:
@@ -21733,8 +22250,6 @@ const isWalletAddressValid = (chainData, address) => {
21733
22250
  return isXrplAddressValid(address);
21734
22251
  case ChainType.STELLAR:
21735
22252
  return isStellarAddressValid(address);
21736
- case ChainType.CANTON:
21737
- return isCantonAddressValid(address);
21738
22253
  }
21739
22254
  };
21740
22255
  const redirectToExtensionsStore = (wallet) => {
@@ -21996,8 +22511,6 @@ const connectByChainType = async (chainType, wallet, defaultChain, params) => {
21996
22511
  connector,
21997
22512
  },
21998
22513
  });
21999
- case ChainType.CANTON:
22000
- return null;
22001
22514
  }
22002
22515
  };
22003
22516
  const getChainTypesToConnect = (selectedChainTypes, defaultChain, supportedChains) => {
@@ -22275,6 +22788,17 @@ class EnsService {
22275
22788
  }
22276
22789
  }
22277
22790
 
22791
+ const XAMAN_OWNERSHIP_CHALLENGE_MEMO_TYPE = "squid-history-challenge";
22792
+ function getXamanNetwork(network) {
22793
+ switch (network) {
22794
+ case XrplNetwork.MAINNET:
22795
+ return XamanXrplNetwork.MAINNET;
22796
+ case XrplNetwork.TESTNET:
22797
+ return XamanXrplNetwork.TESTNET;
22798
+ default:
22799
+ throw new Error(`Network ${network} is not supported`);
22800
+ }
22801
+ }
22278
22802
  /**
22279
22803
  * Client to interact with the Xaman backend through a Squid proxy.
22280
22804
  * Retrieves the QR code data for the following methods:
@@ -22283,38 +22807,54 @@ class EnsService {
22283
22807
  * - send tx
22284
22808
  */
22285
22809
  class XamanClient {
22286
- static baseUrl = XAMAN_API_URL;
22287
- static async signIn(signal) {
22810
+ static defaultBaseUrl = XAMAN_API_URL;
22811
+ baseUrl;
22812
+ constructor({ baseUrl = XAMAN_API_URL } = {}) {
22813
+ this.baseUrl = baseUrl;
22814
+ }
22815
+ async signIn(signal) {
22288
22816
  return this.fetch("sign-in", undefined, signal);
22289
22817
  }
22290
- static async userSession(payload, signal) {
22818
+ async userSession(payload, signal) {
22291
22819
  return this.fetch("user-session", { payload }, signal);
22292
22820
  }
22293
- static async sendTx({ tx, signal, network, }) {
22294
- const xamanNetwork = this.getXamanNetwork(network);
22821
+ /**
22822
+ * Requests a Xaman SignIn payload for wallet ownership verification.
22823
+ *
22824
+ * Expected proxy endpoint: POST /xaman/sign-ownership-message with
22825
+ * `{ message }`, returning the same QR/deeplink/websocket shape as sign-in.
22826
+ * The backend should create a SignIn payload whose signed Memo contains:
22827
+ * - MemoType: UTF-8 hex for the Xaman ownership challenge memo
22828
+ * - MemoData: UTF-8 hex for the challenge message
22829
+ */
22830
+ async signOwnershipMessage(message, signal) {
22831
+ return this.fetch("sign-ownership-message", { message }, signal);
22832
+ }
22833
+ async sendTx({ tx, signal, network, }) {
22834
+ const xamanNetwork = getXamanNetwork(network);
22295
22835
  return this.fetch("send-tx", { tx, network: xamanNetwork }, signal);
22296
22836
  }
22297
- static async fetch(endpoint, body, signal) {
22298
- const url = new URL(endpoint, this.baseUrl);
22837
+ async fetch(endpoint, body, signal) {
22838
+ const url = this.createUrl(endpoint);
22299
22839
  const res = await fetch(url.toString(), {
22300
22840
  method: "POST",
22841
+ headers: {
22842
+ "Content-Type": "application/json",
22843
+ },
22301
22844
  body: body != null ? JSON.stringify(body) : undefined,
22302
22845
  signal,
22303
22846
  });
22304
22847
  if (!res.ok) {
22305
- throw new Error(`Request failed with status ${res.status}`);
22848
+ const errorBody = await res.text().catch(() => "");
22849
+ throw new Error(`Request failed with status ${res.status}${errorBody ? `: ${errorBody}` : ""}`);
22306
22850
  }
22307
22851
  return res.json();
22308
22852
  }
22309
- static getXamanNetwork(network) {
22310
- switch (network) {
22311
- case XrplNetwork.MAINNET:
22312
- return XamanXrplNetwork.MAINNET;
22313
- case XrplNetwork.TESTNET:
22314
- return XamanXrplNetwork.TESTNET;
22315
- default:
22316
- throw new Error(`Network ${network} is not supported`);
22317
- }
22853
+ createUrl(endpoint) {
22854
+ const baseUrl = this.baseUrl.startsWith("/") && typeof window !== "undefined"
22855
+ ? new URL(this.baseUrl, window.location.origin).toString()
22856
+ : this.baseUrl;
22857
+ return new URL(endpoint, baseUrl);
22318
22858
  }
22319
22859
  }
22320
22860
  function isXamanXAppContext() {
@@ -22647,6 +23187,7 @@ const getConfigWithDefaults = (config) => {
22647
23187
  slippage: get$2(config, "slippage", defaultConfigValues.slippage),
22648
23188
  collectFees: get$2(config, "collectFees", defaultConfigValues.collectFees),
22649
23189
  apiUrl: get$2(config, "apiUrl", defaultConfigValues.apiUrl),
23190
+ xamanApiUrl: get$2(config, "xamanApiUrl", defaultConfigValues.xamanApiUrl),
22650
23191
  priceImpactWarnings: get$2(config, "priceImpactWarnings", defaultConfigValues.priceImpactWarnings),
22651
23192
  initialAssets: get$2(config, "initialAssets", defaultConfigValues.initialAssets),
22652
23193
  defaultTokensPerChain: get$2(config, "defaultTokensPerChain", defaultConfigValues.defaultTokensPerChain),
@@ -23072,10 +23613,7 @@ const getNewSwapParamsFromInput = ({ inputParams, initialSwapRoute, tokens, chai
23072
23613
  else {
23073
23614
  newFallbackAddress = fallbackAddress ?? initialSwapRoute?.fallbackAddress;
23074
23615
  }
23075
- const sourceChainChanged = fromChainId !== undefined && fromChainId !== initialSwapRoute?.fromChainId;
23076
- const newDepositRefundAddress = sourceChainChanged
23077
- ? undefined
23078
- : depositRefundAddress || initialSwapRoute?.depositRefundAddress;
23616
+ const newDepositRefundAddress = depositRefundAddress || initialSwapRoute?.depositRefundAddress;
23079
23617
  return {
23080
23618
  fromChainId: srcChainId,
23081
23619
  fromTokenAddress: sourceTokenAddress,
@@ -23354,7 +23892,7 @@ const filterViewableTokens = (tokens, config, direction) => {
23354
23892
  };
23355
23893
  const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
23356
23894
  const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
23357
- const { fetchAllSecretBalances } = await import('./secretService-DOOg6zVn.js');
23895
+ const { fetchAllSecretBalances } = await import('./secretService-B2i6U8uo.js');
23358
23896
  return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
23359
23897
  };
23360
23898
  function getTokenAssetsKey(token) {
@@ -23381,29 +23919,9 @@ async function fetchAssetsColors() {
23381
23919
  };
23382
23920
  }
23383
23921
  }
23384
- const supportedChainTypes = new Set(Object.values(ChainType));
23385
- function isSupportedChainType(chainType) {
23386
- return supportedChainTypes.has(chainType);
23387
- }
23388
- /**
23389
- * Normalizes SDK data after each init/refetch before the rest of hooks consumes it.
23390
- *
23391
- * - Removes chains whose chainType is not supported by the local package.
23392
- * - Drops tokens for those removed chains.
23393
- * - Converts Evmos chains/tokens to EVM.
23394
- * - Applies optional asset colors.
23395
- */
23396
- function initializeSquidData(squid, assetsColors = {
23397
- chains: {},
23398
- tokens: {},
23399
- }) {
23400
- const supportedChains = squid.chains.filter((chain) => isSupportedChainType(chain.chainType));
23401
- const supportedChainIds = new Set(supportedChains.map((chain) => chain.chainId));
23402
- const evmosChainIds = supportedChains
23403
- .filter(isEvmosChain)
23404
- .map((c) => c.chainId);
23405
- const supportedTokens = squid.tokens.filter((token) => supportedChainIds.has(token.chainId));
23406
- squid.tokens = supportedTokens.map((token) => {
23922
+ function initializeSquidWithAssetsColors(squid, assetsColors) {
23923
+ const evmosChainIds = squid.chains.filter(isEvmosChain).map((c) => c.chainId);
23924
+ squid.tokens = squid.tokens.map((token) => {
23407
23925
  const isEvmosToken = evmosChainIds.includes(token.chainId);
23408
23926
  return {
23409
23927
  ...token,
@@ -23412,7 +23930,7 @@ function initializeSquidData(squid, assetsColors = {
23412
23930
  textColor: assetsColors.tokens[getTokenAssetsKey(token)]?.textColor,
23413
23931
  };
23414
23932
  });
23415
- squid.chains = supportedChains.map((chain) => {
23933
+ squid.chains = squid.chains.map((chain) => {
23416
23934
  const bgColor = assetsColors.chains[chain.chainId]?.bgColor;
23417
23935
  // convert evmos cosmos chains to evm chains
23418
23936
  // TODO: this will be fixed in the backend
@@ -23482,90 +24000,6 @@ function convertEvmosToEvmChain(cosmosChain) {
23482
24000
  };
23483
24001
  }
23484
24002
 
23485
- const EvmNetworkNotSupportedErrorCode = 4902;
23486
- async function addEthereumChain({ chain, provider, }) {
23487
- const chainName = chain.rpc.includes("tenderly")
23488
- ? `${chain.networkName} Tenderly fork`
23489
- : chain.networkName;
23490
- const chainParameters = {
23491
- chainId: `0x${parseInt(chain.chainId, 10).toString(16)}`,
23492
- chainName,
23493
- nativeCurrency: chain.nativeCurrency,
23494
- rpcUrls: [chain.rpc],
23495
- blockExplorerUrls: chain.blockExplorerUrls,
23496
- iconUrls: [chain.chainIconURI],
23497
- };
23498
- try {
23499
- return provider.request({
23500
- method: "wallet_addEthereumChain",
23501
- params: [chainParameters],
23502
- });
23503
- }
23504
- catch (error) {
23505
- console.debug("Error adding chain:", error);
23506
- }
23507
- }
23508
- const parseEvmAddress = (address) => {
23509
- if (address && isAddress(address)) {
23510
- return address;
23511
- }
23512
- };
23513
- /**
23514
- * Formats a Wagmi connector into a Squid Wallet
23515
- */
23516
- function formatEvmWallet(connector) {
23517
- const { icon, name: defaultName, id: wagmiConnectorId } = connector;
23518
- const walletOverrides = standardWalletOverrides[wagmiConnectorId];
23519
- const walletIcon = walletOverrides?.icon || icon;
23520
- const name = walletOverrides?.name || defaultName;
23521
- const connectorId = walletOverrides?.connectorId || wagmiConnectorId;
23522
- const isNonInstallableWallet = [
23523
- "injected",
23524
- "walletConnect",
23525
- "metaMaskSDK",
23526
- "coinbaseWalletSDK",
23527
- ].includes(wagmiConnectorId);
23528
- return {
23529
- connectorId,
23530
- name,
23531
- connectorName: name,
23532
- type: ChainType.EVM,
23533
- icon: walletIcon,
23534
- rdns: wagmiConnectorId,
23535
- windowFlag: name,
23536
- // For non-installable wallets, we don't want to show the "Installed" label
23537
- // but still want to allow the user to connect
23538
- skipInstallCheck: isNonInstallableWallet,
23539
- isInstalled: isNonInstallableWallet ? undefined : () => true,
23540
- connector,
23541
- isMobile: true,
23542
- };
23543
- }
23544
- function filterWagmiConnector(connector) {
23545
- // Safe is auto-connected when available, should not be listed as an available wallet
23546
- return connector.id !== "safe";
23547
- }
23548
- /**
23549
- * Waits for a transaction receipt, handling retries if indexing is in progress
23550
- */
23551
- async function waitForReceiptWithRetry(txResponse, retries = 5, delayMs = 2000) {
23552
- let lastError;
23553
- for (let i = 0; i < retries; i++) {
23554
- try {
23555
- return await txResponse.wait();
23556
- }
23557
- catch (error) {
23558
- lastError = error;
23559
- if (error?.message?.match(/transaction indexing is in progress/i)) {
23560
- await sleep(delayMs);
23561
- continue;
23562
- }
23563
- throw error;
23564
- }
23565
- }
23566
- throw lastError;
23567
- }
23568
-
23569
24003
  const countryCurrencyMap = [
23570
24004
  {
23571
24005
  currencyCode: "AED",
@@ -25289,7 +25723,7 @@ const useSquid = () => {
25289
25723
  queryFn: async () => {
25290
25724
  if (squid) {
25291
25725
  await squid?.init();
25292
- initializeSquidData(squid, assetsColors);
25726
+ initializeSquidWithAssetsColors(squid, assetsColors);
25293
25727
  return squid;
25294
25728
  }
25295
25729
  return null;
@@ -25348,7 +25782,7 @@ const useSquidTokens = (direction) => {
25348
25782
  config.availableChains,
25349
25783
  direction,
25350
25784
  ]);
25351
- const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, } = useMemo(() => {
25785
+ const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, } = useMemo(() => {
25352
25786
  return tokens?.reduce((acc, token) => {
25353
25787
  switch (token.type) {
25354
25788
  case ChainType.EVM:
@@ -25372,9 +25806,6 @@ const useSquidTokens = (direction) => {
25372
25806
  case ChainType.STELLAR:
25373
25807
  acc.stellarTokens.push(token);
25374
25808
  break;
25375
- case ChainType.CANTON:
25376
- acc.cantonTokens.push(token);
25377
- break;
25378
25809
  }
25379
25810
  return acc;
25380
25811
  }, {
@@ -25385,7 +25816,6 @@ const useSquidTokens = (direction) => {
25385
25816
  suiTokens: [],
25386
25817
  xrplTokens: [],
25387
25818
  stellarTokens: [],
25388
- cantonTokens: [],
25389
25819
  });
25390
25820
  }, [tokens]);
25391
25821
  const findToken = useCallback((address, chainId) => {
@@ -25403,7 +25833,6 @@ const useSquidTokens = (direction) => {
25403
25833
  suiTokens,
25404
25834
  xrplTokens,
25405
25835
  stellarTokens,
25406
- cantonTokens,
25407
25836
  };
25408
25837
  };
25409
25838
 
@@ -25941,7 +26370,6 @@ const chainTypeToRefetchInterval = {
25941
26370
  [ChainType.SUI]: 1_000,
25942
26371
  [ChainType.XRPL]: 1_000,
25943
26372
  [ChainType.STELLAR]: 1_000,
25944
- [ChainType.CANTON]: 1_000,
25945
26373
  };
25946
26374
  /**
25947
26375
  * Returns the status refetch interval of a Send transaction
@@ -26208,7 +26636,7 @@ const useSquidChains = (direction) => {
26208
26636
  const chain = findChain(chainId);
26209
26637
  return chain?.chainType;
26210
26638
  }, [findChain]);
26211
- const { evmChains, cosmosChains, suiChains, stellarChains, xrplChains, cantonChains, } = useMemo(() => {
26639
+ const { evmChains, cosmosChains, suiChains, stellarChains, xrplChains } = useMemo(() => {
26212
26640
  return chains.reduce((acc, chain) => {
26213
26641
  switch (chain.chainType) {
26214
26642
  case ChainType.EVM:
@@ -26226,9 +26654,6 @@ const useSquidChains = (direction) => {
26226
26654
  case ChainType.STELLAR:
26227
26655
  acc.stellarChains.push(chain);
26228
26656
  break;
26229
- case ChainType.CANTON:
26230
- acc.cantonChains.push(chain);
26231
- break;
26232
26657
  }
26233
26658
  return acc;
26234
26659
  }, {
@@ -26237,7 +26662,6 @@ const useSquidChains = (direction) => {
26237
26662
  suiChains: [],
26238
26663
  xrplChains: [],
26239
26664
  stellarChains: [],
26240
- cantonChains: [],
26241
26665
  });
26242
26666
  }, [chains]);
26243
26667
  const { supportedSourceChains, supportedDestinationChains } = useMemo(() => {
@@ -26258,7 +26682,6 @@ const useSquidChains = (direction) => {
26258
26682
  suiChains,
26259
26683
  xrplChains,
26260
26684
  stellarChains,
26261
- cantonChains,
26262
26685
  getChainType,
26263
26686
  findChain,
26264
26687
  };
@@ -26783,7 +27206,7 @@ function useStellarWallets() {
26783
27206
  try {
26784
27207
  const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
26785
27208
  const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module.mjs');
26786
- const { formatStellarWallet } = await import('./stellarService.client-C-pOt34O.js');
27209
+ const { formatStellarWallet } = await import('./stellarService.client-D20h9JPG.js');
26787
27210
  const modules = [...initializeAllModules(), new LedgerModule()];
26788
27211
  const promises = modules.map(async (module) => {
26789
27212
  const isAvailable = await module.isAvailable();
@@ -26963,6 +27386,56 @@ class XamanConnector {
26963
27386
  this.xumm = await getXummClient();
26964
27387
  }
26965
27388
  }
27389
+ async runPayloadFlow({ txPayload, onSigned, }) {
27390
+ this.validateXummInitialized();
27391
+ if (!this.xumm.xapp) {
27392
+ throw new Error("Not in xApp context");
27393
+ }
27394
+ if (!this.xumm.payload) {
27395
+ throw new Error("Payload not available");
27396
+ }
27397
+ await this.xumm.xapp.openSignRequest(txPayload);
27398
+ return new Promise((resolve, reject) => {
27399
+ this.validateXummInitialized();
27400
+ const unsubscribe = () => {
27401
+ this.xumm?.off("payload", handlePayload);
27402
+ };
27403
+ const rejectAndUnsubscribe = (error) => {
27404
+ unsubscribe();
27405
+ reject(error);
27406
+ };
27407
+ const handlePayload = async (data) => {
27408
+ this.validateXummInitialized();
27409
+ if (!data) {
27410
+ return;
27411
+ }
27412
+ if (data.reason === "DECLINED") {
27413
+ rejectAndUnsubscribe(new Error("User rejected the request."));
27414
+ return;
27415
+ }
27416
+ if (data.reason !== "SIGNED") {
27417
+ return;
27418
+ }
27419
+ if (!this.xumm.payload) {
27420
+ rejectAndUnsubscribe(new Error("Payload not available"));
27421
+ return;
27422
+ }
27423
+ try {
27424
+ const fullPayload = await this.xumm.payload.get(data.uuid);
27425
+ if (!fullPayload) {
27426
+ throw new Error("Invalid Xaman payload response");
27427
+ }
27428
+ unsubscribe();
27429
+ const response = await onSigned(fullPayload);
27430
+ resolve(response);
27431
+ }
27432
+ catch (error) {
27433
+ rejectAndUnsubscribe(error);
27434
+ }
27435
+ };
27436
+ this.xumm.on("payload", handlePayload);
27437
+ });
27438
+ }
26966
27439
  async connect() {
26967
27440
  await this.initializeXumm();
26968
27441
  this.validateXummInitialized();
@@ -26980,7 +27453,7 @@ class XamanConnector {
26980
27453
  if (!this.xumm.payload) {
26981
27454
  throw new Error("Payload not available");
26982
27455
  }
26983
- const xamanNetwork = XamanClient.getXamanNetwork(network);
27456
+ const xamanNetwork = getXamanNetwork(network);
26984
27457
  const txPayload = await this.xumm.payload.create({
26985
27458
  TransactionType: XrplTransactionType.PAYMENT,
26986
27459
  options: {
@@ -26988,33 +27461,65 @@ class XamanConnector {
26988
27461
  },
26989
27462
  txjson: tx,
26990
27463
  });
26991
- await this.xumm.xapp.openSignRequest(txPayload);
26992
- const response = await new Promise((resolve, reject) => {
26993
- this.validateXummInitialized();
26994
- if (!this.xumm.xapp) {
26995
- reject(new Error("Not in xApp context"));
26996
- }
26997
- this.xumm.on("payload", async (data) => {
26998
- this.validateXummInitialized();
26999
- if (data && data.reason === "DECLINED") {
27000
- reject(new Error("User rejected the request."));
27464
+ const response = await this.runPayloadFlow({
27465
+ txPayload,
27466
+ onSigned: (fullPayload) => {
27467
+ if (!fullPayload.response.txid) {
27468
+ throw new Error("Transaction hash not found");
27001
27469
  }
27002
- if (data && data.reason === "SIGNED") {
27003
- if (!this.xumm.payload) {
27004
- throw new Error("Payload not available");
27005
- }
27006
- const fullPayload = await this.xumm.payload.get(data.uuid);
27007
- if (fullPayload?.response.txid) {
27008
- resolve({
27009
- hash: fullPayload.response.txid,
27010
- status: XrplTxStatus.SUCCESS,
27011
- });
27012
- }
27013
- else {
27014
- reject(new Error("Transaction hash not found"));
27015
- }
27470
+ return {
27471
+ hash: fullPayload.response.txid,
27472
+ status: XrplTxStatus.SUCCESS,
27473
+ };
27474
+ },
27475
+ });
27476
+ return response;
27477
+ }
27478
+ async signOwnershipMessage({ address, message, }) {
27479
+ await this.initializeXumm();
27480
+ this.validateXummInitialized();
27481
+ if (!this.xumm.xapp) {
27482
+ throw new Error("Not in xApp context");
27483
+ }
27484
+ if (!this.xumm.payload) {
27485
+ throw new Error("Payload not available");
27486
+ }
27487
+ const txPayload = await this.xumm.payload.create({
27488
+ txjson: {
27489
+ TransactionType: "SignIn",
27490
+ Memos: [
27491
+ {
27492
+ Memo: {
27493
+ MemoType: stringToUtf8Hex(XAMAN_OWNERSHIP_CHALLENGE_MEMO_TYPE, {
27494
+ uppercase: true,
27495
+ }),
27496
+ MemoData: stringToUtf8Hex(message, { uppercase: true }),
27497
+ },
27498
+ },
27499
+ ],
27500
+ },
27501
+ });
27502
+ if (!txPayload) {
27503
+ throw new Error("Failed to create Xaman sign-in payload");
27504
+ }
27505
+ const response = await this.runPayloadFlow({
27506
+ txPayload,
27507
+ onSigned: (fullPayload) => {
27508
+ const signedAddress = fullPayload.response.account;
27509
+ const signedPayload = fullPayload.response.hex;
27510
+ if (signedAddress !== address) {
27511
+ throw createXrplActiveAccountMismatchError("Xaman");
27016
27512
  }
27017
- });
27513
+ if (!signedPayload) {
27514
+ throw new Error("Invalid Xaman sign-in response");
27515
+ }
27516
+ return {
27517
+ signedPayload,
27518
+ signedPayloadEncoding: "xrpl-tx-hex",
27519
+ signatureType: WalletVerificationSignatureType.XAMAN,
27520
+ signerAddress: fullPayload.response.signer ?? undefined,
27521
+ };
27522
+ },
27018
27523
  });
27019
27524
  return response;
27020
27525
  }
@@ -27056,96 +27561,157 @@ function websocket(url, onMessage) {
27056
27561
 
27057
27562
  const genericXamanQrErrorMessage = "Failed to generate Xaman QR code";
27058
27563
  class XamanQrConnector {
27564
+ xamanClient;
27059
27565
  cancelConnectQr = null;
27060
27566
  cancelSignAndSubmitQr = null;
27567
+ cancelSignOwnershipQr = null;
27568
+ constructor(xamanClient = new XamanClient()) {
27569
+ this.xamanClient = xamanClient;
27570
+ }
27061
27571
  cancelConnect() {
27062
27572
  this.cancelConnectQr?.();
27063
27573
  }
27064
27574
  cancelSignAndSubmit() {
27065
27575
  this.cancelSignAndSubmitQr?.();
27066
27576
  }
27067
- async connect() {
27577
+ cancelSignOwnershipMessage() {
27578
+ this.cancelSignOwnershipQr?.();
27579
+ }
27580
+ getPayloadId(message) {
27581
+ if (!message.payload_uuidv4) {
27582
+ throw new Error("Invalid Xaman websocket response");
27583
+ }
27584
+ return message.payload_uuidv4;
27585
+ }
27586
+ async runQrFlow({ flow, cancelMessage, setCancel, createPayload, onSigned, }) {
27068
27587
  const controller = new AbortController();
27069
- this.cancelConnectQr = () => {
27070
- controller.abort("User canceled the connection process");
27071
- };
27588
+ setCancel(() => {
27589
+ controller.abort(cancelMessage);
27590
+ });
27072
27591
  let response;
27073
27592
  try {
27074
- response = await XamanClient.signIn(controller.signal);
27593
+ response = await createPayload(controller.signal);
27075
27594
  }
27076
- catch (error) {
27595
+ catch {
27596
+ if (flow === "sign") {
27597
+ WidgetEvents.getInstance().dispatchQrCodeGenerationFailedForSign(undefined);
27598
+ }
27077
27599
  throw new QrCodeGenerationError(genericXamanQrErrorMessage);
27078
27600
  }
27079
- WidgetEvents.getInstance().dispatchQrCodeGeneratedForConnect({
27080
- matrix: response.qrMatrix,
27081
- deepLinkUrl: response.deepLinkUrl,
27082
- });
27601
+ if (flow === "connect") {
27602
+ WidgetEvents.getInstance().dispatchQrCodeGeneratedForConnect({
27603
+ matrix: response.qrMatrix,
27604
+ deepLinkUrl: response.deepLinkUrl,
27605
+ });
27606
+ }
27607
+ else {
27608
+ WidgetEvents.getInstance().dispatchQrCodeGeneratedForSign({
27609
+ matrix: response.qrMatrix,
27610
+ deepLinkUrl: response.deepLinkUrl,
27611
+ });
27612
+ }
27083
27613
  const { promise, close } = websocket(response.wsStatusUrl, (event, resolve, reject) => {
27084
- const msg = JSON.parse(event.data);
27085
- if (msg.signed === true) {
27086
- XamanClient.userSession(msg.payload_uuidv4).then((data) => {
27087
- resolve(data.response.account);
27614
+ let message;
27615
+ try {
27616
+ message = JSON.parse(event.data);
27617
+ }
27618
+ catch (error) {
27619
+ reject(error);
27620
+ return;
27621
+ }
27622
+ if (message.opened === true) {
27623
+ WidgetEvents.getInstance().dispatchQrScannedAwaitingApproval({
27624
+ flow,
27088
27625
  });
27626
+ return;
27627
+ }
27628
+ if (message.signed === true) {
27629
+ Promise.resolve(onSigned(message)).then(resolve).catch(reject);
27630
+ return;
27089
27631
  }
27090
- else if (msg.signed === false) {
27632
+ if (message.signed === false) {
27091
27633
  reject(new Error("User rejected the request."));
27092
27634
  }
27093
27635
  });
27094
- this.cancelConnectQr = () => {
27636
+ setCancel(() => {
27095
27637
  close();
27096
- };
27097
- const address = await promise;
27098
- return address;
27638
+ });
27639
+ return promise.finally(() => {
27640
+ setCancel(null);
27641
+ });
27642
+ }
27643
+ async connect() {
27644
+ return this.runQrFlow({
27645
+ flow: "connect",
27646
+ cancelMessage: "User canceled the connection process",
27647
+ setCancel: (cancel) => {
27648
+ this.cancelConnectQr = cancel;
27649
+ },
27650
+ createPayload: (signal) => this.xamanClient.signIn(signal),
27651
+ onSigned: async (message) => {
27652
+ const data = await this.xamanClient.userSession(this.getPayloadId(message));
27653
+ if (!data.response.account) {
27654
+ throw new Error("Invalid Xaman sign-in response");
27655
+ }
27656
+ return data.response.account;
27657
+ },
27658
+ });
27099
27659
  }
27100
27660
  async signAndSubmit({ tx, network, }) {
27101
- const controller = new AbortController();
27102
- this.cancelSignAndSubmitQr = () => {
27103
- controller.abort("User canceled the transaction");
27104
- };
27105
- let response;
27106
- try {
27107
- response = await XamanClient.sendTx({
27661
+ return this.runQrFlow({
27662
+ flow: "sign",
27663
+ cancelMessage: "User canceled the transaction",
27664
+ setCancel: (cancel) => {
27665
+ this.cancelSignAndSubmitQr = cancel;
27666
+ },
27667
+ createPayload: (signal) => this.xamanClient.sendTx({
27108
27668
  tx,
27109
27669
  network,
27110
- signal: controller.signal,
27111
- });
27112
- }
27113
- catch (error) {
27114
- WidgetEvents.getInstance().dispatchQrCodeGenerationFailedForSign(undefined);
27115
- throw new QrCodeGenerationError(genericXamanQrErrorMessage);
27116
- }
27117
- WidgetEvents.getInstance().dispatchQrCodeGeneratedForSign({
27118
- matrix: response.qrMatrix,
27119
- deepLinkUrl: response.deepLinkUrl,
27120
- });
27121
- const { promise, close } = websocket(response.wsStatusUrl, (event, resolve, reject) => {
27122
- const msg = JSON.parse(event.data);
27123
- if (msg.opened === true) {
27124
- // User has scanned the QR code
27125
- WidgetEvents.getInstance().dispatchQrTxScannedAwaitingApproval(undefined);
27126
- }
27127
- else if (msg.signed === true) {
27128
- // Tx has been signed
27129
- resolve({
27130
- hash: msg.txid,
27670
+ signal,
27671
+ }),
27672
+ onSigned: (message) => {
27673
+ if (!message.txid) {
27674
+ throw new Error("Invalid Xaman transaction response");
27675
+ }
27676
+ return {
27677
+ hash: message.txid,
27131
27678
  status: XrplTxStatus.SUCCESS,
27132
- });
27133
- }
27134
- else if (msg.signed === false) {
27135
- // User rejected the transaction
27136
- reject(new Error("User rejected the request."));
27137
- }
27679
+ };
27680
+ },
27681
+ });
27682
+ }
27683
+ async signOwnershipMessage({ address, message, }) {
27684
+ return this.runQrFlow({
27685
+ flow: "sign",
27686
+ cancelMessage: "User canceled the signing process",
27687
+ setCancel: (cancel) => {
27688
+ this.cancelSignOwnershipQr = cancel;
27689
+ },
27690
+ createPayload: (signal) => this.xamanClient.signOwnershipMessage(message, signal),
27691
+ onSigned: async (statusMessage) => {
27692
+ const data = await this.xamanClient.userSession(this.getPayloadId(statusMessage));
27693
+ const signedAddress = data.response.account;
27694
+ const signedPayload = data.response.hex;
27695
+ if (signedAddress !== address) {
27696
+ throw createXrplActiveAccountMismatchError("Xaman");
27697
+ }
27698
+ if (!signedPayload) {
27699
+ throw new Error("Invalid Xaman sign-in response");
27700
+ }
27701
+ return {
27702
+ signedPayload,
27703
+ signedPayloadEncoding: "xrpl-tx-hex",
27704
+ signatureType: WalletVerificationSignatureType.XAMAN,
27705
+ signerAddress: data.response.signer ?? undefined,
27706
+ };
27707
+ },
27138
27708
  });
27139
- this.cancelSignAndSubmitQr = () => {
27140
- close();
27141
- };
27142
- const result = await promise;
27143
- return result;
27144
27709
  }
27145
27710
  }
27146
27711
 
27147
27712
  function useXrplWallets() {
27148
27713
  const { clientWindow } = useClient();
27714
+ const xamanApiUrl = useConfigStore((state) => state.config.xamanApiUrl);
27149
27715
  const wallets = useMemo(() => {
27150
27716
  const isXAppContext = isXamanXAppContext();
27151
27717
  const xamanWalletIcon = `${walletIconBaseUrl}/xaman.webp`;
@@ -27166,7 +27732,7 @@ function useXrplWallets() {
27166
27732
  type: ChainType.XRPL,
27167
27733
  name: "Xaman",
27168
27734
  windowFlag: WindowWalletFlag.XamanQr,
27169
- connector: new XamanQrConnector(),
27735
+ connector: new XamanQrConnector(new XamanClient({ baseUrl: xamanApiUrl })),
27170
27736
  skipInstallCheck: true,
27171
27737
  isMobile: true,
27172
27738
  connectorId: "xaman-qr",
@@ -27180,7 +27746,7 @@ function useXrplWallets() {
27180
27746
  isXAppContext ? xamanXAppWallet : xamanQrWallet,
27181
27747
  ...populateWallets(clientWindow, xrplWallets),
27182
27748
  ];
27183
- }, [clientWindow]);
27749
+ }, [clientWindow, xamanApiUrl]);
27184
27750
  return {
27185
27751
  wallets,
27186
27752
  };
@@ -27315,6 +27881,7 @@ const useWallet = () => {
27315
27881
  setConnectingWallet({
27316
27882
  wallet,
27317
27883
  status: ConnectingWalletStatus.CONNECTING,
27884
+ qrScanned: false,
27318
27885
  });
27319
27886
  try {
27320
27887
  const result = await connectWallet({
@@ -27449,11 +28016,29 @@ const useWallet = () => {
27449
28016
  matrix: event.detail.matrix,
27450
28017
  deepLinkUrl: event.detail.deepLinkUrl,
27451
28018
  },
28019
+ qrScanned: false,
28020
+ });
28021
+ };
28022
+ const onQrWalletScannedAwaitingApproval = () => {
28023
+ const currentState = useWalletStore.getState().connectingWalletState;
28024
+ if (currentState.qrData == null) {
28025
+ return;
28026
+ }
28027
+ setConnectingWallet({
28028
+ ...currentState,
28029
+ qrScanned: true,
27452
28030
  });
27453
28031
  };
28032
+ const onQrScannedAwaitingApproval = (event) => {
28033
+ if (event.detail.flow === "connect") {
28034
+ onQrWalletScannedAwaitingApproval();
28035
+ }
28036
+ };
27454
28037
  WidgetEvents.getInstance().listenToWidget("qrCodeGeneratedForConnect", onQrWalletConnectData);
28038
+ WidgetEvents.getInstance().listenToWidget("qrScannedAwaitingUserApproval", onQrScannedAwaitingApproval);
27455
28039
  return () => {
27456
28040
  WidgetEvents.getInstance().removeWidgetListener("qrCodeGeneratedForConnect", onQrWalletConnectData);
28041
+ WidgetEvents.getInstance().removeWidgetListener("qrScannedAwaitingUserApproval", onQrScannedAwaitingApproval);
27457
28042
  };
27458
28043
  }, [setConnectingWallet]);
27459
28044
  return {
@@ -27482,7 +28067,6 @@ const useMultiChainWallet = (chain) => {
27482
28067
  const suiAddress = connectedAddresses[ChainType.SUI];
27483
28068
  const xrplAddress = connectedAddresses[ChainType.XRPL];
27484
28069
  const stellarAddress = connectedAddresses[ChainType.STELLAR];
27485
- const cantonAddress = connectedAddresses[ChainType.CANTON];
27486
28070
  // Cosmos is a special case because the address changes on every chain
27487
28071
  // so we can't use the default cosmos connected address
27488
28072
  const { data: cosmosAddress } = useCosmosForChain(chain);
@@ -27570,16 +28154,6 @@ const useMultiChainWallet = (chain) => {
27570
28154
  chainType: chain.chainType,
27571
28155
  }),
27572
28156
  };
27573
- case ChainType.CANTON:
27574
- if (!cantonAddress)
27575
- return {};
27576
- return {
27577
- address: cantonAddress,
27578
- formatted: formatHash({
27579
- hash: cantonAddress,
27580
- chainType: chain.chainType,
27581
- }),
27582
- };
27583
28157
  }
27584
28158
  }, [
27585
28159
  chain?.chainType,
@@ -27591,7 +28165,6 @@ const useMultiChainWallet = (chain) => {
27591
28165
  suiAddress,
27592
28166
  xrplAddress,
27593
28167
  stellarAddress,
27594
- cantonAddress,
27595
28168
  ]);
27596
28169
  /**
27597
28170
  * Change current network for desired chain
@@ -28416,8 +28989,6 @@ async function createClient(chain) {
28416
28989
  return new XrplRpcClient(chain.rpc);
28417
28990
  case ChainType.STELLAR:
28418
28991
  return new StellarRpcClient(chain.rpc);
28419
- case ChainType.CANTON:
28420
- return null;
28421
28992
  }
28422
28993
  }
28423
28994
 
@@ -29610,7 +30181,7 @@ const useStellarBalance = ({ userAddress, chain, enabled, token, refreshInterval
29610
30181
  };
29611
30182
 
29612
30183
  function useNativeTokenForChain(chain) {
29613
- const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, } = useSquidTokens();
30184
+ const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, } = useSquidTokens();
29614
30185
  const getTokensForChainType = () => {
29615
30186
  if (!chain?.chainType)
29616
30187
  return [];
@@ -29629,8 +30200,6 @@ function useNativeTokenForChain(chain) {
29629
30200
  return xrplTokens;
29630
30201
  case ChainType.STELLAR:
29631
30202
  return stellarTokens;
29632
- case ChainType.CANTON:
29633
- return cantonTokens;
29634
30203
  }
29635
30204
  };
29636
30205
  const nativeTokenForChainType = useMemo(() => {
@@ -29865,11 +30434,6 @@ const useNativeBalance = (chain) => {
29865
30434
  break;
29866
30435
  case ChainType.STELLAR:
29867
30436
  balance = nativeStellarBalance;
29868
- break;
29869
- case ChainType.CANTON:
29870
- // TODO: implement canton balance fetching
29871
- balance = undefined;
29872
- break;
29873
30437
  }
29874
30438
  const balanceFormatted = !!balance
29875
30439
  ? formatBNToReadable(balance.value, balance.decimals)
@@ -29906,9 +30470,6 @@ const useNativeBalance = (chain) => {
29906
30470
  return isXrpLoading;
29907
30471
  case ChainType.STELLAR:
29908
30472
  return isStellarLoading;
29909
- case ChainType.CANTON:
29910
- // TODO: implement canton balance fetching
29911
- return false;
29912
30473
  }
29913
30474
  }, [
29914
30475
  chain?.chainType,
@@ -30133,7 +30694,7 @@ function hederaWalletConnect(parameters) {
30133
30694
  const optionalChains = config.chains.map((x) => x.id);
30134
30695
  if (!optionalChains.length)
30135
30696
  return;
30136
- const { EthereumProvider } = await import('./index.es-Cq4mUT_n.js');
30697
+ const { EthereumProvider } = await import('./index.es-CBWh71yD.js');
30137
30698
  const rawProvider = await EthereumProvider.init({
30138
30699
  ...restParameters,
30139
30700
  disableProviderPing: true,
@@ -30363,8 +30924,6 @@ const useSigner = ({ chain }) => {
30363
30924
  return isXrplSignerReady;
30364
30925
  case ChainType.STELLAR:
30365
30926
  return isStellarSignerReady;
30366
- case ChainType.CANTON:
30367
- return false;
30368
30927
  }
30369
30928
  }, [
30370
30929
  chain?.chainType,
@@ -30814,21 +31373,21 @@ const useSendTransactionStore = create((set, get) => ({
30814
31373
 
30815
31374
  const useDepositAddressStore = create((set) => ({
30816
31375
  deposit: null,
30817
- selectedPaymentMethod: "connectedWallet",
31376
+ isEnabled: false,
30818
31377
  setDeposit: (data) => {
30819
31378
  set({ deposit: data });
30820
31379
  },
30821
- setPaymentMethod: (method) => {
30822
- set({ selectedPaymentMethod: method });
31380
+ toggleDepositFlow: (enabled) => {
31381
+ set({ isEnabled: enabled });
30823
31382
  },
30824
31383
  }));
30825
31384
 
30826
31385
  function useDepositAddress(squidRoute) {
30827
- const { selectedPaymentMethod, depositAddress } = useDepositAddressStore((state) => ({
30828
- selectedPaymentMethod: state.selectedPaymentMethod,
31386
+ const { isEnabled, depositAddress } = useDepositAddressStore((state) => ({
31387
+ isEnabled: state.isEnabled,
30829
31388
  depositAddress: state.deposit?.depositAddress,
30830
31389
  }));
30831
- const { setDeposit, setPaymentMethod, deposit } = useDepositAddressStore();
31390
+ const { setDeposit, toggleDepositFlow, deposit } = useDepositAddressStore();
30832
31391
  const { squid } = useSquidStore();
30833
31392
  const { fromChain } = useSwap();
30834
31393
  const isAvailableAsPaymentMethod = useMemo(() => {
@@ -30837,7 +31396,6 @@ function useDepositAddress(squidRoute) {
30837
31396
  const chainsSupportingDepositAddress = [
30838
31397
  CHAIN_IDS.BITCOIN,
30839
31398
  CHAIN_IDS.SOLANA,
30840
- CHAIN_IDS.CANTON,
30841
31399
  ];
30842
31400
  return chainsSupportingDepositAddress.includes(fromChain.chainId);
30843
31401
  }, [fromChain?.chainId]);
@@ -30845,50 +31403,34 @@ function useDepositAddress(squidRoute) {
30845
31403
  return (squidRoute?.transactionRequest?.type ===
30846
31404
  SquidDataType.ChainflipDepositAddress);
30847
31405
  }, [squidRoute?.transactionRequest?.type]);
30848
- // Effective payment method: the user's intent clamped by what the current
30849
- // source chain can actually do. Reading this (instead of raw intent) is what
30850
- // keeps every consumer in sync — if the source chain can't use a deposit
30851
- // address, the effective method is "connectedWallet" immediately at read time.
30852
- const paymentMethod = isAvailableAsPaymentMethod
30853
- ? selectedPaymentMethod
30854
- : "connectedWallet";
30855
- const isDepositAddressActive = paymentMethod === "depositAddress";
31406
+ const enable = useCallback(() => {
31407
+ toggleDepositFlow(true);
31408
+ }, [toggleDepositFlow]);
31409
+ const disable = useCallback(() => {
31410
+ toggleDepositFlow(false);
31411
+ }, [toggleDepositFlow]);
30856
31412
  const closeDepositChannel = useCallback(() => {
31413
+ toggleDepositFlow(false);
30857
31414
  setDeposit(null);
30858
- }, [setDeposit]);
31415
+ }, [toggleDepositFlow, setDeposit]);
30859
31416
  const getRouteWithDeposit = useMutation(async ({ route }) => {
30860
- if (!squid || !route.transactionRequest)
30861
- throw new Error("Missing required params");
30862
- if (isChainflipDepositRoute(route)) {
30863
- const depositAddressResponse = (await squid.executeRoute({
30864
- signer: {},
30865
- route,
30866
- }));
30867
- setDeposit({
30868
- amount: depositAddressResponse.amount,
30869
- depositAddress: depositAddressResponse.depositAddress,
30870
- statusTrackingId: depositAddressResponse.chainflipStatusTrackingId,
30871
- });
30872
- return;
30873
- }
30874
- else if (isDepositAddressDirectTransferRoute(route.transactionRequest)) {
30875
- const orderHash = route.transactionRequest.data;
30876
- setDeposit({
30877
- amount: route.params.fromAmount ?? "",
30878
- depositAddress: route.transactionRequest.target,
30879
- // Squid Scan indexes the Canton tx by the orderHash
30880
- statusTrackingId: orderHash,
30881
- memo: orderHash,
30882
- });
30883
- return;
30884
- }
31417
+ if (!squid)
31418
+ throw new Error("Squid SDK not initialized");
31419
+ const depositAddressResponse = (await squid.executeRoute({
31420
+ signer: {},
31421
+ route,
31422
+ }));
31423
+ setDeposit(depositAddressResponse);
31424
+ return {
31425
+ depositAddress: depositAddressResponse,
31426
+ };
30885
31427
  });
30886
31428
  return {
30887
- paymentMethod,
30888
- isDepositAddressActive,
31429
+ isEnabled,
30889
31430
  isAvailableAsPaymentMethod,
30890
31431
  swapWillGenerateDepositAddress,
30891
- setPaymentMethod,
31432
+ enable,
31433
+ disable,
30892
31434
  getRouteWithDeposit,
30893
31435
  depositAddress,
30894
31436
  closeDepositChannel,
@@ -30920,7 +31462,7 @@ const useUrlSwapParams = () => {
30920
31462
 
30921
31463
  const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, queryOptions, }) => {
30922
31464
  const { evmChains, cosmosChains, suiChains, xrplChains, stellarChains } = useSquidChains(direction);
30923
- const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, cantonTokens, } = useSquidTokens(direction);
31465
+ const { evmTokens, cosmosTokens, solanaTokens, bitcoinTokens, suiTokens, xrplTokens, stellarTokens, } = useSquidTokens(direction);
30924
31466
  const { keplrTypeWallet } = useCosmosContext();
30925
31467
  const placeholderData = useMemo(() => {
30926
31468
  const tokens = {
@@ -30931,7 +31473,6 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
30931
31473
  [ChainType.SUI]: suiTokens.map((t) => ({ ...t, balance: "0" })),
30932
31474
  [ChainType.XRPL]: xrplTokens.map((t) => ({ ...t, balance: "0" })),
30933
31475
  [ChainType.STELLAR]: stellarTokens.map((t) => ({ ...t, balance: "0" })),
30934
- [ChainType.CANTON]: cantonTokens.map((t) => ({ ...t, balance: "0" })),
30935
31476
  };
30936
31477
  if (!chainType) {
30937
31478
  // Return all tokens with zero balance
@@ -30953,7 +31494,6 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
30953
31494
  suiTokens,
30954
31495
  xrplTokens,
30955
31496
  stellarTokens,
30956
- cantonTokens,
30957
31497
  ]);
30958
31498
  const isQueryEnabled = useMemo(() => {
30959
31499
  // Respect the queryOptions.enabled override if provided
@@ -30976,8 +31516,6 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
30976
31516
  return xrplTokens.length > 0;
30977
31517
  case ChainType.STELLAR:
30978
31518
  return stellarTokens.length > 0;
30979
- case ChainType.CANTON:
30980
- return cantonTokens.length > 0;
30981
31519
  }
30982
31520
  }, [
30983
31521
  chainType,
@@ -30990,7 +31528,6 @@ const useAllTokensWithBalanceForChainType = ({ chainType, address, direction, qu
30990
31528
  suiTokens.length,
30991
31529
  xrplTokens.length,
30992
31530
  stellarTokens.length,
30993
- cantonTokens.length,
30994
31531
  ]);
30995
31532
  const query = useQuery(keys().allTokensBalance(address, chainType, direction), async () => {
30996
31533
  // Return zero balances if no address
@@ -31100,12 +31637,6 @@ const useAllConnectedWalletBalances = ({ direction, queryOptions = {
31100
31637
  direction,
31101
31638
  queryOptions,
31102
31639
  });
31103
- const cantonBalancesQuery = useAllTokensWithBalanceForChainType({
31104
- chainType: ChainType.CANTON,
31105
- address: connectedAddresses?.[ChainType.CANTON],
31106
- direction,
31107
- queryOptions,
31108
- });
31109
31640
  // Create a map of chain type to balance query results
31110
31641
  const balanceQueries = useMemo(() => ({
31111
31642
  [ChainType.EVM]: evmBalancesQuery,
@@ -31115,7 +31646,6 @@ const useAllConnectedWalletBalances = ({ direction, queryOptions = {
31115
31646
  [ChainType.SUI]: suiBalancesQuery,
31116
31647
  [ChainType.XRPL]: xrplBalancesQuery,
31117
31648
  [ChainType.STELLAR]: stellarBalancesQuery,
31118
- [ChainType.CANTON]: cantonBalancesQuery,
31119
31649
  }), [
31120
31650
  evmBalancesQuery,
31121
31651
  cosmosBalancesQuery,
@@ -31124,7 +31654,6 @@ const useAllConnectedWalletBalances = ({ direction, queryOptions = {
31124
31654
  suiBalancesQuery,
31125
31655
  xrplBalancesQuery,
31126
31656
  stellarBalancesQuery,
31127
- cantonBalancesQuery,
31128
31657
  ]);
31129
31658
  // Combine all tokens from different chains
31130
31659
  const allTokens = useMemo(() => Object.values(balanceQueries).flatMap((query) => query.data?.tokens ?? []), [balanceQueries]);
@@ -31224,9 +31753,6 @@ const useMultiChainBalance = ({ chain, token, userAddress, enabled = true, }) =>
31224
31753
  return xrplBalance;
31225
31754
  case ChainType.STELLAR:
31226
31755
  return stellarBalance;
31227
- case ChainType.CANTON:
31228
- // TODO: implement canton balance fetching
31229
- return "0";
31230
31756
  }
31231
31757
  }, [
31232
31758
  chain?.chainType,
@@ -32335,9 +32861,6 @@ function useSendTransaction({ to, amount, token, chain, }) {
32335
32861
  chain,
32336
32862
  });
32337
32863
  break;
32338
- case ChainType.CANTON: {
32339
- throw new Error("Not implemented");
32340
- }
32341
32864
  }
32342
32865
  return {
32343
32866
  amount,
@@ -32541,8 +33064,6 @@ async function getSendTransactionStatus({ chain, txHash, }) {
32541
33064
  txHash,
32542
33065
  chain,
32543
33066
  });
32544
- case ChainType.CANTON:
32545
- throw new Error("Not implemented");
32546
33067
  }
32547
33068
  }
32548
33069
 
@@ -32566,7 +33087,7 @@ const useHistory = (txType) => {
32566
33087
  fromChain: tx.params.fromChain,
32567
33088
  fromToken: tx.params.fromToken,
32568
33089
  fromAddress: tx.params.fromAddress,
32569
- fromAmount: tx.params.fromAmount ?? "",
33090
+ fromAmount: tx.params.fromAmount,
32570
33091
  toChain: tx.params.toChain,
32571
33092
  toToken: tx.params.toToken,
32572
33093
  toAddress: tx.params.toAddress,
@@ -32994,129 +33515,6 @@ const useApproval = ({ squidRoute, }) => {
32994
33515
  };
32995
33516
  };
32996
33517
 
32997
- const useSwapStatusQuery = ({ transaction, retry = 25, refetchOnWindowFocus = "always", enabled = true, onStatus, onEndStatus, onNotFound, onError, }) => {
32998
- const config = useConfigStore((state) => state.config);
32999
- const isInitialized = useConfigStore((state) => state.isInitialized);
33000
- const [isTransactionComplete, setIsTransactionComplete] = useState(false);
33001
- const [refetchInterval, setRefetchInterval] = useState(getSwapTxStatusRefetchInterval(transaction));
33002
- const { getChainType } = useSquidChains();
33003
- const fetchTransactionStatusWithLatestConfig = useCallback(async () => {
33004
- const latestConfig = useConfigStore.getState().config;
33005
- return fetchSwapTransactionStatus({
33006
- transaction,
33007
- integratorId: latestConfig.integratorId,
33008
- apiUrl: latestConfig.apiUrl,
33009
- });
33010
- }, [transaction]);
33011
- const transactionStatusQuery = useQuery(keys().swapTransactionStatus(transaction?.transactionId), fetchTransactionStatusWithLatestConfig, {
33012
- enabled: enabled &&
33013
- transaction?.transactionId !== "0" &&
33014
- !!transaction?.transactionId &&
33015
- !!transaction.fromAddress &&
33016
- !!config.apiUrl &&
33017
- transaction !== undefined &&
33018
- !isTransactionComplete &&
33019
- isInitialized,
33020
- refetchInterval(statusResponse) {
33021
- if (statusResponse &&
33022
- transactionEndStatuses.includes(getTransactionStatus(statusResponse) ?? "")) {
33023
- return false;
33024
- }
33025
- return refetchInterval;
33026
- },
33027
- retryDelay: getChainType(transaction?.fromChain) === ChainType.COSMOS ? 5000 : 3000,
33028
- retry: getChainType(transaction?.fromChain) === ChainType.COSMOS ? 6 : retry,
33029
- refetchOnWindowFocus,
33030
- onSuccess: (statusResponse) => {
33031
- WidgetEvents.getInstance().dispatchSwapStatus(statusResponse.squidTransactionStatus ?? "");
33032
- onStatus?.({
33033
- status: getTransactionStatus(statusResponse) ?? "",
33034
- statusResponse,
33035
- });
33036
- const endStatus = getTransactionEndStatus({ statusResponse });
33037
- if (endStatus) {
33038
- setIsTransactionComplete(true);
33039
- onEndStatus?.({ status: endStatus, statusResponse });
33040
- }
33041
- },
33042
- onError: (error) => {
33043
- if (is404Error(error.cause)) {
33044
- onNotFound?.();
33045
- return;
33046
- }
33047
- setRefetchInterval(-1);
33048
- setIsTransactionComplete(true);
33049
- onError?.();
33050
- },
33051
- });
33052
- return {
33053
- transactionStatusQuery,
33054
- };
33055
- };
33056
-
33057
- // Statuses that indicate the source deposit has been received and the swap is
33058
- // now progressing — the point at which it becomes a history-backed transaction.
33059
- const sourceReceivedStatuses = [
33060
- // Chainflip
33061
- "DEPOSIT_RECEIVED",
33062
- "BROADCAST_REQUESTED",
33063
- "COMPLETE",
33064
- // Canton (Squid Intents)
33065
- "awaiting",
33066
- "success",
33067
- ];
33068
- /**
33069
- * Tracks a generated deposit address before it becomes a persisted swap history item.
33070
- *
33071
- * Mirrors the hooks-first pattern of `useExecuteTransaction`: once the source deposit
33072
- * is received, it registers the transaction in the transaction + history stores, then
33073
- * signals the view (via `onReceived`) to navigate. The view never writes to the stores.
33074
- */
33075
- const useDepositTransactionStatus = ({ transaction, route, retry = 25, refetchOnWindowFocus = "always", enabled = true, onReceived, }) => {
33076
- const { fromChain, toChain } = useSwap();
33077
- const { addSwapTransaction } = useHistory();
33078
- const getTransaction = useTransactionStore((state) => state.getTransaction);
33079
- const setTransactionStoreState = useTransactionStore((state) => state.setTransactionState);
33080
- return useSwapStatusQuery({
33081
- transaction,
33082
- retry,
33083
- refetchOnWindowFocus,
33084
- enabled,
33085
- onStatus: ({ status }) => {
33086
- if (!sourceReceivedStatuses.includes(status))
33087
- return;
33088
- if (!transaction?.transactionId || !route?.transactionRequest)
33089
- return;
33090
- const txLocalId = transaction.transactionId;
33091
- if (getTransaction(txLocalId))
33092
- return;
33093
- useTransactionStore.setState({
33094
- txLocalId,
33095
- currentTransaction: undefined,
33096
- });
33097
- const tx = {
33098
- routeType: route.transactionRequest.type,
33099
- fromChain,
33100
- toChain,
33101
- fromAddress: transaction.fromAddress,
33102
- transactionId: txLocalId,
33103
- transactionIdForStatus: transaction.transactionIdForStatus,
33104
- quoteId: transaction.quoteId ?? "",
33105
- status: TransactionStatus.ONGOING,
33106
- sourceStatus: TransactionStatus.SUCCESS,
33107
- timestamp: Date.now(),
33108
- };
33109
- setTransactionStoreState(txLocalId, tx);
33110
- addSwapTransaction({
33111
- ...tx,
33112
- params: route.params,
33113
- estimate: route.estimate,
33114
- });
33115
- onReceived?.();
33116
- },
33117
- });
33118
- };
33119
-
33120
33518
  const DEFAULT_PROVIDER_IMAGE_URL = "https://raw.githubusercontent.com/0xsquid/assets/main/images/webp128/providers/squid.webp";
33121
33519
  const AXELAR_PROVIDER_IMAGE_URL = "https://raw.githubusercontent.com/0xsquid/assets/main/images/webp128/providers/axelar.webp";
33122
33520
  const useEstimate = (squidRoute) => {
@@ -34176,13 +34574,13 @@ function bytesFromBase64(b64) {
34176
34574
  return arr;
34177
34575
  }
34178
34576
  helpers.bytesFromBase64 = bytesFromBase64;
34179
- const btoa = globalThis$1.btoa || ((bin) => globalThis$1.Buffer.from(bin, "binary").toString("base64"));
34577
+ const btoa$1 = globalThis$1.btoa || ((bin) => globalThis$1.Buffer.from(bin, "binary").toString("base64"));
34180
34578
  function base64FromBytes(arr) {
34181
34579
  const bin = [];
34182
34580
  arr.forEach((byte) => {
34183
34581
  bin.push(String.fromCharCode(byte));
34184
34582
  });
34185
- return btoa(bin.join(""));
34583
+ return btoa$1(bin.join(""));
34186
34584
  }
34187
34585
  helpers.base64FromBytes = base64FromBytes;
34188
34586
  function omitDefault(input) {
@@ -36435,7 +36833,7 @@ const useExecuteTransaction = (squidRoute) => {
36435
36833
  if (!route.params.fromAddress || !route.params.toAddress) {
36436
36834
  throw new Error("From or to address is required");
36437
36835
  }
36438
- const isDirectTransfer = isChainflipDepositRoute(route);
36836
+ const isDirectTransfer = isDepositRoute(route);
36439
36837
  // Means it's a transfer to a deposit address
36440
36838
  // Instead of a Swap/Contract call using a DEX like Jupiter
36441
36839
  if (isDirectTransfer) {
@@ -36446,7 +36844,7 @@ const useExecuteTransaction = (squidRoute) => {
36446
36844
  throw new Error("Deposit address is required");
36447
36845
  }
36448
36846
  const signature = await executeSolanaTransfer({
36449
- amount: BigInt(route.params.fromAmount ?? ""),
36847
+ amount: BigInt(route.params.fromAmount),
36450
36848
  target: depositData.depositAddress,
36451
36849
  signer: solanaSigner,
36452
36850
  connection: solanaConnection,
@@ -36456,7 +36854,7 @@ const useExecuteTransaction = (squidRoute) => {
36456
36854
  const txParams = setTransactionState({
36457
36855
  route,
36458
36856
  txHash,
36459
- transactionIdForStatus: depositData.statusTrackingId,
36857
+ transactionIdForStatus: depositData.chainflipStatusTrackingId,
36460
36858
  userAddress: sourceUserAddress,
36461
36859
  status: TransactionStatus.INITIAL_LOADING,
36462
36860
  sourceStatus: TransactionStatus.ONGOING,
@@ -36507,7 +36905,7 @@ const useExecuteTransaction = (squidRoute) => {
36507
36905
  }
36508
36906
  });
36509
36907
  const swapMutationBitcoin = useMutation(async ({ id, route }) => {
36510
- const { depositAddress, amount: sendAmount, statusTrackingId, } = useDepositAddressStore.getState().deposit ?? {};
36908
+ const { depositAddress, amount: sendAmount, chainflipStatusTrackingId, } = useDepositAddressStore.getState().deposit ?? {};
36511
36909
  if (!depositAddress) {
36512
36910
  throw new Error(`Invalid deposit address: ${depositAddress}`);
36513
36911
  }
@@ -36530,7 +36928,7 @@ const useExecuteTransaction = (squidRoute) => {
36530
36928
  txHash,
36531
36929
  // When bridging from Bitcoin we need to send the chainflipId to the status endpoint
36532
36930
  // instead of the Bitcoin transaction hash
36533
- transactionIdForStatus: statusTrackingId,
36931
+ transactionIdForStatus: chainflipStatusTrackingId,
36534
36932
  userAddress: sourceUserAddress,
36535
36933
  status: TransactionStatus.INITIAL_LOADING,
36536
36934
  sourceStatus: TransactionStatus.ONGOING,
@@ -36978,7 +37376,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36978
37376
  const squid = useSquidStore((state) => state.squid);
36979
37377
  const fallbackAddress = useSwapRoutePersistStore((store) => store.swapRoute?.fallbackAddress);
36980
37378
  const depositRefundAddress = useSwapRoutePersistStore((store) => store.swapRoute?.depositRefundAddress);
36981
- const { isDepositAddressActive } = useDepositAddress();
37379
+ const { isAvailableAsPaymentMethod, isEnabled: isDepositAddressEnabled } = useDepositAddress();
36982
37380
  const getRouteMutation = useGetRoute();
36983
37381
  const { fromChain, toChain, fromPrice, destinationAddress: { address: destinationAddress } = {}, fromToken, toToken, } = useSwap();
36984
37382
  const { connectedAddress: { address: sourceConnectedAddress }, } = useMultiChainWallet(fromChain);
@@ -36986,7 +37384,7 @@ refetchIntervalInBackground = false, refetchInterval = 30000, quoteOnly = true,
36986
37384
  // Tokens will be sent to this address in case of swap failure
36987
37385
  //
36988
37386
  // If deposit address is not selected, we use the connected address as the source address instead
36989
- const sourceUserAddress = isDepositAddressActive
37387
+ const sourceUserAddress = isDepositAddressEnabled && isAvailableAsPaymentMethod
36990
37388
  ? depositRefundAddress ?? sourceConnectedAddress
36991
37389
  : sourceConnectedAddress;
36992
37390
  const squidRouteQueryKeys = 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), [
@@ -37131,50 +37529,94 @@ function useSendTransactionStatus({ chain, txHash, }) {
37131
37529
  * Fetch status of a Swap transaction
37132
37530
  */
37133
37531
  const useSwapTransactionStatus = ({ transaction, retry = 25, refetchOnWindowFocus = "always", enabled = true, }) => {
37532
+ const config = useConfigStore((state) => state.config);
37533
+ const isInitialized = useConfigStore((state) => state.isInitialized);
37134
37534
  const { replaceSwapTransactionStatus } = useHistory();
37135
37535
  const findTransaction = useHistoryStore((state) => state.findTransaction);
37536
+ const [isTransactionComplete, setIsTransactionComplete] = useState(false);
37537
+ const [refetchInterval, setRefetchInterval] = useState(getSwapTxStatusRefetchInterval(transaction));
37538
+ const { getChainType } = useSquidChains();
37136
37539
  const currentHistoryItem = useMemo(() => findTransaction({
37137
37540
  transactionId: transaction?.transactionId,
37138
37541
  txType: HistoryTxType.SWAP,
37139
37542
  }), [findTransaction, transaction?.transactionId]);
37140
- const transactionStatusQuery = useSwapStatusQuery({
37141
- transaction,
37142
- retry,
37143
- refetchOnWindowFocus,
37543
+ /**
37544
+ * Transaction status endpoint
37545
+ * Squid api is using axelar endpoint and parsing the response
37546
+ * @returns {StatusResponse} Status response
37547
+ */
37548
+ const fetchTransactionStatusWithLatestConfig = useCallback(async () => {
37549
+ const latestConfig = useConfigStore.getState().config;
37550
+ return fetchSwapTransactionStatus({
37551
+ transaction,
37552
+ integratorId: latestConfig.integratorId,
37553
+ apiUrl: latestConfig.apiUrl,
37554
+ });
37555
+ }, [transaction]);
37556
+ const transactionStatusQuery = useQuery(keys().swapTransactionStatus(transaction?.transactionId), fetchTransactionStatusWithLatestConfig, {
37144
37557
  enabled: enabled &&
37558
+ transaction?.transactionId !== "0" &&
37559
+ !!transaction?.transactionId &&
37560
+ !!transaction.fromAddress &&
37561
+ !!config.apiUrl &&
37562
+ transaction !== undefined &&
37563
+ !isTransactionComplete &&
37564
+ isInitialized &&
37145
37565
  !!currentHistoryItem &&
37146
37566
  !isHistoryTransactionEnded({
37147
37567
  data: currentHistoryItem?.data,
37148
37568
  txType: HistoryTxType.SWAP,
37149
37569
  }),
37150
- onEndStatus: ({ status, statusResponse }) => {
37151
- if (!transaction?.transactionId)
37152
- return;
37153
- replaceSwapTransactionStatus({
37154
- transactionId: transaction.transactionId,
37155
- statusResponse,
37156
- status,
37157
- });
37570
+ refetchInterval(statusResponse) {
37571
+ // If the status response is something telling that the transaction
37572
+ // is finished, then store transaction history state if success
37573
+ // And return false to indicate refetcher to stop
37574
+ if (statusResponse &&
37575
+ transactionEndStatuses.includes(getTransactionStatus(statusResponse) ?? "")) {
37576
+ return false;
37577
+ }
37578
+ return refetchInterval; // Had to handle a variable here because after onError, we want the interval to stop
37158
37579
  },
37159
- onNotFound: () => {
37160
- if (!transaction?.transactionId)
37161
- return;
37162
- replaceSwapTransactionStatus({
37163
- transactionId: transaction.transactionId,
37164
- statusResponse: undefined,
37165
- status: TransactionStatus.NOT_FOUND,
37166
- });
37580
+ // At the moment Cosmos indexing takes more time, so need more time between retries
37581
+ retryDelay: getChainType(transaction?.fromChain) === ChainType.COSMOS ? 5000 : 3000,
37582
+ retry: getChainType(transaction?.fromChain) === ChainType.COSMOS ? 6 : retry,
37583
+ refetchOnWindowFocus,
37584
+ onSuccess: (statusResponse) => {
37585
+ // Dispatch event
37586
+ WidgetEvents.getInstance().dispatchSwapStatus(statusResponse.squidTransactionStatus ?? "");
37587
+ const endStatus = getTransactionEndStatus({ statusResponse });
37588
+ if (endStatus && transaction?.transactionId) {
37589
+ setIsTransactionComplete(true);
37590
+ replaceSwapTransactionStatus({
37591
+ transactionId: transaction.transactionId,
37592
+ statusResponse,
37593
+ status: endStatus,
37594
+ });
37595
+ }
37167
37596
  },
37168
- onError: () => {
37597
+ onError: (error) => {
37598
+ // `fetchTransactionStatus` throws an error with a cause being an AxiosError
37599
+ const is404 = is404Error(error.cause);
37169
37600
  if (!transaction?.transactionId)
37170
37601
  return;
37171
- replaceSwapTransactionStatus({
37172
- transactionId: transaction.transactionId,
37173
- statusResponse: undefined,
37174
- status: TransactionStatus.ERROR,
37175
- });
37602
+ if (is404) {
37603
+ replaceSwapTransactionStatus({
37604
+ transactionId: transaction.transactionId,
37605
+ statusResponse: undefined,
37606
+ status: TransactionStatus.NOT_FOUND,
37607
+ });
37608
+ }
37609
+ else {
37610
+ setRefetchInterval(-1);
37611
+ setIsTransactionComplete(true);
37612
+ replaceSwapTransactionStatus({
37613
+ transactionId: transaction.transactionId,
37614
+ statusResponse: undefined,
37615
+ status: TransactionStatus.ERROR,
37616
+ });
37617
+ }
37176
37618
  },
37177
- }).transactionStatusQuery;
37619
+ });
37178
37620
  return {
37179
37621
  transactionStatusQuery,
37180
37622
  latestStatus: transactionStatusQuery.data
@@ -37385,6 +37827,430 @@ const useIntegratorContext = () => {
37385
37827
  return { walletHandledExternally, isEmbed, widgetInIframe };
37386
37828
  };
37387
37829
 
37830
+ function wrapSignatureError({ chainType, message, error, }) {
37831
+ if (error instanceof WalletVerificationSignatureError) {
37832
+ throw error;
37833
+ }
37834
+ throw new WalletVerificationSignatureError({
37835
+ code: WalletVerificationSignatureErrorCode.SIGNATURE_REJECTED,
37836
+ chainType,
37837
+ message,
37838
+ cause: error,
37839
+ });
37840
+ }
37841
+ function getEvmAddress({ connectedWallets, walletClient, wagmiAddress, }) {
37842
+ return (connectedWallets[ChainType.EVM].address ??
37843
+ walletClient?.account?.address ??
37844
+ wagmiAddress);
37845
+ }
37846
+
37847
+ function createBitcoinWalletVerificationSigner({ connectedWallets, }) {
37848
+ const bitcoinWallet = connectedWallets[ChainType.BTC].wallet;
37849
+ return {
37850
+ sign: async ({ message }) => {
37851
+ const bitcoinAddress = connectedWallets[ChainType.BTC].address;
37852
+ const bitcoinConnector = bitcoinWallet?.connector;
37853
+ const signMessage = bitcoinConnector?.signMessage;
37854
+ if (!bitcoinAddress) {
37855
+ throw new WalletVerificationSignatureError({
37856
+ code: WalletVerificationSignatureErrorCode.WALLET_NOT_CONNECTED,
37857
+ chainType: ChainType.BTC,
37858
+ message: "Connect a Bitcoin wallet before signing verification messages.",
37859
+ });
37860
+ }
37861
+ if (typeof signMessage !== "function") {
37862
+ throw new WalletVerificationSignatureError({
37863
+ code: WalletVerificationSignatureErrorCode.SIGNER_UNAVAILABLE,
37864
+ chainType: ChainType.BTC,
37865
+ message: "The connected Bitcoin wallet does not expose BIP-322 message signing.",
37866
+ });
37867
+ }
37868
+ try {
37869
+ const signature = await signMessage.call(bitcoinConnector, message);
37870
+ return buildBitcoinWalletVerificationSignatureResult({
37871
+ address: bitcoinAddress,
37872
+ message,
37873
+ signedPayload: bytesToBase64(encodeUtf8(message)),
37874
+ signature,
37875
+ signedPayloadEncoding: "base64",
37876
+ });
37877
+ }
37878
+ catch (error) {
37879
+ wrapSignatureError({
37880
+ chainType: ChainType.BTC,
37881
+ message: "Failed to sign Bitcoin wallet verification message.",
37882
+ error,
37883
+ });
37884
+ }
37885
+ },
37886
+ };
37887
+ }
37888
+
37889
+ function createCosmosWalletVerificationSigner({ connectedWallets, }) {
37890
+ const cosmosWallet = connectedWallets[ChainType.COSMOS].wallet;
37891
+ return {
37892
+ sign: async ({ message, chainId }) => {
37893
+ const cosmosAddress = connectedWallets[ChainType.COSMOS].address;
37894
+ const provider = cosmosWallet?.connector?.().provider;
37895
+ const signArbitrary = provider?.signArbitrary;
37896
+ const getKey = provider?.getKey;
37897
+ if (!cosmosAddress) {
37898
+ throw new WalletVerificationSignatureError({
37899
+ code: WalletVerificationSignatureErrorCode.WALLET_NOT_CONNECTED,
37900
+ chainType: ChainType.COSMOS,
37901
+ message: "Connect a Cosmos wallet before signing verification messages.",
37902
+ });
37903
+ }
37904
+ if (typeof signArbitrary !== "function" || typeof getKey !== "function") {
37905
+ throw new WalletVerificationSignatureError({
37906
+ code: WalletVerificationSignatureErrorCode.SIGNER_UNAVAILABLE,
37907
+ chainType: ChainType.COSMOS,
37908
+ message: "The connected Cosmos wallet does not expose ADR-36 message signing.",
37909
+ });
37910
+ }
37911
+ try {
37912
+ const [signed, key] = await Promise.all([
37913
+ signArbitrary.call(provider, chainId, cosmosAddress, message),
37914
+ getKey.call(provider, chainId),
37915
+ ]);
37916
+ return buildCosmosWalletVerificationSignatureResult({
37917
+ address: cosmosAddress,
37918
+ message,
37919
+ signedPayload: bytesToBase64(encodeUtf8(message)),
37920
+ signature: signed.signature,
37921
+ publicKey: base64StringOrBytes(signed.pub_key?.value ?? key.pubKey),
37922
+ publicKeyEncoding: "base64",
37923
+ signedPayloadEncoding: "base64",
37924
+ });
37925
+ }
37926
+ catch (error) {
37927
+ wrapSignatureError({
37928
+ chainType: ChainType.COSMOS,
37929
+ message: "Failed to sign Cosmos wallet verification message.",
37930
+ error,
37931
+ });
37932
+ }
37933
+ },
37934
+ };
37935
+ }
37936
+
37937
+ function createEvmWalletVerificationSigner(params) {
37938
+ const { connectedWallets, walletClient, wagmiAddress } = params;
37939
+ return {
37940
+ sign: async ({ message }) => {
37941
+ const resolvedAddress = getEvmAddress({
37942
+ connectedWallets,
37943
+ walletClient,
37944
+ wagmiAddress,
37945
+ });
37946
+ if (!resolvedAddress) {
37947
+ throw new WalletVerificationSignatureError({
37948
+ code: WalletVerificationSignatureErrorCode.WALLET_NOT_CONNECTED,
37949
+ chainType: ChainType.EVM,
37950
+ message: "Connect an EVM wallet before signing verification messages.",
37951
+ });
37952
+ }
37953
+ if (typeof walletClient?.signMessage !== "function") {
37954
+ throw new WalletVerificationSignatureError({
37955
+ code: WalletVerificationSignatureErrorCode.SIGNER_UNAVAILABLE,
37956
+ chainType: ChainType.EVM,
37957
+ message: "The connected EVM wallet does not expose message signing.",
37958
+ });
37959
+ }
37960
+ try {
37961
+ const signature = await walletClient.signMessage({
37962
+ account: resolvedAddress,
37963
+ message,
37964
+ });
37965
+ return buildWalletVerificationSignatureResult({
37966
+ address: resolvedAddress,
37967
+ message,
37968
+ signature,
37969
+ });
37970
+ }
37971
+ catch (error) {
37972
+ wrapSignatureError({
37973
+ chainType: ChainType.EVM,
37974
+ message: "Failed to sign EVM wallet verification message.",
37975
+ error,
37976
+ });
37977
+ }
37978
+ },
37979
+ };
37980
+ }
37981
+
37982
+ function createSolanaWalletVerificationSigner({ connectedWallets, }) {
37983
+ const solanaWallet = connectedWallets[ChainType.SOLANA].wallet;
37984
+ return {
37985
+ sign: async ({ message }) => {
37986
+ const solanaAddress = connectedWallets[ChainType.SOLANA].address;
37987
+ const solanaConnector = solanaWallet?.connector;
37988
+ const [account] = solanaConnector?.wallet.accounts ?? [];
37989
+ const signMessage = solanaConnector?.wallet.features["solana:signMessage"]?.signMessage;
37990
+ if (!solanaAddress || !account) {
37991
+ throw new WalletVerificationSignatureError({
37992
+ code: WalletVerificationSignatureErrorCode.WALLET_NOT_CONNECTED,
37993
+ chainType: ChainType.SOLANA,
37994
+ message: "Connect a Solana wallet before signing verification messages.",
37995
+ });
37996
+ }
37997
+ if (typeof signMessage !== "function") {
37998
+ throw new WalletVerificationSignatureError({
37999
+ code: WalletVerificationSignatureErrorCode.SIGNER_UNAVAILABLE,
38000
+ chainType: ChainType.SOLANA,
38001
+ message: "The connected Solana wallet does not expose message signing.",
38002
+ });
38003
+ }
38004
+ try {
38005
+ const [signed] = await signMessage({
38006
+ account,
38007
+ message: encodeUtf8(message),
38008
+ });
38009
+ if (!signed) {
38010
+ throw new Error("Solana wallet did not return a signature.");
38011
+ }
38012
+ return buildSolanaWalletVerificationSignatureResult({
38013
+ address: solanaAddress,
38014
+ message,
38015
+ signedPayload: bytesToBase64(signed.signedMessage),
38016
+ signature: bytesToBase64(signed.signature),
38017
+ publicKey: account.address,
38018
+ publicKeyEncoding: "base58",
38019
+ signedPayloadEncoding: "base64",
38020
+ });
38021
+ }
38022
+ catch (error) {
38023
+ wrapSignatureError({
38024
+ chainType: ChainType.SOLANA,
38025
+ message: "Failed to sign Solana wallet verification message.",
38026
+ error,
38027
+ });
38028
+ }
38029
+ },
38030
+ };
38031
+ }
38032
+
38033
+ function createStellarWalletVerificationSigner({ connectedWallets, }) {
38034
+ const stellarWallet = connectedWallets[ChainType.STELLAR].wallet;
38035
+ return {
38036
+ sign: async ({ message, networkPassphrase }) => {
38037
+ const stellarAddress = connectedWallets[ChainType.STELLAR].address;
38038
+ const stellarConnector = stellarWallet?.connector;
38039
+ const signMessage = stellarConnector?.signMessage;
38040
+ if (!stellarAddress) {
38041
+ throw new WalletVerificationSignatureError({
38042
+ code: WalletVerificationSignatureErrorCode.WALLET_NOT_CONNECTED,
38043
+ chainType: ChainType.STELLAR,
38044
+ message: "Connect a Stellar wallet before signing verification messages.",
38045
+ });
38046
+ }
38047
+ if (typeof signMessage !== "function") {
38048
+ throw new WalletVerificationSignatureError({
38049
+ code: WalletVerificationSignatureErrorCode.SIGNER_UNAVAILABLE,
38050
+ chainType: ChainType.STELLAR,
38051
+ message: "The connected Stellar wallet does not expose message signing.",
38052
+ });
38053
+ }
38054
+ try {
38055
+ const network = networkPassphrase == null && stellarConnector?.getNetwork
38056
+ ? await stellarConnector.getNetwork().catch(() => undefined)
38057
+ : undefined;
38058
+ const resolvedNetworkPassphrase = networkPassphrase ?? network?.networkPassphrase;
38059
+ const signedPayload = bytesToBase64(encodeUtf8(message));
38060
+ const signed = await signMessage.call(stellarConnector, signedPayload, {
38061
+ address: stellarAddress,
38062
+ networkPassphrase: resolvedNetworkPassphrase,
38063
+ });
38064
+ const resolvedSignerAddress = signed.signerAddress ??
38065
+ (await stellarConnector
38066
+ ?.getAddress?.()
38067
+ .then(({ address }) => address)
38068
+ .catch(() => undefined));
38069
+ if (resolvedSignerAddress && resolvedSignerAddress !== stellarAddress) {
38070
+ throw new WalletVerificationSignatureError({
38071
+ code: WalletVerificationSignatureErrorCode.ACTIVE_ACCOUNT_MISMATCH,
38072
+ chainType: ChainType.STELLAR,
38073
+ message: "The Stellar wallet signed with a different active account. Reconnect the Stellar wallet and try again.",
38074
+ });
38075
+ }
38076
+ return buildStellarWalletVerificationSignatureResult({
38077
+ address: stellarAddress,
38078
+ message,
38079
+ signedPayload,
38080
+ signature: normalizeBase64Ed25519Signature(signed.signedMessage),
38081
+ publicKey: resolvedSignerAddress ?? stellarAddress,
38082
+ publicKeyEncoding: "base32",
38083
+ signedPayloadEncoding: "base64",
38084
+ signerAddress: resolvedSignerAddress,
38085
+ });
38086
+ }
38087
+ catch (error) {
38088
+ wrapSignatureError({
38089
+ chainType: ChainType.STELLAR,
38090
+ message: "Failed to sign Stellar wallet verification message.",
38091
+ error,
38092
+ });
38093
+ }
38094
+ },
38095
+ };
38096
+ }
38097
+
38098
+ function createSuiWalletVerificationSigner({ connectedWallets, }) {
38099
+ const suiWallet = connectedWallets[ChainType.SUI].wallet;
38100
+ return {
38101
+ sign: async ({ message }) => {
38102
+ const suiAddress = connectedWallets[ChainType.SUI].address;
38103
+ const suiAccount = connectedWallets[ChainType.SUI].account;
38104
+ const signPersonalMessage = suiWallet?.connector.signPersonalMessage;
38105
+ if (!suiAddress || !suiAccount) {
38106
+ throw new WalletVerificationSignatureError({
38107
+ code: WalletVerificationSignatureErrorCode.WALLET_NOT_CONNECTED,
38108
+ chainType: ChainType.SUI,
38109
+ message: "Connect a Sui wallet before signing verification messages.",
38110
+ });
38111
+ }
38112
+ if (typeof signPersonalMessage !== "function") {
38113
+ throw new WalletVerificationSignatureError({
38114
+ code: WalletVerificationSignatureErrorCode.SIGNER_UNAVAILABLE,
38115
+ chainType: ChainType.SUI,
38116
+ message: "The connected Sui wallet does not expose personal message signing.",
38117
+ });
38118
+ }
38119
+ try {
38120
+ const signed = await signPersonalMessage({
38121
+ account: suiAccount,
38122
+ message: encodeUtf8(message),
38123
+ });
38124
+ return buildSuiWalletVerificationSignatureResult({
38125
+ address: suiAddress,
38126
+ message,
38127
+ signedPayload: signed.bytes,
38128
+ signature: signed.signature,
38129
+ publicKey: suiAccount.publicKey
38130
+ ? bytesToBase64(suiAccount.publicKey)
38131
+ : undefined,
38132
+ publicKeyEncoding: "base64",
38133
+ signedPayloadEncoding: "base64",
38134
+ });
38135
+ }
38136
+ catch (error) {
38137
+ wrapSignatureError({
38138
+ chainType: ChainType.SUI,
38139
+ message: "Failed to sign Sui wallet verification message.",
38140
+ error,
38141
+ });
38142
+ }
38143
+ },
38144
+ };
38145
+ }
38146
+
38147
+ function createXrplWalletVerificationSigner({ connectedWallets, }) {
38148
+ const xrplWallet = connectedWallets[ChainType.XRPL].wallet;
38149
+ return {
38150
+ sign: async ({ message }) => {
38151
+ const xrplAddress = connectedWallets[ChainType.XRPL].address;
38152
+ const xrplConnector = xrplWallet?.connector;
38153
+ const signOwnershipMessage = xrplConnector?.signOwnershipMessage;
38154
+ if (!xrplAddress) {
38155
+ throw new WalletVerificationSignatureError({
38156
+ code: WalletVerificationSignatureErrorCode.WALLET_NOT_CONNECTED,
38157
+ chainType: ChainType.XRPL,
38158
+ message: "Connect an XRPL wallet before signing verification messages.",
38159
+ });
38160
+ }
38161
+ if (typeof signOwnershipMessage !== "function") {
38162
+ throw new WalletVerificationSignatureError({
38163
+ code: WalletVerificationSignatureErrorCode.SIGNER_UNAVAILABLE,
38164
+ chainType: ChainType.XRPL,
38165
+ message: "The connected XRPL wallet does not expose ownership message signing.",
38166
+ });
38167
+ }
38168
+ try {
38169
+ const signed = await signOwnershipMessage.call(xrplConnector, {
38170
+ address: xrplAddress,
38171
+ message,
38172
+ });
38173
+ return buildXrplWalletVerificationSignatureResult({
38174
+ address: xrplAddress,
38175
+ message,
38176
+ signedPayload: signed.signedPayload,
38177
+ signature: signed.signature,
38178
+ publicKey: signed.publicKey,
38179
+ publicKeyEncoding: signed.publicKeyEncoding,
38180
+ signedPayloadEncoding: signed.signedPayloadEncoding,
38181
+ signatureType: signed.signatureType,
38182
+ signerAddress: signed.signerAddress,
38183
+ });
38184
+ }
38185
+ catch (error) {
38186
+ wrapSignatureError({
38187
+ chainType: ChainType.XRPL,
38188
+ message: "Failed to sign XRPL wallet verification message.",
38189
+ error,
38190
+ });
38191
+ }
38192
+ },
38193
+ cancel: () => {
38194
+ xrplWallet?.connector.cancelSignOwnershipMessage?.();
38195
+ },
38196
+ };
38197
+ }
38198
+
38199
+ function createWalletVerificationSigners(params) {
38200
+ return {
38201
+ [ChainType.EVM]: createEvmWalletVerificationSigner(params),
38202
+ [ChainType.COSMOS]: createCosmosWalletVerificationSigner(params),
38203
+ [ChainType.BTC]: createBitcoinWalletVerificationSigner(params),
38204
+ [ChainType.SOLANA]: createSolanaWalletVerificationSigner(params),
38205
+ [ChainType.SUI]: createSuiWalletVerificationSigner(params),
38206
+ [ChainType.XRPL]: createXrplWalletVerificationSigner(params),
38207
+ [ChainType.STELLAR]: createStellarWalletVerificationSigner(params),
38208
+ };
38209
+ }
38210
+
38211
+ const useWalletVerificationSignature = () => {
38212
+ const connectedWallets = useWalletStore((store) => store.connectedWalletsByChainType);
38213
+ const { address: wagmiAddress, connector: activeConnector } = useAccount();
38214
+ const evmWallet = connectedWallets[ChainType.EVM].wallet;
38215
+ const evmConnector = evmWallet?.connector ?? activeConnector;
38216
+ const { data: walletClient } = useWalletClient({ connector: evmConnector });
38217
+ const signers = useMemo(() => createWalletVerificationSigners({
38218
+ connectedWallets,
38219
+ walletClient,
38220
+ wagmiAddress,
38221
+ }), [connectedWallets, wagmiAddress, walletClient]);
38222
+ const signVerificationMessage = useCallback(async (request) => {
38223
+ assertWalletVerificationSigningRequest(request);
38224
+ const signer = signers[request.chainType];
38225
+ if (!signer) {
38226
+ throw new WalletVerificationSignatureError({
38227
+ code: WalletVerificationSignatureErrorCode.UNSUPPORTED_CHAIN_TYPE,
38228
+ chainType: request.chainType,
38229
+ message: "Unsupported wallet verification chain type.",
38230
+ });
38231
+ }
38232
+ return signer.sign(request);
38233
+ }, [signers]);
38234
+ const cancelSignVerificationMessage = useCallback(({ chainType } = {}) => {
38235
+ if (!chainType) {
38236
+ return;
38237
+ }
38238
+ signers[chainType]?.cancel?.();
38239
+ }, [signers]);
38240
+ const signVerificationMessageMutation = useMutation({
38241
+ mutationFn: signVerificationMessage,
38242
+ });
38243
+ return {
38244
+ signatureTypes: WALLET_VERIFICATION_SIGNATURE_TYPE_BY_CHAIN_TYPE,
38245
+ supportedChainTypes: Object.values(ChainType),
38246
+ signVerificationMessage: signVerificationMessageMutation.mutateAsync,
38247
+ cancelSignVerificationMessage,
38248
+ isSigning: signVerificationMessageMutation.isLoading,
38249
+ error: signVerificationMessageMutation.error,
38250
+ reset: signVerificationMessageMutation.reset,
38251
+ };
38252
+ };
38253
+
37388
38254
  /**
37389
38255
  * Maximum IOU amount on XRPL
37390
38256
  * @see https://xrpl.org/docs/references/protocol/data-types/currency-formats#comparison
@@ -37573,10 +38439,8 @@ const SquidProvider = ({ children, config, placeholder, }) => {
37573
38439
  }
37574
38440
  if (assetsColorsResponse.status === "fulfilled") {
37575
38441
  useAssetsColorsStore.setState(assetsColorsResponse.value);
38442
+ initializeSquidWithAssetsColors(squid, assetsColorsResponse.value);
37576
38443
  }
37577
- initializeSquidData(squid, assetsColorsResponse.status === "fulfilled"
37578
- ? assetsColorsResponse.value
37579
- : undefined);
37580
38444
  const shouldResetSwapRouteStore =
37581
38445
  // reset swap route if specified in config
37582
38446
  !config?.loadPreviousStateFromLocalStorage ||
@@ -37653,5 +38517,5 @@ const SquidProvider = ({ children, config, placeholder, }) => {
37653
38517
  React.createElement(CosmosProvider, null, children)))))))))) : (placeholder);
37654
38518
  };
37655
38519
 
37656
- export { useDepositAddress as $, AxelarStatusResponseType as A, useHederaTokenAssociations as B, CHAIN_IDS as C, DEFAULT_LOCALE as D, useKeyboardNavigation as E, useSquidQueryClient as F, useSquid as G, HistoryTxType as H, useStellarAccountActivation as I, useStellarTrustLine as J, useAddressBookStore as K, useAssetsColorsStore as L, useFavoriteTokensStore as M, Nr as N, useHistoryStore as O, useSendTransactionStore as P, QueryKeys as Q, useConfigStore as R, SquidStatusErrorType as S, TransactionErrorType as T, useSquidStore as U, useSwapRoutePersistStore as V, Wo as W, XamanXrplNetwork as X, useTransactionStore as Y, ConnectingWalletStatus as Z, useWalletStore as _, WindowWalletFlag as a, useRecommendedQuote as a$, useSwap as a0, buildUrlSearchParamsFromSwapEvent as a1, parseInitialAssetsFromUrl as a2, useUrlSwapParams as a3, useAllConnectedWalletBalances as a4, useAllTokensWithBalanceForChainType as a5, useCosmosBalance as a6, useEvmBalance as a7, useMultiChainBalance as a8, useMultipleTokenPrices as a9, useSendTransactionStatus as aA, useSwapTransactionStatus as aB, useAvatar as aC, useHistory as aD, useDebouncedValue as aE, useAddToken as aF, useAutoConnect as aG, useEnsDataForAddress as aH, useEnsSearch as aI, useGnosisContext as aJ, useIsSameAddressAndGnosisContext as aK, useIntegratorContext as aL, useMultiChainWallet as aM, useSigner as aN, useWallet as aO, useWallets as aP, useXrplTrustLine as aQ, TX_STATUS_CONSTANTS as aR, FINAL_TRANSACTION_STATUSES as aS, useGetFiatQuote as aT, useGetOnRampConfig as aU, useExecuteFiatQuote as aV, useFiatOnRampTxStatus as aW, useFiatTransactions as aX, useCurrencyDetails as aY, useCountryDetails as aZ, useAvailableQuotes as a_, useBitcoinNativeBalance as aa, useCosmosNativeBalance as ab, useEvmNativeBalance as ac, useNativeBalance as ad, useSolanaNativeBalance as ae, useStellarNativeBalance as af, useSuiNativeBalance as ag, useXrplNativeBalance as ah, useNativeTokenForChain as ai, useSingleTokenPrice as aj, useSourceChainGasToken as ak, useSquidTokens as al, useHistoricalData as am, useTokensData as an, useEstimateSendTransaction as ao, useSendTransaction as ap, useSendTransactionGas as aq, useAllTransactionsStatus as ar, useApproval as as, useDepositTransactionStatus as at, useEstimate as au, useEstimatePriceImpact as av, useExecuteTransaction as aw, useGetRoute as ax, useGetRouteWrapper as ay, useRouteWarnings as az, chainTypeToZeroAddressMap as b, parseEvmAddress as b$, useGetOnrampPaymentTypes as b0, useSuggestedFiatAmounts as b1, SquidProvider as b2, EnsService as b3, getXummClient as b4, isXamanXAppContext as b5, getQueryHeaders as b6, getStatusCode as b7, is404Error as b8, assetsBaseUrl as b9, getTokensForChain as bA, getFirstAvailableChainId as bB, fetchHighestBalanceToken as bC, getInitialOrDefaultTokenAddressForChain as bD, getInitialTokenAddressForChain as bE, filterTokensForDestination as bF, getInitialChainIdFromConfig as bG, getCosmosKey as bH, getKeysSettled as bI, getAllKeysForSupportedCosmosChains as bJ, isCosmosAddressValid as bK, getCosmosSigningClient as bL, getCosmosChainInfosObject as bM, connectCosmosWallet as bN, isFallbackAddressNeeded as bO, suggestChainOrThrow as bP, normalizeError as bQ, transactionErrorCode as bR, isUserRejectionError as bS, getTransactionError as bT, handleTransactionErrorEvents as bU, isSwapRouteError as bV, isStatusError as bW, createQuoteRequestParamsHash as bX, WidgetEvents as bY, EvmNetworkNotSupportedErrorCode as bZ, addEthereumChain as b_, shareSubgraphId as ba, sortTokensBySharedSubgraphIds as bb, getSupportedChainIdsForDirection as bc, filterChains as bd, filterTokens as be, getTokenImage as bf, getNewSwapParamsFromInput as bg, sortAllTokens as bh, findToken as bi, findNativeToken as bj, normalizeIbcAddress as bk, groupTokensBySymbol as bl, groupTokensByChainId as bm, filterViewableTokens as bn, getSecretNetworkBalances as bo, getTokenAssetsKey as bp, fetchAssetsColors as bq, isSupportedChainType as br, initializeSquidData as bs, isEmptyObject as bt, normalizeTokenSymbol as bu, areTokenSymbolsCompatible as bv, isEvmosChain as bw, resolveChainIdFromAsset as bx, getConfigWithDefaults as by, randomIntFromInterval as bz, chainTypeToNativeTokenAddressMap as c, getBridgeType as c$, formatEvmWallet as c0, filterWagmiConnector as c1, waitForReceiptWithRetry as c2, getUserCountry as c3, getCountryData as c4, getCurrencyData as c5, adaptiveRound as c6, getSuggestedAmountsForCurrency as c7, HederaExtensionHelper as c8, convertHederaAccountIdToEvmAddress as c9, getStellarHorizonApiUrl as cA, isValidIssuedAsset as cB, isValidHorizonAsset as cC, formatTransactionHistoryDate as cD, getAxelarExplorerTxUrl as cE, getSourceExplorerTxUrl as cF, getMainExplorerUrl as cG, formatDistance as cH, formatSeconds as cI, formatSwapTxStatusResponseForStorage as cJ, simplifyRouteAction as cK, fetchSwapTransactionStatus as cL, compareTransactionIds as cM, isCoralBridgeAction as cN, isActionCompletedOnSourceTx as cO, sleep as cP, isChainflipDepositRoute as cQ, isChainflipBridgeTransaction as cR, isOnChainTxData as cS, isDepositAddressDirectTransferRoute as cT, getHistoryTransactionId as cU, getStepStatuses as cV, getHalfSuccessState as cW, getStepsInfos as cX, getSwapTxStatusRefetchInterval as cY, getSendTxStatusRefetchInterval as cZ, chainflipMultihopBridgeType as c_, convertEvmAddressToHederaAccountId as ca, scaleHbarToWei as cb, scaleWeiToHbar as cc, parseToBigInt as cd, roundNumericValue as ce, formatUnitsRounded as cf, formatTokenAmount as cg, formatUsdAmount as ch, trimExtraDecimals as ci, getNumericValue as cj, cleanAmount as ck, convertTokenAmountToUSD as cl, convertUSDToTokenAmount as cm, calculateTotal24hChange as cn, getRouteExpiry as co, searchTokens as cp, filterSolanaWallets as cq, isSolanaAddressValid as cr, executeSolanaSwap as cs, executeSolanaTransfer as ct, isStellarAddressValid as cu, getStellarNetwork as cv, stellarAddressToScVal as cw, getStellarTrustLineAsset as cx, isStellarToken as cy, isStellarIssuedToken as cz, definedInWindow as d, getTransactionStatus as d0, getTransactionEndStatus as d1, isHistoryTransactionPending as d2, isHistoryTransactionFailed as d3, isHistoryTransactionWarning as d4, isHistoryTransactionEnded as d5, formatHash as d6, isWalletAddressValid as d7, redirectToExtensionsStore as d8, accessProperty as d9, populateWallets as da, getDefaultChain as db, sortWallets as dc, areSameAddress as dd, sortAddressBook as de, calculateTotalUsdBalanceUSD as df, addTokenToWallet as dg, isEvmChainNotSupportedError as dh, getWalletSupportedChainTypes as di, getConnectorForChainType as dj, walletSupportsChainType as dk, connectWallet as dl, cancelConnectWallet as dm, isProblematicConnector as dn, mergeWallets as dp, isXionSmartContractAddress as dq, isXrplAddressValid as dr, buildXrplTrustSetTx as ds, getXrplNetwork as dt, parseXrplPaymentTx as du, parseXrplTokenAddress as dv, er as e, formatBNToReadable as f, DEFAULT_ROUTE_REFETCH_INTERVAL as g, destinationAddressResetValue as h, fallbackAddressResetValue as i, nativeCosmosTokenAddress as j, nativeEvmTokenAddress as k, nativeSolanaTokenAddress as l, nativeStellarTokenAddress as m, nativeBitcoinTokenAddress as n, nativeSuiTokenAddress as o, nativeXrplTokenAddress as p, CosmosProvider as q, SendTransactionStatus as r, TransactionStatus as s, useTrackSearchEmpty as t, useCosmosContext as u, useSquidChains as v, walletIconBaseUrl as w, useClient as x, useCosmosForChain as y, useHederaAccountActivation as z };
37657
- //# sourceMappingURL=index-D5QOR7JT.js.map
38520
+ export { useStellarAccountActivation as $, AxelarStatusResponseType as A, assertWalletVerificationSigningRequest as B, CHAIN_IDS as C, DEFAULT_LOCALE as D, assertEvmVerificationSigningRequest as E, buildSolanaWalletVerificationSignatureResult as F, buildStellarWalletVerificationSignatureResult as G, HistoryTxType as H, buildSuiWalletVerificationSignatureResult as I, WalletVerificationSignatureErrorCode as J, WalletVerificationSignatureError as K, buildXrplWalletVerificationSignatureResult as L, useTrackSearchEmpty as M, Nr as N, useSquidChains as O, useClient as P, QueryKeys as Q, useCosmosForChain as R, SquidStatusErrorType as S, TransactionErrorType as T, useHederaAccountActivation as U, useHederaTokenAssociations as V, Wo as W, XamanXrplNetwork as X, useKeyboardNavigation as Y, useSquidQueryClient as Z, useSquid as _, WindowWalletFlag as a, useWalletVerificationSignature as a$, useStellarTrustLine as a0, useAddressBookStore as a1, useAssetsColorsStore as a2, useFavoriteTokensStore as a3, useHistoryStore as a4, useSendTransactionStore as a5, useConfigStore as a6, useSquidStore as a7, useSwapRoutePersistStore as a8, useTransactionStore as a9, useTokensData as aA, useEstimateSendTransaction as aB, useSendTransaction as aC, useSendTransactionGas as aD, useAllTransactionsStatus as aE, useApproval as aF, useEstimate as aG, useEstimatePriceImpact as aH, useExecuteTransaction as aI, useGetRoute as aJ, useGetRouteWrapper as aK, useRouteWarnings as aL, useSendTransactionStatus as aM, useSwapTransactionStatus as aN, useAvatar as aO, useHistory as aP, useDebouncedValue as aQ, useAddToken as aR, useAutoConnect as aS, useEnsDataForAddress as aT, useEnsSearch as aU, useGnosisContext as aV, useIsSameAddressAndGnosisContext as aW, useIntegratorContext as aX, useMultiChainWallet as aY, useSigner as aZ, useWallet as a_, ConnectingWalletStatus as aa, useWalletStore as ab, useDepositAddress as ac, useSwap as ad, buildUrlSearchParamsFromSwapEvent as ae, parseInitialAssetsFromUrl as af, useUrlSwapParams as ag, useAllConnectedWalletBalances as ah, useAllTokensWithBalanceForChainType as ai, useCosmosBalance as aj, useEvmBalance as ak, useMultiChainBalance as al, useMultipleTokenPrices as am, useBitcoinNativeBalance as an, useCosmosNativeBalance as ao, useEvmNativeBalance as ap, useNativeBalance as aq, useSolanaNativeBalance as ar, useStellarNativeBalance as as, useSuiNativeBalance as at, useXrplNativeBalance as au, useNativeTokenForChain as av, useSingleTokenPrice as aw, useSourceChainGasToken as ax, useSquidTokens as ay, useHistoricalData as az, chainTypeToZeroAddressMap as b, connectCosmosWallet as b$, useWallets as b0, useXrplTrustLine as b1, TX_STATUS_CONSTANTS as b2, FINAL_TRANSACTION_STATUSES as b3, useGetFiatQuote as b4, useGetOnRampConfig as b5, useExecuteFiatQuote as b6, useFiatOnRampTxStatus as b7, useFiatTransactions as b8, useCurrencyDetails as b9, groupTokensByChainId as bA, filterViewableTokens as bB, getSecretNetworkBalances as bC, getTokenAssetsKey as bD, fetchAssetsColors as bE, initializeSquidWithAssetsColors as bF, isEmptyObject as bG, normalizeTokenSymbol as bH, areTokenSymbolsCompatible as bI, isEvmosChain as bJ, isBitcoinAddressValid as bK, resolveChainIdFromAsset as bL, getConfigWithDefaults as bM, randomIntFromInterval as bN, getTokensForChain as bO, getFirstAvailableChainId as bP, fetchHighestBalanceToken as bQ, getInitialOrDefaultTokenAddressForChain as bR, getInitialTokenAddressForChain as bS, filterTokensForDestination as bT, getInitialChainIdFromConfig as bU, getCosmosKey as bV, getKeysSettled as bW, getAllKeysForSupportedCosmosChains as bX, isCosmosAddressValid as bY, getCosmosSigningClient as bZ, getCosmosChainInfosObject as b_, useCountryDetails as ba, useAvailableQuotes as bb, useRecommendedQuote as bc, useGetOnrampPaymentTypes as bd, useSuggestedFiatAmounts as be, SquidProvider as bf, EnsService as bg, XAMAN_OWNERSHIP_CHALLENGE_MEMO_TYPE as bh, getXummClient as bi, isXamanXAppContext as bj, getQueryHeaders as bk, getStatusCode as bl, is404Error as bm, assetsBaseUrl as bn, shareSubgraphId as bo, sortTokensBySharedSubgraphIds as bp, getSupportedChainIdsForDirection as bq, filterChains as br, filterTokens as bs, getTokenImage as bt, getNewSwapParamsFromInput as bu, sortAllTokens as bv, findToken as bw, findNativeToken as bx, normalizeIbcAddress as by, groupTokensBySymbol as bz, chainTypeToNativeTokenAddressMap as c, formatSeconds as c$, isFallbackAddressNeeded as c0, suggestChainOrThrow as c1, normalizeError as c2, transactionErrorCode as c3, isUserRejectionError as c4, getTransactionError as c5, handleTransactionErrorEvents as c6, isSwapRouteError as c7, isStatusError as c8, createQuoteRequestParamsHash as c9, convertTokenAmountToUSD as cA, convertUSDToTokenAmount as cB, calculateTotal24hChange as cC, getRouteExpiry as cD, searchTokens as cE, filterSolanaWallets as cF, isSolanaAddressValid as cG, executeSolanaSwap as cH, executeSolanaTransfer as cI, isStellarAddressValid as cJ, getStellarNetwork as cK, stellarAddressToScVal as cL, getStellarTrustLineAsset as cM, isStellarToken as cN, isStellarIssuedToken as cO, getStellarHorizonApiUrl as cP, isValidIssuedAsset as cQ, isValidHorizonAsset as cR, filterSuiWallets as cS, isSuiAddressValid as cT, slushWebWalletData as cU, getSuiChain as cV, formatTransactionHistoryDate as cW, getAxelarExplorerTxUrl as cX, getSourceExplorerTxUrl as cY, getMainExplorerUrl as cZ, formatDistance as c_, WidgetEvents as ca, EvmNetworkNotSupportedErrorCode as cb, addEthereumChain as cc, parseEvmAddress as cd, isEvmAddressValid as ce, formatEvmWallet as cf, filterWagmiConnector as cg, waitForReceiptWithRetry as ch, getUserCountry as ci, getCountryData as cj, getCurrencyData as ck, adaptiveRound as cl, getSuggestedAmountsForCurrency as cm, HederaExtensionHelper as cn, convertHederaAccountIdToEvmAddress as co, convertEvmAddressToHederaAccountId as cp, scaleHbarToWei as cq, scaleWeiToHbar as cr, parseToBigInt as cs, roundNumericValue as ct, formatUnitsRounded as cu, formatTokenAmount as cv, formatUsdAmount as cw, trimExtraDecimals as cx, getNumericValue as cy, cleanAmount as cz, definedInWindow as d, formatSwapTxStatusResponseForStorage as d0, simplifyRouteAction as d1, fetchSwapTransactionStatus as d2, compareTransactionIds as d3, isCoralBridgeAction as d4, isActionCompletedOnSourceTx as d5, sleep as d6, isDepositRoute as d7, isChainflipBridgeTransaction as d8, isOnChainTxData as d9, isEvmChainNotSupportedError as dA, getWalletSupportedChainTypes as dB, getConnectorForChainType as dC, walletSupportsChainType as dD, connectWallet as dE, cancelConnectWallet as dF, isProblematicConnector as dG, mergeWallets as dH, isXionSmartContractAddress as dI, isXrplAddressValid as dJ, buildXrplTrustSetTx as dK, getXrplNetwork as dL, parseXrplPaymentTx as dM, parseXrplTokenAddress as dN, getHistoryTransactionId as da, getStepStatuses as db, getHalfSuccessState as dc, getStepsInfos as dd, getSwapTxStatusRefetchInterval as de, getSendTxStatusRefetchInterval as df, chainflipMultihopBridgeType as dg, getBridgeType as dh, getTransactionStatus as di, getTransactionEndStatus as dj, isHistoryTransactionPending as dk, isHistoryTransactionFailed as dl, isHistoryTransactionWarning as dm, isHistoryTransactionEnded as dn, formatHash as dp, isWalletAddressValid as dq, redirectToExtensionsStore as dr, accessProperty as ds, populateWallets as dt, getDefaultChain as du, sortWallets as dv, areSameAddress as dw, sortAddressBook as dx, calculateTotalUsdBalanceUSD as dy, addTokenToWallet as dz, er as e, formatBNToReadable as f, DEFAULT_ROUTE_REFETCH_INTERVAL as g, destinationAddressResetValue as h, fallbackAddressResetValue as i, nativeCosmosTokenAddress as j, nativeEvmTokenAddress as k, nativeSolanaTokenAddress as l, nativeStellarTokenAddress as m, nativeBitcoinTokenAddress as n, nativeSuiTokenAddress as o, nativeXrplTokenAddress as p, CosmosProvider as q, SendTransactionStatus as r, TransactionStatus as s, buildBitcoinWalletVerificationSignatureResult as t, useCosmosContext as u, WalletVerificationSignatureType as v, walletIconBaseUrl as w, WALLET_VERIFICATION_SIGNATURE_TYPE_BY_CHAIN_TYPE as x, buildCosmosWalletVerificationSignatureResult as y, buildWalletVerificationSignatureResult as z };
38521
+ //# sourceMappingURL=index-CtXS5uny.js.map