@btc-vision/bitcoin 6.4.8 → 6.4.10

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.
Files changed (43) hide show
  1. package/browser/index.d.ts +1 -1
  2. package/browser/index.js +1 -1
  3. package/browser/opcodes.d.ts +125 -0
  4. package/browser/script.d.ts +2 -2
  5. package/build/address.js +6 -5
  6. package/build/bufferutils.js +1 -1
  7. package/build/index.d.ts +1 -1
  8. package/build/index.js +1 -1
  9. package/build/opcodes.d.ts +125 -0
  10. package/build/opcodes.js +126 -0
  11. package/build/payments/embed.js +1 -1
  12. package/build/payments/p2ms.js +1 -1
  13. package/build/payments/p2op.js +1 -1
  14. package/build/payments/p2pk.js +1 -1
  15. package/build/payments/p2pkh.js +1 -1
  16. package/build/payments/p2sh.js +3 -3
  17. package/build/payments/p2tr.js +1 -1
  18. package/build/payments/p2wpkh.js +2 -2
  19. package/build/payments/p2wsh.js +2 -2
  20. package/build/psbt.js +2 -2
  21. package/build/push_data.js +9 -9
  22. package/build/script.d.ts +2 -2
  23. package/build/script.js +12 -12
  24. package/build/transaction.js +1 -1
  25. package/package.json +1 -1
  26. package/src/address.ts +304 -303
  27. package/src/bufferutils.ts +1 -1
  28. package/src/index.ts +1 -1
  29. package/src/{ops.ts → opcodes.ts} +4 -6
  30. package/src/payments/embed.ts +1 -1
  31. package/src/payments/p2ms.ts +1 -1
  32. package/src/payments/p2op.ts +1 -1
  33. package/src/payments/p2pk.ts +1 -1
  34. package/src/payments/p2pkh.ts +1 -1
  35. package/src/payments/p2sh.ts +210 -210
  36. package/src/payments/p2tr.ts +1 -1
  37. package/src/payments/p2wpkh.ts +144 -144
  38. package/src/payments/p2wsh.ts +217 -217
  39. package/src/psbt.ts +2 -2
  40. package/src/push_data.ts +9 -9
  41. package/src/script.ts +12 -12
  42. package/src/transaction.ts +1 -1
  43. package/test/script.spec.ts +1 -1
package/build/script.js CHANGED
@@ -1,17 +1,17 @@
1
1
  import * as bip66 from './bip66.js';
2
- import { OPS, REVERSE_OPS } from './ops.js';
2
+ import { opcodes, REVERSE_OPS } from './opcodes.js';
3
3
  import * as pushdata from './push_data.js';
4
4
  import * as scriptNumber from './script_number.js';
5
5
  import * as scriptSignature from './script_signature.js';
6
6
  import * as types from './types.js';
7
7
  const { typeforce } = types;
8
- const OP_INT_BASE = OPS.OP_RESERVED;
9
- export { OPS };
8
+ const OP_INT_BASE = opcodes.OP_RESERVED;
9
+ export { opcodes };
10
10
  function isOPInt(value) {
11
11
  return (types.Number(value) &&
12
- (value === OPS.OP_0 ||
13
- (value >= OPS.OP_1 && value <= OPS.OP_16) ||
14
- value === OPS.OP_1NEGATE));
12
+ (value === opcodes.OP_0 ||
13
+ (value >= opcodes.OP_1 && value <= opcodes.OP_16) ||
14
+ value === opcodes.OP_1NEGATE));
15
15
  }
16
16
  function isPushOnlyChunk(value) {
17
17
  return types.Buffer(value) || isOPInt(value);
@@ -24,13 +24,13 @@ export function countNonPushOnlyOPs(value) {
24
24
  }
25
25
  function asMinimalOP(buffer) {
26
26
  if (buffer.length === 0)
27
- return OPS.OP_0;
27
+ return opcodes.OP_0;
28
28
  if (buffer.length !== 1)
29
29
  return;
30
30
  if (buffer[0] >= 1 && buffer[0] <= 16)
31
31
  return OP_INT_BASE + buffer[0];
32
32
  if (buffer[0] === 0x81)
33
- return OPS.OP_1NEGATE;
33
+ return opcodes.OP_1NEGATE;
34
34
  }
35
35
  function chunksIsBuffer(buf) {
36
36
  return Buffer.isBuffer(buf);
@@ -85,7 +85,7 @@ export function decompile(buffer) {
85
85
  let i = 0;
86
86
  while (i < buffer.length) {
87
87
  const opcode = buffer[i];
88
- if (opcode > OPS.OP_0 && opcode <= OPS.OP_PUSHDATA4) {
88
+ if (opcode > opcodes.OP_0 && opcode <= opcodes.OP_PUSHDATA4) {
89
89
  const d = pushdata.decode(buffer, i);
90
90
  if (d === null)
91
91
  return null;
@@ -131,8 +131,8 @@ export function toASM(chunks) {
131
131
  export function fromASM(asm) {
132
132
  typeforce(types.String, asm);
133
133
  return compile(asm.split(' ').map((chunkStr) => {
134
- if (OPS[chunkStr] !== undefined) {
135
- return OPS[chunkStr];
134
+ if (opcodes[chunkStr] !== undefined) {
135
+ return opcodes[chunkStr];
136
136
  }
137
137
  typeforce(types.Hex, chunkStr);
138
138
  return Buffer.from(chunkStr, 'hex');
@@ -144,7 +144,7 @@ export function toStack(chunks) {
144
144
  return chunks.map((op) => {
145
145
  if (singleChunkIsBuffer(op))
146
146
  return op;
147
- if (op === OPS.OP_0)
147
+ if (op === opcodes.OP_0)
148
148
  return Buffer.allocUnsafe(0);
149
149
  return scriptNumber.encode(op - OP_INT_BASE);
150
150
  });
@@ -1,7 +1,7 @@
1
1
  import { BufferReader, BufferWriter, reverseBuffer, varuint } from './bufferutils.js';
2
2
  import * as bcrypto from './crypto.js';
3
3
  import * as bscript from './script.js';
4
- import { OPS as opcodes } from './script.js';
4
+ import { opcodes } from './script.js';
5
5
  import * as types from './types.js';
6
6
  const { typeforce } = types;
7
7
  function varSliceSize(someScript) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@btc-vision/bitcoin",
3
3
  "type": "module",
4
- "version": "6.4.8",
4
+ "version": "6.4.10",
5
5
  "description": "Client-side Bitcoin JavaScript library",
6
6
  "engines": {
7
7
  "node": ">=16.0.0"