@algorandfoundation/algorand-typescript 0.0.1-alpha.4 → 0.0.1-alpha.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.
- package/impl/encoding-util.d.ts +2 -0
- package/impl/errors.d.ts +1 -0
- package/impl/primitives.d.ts +8 -3
- package/{index-BdtBwx9C.js → index-BHpT2IXF.js} +133 -71
- package/index-BHpT2IXF.js.map +1 -0
- package/index.mjs +3 -2
- package/index.mjs.map +1 -1
- package/index2.mjs +2 -1
- package/index2.mjs.map +1 -1
- package/package.json +1 -1
- package/primitives.d.ts +59 -7
- package/index-BdtBwx9C.js.map +0 -1
package/impl/encoding-util.d.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
export declare const uint8ArrayToBigInt: (v: Uint8Array) => bigint;
|
2
|
+
export declare const hexToUint8Array: (value: string) => Uint8Array;
|
3
|
+
export declare const base64ToUint8Array: (value: string) => Uint8Array;
|
2
4
|
export declare const bigIntToUint8Array: (val: bigint, fixedSize?: number | "dynamic") => Uint8Array;
|
3
5
|
export declare const utf8ToUint8Array: (value: string) => Uint8Array;
|
4
6
|
export declare const uint8ArrayToUtf8: (value: Uint8Array) => string;
|
package/impl/errors.d.ts
CHANGED
@@ -6,6 +6,7 @@ export declare class AvmError extends Error {
|
|
6
6
|
constructor(message: string);
|
7
7
|
}
|
8
8
|
export declare function avmError(message: string): never;
|
9
|
+
export declare function avmInvariant(condition: unknown, message: string): asserts condition;
|
9
10
|
/**
|
10
11
|
* Raised when an assertion fails
|
11
12
|
*/
|
package/impl/primitives.d.ts
CHANGED
@@ -7,9 +7,14 @@ export declare function toExternalValue(val: biguint): bigint;
|
|
7
7
|
export declare function toExternalValue(val: bytes): Uint8Array;
|
8
8
|
export declare function toExternalValue(val: string): string;
|
9
9
|
export declare const toBytes: (val: unknown) => bytes;
|
10
|
+
/**
|
11
|
+
* Convert a StubUint64Compat value into a 'number' if possible.
|
12
|
+
* This value may be negative
|
13
|
+
* @param v
|
14
|
+
*/
|
15
|
+
export declare const getNumber: (v: StubUint64Compat) => number;
|
10
16
|
export declare const isBytes: (v: unknown) => v is StubBytesCompat;
|
11
17
|
export declare const isUint64: (v: unknown) => v is StubUint64Compat;
|
12
|
-
export declare const isBigUint: (v: unknown) => v is biguint;
|
13
18
|
export declare const checkUint64: (v: bigint) => bigint;
|
14
19
|
export declare const checkBigUint: (v: bigint) => bigint;
|
15
20
|
export declare const checkBytes: (v: Uint8Array) => Uint8Array;
|
@@ -23,7 +28,6 @@ export declare class Uint64Cls extends AlgoTsPrimitiveCls {
|
|
23
28
|
constructor(value: bigint | number | string);
|
24
29
|
static [Symbol.hasInstance](x: unknown): x is Uint64Cls;
|
25
30
|
static fromCompat(v: StubUint64Compat): Uint64Cls;
|
26
|
-
static getNumber(v: StubUint64Compat): number;
|
27
31
|
valueOf(): bigint;
|
28
32
|
toBytes(): BytesCls;
|
29
33
|
asAlgoTs(): uint64;
|
@@ -57,7 +61,7 @@ export declare class BytesCls extends AlgoTsPrimitiveCls {
|
|
57
61
|
private bitwiseOp;
|
58
62
|
valueOf(): string;
|
59
63
|
static [Symbol.hasInstance](x: unknown): x is BytesCls;
|
60
|
-
static fromCompat(v: StubBytesCompat | undefined): BytesCls;
|
64
|
+
static fromCompat(v: StubBytesCompat | Uint8Array | undefined): BytesCls;
|
61
65
|
static fromInterpolation(template: TemplateStringsArray, replacements: StubBytesCompat[]): BytesCls;
|
62
66
|
static fromHex(hex: string): BytesCls;
|
63
67
|
static fromBase64(b64: string): BytesCls;
|
@@ -69,6 +73,7 @@ export declare class BytesCls extends AlgoTsPrimitiveCls {
|
|
69
73
|
asUint8Array(): Uint8Array;
|
70
74
|
}
|
71
75
|
export declare const arrayUtil: {
|
76
|
+
arrayAt(arrayLike: Uint8Array, index: StubUint64Compat): Uint8Array;
|
72
77
|
arrayAt<T>(arrayLike: T[], index: StubUint64Compat): T;
|
73
78
|
arraySlice(arrayLike: Uint8Array, start: StubUint64Compat, end: StubUint64Compat): Uint8Array;
|
74
79
|
arraySlice<T>(arrayLike: T[], start: StubUint64Compat, end: StubUint64Compat): T[];
|
@@ -1,5 +1,66 @@
|
|
1
|
+
import { Buffer } from 'node:buffer';
|
1
2
|
import { TextDecoder } from 'node:util';
|
2
3
|
|
4
|
+
/**
|
5
|
+
* Raised when an `err` op is encountered, or when the testing VM is asked to do something that would cause
|
6
|
+
* the AVM to fail.
|
7
|
+
*/
|
8
|
+
class AvmError extends Error {
|
9
|
+
constructor(message) {
|
10
|
+
super(message);
|
11
|
+
}
|
12
|
+
}
|
13
|
+
function avmError(message) {
|
14
|
+
throw new AvmError(message);
|
15
|
+
}
|
16
|
+
function avmInvariant(condition, message) {
|
17
|
+
if (!condition) {
|
18
|
+
throw new AvmError(message);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
/**
|
22
|
+
* Raised when an assertion fails
|
23
|
+
*/
|
24
|
+
class AssertError extends AvmError {
|
25
|
+
constructor(message) {
|
26
|
+
super(message);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Raised when testing code errors
|
31
|
+
*/
|
32
|
+
class InternalError extends Error {
|
33
|
+
constructor(message, options) {
|
34
|
+
super(message, options);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
function internalError(message) {
|
38
|
+
throw new InternalError(message);
|
39
|
+
}
|
40
|
+
/**
|
41
|
+
* Raised when unsupported user code is encountered
|
42
|
+
*/
|
43
|
+
class CodeError extends Error {
|
44
|
+
constructor(message, options) {
|
45
|
+
super(message, options);
|
46
|
+
}
|
47
|
+
}
|
48
|
+
function codeError(message) {
|
49
|
+
throw new CodeError(message);
|
50
|
+
}
|
51
|
+
|
52
|
+
var errors = /*#__PURE__*/Object.freeze({
|
53
|
+
__proto__: null,
|
54
|
+
AssertError: AssertError,
|
55
|
+
AvmError: AvmError,
|
56
|
+
CodeError: CodeError,
|
57
|
+
InternalError: InternalError,
|
58
|
+
avmError: avmError,
|
59
|
+
avmInvariant: avmInvariant,
|
60
|
+
codeError: codeError,
|
61
|
+
internalError: internalError
|
62
|
+
});
|
63
|
+
|
3
64
|
const BASE32_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'.split('');
|
4
65
|
const CHAR_TO_NUM = BASE32_ALPHABET.reduce((acc, cur, index) => ((acc[cur] = index), acc), {});
|
5
66
|
const base32ToUint8Array = (value) => {
|
@@ -42,7 +103,7 @@ const uint8ArrayToBase32 = (value) => {
|
|
42
103
|
if (allBytes.length < 1)
|
43
104
|
break;
|
44
105
|
base32str += BASE32_ALPHABET[a >>> 3];
|
45
|
-
base32str += BASE32_ALPHABET[((a << 2) | ((b || 0) >>> 6)) &
|
106
|
+
base32str += BASE32_ALPHABET[((a << 2) | ((b || 0) >>> 6)) & 31];
|
46
107
|
if (allBytes.length < 2)
|
47
108
|
break;
|
48
109
|
base32str += BASE32_ALPHABET[(b >>> 1) & 31];
|
@@ -62,60 +123,6 @@ const uint8ArrayToBase32 = (value) => {
|
|
62
123
|
return base32str;
|
63
124
|
};
|
64
125
|
|
65
|
-
/**
|
66
|
-
* Raised when an `err` op is encountered, or when the testing VM is asked to do something that would cause
|
67
|
-
* the AVM to fail.
|
68
|
-
*/
|
69
|
-
class AvmError extends Error {
|
70
|
-
constructor(message) {
|
71
|
-
super(message);
|
72
|
-
}
|
73
|
-
}
|
74
|
-
function avmError(message) {
|
75
|
-
throw new AvmError(message);
|
76
|
-
}
|
77
|
-
/**
|
78
|
-
* Raised when an assertion fails
|
79
|
-
*/
|
80
|
-
class AssertError extends AvmError {
|
81
|
-
constructor(message) {
|
82
|
-
super(message);
|
83
|
-
}
|
84
|
-
}
|
85
|
-
/**
|
86
|
-
* Raised when testing code errors
|
87
|
-
*/
|
88
|
-
class InternalError extends Error {
|
89
|
-
constructor(message, options) {
|
90
|
-
super(message, options);
|
91
|
-
}
|
92
|
-
}
|
93
|
-
function internalError(message) {
|
94
|
-
throw new InternalError(message);
|
95
|
-
}
|
96
|
-
/**
|
97
|
-
* Raised when unsupported user code is encountered
|
98
|
-
*/
|
99
|
-
class CodeError extends Error {
|
100
|
-
constructor(message, options) {
|
101
|
-
super(message, options);
|
102
|
-
}
|
103
|
-
}
|
104
|
-
function codeError(message) {
|
105
|
-
throw new CodeError(message);
|
106
|
-
}
|
107
|
-
|
108
|
-
var errors = /*#__PURE__*/Object.freeze({
|
109
|
-
__proto__: null,
|
110
|
-
AssertError: AssertError,
|
111
|
-
AvmError: AvmError,
|
112
|
-
CodeError: CodeError,
|
113
|
-
InternalError: InternalError,
|
114
|
-
avmError: avmError,
|
115
|
-
codeError: codeError,
|
116
|
-
internalError: internalError
|
117
|
-
});
|
118
|
-
|
119
126
|
const uint8ArrayToBigInt = (v) => {
|
120
127
|
// Assume big-endian
|
121
128
|
return Array.from(v)
|
@@ -123,6 +130,16 @@ const uint8ArrayToBigInt = (v) => {
|
|
123
130
|
.map((byte_value, i) => BigInt(byte_value) << BigInt(i * 8))
|
124
131
|
.reduce((a, b) => a + b, 0n);
|
125
132
|
};
|
133
|
+
const hexToUint8Array = (value) => {
|
134
|
+
if (value.length % 2 !== 0) {
|
135
|
+
// TODO: Verify AVM behaviour is to fail
|
136
|
+
throw new AvmError('Hex string must have even number of characters');
|
137
|
+
}
|
138
|
+
return Uint8Array.from(Buffer.from(value, 'hex'));
|
139
|
+
};
|
140
|
+
const base64ToUint8Array = (value) => {
|
141
|
+
return Uint8Array.from(Buffer.from(value, 'base64'));
|
142
|
+
};
|
126
143
|
const bigIntToUint8Array = (val, fixedSize = 'dynamic') => {
|
127
144
|
if (val === 0n && fixedSize === 'dynamic') {
|
128
145
|
return new Uint8Array(0);
|
@@ -160,7 +177,9 @@ const uint8ArrayToBase64Url = (value) => Buffer.from(value).toString('base64url'
|
|
160
177
|
|
161
178
|
var encodingUtil = /*#__PURE__*/Object.freeze({
|
162
179
|
__proto__: null,
|
180
|
+
base64ToUint8Array: base64ToUint8Array,
|
163
181
|
bigIntToUint8Array: bigIntToUint8Array,
|
182
|
+
hexToUint8Array: hexToUint8Array,
|
164
183
|
uint8ArrayToBase32: uint8ArrayToBase32,
|
165
184
|
uint8ArrayToBase64: uint8ArrayToBase64,
|
166
185
|
uint8ArrayToBase64Url: uint8ArrayToBase64Url,
|
@@ -210,6 +229,24 @@ const toBytes = (val) => {
|
|
210
229
|
internalError(`Unsupported arg type ${nameOfType(val)}`);
|
211
230
|
}
|
212
231
|
};
|
232
|
+
/**
|
233
|
+
* Convert a StubUint64Compat value into a 'number' if possible.
|
234
|
+
* This value may be negative
|
235
|
+
* @param v
|
236
|
+
*/
|
237
|
+
const getNumber = (v) => {
|
238
|
+
if (typeof v == 'boolean')
|
239
|
+
return v ? 1 : 0;
|
240
|
+
if (typeof v == 'number')
|
241
|
+
return v;
|
242
|
+
if (typeof v == 'bigint') {
|
243
|
+
avmInvariant(v <= BigInt(Number.MAX_SAFE_INTEGER) && v >= BigInt(Number.MIN_SAFE_INTEGER), 'value cannot be safely converted to a number');
|
244
|
+
return Number(v);
|
245
|
+
}
|
246
|
+
if (v instanceof Uint64Cls)
|
247
|
+
return v.asNumber();
|
248
|
+
internalError(`Cannot convert ${v} to number`);
|
249
|
+
};
|
213
250
|
const isBytes = (v) => {
|
214
251
|
if (typeof v === 'string')
|
215
252
|
return true;
|
@@ -226,19 +263,16 @@ const isUint64 = (v) => {
|
|
226
263
|
return true;
|
227
264
|
return v instanceof Uint64Cls;
|
228
265
|
};
|
229
|
-
const isBigUint = (v) => {
|
230
|
-
return v instanceof BigUintCls;
|
231
|
-
};
|
232
266
|
const checkUint64 = (v) => {
|
233
267
|
const u64 = BigInt.asUintN(64, v);
|
234
268
|
if (u64 !== v)
|
235
|
-
throw new AvmError(`Uint64
|
269
|
+
throw new AvmError(`Uint64 overflow or underflow`);
|
236
270
|
return u64;
|
237
271
|
};
|
238
272
|
const checkBigUint = (v) => {
|
239
273
|
const uBig = BigInt.asUintN(64 * 8, v);
|
240
274
|
if (uBig !== v)
|
241
|
-
throw new AvmError(`BigUint
|
275
|
+
throw new AvmError(`BigUint overflow or underflow`);
|
242
276
|
return uBig;
|
243
277
|
};
|
244
278
|
const checkBytes = (v) => {
|
@@ -296,9 +330,6 @@ class Uint64Cls extends AlgoTsPrimitiveCls {
|
|
296
330
|
return v;
|
297
331
|
internalError(`Cannot convert ${v} to uint64`);
|
298
332
|
}
|
299
|
-
static getNumber(v) {
|
300
|
-
return Uint64Cls.fromCompat(v).asNumber();
|
301
|
-
}
|
302
333
|
valueOf() {
|
303
334
|
return this.#value;
|
304
335
|
}
|
@@ -386,8 +417,8 @@ class BytesCls extends AlgoTsPrimitiveCls {
|
|
386
417
|
return this;
|
387
418
|
}
|
388
419
|
at(i) {
|
389
|
-
|
390
|
-
return new BytesCls(this.#v
|
420
|
+
Uint64Cls.fromCompat(i).asNumber();
|
421
|
+
return new BytesCls(arrayUtil.arrayAt(this.#v, i));
|
391
422
|
}
|
392
423
|
slice(start, end) {
|
393
424
|
const startNumber = start instanceof Uint64Cls ? start.asNumber() : start;
|
@@ -467,10 +498,10 @@ class BytesCls extends AlgoTsPrimitiveCls {
|
|
467
498
|
.reduce((a, b) => a.concat(b));
|
468
499
|
}
|
469
500
|
static fromHex(hex) {
|
470
|
-
return new BytesCls(
|
501
|
+
return new BytesCls(hexToUint8Array(hex));
|
471
502
|
}
|
472
503
|
static fromBase64(b64) {
|
473
|
-
return new BytesCls(
|
504
|
+
return new BytesCls(base64ToUint8Array(b64));
|
474
505
|
}
|
475
506
|
static fromBase32(b32) {
|
476
507
|
return new BytesCls(base32ToUint8Array(b32));
|
@@ -493,10 +524,23 @@ class BytesCls extends AlgoTsPrimitiveCls {
|
|
493
524
|
}
|
494
525
|
const arrayUtil = new (class {
|
495
526
|
arrayAt(arrayLike, index) {
|
496
|
-
|
527
|
+
const indexNum = getNumber(index);
|
528
|
+
if (arrayLike instanceof Uint8Array) {
|
529
|
+
const res = arrayLike.slice(indexNum, indexNum + 1);
|
530
|
+
avmInvariant(res.length, 'Index out of bounds');
|
531
|
+
return res;
|
532
|
+
}
|
533
|
+
return arrayLike.at(indexNum) ?? avmError('Index out of bounds');
|
497
534
|
}
|
498
535
|
arraySlice(arrayLike, start, end) {
|
499
|
-
|
536
|
+
const startNum = getNumber(start);
|
537
|
+
const endNum = getNumber(end);
|
538
|
+
if (arrayLike instanceof Uint8Array) {
|
539
|
+
return arrayLike.slice(startNum, endNum);
|
540
|
+
}
|
541
|
+
else {
|
542
|
+
return arrayLike.slice(startNum, endNum);
|
543
|
+
}
|
500
544
|
}
|
501
545
|
})();
|
502
546
|
|
@@ -510,7 +554,7 @@ var primitives = /*#__PURE__*/Object.freeze({
|
|
510
554
|
checkBigUint: checkBigUint,
|
511
555
|
checkBytes: checkBytes,
|
512
556
|
checkUint64: checkUint64,
|
513
|
-
|
557
|
+
getNumber: getNumber,
|
514
558
|
isBytes: isBytes,
|
515
559
|
isUint64: isUint64,
|
516
560
|
toBytes: toBytes,
|
@@ -521,12 +565,30 @@ function Uint64(v) {
|
|
521
565
|
return Uint64Cls.fromCompat(v).asAlgoTs();
|
522
566
|
}
|
523
567
|
function BigUint(v) {
|
568
|
+
if (typeof v === 'string')
|
569
|
+
v = BigInt(v);
|
570
|
+
else if (v === undefined)
|
571
|
+
v = 0n;
|
524
572
|
return BigUintCls.fromCompat(v).asAlgoTs();
|
525
573
|
}
|
526
574
|
function Bytes(value, ...replacements) {
|
527
575
|
if (isTemplateStringsArray(value)) {
|
528
576
|
return BytesCls.fromInterpolation(value, replacements).asAlgoTs();
|
529
577
|
}
|
578
|
+
else if (typeof value === 'bigint' || value instanceof BigUintCls) {
|
579
|
+
return BigUintCls.fromCompat(value).toBytes().asAlgoTs();
|
580
|
+
}
|
581
|
+
else if (typeof value === 'number' || value instanceof Uint64Cls) {
|
582
|
+
return Uint64Cls.fromCompat(value).toBytes().asAlgoTs();
|
583
|
+
}
|
584
|
+
else if (typeof value === 'object' && Symbol.iterator in value) {
|
585
|
+
const valueItems = Array.from(value).map((v) => getNumber(v));
|
586
|
+
const invalidValue = valueItems.find((v) => v < 0 && v > 255);
|
587
|
+
if (invalidValue) {
|
588
|
+
throw new CodeError(`Cannot convert ${invalidValue} to a byte`);
|
589
|
+
}
|
590
|
+
return new BytesCls(new Uint8Array(value)).asAlgoTs();
|
591
|
+
}
|
530
592
|
else {
|
531
593
|
return BytesCls.fromCompat(value).asAlgoTs();
|
532
594
|
}
|
@@ -769,4 +831,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
769
831
|
});
|
770
832
|
|
771
833
|
export { AssertError as A, BytesCls 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, ctxMgr as c, assert as d, encodingUtil as e, assertMatch as f, ensureBudget as g, abimethod as h, index as i, BaseContract as j, BigUint as k, log as l, match as m, Bytes 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 };
|
772
|
-
//# sourceMappingURL=index-
|
834
|
+
//# sourceMappingURL=index-BHpT2IXF.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index-BHpT2IXF.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/execution-context.ts","../src/util.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 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 == 'boolean') return true\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 const start = Uint64Cls.fromCompat(i).asNumber()\n return new BytesCls(arrayUtil.arrayAt(this.#v, i))\n }\n\n slice(start: StubUint64Compat, end: StubUint64Compat): BytesCls {\n const startNumber = start instanceof Uint64Cls ? start.asNumber() : start\n const endNumber = end instanceof Uint64Cls ? end.asNumber() : end\n const sliced = arrayUtil.arraySlice(this.#v, startNumber, endNumber)\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 {\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 const indexNum = getNumber(index)\n if (arrayLike instanceof Uint8Array) {\n const res = arrayLike.slice(indexNum, 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: StubUint64Compat, end: StubUint64Compat): Uint8Array\n arraySlice<T>(arrayLike: T[], start: StubUint64Compat, end: StubUint64Compat): T[]\n arraySlice<T>(arrayLike: T[] | Uint8Array, start: StubUint64Compat, end: StubUint64Compat) {\n const startNum = getNumber(start)\n const endNum = 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(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 { Contract, gtxn, itxn } 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}\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","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 { 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 { biguint, BigUintCompat, Bytes, bytes, BytesBacked, StringCompat, uint64, Uint64Compat } from '../primitives'\nimport { err } from '../util'\nimport { Account } from '../reference'\nimport { arrayUtil } from '../impl/primitives'\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\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 get native(): uint64 {\n throw new Error('TODO')\n }\n}\nexport class Bool {\n #v: boolean\n constructor(v: boolean) {\n this.#v = v\n }\n\n get native(): boolean {\n return this.#v\n }\n}\n\nabstract class Arc4Array<TItem> extends AbiEncoded {\n protected constructor(protected items: TItem[]) {\n super()\n }\n get length(): uint64 {\n throw new Error('TODO')\n }\n at(index: Uint64Compat): TItem {\n return arrayUtil.arrayAt(this.items, index)\n }\n slice(start: Uint64Compat, end: Uint64Compat): DynamicArray<TItem> {\n return new DynamicArray(...arrayUtil.arraySlice(this.items, start, end))\n }\n [Symbol.iterator](): IterableIterator<TItem> {\n return this.items[Symbol.iterator]()\n }\n entries(): IterableIterator<readonly [uint64, TItem]> {\n throw new Error('TODO')\n }\n keys(): IterableIterator<uint64> {\n throw new Error('TODO')\n }\n}\n\nexport class StaticArray<TItem, TLength extends number> extends Arc4Array<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 Arc4Array<TItem> {\n constructor(...items: TItem[]) {\n super(items)\n }\n push(...items: TItem[]): void {}\n pop(): TItem {\n throw new Error('Not implemented')\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 StaticArray<Byte, 32> {\n constructor(value: Account | string | bytes) {\n super()\n }\n\n get native(): Account {\n throw new Error('TODO')\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,IAAA,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAA;AAC7B,CAAC;AAEe,SAAA,YAAY,CAAC,SAAkB,EAAE,OAAe,EAAA;IAC9D,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAA;KAC5B;AACH,CAAC;A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AACH,CAAC;AAcK,SAAU,UAAU,CAA6B,MAAyB,EAAA;IAC9E,OAAO,UACL,MAAoD,EACpD,GAA2C,EAAA;QAE3C,GAAG,CAAC,cAAc,CAAC,YAAA;AACjB,YAAA,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;AAC5E,SAAC,CAAC,CAAA;AACF,QAAA,OAAO,MAAM,CAAA;AACf,KAAC,CAAA;AACH;;;;;;;;;;;;;;;;;;;;;"}
|
package/index.mjs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
import { c as ctxMgr, A as AssertError, B as BytesCls, e as encodingUtil, a as errors, p as primitives } from './index-
|
2
|
-
export { j as BaseContract, k as BigUint, n as Bytes, C as Contract, O as OpUpFeeSource, U as Uint64, h as abimethod, i as arc4, d as assert, f as assertMatch, g as ensureBudget, b as err, l as log, m as match, u as urange } from './index-
|
1
|
+
import { c as ctxMgr, A as AssertError, B as BytesCls, e as encodingUtil, a as errors, p as primitives } from './index-BHpT2IXF.js';
|
2
|
+
export { j as BaseContract, k as BigUint, n as Bytes, C as Contract, O as OpUpFeeSource, U as Uint64, h as abimethod, i as arc4, d as assert, f as assertMatch, g as ensureBudget, b as err, l as log, m as match, u as urange } from './index-BHpT2IXF.js';
|
3
|
+
import 'node:buffer';
|
3
4
|
import 'node:util';
|
4
5
|
|
5
6
|
function Account(address) {
|