@btc-vision/transaction 1.1.6 → 1.1.7

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 +1 @@
1
- export declare const version = "1.1.6";
1
+ export declare const version = "1.1.7";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.1.6';
1
+ export const version = '1.1.7';
@@ -14,6 +14,7 @@ export declare enum ABIDataTypes {
14
14
  ADDRESS_UINT256_TUPLE = "ADDRESS_UINT256_TUPLE",
15
15
  ARRAY_OF_ADDRESSES = "ARRAY_OF_ADDRESSES",
16
16
  ARRAY_OF_UINT256 = "ARRAY_OF_UINT256",
17
+ ARRAY_OF_UINT128 = "ARRAY_OF_UINT128",
17
18
  ARRAY_OF_UINT64 = "ARRAY_OF_UINT64",
18
19
  ARRAY_OF_UINT32 = "ARRAY_OF_UINT32",
19
20
  ARRAY_OF_UINT16 = "ARRAY_OF_UINT16",
@@ -18,6 +18,7 @@ export var ABIDataTypes;
18
18
  ABIDataTypes["ADDRESS_UINT256_TUPLE"] = "ADDRESS_UINT256_TUPLE";
19
19
  ABIDataTypes["ARRAY_OF_ADDRESSES"] = "ARRAY_OF_ADDRESSES";
20
20
  ABIDataTypes["ARRAY_OF_UINT256"] = "ARRAY_OF_UINT256";
21
+ ABIDataTypes["ARRAY_OF_UINT128"] = "ARRAY_OF_UINT128";
21
22
  ABIDataTypes["ARRAY_OF_UINT64"] = "ARRAY_OF_UINT64";
22
23
  ABIDataTypes["ARRAY_OF_UINT32"] = "ARRAY_OF_UINT32";
23
24
  ABIDataTypes["ARRAY_OF_UINT16"] = "ARRAY_OF_UINT16";
@@ -77,6 +78,9 @@ export class ABICoder {
77
78
  case ABIDataTypes.ARRAY_OF_UINT256:
78
79
  result.push(byteReader.readU256Array());
79
80
  break;
81
+ case ABIDataTypes.ARRAY_OF_UINT128:
82
+ result.push(byteReader.readU128Array());
83
+ break;
80
84
  case ABIDataTypes.ARRAY_OF_UINT64:
81
85
  result.push(byteReader.readU64Array());
82
86
  break;
@@ -11,6 +11,7 @@ export declare class BinaryReader {
11
11
  setBuffer(bytes: BufferLike): void;
12
12
  readAddressArray(): Address[];
13
13
  readU256Array(): bigint[];
14
+ readU128Array(): bigint[];
14
15
  readU64Array(): bigint[];
15
16
  readU32Array(): u32[];
16
17
  readU16Array(): u16[];
@@ -43,6 +43,14 @@ export class BinaryReader {
43
43
  }
44
44
  return result;
45
45
  }
46
+ readU128Array() {
47
+ const length = this.readU16();
48
+ const result = new Array(length);
49
+ for (let i = 0; i < length; i++) {
50
+ result[i] = this.readU128();
51
+ }
52
+ return result;
53
+ }
46
54
  readU64Array() {
47
55
  const length = this.readU16();
48
56
  const result = new Array(length);
@@ -33,6 +33,7 @@ export declare class BinaryWriter {
33
33
  writeAddressArray(value: Address[]): void;
34
34
  writeU32Array(value: u32[]): void;
35
35
  writeU256Array(value: bigint[]): void;
36
+ writeU128Array(value: bigint[]): void;
36
37
  writeStringArray(value: string[]): void;
37
38
  writeU16Array(value: u16[]): void;
38
39
  writeU8Array(value: u8[]): void;
@@ -190,6 +190,14 @@ export class BinaryWriter {
190
190
  this.writeU256(value[i]);
191
191
  }
192
192
  }
193
+ writeU128Array(value) {
194
+ if (value.length > 65535)
195
+ throw new Error('Array size is too large');
196
+ this.writeU16(value.length);
197
+ for (let i = 0; i < value.length; i++) {
198
+ this.writeU128(value[i]);
199
+ }
200
+ }
193
201
  writeStringArray(value) {
194
202
  if (value.length > 65535)
195
203
  throw new Error('Array size is too large');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@btc-vision/transaction",
3
3
  "type": "module",
4
- "version": "1.1.6",
4
+ "version": "1.1.7",
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.1.6';
1
+ export const version = '1.1.7';
@@ -19,6 +19,7 @@ export enum ABIDataTypes {
19
19
  ADDRESS_UINT256_TUPLE = 'ADDRESS_UINT256_TUPLE',
20
20
  ARRAY_OF_ADDRESSES = 'ARRAY_OF_ADDRESSES',
21
21
  ARRAY_OF_UINT256 = 'ARRAY_OF_UINT256',
22
+ ARRAY_OF_UINT128 = 'ARRAY_OF_UINT128',
22
23
  ARRAY_OF_UINT64 = 'ARRAY_OF_UINT64',
23
24
  ARRAY_OF_UINT32 = 'ARRAY_OF_UINT32',
24
25
  ARRAY_OF_UINT16 = 'ARRAY_OF_UINT16',
@@ -80,6 +81,9 @@ export class ABICoder {
80
81
  case ABIDataTypes.ARRAY_OF_UINT256:
81
82
  result.push(byteReader.readU256Array());
82
83
  break;
84
+ case ABIDataTypes.ARRAY_OF_UINT128:
85
+ result.push(byteReader.readU128Array());
86
+ break;
83
87
  case ABIDataTypes.ARRAY_OF_UINT64:
84
88
  result.push(byteReader.readU64Array());
85
89
  break;
@@ -55,6 +55,17 @@ export class BinaryReader {
55
55
  return result;
56
56
  }
57
57
 
58
+ public readU128Array(): bigint[] {
59
+ const length = this.readU16();
60
+ const result: bigint[] = new Array<bigint>(length);
61
+
62
+ for (let i = 0; i < length; i++) {
63
+ result[i] = this.readU128();
64
+ }
65
+
66
+ return result;
67
+ }
68
+
58
69
  public readU64Array(): bigint[] {
59
70
  const length = this.readU16();
60
71
  const result: bigint[] = new Array<bigint>(length);
@@ -244,6 +244,16 @@ export class BinaryWriter {
244
244
  }
245
245
  }
246
246
 
247
+ public writeU128Array(value: bigint[]): void {
248
+ if (value.length > 65535) throw new Error('Array size is too large');
249
+
250
+ this.writeU16(value.length);
251
+
252
+ for (let i = 0; i < value.length; i++) {
253
+ this.writeU128(value[i]);
254
+ }
255
+ }
256
+
247
257
  public writeStringArray(value: string[]): void {
248
258
  if (value.length > 65535) throw new Error('Array size is too large');
249
259