@algorandfoundation/algorand-typescript 0.0.1-alpha.13 → 0.0.1-alpha.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.
@@ -5,6 +5,7 @@ type NativeForArc4Int<N extends BitSize> = N extends 8 | 16 | 32 | 64 ? uint64 :
5
5
  type CompatForArc4Int<N extends BitSize> = N extends 8 | 16 | 32 | 64 ? Uint64Compat : BigUintCompat;
6
6
  declare abstract class AbiEncoded implements BytesBacked {
7
7
  get bytes(): bytes;
8
+ equals(other: this): boolean;
8
9
  }
9
10
  export declare class Str extends AbiEncoded {
10
11
  constructor(s: StringCompat);
@@ -19,25 +20,45 @@ export declare class UFixedNxM<N extends BitSize, M extends number> {
19
20
  get native(): NativeForArc4Int<N>;
20
21
  }
21
22
  export declare class Byte extends UintN<8> {
22
- constructor(v: Uint64Compat);
23
- get native(): uint64;
23
+ constructor(v?: Uint64Compat);
24
24
  }
25
25
  export declare class Bool {
26
26
  #private;
27
- constructor(v: boolean);
27
+ constructor(v?: boolean);
28
28
  get native(): boolean;
29
29
  }
30
- declare abstract class Arc4Array<TItem> extends AbiEncoded {
30
+ declare abstract class Arc4ReadonlyArray<TItem extends AbiEncoded> extends AbiEncoded {
31
31
  protected items: TItem[];
32
32
  protected constructor(items: TItem[]);
33
+ /**
34
+ * Returns the current length of this array
35
+ */
33
36
  get length(): uint64;
37
+ /**
38
+ * Returns the item at the given index.
39
+ * Negative indexes are taken from the end.
40
+ * @param index The index of the item to retrieve
41
+ */
34
42
  at(index: Uint64Compat): TItem;
35
- slice(start: Uint64Compat, end: Uint64Compat): DynamicArray<TItem>;
43
+ /**
44
+ * Returns an iterator for the items in this array
45
+ */
36
46
  [Symbol.iterator](): IterableIterator<TItem>;
47
+ /**
48
+ * Returns an iterator for a tuple of the indexes and items in this array
49
+ */
37
50
  entries(): IterableIterator<readonly [uint64, TItem]>;
51
+ /**
52
+ * Returns an iterator for the indexes in this array
53
+ */
38
54
  keys(): IterableIterator<uint64>;
55
+ /**
56
+ * Get or set the item at the specified index.
57
+ * Negative indexes are not supported
58
+ */
59
+ [index: uint64]: TItem;
39
60
  }
40
- export declare class StaticArray<TItem, TLength extends number> extends Arc4Array<TItem> {
61
+ export declare class StaticArray<TItem extends AbiEncoded, TLength extends number> extends Arc4ReadonlyArray<TItem> {
41
62
  constructor();
42
63
  constructor(...items: TItem[] & {
43
64
  length: TLength;
@@ -45,9 +66,16 @@ export declare class StaticArray<TItem, TLength extends number> extends Arc4Arra
45
66
  constructor(...items: TItem[]);
46
67
  copy(): StaticArray<TItem, TLength>;
47
68
  }
48
- export declare class DynamicArray<TItem> extends Arc4Array<TItem> {
69
+ export declare class DynamicArray<TItem extends AbiEncoded> extends Arc4ReadonlyArray<TItem> {
49
70
  constructor(...items: TItem[]);
71
+ /**
72
+ * Push a number of items into this array
73
+ * @param items The items to be added to this array
74
+ */
50
75
  push(...items: TItem[]): void;
76
+ /**
77
+ * Pop a single item from this array
78
+ */
51
79
  pop(): TItem;
52
80
  copy(): DynamicArray<TItem>;
53
81
  }
@@ -58,8 +86,8 @@ export declare class Tuple<TTuple extends unknown[]> {
58
86
  at<TIndex extends number>(index: TIndex): ItemAt<TTuple, TIndex>;
59
87
  get native(): TTuple;
60
88
  }
61
- export declare class Address extends StaticArray<Byte, 32> {
62
- constructor(value: Account | string | bytes);
89
+ export declare class Address extends Arc4ReadonlyArray<Byte> {
90
+ constructor(value?: Account | string | bytes);
63
91
  get native(): Account;
64
92
  }
65
93
  export {};
package/arc4/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Address, s as Bool, r as Byte, C as Contract, D as DynamicArray, k as OnCompleteAction, t as StaticArray, S as Str, T as Tuple, q as UFixedNxM, o as UintN, g as abimethod, n as baremethod } from '../index-CWa8GSj0.js';
1
+ export { x as Address, v as Bool, t as Byte, C as Contract, D as DynamicArray, o as OnCompleteAction, w as StaticArray, S as Str, T as Tuple, s as UFixedNxM, r as UintN, g as abimethod, q as baremethod } from '../index-hpwu00-P.js';
2
2
  import '../execution-context-BznYSiE4.js';
3
3
  import 'node:buffer';
4
4
  import 'node:util';
package/box.d.ts CHANGED
@@ -29,8 +29,8 @@ export type BoxRef = {
29
29
  get(options: {
30
30
  default: bytes;
31
31
  }): bytes;
32
- put(value: bytes): bytes;
33
- splice(start: uint64, end: uint64, value: bytes): void;
32
+ put(value: bytes): void;
33
+ splice(start: uint64, length: uint64, value: bytes): void;
34
34
  replace(start: uint64, value: bytes): void;
35
35
  extract(start: uint64, length: uint64): bytes;
36
36
  delete(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"execution-context-BznYSiE4.js","sources":["../src/execution-context.ts"],"sourcesContent":["import { Contract, GlobalState, gtxn, itxn, LocalState } from '.'\nimport { AbiMethodConfig, BareMethodConfig } from './arc4'\nimport { OpsNamespace } from './op-types'\nimport { bytes, uint64 } from './primitives'\nimport { Account, Application, Asset } from './reference'\n\nexport type ExecutionContext = {\n log(value: bytes): void\n application(id?: uint64): Application\n asset(id?: uint64): Asset\n account(address?: bytes): Account\n op: Partial<OpsNamespace>\n abiMetadata: {\n captureMethodConfig<T extends Contract>(contract: T, methodName: string, config?: AbiMethodConfig<T> | BareMethodConfig): void\n }\n gtxn: {\n Transaction: typeof gtxn.Transaction\n PaymentTxn: typeof gtxn.PaymentTxn\n KeyRegistrationTxn: typeof gtxn.KeyRegistrationTxn\n AssetConfigTxn: typeof gtxn.AssetConfigTxn\n AssetTransferTxn: typeof gtxn.AssetTransferTxn\n AssetFreezeTxn: typeof gtxn.AssetFreezeTxn\n ApplicationTxn: typeof gtxn.ApplicationTxn\n }\n itxn: {\n submitGroup: typeof itxn.submitGroup\n payment: typeof itxn.payment\n keyRegistration: typeof itxn.keyRegistration\n assetConfig: typeof itxn.assetConfig\n assetTransfer: typeof itxn.assetTransfer\n assetFreeze: typeof itxn.assetFreeze\n applicationCall: typeof itxn.applicationCall\n }\n state: {\n createGlobalState: typeof GlobalState\n createLocalState: typeof LocalState\n }\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var puyaTsExecutionContext: ExecutionContext | undefined\n}\n\nexport const ctxMgr = {\n set instance(ctx: ExecutionContext) {\n const instance = global.puyaTsExecutionContext\n if (instance != undefined) throw new Error('Execution context has already been set')\n global.puyaTsExecutionContext = ctx\n },\n get instance() {\n const instance = global.puyaTsExecutionContext\n if (instance == undefined) throw new Error('No execution context has been set')\n return instance\n },\n reset() {\n global.puyaTsExecutionContext = undefined\n },\n}\n"],"names":[],"mappings":"AA4Ca,MAAA,MAAM,GAAG;IACpB,IAAI,QAAQ,CAAC,GAAqB,EAAA;AAChC,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,sBAAsB,CAAA;QAC9C,IAAI,QAAQ,IAAI,SAAS;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;AACpF,QAAA,MAAM,CAAC,sBAAsB,GAAG,GAAG,CAAA;KACpC;AACD,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,sBAAsB,CAAA;QAC9C,IAAI,QAAQ,IAAI,SAAS;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;AAC/E,QAAA,OAAO,QAAQ,CAAA;KAChB;IACD,KAAK,GAAA;AACH,QAAA,MAAM,CAAC,sBAAsB,GAAG,SAAS,CAAA;KAC1C;;;;;"}
1
+ {"version":3,"file":"execution-context-BznYSiE4.js","sources":["../src/execution-context.ts"],"sourcesContent":["import { Box, BoxMap, BoxRef, Contract, GlobalState, gtxn, itxn, LocalState } from '.'\nimport { AbiMethodConfig, BareMethodConfig } from './arc4'\nimport { OpsNamespace } from './op-types'\nimport { bytes, uint64 } from './primitives'\nimport { Account, Application, Asset } from './reference'\n\nexport type ExecutionContext = {\n log(value: bytes): void\n application(id?: uint64): Application\n asset(id?: uint64): Asset\n account(address?: bytes): Account\n op: Partial<OpsNamespace>\n abiMetadata: {\n captureMethodConfig<T extends Contract>(contract: T, methodName: string, config?: AbiMethodConfig<T> | BareMethodConfig): void\n }\n gtxn: {\n Transaction: typeof gtxn.Transaction\n PaymentTxn: typeof gtxn.PaymentTxn\n KeyRegistrationTxn: typeof gtxn.KeyRegistrationTxn\n AssetConfigTxn: typeof gtxn.AssetConfigTxn\n AssetTransferTxn: typeof gtxn.AssetTransferTxn\n AssetFreezeTxn: typeof gtxn.AssetFreezeTxn\n ApplicationTxn: typeof gtxn.ApplicationTxn\n }\n itxn: {\n submitGroup: typeof itxn.submitGroup\n payment: typeof itxn.payment\n keyRegistration: typeof itxn.keyRegistration\n assetConfig: typeof itxn.assetConfig\n assetTransfer: typeof itxn.assetTransfer\n assetFreeze: typeof itxn.assetFreeze\n applicationCall: typeof itxn.applicationCall\n }\n state: {\n GlobalState: typeof GlobalState\n LocalState: typeof LocalState\n Box: typeof Box\n BoxMap: typeof BoxMap\n BoxRef: typeof BoxRef\n }\n}\n\ndeclare global {\n // eslint-disable-next-line no-var\n var puyaTsExecutionContext: ExecutionContext | undefined\n}\n\nexport const ctxMgr = {\n set instance(ctx: ExecutionContext) {\n const instance = global.puyaTsExecutionContext\n if (instance != undefined) throw new Error('Execution context has already been set')\n global.puyaTsExecutionContext = ctx\n },\n get instance() {\n const instance = global.puyaTsExecutionContext\n if (instance == undefined) throw new Error('No execution context has been set')\n return instance\n },\n reset() {\n global.puyaTsExecutionContext = undefined\n },\n}\n"],"names":[],"mappings":"AA+Ca,MAAA,MAAM,GAAG;IACpB,IAAI,QAAQ,CAAC,GAAqB,EAAA;AAChC,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,sBAAsB,CAAA;QAC9C,IAAI,QAAQ,IAAI,SAAS;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;AACpF,QAAA,MAAM,CAAC,sBAAsB,GAAG,GAAG,CAAA;KACpC;AACD,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,sBAAsB,CAAA;QAC9C,IAAI,QAAQ,IAAI,SAAS;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;AAC/E,QAAA,OAAO,QAAQ,CAAA;KAChB;IACD,KAAK,GAAA;AACH,QAAA,MAAM,CAAC,sBAAsB,GAAG,SAAS,CAAA;KAC1C;;;;;"}
@@ -1,4 +1,4 @@
1
- import { Contract, GlobalState, gtxn, itxn, LocalState } from '.';
1
+ import { Box, BoxMap, BoxRef, Contract, GlobalState, gtxn, itxn, LocalState } from '.';
2
2
  import { AbiMethodConfig, BareMethodConfig } from './arc4';
3
3
  import { OpsNamespace } from './op-types';
4
4
  import { bytes, uint64 } from './primitives';
@@ -31,8 +31,11 @@ export type ExecutionContext = {
31
31
  applicationCall: typeof itxn.applicationCall;
32
32
  };
33
33
  state: {
34
- createGlobalState: typeof GlobalState;
35
- createLocalState: typeof LocalState;
34
+ GlobalState: typeof GlobalState;
35
+ LocalState: typeof LocalState;
36
+ Box: typeof Box;
37
+ BoxMap: typeof BoxMap;
38
+ BoxRef: typeof BoxRef;
36
39
  };
37
40
  };
38
41
  declare global {
@@ -13,6 +13,7 @@ export declare const toBytes: (val: unknown) => bytes;
13
13
  * @param v
14
14
  */
15
15
  export declare const getNumber: (v: StubUint64Compat) => number;
16
+ export declare const getUint8Array: (v: StubBytesCompat) => Uint8Array;
16
17
  export declare const isBytes: (v: unknown) => v is StubBytesCompat;
17
18
  export declare const isUint64: (v: unknown) => v is StubUint64Compat;
18
19
  export declare const checkUint64: (v: bigint) => bigint;
@@ -248,6 +248,9 @@ const getNumber = (v) => {
248
248
  return v.asNumber();
249
249
  internalError(`Cannot convert ${v} to number`);
250
250
  };
251
+ const getUint8Array = (v) => {
252
+ return BytesCls.fromCompat(v).asUint8Array();
253
+ };
251
254
  const isBytes = (v) => {
252
255
  if (typeof v === 'string')
253
256
  return true;
@@ -256,8 +259,6 @@ const isBytes = (v) => {
256
259
  return v instanceof Uint8Array;
257
260
  };
258
261
  const isUint64 = (v) => {
259
- if (typeof v == 'boolean')
260
- return true;
261
262
  if (typeof v == 'number')
262
263
  return true;
263
264
  if (typeof v == 'bigint')
@@ -553,6 +554,7 @@ var primitives = /*#__PURE__*/Object.freeze({
553
554
  checkBytes: checkBytes,
554
555
  checkUint64: checkUint64,
555
556
  getNumber: getNumber,
557
+ getUint8Array: getUint8Array,
556
558
  isBytes: isBytes,
557
559
  isUint64: isUint64,
558
560
  toBytes: toBytes,
@@ -646,6 +648,16 @@ function urange(a, b, c) {
646
648
  throw new Error('Not implemented');
647
649
  }
648
650
 
651
+ function Account(address) {
652
+ return ctxMgr.instance.account(address);
653
+ }
654
+ function Asset(assetId) {
655
+ return ctxMgr.instance.asset(assetId);
656
+ }
657
+ function Application(applicationId) {
658
+ return ctxMgr.instance.application(applicationId);
659
+ }
660
+
649
661
  class BaseContract {
650
662
  clearStateProgram() {
651
663
  return true;
@@ -656,6 +668,9 @@ class AbiEncoded {
656
668
  get bytes() {
657
669
  throw new Error('todo');
658
670
  }
671
+ equals(other) {
672
+ return this.bytes.equals(other.bytes);
673
+ }
659
674
  }
660
675
  class Str extends AbiEncoded {
661
676
  constructor(s) {
@@ -683,45 +698,85 @@ class Byte extends UintN {
683
698
  constructor(v) {
684
699
  super(v);
685
700
  }
686
- get native() {
687
- throw new Error('TODO');
688
- }
689
701
  }
690
702
  class Bool {
691
703
  #v;
692
704
  constructor(v) {
693
- this.#v = v;
705
+ this.#v = v ?? false;
694
706
  }
695
707
  get native() {
696
708
  return this.#v;
697
709
  }
698
710
  }
699
- class Arc4Array extends AbiEncoded {
711
+ class Arc4ReadonlyArray extends AbiEncoded {
700
712
  items;
701
713
  constructor(items) {
702
714
  super();
703
- this.items = items;
715
+ this.items = items.slice();
716
+ return new Proxy(this, {
717
+ get(target, prop) {
718
+ if (isUint64(prop)) {
719
+ const idx = getNumber(prop);
720
+ if (idx < target.items.length)
721
+ return target.items[idx];
722
+ avmError('Index out of bounds');
723
+ }
724
+ return Reflect.get(target, prop);
725
+ },
726
+ set(target, prop, value) {
727
+ if (isUint64(prop)) {
728
+ const idx = getNumber(prop);
729
+ if (idx < target.items.length) {
730
+ target.items[idx] = value;
731
+ return true;
732
+ }
733
+ avmError('Index out of bounds');
734
+ }
735
+ avmError('Property is not writable');
736
+ },
737
+ });
704
738
  }
739
+ /**
740
+ * Returns the current length of this array
741
+ */
705
742
  get length() {
706
- throw new Error('TODO');
743
+ return Uint64(this.items.length);
707
744
  }
745
+ /**
746
+ * Returns the item at the given index.
747
+ * Negative indexes are taken from the end.
748
+ * @param index The index of the item to retrieve
749
+ */
708
750
  at(index) {
709
751
  return arrayUtil.arrayAt(this.items, index);
710
752
  }
711
753
  slice(start, end) {
712
754
  return new DynamicArray(...arrayUtil.arraySlice(this.items, start, end));
713
755
  }
756
+ /**
757
+ * Returns an iterator for the items in this array
758
+ */
714
759
  [Symbol.iterator]() {
715
760
  return this.items[Symbol.iterator]();
716
761
  }
717
- entries() {
718
- throw new Error('TODO');
762
+ /**
763
+ * Returns an iterator for a tuple of the indexes and items in this array
764
+ */
765
+ *entries() {
766
+ for (const [idx, item] of this.items.entries()) {
767
+ yield [Uint64(idx), item];
768
+ }
719
769
  }
720
- keys() {
721
- throw new Error('TODO');
770
+ /**
771
+ * Returns an iterator for the indexes in this array
772
+ */
773
+ *keys() {
774
+ for (const idx of this.items.keys()) {
775
+ yield Uint64(idx);
776
+ }
722
777
  }
723
778
  }
724
- class StaticArray extends Arc4Array {
779
+ class StaticArray extends Arc4ReadonlyArray {
725
780
  constructor(...items) {
726
781
  super(items);
727
782
  }
@@ -729,13 +784,25 @@ class StaticArray extends Arc4Array {
729
784
  return new StaticArray(...this.items);
730
785
  }
731
786
  }
732
- class DynamicArray extends Arc4Array {
787
+ class DynamicArray extends Arc4ReadonlyArray {
733
788
  constructor(...items) {
734
789
  super(items);
735
790
  }
736
- push(...items) { }
791
+ /**
792
+ * Push a number of items into this array
793
+ * @param items The items to be added to this array
794
+ */
795
+ push(...items) {
796
+ this.items.push(...items);
797
+ }
798
+ /**
799
+ * Pop a single item from this array
800
+ */
737
801
  pop() {
738
- throw new Error('Not implemented');
802
+ const item = this.items.pop();
803
+ if (item === undefined)
804
+ avmError('The array is empty');
805
+ return item;
739
806
  }
740
807
  copy() {
741
808
  return new DynamicArray(...this.items);
@@ -753,12 +820,27 @@ class Tuple {
753
820
  return this.#items;
754
821
  }
755
822
  }
756
- class Address extends StaticArray {
823
+ class Address extends Arc4ReadonlyArray {
757
824
  constructor(value) {
758
- super();
825
+ let byteValues;
826
+ if (value === undefined) {
827
+ byteValues = new Uint8Array(32);
828
+ }
829
+ else if (typeof value === 'string') {
830
+ // Interpret as base 32
831
+ byteValues = BytesCls.fromBase32(value).asUint8Array();
832
+ }
833
+ else if (isBytes(value)) {
834
+ byteValues = getUint8Array(value);
835
+ }
836
+ else {
837
+ byteValues = getUint8Array(value.bytes);
838
+ }
839
+ avmInvariant(byteValues.length === 32, 'Addresses should be 32 bytes');
840
+ super(Array.from(byteValues).map((b) => new Byte(b)));
759
841
  }
760
842
  get native() {
761
- throw new Error('TODO');
843
+ return Account(Bytes(this.items.map((i) => i.native)));
762
844
  }
763
845
  }
764
846
 
@@ -810,5 +892,5 @@ var index = /*#__PURE__*/Object.freeze({
810
892
  baremethod: baremethod
811
893
  });
812
894
 
813
- export { Address as A, BaseContract as B, Contract as C, DynamicArray as D, OpUpFeeSource as O, Str as S, Tuple as T, Uint64 as U, errors as a, err as b, assert as c, assertMatch as d, encodingUtil as e, ensureBudget as f, abimethod as g, BigUint as h, index as i, Bytes as j, OnCompleteAction as k, log as l, match as m, baremethod as n, UintN as o, primitives as p, UFixedNxM as q, Byte as r, Bool as s, StaticArray as t, urange as u };
814
- //# sourceMappingURL=index-CWa8GSj0.js.map
895
+ export { Account as A, BaseContract as B, Contract as C, DynamicArray as D, OpUpFeeSource as O, Str as S, Tuple as T, Uint64 as U, errors as a, err as b, assert as c, assertMatch as d, encodingUtil as e, ensureBudget as f, abimethod as g, BigUint as h, index as i, Bytes as j, Asset as k, log as l, match as m, Application as n, OnCompleteAction as o, primitives as p, baremethod as q, UintN as r, UFixedNxM as s, Byte as t, urange as u, Bool as v, StaticArray as w, Address as x };
896
+ //# sourceMappingURL=index-hpwu00-P.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-hpwu00-P.js","sources":["../src/impl/errors.ts","../src/impl/base-32.ts","../src/impl/encoding-util.ts","../src/impl/name-of-type.ts","../src/impl/primitives.ts","../src/primitives.ts","../src/util.ts","../src/reference.ts","../src/base-contract.ts","../src/arc4/encoded-types.ts","../src/arc4/index.ts"],"sourcesContent":["/**\n * Raised when an `err` op is encountered, or when the testing VM is asked to do something that would cause\n * the AVM to fail.\n */\nexport class AvmError extends Error {\n constructor(message: string) {\n super(message)\n }\n}\nexport function avmError(message: string): never {\n throw new AvmError(message)\n}\n\nexport function avmInvariant(condition: unknown, message: string): asserts condition {\n if (!condition) {\n throw new AvmError(message)\n }\n}\n/**\n * Raised when an assertion fails\n */\nexport class AssertError extends AvmError {\n constructor(message: string) {\n super(message)\n }\n}\n\n/**\n * Raised when testing code errors\n */\nexport class InternalError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options)\n }\n}\n\nexport function internalError(message: string): never {\n throw new InternalError(message)\n}\n\n/**\n * Raised when unsupported user code is encountered\n */\nexport class CodeError extends Error {\n constructor(message: string, options?: ErrorOptions) {\n super(message, options)\n }\n}\n\nexport function codeError(message: string): never {\n throw new CodeError(message)\n}\n","const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.split('')\n\nconst CHAR_TO_NUM = BASE32_ALPHABET.reduce((acc, cur, index) => ((acc[cur] = index), acc), {} as Record<string, number>)\n\nexport const base32ToUint8Array = (value: string): Uint8Array => {\n let allChars = value\n .split('')\n .filter((c) => c !== '=')\n .map((c) => {\n const cUpper = c.toUpperCase()\n if (cUpper in CHAR_TO_NUM) return CHAR_TO_NUM[cUpper]\n throw new Error(`Invalid base32 char ${c}`)\n })\n const bytes = new Array<number>()\n while (allChars.length) {\n const [a, b, c, d, e, f, g, h, ...rest] = allChars\n if (a === undefined || b === undefined) break\n bytes.push(((a << 3) | (b >>> 2)) & 255)\n if (c === undefined || d === undefined) break\n bytes.push(((b << 6) | (c << 1) | (d >>> 4)) & 255)\n if (e === undefined) break\n bytes.push(((d << 4) | (e >>> 1)) & 255)\n if (f === undefined || g === undefined) break\n bytes.push(((e << 7) | (f << 2) | (g >>> 3)) & 255)\n if (h === undefined) break\n bytes.push(((g << 5) | h) & 255)\n allChars = rest\n }\n return new Uint8Array(bytes)\n}\n\nexport const uint8ArrayToBase32 = (value: Uint8Array): string => {\n let allBytes = Array.from(value)\n let base32str = ''\n while (allBytes.length) {\n const [a, b, c, d, e, ...rest] = allBytes ?? [0, 0, 0, 0, 0]\n\n if (allBytes.length < 1) break\n base32str += BASE32_ALPHABET[a >>> 3]\n base32str += BASE32_ALPHABET[((a << 2) | ((b || 0) >>> 6)) & 31]\n if (allBytes.length < 2) break\n base32str += BASE32_ALPHABET[(b >>> 1) & 31]\n base32str += BASE32_ALPHABET[((b << 4) | (c >>> 4)) & 31]\n if (allBytes.length < 3) break\n base32str += BASE32_ALPHABET[((c << 1) | (d >>> 7)) & 31]\n if (allBytes.length < 4) break\n base32str += BASE32_ALPHABET[(d >>> 2) & 31]\n base32str += BASE32_ALPHABET[((d << 3) | (e >>> 5)) & 31]\n if (allBytes.length < 5) break\n base32str += BASE32_ALPHABET[e & 31]\n allBytes = rest\n }\n return base32str\n}\n","import { Buffer } from 'node:buffer'\nimport { TextDecoder } from 'node:util'\nimport { AvmError } from './errors'\n\nexport const uint8ArrayToBigInt = (v: Uint8Array): bigint => {\n // Assume big-endian\n return Array.from(v)\n .toReversed()\n .map((byte_value, i): bigint => BigInt(byte_value) << BigInt(i * 8))\n .reduce((a, b) => a + b, 0n)\n}\n\nexport const hexToUint8Array = (value: string): Uint8Array => {\n if (value.length % 2 !== 0) {\n // TODO: Verify AVM behaviour is to fail\n throw new AvmError('Hex string must have even number of characters')\n }\n return Uint8Array.from(Buffer.from(value, 'hex'))\n}\n\nexport const base64ToUint8Array = (value: string): Uint8Array => {\n return Uint8Array.from(Buffer.from(value, 'base64'))\n}\n\nexport const bigIntToUint8Array = (val: bigint, fixedSize: number | 'dynamic' = 'dynamic'): Uint8Array => {\n if (val === 0n && fixedSize === 'dynamic') {\n return new Uint8Array(0)\n }\n const maxBytes = fixedSize === 'dynamic' ? undefined : fixedSize\n\n let hex = val.toString(16)\n\n // Pad the hex with zeros so it matches the size in bytes\n if (fixedSize !== 'dynamic' && hex.length !== fixedSize * 2) {\n hex = hex.padStart(fixedSize * 2, '0')\n } else if (hex.length % 2 == 1) {\n // Pad to 'whole' byte\n hex = `0${hex}`\n }\n if (maxBytes && hex.length > maxBytes * 2) {\n throw new AvmError(`Cannot encode ${val} as ${maxBytes} bytes as it would overflow`)\n }\n const byteArray = new Uint8Array(hex.length / 2)\n for (let i = 0, j = 0; i < hex.length / 2; i++, j += 2) {\n byteArray[i] = parseInt(hex.slice(j, j + 2), 16)\n }\n return byteArray\n}\n\nexport const utf8ToUint8Array = (value: string): Uint8Array => {\n const encoder = new TextEncoder()\n return encoder.encode(value)\n}\n\nexport const uint8ArrayToUtf8 = (value: Uint8Array): string => {\n const decoder = new TextDecoder()\n return decoder.decode(value)\n}\n\nexport const uint8ArrayToHex = (value: Uint8Array): string => Buffer.from(value).toString('hex')\n\nexport const uint8ArrayToBase64 = (value: Uint8Array): string => Buffer.from(value).toString('base64')\n\nexport const uint8ArrayToBase64Url = (value: Uint8Array): string => Buffer.from(value).toString('base64url')\n\nexport { uint8ArrayToBase32 } from './base-32'\n","export const nameOfType = (x: unknown) => {\n if (typeof x === 'object') {\n if (x === null) return 'Null'\n if (x === undefined) return 'undefined'\n if ('constructor' in x) {\n return x.constructor.name\n }\n }\n return typeof x\n}\n","import type { biguint, BigUintCompat, bytes, BytesCompat, uint64, Uint64Compat } from '../index'\nimport { base32ToUint8Array } from './base-32'\nimport {\n base64ToUint8Array,\n bigIntToUint8Array,\n hexToUint8Array,\n uint8ArrayToBigInt,\n uint8ArrayToHex,\n uint8ArrayToUtf8,\n utf8ToUint8Array,\n} from './encoding-util'\nimport { avmError, AvmError, avmInvariant, internalError } from './errors'\nimport { nameOfType } from './name-of-type'\n\nconst MAX_UINT8 = 2 ** 8 - 1\nconst MAX_BYTES_SIZE = 4096\n\nexport type StubBigUintCompat = BigUintCompat | BigUintCls | Uint64Cls\nexport type StubBytesCompat = BytesCompat | BytesCls\nexport type StubUint64Compat = Uint64Compat | Uint64Cls\n\nexport function toExternalValue(val: uint64): bigint\nexport function toExternalValue(val: biguint): bigint\nexport function toExternalValue(val: bytes): Uint8Array\nexport function toExternalValue(val: string): string\nexport function toExternalValue(val: uint64 | biguint | bytes | string) {\n const instance = val as unknown\n if (instance instanceof BytesCls) return instance.asUint8Array()\n if (instance instanceof Uint64Cls) return instance.asBigInt()\n if (instance instanceof BigUintCls) return instance.asBigInt()\n if (typeof val === 'string') return val\n}\nexport const toBytes = (val: unknown): bytes => {\n if (val instanceof AlgoTsPrimitiveCls) return val.toBytes().asAlgoTs()\n\n switch (typeof val) {\n case 'string':\n return BytesCls.fromCompat(val).asAlgoTs()\n case 'bigint':\n return BigUintCls.fromCompat(val).toBytes().asAlgoTs()\n case 'number':\n return Uint64Cls.fromCompat(val).toBytes().asAlgoTs()\n default:\n internalError(`Unsupported arg type ${nameOfType(val)}`)\n }\n}\n\n/**\n * Convert a StubUint64Compat value into a 'number' if possible.\n * This value may be negative\n * @param v\n */\nexport const getNumber = (v: StubUint64Compat): number => {\n if (typeof v == 'boolean') return v ? 1 : 0\n if (typeof v == 'number') return v\n if (typeof v == 'bigint') {\n avmInvariant(\n v <= BigInt(Number.MAX_SAFE_INTEGER) && v >= BigInt(Number.MIN_SAFE_INTEGER),\n 'value cannot be safely converted to a number',\n )\n return Number(v)\n }\n if (v instanceof Uint64Cls) return v.asNumber()\n internalError(`Cannot convert ${v} to number`)\n}\n\nexport const getUint8Array = (v: StubBytesCompat): Uint8Array => {\n return BytesCls.fromCompat(v).asUint8Array()\n}\n\nexport const isBytes = (v: unknown): v is StubBytesCompat => {\n if (typeof v === 'string') return true\n if (v instanceof BytesCls) return true\n return v instanceof Uint8Array\n}\n\nexport const isUint64 = (v: unknown): v is StubUint64Compat => {\n if (typeof v == 'number') return true\n if (typeof v == 'bigint') return true\n return v instanceof Uint64Cls\n}\n\nexport const checkUint64 = (v: bigint): bigint => {\n const u64 = BigInt.asUintN(64, v)\n if (u64 !== v) throw new AvmError(`Uint64 overflow or underflow`)\n return u64\n}\nexport const checkBigUint = (v: bigint): bigint => {\n const uBig = BigInt.asUintN(64 * 8, v)\n if (uBig !== v) throw new AvmError(`BigUint overflow or underflow`)\n return uBig\n}\n\nexport const checkBytes = (v: Uint8Array): Uint8Array => {\n if (v.length > MAX_BYTES_SIZE) throw new AvmError(`Bytes length ${v.length} exceeds maximum length ${MAX_BYTES_SIZE}`)\n return v\n}\n\n/**\n * Verifies that an object is an instance of a type based on its name rather than reference equality.\n *\n * This is useful in scenarios where a module loader has loaded a module twice and hence two instances of a\n * type do not have reference equality on their constructors.\n * @param subject The object to check\n * @param typeCtor The ctor of the type\n */\nfunction isInstanceOfTypeByName(subject: unknown, typeCtor: { name: string }): boolean {\n if (subject === null || typeof subject !== 'object') return false\n\n let ctor = subject.constructor\n while (typeof ctor === 'function') {\n if (ctor.name === typeCtor.name) return true\n ctor = Object.getPrototypeOf(ctor)\n }\n return false\n}\n\nexport abstract class AlgoTsPrimitiveCls {\n static [Symbol.hasInstance](x: unknown): x is AlgoTsPrimitiveCls {\n return isInstanceOfTypeByName(x, AlgoTsPrimitiveCls)\n }\n\n abstract valueOf(): bigint | string\n abstract toBytes(): BytesCls\n}\n\nexport class Uint64Cls extends AlgoTsPrimitiveCls {\n readonly #value: bigint\n constructor(value: bigint | number | string) {\n super()\n this.#value = BigInt(value)\n checkUint64(this.#value)\n\n Object.defineProperty(this, 'uint64', {\n value: this.#value.toString(),\n writable: false,\n enumerable: true,\n })\n }\n static [Symbol.hasInstance](x: unknown): x is Uint64Cls {\n return isInstanceOfTypeByName(x, Uint64Cls)\n }\n static fromCompat(v: StubUint64Compat): Uint64Cls {\n if (typeof v == 'boolean') return new Uint64Cls(v ? 1n : 0n)\n if (typeof v == 'number') return new Uint64Cls(BigInt(v))\n if (typeof v == 'bigint') return new Uint64Cls(v)\n if (v instanceof Uint64Cls) return v\n internalError(`Cannot convert ${v} to uint64`)\n }\n\n valueOf(): bigint {\n return this.#value\n }\n\n toBytes(): BytesCls {\n return new BytesCls(bigIntToUint8Array(this.#value, 8))\n }\n\n asAlgoTs(): uint64 {\n return this as unknown as uint64\n }\n\n asBigInt(): bigint {\n return this.#value\n }\n asNumber(): number {\n if (this.#value > Number.MAX_SAFE_INTEGER) {\n throw new AvmError('value cannot be safely converted to a number')\n }\n return Number(this.#value)\n }\n}\n\nexport class BigUintCls extends AlgoTsPrimitiveCls {\n readonly #value: bigint\n constructor(value: bigint) {\n super()\n this.#value = value\n Object.defineProperty(this, 'biguint', {\n value: value.toString(),\n writable: false,\n enumerable: true,\n })\n }\n valueOf(): bigint {\n return this.#value\n }\n\n toBytes(): BytesCls {\n return new BytesCls(bigIntToUint8Array(this.#value))\n }\n\n asAlgoTs(): biguint {\n return this as unknown as biguint\n }\n\n asBigInt(): bigint {\n return this.#value\n }\n asNumber(): number {\n if (this.#value > Number.MAX_SAFE_INTEGER) {\n throw new AvmError('value cannot be safely converted to a number')\n }\n return Number(this.#value)\n }\n static [Symbol.hasInstance](x: unknown): x is BigUintCls {\n return isInstanceOfTypeByName(x, BigUintCls)\n }\n static fromCompat(v: StubBigUintCompat): BigUintCls {\n if (typeof v == 'boolean') return new BigUintCls(v ? 1n : 0n)\n if (typeof v == 'number') return new BigUintCls(BigInt(v))\n if (typeof v == 'bigint') return new BigUintCls(v)\n if (v instanceof Uint64Cls) return new BigUintCls(v.valueOf())\n if (v instanceof BytesCls) return v.toBigUint()\n if (v instanceof BigUintCls) return v\n internalError(`Cannot convert ${nameOfType(v)} to BigUint`)\n }\n}\n\nexport class BytesCls extends AlgoTsPrimitiveCls {\n readonly #v: Uint8Array\n constructor(v: Uint8Array) {\n super()\n this.#v = v\n checkBytes(this.#v)\n // Add an enumerable property for debugging code to show\n Object.defineProperty(this, 'bytes', {\n value: uint8ArrayToHex(this.#v),\n writable: false,\n enumerable: true,\n })\n }\n\n get length() {\n return new Uint64Cls(this.#v.length)\n }\n\n toBytes(): BytesCls {\n return this\n }\n\n at(i: StubUint64Compat): BytesCls {\n return new BytesCls(arrayUtil.arrayAt(this.#v, i))\n }\n\n slice(start: undefined | StubUint64Compat, end: undefined | StubUint64Compat): BytesCls {\n const sliced = arrayUtil.arraySlice(this.#v, start, end)\n return new BytesCls(sliced)\n }\n\n concat(other: StubBytesCompat): BytesCls {\n const otherArray = BytesCls.fromCompat(other).asUint8Array()\n const mergedArray = new Uint8Array(this.#v.length + otherArray.length)\n mergedArray.set(this.#v)\n mergedArray.set(otherArray, this.#v.length)\n return new BytesCls(mergedArray)\n }\n\n bitwiseAnd(other: StubBytesCompat): BytesCls {\n return this.bitwiseOp(other, (a, b) => a & b)\n }\n\n bitwiseOr(other: StubBytesCompat): BytesCls {\n return this.bitwiseOp(other, (a, b) => a | b)\n }\n\n bitwiseXor(other: StubBytesCompat): BytesCls {\n return this.bitwiseOp(other, (a, b) => a ^ b)\n }\n\n bitwiseInvert(): BytesCls {\n const result = new Uint8Array(this.#v.length)\n this.#v.forEach((v, i) => {\n result[i] = ~v & MAX_UINT8\n })\n return new BytesCls(result)\n }\n\n equals(other: StubBytesCompat): boolean {\n const otherArray = BytesCls.fromCompat(other).asUint8Array()\n if (this.#v.length !== otherArray.length) return false\n for (let i = 0; i < this.#v.length; i++) {\n if (this.#v[i] !== otherArray[i]) return false\n }\n return true\n }\n\n private bitwiseOp(other: StubBytesCompat, op: (a: number, b: number) => number): BytesCls {\n const otherArray = BytesCls.fromCompat(other).asUint8Array()\n const result = new Uint8Array(Math.max(this.#v.length, otherArray.length))\n for (let i = result.length - 1; i >= 0; i--) {\n const thisIndex = i - (result.length - this.#v.length)\n const otherIndex = i - (result.length - otherArray.length)\n result[i] = op(this.#v[thisIndex] ?? 0, otherArray[otherIndex] ?? 0)\n }\n return new BytesCls(result)\n }\n\n valueOf(): string {\n return uint8ArrayToHex(this.#v)\n }\n\n static [Symbol.hasInstance](x: unknown): x is BytesCls {\n return isInstanceOfTypeByName(x, BytesCls)\n }\n\n static fromCompat(v: StubBytesCompat | Uint8Array | undefined): BytesCls {\n if (v === undefined) return new BytesCls(new Uint8Array())\n if (typeof v === 'string') return new BytesCls(utf8ToUint8Array(v))\n if (v instanceof BytesCls) return v\n if (v instanceof Uint8Array) return new BytesCls(v)\n internalError(`Cannot convert ${nameOfType(v)} to bytes`)\n }\n\n static fromInterpolation(template: TemplateStringsArray, replacements: StubBytesCompat[]) {\n return template\n .flatMap((templateText, index) => {\n const replacement = replacements[index]\n if (replacement) {\n return [BytesCls.fromCompat(templateText), BytesCls.fromCompat(replacement)]\n }\n return [BytesCls.fromCompat(templateText)]\n })\n .reduce((a, b) => a.concat(b))\n }\n\n static fromHex(hex: string): BytesCls {\n return new BytesCls(hexToUint8Array(hex))\n }\n\n static fromBase64(b64: string): BytesCls {\n return new BytesCls(base64ToUint8Array(b64))\n }\n\n static fromBase32(b32: string): BytesCls {\n return new BytesCls(base32ToUint8Array(b32))\n }\n\n toUint64(): Uint64Cls {\n return new Uint64Cls(uint8ArrayToBigInt(this.#v))\n }\n\n toBigUint(): BigUintCls {\n return new BigUintCls(uint8ArrayToBigInt(this.#v))\n }\n\n toString(): string {\n return uint8ArrayToUtf8(this.#v)\n }\n\n asAlgoTs(): bytes {\n return this as unknown as bytes\n }\n\n asUint8Array(): Uint8Array {\n return this.#v\n }\n}\n\nexport const arrayUtil = new (class ArrayUtil {\n arrayAt(arrayLike: Uint8Array, index: StubUint64Compat): Uint8Array\n arrayAt<T>(arrayLike: T[], index: StubUint64Compat): T\n arrayAt<T>(arrayLike: T[] | Uint8Array, index: StubUint64Compat): T | Uint8Array\n arrayAt<T>(arrayLike: T[] | Uint8Array, index: StubUint64Compat): T | Uint8Array {\n const indexNum = getNumber(index)\n if (arrayLike instanceof Uint8Array) {\n const res = arrayLike.slice(indexNum, indexNum === -1 ? undefined : indexNum + 1)\n avmInvariant(res.length, 'Index out of bounds')\n return res\n }\n return arrayLike.at(indexNum) ?? avmError('Index out of bounds')\n }\n arraySlice(arrayLike: Uint8Array, start: undefined | StubUint64Compat, end: undefined | StubUint64Compat): Uint8Array\n arraySlice<T>(arrayLike: T[], start: undefined | StubUint64Compat, end: undefined | StubUint64Compat): T[]\n arraySlice<T>(arrayLike: T[] | Uint8Array, start: undefined | StubUint64Compat, end: undefined | StubUint64Compat): Uint8Array | T[]\n arraySlice<T>(arrayLike: T[] | Uint8Array, start: undefined | StubUint64Compat, end: undefined | StubUint64Compat) {\n const startNum = start === undefined ? undefined : getNumber(start)\n const endNum = end === undefined ? undefined : getNumber(end)\n if (arrayLike instanceof Uint8Array) {\n return arrayLike.slice(startNum, endNum)\n } else {\n return arrayLike.slice(startNum, endNum)\n }\n }\n})()\n","import { CodeError } from './impl/errors'\nimport { BigUintCls, BytesCls, getNumber, Uint64Cls } from './impl/primitives'\n\nexport type Uint64Compat = uint64 | bigint | boolean | number\nexport type BigUintCompat = bigint | bytes | number | boolean\nexport type StringCompat = string\nexport type BytesCompat = bytes | string\n\n/**\n * An unsigned integer of exactly 64 bits\n */\nexport type uint64 = {\n __type?: 'uint64'\n} & number\n\n/**\n * Create a uint64 from a bigint literal\n */\nexport function Uint64(v: bigint): uint64\n/**\n * Create a uint64 from a number literal\n */\nexport function Uint64(v: number): uint64\n/**\n * Create a uint64 from a boolean value. True is 1, False is 0\n */\nexport function Uint64(v: boolean): uint64\nexport function Uint64(v: Uint64Compat): uint64 {\n return Uint64Cls.fromCompat(v).asAlgoTs()\n}\n\n/**\n * An unsigned integer of up to 512 bits\n *\n * Stored as a big-endian variable byte array\n */\nexport type biguint = {\n __type?: 'biguint'\n} & bigint\n\n/**\n * Create a biguint from a bigint literal\n */\nexport function BigUint(v: bigint): biguint\n/**\n * Create a biguint from a boolean value (true = 1, false = 0)\n */\nexport function BigUint(v: boolean): biguint\n/**\n * Create a biguint from a uint64 value\n */\nexport function BigUint(v: uint64): biguint\n/**\n * Create a biguint from a number literal\n */\nexport function BigUint(v: number): biguint\n/**\n * Create a biguint from a byte array interpreted as a big-endian number\n */\nexport function BigUint(v: bytes): biguint\n/**\n * Create a biguint from a string literal containing the decimal digits\n */\nexport function BigUint(v: string): biguint\n/**\n * Create a biguint with the default value of 0\n */\nexport function BigUint(): biguint\nexport function BigUint(v?: BigUintCompat | string): biguint {\n if (typeof v === 'string') v = BigInt(v)\n else if (v === undefined) v = 0n\n return BigUintCls.fromCompat(v).asAlgoTs()\n}\n\nexport type bytes = {\n readonly length: uint64\n\n at(i: Uint64Compat): bytes\n\n concat(other: BytesCompat): bytes\n\n bitwiseAnd(other: BytesCompat): bytes\n\n bitwiseOr(other: BytesCompat): bytes\n\n bitwiseXor(other: BytesCompat): bytes\n\n bitwiseInvert(): bytes\n\n equals(other: BytesCompat): boolean\n\n slice(): bytes\n slice(start: Uint64Compat): bytes\n slice(start: Uint64Compat, end: Uint64Compat): bytes\n slice(start?: Uint64Compat, end?: Uint64Compat): bytes\n\n toString(): string\n}\n\n/**\n * Create a byte array from a string interpolation template and compatible replacements\n * @param value\n * @param replacements\n */\nexport function Bytes(value: TemplateStringsArray, ...replacements: BytesCompat[]): bytes\n/**\n * Create a byte array from a utf8 string\n */\nexport function Bytes(value: string): bytes\n/**\n * No op, returns the provided byte array.\n */\nexport function Bytes(value: bytes): bytes\n/**\n * Create a byte array from a biguint value encoded as a variable length big-endian number\n */\nexport function Bytes(value: biguint): bytes\n/**\n * Create a byte array from a uint64 value encoded as a fixed length 64-bit number\n */\nexport function Bytes(value: uint64): bytes\n/**\n * Create a byte array from an Iterable<uint64> where each item is interpreted as a single byte and must be between 0 and 255 inclusively\n */\nexport function Bytes(value: Iterable<uint64>): bytes\n/**\n * Create an empty byte array\n */\nexport function Bytes(): bytes\nexport function Bytes(\n value?: BytesCompat | TemplateStringsArray | biguint | uint64 | Iterable<number>,\n ...replacements: BytesCompat[]\n): bytes {\n if (isTemplateStringsArray(value)) {\n return BytesCls.fromInterpolation(value, replacements).asAlgoTs()\n } else if (typeof value === 'bigint' || value instanceof BigUintCls) {\n return BigUintCls.fromCompat(value).toBytes().asAlgoTs()\n } else if (typeof value === 'number' || value instanceof Uint64Cls) {\n return Uint64Cls.fromCompat(value).toBytes().asAlgoTs()\n } else if (typeof value === 'object' && Symbol.iterator in value) {\n const valueItems = Array.from(value).map((v) => getNumber(v))\n const invalidValue = valueItems.find((v) => v < 0 && v > 255)\n if (invalidValue) {\n throw new CodeError(`Cannot convert ${invalidValue} to a byte`)\n }\n return new BytesCls(new Uint8Array(value)).asAlgoTs()\n } else {\n return BytesCls.fromCompat(value).asAlgoTs()\n }\n}\n\n/**\n * Create a new bytes value from a hexadecimal encoded string\n * @param hex\n */\nBytes.fromHex = (hex: string): bytes => {\n return BytesCls.fromHex(hex).asAlgoTs()\n}\n/**\n * Create a new bytes value from a base 64 encoded string\n * @param b64\n */\nBytes.fromBase64 = (b64: string): bytes => {\n return BytesCls.fromBase64(b64).asAlgoTs()\n}\n\n/**\n * Create a new bytes value from a base 32 encoded string\n * @param b32\n */\nBytes.fromBase32 = (b32: string): bytes => {\n return BytesCls.fromBase32(b32).asAlgoTs()\n}\n\nfunction isTemplateStringsArray(v: unknown): v is TemplateStringsArray {\n return Boolean(v) && Array.isArray(v) && typeof v[0] === 'string'\n}\n\nexport interface BytesBacked {\n get bytes(): bytes\n}\n","import { biguint, BigUintCompat, BytesCompat, StringCompat, uint64, Uint64Compat } from './primitives'\nimport { ctxMgr } from './execution-context'\nimport { AssertError, AvmError } from './impl/errors'\nimport { toBytes } from './impl/primitives'\n\nexport function log(...args: Array<Uint64Compat | BytesCompat | BigUintCompat | StringCompat>): void {\n ctxMgr.instance.log(args.map(toBytes).reduce((left, right) => left.concat(right)))\n}\n\nexport function assert(condition: unknown, message?: string): asserts condition {\n if (!condition) {\n throw new AssertError(message ?? 'Assertion failed')\n }\n}\n\nexport function err(message?: string): never {\n throw new AvmError(message ?? 'Err')\n}\n\ntype NumericComparison<T> = T | { lessThan: T } | { greaterThan: T } | { greaterThanEq: T } | { lessThanEq: T } | { between: [T, T] }\n\ntype ComparisonFor<T> = T extends uint64 | biguint ? NumericComparison<T> : T\n\ntype MatchTest<T> = {\n [key in keyof T]?: ComparisonFor<T[key]>\n}\n\nexport function match<T>(subject: T, test: MatchTest<T>): boolean {\n return true\n}\nexport function assertMatch<T>(subject: T, test: MatchTest<T>, message?: string): boolean {\n return true\n}\n\nexport enum OpUpFeeSource {\n GroupCredit = 0,\n AppAccount = 1,\n Any = 2,\n}\n\nexport function ensureBudget(budget: uint64, feeSource: OpUpFeeSource = OpUpFeeSource.GroupCredit) {\n throw new Error('Not implemented')\n}\n\nexport function urange(stop: Uint64Compat): IterableIterator<uint64>\nexport function urange(start: Uint64Compat, stop: Uint64Compat): IterableIterator<uint64>\nexport function urange(start: Uint64Compat, stop: Uint64Compat, step: Uint64Compat): IterableIterator<uint64>\nexport function urange(a: Uint64Compat, b?: Uint64Compat, c?: Uint64Compat): IterableIterator<uint64> {\n throw new Error('Not implemented')\n}\n","import { ctxMgr } from './execution-context'\nimport { bytes, uint64 } from './primitives'\n\nexport type Account = {\n readonly bytes: bytes\n\n /**\n * Account balance in microalgos\n *\n * Account must be an available resource\n */\n readonly balance: uint64\n\n /**\n * Minimum required balance for account, in microalgos\n *\n * Account must be an available resource\n */\n readonly minBalance: uint64\n\n /**\n * Address the account is rekeyed to\n *\n * Account must be an available resource\n */\n readonly authAddress: Account\n\n /**\n * The total number of uint64 values allocated by this account in Global and Local States.\n *\n * Account must be an available resource\n */\n readonly totalNumUint: uint64\n\n /**\n * The total number of byte array values allocated by this account in Global and Local States.\n *\n * Account must be an available resource\n */\n readonly totalNumByteSlice: uint64\n\n /**\n * The number of extra app code pages used by this account.\n *\n * Account must be an available resource\n */\n readonly totalExtraAppPages: uint64\n\n /**\n * The number of existing apps created by this account.\n *\n * Account must be an available resource\n */\n readonly totalAppsCreated: uint64\n\n /**\n * The number of apps this account is opted into.\n *\n * Account must be an available resource\n */\n readonly totalAppsOptedIn: uint64\n\n /**\n * The number of existing ASAs created by this account.\n *\n * Account must be an available resource\n */\n readonly totalAssetsCreated: uint64\n\n /**\n * The numbers of ASAs held by this account (including ASAs this account created).\n *\n * Account must be an available resource\n */\n readonly totalAssets: uint64\n\n /**\n * The number of existing boxes created by this account's app.\n *\n * Account must be an available resource\n */\n readonly totalBoxes: uint64\n\n /**\n * The total number of bytes used by this account's app's box keys and values.\n *\n * Account must be an available resource\n */\n readonly totalBoxBytes: uint64\n\n /**\n * Returns true if this account is opted in to the specified Asset or Application.\n * Note: Account and Asset/Application must be an available resource\n *\n * @param assetOrApp\n */\n isOptedIn(assetOrApp: Asset | Application): boolean\n}\n\nexport function Account(): Account\nexport function Account(address: bytes): Account\nexport function Account(address?: bytes): Account {\n return ctxMgr.instance.account(address)\n}\n\nexport function Asset(): Asset\nexport function Asset(assetId: uint64): Asset\nexport function Asset(assetId?: uint64): Asset {\n return ctxMgr.instance.asset(assetId)\n}\n/**\n * An Asset on the Algorand network.\n */\nexport type Asset = {\n /**\n * Returns the id of the Asset\n */\n readonly id: uint64\n\n /**\n * Total number of units of this asset\n */\n readonly total: uint64\n\n /**\n * @see AssetParams.decimals\n */\n readonly decimals: uint64\n\n /**\n * Frozen by default or not\n */\n readonly defaultFrozen: boolean\n\n /**\n * Asset unit name\n */\n readonly unitName: bytes\n\n /**\n * Asset name\n */\n readonly name: bytes\n\n /**\n * URL with additional info about the asset\n */\n readonly url: bytes\n\n /**\n * Arbitrary commitment\n */\n readonly metadataHash: bytes\n\n /**\n * Manager address\n */\n readonly manager: Account\n\n /**\n * Reserve address\n */\n readonly reserve: Account\n\n /**\n * Freeze address\n */\n readonly freeze: Account\n\n /**\n * Clawback address\n */\n readonly clawback: Account\n\n /**\n * Creator address\n */\n readonly creator: Account\n\n /**\n * Amount of the asset unit held by this account. Fails if the account has not\n * opted in to the asset.\n * Asset and supplied Account must be an available resource\n * @param account Account\n * @return balance: uint64\n */\n balance(account: Account): uint64\n\n /**\n * Is the asset frozen or not. Fails if the account has not\n * opted in to the asset.\n * Asset and supplied Account must be an available resource\n * @param account Account\n * @return isFrozen: boolean\n */\n frozen(account: Account): boolean\n}\n\nexport function Application(): Application\nexport function Application(applicationId: uint64): Application\nexport function Application(applicationId?: uint64): Application {\n return ctxMgr.instance.application(applicationId)\n}\n\n/**\n * An Application on the Algorand network.\n */\nexport type Application = {\n /**\n * The id of this application on the current network\n */\n readonly id: uint64\n /**\n * Bytecode of Approval Program\n */\n readonly approvalProgram: bytes\n\n /**\n * Bytecode of Clear State Program\n */\n readonly clearStateProgram: bytes\n\n /**\n * Number of uint64 values allowed in Global State\n */\n readonly globalNumUint: uint64\n\n /**\n * Number of byte array values allowed in Global State\n */\n readonly globalNumBytes: uint64\n\n /**\n * Number of uint64 values allowed in Local State\n */\n readonly localNumUint: uint64\n\n /**\n * Number of byte array values allowed in Local State\n */\n readonly localNumBytes: uint64\n\n /**\n * Number of Extra Program Pages of code space\n */\n readonly extraProgramPages: uint64\n\n /**\n * Creator address\n */\n readonly creator: Account\n\n /**\n * Address for which this application has authority\n */\n readonly address: Account\n}\n","import { uint64 } from './primitives'\n\nexport abstract class BaseContract {\n public abstract approvalProgram(): boolean | uint64\n public clearStateProgram(): boolean | uint64 {\n return true\n }\n}\n","import { avmError, avmInvariant } from '../impl/errors'\nimport { arrayUtil, BytesCls, getNumber, getUint8Array, isBytes, isUint64 } from '../impl/primitives'\nimport { biguint, BigUintCompat, Bytes, bytes, BytesBacked, StringCompat, Uint64, uint64, Uint64Compat } from '../primitives'\nimport { Account } from '../reference'\nimport { err } from '../util'\n\nexport type BitSize = 8 | 16 | 32 | 64 | 128 | 256 | 512\ntype NativeForArc4Int<N extends BitSize> = N extends 8 | 16 | 32 | 64 ? uint64 : biguint\ntype CompatForArc4Int<N extends BitSize> = N extends 8 | 16 | 32 | 64 ? Uint64Compat : BigUintCompat\n\nabstract class AbiEncoded implements BytesBacked {\n get bytes(): bytes {\n throw new Error('todo')\n }\n\n equals(other: this): boolean {\n return this.bytes.equals(other.bytes)\n }\n}\n\nexport class Str extends AbiEncoded {\n constructor(s: StringCompat) {\n super()\n }\n get native(): string {\n throw new Error('TODO')\n }\n}\nexport class UintN<N extends BitSize> extends AbiEncoded {\n constructor(v?: CompatForArc4Int<N>) {\n super()\n }\n get native(): NativeForArc4Int<N> {\n throw new Error('TODO')\n }\n}\nexport class UFixedNxM<N extends BitSize, M extends number> {\n constructor(v: `${number}:${number}`, n?: N, m?: M) {}\n\n get native(): NativeForArc4Int<N> {\n throw new Error('TODO')\n }\n}\n\nexport class Byte extends UintN<8> {\n constructor(v?: Uint64Compat) {\n super(v)\n }\n}\nexport class Bool {\n #v: boolean\n constructor(v?: boolean) {\n this.#v = v ?? false\n }\n\n get native(): boolean {\n return this.#v\n }\n}\n\nabstract class Arc4ReadonlyArray<TItem extends AbiEncoded> extends AbiEncoded {\n protected items: TItem[]\n protected constructor(items: TItem[]) {\n super()\n this.items = items.slice()\n return new Proxy(this, {\n get(target, prop) {\n if (isUint64(prop)) {\n const idx = getNumber(prop)\n if (idx < target.items.length) return target.items[idx]\n avmError('Index out of bounds')\n }\n return Reflect.get(target, prop)\n },\n set(target, prop, value) {\n if (isUint64(prop)) {\n const idx = getNumber(prop)\n if (idx < target.items.length) {\n target.items[idx] = value\n return true\n }\n avmError('Index out of bounds')\n }\n avmError('Property is not writable')\n },\n })\n }\n\n /**\n * Returns the current length of this array\n */\n get length(): uint64 {\n return Uint64(this.items.length)\n }\n\n /**\n * Returns the item at the given index.\n * Negative indexes are taken from the end.\n * @param index The index of the item to retrieve\n */\n at(index: Uint64Compat): TItem {\n return arrayUtil.arrayAt(this.items, index)\n }\n\n /** @internal\n * Create a new Dynamic array with all items from this array\n */\n slice(): DynamicArray<TItem>\n /** @internal\n * Create a new DynamicArray with all items up till `end`.\n * Negative indexes are taken from the end.\n * @param end An index in which to stop copying items.\n */\n slice(end: Uint64Compat): DynamicArray<TItem>\n /** @internal\n * Create a new DynamicArray with items from `start`, up until `end`\n * Negative indexes are taken from the end.\n * @param start An index in which to start copying items.\n * @param end An index in which to stop copying items\n */\n slice(start: Uint64Compat, end: Uint64Compat): DynamicArray<TItem>\n slice(start?: Uint64Compat, end?: Uint64Compat): DynamicArray<TItem> {\n return new DynamicArray(...arrayUtil.arraySlice(this.items, start, end))\n }\n\n /**\n * Returns an iterator for the items in this array\n */\n [Symbol.iterator](): IterableIterator<TItem> {\n return this.items[Symbol.iterator]()\n }\n\n /**\n * Returns an iterator for a tuple of the indexes and items in this array\n */\n *entries(): IterableIterator<readonly [uint64, TItem]> {\n for (const [idx, item] of this.items.entries()) {\n yield [Uint64(idx), item]\n }\n }\n\n /**\n * Returns an iterator for the indexes in this array\n */\n *keys(): IterableIterator<uint64> {\n for (const idx of this.items.keys()) {\n yield Uint64(idx)\n }\n }\n\n /**\n * Get or set the item at the specified index.\n * Negative indexes are not supported\n */\n [index: uint64]: TItem\n}\n\nexport class StaticArray<TItem extends AbiEncoded, TLength extends number> extends Arc4ReadonlyArray<TItem> {\n constructor()\n constructor(...items: TItem[] & { length: TLength })\n constructor(...items: TItem[])\n constructor(...items: TItem[] & { length: TLength }) {\n super(items)\n }\n\n copy(): StaticArray<TItem, TLength> {\n return new StaticArray<TItem, TLength>(...this.items)\n }\n}\n\nexport class DynamicArray<TItem extends AbiEncoded> extends Arc4ReadonlyArray<TItem> {\n constructor(...items: TItem[]) {\n super(items)\n }\n\n /**\n * Push a number of items into this array\n * @param items The items to be added to this array\n */\n push(...items: TItem[]): void {\n this.items.push(...items)\n }\n\n /**\n * Pop a single item from this array\n */\n pop(): TItem {\n const item = this.items.pop()\n if (item === undefined) avmError('The array is empty')\n return item\n }\n\n copy(): DynamicArray<TItem> {\n return new DynamicArray<TItem>(...this.items)\n }\n}\n\ntype ItemAt<TTuple extends unknown[], TIndex extends number> = undefined extends TTuple[TIndex] ? never : TTuple[TIndex]\n\nexport class Tuple<TTuple extends unknown[]> {\n #items: TTuple\n constructor(...items: TTuple) {\n this.#items = items\n }\n\n at<TIndex extends number>(index: TIndex): ItemAt<TTuple, TIndex> {\n return (this.#items[index] ?? err('Index out of bounds')) as ItemAt<TTuple, TIndex>\n }\n\n get native(): TTuple {\n return this.#items\n }\n}\n\nexport class Address extends Arc4ReadonlyArray<Byte> {\n constructor(value?: Account | string | bytes) {\n let byteValues: Uint8Array\n if (value === undefined) {\n byteValues = new Uint8Array(32)\n } else if (typeof value === 'string') {\n // Interpret as base 32\n byteValues = BytesCls.fromBase32(value).asUint8Array()\n } else if (isBytes(value)) {\n byteValues = getUint8Array(value)\n } else {\n byteValues = getUint8Array(value.bytes)\n }\n avmInvariant(byteValues.length === 32, 'Addresses should be 32 bytes')\n super(Array.from(byteValues).map((b) => new Byte(b)))\n }\n\n get native(): Account {\n return Account(Bytes(this.items.map((i) => i.native)))\n }\n}\n","import { BaseContract } from '../base-contract'\nimport { ctxMgr } from '../execution-context'\nimport { Uint64 } from '../primitives'\nimport { DeliberateAny } from '../typescript-helpers'\n\nexport * from './encoded-types'\n\nexport class Contract extends BaseContract {\n override approvalProgram(): boolean {\n return true\n }\n}\n\nexport type CreateOptions = 'allow' | 'disallow' | 'require'\nexport type OnCompleteActionStr = 'NoOp' | 'OptIn' | 'ClearState' | 'CloseOut' | 'UpdateApplication' | 'DeleteApplication'\n\nexport enum OnCompleteAction {\n NoOp = Uint64(0),\n OptIn = Uint64(1),\n CloseOut = Uint64(2),\n ClearState = Uint64(3),\n UpdateApplication = Uint64(4),\n DeleteApplication = Uint64(5),\n}\n\nexport type DefaultArgument<TContract extends Contract> = { constant: string | boolean | number | bigint } | { from: keyof TContract }\nexport type AbiMethodConfig<TContract extends Contract> = {\n /**\n * Which on complete action(s) are allowed when invoking this method.\n * @default 'NoOp'\n */\n allowActions?: OnCompleteActionStr | OnCompleteActionStr[]\n /**\n * Whether this method should be callable when creating the application.\n * @default 'disallow'\n */\n onCreate?: CreateOptions\n /**\n * Does the method only perform read operations (no mutation of chain state)\n * @default false\n */\n readonly?: boolean\n /**\n * Override the name used to generate the abi method selector\n */\n name?: string\n\n defaultArguments?: Record<string, DefaultArgument<TContract>>\n}\nexport function abimethod<TContract extends Contract>(config?: AbiMethodConfig<TContract>) {\n return function <TArgs extends DeliberateAny[], TReturn>(\n target: (this: TContract, ...args: TArgs) => TReturn,\n ctx: ClassMethodDecoratorContext<TContract>,\n ): (this: TContract, ...args: TArgs) => TReturn {\n ctx.addInitializer(function () {\n ctxMgr.instance.abiMetadata.captureMethodConfig(this, target.name, config)\n })\n return target\n }\n}\n\nexport type BareMethodConfig = {\n /**\n * Which on complete action(s) are allowed when invoking this method.\n * @default 'NoOp'\n */\n allowActions?: OnCompleteActionStr | OnCompleteActionStr[]\n /**\n * Whether this method should be callable when creating the application.\n * @default 'disallow'\n */\n onCreate?: CreateOptions\n}\nexport function baremethod<TContract extends Contract>(config?: BareMethodConfig) {\n return function <TArgs extends DeliberateAny[], TReturn>(\n target: (this: TContract, ...args: TArgs) => TReturn,\n ctx: ClassMethodDecoratorContext<TContract>,\n ): (this: TContract, ...args: TArgs) => TReturn {\n ctx.addInitializer(function () {\n ctxMgr.instance.abiMetadata.captureMethodConfig(this, target.name, config)\n })\n return target\n }\n}\n"],"names":[],"mappings":";;;;AAAA;;;AAGG;AACG,MAAO,QAAS,SAAQ,KAAK,CAAA;AACjC,IAAA,WAAA,CAAY,OAAe,EAAA;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;KACf;AACF,CAAA;AACK,SAAU,QAAQ,CAAC,OAAe,EAAA;AACtC,IAA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;;;;;;;;;;;;;;;;"}
package/index.mjs CHANGED
@@ -1,21 +1,11 @@
1
- import { e as encodingUtil, a as errors, p as primitives } from './index-CWa8GSj0.js';
2
- export { B as BaseContract, h as BigUint, j as Bytes, C as Contract, O as OpUpFeeSource, U as Uint64, g as abimethod, i as arc4, c as assert, d as assertMatch, f as ensureBudget, b as err, l as log, m as match, u as urange } from './index-CWa8GSj0.js';
1
+ import { e as encodingUtil, a as errors, p as primitives } from './index-hpwu00-P.js';
2
+ export { A as Account, n as Application, k as Asset, B as BaseContract, h as BigUint, j as Bytes, C as Contract, O as OpUpFeeSource, U as Uint64, g as abimethod, i as arc4, c as assert, d as assertMatch, f as ensureBudget, b as err, l as log, m as match, u as urange } from './index-hpwu00-P.js';
3
+ import { o as opTypes } from './op-plv5yuzk.js';
4
+ export { G as Global, T as Txn, a as op } from './op-plv5yuzk.js';
3
5
  import { c as ctxMgr } from './execution-context-BznYSiE4.js';
4
- import { o as opTypes } from './op-BLuSBcoz.js';
5
- export { G as Global, T as Txn, a as op } from './op-BLuSBcoz.js';
6
6
  import 'node:buffer';
7
7
  import 'node:util';
8
8
 
9
- function Account(address) {
10
- return ctxMgr.instance.account(address);
11
- }
12
- function Asset(assetId) {
13
- return ctxMgr.instance.asset(assetId);
14
- }
15
- function Application(applicationId) {
16
- return ctxMgr.instance.application(applicationId);
17
- }
18
-
19
9
  var internal = /*#__PURE__*/Object.freeze({
20
10
  __proto__: null,
21
11
  ctxMgr: ctxMgr,
@@ -26,22 +16,22 @@ var internal = /*#__PURE__*/Object.freeze({
26
16
  });
27
17
 
28
18
  function Box(options) {
29
- throw new Error('Not implemented');
19
+ return ctxMgr.instance.state.Box(options);
30
20
  }
31
21
  function BoxMap(options) {
32
- throw new Error('Not implemented');
22
+ return ctxMgr.instance.state.BoxMap(options);
33
23
  }
34
24
  function BoxRef(options) {
35
- throw new Error('Not implemented');
25
+ return ctxMgr.instance.state.BoxRef(options);
36
26
  }
37
27
 
38
28
  /** A single key in global state */
39
29
  function GlobalState(options) {
40
- return ctxMgr.instance.state.createGlobalState(options);
30
+ return ctxMgr.instance.state.GlobalState(options);
41
31
  }
42
32
  /** A single key in local state */
43
33
  function LocalState(options) {
44
- return ctxMgr.instance.state.createLocalState(options);
34
+ return ctxMgr.instance.state.LocalState(options);
45
35
  }
46
36
 
47
37
  function submitGroup(...transactionFields) {
@@ -141,5 +131,5 @@ var TransactionType;
141
131
  TransactionType[TransactionType["ApplicationCall"] = 6] = "ApplicationCall";
142
132
  })(TransactionType || (TransactionType = {}));
143
133
 
144
- export { Account, Application, Asset, Box, BoxMap, BoxRef, GlobalState, LocalState, TransactionType, gtxn, internal, itxn };
134
+ export { Box, BoxMap, BoxRef, GlobalState, LocalState, TransactionType, gtxn, internal, itxn };
145
135
  //# sourceMappingURL=index.mjs.map