@satora/swap 1.11.0 → 1.11.1
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/{chunk-EYVSXWCA.cjs → chunk-4NVWIR74.cjs} +216 -204
- package/dist/chunk-4NVWIR74.cjs.map +1 -0
- package/dist/{chunk-M47Z35Z5.cjs → chunk-Q4TOBBAN.cjs} +5 -5
- package/dist/{chunk-M47Z35Z5.cjs.map → chunk-Q4TOBBAN.cjs.map} +1 -1
- package/dist/{chunk-ZAQ7YV6W.js → chunk-TT3J2OOS.js} +5 -5
- package/dist/{chunk-ZAQ7YV6W.js.map → chunk-TT3J2OOS.js.map} +1 -1
- package/dist/{chunk-BVTLZLT2.js → chunk-WQMAL2VD.js} +31 -19
- package/dist/{chunk-BVTLZLT2.js.map → chunk-WQMAL2VD.js.map} +1 -1
- package/dist/delegate.cjs +2 -2
- package/dist/delegate.js +1 -1
- package/dist/dist-MHRQ5FFV.cjs +394 -0
- package/dist/{dist-RWCRSE4V.cjs.map → dist-MHRQ5FFV.cjs.map} +1 -1
- package/dist/{dist-INHW3D4S.js → dist-SHY7I6SH.js} +3 -3
- package/dist/index.cjs +10 -10
- package/dist/index.js +3 -3
- package/dist/types/cjs/pure/redeem/arkade.d.cts +4 -1
- package/dist/types/cjs/pure/version.d.cts +4 -4
- package/dist/types/esm/pure/redeem/arkade.d.ts +4 -1
- package/dist/types/esm/pure/version.d.ts +4 -4
- package/package.json +1 -1
- package/dist/chunk-EYVSXWCA.cjs.map +0 -1
- package/dist/dist-RWCRSE4V.cjs +0 -394
- /package/dist/{dist-INHW3D4S.js.map → dist-SHY7I6SH.js.map} +0 -0
|
@@ -115,7 +115,7 @@ import {
|
|
|
115
115
|
sha2562,
|
|
116
116
|
sha512,
|
|
117
117
|
utils
|
|
118
|
-
} from "./chunk-
|
|
118
|
+
} from "./chunk-TT3J2OOS.js";
|
|
119
119
|
import {
|
|
120
120
|
ArkAddress,
|
|
121
121
|
CSVMultisigTapscript,
|
|
@@ -13796,8 +13796,7 @@ async function buildArkadeClaim(params) {
|
|
|
13796
13796
|
// The preimage will be added to the witness during signing
|
|
13797
13797
|
witnessData: preimageBytes
|
|
13798
13798
|
}));
|
|
13799
|
-
const
|
|
13800
|
-
const destAddr = ArkAddress2.decode(destinationAddress);
|
|
13799
|
+
const destAddr = ArkAddress.decode(destinationAddress);
|
|
13801
13800
|
const destPkScript = destAddr.pkScript;
|
|
13802
13801
|
const outputs = [
|
|
13803
13802
|
{
|
|
@@ -13867,7 +13866,7 @@ async function continueArkadeClaim(params) {
|
|
|
13867
13866
|
unilateralClaimDelay,
|
|
13868
13867
|
unilateralRefundDelay,
|
|
13869
13868
|
unilateralRefundWithoutReceiverDelay,
|
|
13870
|
-
|
|
13869
|
+
destinationAddress,
|
|
13871
13870
|
network,
|
|
13872
13871
|
arkadeHtlcScriptVersion,
|
|
13873
13872
|
arkadeServerUrl
|
|
@@ -13948,7 +13947,6 @@ async function continueArkadeClaim(params) {
|
|
|
13948
13947
|
throw new Error("Total VTXO amount is zero");
|
|
13949
13948
|
}
|
|
13950
13949
|
const claimLeafScript = vhtlc.claim();
|
|
13951
|
-
const claimScriptByte = claimLeafScript[1];
|
|
13952
13950
|
const tapTree = vhtlc.encode();
|
|
13953
13951
|
logger.info({
|
|
13954
13952
|
event: "arkade.claim.continue_vtxos_found",
|
|
@@ -13996,6 +13994,25 @@ async function continueArkadeClaim(params) {
|
|
|
13996
13994
|
"No pending transactions found at the VHTLC address. The claim may have already been finalized or was never submitted."
|
|
13997
13995
|
);
|
|
13998
13996
|
}
|
|
13997
|
+
if (destinationAddress) {
|
|
13998
|
+
const expectedScript = hex.encode(
|
|
13999
|
+
ArkAddress.decode(destinationAddress).pkScript
|
|
14000
|
+
);
|
|
14001
|
+
for (const { arkTxid, finalArkTx } of pendingTxs) {
|
|
14002
|
+
const arkTx = Transaction2.fromPSBT(base64.decode(finalArkTx));
|
|
14003
|
+
if (arkTx.id !== arkTxid) {
|
|
14004
|
+
throw new Error(
|
|
14005
|
+
"Pending Arkade claim transaction ID does not match its PSBT."
|
|
14006
|
+
);
|
|
14007
|
+
}
|
|
14008
|
+
const { amount, script } = arkTx.getOutput(0);
|
|
14009
|
+
if (!amount || !script || hex.encode(script) !== expectedScript) {
|
|
14010
|
+
throw new Error(
|
|
14011
|
+
"Pending Arkade claim does not pay the requested destination address."
|
|
14012
|
+
);
|
|
14013
|
+
}
|
|
14014
|
+
}
|
|
14015
|
+
}
|
|
13999
14016
|
logger.info({
|
|
14000
14017
|
event: "arkade.claim.pending_txs_found",
|
|
14001
14018
|
message: "Found pending Arkade claim transactions",
|
|
@@ -14007,9 +14024,6 @@ async function continueArkadeClaim(params) {
|
|
|
14007
14024
|
const finalCheckpoints = await Promise.all(
|
|
14008
14025
|
signedCheckpointTxs.map(async (c) => {
|
|
14009
14026
|
const checkpointTx = Transaction2.fromPSBT(base64.decode(c));
|
|
14010
|
-
checkpointTx.updateInput(0, {
|
|
14011
|
-
witnessScript: claimScriptByte
|
|
14012
|
-
});
|
|
14013
14027
|
for (let i = 0; i < checkpointTx.inputsLength; i++) {
|
|
14014
14028
|
ensureConditionWitness(checkpointTx, i, preimageBytes);
|
|
14015
14029
|
}
|
|
@@ -17439,12 +17453,7 @@ var Client = class _Client {
|
|
|
17439
17453
|
};
|
|
17440
17454
|
}
|
|
17441
17455
|
if (vtxoStatus === "spent") {
|
|
17442
|
-
|
|
17443
|
-
if (continued.success) return continued;
|
|
17444
|
-
return {
|
|
17445
|
-
success: false,
|
|
17446
|
-
message: "All VTXOs have already been spent."
|
|
17447
|
-
};
|
|
17456
|
+
return this.#continueArkadeClaim(claimParams, options);
|
|
17448
17457
|
}
|
|
17449
17458
|
if (vtxoStatus === "spendable") {
|
|
17450
17459
|
return this.#claimArkadeOffchain(claimParams, options);
|
|
@@ -17675,13 +17684,16 @@ var Client = class _Client {
|
|
|
17675
17684
|
message: `Expected an Arkade-destination swap, got ${swap.direction}.`
|
|
17676
17685
|
};
|
|
17677
17686
|
}
|
|
17678
|
-
|
|
17687
|
+
return this.#continueArkadeClaim(
|
|
17688
|
+
this.#extractArkadeClaimParams(id, storedSwap)
|
|
17689
|
+
);
|
|
17690
|
+
}
|
|
17691
|
+
async #continueArkadeClaim(claimParams, options) {
|
|
17679
17692
|
try {
|
|
17680
17693
|
const result = await continueArkadeClaim({
|
|
17681
17694
|
...claimParams,
|
|
17682
|
-
destinationAddress:
|
|
17683
|
-
|
|
17684
|
-
arkadeServerUrl: this.#config.arkadeServerUrl,
|
|
17695
|
+
destinationAddress: options?.destinationAddress,
|
|
17696
|
+
arkadeServerUrl: options?.arkadeServerUrl ?? this.#config.arkadeServerUrl,
|
|
17685
17697
|
logger: this.#config.logger,
|
|
17686
17698
|
logLevel: this.#config.logLevel
|
|
17687
17699
|
});
|
|
@@ -22993,4 +23005,4 @@ export {
|
|
|
22993
23005
|
@scure/bip39/index.js:
|
|
22994
23006
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
22995
23007
|
*/
|
|
22996
|
-
//# sourceMappingURL=chunk-
|
|
23008
|
+
//# sourceMappingURL=chunk-WQMAL2VD.js.map
|