@0xsquid/react-hooks 8.10.1-beta-bitcoin-coralv2.0 → 8.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/canton/cantonConnector.d.ts +2 -1
- package/dist/core/canton/injectedCantonProvider.d.ts +31 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/hooks/canton/useCantonWallets.d.ts +4 -2
- package/dist/{index-Cw1rn5LQ.js → index-BzTFES6t.js} +204 -100
- package/dist/index-BzTFES6t.js.map +1 -0
- package/dist/{index-Dykfm_Bt.js → index-D5bkikGx.js} +204 -101
- package/dist/index-D5bkikGx.js.map +1 -0
- package/dist/{index.es-DQyW9YL5.js → index.es-DaKI7v5_.js} +2 -2
- package/dist/{index.es-DQyW9YL5.js.map → index.es-DaKI7v5_.js.map} +1 -1
- package/dist/{index.es-DspxF1i7.js → index.es-wL3I3c3h.js} +2 -2
- package/dist/{index.es-DspxF1i7.js.map → index.es-wL3I3c3h.js.map} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/{secretService-C_gWAduF.js → secretService-BMH_eXJd.js} +2 -2
- package/dist/{secretService-C_gWAduF.js.map → secretService-BMH_eXJd.js.map} +1 -1
- package/dist/{secretService-6H3XQVCV.js → secretService-D70MRo5w.js} +2 -2
- package/dist/{secretService-6H3XQVCV.js.map → secretService-D70MRo5w.js.map} +1 -1
- package/dist/services/internal/cantonService.d.ts +17 -1
- package/dist/{stellarService.client-BdMbbog4.js → stellarService.client-BpCW1qZY.js} +2 -2
- package/dist/{stellarService.client-BdMbbog4.js.map → stellarService.client-BpCW1qZY.js.map} +1 -1
- package/dist/{stellarService.client-CElL9N4g.js → stellarService.client-DhwF4F1c.js} +2 -2
- package/dist/{stellarService.client-CElL9N4g.js.map → stellarService.client-DhwF4F1c.js.map} +1 -1
- package/dist/tests/injectedCantonProvider.test.d.ts +1 -0
- package/package.json +1 -1
- package/dist/index-Cw1rn5LQ.js.map +0 -1
- package/dist/index-Dykfm_Bt.js.map +0 -1
|
@@ -3442,7 +3442,7 @@ function get$1(object, path, defaultValue) {
|
|
|
3442
3442
|
|
|
3443
3443
|
var get_1 = get$1;
|
|
3444
3444
|
|
|
3445
|
-
var
|
|
3445
|
+
var getProperty = /*@__PURE__*/getDefaultExportFromCjs(get_1);
|
|
3446
3446
|
|
|
3447
3447
|
/**
|
|
3448
3448
|
* The base implementation of `_.hasIn` without support for deep paths.
|
|
@@ -4718,52 +4718,6 @@ class BitcoinConnectorInvalidAccountError extends BitcoinConnectorError {
|
|
|
4718
4718
|
}
|
|
4719
4719
|
}
|
|
4720
4720
|
|
|
4721
|
-
class KeplrConnector {
|
|
4722
|
-
get getProvider() {
|
|
4723
|
-
const provider = window?.bitcoin_keplr;
|
|
4724
|
-
if (!provider) {
|
|
4725
|
-
throw new BitcoinConnectorProviderNotFoundError("Keplr");
|
|
4726
|
-
}
|
|
4727
|
-
return provider;
|
|
4728
|
-
}
|
|
4729
|
-
async sendBTC(to, amount) {
|
|
4730
|
-
const txHash = await this.getProvider.sendBitcoin(to, amount);
|
|
4731
|
-
if (!txHash) {
|
|
4732
|
-
throw new BitcoinConnectorTransactionFailedError();
|
|
4733
|
-
}
|
|
4734
|
-
return { txHash };
|
|
4735
|
-
}
|
|
4736
|
-
async requestAccount() {
|
|
4737
|
-
const accounts = await this.getProvider.requestAccounts();
|
|
4738
|
-
const account = accounts[0];
|
|
4739
|
-
if (typeof account !== "string") {
|
|
4740
|
-
throw new BitcoinConnectorInvalidAccountError();
|
|
4741
|
-
}
|
|
4742
|
-
return {
|
|
4743
|
-
address: account,
|
|
4744
|
-
};
|
|
4745
|
-
}
|
|
4746
|
-
async signPsbt(psbtHex) {
|
|
4747
|
-
// Keplr follows the UniSat-style Bitcoin provider API: `signPsbt` signs and,
|
|
4748
|
-
// with `autoFinalized` (the default), finalizes every input, returning the
|
|
4749
|
-
// signed PSBT as a hex string.
|
|
4750
|
-
// https://docs.keplr.app/api/bitcoin
|
|
4751
|
-
const signedPsbtHex = await this.getProvider.signPsbt(psbtHex, {
|
|
4752
|
-
autoFinalized: true,
|
|
4753
|
-
});
|
|
4754
|
-
// Keplr only exposes `pushTx`, so extract the finalized raw transaction from
|
|
4755
|
-
// the signed PSBT before broadcasting it.
|
|
4756
|
-
const rawTxHex = bitcoin.Psbt.fromHex(signedPsbtHex)
|
|
4757
|
-
.extractTransaction()
|
|
4758
|
-
.toHex();
|
|
4759
|
-
const txHash = await this.getProvider.pushTx(rawTxHex);
|
|
4760
|
-
if (!txHash) {
|
|
4761
|
-
throw new BitcoinConnectorTransactionFailedError();
|
|
4762
|
-
}
|
|
4763
|
-
return { txHash };
|
|
4764
|
-
}
|
|
4765
|
-
}
|
|
4766
|
-
|
|
4767
4721
|
bitcoin.initEccLib(ecc);
|
|
4768
4722
|
const network = bitcoin.networks.bitcoin;
|
|
4769
4723
|
const fromHexString = (hexString) => {
|
|
@@ -4852,6 +4806,53 @@ async function getTransactionStatus$1(txHash) {
|
|
|
4852
4806
|
.then((response) => response.data);
|
|
4853
4807
|
}
|
|
4854
4808
|
|
|
4809
|
+
class KeplrConnector {
|
|
4810
|
+
get getProvider() {
|
|
4811
|
+
const provider = window?.bitcoin_keplr;
|
|
4812
|
+
if (!provider) {
|
|
4813
|
+
throw new BitcoinConnectorProviderNotFoundError("Keplr");
|
|
4814
|
+
}
|
|
4815
|
+
return provider;
|
|
4816
|
+
}
|
|
4817
|
+
async sendBTC(to, amount) {
|
|
4818
|
+
const txHash = await this.getProvider.sendBitcoin(to, amount);
|
|
4819
|
+
if (!txHash) {
|
|
4820
|
+
throw new BitcoinConnectorTransactionFailedError();
|
|
4821
|
+
}
|
|
4822
|
+
return { txHash };
|
|
4823
|
+
}
|
|
4824
|
+
async requestAccount() {
|
|
4825
|
+
const accounts = await this.getProvider.requestAccounts();
|
|
4826
|
+
const account = accounts[0];
|
|
4827
|
+
if (typeof account !== "string") {
|
|
4828
|
+
throw new BitcoinConnectorInvalidAccountError();
|
|
4829
|
+
}
|
|
4830
|
+
return {
|
|
4831
|
+
address: account,
|
|
4832
|
+
};
|
|
4833
|
+
}
|
|
4834
|
+
async signPsbt(psbtHex) {
|
|
4835
|
+
// Keplr follows the UniSat-style Bitcoin provider API: `signPsbt` signs and,
|
|
4836
|
+
// with `autoFinalized` (the default), finalizes every input, returning the
|
|
4837
|
+
// signed PSBT as a hex string.
|
|
4838
|
+
// https://docs.keplr.app/api/bitcoin
|
|
4839
|
+
const signedPsbtHex = await this.getProvider.signPsbt(psbtHex, {
|
|
4840
|
+
autoFinalized: true,
|
|
4841
|
+
});
|
|
4842
|
+
// Broadcast the finalized raw transaction directly rather than through
|
|
4843
|
+
// Keplr's `pushTx`, which proxies via Keplr's own Bitcoin indexer
|
|
4844
|
+
// (api-indexer-bitcoin.keplr.app) and fails when that service is down.
|
|
4845
|
+
const rawTxHex = bitcoin.Psbt.fromHex(signedPsbtHex)
|
|
4846
|
+
.extractTransaction()
|
|
4847
|
+
.toHex();
|
|
4848
|
+
const txHash = await broadcastTx(rawTxHex);
|
|
4849
|
+
if (!txHash) {
|
|
4850
|
+
throw new BitcoinConnectorTransactionFailedError();
|
|
4851
|
+
}
|
|
4852
|
+
return { txHash };
|
|
4853
|
+
}
|
|
4854
|
+
}
|
|
4855
|
+
|
|
4855
4856
|
const MAINNET = bitcoin.networks.bitcoin;
|
|
4856
4857
|
class PhantomConnector {
|
|
4857
4858
|
get getProvider() {
|
|
@@ -20583,7 +20584,7 @@ const walletIconBaseUrl = "https://raw.githubusercontent.com/0xsquid/assets/main
|
|
|
20583
20584
|
* Returns the value of the property if found, otherwise undefined.
|
|
20584
20585
|
*/
|
|
20585
20586
|
const accessProperty = (object, path) => {
|
|
20586
|
-
const value =
|
|
20587
|
+
const value = getProperty(object, path);
|
|
20587
20588
|
if (value === undefined) {
|
|
20588
20589
|
console.error(`Property "${path}" not found while reading object`, object);
|
|
20589
20590
|
}
|
|
@@ -20911,6 +20912,16 @@ const fallbackWallets = [
|
|
|
20911
20912
|
chrome: "https://chromewebstore.google.com/detail/console-wallet/lpnfhpbpmlobjlgkdmnjieeihjmihhjd",
|
|
20912
20913
|
},
|
|
20913
20914
|
},
|
|
20915
|
+
{
|
|
20916
|
+
chainType: ChainType.CANTON,
|
|
20917
|
+
id: "nightly",
|
|
20918
|
+
name: "Nightly",
|
|
20919
|
+
connectorName: "Nightly",
|
|
20920
|
+
icon: `${walletIconBaseUrl}/nightly.webp`,
|
|
20921
|
+
links: {
|
|
20922
|
+
chrome: "https://chromewebstore.google.com/detail/nightly/fiikommddbeccaoicoejoniammnalkfa",
|
|
20923
|
+
},
|
|
20924
|
+
},
|
|
20914
20925
|
];
|
|
20915
20926
|
|
|
20916
20927
|
// Validation taken from Squid API repo
|
|
@@ -20932,6 +20943,32 @@ const isBitcoinAddressValid = (address$1) => {
|
|
|
20932
20943
|
}
|
|
20933
20944
|
};
|
|
20934
20945
|
|
|
20946
|
+
/**
|
|
20947
|
+
* Format a Canton connector into a Squid {@link CantonWallet}. Shared by the
|
|
20948
|
+
* announce-discovery and injected-provider paths.
|
|
20949
|
+
*/
|
|
20950
|
+
function formatCantonWallet({ connectorId, name, icon, connector, }) {
|
|
20951
|
+
return {
|
|
20952
|
+
name,
|
|
20953
|
+
connectorId,
|
|
20954
|
+
connectorName: name,
|
|
20955
|
+
icon,
|
|
20956
|
+
windowFlag: connectorId,
|
|
20957
|
+
skipInstallCheck: true,
|
|
20958
|
+
isInstalled: () => true,
|
|
20959
|
+
isMultiChain: false,
|
|
20960
|
+
type: ChainType.CANTON,
|
|
20961
|
+
connector,
|
|
20962
|
+
};
|
|
20963
|
+
}
|
|
20964
|
+
/**
|
|
20965
|
+
* Append injected wallets that aren't already covered by an announce-discovered
|
|
20966
|
+
* wallet with the same connectorId (in case a wallet later does both).
|
|
20967
|
+
*/
|
|
20968
|
+
function mergeInjectedCantonWallets(announced, injected) {
|
|
20969
|
+
const seen = new Set(announced.map((w) => w.connectorId));
|
|
20970
|
+
return [...announced, ...injected.filter((w) => !seen.has(w.connectorId))];
|
|
20971
|
+
}
|
|
20935
20972
|
// Canton PartyID = address
|
|
20936
20973
|
const CANTON_PARTY_ID_SEPARATOR = "::";
|
|
20937
20974
|
/** Canton Coin's well-known token-standard instrument id (its address carries no id prefix). */
|
|
@@ -22907,21 +22944,21 @@ const resolveChainIdFromAsset = (asset, chains) => {
|
|
|
22907
22944
|
};
|
|
22908
22945
|
const getConfigWithDefaults = (config) => {
|
|
22909
22946
|
return {
|
|
22910
|
-
integratorId:
|
|
22911
|
-
slippage:
|
|
22912
|
-
collectFees:
|
|
22913
|
-
apiUrl:
|
|
22914
|
-
priceImpactWarnings:
|
|
22915
|
-
initialAssets:
|
|
22916
|
-
defaultTokensPerChain:
|
|
22917
|
-
loadPreviousStateFromLocalStorage:
|
|
22918
|
-
availableChains:
|
|
22919
|
-
availableTokens:
|
|
22920
|
-
disabledChains:
|
|
22921
|
-
degenMode:
|
|
22922
|
-
preHook:
|
|
22923
|
-
postHook:
|
|
22924
|
-
overrideGasRefundAddress:
|
|
22947
|
+
integratorId: getProperty(config, "integratorId", defaultConfigValues.integratorId),
|
|
22948
|
+
slippage: getProperty(config, "slippage", defaultConfigValues.slippage),
|
|
22949
|
+
collectFees: getProperty(config, "collectFees", defaultConfigValues.collectFees),
|
|
22950
|
+
apiUrl: getProperty(config, "apiUrl", defaultConfigValues.apiUrl),
|
|
22951
|
+
priceImpactWarnings: getProperty(config, "priceImpactWarnings", defaultConfigValues.priceImpactWarnings),
|
|
22952
|
+
initialAssets: getProperty(config, "initialAssets", defaultConfigValues.initialAssets),
|
|
22953
|
+
defaultTokensPerChain: getProperty(config, "defaultTokensPerChain", defaultConfigValues.defaultTokensPerChain),
|
|
22954
|
+
loadPreviousStateFromLocalStorage: getProperty(config, "loadPreviousStateFromLocalStorage", defaultConfigValues.loadPreviousStateFromLocalStorage),
|
|
22955
|
+
availableChains: getProperty(config, "availableChains", defaultConfigValues.availableChains),
|
|
22956
|
+
availableTokens: getProperty(config, "availableTokens", defaultConfigValues.availableTokens),
|
|
22957
|
+
disabledChains: getProperty(config, "disabledChains", defaultConfigValues.disabledChains),
|
|
22958
|
+
degenMode: getProperty(config, "degenMode", defaultConfigValues.degenMode),
|
|
22959
|
+
preHook: getProperty(config, "preHook", defaultConfigValues.preHook),
|
|
22960
|
+
postHook: getProperty(config, "postHook", defaultConfigValues.postHook),
|
|
22961
|
+
overrideGasRefundAddress: getProperty(config, "overrideGasRefundAddress", defaultConfigValues.overrideGasRefundAddress),
|
|
22925
22962
|
};
|
|
22926
22963
|
};
|
|
22927
22964
|
const randomIntFromInterval = (min, max) => {
|
|
@@ -23618,7 +23655,7 @@ const filterViewableTokens = (tokens, config, direction) => {
|
|
|
23618
23655
|
};
|
|
23619
23656
|
const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
|
|
23620
23657
|
const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
|
|
23621
|
-
const { fetchAllSecretBalances } = await import('./secretService-
|
|
23658
|
+
const { fetchAllSecretBalances } = await import('./secretService-BMH_eXJd.js');
|
|
23622
23659
|
return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
|
|
23623
23660
|
};
|
|
23624
23661
|
function getTokenAssetsKey(token) {
|
|
@@ -26849,14 +26886,16 @@ class CantonBrowserConnector {
|
|
|
26849
26886
|
client;
|
|
26850
26887
|
listeners = { connect: new Set(), disconnect: new Set() };
|
|
26851
26888
|
_accounts = [];
|
|
26852
|
-
constructor(provider, win = window) {
|
|
26889
|
+
constructor(provider, win = window, client) {
|
|
26853
26890
|
this.providerId = provider.id;
|
|
26854
26891
|
this.name = provider.name;
|
|
26855
26892
|
this.target = provider.target ?? provider.id;
|
|
26856
|
-
this.client =
|
|
26857
|
-
|
|
26858
|
-
|
|
26859
|
-
|
|
26893
|
+
this.client =
|
|
26894
|
+
client ??
|
|
26895
|
+
createCantonClient(new WindowTransport(win, {
|
|
26896
|
+
target: this.target,
|
|
26897
|
+
timeout: REQUEST_TIMEOUT_MS,
|
|
26898
|
+
}));
|
|
26860
26899
|
}
|
|
26861
26900
|
get accounts() {
|
|
26862
26901
|
return this._accounts;
|
|
@@ -26958,44 +26997,116 @@ async function discoverCantonProviders(timeoutMs = DEFAULT_DISCOVERY_TIMEOUT_MS,
|
|
|
26958
26997
|
}
|
|
26959
26998
|
|
|
26960
26999
|
/**
|
|
26961
|
-
*
|
|
26962
|
-
*
|
|
27000
|
+
* CIP-103 wallets that expose their provider as an injected `window` global
|
|
27001
|
+
* instead of participating in the `canton:announceProvider` discovery protocol.
|
|
27002
|
+
* Add an entry to support a new one.
|
|
27003
|
+
*/
|
|
27004
|
+
const INJECTED_CANTON_WALLETS = [
|
|
27005
|
+
{
|
|
27006
|
+
connectorId: "nightly",
|
|
27007
|
+
name: "Nightly",
|
|
27008
|
+
icon: `${walletIconBaseUrl}/nightly.webp`,
|
|
27009
|
+
windowPath: "nightly.canton",
|
|
27010
|
+
},
|
|
27011
|
+
];
|
|
27012
|
+
/**
|
|
27013
|
+
* Adapts an injected CIP-103 `SpliceProvider` (the normative `request` API) to
|
|
27014
|
+
* the {@link CantonClient} surface consumed by `CantonBrowserConnector`, so
|
|
27015
|
+
* injected wallets reuse the same connector as announce-discovered ones.
|
|
27016
|
+
*/
|
|
27017
|
+
function cantonClientFromSpliceProvider(provider) {
|
|
27018
|
+
return {
|
|
27019
|
+
status: () => provider.request({ method: "status" }),
|
|
27020
|
+
connect: () => provider.request({ method: "connect" }),
|
|
27021
|
+
disconnect: () => provider.request({ method: "disconnect" }),
|
|
27022
|
+
isConnected: () => provider.request({ method: "isConnected" }),
|
|
27023
|
+
getActiveNetwork: () => provider.request({ method: "getActiveNetwork" }),
|
|
27024
|
+
listAccounts: () => provider.request({ method: "listAccounts" }),
|
|
27025
|
+
getPrimaryAccount: () => provider.request({ method: "getPrimaryAccount" }),
|
|
27026
|
+
prepareExecute: (params) => provider.request({ method: "prepareExecute", params }),
|
|
27027
|
+
prepareExecuteAndWait: (params) => provider.request({ method: "prepareExecuteAndWait", params }),
|
|
27028
|
+
signMessage: (params) => provider.request({ method: "signMessage", params }),
|
|
27029
|
+
ledgerApi: (params) => provider.request({ method: "ledgerApi", params }),
|
|
27030
|
+
};
|
|
27031
|
+
}
|
|
27032
|
+
/**
|
|
27033
|
+
* Detect installed injected Canton wallets by walking each registered
|
|
27034
|
+
* `windowPath`, mirroring the `definedInWindow` install check used for other
|
|
27035
|
+
* non-autodiscovered wallets.
|
|
27036
|
+
*/
|
|
27037
|
+
function discoverInjectedCantonWallets(win) {
|
|
27038
|
+
const source = (typeof window !== "undefined" ? window : undefined);
|
|
27039
|
+
if (!source)
|
|
27040
|
+
return [];
|
|
27041
|
+
return INJECTED_CANTON_WALLETS.flatMap((config) => {
|
|
27042
|
+
const provider = getProperty(source, config.windowPath);
|
|
27043
|
+
if (!provider || typeof provider.request !== "function")
|
|
27044
|
+
return [];
|
|
27045
|
+
return [{ config, provider }];
|
|
27046
|
+
});
|
|
27047
|
+
}
|
|
27048
|
+
|
|
27049
|
+
/**
|
|
27050
|
+
* Discovers Canton browser-extension wallets and maps each to a
|
|
27051
|
+
* {@link CantonWallet}: CIP-103 announce-protocol wallets (on mount and on
|
|
27052
|
+
* window focus), plus injected wallets that ship the CIP-103 RPC surface as a
|
|
27053
|
+
* `window` global instead of announcing (see `INJECTED_CANTON_WALLETS`).
|
|
26963
27054
|
*/
|
|
26964
27055
|
function useCantonWallets() {
|
|
26965
27056
|
const [wallets, setWallets] = useState([]);
|
|
26966
|
-
const
|
|
26967
|
-
const
|
|
26968
|
-
|
|
27057
|
+
const announcedCache = useRef(new Map());
|
|
27058
|
+
const injectedCache = useRef(new Map());
|
|
27059
|
+
const toAnnouncedWallet = useCallback((provider) => {
|
|
27060
|
+
let connector = announcedCache.current.get(provider.id);
|
|
26969
27061
|
if (!connector) {
|
|
26970
27062
|
connector = new CantonBrowserConnector(provider);
|
|
26971
|
-
|
|
27063
|
+
announcedCache.current.set(provider.id, connector);
|
|
26972
27064
|
}
|
|
26973
|
-
return {
|
|
26974
|
-
name: provider.name,
|
|
27065
|
+
return formatCantonWallet({
|
|
26975
27066
|
connectorId: provider.id,
|
|
26976
|
-
|
|
27067
|
+
name: provider.name,
|
|
26977
27068
|
icon: provider.icon,
|
|
26978
|
-
windowFlag: provider.id,
|
|
26979
|
-
skipInstallCheck: true,
|
|
26980
|
-
isInstalled: () => true,
|
|
26981
|
-
isMultiChain: false,
|
|
26982
|
-
type: ChainType.CANTON,
|
|
26983
27069
|
connector,
|
|
26984
|
-
};
|
|
27070
|
+
});
|
|
27071
|
+
}, []);
|
|
27072
|
+
const toInjectedWallet = useCallback(({ config, provider }) => {
|
|
27073
|
+
// Rebuild if the wallet re-injects a new provider object (e.g. extension
|
|
27074
|
+
// reload): the cached connector closes over the previous provider.
|
|
27075
|
+
let entry = injectedCache.current.get(config.connectorId);
|
|
27076
|
+
if (!entry || entry.provider !== provider) {
|
|
27077
|
+
entry = {
|
|
27078
|
+
connector: new CantonBrowserConnector({ id: config.connectorId, name: config.name, icon: config.icon }, window, cantonClientFromSpliceProvider(provider)),
|
|
27079
|
+
provider,
|
|
27080
|
+
};
|
|
27081
|
+
injectedCache.current.set(config.connectorId, entry);
|
|
27082
|
+
}
|
|
27083
|
+
return formatCantonWallet({
|
|
27084
|
+
connectorId: config.connectorId,
|
|
27085
|
+
name: config.name,
|
|
27086
|
+
icon: config.icon,
|
|
27087
|
+
connector: entry.connector,
|
|
27088
|
+
});
|
|
26985
27089
|
}, []);
|
|
26986
27090
|
const refresh = useCallback(async () => {
|
|
26987
27091
|
if (typeof window === "undefined")
|
|
26988
27092
|
return;
|
|
26989
|
-
const
|
|
26990
|
-
|
|
26991
|
-
|
|
27093
|
+
const announced = (await discoverCantonProviders()).map(toAnnouncedWallet);
|
|
27094
|
+
const injected = discoverInjectedCantonWallets().map(toInjectedWallet);
|
|
27095
|
+
setWallets(mergeInjectedCantonWallets(announced, injected));
|
|
27096
|
+
}, [toAnnouncedWallet, toInjectedWallet]);
|
|
26992
27097
|
useEffect(() => {
|
|
26993
27098
|
refresh();
|
|
26994
27099
|
if (typeof window === "undefined")
|
|
26995
|
-
return;
|
|
27100
|
+
return undefined;
|
|
26996
27101
|
const onFocus = () => refresh();
|
|
26997
27102
|
window.addEventListener("focus", onFocus);
|
|
26998
|
-
|
|
27103
|
+
// Extensions may inject their global shortly after mount; re-check a couple
|
|
27104
|
+
// of times so late injection surfaces without a focus change.
|
|
27105
|
+
const retries = [500, 1500].map((ms) => window.setTimeout(refresh, ms));
|
|
27106
|
+
return () => {
|
|
27107
|
+
window.removeEventListener("focus", onFocus);
|
|
27108
|
+
retries.forEach((id) => window.clearTimeout(id));
|
|
27109
|
+
};
|
|
26999
27110
|
}, [refresh]);
|
|
27000
27111
|
return { wallets };
|
|
27001
27112
|
}
|
|
@@ -27292,7 +27403,7 @@ function useStellarWallets() {
|
|
|
27292
27403
|
try {
|
|
27293
27404
|
const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
|
|
27294
27405
|
const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module.mjs');
|
|
27295
|
-
const { formatStellarWallet } = await import('./stellarService.client-
|
|
27406
|
+
const { formatStellarWallet } = await import('./stellarService.client-BpCW1qZY.js');
|
|
27296
27407
|
const modules = [...initializeAllModules(), new LedgerModule()];
|
|
27297
27408
|
const promises = modules.map(async (module) => {
|
|
27298
27409
|
const isAvailable = await module.isAvailable();
|
|
@@ -30751,7 +30862,7 @@ function hederaWalletConnect(parameters) {
|
|
|
30751
30862
|
const optionalChains = config.chains.map((x) => x.id);
|
|
30752
30863
|
if (!optionalChains.length)
|
|
30753
30864
|
return;
|
|
30754
|
-
const { EthereumProvider } = await import('./index.es-
|
|
30865
|
+
const { EthereumProvider } = await import('./index.es-wL3I3c3h.js');
|
|
30755
30866
|
const rawProvider = await EthereumProvider.init({
|
|
30756
30867
|
...restParameters,
|
|
30757
30868
|
disableProviderPing: true,
|
|
@@ -37478,10 +37589,6 @@ const useExecuteTransaction = (squidRoute) => {
|
|
|
37478
37589
|
}
|
|
37479
37590
|
});
|
|
37480
37591
|
const swapMutationBitcoin = useMutation(async ({ id, route }) => {
|
|
37481
|
-
console.log("Validating route", {
|
|
37482
|
-
bitcoinSigner,
|
|
37483
|
-
route,
|
|
37484
|
-
});
|
|
37485
37592
|
if (!bitcoinSigner || !route?.transactionRequest) {
|
|
37486
37593
|
throw new Error("Need all parameters");
|
|
37487
37594
|
}
|
|
@@ -37524,17 +37631,13 @@ const useExecuteTransaction = (squidRoute) => {
|
|
|
37524
37631
|
break;
|
|
37525
37632
|
}
|
|
37526
37633
|
case SquidDataType.DepositAddressCalldata: {
|
|
37527
|
-
console.log(`Route type: ${route.transactionRequest?.type}`);
|
|
37528
37634
|
if (!isOnChainTxData(route.transactionRequest)) {
|
|
37529
|
-
console.log("Invalid route data", route.transactionRequest);
|
|
37530
37635
|
throw new Error("Invalid route data");
|
|
37531
37636
|
}
|
|
37532
37637
|
const { data: transactionHex } = route.transactionRequest;
|
|
37533
37638
|
await changeNetworkIfNeeded.mutateAsync();
|
|
37534
37639
|
dispatchSignatureRequestEvent(route);
|
|
37535
|
-
console.log("Signing psbt", { transactionHex });
|
|
37536
37640
|
const { txHash } = await bitcoinSigner.signPsbt(transactionHex);
|
|
37537
|
-
console.log("Signed psbt", { txHash });
|
|
37538
37641
|
if (txHash) {
|
|
37539
37642
|
resetQueriesAfterTxSigned();
|
|
37540
37643
|
}
|
|
@@ -38722,5 +38825,5 @@ const SquidProvider = ({ children, config, placeholder, }) => {
|
|
|
38722
38825
|
React.createElement(CosmosProvider, null, children))))))))))) : (placeholder);
|
|
38723
38826
|
};
|
|
38724
38827
|
|
|
38725
|
-
export {
|
|
38726
|
-
//# sourceMappingURL=index-
|
|
38828
|
+
export { useWalletStore as $, AxelarStatusResponseType as A, useHederaAccountActivation as B, CHAIN_IDS as C, DEFAULT_LOCALE as D, useHederaTokenAssociations as E, useKeyboardNavigation as F, useSquidQueryClient as G, HistoryTxType as H, useSquid as I, useStellarAccountActivation as J, useStellarTrustLine as K, useAddressBookStore as L, useAssetsColorsStore as M, Nr as N, useFavoriteTokensStore as O, useHistoryStore as P, QueryKeys as Q, useSendTransactionStore as R, SquidStatusErrorType as S, TransactionErrorType as T, useConfigStore as U, useSquidStore as V, Wo as W, XamanXrplNetwork as X, useSwapRoutePersistStore as Y, useTransactionStore as Z, ConnectingWalletStatus as _, WindowWalletFlag as a, useAvailableQuotes as a$, useDepositAddress as a0, useSwap as a1, buildUrlSearchParamsFromSwapEvent as a2, parseInitialAssetsFromUrl as a3, useUrlSwapParams as a4, useAllConnectedWalletBalances as a5, useAllTokensWithBalanceForChainType as a6, useCosmosBalance as a7, useEvmBalance as a8, useMultiChainBalance as a9, useRouteWarnings as aA, useSendTransactionStatus as aB, useSwapTransactionStatus as aC, useAvatar as aD, useHistory as aE, useDebouncedValue as aF, useAddToken as aG, useAutoConnect as aH, useEnsDataForAddress as aI, useEnsSearch as aJ, useGnosisContext as aK, useIsSameAddressAndGnosisContext as aL, useIntegratorContext as aM, useMultiChainWallet as aN, useSigner as aO, useWallet as aP, useWallets as aQ, useXrplTrustLine as aR, TX_STATUS_CONSTANTS as aS, FINAL_TRANSACTION_STATUSES as aT, useGetFiatQuote as aU, useGetOnRampConfig as aV, useExecuteFiatQuote as aW, useFiatOnRampTxStatus as aX, useFiatTransactions as aY, useCurrencyDetails as aZ, useCountryDetails as a_, useMultipleTokenPrices as aa, useBitcoinNativeBalance as ab, useCosmosNativeBalance as ac, useEvmNativeBalance as ad, useNativeBalance as ae, useSolanaNativeBalance as af, useStellarNativeBalance as ag, useSuiNativeBalance as ah, useXrplNativeBalance as ai, useNativeTokenForChain as aj, useSingleTokenPrice as ak, useSourceChainGasToken as al, useSquidTokens as am, useHistoricalData as an, useTokensData as ao, useEstimateSendTransaction as ap, useSendTransaction as aq, useSendTransactionGas as ar, useAllTransactionsStatus as as, useApproval as at, useDepositTransactionStatus as au, useEstimate as av, useEstimatePriceImpact as aw, useExecuteTransaction as ax, useGetRoute as ay, useGetRouteWrapper as az, DEFAULT_ROUTE_REFETCH_INTERVAL as b, addEthereumChain as b$, useRecommendedQuote as b0, useGetOnrampPaymentTypes as b1, useSuggestedFiatAmounts as b2, SquidProvider as b3, EnsService as b4, getXummClient as b5, isXamanXAppContext as b6, getQueryHeaders as b7, getStatusCode as b8, is404Error as b9, randomIntFromInterval as bA, getTokensForChain as bB, getFirstAvailableChainId as bC, fetchHighestBalanceToken as bD, getInitialOrDefaultTokenAddressForChain as bE, getInitialTokenAddressForChain as bF, filterTokensForDestination as bG, getInitialChainIdFromConfig as bH, getCosmosKey as bI, getKeysSettled as bJ, getAllKeysForSupportedCosmosChains as bK, isCosmosAddressValid as bL, getCosmosSigningClient as bM, getCosmosChainInfosObject as bN, connectCosmosWallet as bO, isFallbackAddressNeeded as bP, suggestChainOrThrow as bQ, normalizeError as bR, transactionErrorCode as bS, isUserRejectionError as bT, getTransactionError as bU, handleTransactionErrorEvents as bV, isSwapRouteError as bW, isStatusError as bX, createQuoteRequestParamsHash as bY, WidgetEvents as bZ, EvmNetworkNotSupportedErrorCode as b_, assetsBaseUrl as ba, shareSubgraphId as bb, sortTokensBySharedSubgraphIds as bc, getSupportedChainIdsForDirection as bd, filterChains as be, filterTokens as bf, getTokenImage as bg, getNewSwapParamsFromInput as bh, sortAllTokens as bi, findToken as bj, findNativeToken as bk, normalizeIbcAddress as bl, groupTokensBySymbol as bm, groupTokensByChainId as bn, filterViewableTokens as bo, getSecretNetworkBalances as bp, getTokenAssetsKey as bq, fetchAssetsColors as br, isSupportedChainType as bs, initializeSquidData as bt, isEmptyObject as bu, normalizeTokenSymbol as bv, areTokenSymbolsCompatible as bw, isEvmosChain as bx, resolveChainIdFromAsset as by, getConfigWithDefaults as bz, chainTypeToNativeTokenAddressMap as c, chainflipMultihopBridgeType as c$, parseEvmAddress as c0, formatEvmWallet as c1, filterWagmiConnector as c2, waitForReceiptWithRetry as c3, getUserCountry as c4, getCountryData as c5, getCurrencyData as c6, adaptiveRound as c7, getSuggestedAmountsForCurrency as c8, HederaExtensionHelper as c9, isStellarIssuedToken as cA, getStellarHorizonApiUrl as cB, isValidIssuedAsset as cC, isValidHorizonAsset as cD, formatTransactionHistoryDate as cE, getAxelarExplorerTxUrl as cF, getSourceExplorerTxUrl as cG, getMainExplorerUrl as cH, formatDistance as cI, formatSeconds as cJ, formatSwapTxStatusResponseForStorage as cK, simplifyRouteAction as cL, fetchSwapTransactionStatus as cM, compareTransactionIds as cN, isCoralBridgeAction as cO, isActionCompletedOnSourceTx as cP, sleep as cQ, isChainflipDepositRoute as cR, isChainflipBridgeTransaction as cS, isOnChainTxData as cT, isDepositAddressDirectTransferRoute as cU, getHistoryTransactionId as cV, getStepStatuses as cW, getHalfSuccessState as cX, getStepsInfos as cY, getSwapTxStatusRefetchInterval as cZ, getSendTxStatusRefetchInterval as c_, convertHederaAccountIdToEvmAddress as ca, convertEvmAddressToHederaAccountId as cb, scaleHbarToWei as cc, scaleWeiToHbar as cd, parseToBigInt as ce, roundNumericValue as cf, formatUnitsRounded as cg, formatTokenAmount as ch, formatUsdAmount as ci, trimExtraDecimals as cj, getNumericValue as ck, cleanAmount as cl, convertTokenAmountToUSD as cm, convertUSDToTokenAmount as cn, calculateTotal24hChange as co, getRouteExpiry as cp, searchTokens as cq, filterSolanaWallets as cr, isSolanaAddressValid as cs, executeSolanaSwap as ct, executeSolanaTransfer as cu, isStellarAddressValid as cv, getStellarNetwork as cw, stellarAddressToScVal as cx, getStellarTrustLineAsset as cy, isStellarToken as cz, definedInWindow as d, getBridgeType as d0, getTransactionStatus as d1, getTransactionEndStatus as d2, isHistoryTransactionPending as d3, isHistoryTransactionFailed as d4, isHistoryTransactionWarning as d5, isHistoryTransactionEnded as d6, formatHash as d7, isWalletAddressValid as d8, redirectToExtensionsStore as d9, populateWallets as da, buildFallbackWallets as db, getDefaultChain as dc, sortWallets as dd, areSameAddress as de, sortAddressBook as df, calculateTotalUsdBalanceUSD as dg, addTokenToWallet as dh, isEvmChainNotSupportedError as di, getWalletSupportedChainTypes as dj, getConnectorForChainType as dk, walletSupportsChainType as dl, connectWallet as dm, cancelConnectWallet as dn, isProblematicConnector as dp, mergeWallets as dq, isXionSmartContractAddress as dr, isXrplAddressValid as ds, buildXrplTrustSetTx as dt, getXrplNetwork as du, parseXrplPaymentTx as dv, parseXrplTokenAddress as dw, er as e, formatBNToReadable as f, chainTypeToZeroAddressMap as g, destinationAddressResetValue as h, fallbackAddressResetValue as i, nativeCantonTokenAddress as j, nativeCosmosTokenAddress as k, nativeEvmTokenAddress as l, nativeSolanaTokenAddress as m, nativeBitcoinTokenAddress as n, nativeStellarTokenAddress as o, nativeSuiTokenAddress as p, nativeXrplTokenAddress as q, CosmosProvider as r, SendTransactionStatus as s, TransactionStatus as t, useCosmosContext as u, useTrackSearchEmpty as v, walletIconBaseUrl as w, useSquidChains as x, useClient as y, useCosmosForChain as z };
|
|
38829
|
+
//# sourceMappingURL=index-D5bkikGx.js.map
|