@btc-vision/btc-runtime 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btc-vision/btc-runtime",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Bitcoin Smart Contract Runtime",
5
5
  "main": "btc/index.ts",
6
6
  "types": "btc/index.ts",
@@ -134,6 +134,14 @@ export class BytesWriter {
134
134
  }
135
135
  }
136
136
 
137
+ public writeBytesU8Array(value: u8[]): void {
138
+ this.allocSafe(value.length);
139
+
140
+ for (let i = 0; i < value.length; i++) {
141
+ this.writeU8(value[i]);
142
+ }
143
+ }
144
+
137
145
  public writeBytesWithLength(value: Uint8Array): void {
138
146
  const length: u32 = u32(value.byteLength);
139
147
  this.allocSafe(length + 4);
@@ -29,6 +29,24 @@ export class StoredU256 {
29
29
  return this._value;
30
30
  }
31
31
 
32
+ @inline
33
+ public set value(value: u256) {
34
+ this._value = value;
35
+
36
+ Blockchain.setStorageAt(
37
+ this.address,
38
+ this.pointer,
39
+ this.subPointer,
40
+ this._value,
41
+ this.defaultValue,
42
+ );
43
+ }
44
+
45
+ @inline
46
+ public get toBytes(): Uint8Array {
47
+ return this._value.toUint8Array(true);
48
+ }
49
+
32
50
  @inline
33
51
  @operator('+')
34
52
  public add(value: u256): this {