@algorandfoundation/algorand-typescript 0.0.1-alpha.16 → 0.0.1-alpha.17
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/arc-28.d.ts +34 -0
- package/arc4/encoded-types.d.ts +63 -26
- package/arc4/index.d.ts +8 -0
- package/arc4/index.mjs +1 -1
- package/compiled.d.ts +108 -0
- package/execution-context-BznYSiE4.js.map +1 -1
- package/impl/errors.d.ts +7 -0
- package/impl/primitives.d.ts +1 -1
- package/{index-DaaqFl7S.js → index-BD1amocx.js} +131 -137
- package/index-BD1amocx.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.mjs +108 -5
- package/index.mjs.map +1 -1
- package/mutable-array.d.ts +58 -0
- package/op-COyMsFkC.js.map +1 -1
- package/package.json +3 -2
- package/primitives.d.ts +8 -0
- package/typescript-helpers.d.ts +1 -0
- package/index-DaaqFl7S.js.map +0 -1
package/arc-28.d.ts
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
import { DeliberateAny } from './typescript-helpers';
|
2
|
+
/**
|
3
|
+
* Emit an arc28 event log using either an ARC4Struct type or a named object type.
|
4
|
+
* Object types must have an ARC4 equivalent type.
|
5
|
+
*
|
6
|
+
* Anonymous types cannot be used as the type name is used to determine the event prefix
|
7
|
+
* @param event An ARC4Struct instance, or a plain object with a named type
|
8
|
+
*
|
9
|
+
* @example
|
10
|
+
* class Demo extends Struct<{ a: UintN64 }> {}
|
11
|
+
* emit(new Demo({ a: new UintN64(123) }))
|
12
|
+
*
|
13
|
+
* @example
|
14
|
+
* type Demo = { a: uint64 }
|
15
|
+
* emit<Demo>({a: 123})
|
16
|
+
* // or
|
17
|
+
* const d: Demo = { a: 123 }
|
18
|
+
* emit(d)
|
19
|
+
*/
|
20
|
+
export declare function emit<TEvent extends Record<string, DeliberateAny>>(event: TEvent): void;
|
21
|
+
/**
|
22
|
+
* Emit an arc28 event log using an explicit name and inferred property/field types.
|
23
|
+
* Property types must be ARC4 or have an ARC4 equivalent type.
|
24
|
+
* @param eventName The name of the event (must be a compile time constant)
|
25
|
+
* @param eventProps A set of event properties (order is significant)
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* emit("Demo", new UintN64(123))
|
29
|
+
*
|
30
|
+
* @example
|
31
|
+
* const a: uint64 = 123
|
32
|
+
* emit("Demo", a)
|
33
|
+
*/
|
34
|
+
export declare function emit<TProps extends [...DeliberateAny[]]>(eventName: string, ...eventProps: TProps): void;
|
package/arc4/encoded-types.d.ts
CHANGED
@@ -1,41 +1,52 @@
|
|
1
|
-
import { biguint, BigUintCompat, bytes, BytesBacked, StringCompat, uint64, Uint64Compat } from '../primitives';
|
1
|
+
import { biguint, BigUintCompat, bytes, BytesBacked, BytesCompat, StringCompat, uint64, Uint64Compat } from '../primitives';
|
2
2
|
import { Account } from '../reference';
|
3
|
-
|
4
|
-
type
|
5
|
-
type
|
6
|
-
|
7
|
-
|
3
|
+
type UintBitSize = 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64;
|
4
|
+
type BigUintBitSize = 72 | 80 | 88 | 96 | 104 | 112 | 120 | 128 | 136 | 144 | 152 | 160 | 168 | 176 | 184 | 192 | 200 | 208 | 216 | 224 | 232 | 240 | 248 | 256 | 264 | 272 | 280 | 288 | 296 | 304 | 312 | 320 | 328 | 336 | 344 | 352 | 360 | 368 | 376 | 384 | 392 | 400 | 408 | 416 | 424 | 432 | 440 | 448 | 456 | 464 | 472 | 480 | 488 | 496 | 504 | 512;
|
5
|
+
export type BitSize = UintBitSize | BigUintBitSize;
|
6
|
+
type NativeForArc4Int<N extends BitSize> = N extends UintBitSize ? uint64 : biguint;
|
7
|
+
type CompatForArc4Int<N extends BitSize> = N extends UintBitSize ? Uint64Compat : BigUintCompat;
|
8
|
+
declare const TypeProperty: unique symbol;
|
9
|
+
export declare abstract class ARC4Encoded implements BytesBacked {
|
10
|
+
abstract [TypeProperty]?: string;
|
8
11
|
get bytes(): bytes;
|
9
|
-
equals(other: this): boolean;
|
10
12
|
}
|
11
13
|
export declare class Str extends ARC4Encoded {
|
12
14
|
#private;
|
13
|
-
|
15
|
+
[TypeProperty]?: 'arc4.Str';
|
14
16
|
constructor(s?: StringCompat);
|
15
17
|
get native(): string;
|
16
18
|
}
|
17
19
|
export declare class UintN<N extends BitSize> extends ARC4Encoded {
|
18
|
-
|
20
|
+
[TypeProperty]?: `arc4.UintN<${N}>`;
|
19
21
|
constructor(v?: CompatForArc4Int<N>);
|
20
22
|
get native(): NativeForArc4Int<N>;
|
21
23
|
}
|
24
|
+
export declare class Byte extends UintN<8> {
|
25
|
+
}
|
26
|
+
export declare class UintN8 extends UintN<8> {
|
27
|
+
}
|
28
|
+
export declare class UintN16 extends UintN<16> {
|
29
|
+
}
|
30
|
+
export declare class UintN32 extends UintN<32> {
|
31
|
+
}
|
32
|
+
export declare class UintN64 extends UintN<64> {
|
33
|
+
}
|
34
|
+
export declare class UintN128 extends UintN<128> {
|
35
|
+
}
|
36
|
+
export declare class UintN256 extends UintN<256> {
|
37
|
+
}
|
22
38
|
export declare class UFixedNxM<N extends BitSize, M extends number> extends ARC4Encoded {
|
23
|
-
|
24
|
-
constructor(v: `${number}.${number}
|
39
|
+
[TypeProperty]?: `arc4.UFixedNxM<${N}x${M}>`;
|
40
|
+
constructor(v: `${number}.${number}`);
|
25
41
|
get native(): NativeForArc4Int<N>;
|
26
42
|
}
|
27
|
-
export declare class
|
28
|
-
|
29
|
-
}
|
30
|
-
export declare class Bool {
|
31
|
-
#private;
|
32
|
-
__type?: `arc4.Bool`;
|
43
|
+
export declare class Bool extends ARC4Encoded {
|
44
|
+
[TypeProperty]?: `arc4.Bool`;
|
33
45
|
constructor(v?: boolean);
|
34
46
|
get native(): boolean;
|
35
47
|
}
|
36
48
|
declare abstract class Arc4ReadonlyArray<TItem extends ARC4Encoded> extends ARC4Encoded {
|
37
|
-
protected
|
38
|
-
protected constructor(items: TItem[]);
|
49
|
+
protected constructor();
|
39
50
|
/**
|
40
51
|
* Returns the current length of this array
|
41
52
|
*/
|
@@ -65,7 +76,7 @@ declare abstract class Arc4ReadonlyArray<TItem extends ARC4Encoded> extends ARC4
|
|
65
76
|
[index: uint64]: TItem;
|
66
77
|
}
|
67
78
|
export declare class StaticArray<TItem extends ARC4Encoded, TLength extends number> extends Arc4ReadonlyArray<TItem> {
|
68
|
-
|
79
|
+
[TypeProperty]?: `arc4.StaticArray<${TItem[typeof TypeProperty]}, ${TLength}>`;
|
69
80
|
constructor();
|
70
81
|
constructor(...items: TItem[] & {
|
71
82
|
length: TLength;
|
@@ -74,7 +85,7 @@ export declare class StaticArray<TItem extends ARC4Encoded, TLength extends numb
|
|
74
85
|
copy(): StaticArray<TItem, TLength>;
|
75
86
|
}
|
76
87
|
export declare class DynamicArray<TItem extends ARC4Encoded> extends Arc4ReadonlyArray<TItem> {
|
77
|
-
|
88
|
+
[TypeProperty]?: `arc4.DynamicArray<${TItem[typeof TypeProperty]}>`;
|
78
89
|
constructor(...items: TItem[]);
|
79
90
|
/**
|
80
91
|
* Push a number of items into this array
|
@@ -87,24 +98,50 @@ export declare class DynamicArray<TItem extends ARC4Encoded> extends Arc4Readonl
|
|
87
98
|
pop(): TItem;
|
88
99
|
copy(): DynamicArray<TItem>;
|
89
100
|
}
|
90
|
-
type ExpandTupleType<T extends ARC4Encoded[]> = T extends [infer T1 extends ARC4Encoded, ...infer TRest extends ARC4Encoded[]] ? TRest extends [] ? `${T1[
|
101
|
+
type ExpandTupleType<T extends ARC4Encoded[]> = T extends [infer T1 extends ARC4Encoded, ...infer TRest extends ARC4Encoded[]] ? TRest extends [] ? `${T1[typeof TypeProperty]}` : `${T1[typeof TypeProperty]},${ExpandTupleType<TRest>}` : '';
|
91
102
|
export declare class Tuple<TTuple extends [ARC4Encoded, ...ARC4Encoded[]]> extends ARC4Encoded {
|
92
|
-
|
93
|
-
__type?: `arc4.Tuple<${ExpandTupleType<TTuple>}>`;
|
103
|
+
[TypeProperty]?: `arc4.Tuple<${ExpandTupleType<TTuple>}>`;
|
94
104
|
constructor(...items: TTuple);
|
95
105
|
at<TIndex extends keyof TTuple>(index: TIndex): TTuple[TIndex];
|
96
106
|
get length(): TTuple['length'] & uint64;
|
97
107
|
get native(): TTuple;
|
98
108
|
}
|
99
109
|
export declare class Address extends Arc4ReadonlyArray<Byte> {
|
100
|
-
|
110
|
+
[TypeProperty]?: `arc4.Address`;
|
101
111
|
constructor(value?: Account | string | bytes);
|
102
112
|
get native(): Account;
|
103
113
|
}
|
104
114
|
type StructConstraint = Record<string, ARC4Encoded>;
|
105
115
|
declare class StructBase extends ARC4Encoded {
|
106
|
-
|
116
|
+
[TypeProperty]: string;
|
107
117
|
}
|
108
118
|
type StructConstructor = new <T extends StructConstraint>(initial: T) => StructBase & T;
|
109
119
|
export declare const Struct: StructConstructor;
|
120
|
+
export declare class DynamicBytes extends Arc4ReadonlyArray<Byte> {
|
121
|
+
[TypeProperty]?: `arc4.DynamicBytes`;
|
122
|
+
constructor(value?: bytes | string);
|
123
|
+
get native(): bytes;
|
124
|
+
}
|
125
|
+
export declare class StaticBytes<TLength extends number = 0> extends Arc4ReadonlyArray<Byte> {
|
126
|
+
[TypeProperty]?: `arc4.StaticBytes<${TLength}>`;
|
127
|
+
constructor(value?: bytes | string);
|
128
|
+
get native(): bytes;
|
129
|
+
}
|
130
|
+
/**
|
131
|
+
* Interpret the provided bytes as an ARC4 encoded type with no validation
|
132
|
+
* @param bytes An arc4 encoded bytes value
|
133
|
+
* @param prefix The prefix (if any), present in the bytes value. This prefix will be validated and removed
|
134
|
+
*/
|
135
|
+
export declare function interpretAsArc4<T extends ARC4Encoded>(bytes: BytesCompat, prefix?: 'none' | 'log'): T;
|
136
|
+
/**
|
137
|
+
* Decode the provided bytes to a native Algorand TypeScript value
|
138
|
+
* @param bytes An arc4 encoded bytes value
|
139
|
+
* @param prefix The prefix (if any), present in the bytes value. This prefix will be validated and removed
|
140
|
+
*/
|
141
|
+
export declare function decodeArc4<T>(bytes: BytesCompat, prefix?: 'none' | 'log'): T;
|
142
|
+
/**
|
143
|
+
* Encode the provided Algorand TypeScript value as ARC4 bytes
|
144
|
+
* @param value Any native Algorand TypeScript value with a supported ARC4 encoding
|
145
|
+
*/
|
146
|
+
export declare function encodeArc4<T>(value: T): bytes;
|
110
147
|
export {};
|
package/arc4/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { BaseContract } from '../base-contract';
|
2
|
+
import { bytes } from '../primitives';
|
2
3
|
import { DeliberateAny } from '../typescript-helpers';
|
3
4
|
export * from './encoded-types';
|
4
5
|
export declare class Contract extends BaseContract {
|
@@ -55,3 +56,10 @@ export type BareMethodConfig = {
|
|
55
56
|
onCreate?: CreateOptions;
|
56
57
|
};
|
57
58
|
export declare function baremethod<TContract extends Contract>(config?: BareMethodConfig): <TArgs extends DeliberateAny[], TReturn>(target: (this: TContract, ...args: TArgs) => TReturn, ctx: ClassMethodDecoratorContext<TContract>) => (this: TContract, ...args: TArgs) => TReturn;
|
59
|
+
/**
|
60
|
+
* Returns the ARC4 method selector for a given ARC4 method signature. The method selector is the first
|
61
|
+
* 4 bytes of the SHA512/256 hash of the method signature.
|
62
|
+
* @param methodSignature An ARC4 method signature. Eg. `hello(string)string`. Must be a compile time constant.
|
63
|
+
* @returns The ARC4 method selector. Eg. `02BECE11`
|
64
|
+
*/
|
65
|
+
export declare function methodSelector(methodSignature: string): bytes;
|
package/arc4/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { x as Address, v as Bool,
|
1
|
+
export { h as ARC4Encoded, x as Address, v as Bool, k as Byte, C as Contract, D as DynamicArray, z as DynamicBytes, O as OnCompleteAction, w as StaticArray, E as StaticBytes, S as Str, y as Struct, T as Tuple, u as UFixedNxM, j as UintN, r as UintN128, n as UintN16, s as UintN256, o as UintN32, q as UintN64, l as UintN8, c as abimethod, g as baremethod, G as decodeArc4, H as encodeArc4, F as interpretAsArc4, m as methodSelector } from '../index-BD1amocx.js';
|
2
2
|
import '../execution-context-BznYSiE4.js';
|
3
3
|
import 'node:buffer';
|
4
4
|
import 'node:util';
|
package/compiled.d.ts
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
import { BaseContract } from './base-contract';
|
2
|
+
import { LogicSig } from './logic-sig';
|
3
|
+
import { bytes, uint64 } from './primitives';
|
4
|
+
import { Account } from './reference';
|
5
|
+
import { ConstructorFor, DeliberateAny } from './typescript-helpers';
|
6
|
+
/**
|
7
|
+
* Provides compiled programs and state allocation values for a Contract. Created by calling `compile(ExampleContractType)`
|
8
|
+
*/
|
9
|
+
export type CompiledContract = {
|
10
|
+
/**
|
11
|
+
* Approval program pages for a contract, after template variables have been replaced and compiled to AVM bytecode
|
12
|
+
*/
|
13
|
+
approvalProgram: [bytes, bytes];
|
14
|
+
/**
|
15
|
+
* Clear state program pages for a contract, after template variables have been replaced and compiled to AVM bytecode
|
16
|
+
*/
|
17
|
+
clearStateProgram: [bytes, bytes];
|
18
|
+
/**
|
19
|
+
* By default, provides extra program pages required based on approval and clear state program size, can be overridden when calling `compile(ExampleContractType, { extraProgramPages: ... })`
|
20
|
+
*/
|
21
|
+
extraProgramPages: uint64;
|
22
|
+
/**
|
23
|
+
* By default, provides global num uints based on contract state totals, can be overridden when calling `compile(ExampleContractType, { globalUints: ... })`
|
24
|
+
*/
|
25
|
+
globalUints: uint64;
|
26
|
+
/**
|
27
|
+
* By default, provides global num bytes based on contract state totals, can be overridden when calling `compile(ExampleContractType, { globalBytes: ... })`
|
28
|
+
*/
|
29
|
+
globalBytes: uint64;
|
30
|
+
/**
|
31
|
+
* By default, provides local num uints based on contract state totals, can be overridden when calling `compile(ExampleContractType, { localUints: ... })`
|
32
|
+
*/
|
33
|
+
localUints: uint64;
|
34
|
+
/**
|
35
|
+
* By default, provides local num bytes based on contract state totals, can be overridden when calling `compile(ExampleContractType, { localBytes: ... })`
|
36
|
+
*/
|
37
|
+
localBytes: uint64;
|
38
|
+
};
|
39
|
+
/**
|
40
|
+
* Provides account for a Logic Signature. Created by calling `compile(LogicSigType)`
|
41
|
+
*/
|
42
|
+
export type CompiledLogicSig = {
|
43
|
+
/**
|
44
|
+
* Address of a logic sig program, after template variables have been replaced and compiled to AVM bytecode
|
45
|
+
*/
|
46
|
+
account: Account;
|
47
|
+
};
|
48
|
+
/**
|
49
|
+
* Options for compiling a contract
|
50
|
+
*/
|
51
|
+
type CompileContractOptions = {
|
52
|
+
/**
|
53
|
+
* Number of extra program pages, defaults to minimum required for contract
|
54
|
+
*/
|
55
|
+
extraProgramPages?: uint64;
|
56
|
+
/**
|
57
|
+
* Number of global uint64s, defaults to value defined for contract
|
58
|
+
*/
|
59
|
+
globalUints?: uint64;
|
60
|
+
/**
|
61
|
+
* Number of global bytes, defaults to value defined for contract
|
62
|
+
*/
|
63
|
+
globalBytes?: uint64;
|
64
|
+
/**
|
65
|
+
* Number of local uint64s, defaults to value defined for contract
|
66
|
+
*/
|
67
|
+
localUints?: uint64;
|
68
|
+
/**
|
69
|
+
* Number of local bytes, defaults to value defined for contract
|
70
|
+
*/
|
71
|
+
localBytes?: uint64;
|
72
|
+
/**
|
73
|
+
* Template variables to substitute into the contract, key should be without the prefix, must evaluate to a compile time constant
|
74
|
+
* and match the type of the template var declaration
|
75
|
+
*/
|
76
|
+
templateVars?: Record<string, DeliberateAny>;
|
77
|
+
/**
|
78
|
+
* Prefix to add to provided template vars, defaults to the prefix supplied on command line (which defaults to TMPL_)
|
79
|
+
*/
|
80
|
+
templateVarsPrefix?: string;
|
81
|
+
};
|
82
|
+
/**
|
83
|
+
* Options for compiling a logic signature
|
84
|
+
*/
|
85
|
+
type CompileLogicSigOptions = {
|
86
|
+
/**
|
87
|
+
* Template variables to substitute into the contract, key should be without the prefix, must evaluate to a compile time constant
|
88
|
+
* and match the type of the template var declaration
|
89
|
+
*/
|
90
|
+
templateVars?: Record<string, DeliberateAny>;
|
91
|
+
/**
|
92
|
+
* Prefix to add to provided template vars, defaults to the prefix supplied on command line (which defaults to TMPL_)
|
93
|
+
*/
|
94
|
+
templateVarsPrefix?: string;
|
95
|
+
};
|
96
|
+
/**
|
97
|
+
* Compile a contract and return the resulting byte code for approval and clear state programs.
|
98
|
+
* @param contract The contract class to compile
|
99
|
+
* @param options Options for compiling the contract
|
100
|
+
*/
|
101
|
+
export declare function compile(contract: ConstructorFor<BaseContract>, options?: CompileContractOptions): CompiledContract;
|
102
|
+
/**
|
103
|
+
* Compile a logic signature and return an account ready for signing transactions.
|
104
|
+
* @param logicSig The logic sig class to compile
|
105
|
+
* @param options Options for compiling the logic sig
|
106
|
+
*/
|
107
|
+
export declare function compile(logicSig: ConstructorFor<LogicSig>, options?: CompileLogicSigOptions): CompiledLogicSig;
|
108
|
+
export {};
|
@@ -1 +1 @@
|
|
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
|
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;QAC9C,IAAI,QAAQ,IAAI,SAAS;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC;AACpF,QAAA,MAAM,CAAC,sBAAsB,GAAG,GAAG;KACpC;AACD,IAAA,IAAI,QAAQ,GAAA;AACV,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,sBAAsB;QAC9C,IAAI,QAAQ,IAAI,SAAS;AAAE,YAAA,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC;AAC/E,QAAA,OAAO,QAAQ;KAChB;IACD,KAAK,GAAA;AACH,QAAA,MAAM,CAAC,sBAAsB,GAAG,SAAS;KAC1C;;;;;"}
|
package/impl/errors.d.ts
CHANGED
@@ -27,3 +27,10 @@ export declare class CodeError extends Error {
|
|
27
27
|
constructor(message: string, options?: ErrorOptions);
|
28
28
|
}
|
29
29
|
export declare function codeError(message: string): never;
|
30
|
+
/**
|
31
|
+
* This error can be used in stub implementations that are expected to be overridden
|
32
|
+
* by the testing framework
|
33
|
+
*/
|
34
|
+
export declare class NoImplementation extends Error {
|
35
|
+
constructor();
|
36
|
+
}
|
package/impl/primitives.d.ts
CHANGED
@@ -52,7 +52,7 @@ export declare class BytesCls extends AlgoTsPrimitiveCls {
|
|
52
52
|
get length(): Uint64Cls;
|
53
53
|
toBytes(): BytesCls;
|
54
54
|
at(i: StubUint64Compat): BytesCls;
|
55
|
-
slice(start
|
55
|
+
slice(start?: StubUint64Compat, end?: StubUint64Compat): BytesCls;
|
56
56
|
concat(other: StubBytesCompat): BytesCls;
|
57
57
|
bitwiseAnd(other: StubBytesCompat): BytesCls;
|
58
58
|
bitwiseOr(other: StubBytesCompat): BytesCls;
|