@bsv/templates 1.2.3 → 1.4.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.
@@ -1,11 +1,11 @@
1
- import { LockingScript, UnlockingScript, OP, Hash, PublicKey, TransactionSignature, Signature, Utils } from "@bsv/sdk";
1
+ import { LockingScript, UnlockingScript, OP, Hash, PublicKey, TransactionSignature, Signature, Utils } from '@bsv/sdk';
2
2
  function concatPubkeys(pubkeys) {
3
3
  return pubkeys.map((p) => p.toDER()).reduce((a, b) => a.concat(b), []);
4
4
  }
5
5
  function numberFromScriptChunk(chunk) {
6
6
  let returnNum;
7
- if (!chunk.data) {
8
- returnNum = 1 + chunk.op - OP.OP_1;
7
+ if (chunk.data == null) {
8
+ returnNum = 1 + (chunk.op) - OP.OP_1;
9
9
  }
10
10
  else {
11
11
  const reader = new Utils.Reader(chunk.data);
@@ -14,8 +14,12 @@ function numberFromScriptChunk(chunk) {
14
14
  }
15
15
  return returnNum;
16
16
  }
17
- export class MultiSigPubkeyHash {
17
+ export class P2MSKH {
18
18
  static address(pubkeys, threshold) {
19
+ if (threshold < 1 || threshold > pubkeys.length)
20
+ throw new Error('threshold must be between 1 and the number of pubkeys');
21
+ if (!pubkeys || pubkeys.length < 2 || pubkeys.length < threshold)
22
+ throw new Error(`at least ${threshold || 2} pubkeys are required`);
19
23
  const concat = concatPubkeys(pubkeys);
20
24
  const hash = Hash.hash160(concat);
21
25
  const writer = new Utils.Writer();
@@ -28,7 +32,7 @@ export class MultiSigPubkeyHash {
28
32
  static async addressBRC29(wallet, counterparties, keyID, threshold) {
29
33
  const pubkeys = await Promise.all(counterparties.map(async (counterparty) => {
30
34
  const { publicKey } = await wallet.getPublicKey({
31
- protocolID: [1, "multi sig brc29"],
35
+ protocolID: [1, 'multi sig brc29'],
32
36
  keyID,
33
37
  counterparty
34
38
  });
@@ -49,26 +53,26 @@ export class MultiSigPubkeyHash {
49
53
  }
50
54
  lock(address, pubkeys, threshold = 1) {
51
55
  let hash;
52
- let total;
56
+ let total = pubkeys?.length || 0;
53
57
  if (address) {
54
58
  if (typeof address !== 'string')
55
59
  throw new Error('address must be a string');
56
- const result = MultiSigPubkeyHash.thresholdAndTotalFromAddress(address);
60
+ const result = P2MSKH.thresholdAndTotalFromAddress(address);
57
61
  hash = result.hash;
58
62
  total = result.total;
59
63
  threshold = result.threshold;
60
64
  }
61
65
  else {
62
- if (!pubkeys || pubkeys.length < 2 || pubkeys.length < threshold)
63
- throw new Error(`at least ${threshold} pubkeys are required, or use an address`);
66
+ if ((pubkeys == null) || total < 2)
67
+ throw new Error('at least 2 pubkeys are required');
64
68
  const concat = concatPubkeys(pubkeys);
65
69
  hash = Hash.hash160(concat);
66
- total = pubkeys.length;
67
70
  }
71
+ if (!threshold || threshold < 1 || threshold > total)
72
+ throw new Error('threshold must be between 1 and the number of pubkeys');
73
+ if (total > 10)
74
+ throw new Error('total must be less than or equal to 10');
68
75
  const script = new LockingScript();
69
- for (let i = 0; i < total - 1; i++) {
70
- script.writeOpCode(OP.OP_CAT);
71
- }
72
76
  script
73
77
  .writeOpCode(OP.OP_DUP)
74
78
  .writeOpCode(OP.OP_HASH160)
@@ -85,24 +89,23 @@ export class MultiSigPubkeyHash {
85
89
  script.writeOpCode(OP.OP_CHECKMULTISIG);
86
90
  return script;
87
91
  }
88
- unlock(wallet, customInstructions, workingUnlockingScript, signOutputs = "all", anyoneCanPay = false, sourceSatoshis, lockingScript) {
92
+ unlock(wallet, customInstructions, workingUnlockingScript, signOutputs = 'all', anyoneCanPay = false, sourceSatoshis, lockingScript) {
89
93
  return {
90
94
  sign: async (tx, inputIndex) => {
91
- if (!workingUnlockingScript) {
95
+ if (workingUnlockingScript == null) {
92
96
  workingUnlockingScript = new UnlockingScript();
93
97
  workingUnlockingScript.writeOpCode(OP.OP_0);
94
- customInstructions.pubkeys.forEach((pubkey) => {
95
- workingUnlockingScript.writeBin(PublicKey.fromString(pubkey).toDER());
96
- });
98
+ const pubkeys = concatPubkeys(customInstructions.pubkeys.map(p => PublicKey.fromString(p)));
99
+ workingUnlockingScript.writeBin(pubkeys);
97
100
  }
98
101
  let signatureScope = TransactionSignature.SIGHASH_FORKID;
99
- if (signOutputs === "all") {
102
+ if (signOutputs === 'all') {
100
103
  signatureScope |= TransactionSignature.SIGHASH_ALL;
101
104
  }
102
- if (signOutputs === "none") {
105
+ if (signOutputs === 'none') {
103
106
  signatureScope |= TransactionSignature.SIGHASH_NONE;
104
107
  }
105
- if (signOutputs === "single") {
108
+ if (signOutputs === 'single') {
106
109
  signatureScope |= TransactionSignature.SIGHASH_SINGLE;
107
110
  }
108
111
  if (anyoneCanPay) {
@@ -112,20 +115,17 @@ export class MultiSigPubkeyHash {
112
115
  const otherInputs = tx.inputs.filter((_, index) => index !== inputIndex);
113
116
  const sourceTXID = input.sourceTXID
114
117
  ? input.sourceTXID
115
- : input.sourceTransaction?.id("hex");
118
+ : input.sourceTransaction?.id('hex');
116
119
  if (!sourceTXID) {
117
- throw new Error("The input sourceTXID or sourceTransaction is required for transaction signing.");
120
+ throw new Error('The input sourceTXID or sourceTransaction is required for transaction signing.');
118
121
  }
119
- sourceSatoshis ||=
120
- input.sourceTransaction?.outputs[input.sourceOutputIndex].satoshis;
122
+ sourceSatoshis ||= input.sourceTransaction?.outputs[input.sourceOutputIndex].satoshis;
121
123
  if (!sourceSatoshis) {
122
- throw new Error("The sourceSatoshis or input sourceTransaction is required for transaction signing.");
124
+ throw new Error('The sourceSatoshis or input sourceTransaction is required for transaction signing.');
123
125
  }
124
- lockingScript ||=
125
- input.sourceTransaction?.outputs[input.sourceOutputIndex]
126
- .lockingScript;
127
- if (!lockingScript) {
128
- throw new Error("The lockingScript or input sourceTransaction is required for transaction signing.");
126
+ lockingScript ||= input.sourceTransaction?.outputs[input.sourceOutputIndex].lockingScript;
127
+ if (lockingScript == null) {
128
+ throw new Error('The lockingScript or input sourceTransaction is required for transaction signing.');
129
129
  }
130
130
  const preimage = TransactionSignature.format({
131
131
  sourceTXID,
@@ -138,41 +138,40 @@ export class MultiSigPubkeyHash {
138
138
  inputSequence: input.sequence || 0xffffffff,
139
139
  subscript: lockingScript,
140
140
  lockTime: tx.lockTime,
141
- scope: signatureScope,
141
+ scope: signatureScope
142
142
  });
143
143
  const hashToDirectlySign = Hash.hash256(preimage);
144
144
  const { signature } = await wallet.createSignature({
145
145
  hashToDirectlySign,
146
- protocolID: [1, "multi sig brc29"],
146
+ protocolID: [1, 'multi sig brc29'],
147
147
  counterparty: customInstructions.counterparty,
148
- keyID: customInstructions.keyID,
148
+ keyID: customInstructions.keyID
149
149
  });
150
150
  const s = Signature.fromDER(signature);
151
151
  const sig = new TransactionSignature(s.r, s.s, signatureScope);
152
152
  const sigForScript = sig.toChecksigFormat();
153
153
  workingUnlockingScript.writeBin(sigForScript);
154
154
  const chunkforSig = workingUnlockingScript.chunks.pop();
155
- // add it to the array at position 1, pushing the other content to the right
156
- workingUnlockingScript.chunks.splice(1, 0, chunkforSig);
155
+ // add it to the array before the pubkeys, pushing the other content to the right
156
+ workingUnlockingScript.chunks.splice(workingUnlockingScript.chunks.length - 1, 0, chunkforSig);
157
157
  return workingUnlockingScript;
158
158
  },
159
- estimateLength: (tx, inputIndex) => {
160
- let numberOfPubkeys = 2;
161
- let numberOfSignatures = 1;
162
- const staticLength = 1;
159
+ estimateLength: async (tx, inputIndex) => {
160
+ let numberOfPubkeys;
161
+ let numberOfSignatures;
162
+ const staticLength = 8;
163
163
  const input = tx.inputs[inputIndex];
164
164
  const lockingScript = input.sourceTransaction?.outputs[input.sourceOutputIndex].lockingScript;
165
- if (!lockingScript) {
166
- return Promise.resolve(1000); // guess
165
+ if (lockingScript == null) {
166
+ return await Promise.resolve(1000); // guess
167
167
  }
168
- const totalChunk = lockingScript?.chunks[lockingScript.chunks.length - 2];
168
+ const totalChunk = lockingScript.chunks.at(-2);
169
169
  numberOfPubkeys = numberFromScriptChunk(totalChunk);
170
- const thresholdPos = lockingScript.chunks.map(chunk => chunk.op === OP.OP_EQUALVERIFY).indexOf(true) + 1;
171
- const thresholdChunk = lockingScript?.chunks[thresholdPos];
170
+ const thresholdChunk = lockingScript.chunks[4];
172
171
  numberOfSignatures = numberFromScriptChunk(thresholdChunk);
173
- return Promise.resolve(staticLength + (numberOfSignatures * 73) + (numberOfPubkeys * 34));
172
+ return await Promise.resolve(staticLength + (numberOfSignatures * 74) + (numberOfPubkeys * 34));
174
173
  }
175
174
  };
176
175
  }
177
176
  }
178
- //# sourceMappingURL=MultiSigPubkeyHash.js.map
177
+ //# sourceMappingURL=P2MSKH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"P2MSKH.js","sourceRoot":"","sources":["../../../src/P2MSKH.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,eAAe,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,oBAAoB,EAAE,SAAS,EAAE,KAAK,EAA6C,MAAM,UAAU,CAAA;AAQjL,SAAS,aAAa,CAAE,OAAoB;IAC1C,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,EAAc,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACpF,CAAC;AAED,SAAS,qBAAqB,CAAE,KAAkB;IAChD,IAAI,SAAiB,CAAA;IACrB,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;QACvB,SAAS,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAA;IACtC,CAAC;SAAM,CAAC;QACN,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC3C,MAAM,SAAS,GAAG,MAAM,CAAC,aAAa,EAAE,CAAA;QACxC,SAAS,G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