@satora/escrow 0.0.1-alpha.1 → 0.0.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/2-of-2/ark-contract.d.ts +2 -2
- package/dist/2-of-2/ark-contract.d.ts.map +1 -1
- package/dist/2-of-2/ark-contract.js +3 -3
- package/dist/2-of-2/ark-contract.js.map +1 -1
- package/dist/2-of-2/contract-handler.d.ts +1 -1
- package/dist/2-of-2/contract-handler.js +3 -3
- package/dist/2-of-2/contract-handler.js.map +1 -1
- package/dist/2-of-2/escrow-script.d.ts +9 -9
- package/dist/2-of-2/escrow-script.d.ts.map +1 -1
- package/dist/2-of-2/escrow-script.js +12 -8
- package/dist/2-of-2/escrow-script.js.map +1 -1
- package/dist/2-of-2/monitor.d.ts +1 -1
- package/dist/2-of-2/monitor.d.ts.map +1 -1
- package/dist/2-of-2/monitor.js +2 -2
- package/dist/2-of-2/monitor.js.map +1 -1
- package/dist/2-of-2/release.d.ts +16 -16
- package/dist/2-of-2/release.d.ts.map +1 -1
- package/dist/2-of-2/release.js +16 -16
- package/dist/2-of-2/release.js.map +1 -1
- package/dist/2-of-2/verify.d.ts +6 -6
- package/dist/2-of-2/verify.d.ts.map +1 -1
- package/dist/2-of-2/verify.js +24 -20
- package/dist/2-of-2/verify.js.map +1 -1
- package/dist/payout-commitment.d.ts +2 -2
- package/dist/payout-commitment.js +2 -2
- package/dist/sign.d.ts +1 -1
- package/dist/sign.js +1 -1
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ export declare function encodeEscrowArkContract(options: EscrowScriptOptions): s
|
|
|
23
23
|
* re-deriving the pkScript and funding address from the embedded parameters.
|
|
24
24
|
*
|
|
25
25
|
* Registers the escrow handler if needed, so the caller does not have to.
|
|
26
|
-
* `
|
|
26
|
+
* `arkadeServerPubKey` is the Arkade server x-only key the funding address is built from.
|
|
27
27
|
*/
|
|
28
|
-
export declare function decodeEscrowArkContract(encoded: string,
|
|
28
|
+
export declare function decodeEscrowArkContract(encoded: string, arkadeServerPubKey: Uint8Array, network: Network, meta?: EscrowContractMeta): Contract;
|
|
29
29
|
//# sourceMappingURL=ark-contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ark-contract.d.ts","sourceRoot":"","sources":["../../src/2-of-2/ark-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAGzB,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAE,KAAK,mBAAmB,EAAoB,MAAM,oBAAoB,CAAC;AAEhF,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,GAAE,kBAAuB,GAC5B,oBAAoB,CAWtB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAM5E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,
|
|
1
|
+
{"version":3,"file":"ark-contract.d.ts","sourceRoot":"","sources":["../../src/2-of-2/ark-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,oBAAoB,EAGzB,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AAOxB,OAAO,EAAE,KAAK,mBAAmB,EAAoB,MAAM,oBAAoB,CAAC;AAEhF,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,EAAE,OAAO,EAChB,IAAI,GAAE,kBAAuB,GAC5B,oBAAoB,CAWtB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAM5E;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,UAAU,EAC9B,OAAO,EAAE,OAAO,EAChB,IAAI,GAAE,kBAAuB,GAC5B,QAAQ,CAYV"}
|
|
@@ -36,11 +36,11 @@ export function encodeEscrowArkContract(options) {
|
|
|
36
36
|
* re-deriving the pkScript and funding address from the embedded parameters.
|
|
37
37
|
*
|
|
38
38
|
* Registers the escrow handler if needed, so the caller does not have to.
|
|
39
|
-
* `
|
|
39
|
+
* `arkadeServerPubKey` is the Arkade server x-only key the funding address is built from.
|
|
40
40
|
*/
|
|
41
|
-
export function decodeEscrowArkContract(encoded,
|
|
41
|
+
export function decodeEscrowArkContract(encoded, arkadeServerPubKey, network, meta = {}) {
|
|
42
42
|
registerEscrowContractHandler();
|
|
43
|
-
return contractFromArkContractWithAddress(encoded,
|
|
43
|
+
return contractFromArkContractWithAddress(encoded, arkadeServerPubKey, network.hrp, {
|
|
44
44
|
label: meta.label,
|
|
45
45
|
state: meta.state,
|
|
46
46
|
metadata: meta.metadata,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ark-contract.js","sourceRoot":"","sources":["../../src/2-of-2/ark-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,kCAAkC,EAClC,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAC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AC;AAShF;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAA4B,EAC5B,OAAgB,EAChB,OAA2B,EAAE;IAE7B,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,qBAAqB,CAAC,eAAe,CAAC,OAAO,CAAC;QACtD,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QACnC,OAAO,EAAE,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC;QACnC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAA4B;IAClE,sDAAsD;IACtD,OAAO,iBAAiB,CAAC;QACvB,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,qBAAqB,CAAC,eAAe,CAAC,OAAO,CAAC;KAC3C,CAAC,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,kBAA8B,EAC9B,OAAgB,EAChB,OAA2B,EAAE;IAE7B,6BAA6B,EAAE,CAAC;IAChC,OAAO,kCAAkC,CACvC,OAAO,EACP,kBAAkB,EAClB,OAAO,CAAC,GAAG,EACX;QACE,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -8,7 +8,7 @@ export type EscrowRole = "seller" | "arbiter";
|
|
|
8
8
|
* ContractHandler for the cooperative 2-of-2 escrow ({@link EscrowVtxoScript}).
|
|
9
9
|
*
|
|
10
10
|
* Spending paths:
|
|
11
|
-
* - cooperative (leaf A): 3-of-3 [seller, arbiter,
|
|
11
|
+
* - cooperative (leaf A): 3-of-3 [seller, arbiter, Arkade server]. Available whenever
|
|
12
12
|
* the server cooperates. Returned for ANY role — the witness is completed
|
|
13
13
|
* by the multi-party signing choreography (see `signEscrowArkTx`), not by a
|
|
14
14
|
* single wallet. This mirrors how the SDK's VHTLC handler returns its
|
|
@@ -61,7 +61,7 @@ function escapeSequence(contract) {
|
|
|
61
61
|
* ContractHandler for the cooperative 2-of-2 escrow ({@link EscrowVtxoScript}).
|
|
62
62
|
*
|
|
63
63
|
* Spending paths:
|
|
64
|
-
* - cooperative (leaf A): 3-of-3 [seller, arbiter,
|
|
64
|
+
* - cooperative (leaf A): 3-of-3 [seller, arbiter, Arkade server]. Available whenever
|
|
65
65
|
* the server cooperates. Returned for ANY role — the witness is completed
|
|
66
66
|
* by the multi-party signing choreography (see `signEscrowArkTx`), not by a
|
|
67
67
|
* single wallet. This mirrors how the SDK's VHTLC handler returns its
|
|
@@ -79,7 +79,7 @@ export const EscrowContractHandler = {
|
|
|
79
79
|
return {
|
|
80
80
|
sellerPubKey: hex.encode(params.sellerPubKey),
|
|
81
81
|
arbiterPubKey: hex.encode(params.arbiterPubKey),
|
|
82
|
-
|
|
82
|
+
arkadeServerPubKey: hex.encode(params.arkadeServerPubKey),
|
|
83
83
|
exitTimelock: timelockToSequence(params.exitTimelock).toString(),
|
|
84
84
|
};
|
|
85
85
|
},
|
|
@@ -87,7 +87,7 @@ export const EscrowContractHandler = {
|
|
|
87
87
|
return {
|
|
88
88
|
sellerPubKey: hex.decode(params.sellerPubKey),
|
|
89
89
|
arbiterPubKey: hex.decode(params.arbiterPubKey),
|
|
90
|
-
|
|
90
|
+
arkadeServerPubKey: hex.decode(params.arkadeServerPubKey),
|
|
91
91
|
exitTimelock: sequenceToTimelock(Number(params.exitTimelock)),
|
|
92
92
|
};
|
|
93
93
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract-handler.js","sourceRoot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GAAoB,EAAE,CAAC;QAClC,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;QACjD,CAAC;QACD,IAAI,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,KAAK,SAAS,EAAE,CAAC;YACvD,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC1C,IAAI,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;gBACtC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,6BAA6B;IAC3C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,CAAC;QACrD,gBAAgB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
|
@@ -4,11 +4,11 @@ export interface EscrowScriptOptions {
|
|
|
4
4
|
sellerPubKey: Uint8Array;
|
|
5
5
|
/** x-only Schnorr pubkey, 32 bytes. The escrow arbiter / cosigner. */
|
|
6
6
|
arbiterPubKey: Uint8Array;
|
|
7
|
-
/** x-only Schnorr pubkey, 32 bytes. Arkade
|
|
8
|
-
|
|
7
|
+
/** x-only Schnorr pubkey, 32 bytes. Arkade server's signer key. */
|
|
8
|
+
arkadeServerPubKey: Uint8Array;
|
|
9
9
|
/**
|
|
10
10
|
* CSV timelock for the arbiter-only unilateral escape leaf — the
|
|
11
|
-
*
|
|
11
|
+
* Arkade server-mandated unilateral-exit closure. Must be ≥ the Arkade server's
|
|
12
12
|
* `unilateralExitDelay` (~2 days on mutinynet, ~30 days on
|
|
13
13
|
* mainnet) or `submitTx` rejects the script with
|
|
14
14
|
* INVALID_VTXO_SCRIPT "exit delay is too short".
|
|
@@ -16,19 +16,19 @@ export interface EscrowScriptOptions {
|
|
|
16
16
|
exitTimelock: RelativeTimelock;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Two-leaf VtxoScript for a cooperative 2-of-2 escrow on
|
|
19
|
+
* Two-leaf VtxoScript for a cooperative 2-of-2 escrow on Arkade.
|
|
20
20
|
*
|
|
21
|
-
* A — cooperative release : 3-of-3 [seller, arbiter,
|
|
21
|
+
* A — cooperative release : 3-of-3 [seller, arbiter, Arkade server] (no CSV)
|
|
22
22
|
* B — arbiter unilateral exit : [arbiter] alone after a long CSV
|
|
23
23
|
*
|
|
24
24
|
* The two policy parties are the seller and the arbiter; both must sign
|
|
25
|
-
* the cooperative release. The Arkade
|
|
26
|
-
* by
|
|
25
|
+
* the cooperative release. The Arkade server is added to leaf A as required
|
|
26
|
+
* by Arkade round/forfeit semantics — the Arkade server must cosign every
|
|
27
27
|
* cooperative VTXO spend — so at the script level leaf A is 3-of-3 even
|
|
28
28
|
* though only two parties hold policy.
|
|
29
29
|
*
|
|
30
30
|
* The seller has NO unilateral exit. Seller safety relies on a
|
|
31
|
-
* pre-signed cooperative refund
|
|
31
|
+
* pre-signed cooperative refund Arkade transaction (created at funding time, held by
|
|
32
32
|
* the arbiter). After the CSV elapses, only the arbiter can sweep.
|
|
33
33
|
*/
|
|
34
34
|
export declare class EscrowVtxoScript extends VtxoScript {
|
|
@@ -51,7 +51,7 @@ export declare class EscrowVtxoScript extends VtxoScript {
|
|
|
51
51
|
* `exit()` convention for the unilateral (CSV) leaf.
|
|
52
52
|
*/
|
|
53
53
|
exit(): import("@arkade-os/sdk").TapLeafScript;
|
|
54
|
-
/** Encoded
|
|
54
|
+
/** Encoded Arkade address (bech32m) for funding this escrow. */
|
|
55
55
|
arkAddress(network: Network): string;
|
|
56
56
|
}
|
|
57
57
|
//# sourceMappingURL=escrow-script.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow-script.d.ts","sourceRoot":"","sources":["../../src/2-of-2/escrow-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,YAAY,EAAE,UAAU,CAAC;IACzB,sEAAsE;IACtE,aAAa,EAAE,UAAU,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"escrow-script.d.ts","sourceRoot":"","sources":["../../src/2-of-2/escrow-script.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,YAAY,EAAE,UAAU,CAAC;IACzB,sEAAsE;IACtE,aAAa,EAAE,UAAU,CAAC;IAC1B,mEAAmE;IACnE,kBAAkB,EAAE,UAAU,CAAC;IAC/B;;;;;;OAMG;IACH,YAAY,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAC9C,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;gBAE1B,OAAO,EAAE,mBAAmB;IAmBxC,yDAAyD;IACzD,eAAe;IAIf,oEAAoE;IACpE,UAAU;IAIV;;;;;;OAMG;IACH,OAAO;IAIP;;;OAGG;IACH,IAAI;IAIJ,gEAAgE;IAChE,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;CAGrC"}
|
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
import { CSVMultisigTapscript, MultisigTapscript, VtxoScript, } from "@arkade-os/sdk";
|
|
2
2
|
/**
|
|
3
|
-
* Two-leaf VtxoScript for a cooperative 2-of-2 escrow on
|
|
3
|
+
* Two-leaf VtxoScript for a cooperative 2-of-2 escrow on Arkade.
|
|
4
4
|
*
|
|
5
|
-
* A — cooperative release : 3-of-3 [seller, arbiter,
|
|
5
|
+
* A — cooperative release : 3-of-3 [seller, arbiter, Arkade server] (no CSV)
|
|
6
6
|
* B — arbiter unilateral exit : [arbiter] alone after a long CSV
|
|
7
7
|
*
|
|
8
8
|
* The two policy parties are the seller and the arbiter; both must sign
|
|
9
|
-
* the cooperative release. The Arkade
|
|
10
|
-
* by
|
|
9
|
+
* the cooperative release. The Arkade server is added to leaf A as required
|
|
10
|
+
* by Arkade round/forfeit semantics — the Arkade server must cosign every
|
|
11
11
|
* cooperative VTXO spend — so at the script level leaf A is 3-of-3 even
|
|
12
12
|
* though only two parties hold policy.
|
|
13
13
|
*
|
|
14
14
|
* The seller has NO unilateral exit. Seller safety relies on a
|
|
15
|
-
* pre-signed cooperative refund
|
|
15
|
+
* pre-signed cooperative refund Arkade transaction (created at funding time, held by
|
|
16
16
|
* the arbiter). After the CSV elapses, only the arbiter can sweep.
|
|
17
17
|
*/
|
|
18
18
|
export class EscrowVtxoScript extends VtxoScript {
|
|
19
19
|
options;
|
|
20
20
|
constructor(options) {
|
|
21
21
|
const cooperativeLeaf = MultisigTapscript.encode({
|
|
22
|
-
pubkeys: [
|
|
22
|
+
pubkeys: [
|
|
23
|
+
options.sellerPubKey,
|
|
24
|
+
options.arbiterPubKey,
|
|
25
|
+
options.arkadeServerPubKey,
|
|
26
|
+
],
|
|
23
27
|
});
|
|
24
28
|
const escapeLeaf = CSVMultisigTapscript.encode({
|
|
25
29
|
pubkeys: [options.arbiterPubKey],
|
|
@@ -53,9 +57,9 @@ export class EscrowVtxoScript extends VtxoScript {
|
|
|
53
57
|
exit() {
|
|
54
58
|
return this.escapeLeaf();
|
|
55
59
|
}
|
|
56
|
-
/** Encoded
|
|
60
|
+
/** Encoded Arkade address (bech32m) for funding this escrow. */
|
|
57
61
|
arkAddress(network) {
|
|
58
|
-
return this.address(network.hrp, this.options.
|
|
62
|
+
return this.address(network.hrp, this.options.arkadeServerPubKey).encode();
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
//# sourceMappingURL=escrow-script.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow-script.js","sourceRoot":"","sources":["../../src/2-of-2/escrow-script.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EAGjB,UAAU,GACX,MAAM,gBAAgB,CAAC;AAmBxB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IACrC,OAAO,CAAsB;IAEtC,YAAY,OAA4B;QACtC,MAAM,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC;YAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"escrow-script.js","sourceRoot":"","sources":["../../src/2-of-2/escrow-script.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EAGjB,UAAU,GACX,MAAM,gBAAgB,CAAC;AAmBxB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,gBAAiB,SAAQ,UAAU;IACrC,OAAO,CAAsB;IAEtC,YAAY,OAA4B;QACtC,MAAM,eAAe,GAAG,iBAAiB,CAAC,MAAM,CAAC;YAC/C,OAAO,EAAE;gBACP,OAAO,CAAC,YAAY;gBACpB,OAAO,CAAC,aAAa;gBACrB,OAAO,CAAC,kBAAkB;aAC3B;SACF,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,oBAAoB,CAAC,MAAM,CAAC;YAC7C,OAAO,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC;YAChC,QAAQ,EAAE,OAAO,CAAC,YAAY;SAC/B,CAAC,CAAC;QAEH,KAAK,CAAC,CAAC,eAAe,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAEnD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,yDAAyD;IACzD,eAAe;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,oEAAoE;IACpE,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,eAAe,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC;IAED,gEAAgE;IAChE,UAAU,CAAC,OAAgB;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7E,CAAC;CACF"}
|
package/dist/2-of-2/monitor.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare class EscrowMonitor {
|
|
|
45
45
|
* Register an escrow received as an `arkcontract=` string (the server→client
|
|
46
46
|
* handoff) for monitoring.
|
|
47
47
|
*/
|
|
48
|
-
watchArkContract(encoded: string,
|
|
48
|
+
watchArkContract(encoded: string, arkadeServerPubKey: Uint8Array, network: Network, meta?: EscrowContractMeta): Promise<Contract>;
|
|
49
49
|
/** Stop monitoring an escrow by its pkScript hex. */
|
|
50
50
|
unwatch(script: string): Promise<void>;
|
|
51
51
|
/** List all monitored escrows together with their current virtual outputs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.d.ts","sourceRoot":"","sources":["../../src/2-of-2/monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB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H,UAAU,CAAC,EAAE,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,MAAM,IAAI;IAWhE,wEAAwE;IACxE,OAAO,IAAI,IAAI;CAGhB"}
|
package/dist/2-of-2/monitor.js
CHANGED
|
@@ -45,8 +45,8 @@ export class EscrowMonitor {
|
|
|
45
45
|
* Register an escrow received as an `arkcontract=` string (the server→client
|
|
46
46
|
* handoff) for monitoring.
|
|
47
47
|
*/
|
|
48
|
-
watchArkContract(encoded,
|
|
49
|
-
const { createdAt: _createdAt, ...params } = decodeEscrowArkContract(encoded,
|
|
48
|
+
watchArkContract(encoded, arkadeServerPubKey, network, meta) {
|
|
49
|
+
const { createdAt: _createdAt, ...params } = decodeEscrowArkContract(encoded, arkadeServerPubKey, network, meta);
|
|
50
50
|
return this.manager.createContract(params);
|
|
51
51
|
}
|
|
52
52
|
/** Stop monitoring an escrow by its pkScript hex. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor.js","sourceRoot":"","sources":["../../src/2-of-2/monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,GAKhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EAEvB,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,yBAAyB,EACzB,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AA2B/B,SAAS,SAAS,CAAC,KAAqB;IACtC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACa;IAArC,YAAqC,OAA0B;QAA1B,YAAO,GAAP,OAAO,CAAmB;IAAG,CAAC;IAEnE;;;OAGG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAA6B;QAC/C,6BAA6B,E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AC,KAAK,EAAE,EAAE;YAC5C,IACE,KAAK,CAAC,IAAI,KAAK,eAAe;gBAC9B,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,yBAAyB,EACjD,CAAC;gBACD,EAAE,CAAC;oBACD,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;iBAClC,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,UAAU,CAAC,EAAwC;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE;YAC5C,IACE,KAAK,CAAC,IAAI,KAAK,YAAY;gBAC3B,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,yBAAyB,EACjD,CAAC;gBACD,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC;YACvD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,wEAAwE;IACxE,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACF"}
|
package/dist/2-of-2/release.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { type ArkInfo, type ArkProvider, CSVMultisigTapscript, type RelativeTimelock, Transaction } from "@arkade-os/sdk";
|
|
2
2
|
import type { EscrowVtxoScript } from "./escrow-script.js";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Arkade server-derived parameters needed to build and submit an escrow release.
|
|
5
5
|
*
|
|
6
6
|
* Derive once at startup from `ArkProvider.getInfo()` via
|
|
7
|
-
* {@link escrowArkConfigFromInfo}; these values are fixed by the
|
|
7
|
+
* {@link escrowArkConfigFromInfo}; these values are fixed by the Arkade server and
|
|
8
8
|
* cannot be chosen by the escrow parties.
|
|
9
9
|
*/
|
|
10
10
|
export interface EscrowArkConfig {
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/**
|
|
11
|
+
/** Arkade server x-only pubkey (32 bytes). */
|
|
12
|
+
arkadeServerPubKey: Uint8Array;
|
|
13
|
+
/** Arkade server-mandated unilateral-exit timelock (the escrow escape-leaf CSV). */
|
|
14
14
|
exitTimelock: RelativeTimelock;
|
|
15
15
|
/** CSV+multisig tapscript used as the second leaf of every checkpoint VTXO. */
|
|
16
16
|
serverUnrollScript: CSVMultisigTapscript.Type;
|
|
17
|
-
/**
|
|
17
|
+
/** Arkade server dust threshold (sats). Sub-dust outputs use an OP_RETURN-shaped script. */
|
|
18
18
|
dust: bigint;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* Derive {@link EscrowArkConfig} from the
|
|
21
|
+
* Derive {@link EscrowArkConfig} from the Arkade server's `getInfo()` response.
|
|
22
22
|
*
|
|
23
23
|
* Mirrors the connect step every party performs: x-only the signer key,
|
|
24
24
|
* decode the checkpoint tapscript, and map the unilateral-exit delay to a
|
|
@@ -33,11 +33,11 @@ export interface EscrowFundingOutpoint {
|
|
|
33
33
|
}
|
|
34
34
|
/** The two release outputs: buyer payout and escrow fee. */
|
|
35
35
|
export interface EscrowReleaseOutputs {
|
|
36
|
-
/** Buyer's payout
|
|
36
|
+
/** Buyer's payout Arkade address (committed to at take time). */
|
|
37
37
|
buyerArkAddress: string;
|
|
38
38
|
/** Sats paid to the buyer. */
|
|
39
39
|
buyerAmountSats: number;
|
|
40
|
-
/** Fee-collection
|
|
40
|
+
/** Fee-collection Arkade address. */
|
|
41
41
|
feeArkAddress: string;
|
|
42
42
|
/** Sats paid to the fee output. */
|
|
43
43
|
feeSats: number;
|
|
@@ -47,7 +47,7 @@ export interface BuiltEscrowRelease {
|
|
|
47
47
|
checkpoints: Transaction[];
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Build the cooperative release
|
|
50
|
+
* Build the cooperative release Arkade transaction and its checkpoint(s) spending the
|
|
51
51
|
* escrow funding VTXO to `buyer` and `fee` outputs via the cooperative leaf.
|
|
52
52
|
*
|
|
53
53
|
* Deterministic: identical inputs produce identical PSBT bytes and txids, so
|
|
@@ -55,7 +55,7 @@ export interface BuiltEscrowRelease {
|
|
|
55
55
|
*/
|
|
56
56
|
export declare function buildEscrowReleaseTx(escrow: EscrowVtxoScript, funding: EscrowFundingOutpoint, outputs: EscrowReleaseOutputs, config: EscrowArkConfig): BuiltEscrowRelease;
|
|
57
57
|
/**
|
|
58
|
-
* Sign input 0 of the
|
|
58
|
+
* Sign input 0 of the Arkade transaction and every checkpoint with `secretKey`, in place.
|
|
59
59
|
*
|
|
60
60
|
* Defaults to a deterministic auxRand (see above). Used by the arbiter, who
|
|
61
61
|
* signs across rounds; a single-shot signer (the seller) can use
|
|
@@ -63,16 +63,16 @@ export declare function buildEscrowReleaseTx(escrow: EscrowVtxoScript, funding:
|
|
|
63
63
|
*/
|
|
64
64
|
export declare function signEscrowReleaseInPlace(built: BuiltEscrowRelease, secretKey: Uint8Array, auxRand?: Uint8Array): void;
|
|
65
65
|
/**
|
|
66
|
-
* Submit the fully-signed
|
|
67
|
-
* the user (seller+arbiter) checkpoint sigs into the
|
|
66
|
+
* Submit the fully-signed Arkade transaction with UNSIGNED checkpoints to the Arkade server, merge
|
|
67
|
+
* the user (seller+arbiter) checkpoint sigs into the Arkade server-signed responses, and
|
|
68
68
|
* finalize. Returns the arkTxid.
|
|
69
69
|
*
|
|
70
|
-
* The submit/finalize split lets the
|
|
70
|
+
* The submit/finalize split lets the Arkade server reject a malformed Arkade transaction before any
|
|
71
71
|
* checkpoint signature is spent. Crash recovery between submit and finalize is
|
|
72
72
|
* the caller's responsibility.
|
|
73
73
|
*
|
|
74
|
-
* @param provider
|
|
75
|
-
* @param fullySignedArkTx
|
|
74
|
+
* @param provider Arkade server provider used to submit and finalize the Arkade transaction
|
|
75
|
+
* @param fullySignedArkTx Arkade transaction carrying both arbiter and seller tapscript sigs
|
|
76
76
|
* @param userSignedCheckpoints checkpoints with arbiter+seller sigs (kept aside)
|
|
77
77
|
* @param unsignedCheckpoints fresh-from-build checkpoints (no signatures)
|
|
78
78
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/2-of-2/release.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,WAAW,EAGhB,oBAAoB,EAEpB,KAAK,gBAAgB,EACrB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/2-of-2/release.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,WAAW,EAGhB,oBAAoB,EAEpB,KAAK,gBAAgB,EACrB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,kBAAkB,EAAE,UAAU,CAAC;IAC/B,oFAAoF;IACpF,YAAY,EAAE,gBAAgB,CAAC;IAC/B,+EAA+E;IAC/E,kBAAkB,EAAE,oBAAoB,CAAC,IAAI,CAAC;IAC9C,4FAA4F;IAC5F,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,CAYtE;AAED,0DAA0D;AAC1D,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACnC,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,8BAA8B;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,qCAAqC;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,WAAW,EAAE,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,eAAe,GACtB,kBAAkB,CA8BpB;AAUD;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,kBAAkB,EACzB,SAAS,EAAE,UAAU,EACrB,OAAO,GAAE,UAAmC,GAC3C,IAAI,CAKN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,8BAA8B,CAClD,QAAQ,EAAE,WAAW,EACrB,gBAAgB,EAAE,WAAW,EAC7B,qBAAqB,EAAE,WAAW,EAAE,EACpC,mBAAmB,EAAE,WAAW,EAAE,GACjC,OAAO,CAAC,MAAM,CAAC,CAkBjB"}
|
package/dist/2-of-2/release.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ArkAddress, buildOffchainTx, CSVMultisigTapscript, combineTapscriptSigs, Transaction, } from "@arkade-os/sdk";
|
|
2
2
|
import { base64, hex } from "@scure/base";
|
|
3
3
|
/**
|
|
4
|
-
* Derive {@link EscrowArkConfig} from the
|
|
4
|
+
* Derive {@link EscrowArkConfig} from the Arkade server's `getInfo()` response.
|
|
5
5
|
*
|
|
6
6
|
* Mirrors the connect step every party performs: x-only the signer key,
|
|
7
7
|
* decode the checkpoint tapscript, and map the unilateral-exit delay to a
|
|
@@ -9,17 +9,17 @@ import { base64, hex } from "@scure/base";
|
|
|
9
9
|
*/
|
|
10
10
|
export function escrowArkConfigFromInfo(info) {
|
|
11
11
|
if (!info.checkpointTapscript) {
|
|
12
|
-
throw new Error("
|
|
12
|
+
throw new Error("Arkade server info is missing checkpointTapscript");
|
|
13
13
|
}
|
|
14
14
|
return {
|
|
15
|
-
|
|
15
|
+
arkadeServerPubKey: toXOnly(hex.decode(info.signerPubkey)),
|
|
16
16
|
exitTimelock: delayToTimelock(info.unilateralExitDelay),
|
|
17
17
|
serverUnrollScript: CSVMultisigTapscript.decode(hex.decode(info.checkpointTapscript)),
|
|
18
18
|
dust: info.dust,
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
* Build the cooperative release
|
|
22
|
+
* Build the cooperative release Arkade transaction and its checkpoint(s) spending the
|
|
23
23
|
* escrow funding VTXO to `buyer` and `fee` outputs via the cooperative leaf.
|
|
24
24
|
*
|
|
25
25
|
* Deterministic: identical inputs produce identical PSBT bytes and txids, so
|
|
@@ -57,7 +57,7 @@ export function buildEscrowReleaseTx(escrow, funding, outputs, config) {
|
|
|
57
57
|
*/
|
|
58
58
|
const DETERMINISTIC_AUX_RAND = new Uint8Array(32);
|
|
59
59
|
/**
|
|
60
|
-
* Sign input 0 of the
|
|
60
|
+
* Sign input 0 of the Arkade transaction and every checkpoint with `secretKey`, in place.
|
|
61
61
|
*
|
|
62
62
|
* Defaults to a deterministic auxRand (see above). Used by the arbiter, who
|
|
63
63
|
* signs across rounds; a single-shot signer (the seller) can use
|
|
@@ -70,35 +70,35 @@ export function signEscrowReleaseInPlace(built, secretKey, auxRand = DETERMINIST
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* Submit the fully-signed
|
|
74
|
-
* the user (seller+arbiter) checkpoint sigs into the
|
|
73
|
+
* Submit the fully-signed Arkade transaction with UNSIGNED checkpoints to the Arkade server, merge
|
|
74
|
+
* the user (seller+arbiter) checkpoint sigs into the Arkade server-signed responses, and
|
|
75
75
|
* finalize. Returns the arkTxid.
|
|
76
76
|
*
|
|
77
|
-
* The submit/finalize split lets the
|
|
77
|
+
* The submit/finalize split lets the Arkade server reject a malformed Arkade transaction before any
|
|
78
78
|
* checkpoint signature is spent. Crash recovery between submit and finalize is
|
|
79
79
|
* the caller's responsibility.
|
|
80
80
|
*
|
|
81
|
-
* @param provider
|
|
82
|
-
* @param fullySignedArkTx
|
|
81
|
+
* @param provider Arkade server provider used to submit and finalize the Arkade transaction
|
|
82
|
+
* @param fullySignedArkTx Arkade transaction carrying both arbiter and seller tapscript sigs
|
|
83
83
|
* @param userSignedCheckpoints checkpoints with arbiter+seller sigs (kept aside)
|
|
84
84
|
* @param unsignedCheckpoints fresh-from-build checkpoints (no signatures)
|
|
85
85
|
*/
|
|
86
86
|
export async function submitAndFinalizeEscrowRelease(provider, fullySignedArkTx, userSignedCheckpoints, unsignedCheckpoints) {
|
|
87
87
|
const { arkTxid, signedCheckpointTxs } = await provider.submitTx(base64.encode(fullySignedArkTx.toPSBT()), unsignedCheckpoints.map((c) => base64.encode(c.toPSBT())));
|
|
88
88
|
const finalCheckpoints = signedCheckpointTxs.map((c, i) => {
|
|
89
|
-
const
|
|
89
|
+
const serverSigned = Transaction.fromPSBT(base64.decode(c));
|
|
90
90
|
const userSigned = userSignedCheckpoints[i];
|
|
91
91
|
if (!userSigned) {
|
|
92
92
|
throw new Error(`missing user-signed checkpoint at index ${i}`);
|
|
93
93
|
}
|
|
94
|
-
combineTapscriptSigs(userSigned,
|
|
95
|
-
return base64.encode(
|
|
94
|
+
combineTapscriptSigs(userSigned, serverSigned);
|
|
95
|
+
return base64.encode(serverSigned.toPSBT());
|
|
96
96
|
});
|
|
97
97
|
await provider.finalizeTx(arkTxid, finalCheckpoints);
|
|
98
98
|
return arkTxid;
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
101
|
-
* The
|
|
101
|
+
* The Arkade server rejects any non-OP_RETURN output below `dust`. Arkade addresses expose
|
|
102
102
|
* a {@link ArkAddress.subdustPkScript} encoding the destination as an
|
|
103
103
|
* OP_RETURN-shaped script for amounts the recipient still wants but that are
|
|
104
104
|
* sub-dust on L1 (e.g. a 1-sat fee on a small trade).
|
|
@@ -109,7 +109,7 @@ function pkScriptFor(address, amount, dust) {
|
|
|
109
109
|
/**
|
|
110
110
|
* BIP-68: a relative-timelock value below 512 is encoded as a block height;
|
|
111
111
|
* otherwise it is a 512-second-granularity time value (rounded up to the next
|
|
112
|
-
* valid multiple).
|
|
112
|
+
* valid multiple). Arkade server-reported values are already valid.
|
|
113
113
|
*/
|
|
114
114
|
function delayToTimelock(delay) {
|
|
115
115
|
if (delay < 512n) {
|
|
@@ -120,7 +120,7 @@ function delayToTimelock(delay) {
|
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* Drop the sign byte from a 33-byte compressed secp256k1 pubkey to get the
|
|
123
|
-
* 32-byte x-only form used by BIP-340 / tapscripts. The
|
|
123
|
+
* 32-byte x-only form used by BIP-340 / tapscripts. The Arkade server returns its
|
|
124
124
|
* `signerPubkey` compressed.
|
|
125
125
|
*/
|
|
126
126
|
function toXOnly(pubkey) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/2-of-2/release.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EAEpB,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAqB1C;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAa;IACnD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"release.js","sourceRoot":"","sources":["../../src/2-of-2/release.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAIV,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,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC;IACxC,IAAI,MAAM,CAAC,MAAM,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpD,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;AAC/D,CAAC"}
|
package/dist/2-of-2/verify.d.ts
CHANGED
|
@@ -5,16 +5,16 @@ export interface ReleaseArkTxExpectations {
|
|
|
5
5
|
txid: string;
|
|
6
6
|
vout: number;
|
|
7
7
|
};
|
|
8
|
-
/** Buyer's payout
|
|
8
|
+
/** Buyer's payout Arkade address (committed to during take). */
|
|
9
9
|
buyerArkAddress: string;
|
|
10
10
|
/** Buyer payout amount in sats. */
|
|
11
11
|
buyerAmountSats: bigint;
|
|
12
|
-
/** Escrow fee
|
|
12
|
+
/** Escrow fee Arkade address. */
|
|
13
13
|
feeArkAddress: string;
|
|
14
14
|
/** Escrow fee amount in sats. */
|
|
15
15
|
feeAmountSats: bigint;
|
|
16
16
|
}
|
|
17
|
-
/** The release as the seller receives it: the
|
|
17
|
+
/** The release as the seller receives it: the Arkade transaction and its checkpoint(s). */
|
|
18
18
|
export interface ReleaseToVerify {
|
|
19
19
|
arkTx: Transaction;
|
|
20
20
|
checkpoints: Transaction[];
|
|
@@ -26,12 +26,12 @@ export declare class ReleaseArkTxValidationError extends Error {
|
|
|
26
26
|
* Seller-side check before signing the cooperative release.
|
|
27
27
|
*
|
|
28
28
|
* An Arkade offchain spend is a two-tx chain: a **checkpoint** spends the
|
|
29
|
-
* funding VTXO, and the **
|
|
29
|
+
* funding VTXO, and the **Arkade transaction** spends the checkpoint and pays the final
|
|
30
30
|
* outputs (plus a zero-value P2A fee-bump anchor). This verifies the whole
|
|
31
31
|
* chain the seller is about to sign:
|
|
32
32
|
* - the checkpoint spends the escrow funding outpoint,
|
|
33
|
-
* - the
|
|
34
|
-
* - the
|
|
33
|
+
* - the Arkade transaction spends that checkpoint,
|
|
34
|
+
* - the Arkade transaction pays the agreed buyer and fee amounts — and nothing else
|
|
35
35
|
* except the anchor (no rogue payout).
|
|
36
36
|
*
|
|
37
37
|
* Throws on any mismatch. Caller must NOT sign if this throws.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/2-of-2/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGnE,MAAM,WAAW,wBAAwB;IACvC,uDAAuD;IACvD,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/2-of-2/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGnE,MAAM,WAAW,wBAAwB;IACvC,uDAAuD;IACvD,cAAc,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/C,gEAAgE;IAChE,eAAe,EAAE,MAAM,CAAC;IACxB,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,2FAA2F;AAC3F,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,WAAW,EAAE,WAAW,EAAE,CAAC;CAC5B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,wBAAwB,GACjC,IAAI,CAmGN"}
|
package/dist/2-of-2/verify.js
CHANGED
|
@@ -10,12 +10,12 @@ export class ReleaseArkTxValidationError extends Error {
|
|
|
10
10
|
* Seller-side check before signing the cooperative release.
|
|
11
11
|
*
|
|
12
12
|
* An Arkade offchain spend is a two-tx chain: a **checkpoint** spends the
|
|
13
|
-
* funding VTXO, and the **
|
|
13
|
+
* funding VTXO, and the **Arkade transaction** spends the checkpoint and pays the final
|
|
14
14
|
* outputs (plus a zero-value P2A fee-bump anchor). This verifies the whole
|
|
15
15
|
* chain the seller is about to sign:
|
|
16
16
|
* - the checkpoint spends the escrow funding outpoint,
|
|
17
|
-
* - the
|
|
18
|
-
* - the
|
|
17
|
+
* - the Arkade transaction spends that checkpoint,
|
|
18
|
+
* - the Arkade transaction pays the agreed buyer and fee amounts — and nothing else
|
|
19
19
|
* except the anchor (no rogue payout).
|
|
20
20
|
*
|
|
21
21
|
* Throws on any mismatch. Caller must NOT sign if this throws.
|
|
@@ -37,53 +37,57 @@ export function verifyReleaseArkTx(release, expected) {
|
|
|
37
37
|
cpIn.index !== expected.escrowOutpoint.vout) {
|
|
38
38
|
throw new ReleaseArkTxValidationError(`checkpoint input ${cpInTxid}:${cpIn.index} does not spend funding ${expected.escrowOutpoint.txid}:${expected.escrowOutpoint.vout}`);
|
|
39
39
|
}
|
|
40
|
-
// (2) The
|
|
40
|
+
// (2) The Arkade transaction must spend that checkpoint.
|
|
41
41
|
if (arkTx.inputsLength !== 1) {
|
|
42
|
-
throw new ReleaseArkTxValidationError(`expected exactly 1
|
|
42
|
+
throw new ReleaseArkTxValidationError(`expected exactly 1 Arkade transaction input, got ${arkTx.inputsLength}`);
|
|
43
43
|
}
|
|
44
44
|
const arkIn = arkTx.getInput(0);
|
|
45
45
|
if (!arkIn.txid) {
|
|
46
|
-
throw new ReleaseArkTxValidationError("
|
|
46
|
+
throw new ReleaseArkTxValidationError("Arkade transaction input 0 missing prevout");
|
|
47
47
|
}
|
|
48
48
|
const arkInTxid = hex.encode(arkIn.txid);
|
|
49
49
|
if (arkInTxid !== checkpoint.id) {
|
|
50
|
-
throw new ReleaseArkTxValidationError(`
|
|
50
|
+
throw new ReleaseArkTxValidationError(`Arkade transaction input ${arkInTxid} does not spend checkpoint ${checkpoint.id}`);
|
|
51
51
|
}
|
|
52
|
-
// (3) The
|
|
52
|
+
// (3) The Arkade transaction must pay buyer + fee, and nothing else but the anchor.
|
|
53
53
|
const buyerAddress = ArkAddress.decode(expected.buyerArkAddress);
|
|
54
54
|
const feeAddress = ArkAddress.decode(expected.feeArkAddress);
|
|
55
55
|
const anchorScriptHex = hex.encode(P2A.script);
|
|
56
|
-
let
|
|
57
|
-
let
|
|
56
|
+
let buyerOutputs = 0;
|
|
57
|
+
let feeOutputs = 0;
|
|
58
|
+
let anchorOutputs = 0;
|
|
58
59
|
for (let i = 0; i < arkTx.outputsLength; i++) {
|
|
59
60
|
const output = arkTx.getOutput(i);
|
|
60
61
|
if (!output.script || output.amount === undefined) {
|
|
61
|
-
throw new ReleaseArkTxValidationError(`
|
|
62
|
+
throw new ReleaseArkTxValidationError(`Arkade transaction output ${i} missing script or amount`);
|
|
62
63
|
}
|
|
63
64
|
if (matchesAddress(output.script, buyerAddress) &&
|
|
64
65
|
output.amount === expected.buyerAmountSats) {
|
|
65
|
-
|
|
66
|
+
buyerOutputs++;
|
|
66
67
|
}
|
|
67
68
|
else if (matchesAddress(output.script, feeAddress) &&
|
|
68
69
|
output.amount === expected.feeAmountSats) {
|
|
69
|
-
|
|
70
|
+
feeOutputs++;
|
|
70
71
|
}
|
|
71
72
|
else if (hex.encode(output.script) === anchorScriptHex &&
|
|
72
73
|
output.amount === P2A.amount) {
|
|
73
|
-
|
|
74
|
+
anchorOutputs++;
|
|
74
75
|
}
|
|
75
76
|
else {
|
|
76
|
-
throw new ReleaseArkTxValidationError(`unexpected
|
|
77
|
+
throw new ReleaseArkTxValidationError(`unexpected Arkade transaction output ${i}: ${output.amount} sats to ${hex.encode(output.script)}`);
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
if (
|
|
80
|
-
throw new ReleaseArkTxValidationError(`
|
|
80
|
+
if (buyerOutputs !== 1) {
|
|
81
|
+
throw new ReleaseArkTxValidationError(`expected exactly 1 buyer output paying ${expected.buyerAmountSats} sats to ${expected.buyerArkAddress}, got ${buyerOutputs}`);
|
|
81
82
|
}
|
|
82
|
-
if (
|
|
83
|
-
throw new ReleaseArkTxValidationError(`
|
|
83
|
+
if (feeOutputs !== 1) {
|
|
84
|
+
throw new ReleaseArkTxValidationError(`expected exactly 1 fee output paying ${expected.feeAmountSats} sats to ${expected.feeArkAddress}, got ${feeOutputs}`);
|
|
85
|
+
}
|
|
86
|
+
if (anchorOutputs !== 1) {
|
|
87
|
+
throw new ReleaseArkTxValidationError(`expected exactly 1 P2A anchor output, got ${anchorOutputs}`);
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
|
-
/** Match a pkScript against an
|
|
90
|
+
/** Match a pkScript against an Arkade address, allowing its sub-dust form. */
|
|
87
91
|
function matchesAddress(script, address) {
|
|
88
92
|
return (bytesEqual(script, address.pkScript) ||
|
|
89
93
|
bytesEqual(script, address.subdustPkScript));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/2-of-2/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAoB,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAqBlC,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC5C,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAwB,EACxB,QAAkC;IAElC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAEvC,uDAAu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CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAClC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAClC,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Buyer's commitment to a payout
|
|
2
|
+
* Buyer's commitment to a payout Arkade address.
|
|
3
3
|
*
|
|
4
|
-
* The buyer's destination is an
|
|
4
|
+
* The buyer's destination is an Arkade address (bech32m wrapping a server
|
|
5
5
|
* pubkey + vtxo taproot key), not an L1 P2WPKH/P2TR address, so an L1
|
|
6
6
|
* BIP-322 flow does not apply directly. Instead the buyer Schnorr-signs a
|
|
7
7
|
* deterministic message tying the offer, the destination address, and the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Buyer's commitment to a payout
|
|
2
|
+
* Buyer's commitment to a payout Arkade address.
|
|
3
3
|
*
|
|
4
|
-
* The buyer's destination is an
|
|
4
|
+
* The buyer's destination is an Arkade address (bech32m wrapping a server
|
|
5
5
|
* pubkey + vtxo taproot key), not an L1 P2WPKH/P2TR address, so an L1
|
|
6
6
|
* BIP-322 flow does not apply directly. Instead the buyer Schnorr-signs a
|
|
7
7
|
* deterministic message tying the offer, the destination address, and the
|
package/dist/sign.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface SignedEscrowTx {
|
|
|
3
3
|
txid: string;
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
* Sign input 0 of an Arkade
|
|
6
|
+
* Sign input 0 of an Arkade Arkade transaction PSBT with `secretKey`.
|
|
7
7
|
*
|
|
8
8
|
* Equivalent to `signEscrowArkTx` from `@lendasat/lendaswap-sdk-pure`,
|
|
9
9
|
* lifted into this SDK so consumers don't have to pull in Lendaswap's
|
package/dist/sign.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transaction } from "@arkade-os/sdk";
|
|
2
2
|
import { base64 } from "@scure/base";
|
|
3
3
|
/**
|
|
4
|
-
* Sign input 0 of an Arkade
|
|
4
|
+
* Sign input 0 of an Arkade Arkade transaction PSBT with `secretKey`.
|
|
5
5
|
*
|
|
6
6
|
* Equivalent to `signEscrowArkTx` from `@lendasat/lendaswap-sdk-pure`,
|
|
7
7
|
* lifted into this SDK so consumers don't have to pull in Lendaswap's
|