@btc-vision/btc-runtime 1.11.0-beta.0 → 1.11.0-rc.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.
@@ -106,7 +106,7 @@ npm install --save-dev assemblyscript prettier typescript
106
106
  "@btc-vision/opnet-transform": "^0.1.12"
107
107
  },
108
108
  "devDependencies": {
109
- "assemblyscript": "^0.28.9",
109
+ "@btc-vision/assemblyscript": "^0.29.2",
110
110
  "prettier": "^3.7.4"
111
111
  }
112
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@btc-vision/btc-runtime",
3
- "version": "1.11.0-beta.0",
3
+ "version": "1.11.0-rc.0",
4
4
  "description": "Bitcoin L1 Smart Contract Runtime for OPNet. Build decentralized applications on Bitcoin using AssemblyScript and WebAssembly. Fully audited.",
5
5
  "main": "btc/index.ts",
6
6
  "types": "btc/index.ts",
@@ -60,13 +60,14 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "@assemblyscript/loader": "^0.28.9",
63
- "@btc-vision/as-bignum": "^0.0.7",
64
- "@btc-vision/opnet-transform": "^0.2.1",
63
+ "@btc-vision/as-bignum": "^0.1.2",
64
+ "@btc-vision/assemblyscript": "^0.29.2",
65
+ "@btc-vision/opnet-transform": "^1.0.2",
65
66
  "@eslint/js": "9.39.2",
66
67
  "gulplog": "^2.2.0",
67
68
  "ts-node": "^10.9.2",
68
69
  "typescript": "^5.9.3",
69
- "typescript-eslint": "^8.53.1"
70
+ "typescript-eslint": "^8.54.0"
70
71
  },
71
72
  "devDependencies": {
72
73
  "@btc-vision/as-covers-assembly": "^0.4.4",
@@ -74,7 +75,6 @@
74
75
  "@btc-vision/as-pect-assembly": "^8.2.0",
75
76
  "@btc-vision/as-pect-cli": "^8.2.0",
76
77
  "@btc-vision/as-pect-transform": "^8.2.0",
77
- "@types/node": "^25.0.9",
78
- "assemblyscript": "^0.28.9"
78
+ "@types/node": "^25.2.0"
79
79
  }
80
80
  }
@@ -101,7 +101,7 @@ export abstract class OP20 extends ReentrancyGuard implements IOP20 {
101
101
  * Reentrancy protection level for this contract.
102
102
  * Set to CALLBACK to allow single-depth callbacks for safeTransfer operations.
103
103
  */
104
- protected readonly reentrancyLevel: ReentrancyLevel = ReentrancyLevel.CALLBACK;
104
+ protected override readonly reentrancyLevel: ReentrancyLevel = ReentrancyLevel.CALLBACK;
105
105
 
106
106
  /**
107
107
  * Nested mapping of owner -> spender -> allowance amount.
@@ -746,7 +746,7 @@ export abstract class OP20 extends ReentrancyGuard implements IOP20 {
746
746
  * Checks if a selector should bypass reentrancy guards.
747
747
  * @protected
748
748
  */
749
- protected isSelectorExcluded(selector: Selector): boolean {
749
+ protected override isSelectorExcluded(selector: Selector): boolean {
750
750
  if (
751
751
  selector === BALANCE_OF_SELECTOR ||
752
752
  selector === ALLOWANCE_SELECTOR ||
@@ -839,7 +839,7 @@ export abstract class OP20 extends ReentrancyGuard implements IOP20 {
839
839
  * Internal: Builds EIP-712 domain separator.
840
840
  * @protected
841
841
  */
842
- protected _buildDomainSeparator(): Uint8Array {
842
+ protected override _buildDomainSeparator(): Uint8Array {
843
843
  const writer = new BytesWriter(32 * 5 + ADDRESS_BYTE_LENGTH);
844
844
  writer.writeBytesU8Array(OP712_DOMAIN_TYPE_HASH);
845
845
  writer.writeBytes(sha256String(this._name.value));
@@ -914,7 +914,7 @@ export abstract class OP721 extends ReentrancyGuard implements IOP721 {
914
914
  this._baseURI.value = baseURI;
915
915
  }
916
916
 
917
- protected _buildDomainSeparator(): Uint8Array {
917
+ protected override _buildDomainSeparator(): Uint8Array {
918
918
  const writer = new BytesWriter(32 * 5 + ADDRESS_BYTE_LENGTH);
919
919
  writer.writeBytesU8Array(OP712_DOMAIN_TYPE_HASH);
920
920
 
@@ -1014,6 +1014,7 @@ export abstract class OP721 extends ReentrancyGuard implements IOP721 {
1014
1014
  for (let i: i32 = 0; i < 32; i++) {
1015
1015
  addr[i] = bytes[i];
1016
1016
  }
1017
+
1017
1018
  return addr;
1018
1019
  }
1019
1020
 
@@ -4,6 +4,7 @@ import { BytesWriter } from '../buffer/BytesWriter';
4
4
  import { u256 } from '@btc-vision/as-bignum/assembly';
5
5
  import { Address } from '../types/Address';
6
6
  import { Revert } from '../types/Revert';
7
+ import { BytesReader } from '../buffer/BytesReader';
7
8
 
8
9
  @final
9
10
  export class Nested<T> {
@@ -61,8 +62,8 @@ export class Nested<T> {
61
62
  // We know T is Address
62
63
  return changetype<T>(value);
63
64
  } else if (isInteger<T>()) {
64
- // For a simple integer, just pull out the first byte
65
- return value[0] as T;
65
+ const reader = new BytesReader(value);
66
+ return reader.read<T>();
66
67
  } else if (isString<T>()) {
67
68
  // T is a string
68
69
  return changetype<T>(String.UTF8.decode(value.buffer));
@@ -23,10 +23,6 @@ export class StoredU256 {
23
23
  }
24
24
 
25
25
  public set value(value: u256) {
26
- if (u256.eq(value, this._value)) {
27
- return;
28
- }
29
-
30
26
  this._value = value;
31
27
 
32
28
  Blockchain.setStorageAt(this.pointerBuffer, this.__value);
@@ -317,7 +317,7 @@ export class Address extends Uint8Array {
317
317
  *
318
318
  * @returns The address as a hex string (delegates to toHex())
319
319
  */
320
- public toString(): string {
320
+ public override toString(): string {
321
321
  return this.toHex();
322
322
  }
323
323
 
@@ -351,6 +351,7 @@ export class Address extends Uint8Array {
351
351
  * @private
352
352
  */
353
353
  @operator('[]')
354
+ // @ts-ignore
354
355
  private ___get(index: i32): u8 {
355
356
  if (u32(index) >= u32(this.length)) {
356
357
  throw new RangeError('Index out of range');
@@ -371,6 +372,7 @@ export class Address extends Uint8Array {
371
372
  * @private
372
373
  */
373
374
  @operator('[]=')
375
+ // @ts-ignore
374
376
  private ___set(index: i32, value: u8): void {
375
377
  if (this.isDefined) {
376
378
  throw new Revert(`Cannot modify address data.`);
@@ -116,7 +116,7 @@ export class ExtendedAddress extends Address {
116
116
  * }
117
117
  * ```
118
118
  */
119
- public static zero(): ExtendedAddress {
119
+ public static override zero(): ExtendedAddress {
120
120
  let cached = getCachedZeroAddress();
121
121
  if (cached === 0) {
122
122
  const addr = new ExtendedAddress(ZERO_ARRAY, ZERO_ARRAY);
@@ -221,7 +221,7 @@ export class ExtendedAddress extends Address {
221
221
  * const addr = ExtendedAddress.fromUint8Array(combined);
222
222
  * ```
223
223
  */
224
- public static fromUint8Array(bytes: Uint8Array): ExtendedAddress {
224
+ public static override fromUint8Array(bytes: Uint8Array): ExtendedAddress {
225
225
  if (bytes.length !== 64) {
226
226
  throw new Error('Expected 64 bytes: 32 for tweakedPublicKey, 32 for publicKey');
227
227
  }
@@ -306,7 +306,7 @@ export class ExtendedAddress extends Address {
306
306
  * not the tweaked Schnorr key. Use ZERO_BITCOIN_ADDRESS for a fully
307
307
  * zero ExtendedAddress.
308
308
  */
309
- public isZero(): bool {
309
+ public override isZero(): bool {
310
310
  for (let i = 0; i < this.length; i++) {
311
311
  if (this[i] != 0) {
312
312
  return false;
@@ -381,7 +381,7 @@ export class ExtendedAddress extends Address {
381
381
  *
382
382
  * @override Overrides the base Address.toString() which returns hex
383
383
  */
384
- public toString(): string {
384
+ public override toString(): string {
385
385
  return this.p2tr();
386
386
  }
387
387