@algorandfoundation/algorand-typescript-testing 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +2 -2
- package/collections/custom-key-map.d.ts +29 -0
- package/constants.d.ts +4 -0
- package/context-helpers/internal-context.d.ts +3 -3
- package/decode-logs.d.ts +2 -1
- package/impl/account.d.ts +6 -5
- package/impl/app-global.d.ts +2 -0
- package/impl/application.d.ts +7 -2
- package/impl/asset.d.ts +3 -2
- package/impl/base.d.ts +11 -0
- package/impl/block.d.ts +2 -0
- package/impl/index.d.ts +4 -2
- package/impl/scratch.d.ts +2 -0
- package/impl/state.d.ts +27 -0
- package/impl/transactions.d.ts +2 -1
- package/index.mjs +1410 -1135
- package/index.mjs.map +1 -1
- package/package.json +6 -6
- package/{runtime-helpers-B6YRp95T.js → runtime-helpers-Dv3qU-7_.js} +51 -12
- package/runtime-helpers-Dv3qU-7_.js.map +1 -0
- package/runtime-helpers.mjs +1 -1
- package/set-up.d.ts +11 -0
- package/subcontexts/contract-context.d.ts +1 -0
- package/subcontexts/ledger-context.d.ts +18 -6
- package/subcontexts/transaction-context.d.ts +3 -2
- package/test-execution-context.d.ts +6 -1
- package/test-transformer/index.mjs +0 -12
- package/test-transformer/index.mjs.map +1 -1
- package/util.d.ts +1 -1
- package/value-generators/avm.d.ts +1 -1
- package/runtime-helpers-B6YRp95T.js.map +0 -1
package/abi-metadata.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Contract } from '@algorandfoundation/algorand-typescript';
|
|
1
|
+
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;
|
|
@@ -13,4 +13,4 @@ export declare const attachAbiMetadata: (contract: {
|
|
|
13
13
|
}, methodName: string, metadata: AbiMetadata) => void;
|
|
14
14
|
export declare const captureMethodConfig: <T extends Contract>(contract: T, methodName: string, config?: AbiMethodConfig<T> | BareMethodConfig) => void;
|
|
15
15
|
export declare const hasAbiMetadata: <T extends Contract>(contract: T) => boolean;
|
|
16
|
-
export declare const getAbiMetadata: <T extends
|
|
16
|
+
export declare const getAbiMetadata: <T extends BaseContract>(contract: T, methodName: string) => AbiMetadata;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Account, internal } from '@algorandfoundation/algorand-typescript';
|
|
2
|
+
import { DeliberateAny } from '../typescript-helpers';
|
|
3
|
+
export declare abstract class CustomKeyMap<TKey, TValue> implements Map<TKey, TValue> {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(keySerializer: (key: TKey) => number | bigint | string);
|
|
6
|
+
clear(): void;
|
|
7
|
+
delete(key: TKey): boolean;
|
|
8
|
+
forEach(callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void, thisArg?: DeliberateAny): void;
|
|
9
|
+
get(key: TKey): TValue | undefined;
|
|
10
|
+
getOrFail(key: TKey): TValue;
|
|
11
|
+
has(key: TKey): boolean;
|
|
12
|
+
set(key: TKey, value: TValue): this;
|
|
13
|
+
get size(): number;
|
|
14
|
+
entries(): MapIterator<[TKey, TValue]>;
|
|
15
|
+
keys(): MapIterator<TKey>;
|
|
16
|
+
values(): MapIterator<TValue>;
|
|
17
|
+
[Symbol.iterator](): MapIterator<[TKey, TValue]>;
|
|
18
|
+
get [Symbol.toStringTag](): string;
|
|
19
|
+
}
|
|
20
|
+
export declare class AccountMap<TValue> extends CustomKeyMap<Account, TValue> {
|
|
21
|
+
constructor();
|
|
22
|
+
private static getAddressStrFromAccount;
|
|
23
|
+
}
|
|
24
|
+
export declare class BytesMap<TValue> extends CustomKeyMap<internal.primitives.StubBytesCompat, TValue> {
|
|
25
|
+
constructor();
|
|
26
|
+
}
|
|
27
|
+
export declare class Uint64Map<TValue> extends CustomKeyMap<internal.primitives.StubUint64Compat, TValue> {
|
|
28
|
+
constructor();
|
|
29
|
+
}
|
package/constants.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const DEFAULT_MAX_TXN_LIFE = 1000;
|
|
|
11
11
|
export declare const DEFAULT_ASSET_CREATE_MIN_BALANCE = 1000000;
|
|
12
12
|
export declare const DEFAULT_ASSET_OPT_IN_MIN_BALANCE = 10000;
|
|
13
13
|
export declare const DEFAULT_GLOBAL_GENESIS_HASH: import("@algorandfoundation/algorand-typescript").bytes;
|
|
14
|
+
export declare const ZERO_ADDRESS_B32 = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY5HFKQ";
|
|
14
15
|
export declare const ZERO_ADDRESS: import("@algorandfoundation/algorand-typescript").bytes;
|
|
15
16
|
/**
|
|
16
17
|
"\x09" # pragma version 9
|
|
@@ -19,3 +20,6 @@ export declare const ZERO_ADDRESS: import("@algorandfoundation/algorand-typescri
|
|
|
19
20
|
export declare const ALWAYS_APPROVE_TEAL_PROGRAM: import("@algorandfoundation/algorand-typescript").bytes;
|
|
20
21
|
export declare const LOGIC_DATA_PREFIX: import("@algorandfoundation/algorand-typescript").bytes;
|
|
21
22
|
export declare const MIN_TXN_FEE = 1000;
|
|
23
|
+
export declare const ABI_RETURN_VALUE_LOG_PREFIX: import("@algorandfoundation/algorand-typescript").bytes;
|
|
24
|
+
export declare const UINT64_OVERFLOW_UNDERFLOW_MESSAGE = "Uint64 overflow or underflow";
|
|
25
|
+
export declare const BIGUINT_OVERFLOW_UNDERFLOW_MESSAGE = "BigUint overflow or underflow";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { internal } from '@algorandfoundation/algorand-typescript';
|
|
1
|
+
import { Account, 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';
|
|
@@ -11,14 +11,14 @@ import { TestExecutionContext } from '../test-execution-context';
|
|
|
11
11
|
*/
|
|
12
12
|
declare class InternalContext {
|
|
13
13
|
get value(): TestExecutionContext;
|
|
14
|
-
get defaultSender():
|
|
14
|
+
get defaultSender(): Account;
|
|
15
15
|
get ledger(): import("../subcontexts/ledger-context").LedgerContext;
|
|
16
16
|
get txn(): import("../subcontexts/transaction-context").TransactionContext;
|
|
17
17
|
get contract(): import("../subcontexts/contract-context").ContractContext;
|
|
18
18
|
get any(): import("../value-generators").ValueGenerator;
|
|
19
19
|
get activeApplication(): import("@algorandfoundation/algorand-typescript").Application;
|
|
20
20
|
get activeGroup(): TransactionGroup;
|
|
21
|
-
getAccountData(
|
|
21
|
+
getAccountData(account: Account): AccountData;
|
|
22
22
|
getAssetData(id: internal.primitives.StubUint64Compat): AssetData;
|
|
23
23
|
getApplicationData(id: internal.primitives.StubUint64Compat): ApplicationData;
|
|
24
24
|
}
|
package/decode-logs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { bytes } from '@algorandfoundation/algorand-typescript';
|
|
1
2
|
export type LogDecoding = 'i' | 's' | 'b';
|
|
2
3
|
export type DecodedLog<T extends LogDecoding> = T extends 'i' ? bigint : T extends 's' ? string : Uint8Array;
|
|
3
4
|
export type DecodedLogs<T extends [...LogDecoding[]]> = {
|
|
@@ -5,4 +6,4 @@ export type DecodedLogs<T extends [...LogDecoding[]]> = {
|
|
|
5
6
|
} & {
|
|
6
7
|
length: T['length'];
|
|
7
8
|
};
|
|
8
|
-
export declare function decodeLogs<const T extends [...LogDecoding[]]>(logs:
|
|
9
|
+
export declare function decodeLogs<const T extends [...LogDecoding[]]>(logs: bytes[], decoding: T): DecodedLogs<T>;
|
package/impl/account.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import { Account, Application, Asset, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
2
|
+
import { Uint64Map } from '../collections/custom-key-map';
|
|
2
3
|
import { Mutable } from '../typescript-helpers';
|
|
4
|
+
import { BytesBackedCls } from './base';
|
|
3
5
|
export declare class AssetHolding {
|
|
4
6
|
balance: uint64;
|
|
5
7
|
frozen: boolean;
|
|
6
8
|
constructor(balance: internal.primitives.StubUint64Compat, frozen: boolean);
|
|
7
9
|
}
|
|
8
10
|
export declare class AccountData {
|
|
9
|
-
optedAssets:
|
|
10
|
-
optedApplications:
|
|
11
|
+
optedAssets: Uint64Map<AssetHolding>;
|
|
12
|
+
optedApplications: Uint64Map<Application>;
|
|
11
13
|
account: Mutable<Omit<Account, 'bytes' | 'isOptedIn'>>;
|
|
12
14
|
constructor();
|
|
13
15
|
}
|
|
14
|
-
export declare class AccountCls implements Account {
|
|
15
|
-
|
|
16
|
-
constructor(address?: internal.primitives.StubBytesCompat);
|
|
16
|
+
export declare class AccountCls extends BytesBackedCls implements Account {
|
|
17
|
+
constructor(address?: bytes);
|
|
17
18
|
private get data();
|
|
18
19
|
get balance(): uint64;
|
|
19
20
|
get minBalance(): uint64;
|
package/impl/application.d.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { Account, Application, bytes, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
2
|
+
import { BytesMap } from '../collections/custom-key-map';
|
|
2
3
|
import { Mutable } from '../typescript-helpers';
|
|
4
|
+
import { Uint64BackedCls } from './base';
|
|
5
|
+
import { GlobalStateCls, LocalStateMapCls } from './state';
|
|
3
6
|
export declare class ApplicationData {
|
|
4
7
|
application: Mutable<Omit<Application, 'id' | 'address'>> & {
|
|
5
8
|
appLogs: bytes[];
|
|
9
|
+
globalStates: BytesMap<GlobalStateCls<unknown>>;
|
|
10
|
+
localStates: BytesMap<LocalStateMapCls<unknown>>;
|
|
6
11
|
};
|
|
7
12
|
isCreating: boolean;
|
|
8
13
|
get appLogs(): bytes[];
|
|
9
14
|
constructor();
|
|
10
15
|
}
|
|
11
|
-
export declare class ApplicationCls implements Application {
|
|
12
|
-
|
|
16
|
+
export declare class ApplicationCls extends Uint64BackedCls implements Application {
|
|
17
|
+
get id(): uint64;
|
|
13
18
|
constructor(id?: uint64);
|
|
14
19
|
private get data();
|
|
15
20
|
get approvalProgram(): bytes;
|
package/impl/asset.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Account, Asset, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
2
2
|
import { Mutable } from '../typescript-helpers';
|
|
3
|
+
import { Uint64BackedCls } from './base';
|
|
3
4
|
export type AssetData = Mutable<Omit<Asset, 'id' | 'balance' | 'frozen'>>;
|
|
4
|
-
export declare class AssetCls implements Asset {
|
|
5
|
-
|
|
5
|
+
export declare class AssetCls extends Uint64BackedCls implements Asset {
|
|
6
|
+
get id(): uint64;
|
|
6
7
|
constructor(id?: internal.primitives.StubUint64Compat);
|
|
7
8
|
private get data();
|
|
8
9
|
get total(): uint64;
|
package/impl/base.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { bytes, uint64 } from '@algorandfoundation/algorand-typescript';
|
|
2
|
+
export declare abstract class BytesBackedCls {
|
|
3
|
+
#private;
|
|
4
|
+
get bytes(): bytes;
|
|
5
|
+
constructor(value: bytes);
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class Uint64BackedCls {
|
|
8
|
+
#private;
|
|
9
|
+
get uint64(): uint64;
|
|
10
|
+
constructor(value: uint64);
|
|
11
|
+
}
|
package/impl/block.d.ts
ADDED
package/impl/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export { AcctParams, balance, minBalance } from './acct-params';
|
|
2
|
+
export { AppGlobal } from './app-global';
|
|
2
3
|
export { AppParams } from './app-params';
|
|
3
4
|
export { AssetHolding } from './asset-holding';
|
|
4
5
|
export { AssetParams } from './asset-params';
|
|
5
6
|
export * from './crypto';
|
|
6
7
|
export { Global } from './global';
|
|
7
8
|
export { GTxn } from './gtxn';
|
|
9
|
+
export { GITxn, ITxn, ITxnCreate } from './itxn';
|
|
8
10
|
export * from './pure';
|
|
11
|
+
export { Scratch, gloadBytes, gloadUint64 } from './scratch';
|
|
12
|
+
export { Block } from './block';
|
|
9
13
|
export { Txn, gaid } from './txn';
|
|
10
|
-
export { GITxn, ITxn, ITxnCreate } from './itxn';
|
|
11
|
-
export { Scratch } from './scratch';
|
package/impl/scratch.d.ts
CHANGED
package/impl/state.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Account, bytes, GlobalState, GlobalStateOptions, LocalState } from '@algorandfoundation/algorand-typescript';
|
|
2
|
+
export declare class GlobalStateCls<ValueType> {
|
|
3
|
+
#private;
|
|
4
|
+
private readonly _type;
|
|
5
|
+
key: bytes | undefined;
|
|
6
|
+
delete: () => void;
|
|
7
|
+
static [Symbol.hasInstance](x: unknown): x is GlobalStateCls<unknown>;
|
|
8
|
+
get value(): ValueType;
|
|
9
|
+
set value(v: ValueType);
|
|
10
|
+
get hasValue(): boolean;
|
|
11
|
+
constructor(key?: bytes | string, value?: ValueType);
|
|
12
|
+
}
|
|
13
|
+
export declare class LocalStateCls<ValueType> {
|
|
14
|
+
#private;
|
|
15
|
+
delete: () => void;
|
|
16
|
+
get value(): ValueType;
|
|
17
|
+
set value(v: ValueType);
|
|
18
|
+
get hasValue(): boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare class LocalStateMapCls<ValueType> {
|
|
21
|
+
#private;
|
|
22
|
+
getValue(account: Account): LocalStateCls<ValueType>;
|
|
23
|
+
}
|
|
24
|
+
export declare function createGlobalState<ValueType>(options?: GlobalStateOptions<ValueType>): GlobalState<ValueType>;
|
|
25
|
+
export declare function createLocalState<ValueType>(options?: {
|
|
26
|
+
key?: bytes | string;
|
|
27
|
+
}): LocalState<ValueType>;
|
package/impl/transactions.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export type ApplicationTransactionFields = TxnFields<gtxn.ApplicationTxn> & Part
|
|
|
98
98
|
approvalProgramPages: Array<bytes>;
|
|
99
99
|
clearStateProgramPages: Array<bytes>;
|
|
100
100
|
appLogs: Array<bytes>;
|
|
101
|
-
scratchSpace:
|
|
101
|
+
scratchSpace: Record<number, bytes | uint64>;
|
|
102
102
|
}>;
|
|
103
103
|
export declare class ApplicationTransaction extends TransactionBase implements gtxn.ApplicationTxn {
|
|
104
104
|
#private;
|
|
@@ -133,6 +133,7 @@ export declare class ApplicationTransaction extends TransactionBase implements g
|
|
|
133
133
|
readonly typeBytes: bytes;
|
|
134
134
|
get appLogs(): bytes[];
|
|
135
135
|
appendLog(value: internal.primitives.StubBytesCompat): void;
|
|
136
|
+
logArc4ReturnValue(value: unknown): void;
|
|
136
137
|
}
|
|
137
138
|
export type Transaction = PaymentTransaction | KeyRegistrationTransaction | AssetConfigTransaction | AssetTransferTransaction | AssetFreezeTransaction | ApplicationTransaction;
|
|
138
139
|
export type AllTransactionFields = TxnFields<gtxn.PaymentTxn> & TxnFields<gtxn.KeyRegistrationTxn> & TxnFields<gtxn.AssetConfigTxn> & TxnFields<gtxn.AssetTransferTxn> & TxnFields<gtxn.AssetFreezeTxn> & ApplicationTransactionFields;
|