@algorandfoundation/algorand-typescript-testing 1.0.0-alpha.11 → 1.0.0-alpha.13
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/abi-metadata.d.ts +7 -2
- package/constants.d.ts +20 -0
- package/context-helpers/context-util.d.ts +3 -0
- package/context-helpers/internal-context.d.ts +2 -2
- package/impl/acct-params.d.ts +2 -1
- package/impl/encoded-types.d.ts +11 -1
- package/impl/ensure-budget.d.ts +2 -0
- package/impl/index.d.ts +5 -4
- package/impl/inner-transactions.d.ts +2 -2
- package/impl/logicSigArg.d.ts +2 -0
- package/impl/pure.d.ts +1 -0
- package/impl/template-var.d.ts +1 -0
- package/impl/transactions.d.ts +1 -1
- package/index.mjs +1016 -1169
- package/index.mjs.map +1 -1
- package/package.json +3 -5
- package/{runtime-helpers-DlIX78iw.js → runtime-helpers-CUc689EZ.js} +549 -52
- package/runtime-helpers-CUc689EZ.js.map +1 -0
- package/runtime-helpers.d.ts +2 -0
- package/runtime-helpers.mjs +3 -3
- package/subcontexts/contract-context.d.ts +2 -1
- package/subcontexts/transaction-context.d.ts +7 -3
- package/test-execution-context.d.ts +7 -2
- package/test-transformer/index.mjs +47 -29
- package/test-transformer/index.mjs.map +1 -1
- package/test-transformer/node-factory.d.ts +2 -2
- package/util.d.ts +6 -2
- package/value-generators/arc4.d.ts +70 -0
- package/value-generators/index.d.ts +2 -0
- package/runtime-helpers-DlIX78iw.js.map +0 -1
package/abi-metadata.d.ts
CHANGED
|
@@ -2,15 +2,20 @@ import { BaseContract, Contract } from '@algorandfoundation/algorand-typescript'
|
|
|
2
2
|
import { AbiMethodConfig, BareMethodConfig, CreateOptions, OnCompleteActionStr } from '@algorandfoundation/algorand-typescript/arc4';
|
|
3
3
|
export interface AbiMetadata {
|
|
4
4
|
methodName: string;
|
|
5
|
-
|
|
5
|
+
methodSignature: string | undefined;
|
|
6
6
|
argTypes: string[];
|
|
7
7
|
returnType: string;
|
|
8
8
|
onCreate?: CreateOptions;
|
|
9
9
|
allowActions?: OnCompleteActionStr[];
|
|
10
10
|
}
|
|
11
|
+
export declare const isContractProxy: unique symbol;
|
|
11
12
|
export declare const attachAbiMetadata: (contract: {
|
|
12
13
|
new (): Contract;
|
|
13
14
|
}, methodName: string, metadata: AbiMetadata) => void;
|
|
15
|
+
export declare const copyAbiMetadatas: <T extends BaseContract>(sourceContract: T, targetContract: T) => void;
|
|
14
16
|
export declare const captureMethodConfig: <T extends Contract>(contract: T, methodName: string, config?: AbiMethodConfig<T> | BareMethodConfig) => void;
|
|
15
17
|
export declare const hasAbiMetadata: <T extends Contract>(contract: T) => boolean;
|
|
16
|
-
export declare const
|
|
18
|
+
export declare const getContractAbiMetadata: <T extends BaseContract>(contract: T) => Record<string, AbiMetadata>;
|
|
19
|
+
export declare const getContractMethodAbiMetadata: <T extends BaseContract>(contract: T, methodName: string) => AbiMetadata;
|
|
20
|
+
export declare const getArc4Signature: (metadata: AbiMetadata) => string;
|
|
21
|
+
export declare const getArc4Selector: (metadata: AbiMetadata) => Uint8Array;
|
package/constants.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
export declare const UINT64_SIZE = 64;
|
|
2
2
|
export declare const UINT512_SIZE = 512;
|
|
3
3
|
export declare const MAX_UINT8: number;
|
|
4
|
+
export declare const MAX_UINT16: number;
|
|
5
|
+
export declare const MAX_UINT32: number;
|
|
4
6
|
export declare const MAX_UINT64: bigint;
|
|
7
|
+
export declare const MAX_UINT128: bigint;
|
|
8
|
+
export declare const MAX_UINT256: bigint;
|
|
5
9
|
export declare const MAX_UINT512: bigint;
|
|
6
10
|
export declare const MAX_BYTES_SIZE = 4096;
|
|
7
11
|
export declare const MAX_LOG_SIZE = 1024;
|
|
@@ -25,3 +29,19 @@ export declare const MIN_TXN_FEE = 1000;
|
|
|
25
29
|
export declare const ABI_RETURN_VALUE_LOG_PREFIX: import("@algorandfoundation/algorand-typescript").bytes;
|
|
26
30
|
export declare const UINT64_OVERFLOW_UNDERFLOW_MESSAGE = "Uint64 overflow or underflow";
|
|
27
31
|
export declare const BIGUINT_OVERFLOW_UNDERFLOW_MESSAGE = "BigUint overflow or underflow";
|
|
32
|
+
export declare const DEFAULT_TEMPLATE_VAR_PREFIX = "TMPL_";
|
|
33
|
+
export declare const APP_ID_PREFIX = "appID";
|
|
34
|
+
export declare const HASH_BYTES_LENGTH = 32;
|
|
35
|
+
export declare const ALGORAND_ADDRESS_BYTE_LENGTH = 36;
|
|
36
|
+
export declare const ALGORAND_CHECKSUM_BYTE_LENGTH = 4;
|
|
37
|
+
export declare const ALGORAND_ADDRESS_LENGTH = 58;
|
|
38
|
+
export declare const PROGRAM_TAG = "Program";
|
|
39
|
+
export declare const TRANSACTION_GROUP_MAX_SIZE = 16;
|
|
40
|
+
export declare enum OnApplicationComplete {
|
|
41
|
+
NoOpOC = 0,
|
|
42
|
+
OptInOC = 1,
|
|
43
|
+
CloseOutOC = 2,
|
|
44
|
+
ClearStateOC = 3,
|
|
45
|
+
UpdateApplicationOC = 4,
|
|
46
|
+
DeleteApplicationOC = 5
|
|
47
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, internal } from '@algorandfoundation/algorand-typescript';
|
|
1
|
+
import { Account, BaseContract, internal } from '@algorandfoundation/algorand-typescript';
|
|
2
2
|
import { AccountData } from '../impl/account';
|
|
3
3
|
import { ApplicationData } from '../impl/application';
|
|
4
4
|
import { AssetData } from '../impl/asset';
|
|
@@ -20,7 +20,7 @@ declare class InternalContext {
|
|
|
20
20
|
get activeGroup(): TransactionGroup;
|
|
21
21
|
getAccountData(account: Account): AccountData;
|
|
22
22
|
getAssetData(id: internal.primitives.StubUint64Compat): AssetData;
|
|
23
|
-
getApplicationData(id: internal.primitives.StubUint64Compat): ApplicationData;
|
|
23
|
+
getApplicationData(id: internal.primitives.StubUint64Compat | BaseContract): ApplicationData;
|
|
24
24
|
}
|
|
25
25
|
export declare const lazyContext: InternalContext;
|
|
26
26
|
export {};
|
package/impl/acct-params.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Account, internal, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
1
|
+
import { Account, Application, internal, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
2
2
|
export declare const getAccount: (acct: Account | internal.primitives.StubUint64Compat) => Account;
|
|
3
3
|
export declare const balance: (a: Account | internal.primitives.StubUint64Compat) => uint64;
|
|
4
4
|
export declare const minBalance: (a: Account | internal.primitives.StubUint64Compat) => uint64;
|
|
5
|
+
export declare const appOptedIn: (a: Account | internal.primitives.StubUint64Compat, b: Application | internal.primitives.StubUint64Compat) => boolean;
|
|
5
6
|
export declare const AcctParams: internal.opTypes.AcctParamsType;
|
package/impl/encoded-types.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare class UintNImpl<N extends BitSize> extends UintN<N> {
|
|
|
13
13
|
equals(other: this): boolean;
|
|
14
14
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): UintNImpl<BitSize>;
|
|
15
15
|
static getMaxBitsLength(typeInfo: TypeInfo): BitSize;
|
|
16
|
+
static getArc4TypeName: (t: TypeInfo) => string;
|
|
16
17
|
}
|
|
17
18
|
export declare class UFixedNxMImpl<N extends BitSize, M extends number> extends UFixedNxM<N, M> {
|
|
18
19
|
private value;
|
|
@@ -25,6 +26,7 @@ export declare class UFixedNxMImpl<N extends BitSize, M extends number> extends
|
|
|
25
26
|
equals(other: this): boolean;
|
|
26
27
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): UFixedNxM<BitSize, number>;
|
|
27
28
|
static getMaxBitsLength(typeInfo: TypeInfo): BitSize;
|
|
29
|
+
static getArc4TypeName: (t: TypeInfo) => string;
|
|
28
30
|
}
|
|
29
31
|
export declare class ByteImpl extends Byte {
|
|
30
32
|
private value;
|
|
@@ -73,6 +75,7 @@ export declare class StaticArrayImpl<TItem extends ARC4Encoded, TLength extends
|
|
|
73
75
|
copy(): StaticArrayImpl<TItem, TLength>;
|
|
74
76
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): StaticArrayImpl<ARC4Encoded, number>;
|
|
75
77
|
static getMaxBytesLength(typeInfo: TypeInfo): number;
|
|
78
|
+
static getArc4TypeName: (t: TypeInfo) => string;
|
|
76
79
|
}
|
|
77
80
|
export declare class AddressImpl extends Address {
|
|
78
81
|
private typeInfo;
|
|
@@ -105,6 +108,7 @@ export declare class DynamicArrayImpl<TItem extends ARC4Encoded> extends Dynamic
|
|
|
105
108
|
push(...values: TItem[]): void;
|
|
106
109
|
pop(): TItem;
|
|
107
110
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): DynamicArrayImpl<ARC4Encoded>;
|
|
111
|
+
static getArc4TypeName: (t: TypeInfo) => string;
|
|
108
112
|
private encodeWithLength;
|
|
109
113
|
}
|
|
110
114
|
export declare class TupleImpl<TTuple extends [ARC4Encoded, ...ARC4Encoded[]]> extends Tuple<TTuple> {
|
|
@@ -121,10 +125,12 @@ export declare class TupleImpl<TTuple extends [ARC4Encoded, ...ARC4Encoded[]]> e
|
|
|
121
125
|
private get items();
|
|
122
126
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): TupleImpl<[ARC4Encoded, ...ARC4Encoded[]]>;
|
|
123
127
|
static getMaxBytesLength(typeInfo: TypeInfo): number;
|
|
128
|
+
static getArc4TypeName: (t: TypeInfo) => string;
|
|
124
129
|
}
|
|
125
130
|
type StructConstraint = Record<string, ARC4Encoded>;
|
|
126
|
-
declare const StructImpl_base:
|
|
131
|
+
declare const StructImpl_base: DeliberateAny;
|
|
127
132
|
export declare class StructImpl<T extends StructConstraint> extends StructImpl_base {
|
|
133
|
+
static [x: string]: any;
|
|
128
134
|
private uint8ArrayValue?;
|
|
129
135
|
private typeInfo;
|
|
130
136
|
genericArgs: Record<string, TypeInfo>;
|
|
@@ -133,6 +139,7 @@ export declare class StructImpl<T extends StructConstraint> extends StructImpl_b
|
|
|
133
139
|
get items(): T;
|
|
134
140
|
private decodeAsProperties;
|
|
135
141
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): StructImpl<StructConstraint>;
|
|
142
|
+
static getArc4TypeName: (t: TypeInfo) => string;
|
|
136
143
|
}
|
|
137
144
|
export declare class DynamicBytesImpl extends DynamicBytes {
|
|
138
145
|
private typeInfo;
|
|
@@ -145,6 +152,7 @@ export declare class DynamicBytesImpl extends DynamicBytes {
|
|
|
145
152
|
get items(): ByteImpl[];
|
|
146
153
|
setItem(_index: number, _value: ByteImpl): void;
|
|
147
154
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): DynamicBytesImpl;
|
|
155
|
+
static getArc4TypeName: (_t: TypeInfo) => string;
|
|
148
156
|
}
|
|
149
157
|
export declare class StaticBytesImpl extends StaticBytes {
|
|
150
158
|
private value;
|
|
@@ -158,8 +166,10 @@ export declare class StaticBytesImpl extends StaticBytes {
|
|
|
158
166
|
setItem(_index: number, _value: ByteImpl): void;
|
|
159
167
|
static fromBytesImpl(value: internal.primitives.StubBytesCompat | Uint8Array, typeInfo: string | TypeInfo, prefix?: 'none' | 'log'): StaticBytesImpl;
|
|
160
168
|
static getMaxBytesLength(typeInfo: TypeInfo): number;
|
|
169
|
+
static getArc4TypeName: (t: TypeInfo) => string;
|
|
161
170
|
}
|
|
162
171
|
export declare function interpretAsArc4Impl<T extends ARC4Encoded>(typeInfoString: string, bytes: internal.primitives.StubBytesCompat, prefix?: 'none' | 'log'): T;
|
|
163
172
|
export declare const arc4Encoders: Record<string, fromBytes<DeliberateAny>>;
|
|
164
173
|
export declare const getArc4Encoder: <T>(typeInfo: TypeInfo, encoders?: Record<string, fromBytes<DeliberateAny>>) => fromBytes<T>;
|
|
174
|
+
export declare const getArc4TypeName: (typeInfo: TypeInfo) => string | undefined;
|
|
165
175
|
export {};
|
package/impl/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
export { AcctParams, balance, minBalance } from './acct-params';
|
|
1
|
+
export { AcctParams, appOptedIn, balance, minBalance } from './acct-params';
|
|
2
2
|
export { AppGlobal } from './app-global';
|
|
3
3
|
export { AppLocal } from './app-local';
|
|
4
4
|
export { AppParams } from './app-params';
|
|
5
5
|
export { AssetHolding } from './asset-holding';
|
|
6
6
|
export { AssetParams } from './asset-params';
|
|
7
|
+
export { Block } from './block';
|
|
7
8
|
export { Box } from './box';
|
|
8
9
|
export * from './crypto';
|
|
9
10
|
export { Global } from './global';
|
|
10
11
|
export { GTxn } from './gtxn';
|
|
11
12
|
export { GITxn, ITxn, ITxnCreate } from './itxn';
|
|
13
|
+
export { arg } from './logicSigArg';
|
|
12
14
|
export * from './pure';
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export { Txn, gaid } from './txn';
|
|
15
|
+
export { gloadBytes, gloadUint64, Scratch } from './scratch';
|
|
16
|
+
export { gaid, Txn } from './txn';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { arc4, itxn, TransactionType, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
2
|
-
import { ApplicationTransaction, AssetConfigTransaction, AssetFreezeTransaction, AssetTransferTransaction, KeyRegistrationTransaction, PaymentTransaction } from './transactions';
|
|
3
|
-
import { InnerTxn, InnerTxnFields } from './itxn';
|
|
4
2
|
import { Mutable } from '../typescript-helpers';
|
|
3
|
+
import { InnerTxn, InnerTxnFields } from './itxn';
|
|
4
|
+
import { ApplicationTransaction, AssetConfigTransaction, AssetFreezeTransaction, AssetTransferTransaction, KeyRegistrationTransaction, PaymentTransaction } from './transactions';
|
|
5
5
|
export declare class PaymentInnerTxn extends PaymentTransaction implements itxn.PaymentInnerTxn {
|
|
6
6
|
readonly isItxn?: true;
|
|
7
7
|
static create(fields: itxn.PaymentFields): PaymentInnerTxn;
|
package/impl/pure.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const extractUint64: (a: internal.primitives.StubBytesCompat, b:
|
|
|
17
17
|
export declare const getBit: (a: internal.primitives.StubUint64Compat | internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat) => uint64;
|
|
18
18
|
export declare const getByte: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat) => uint64;
|
|
19
19
|
export declare const itob: (a: internal.primitives.StubUint64Compat) => bytes;
|
|
20
|
+
export declare const len: (a: internal.primitives.StubBytesCompat) => uint64;
|
|
20
21
|
export declare const mulw: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => readonly [uint64, uint64];
|
|
21
22
|
export declare const replace: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubBytesCompat) => bytes;
|
|
22
23
|
type selectType = ((a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat, c: internal.primitives.StubUint64Compat) => bytes) & ((a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat) => uint64);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TemplateVarImpl<T>(variableName: string, prefix?: string): T;
|
package/impl/transactions.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ export declare class AssetFreezeTransaction extends TransactionBase implements g
|
|
|
91
91
|
readonly typeBytes: bytes;
|
|
92
92
|
}
|
|
93
93
|
export type ApplicationTransactionFields = TxnFields<gtxn.ApplicationTxn> & Partial<{
|
|
94
|
-
appArgs: Array<
|
|
94
|
+
appArgs: Array<unknown>;
|
|
95
95
|
accounts: Array<Account>;
|
|
96
96
|
assets: Array<Asset>;
|
|
97
97
|
apps: Array<Application>;
|