@satora/swap 1.10.0 → 1.10.2
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-FXGBP464.cjs → chunk-2LGHF7A3.cjs} +114 -99
- package/dist/chunk-2LGHF7A3.cjs.map +1 -0
- package/dist/{chunk-JAQ7MTJH.cjs → chunk-OJNQCRHU.cjs} +5 -5
- package/dist/{chunk-JAQ7MTJH.cjs.map → chunk-OJNQCRHU.cjs.map} +1 -1
- package/dist/{chunk-OWK4QVCF.js → chunk-S4T4GK5G.js} +22 -7
- package/dist/{chunk-OWK4QVCF.js.map → chunk-S4T4GK5G.js.map} +1 -1
- package/dist/{chunk-SEHIFNWW.js → chunk-VBNBVJLB.js} +5 -5
- package/dist/{chunk-SEHIFNWW.js.map → chunk-VBNBVJLB.js.map} +1 -1
- package/dist/delegate.cjs +2 -2
- package/dist/delegate.js +1 -1
- package/dist/{dist-SFQUB46D.js → dist-L5LHQNRK.js} +3 -3
- package/dist/dist-MMYSP6LP.cjs +394 -0
- package/dist/{dist-VCEMHI5A.cjs.map → dist-MMYSP6LP.cjs.map} +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.js +3 -3
- package/dist/types/cjs/pure/version.d.cts +4 -4
- package/dist/types/esm/pure/version.d.ts +4 -4
- package/package.json +1 -1
- package/dist/chunk-FXGBP464.cjs.map +0 -1
- package/dist/dist-VCEMHI5A.cjs +0 -394
- /package/dist/{dist-SFQUB46D.js.map → dist-L5LHQNRK.js.map} +0 -0
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
sha2562,
|
|
119
119
|
sha512,
|
|
120
120
|
utils
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-VBNBVJLB.js";
|
|
122
122
|
import {
|
|
123
123
|
createSdkLogger
|
|
124
124
|
} from "./chunk-G6NZFSWU.js";
|
|
@@ -22235,9 +22235,24 @@ function b64Encode(u) {
|
|
|
22235
22235
|
for (let i = 0; i < u.length; i++) bin += String.fromCharCode(u[i]);
|
|
22236
22236
|
return btoa(bin);
|
|
22237
22237
|
}
|
|
22238
|
+
function isP2tr(script) {
|
|
22239
|
+
return script?.length === 34 && script[0] === 81 && script[1] === 32;
|
|
22240
|
+
}
|
|
22241
|
+
function parseEscrowPsbt(psbt) {
|
|
22242
|
+
const lenient = Transaction2.fromPSBT(psbt, { disableScriptCheck: true });
|
|
22243
|
+
let stripped = false;
|
|
22244
|
+
for (let i = 0; i < lenient.inputsLength; i++) {
|
|
22245
|
+
const input = lenient.getInput(i);
|
|
22246
|
+
if (input.witnessScript && isP2tr(input.witnessUtxo?.script)) {
|
|
22247
|
+
lenient.updateInput(i, { witnessScript: void 0 }, true);
|
|
22248
|
+
stripped = true;
|
|
22249
|
+
}
|
|
22250
|
+
}
|
|
22251
|
+
return Transaction2.fromPSBT(stripped ? lenient.toPSBT() : psbt);
|
|
22252
|
+
}
|
|
22238
22253
|
function signEscrowArkTx(psbtB64, secretKey) {
|
|
22239
22254
|
const sk = typeof secretKey === "string" ? hex.decode(secretKey) : secretKey;
|
|
22240
|
-
const tx =
|
|
22255
|
+
const tx = parseEscrowPsbt(b64Decode(psbtB64));
|
|
22241
22256
|
tx.signIdx(sk, 0);
|
|
22242
22257
|
const txId = tx.id;
|
|
22243
22258
|
const txid = txId instanceof Uint8Array ? hex.encode(txId) : String(txId);
|
|
@@ -22249,7 +22264,7 @@ function signEscrowArkTx(psbtB64, secretKey) {
|
|
|
22249
22264
|
function signEscrowCheckpoints(psbtB64s, secretKey) {
|
|
22250
22265
|
const sk = typeof secretKey === "string" ? hex.decode(secretKey) : secretKey;
|
|
22251
22266
|
return psbtB64s.map((cpB64) => {
|
|
22252
|
-
const tx =
|
|
22267
|
+
const tx = parseEscrowPsbt(b64Decode(cpB64));
|
|
22253
22268
|
tx.signIdx(sk, 0);
|
|
22254
22269
|
return b64Encode(tx.toPSBT());
|
|
22255
22270
|
});
|
|
@@ -22257,11 +22272,11 @@ function signEscrowCheckpoints(psbtB64s, secretKey) {
|
|
|
22257
22272
|
async function signEscrowDelegate(intentProofB64, forfeitPsbtsB64, secretKey) {
|
|
22258
22273
|
const sk = typeof secretKey === "string" ? secretKey : hex.encode(secretKey);
|
|
22259
22274
|
const signer = SingleKey.fromHex(sk);
|
|
22260
|
-
const intent =
|
|
22275
|
+
const intent = parseEscrowPsbt(b64Decode(intentProofB64));
|
|
22261
22276
|
const signedIntent = await signer.sign(intent);
|
|
22262
22277
|
const signedForfeits = [];
|
|
22263
22278
|
for (const b64 of forfeitPsbtsB64) {
|
|
22264
|
-
const forfeit =
|
|
22279
|
+
const forfeit = parseEscrowPsbt(b64Decode(b64));
|
|
22265
22280
|
const signed = await signer.sign(forfeit);
|
|
22266
22281
|
signedForfeits.push(b64Encode(signed.toPSBT()));
|
|
22267
22282
|
}
|
|
@@ -22271,7 +22286,7 @@ async function signEscrowDelegate(intentProofB64, forfeitPsbtsB64, secretKey) {
|
|
|
22271
22286
|
};
|
|
22272
22287
|
}
|
|
22273
22288
|
function getArkTxid(psbtB64) {
|
|
22274
|
-
const tx =
|
|
22289
|
+
const tx = parseEscrowPsbt(b64Decode(psbtB64));
|
|
22275
22290
|
const txId = tx.id;
|
|
22276
22291
|
return txId instanceof Uint8Array ? hex.encode(txId) : String(txId);
|
|
22277
22292
|
}
|
|
@@ -22674,4 +22689,4 @@ export {
|
|
|
22674
22689
|
@scure/bip39/index.js:
|
|
22675
22690
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
22676
22691
|
*/
|
|
22677
|
-
//# sourceMappingURL=chunk-
|
|
22692
|
+
//# sourceMappingURL=chunk-S4T4GK5G.js.map
|