@btc-vision/transaction 1.2.14 → 1.2.15

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.
@@ -11,6 +11,6 @@ export declare abstract class CustomKeypair implements Signer {
11
11
  abstract getPublicKey(): Buffer;
12
12
  abstract sign(hash: Buffer, lowR?: boolean): Buffer;
13
13
  abstract signSchnorr(hash: Buffer): Buffer;
14
- abstract verify(hash: Buffer, signature: Buffer): boolean;
14
+ abstract verify(hash: Buffer, signature: Buffer): boolean | Buffer;
15
15
  abstract init(): Promise<void>;
16
16
  }
@@ -1 +1 @@
1
- export declare const version = "1.2.14";
1
+ export declare const version = "1.2.15";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.2.14';
1
+ export const version = '1.2.15';
@@ -10,7 +10,6 @@ export declare enum ABIDataTypes {
10
10
  ADDRESS = "ADDRESS",
11
11
  STRING = "STRING",
12
12
  BYTES32 = "BYTES32",
13
- TUPLE = "TUPLE",
14
13
  BYTES = "BYTES",
15
14
  ADDRESS_UINT256_TUPLE = "ADDRESS_UINT256_TUPLE",
16
15
  ARRAY_OF_ADDRESSES = "ARRAY_OF_ADDRESSES",
@@ -14,7 +14,6 @@ export var ABIDataTypes;
14
14
  ABIDataTypes["ADDRESS"] = "ADDRESS";
15
15
  ABIDataTypes["STRING"] = "STRING";
16
16
  ABIDataTypes["BYTES32"] = "BYTES32";
17
- ABIDataTypes["TUPLE"] = "TUPLE";
18
17
  ABIDataTypes["BYTES"] = "BYTES";
19
18
  ABIDataTypes["ADDRESS_UINT256_TUPLE"] = "ADDRESS_UINT256_TUPLE";
20
19
  ABIDataTypes["ARRAY_OF_ADDRESSES"] = "ARRAY_OF_ADDRESSES";
@@ -64,9 +63,6 @@ export class ABICoder {
64
63
  case ABIDataTypes.INT128:
65
64
  result.push(byteReader.readI128());
66
65
  break;
67
- case ABIDataTypes.TUPLE:
68
- result.push(byteReader.readTuple());
69
- break;
70
66
  case ABIDataTypes.ADDRESS_UINT256_TUPLE:
71
67
  result.push(byteReader.readAddressValueTuple());
72
68
  break;
@@ -19,7 +19,6 @@ export declare class BinaryReader {
19
19
  readStringArray(): string[];
20
20
  readBytesArray(): Uint8Array[];
21
21
  readBytesWithLength(maxLength?: number): Uint8Array;
22
- readTuple(): bigint[];
23
22
  readU8(): u8;
24
23
  readU16(): u16;
25
24
  readU32(le?: boolean): u32;
@@ -106,14 +106,6 @@ export class BinaryReader {
106
106
  }
107
107
  return this.readBytes(length);
108
108
  }
109
- readTuple() {
110
- const length = this.readU32();
111
- const result = new Array(length);
112
- for (let i = 0; i < length; i++) {
113
- result[i] = this.readU256();
114
- }
115
- return result;
116
- }
117
109
  readU8() {
118
110
  this.verifyEnd(this.currentOffset + U8_BYTE_LENGTH);
119
111
  const value = this.buffer.getUint8(this.currentOffset);
@@ -21,14 +21,13 @@ export declare class BinaryWriter {
21
21
  writeStringWithLength(value: string): void;
22
22
  getBuffer(clear?: boolean): Uint8Array;
23
23
  reset(): void;
24
- writeTuple(values: bigint[]): void;
25
24
  toBytesReader(): BinaryReader;
26
25
  getOffset(): u32;
27
26
  setOffset(offset: u32): void;
28
27
  clear(): void;
29
28
  allocSafe(size: u32): void;
30
29
  writeABISelector(name: string, selector: Selector): void;
31
- writeAddressValueTupleMap(map: AddressMap<bigint>): void;
30
+ writeAddressValueTuple(map: AddressMap<bigint>): void;
32
31
  writeLimitedAddressBytesMap(map: AddressMap<Uint8Array[]>): void;
33
32
  writeBytesWithLength(value: Uint8Array): void;
34
33
  writeAddressArray(value: Address[]): void;
@@ -114,13 +114,6 @@ export class BinaryWriter {
114
114
  this.currentOffset = 0;
115
115
  this.buffer = this.getDefaultBuffer(4);
116
116
  }
117
- writeTuple(values) {
118
- this.allocSafe(U32_BYTE_LENGTH + values.length * U256_BYTE_LENGTH);
119
- this.writeU32(values.length);
120
- for (let i = 0; i < values.length; i++) {
121
- this.writeU256(values[i]);
122
- }
123
- }
124
117
  toBytesReader() {
125
118
  return new BinaryReader(this.getBuffer());
126
119
  }
@@ -143,7 +136,7 @@ export class BinaryWriter {
143
136
  this.writeStringWithLength(name);
144
137
  this.writeSelector(selector);
145
138
  }
146
- writeAddressValueTupleMap(map) {
139
+ writeAddressValueTuple(map) {
147
140
  if (map.size > 65535)
148
141
  throw new Error('Map size is too large');
149
142
  this.writeU16(map.size);
@@ -11,6 +11,6 @@ export declare abstract class CustomKeypair implements Signer {
11
11
  abstract getPublicKey(): Buffer;
12
12
  abstract sign(hash: Buffer, lowR?: boolean): Buffer;
13
13
  abstract signSchnorr(hash: Buffer): Buffer;
14
- abstract verify(hash: Buffer, signature: Buffer): boolean;
14
+ abstract verify(hash: Buffer, signature: Buffer): boolean | Buffer;
15
15
  abstract init(): Promise<void>;
16
16
  }
@@ -1,4 +1,4 @@
1
- import { crypto as bitCrypto, script as bitScript, networks, Psbt, toXOnly, } from '@btc-vision/bitcoin';
1
+ import { crypto as bitCrypto, networks, Psbt, script as bitScript, toXOnly, } from '@btc-vision/bitcoin';
2
2
  import { EcKeyPair } from '../../../keypair/EcKeyPair.js';
3
3
  import { canSignNonTaprootInput, isTaprootInput } from '../../../signer/SignerUtils.js';
4
4
  import { CustomKeypair } from '../BrowserSignerBase.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@btc-vision/transaction",
3
3
  "type": "module",
4
- "version": "1.2.14",
4
+ "version": "1.2.15",
5
5
  "author": "BlobMaster41",
6
6
  "description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
7
7
  "engines": {
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.2.14';
1
+ export const version = '1.2.15';
@@ -15,7 +15,6 @@ export enum ABIDataTypes {
15
15
  ADDRESS = 'ADDRESS',
16
16
  STRING = 'STRING',
17
17
  BYTES32 = 'BYTES32',
18
- TUPLE = 'TUPLE',
19
18
  BYTES = 'BYTES',
20
19
  ADDRESS_UINT256_TUPLE = 'ADDRESS_UINT256_TUPLE',
21
20
  ARRAY_OF_ADDRESSES = 'ARRAY_OF_ADDRESSES',
@@ -67,9 +66,6 @@ export class ABICoder {
67
66
  case ABIDataTypes.INT128:
68
67
  result.push(byteReader.readI128());
69
68
  break;
70
- case ABIDataTypes.TUPLE: // very basic for now, only contains uint256
71
- result.push(byteReader.readTuple());
72
- break;
73
69
  case ABIDataTypes.ADDRESS_UINT256_TUPLE:
74
70
  result.push(byteReader.readAddressValueTuple());
75
71
  break;
@@ -152,17 +152,6 @@ export class BinaryReader {
152
152
  return this.readBytes(length);
153
153
  }
154
154
 
155
- public readTuple(): bigint[] {
156
- const length = this.readU32();
157
- const result: bigint[] = new Array<bigint>(length);
158
-
159
- for (let i = 0; i < length; i++) {
160
- result[i] = this.readU256();
161
- }
162
-
163
- return result;
164
- }
165
-
166
155
  public readU8(): u8 {
167
156
  this.verifyEnd(this.currentOffset + U8_BYTE_LENGTH);
168
157
 
@@ -163,15 +163,6 @@ export class BinaryWriter {
163
163
  this.buffer = this.getDefaultBuffer(4);
164
164
  }
165
165
 
166
- public writeTuple(values: bigint[]): void {
167
- this.allocSafe(U32_BYTE_LENGTH + values.length * U256_BYTE_LENGTH);
168
- this.writeU32(values.length);
169
-
170
- for (let i = 0; i < values.length; i++) {
171
- this.writeU256(values[i]);
172
- }
173
- }
174
-
175
166
  public toBytesReader(): BinaryReader {
176
167
  return new BinaryReader(this.getBuffer());
177
168
  }
@@ -200,7 +191,7 @@ export class BinaryWriter {
200
191
  this.writeSelector(selector);
201
192
  }
202
193
 
203
- public writeAddressValueTupleMap(map: AddressMap<bigint>): void {
194
+ public writeAddressValueTuple(map: AddressMap<bigint>): void {
204
195
  if (map.size > 65535) throw new Error('Map size is too large');
205
196
 
206
197
  this.writeU16(map.size);
@@ -30,7 +30,7 @@ export abstract class CustomKeypair implements Signer {
30
30
 
31
31
  public abstract signSchnorr(hash: Buffer): Buffer;
32
32
 
33
- public abstract verify(hash: Buffer, signature: Buffer): boolean;
33
+ public abstract verify(hash: Buffer, signature: Buffer): boolean | Buffer;
34
34
 
35
35
  public abstract init(): Promise<void>;
36
36
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  crypto as bitCrypto,
3
- script as bitScript,
4
3
  Network,
5
4
  networks,
6
5
  Psbt,
6
+ script as bitScript,
7
7
  TapScriptSig,
8
8
  toXOnly,
9
9
  } from '@btc-vision/bitcoin';