@0xsquid/react-hooks 8.3.1-beta-update-ethers.0 → 8.3.1-beta-bitcoin-coralv2.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/connectors/bitcoin/wallets/keplr.d.ts +3 -0
- package/dist/core/connectors/bitcoin/wallets/phantom.d.ts +3 -1
- package/dist/core/connectors/bitcoin/wallets/unisat.d.ts +3 -0
- package/dist/core/types/bitcoin.d.ts +3 -0
- package/dist/{index-qAOvcSon.js → index-D9ejMike.js} +111 -46
- package/dist/index-D9ejMike.js.map +1 -0
- package/dist/{index-CMrdTYeW.js → index-DW9wT497.js} +111 -47
- package/dist/index-DW9wT497.js.map +1 -0
- package/dist/{index.es-Cu_QQTg-.js → index.es-BWWDAnQe.js} +2 -2
- package/dist/{index.es-Cu_QQTg-.js.map → index.es-BWWDAnQe.js.map} +1 -1
- package/dist/{index.es-DRgOycmm.js → index.es-kZEFPxkm.js} +2 -2
- package/dist/{index.es-DRgOycmm.js.map → index.es-kZEFPxkm.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-B_-XWo1F.js → secretService-0aEFG8v1.js} +2 -2
- package/dist/{secretService-B_-XWo1F.js.map → secretService-0aEFG8v1.js.map} +1 -1
- package/dist/{secretService-B3sc6ibT.js → secretService-B46DBNsN.js} +2 -2
- package/dist/{secretService-B3sc6ibT.js.map → secretService-B46DBNsN.js.map} +1 -1
- package/dist/services/internal/transactionService.d.ts +7 -1
- package/dist/{stellarService.client-sRzC5VSD.js → stellarService.client-BUoaW_gK.js} +2 -2
- package/dist/{stellarService.client-sRzC5VSD.js.map → stellarService.client-BUoaW_gK.js.map} +1 -1
- package/dist/{stellarService.client-Ciqw9lmL.js → stellarService.client-dfwlhLiK.js} +2 -2
- package/dist/{stellarService.client-Ciqw9lmL.js.map → stellarService.client-dfwlhLiK.js.map} +1 -1
- package/package.json +4 -4
- package/dist/index-CMrdTYeW.js.map +0 -1
- package/dist/index-qAOvcSon.js.map +0 -1
|
@@ -4752,6 +4752,9 @@ class KeplrConnector {
|
|
|
4752
4752
|
address: account,
|
|
4753
4753
|
};
|
|
4754
4754
|
}
|
|
4755
|
+
async signPsbt(_) {
|
|
4756
|
+
throw new Error("Method not implemented.");
|
|
4757
|
+
}
|
|
4755
4758
|
}
|
|
4756
4759
|
|
|
4757
4760
|
bitcoin__namespace.initEccLib(ecc__namespace);
|
|
@@ -4866,10 +4869,8 @@ class PhantomConnector {
|
|
|
4866
4869
|
async sendBTC(to, amount) {
|
|
4867
4870
|
const { address } = await this.requestAccount();
|
|
4868
4871
|
const { psbtHex } = await createSendBtcPsbt(address, to, amount);
|
|
4869
|
-
const {
|
|
4870
|
-
|
|
4871
|
-
throw new BitcoinConnectorTransactionFailedError();
|
|
4872
|
-
return { txHash: txId };
|
|
4872
|
+
const { txHash } = await this.signPsbt(psbtHex);
|
|
4873
|
+
return { txHash };
|
|
4873
4874
|
}
|
|
4874
4875
|
async signPsbt(psbtHex) {
|
|
4875
4876
|
const { address: paymentAddress } = await this.requestAccount();
|
|
@@ -4890,8 +4891,10 @@ class PhantomConnector {
|
|
|
4890
4891
|
const signedPsbt = bitcoin__namespace.Psbt.fromBuffer(signedPsbtBytes);
|
|
4891
4892
|
signedPsbt.finalizeAllInputs();
|
|
4892
4893
|
const tx = signedPsbt.extractTransaction();
|
|
4893
|
-
const
|
|
4894
|
-
|
|
4894
|
+
const txHash = await broadcastTx(tx.toHex());
|
|
4895
|
+
if (!txHash)
|
|
4896
|
+
throw new BitcoinConnectorTransactionFailedError();
|
|
4897
|
+
return { txHash };
|
|
4895
4898
|
}
|
|
4896
4899
|
}
|
|
4897
4900
|
|
|
@@ -4920,6 +4923,9 @@ class UnisatConnector {
|
|
|
4920
4923
|
address: account,
|
|
4921
4924
|
};
|
|
4922
4925
|
}
|
|
4926
|
+
async signPsbt(_) {
|
|
4927
|
+
throw new Error("Method not implemented.");
|
|
4928
|
+
}
|
|
4923
4929
|
}
|
|
4924
4930
|
|
|
4925
4931
|
var XrplTransactionType;
|
|
@@ -22174,6 +22180,20 @@ function isChainflipBridgeTransaction(actions = []) {
|
|
|
22174
22180
|
return actions.some((action) => action.type === squidTypes.ActionType.BRIDGE &&
|
|
22175
22181
|
action.data?.type === squidTypes.BridgeType.CHAINFLIP);
|
|
22176
22182
|
}
|
|
22183
|
+
/**
|
|
22184
|
+
* Checks if a route is of type {@link OnChainExecutionData}
|
|
22185
|
+
*
|
|
22186
|
+
* On-chain routes require calling a smart contract to execute
|
|
22187
|
+
*/
|
|
22188
|
+
function isOnChainTxData(squidData) {
|
|
22189
|
+
return [
|
|
22190
|
+
squidTypes.SquidDataType.OnChainExecution,
|
|
22191
|
+
squidTypes.SquidDataType.DepositAddressWithSignature,
|
|
22192
|
+
squidTypes.SquidDataType.DepositAddressCalldata,
|
|
22193
|
+
squidTypes.SquidDataType.DepositAddressWithSignature,
|
|
22194
|
+
squidTypes.SquidDataType.DepositAddressWithMemo,
|
|
22195
|
+
].includes(squidData.type);
|
|
22196
|
+
}
|
|
22177
22197
|
function getHistoryTransactionId(tx) {
|
|
22178
22198
|
switch (tx.txType) {
|
|
22179
22199
|
case exports.HistoryTxType.SWAP:
|
|
@@ -23153,7 +23173,7 @@ const filterViewableTokens = (tokens, config, direction) => {
|
|
|
23153
23173
|
};
|
|
23154
23174
|
const getSecretNetworkBalances = async (chainData, cosmosAddress, squidTokens, keplrTypeWallet) => {
|
|
23155
23175
|
const squidSecretTokens = squidTokens.filter((t) => t.chainId === CHAIN_IDS.SECRET);
|
|
23156
|
-
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-
|
|
23176
|
+
const { fetchAllSecretBalances } = await Promise.resolve().then(function () { return require('./secretService-0aEFG8v1.js'); });
|
|
23157
23177
|
return fetchAllSecretBalances(chainData, cosmosAddress, squidSecretTokens, keplrTypeWallet);
|
|
23158
23178
|
};
|
|
23159
23179
|
function getTokenAssetsKey(token) {
|
|
@@ -26438,7 +26458,7 @@ function useStellarWallets() {
|
|
|
26438
26458
|
try {
|
|
26439
26459
|
const { allowAllModules: initializeAllModules } = await import('@creit.tech/stellar-wallets-kit');
|
|
26440
26460
|
const { LedgerModule } = await import('@creit.tech/stellar-wallets-kit/modules/ledger.module');
|
|
26441
|
-
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-
|
|
26461
|
+
const { formatStellarWallet } = await Promise.resolve().then(function () { return require('./stellarService.client-BUoaW_gK.js'); });
|
|
26442
26462
|
const modules = [...initializeAllModules(), new LedgerModule()];
|
|
26443
26463
|
const promises = modules.map(async (module) => {
|
|
26444
26464
|
const isAvailable = await module.isAvailable();
|
|
@@ -27938,7 +27958,7 @@ function hederaWalletConnect(parameters) {
|
|
|
27938
27958
|
const optionalChains = config.chains.map((x) => x.id);
|
|
27939
27959
|
if (!optionalChains.length)
|
|
27940
27960
|
return;
|
|
27941
|
-
const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-
|
|
27961
|
+
const { EthereumProvider } = await Promise.resolve().then(function () { return require('./index.es-BWWDAnQe.js'); });
|
|
27942
27962
|
const rawProvider = await EthereumProvider.init({
|
|
27943
27963
|
...restParameters,
|
|
27944
27964
|
disableProviderPing: true,
|
|
@@ -35626,47 +35646,91 @@ const useExecuteTransaction = (squidRoute) => {
|
|
|
35626
35646
|
},
|
|
35627
35647
|
});
|
|
35628
35648
|
const swapMutationBitcoin = reactQuery.useMutation(async ({ id, route }) => {
|
|
35629
|
-
|
|
35630
|
-
|
|
35631
|
-
|
|
35632
|
-
}
|
|
35633
|
-
if (!
|
|
35634
|
-
throw new Error(
|
|
35649
|
+
console.log("Validating route", {
|
|
35650
|
+
bitcoinSigner,
|
|
35651
|
+
route,
|
|
35652
|
+
});
|
|
35653
|
+
if (!bitcoinSigner || !route?.transactionRequest) {
|
|
35654
|
+
throw new Error("Need all parameters");
|
|
35635
35655
|
}
|
|
35636
|
-
|
|
35637
|
-
|
|
35638
|
-
|
|
35639
|
-
|
|
35640
|
-
|
|
35641
|
-
|
|
35642
|
-
|
|
35656
|
+
switch (route.transactionRequest.type) {
|
|
35657
|
+
case squidTypes.SquidDataType.ChainflipDepositAddress: {
|
|
35658
|
+
const { depositAddress, amount: sendAmount, chainflipStatusTrackingId, } = useDepositAddressStore.getState().deposit ?? {};
|
|
35659
|
+
const allParamsValid = route && bitcoinSigner && depositAddress && sendAmount;
|
|
35660
|
+
if (!allParamsValid) {
|
|
35661
|
+
throw new Error("Need all parameters");
|
|
35662
|
+
}
|
|
35663
|
+
await changeNetworkIfNeeded.mutateAsync();
|
|
35664
|
+
dispatchSignatureRequestEvent(route);
|
|
35665
|
+
const { txHash } = await bitcoinSigner.sendBTC(depositAddress, Number(sendAmount));
|
|
35666
|
+
if (txHash) {
|
|
35667
|
+
resetQueriesAfterTxSigned();
|
|
35668
|
+
}
|
|
35669
|
+
// Dispatch event so it can be listened from outside the widget
|
|
35670
|
+
WidgetEvents.getInstance().dispatchSwapExecuteCall(route, txHash);
|
|
35671
|
+
if (route.transactionRequest) {
|
|
35672
|
+
const txParams = setTransactionState({
|
|
35673
|
+
route,
|
|
35674
|
+
txHash,
|
|
35675
|
+
// When bridging from Bitcoin we need to send the chainflipId to the status endpoint
|
|
35676
|
+
// instead of the Bitcoin transaction hash
|
|
35677
|
+
transactionIdForStatus: chainflipStatusTrackingId,
|
|
35678
|
+
userAddress: sourceUserAddress,
|
|
35679
|
+
status: exports.TransactionStatus.INITIAL_LOADING,
|
|
35680
|
+
sourceStatus: exports.TransactionStatus.ONGOING,
|
|
35681
|
+
axelarUrl: undefined,
|
|
35682
|
+
id,
|
|
35683
|
+
});
|
|
35684
|
+
if (txParams) {
|
|
35685
|
+
addSwapTransaction({
|
|
35686
|
+
...txParams,
|
|
35687
|
+
params: route.params,
|
|
35688
|
+
estimate: route.estimate,
|
|
35689
|
+
});
|
|
35690
|
+
}
|
|
35691
|
+
}
|
|
35692
|
+
break;
|
|
35643
35693
|
}
|
|
35644
|
-
|
|
35645
|
-
|
|
35646
|
-
|
|
35647
|
-
|
|
35648
|
-
route
|
|
35649
|
-
|
|
35650
|
-
|
|
35651
|
-
|
|
35652
|
-
|
|
35653
|
-
|
|
35654
|
-
|
|
35655
|
-
|
|
35656
|
-
|
|
35657
|
-
|
|
35658
|
-
}
|
|
35659
|
-
|
|
35660
|
-
|
|
35661
|
-
|
|
35662
|
-
|
|
35663
|
-
|
|
35694
|
+
case squidTypes.SquidDataType.DepositAddressCalldata: {
|
|
35695
|
+
console.log(`Route type: ${route.transactionRequest?.type}`);
|
|
35696
|
+
if (!isOnChainTxData(route.transactionRequest)) {
|
|
35697
|
+
console.log("Invalid route data", route.transactionRequest);
|
|
35698
|
+
throw new Error("Invalid route data");
|
|
35699
|
+
}
|
|
35700
|
+
const { data: transactionHex } = route.transactionRequest;
|
|
35701
|
+
await changeNetworkIfNeeded.mutateAsync();
|
|
35702
|
+
dispatchSignatureRequestEvent(route);
|
|
35703
|
+
console.log("Signing psbt", { transactionHex });
|
|
35704
|
+
const { txHash } = await bitcoinSigner.signPsbt(transactionHex);
|
|
35705
|
+
console.log("Signed psbt", { txHash });
|
|
35706
|
+
if (txHash) {
|
|
35707
|
+
resetQueriesAfterTxSigned();
|
|
35708
|
+
}
|
|
35709
|
+
// Dispatch event so it can be listened from outside the widget
|
|
35710
|
+
WidgetEvents.getInstance().dispatchSwapExecuteCall(route, txHash);
|
|
35711
|
+
if (route.transactionRequest) {
|
|
35712
|
+
const txParams = setTransactionState({
|
|
35713
|
+
route,
|
|
35714
|
+
txHash,
|
|
35715
|
+
userAddress: sourceUserAddress,
|
|
35716
|
+
status: exports.TransactionStatus.INITIAL_LOADING,
|
|
35717
|
+
sourceStatus: exports.TransactionStatus.ONGOING,
|
|
35718
|
+
axelarUrl: undefined,
|
|
35719
|
+
id,
|
|
35664
35720
|
});
|
|
35721
|
+
if (txParams) {
|
|
35722
|
+
addSwapTransaction({
|
|
35723
|
+
...txParams,
|
|
35724
|
+
params: route.params,
|
|
35725
|
+
estimate: route.estimate,
|
|
35726
|
+
});
|
|
35727
|
+
}
|
|
35665
35728
|
}
|
|
35729
|
+
break;
|
|
35730
|
+
}
|
|
35731
|
+
default: {
|
|
35732
|
+
throw new Error(`Unhandled route type ${route.transactionRequest.type}`);
|
|
35666
35733
|
}
|
|
35667
|
-
}
|
|
35668
|
-
else {
|
|
35669
|
-
throw new Error("Need all parameters");
|
|
35670
35734
|
}
|
|
35671
35735
|
});
|
|
35672
35736
|
const swapMutationXrpl = reactQuery.useMutation(async ({ id, route }) => {
|
|
@@ -36933,6 +36997,7 @@ exports.isHistoryTransactionEnded = isHistoryTransactionEnded;
|
|
|
36933
36997
|
exports.isHistoryTransactionFailed = isHistoryTransactionFailed;
|
|
36934
36998
|
exports.isHistoryTransactionPending = isHistoryTransactionPending;
|
|
36935
36999
|
exports.isHistoryTransactionWarning = isHistoryTransactionWarning;
|
|
37000
|
+
exports.isOnChainTxData = isOnChainTxData;
|
|
36936
37001
|
exports.isProblematicConnector = isProblematicConnector;
|
|
36937
37002
|
exports.isSolanaAddressValid = isSolanaAddressValid;
|
|
36938
37003
|
exports.isStatusError = isStatusError;
|
|
@@ -37048,4 +37113,4 @@ exports.useXrplTrustLine = useXrplTrustLine;
|
|
|
37048
37113
|
exports.waitForReceiptWithRetry = waitForReceiptWithRetry;
|
|
37049
37114
|
exports.walletIconBaseUrl = walletIconBaseUrl;
|
|
37050
37115
|
exports.walletSupportsChainType = walletSupportsChainType;
|
|
37051
|
-
//# sourceMappingURL=index-
|
|
37116
|
+
//# sourceMappingURL=index-D9ejMike.js.map
|