@algorandfoundation/algorand-typescript-testing 1.0.0-alpha.2

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.
Files changed (48) hide show
  1. package/abi-metadata.d.ts +16 -0
  2. package/constants.d.ts +21 -0
  3. package/context-helpers/internal-context.d.ts +26 -0
  4. package/decode-logs.d.ts +8 -0
  5. package/errors.d.ts +5 -0
  6. package/impl/account.d.ts +31 -0
  7. package/impl/acct-params.d.ts +5 -0
  8. package/impl/app-params.d.ts +3 -0
  9. package/impl/application.d.ts +24 -0
  10. package/impl/asset-holding.d.ts +2 -0
  11. package/impl/asset-params.d.ts +3 -0
  12. package/impl/asset.d.ts +23 -0
  13. package/impl/crypto.d.ts +12 -0
  14. package/impl/global.d.ts +18 -0
  15. package/impl/gtxn.d.ts +2 -0
  16. package/impl/index.d.ts +11 -0
  17. package/impl/inner-transactions.d.ts +51 -0
  18. package/impl/itxn.d.ts +8 -0
  19. package/impl/pure.d.ts +32 -0
  20. package/impl/scratch.d.ts +2 -0
  21. package/impl/transactions.d.ts +139 -0
  22. package/impl/txn.d.ts +3 -0
  23. package/index.d.ts +1 -0
  24. package/index.mjs +3687 -0
  25. package/index.mjs.map +1 -0
  26. package/package.json +41 -0
  27. package/runtime-helpers-B6YRp95T.js +460 -0
  28. package/runtime-helpers-B6YRp95T.js.map +1 -0
  29. package/runtime-helpers.d.ts +9 -0
  30. package/runtime-helpers.mjs +4 -0
  31. package/runtime-helpers.mjs.map +1 -0
  32. package/subcontexts/contract-context.d.ts +10 -0
  33. package/subcontexts/ledger-context.d.ts +27 -0
  34. package/subcontexts/transaction-context.d.ts +57 -0
  35. package/test-execution-context.d.ts +45 -0
  36. package/test-transformer/errors.d.ts +3 -0
  37. package/test-transformer/helpers.d.ts +2 -0
  38. package/test-transformer/index.d.ts +6 -0
  39. package/test-transformer/node-factory.d.ts +10 -0
  40. package/test-transformer/supported-binary-op-string.d.ts +3 -0
  41. package/test-transformer/visitors.d.ts +11 -0
  42. package/test-transformer.mjs +297 -0
  43. package/test-transformer.mjs.map +1 -0
  44. package/typescript-helpers.d.ts +9 -0
  45. package/util.d.ts +26 -0
  46. package/value-generators/avm.d.ts +23 -0
  47. package/value-generators/index.d.ts +6 -0
  48. package/value-generators/txn.d.ts +10 -0
@@ -0,0 +1,16 @@
1
+ import { Contract } from '@algorandfoundation/algorand-typescript';
2
+ import { AbiMethodConfig, BareMethodConfig, CreateOptions, OnCompleteActionStr } from '@algorandfoundation/algorand-typescript/arc4';
3
+ export interface AbiMetadata {
4
+ methodName: string;
5
+ methodSelector: string;
6
+ argTypes: string[];
7
+ returnType: string;
8
+ onCreate?: CreateOptions;
9
+ allowActions?: OnCompleteActionStr[];
10
+ }
11
+ export declare const attachAbiMetadata: (contract: {
12
+ new (): Contract;
13
+ }, methodName: string, metadata: AbiMetadata) => void;
14
+ export declare const captureMethodConfig: <T extends Contract>(contract: T, methodName: string, config?: AbiMethodConfig<T> | BareMethodConfig) => void;
15
+ export declare const hasAbiMetadata: <T extends Contract>(contract: T) => boolean;
16
+ export declare const getAbiMetadata: <T extends Contract>(contract: T, methodName: string) => AbiMetadata;
package/constants.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export declare const UINT64_SIZE = 64;
2
+ export declare const UINT512_SIZE = 512;
3
+ export declare const MAX_UINT8: number;
4
+ export declare const MAX_UINT64: bigint;
5
+ export declare const MAX_UINT512: bigint;
6
+ export declare const MAX_BYTES_SIZE = 4096;
7
+ export declare const MAX_ITEMS_IN_LOG = 32;
8
+ export declare const BITS_IN_BYTE = 8;
9
+ export declare const DEFAULT_ACCOUNT_MIN_BALANCE = 100000;
10
+ export declare const DEFAULT_MAX_TXN_LIFE = 1000;
11
+ export declare const DEFAULT_ASSET_CREATE_MIN_BALANCE = 1000000;
12
+ export declare const DEFAULT_ASSET_OPT_IN_MIN_BALANCE = 10000;
13
+ export declare const DEFAULT_GLOBAL_GENESIS_HASH: import("@algorandfoundation/algorand-typescript").bytes;
14
+ export declare const ZERO_ADDRESS: import("@algorandfoundation/algorand-typescript").bytes;
15
+ /**
16
+ "\x09" # pragma version 9
17
+ "\x81\x01" # pushint 1
18
+ */
19
+ export declare const ALWAYS_APPROVE_TEAL_PROGRAM: import("@algorandfoundation/algorand-typescript").bytes;
20
+ export declare const LOGIC_DATA_PREFIX: import("@algorandfoundation/algorand-typescript").bytes;
21
+ export declare const MIN_TXN_FEE = 1000;
@@ -0,0 +1,26 @@
1
+ import { internal } from '@algorandfoundation/algorand-typescript';
2
+ import { AccountData } from '../impl/account';
3
+ import { ApplicationData } from '../impl/application';
4
+ import { AssetData } from '../impl/asset';
5
+ import { TransactionGroup } from '../subcontexts/transaction-context';
6
+ import { TestExecutionContext } from '../test-execution-context';
7
+ /**
8
+ * For accessing implementation specific functions, with a convenient single entry
9
+ * point for other modules to import Also allows for a single place to check and
10
+ * provide.
11
+ */
12
+ declare class InternalContext {
13
+ get value(): TestExecutionContext;
14
+ get defaultSender(): import("@algorandfoundation/algorand-typescript").Account;
15
+ get ledger(): import("../subcontexts/ledger-context").LedgerContext;
16
+ get txn(): import("../subcontexts/transaction-context").TransactionContext;
17
+ get contract(): import("../subcontexts/contract-context").ContractContext;
18
+ get any(): import("../value-generators").ValueGenerator;
19
+ get activeApplication(): import("@algorandfoundation/algorand-typescript").Application;
20
+ get activeGroup(): TransactionGroup;
21
+ getAccountData(accountPublicKey: internal.primitives.StubBytesCompat): AccountData;
22
+ getAssetData(id: internal.primitives.StubUint64Compat): AssetData;
23
+ getApplicationData(id: internal.primitives.StubUint64Compat): ApplicationData;
24
+ }
25
+ export declare const lazyContext: InternalContext;
26
+ export {};
@@ -0,0 +1,8 @@
1
+ export type LogDecoding = 'i' | 's' | 'b';
2
+ export type DecodedLog<T extends LogDecoding> = T extends 'i' ? bigint : T extends 's' ? string : Uint8Array;
3
+ export type DecodedLogs<T extends [...LogDecoding[]]> = {
4
+ [Index in keyof T]: DecodedLog<T[Index]>;
5
+ } & {
6
+ length: T['length'];
7
+ };
8
+ export declare function decodeLogs<const T extends [...LogDecoding[]]>(logs: Uint8Array[], decoding: T): DecodedLogs<T>;
package/errors.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare class NotImplementedError extends Error {
2
+ constructor(feature: string);
3
+ }
4
+ export declare function notImplementedError(feature: string): never;
5
+ export declare function testInvariant(condition: unknown, message: string): asserts condition;
@@ -0,0 +1,31 @@
1
+ import { Account, Application, Asset, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ import { Mutable } from '../typescript-helpers';
3
+ export declare class AssetHolding {
4
+ balance: uint64;
5
+ frozen: boolean;
6
+ constructor(balance: internal.primitives.StubUint64Compat, frozen: boolean);
7
+ }
8
+ export declare class AccountData {
9
+ optedAssets: Map<bigint, AssetHolding>;
10
+ optedApplications: Map<bigint, Application>;
11
+ account: Mutable<Omit<Account, 'bytes' | 'isOptedIn'>>;
12
+ constructor();
13
+ }
14
+ export declare class AccountCls implements Account {
15
+ readonly bytes: bytes;
16
+ constructor(address?: internal.primitives.StubBytesCompat);
17
+ private get data();
18
+ get balance(): uint64;
19
+ get minBalance(): uint64;
20
+ get authAddress(): Account;
21
+ get totalNumUint(): uint64;
22
+ get totalNumByteSlice(): uint64;
23
+ get totalExtraAppPages(): uint64;
24
+ get totalAppsCreated(): uint64;
25
+ get totalAppsOptedIn(): uint64;
26
+ get totalAssetsCreated(): uint64;
27
+ get totalAssets(): uint64;
28
+ get totalBoxes(): uint64;
29
+ get totalBoxBytes(): uint64;
30
+ isOptedIn(assetOrApp: Asset | Application): boolean;
31
+ }
@@ -0,0 +1,5 @@
1
+ import { Account, internal, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ export declare const getAccount: (acct: Account | internal.primitives.StubUint64Compat) => Account;
3
+ export declare const balance: (a: Account | internal.primitives.StubUint64Compat) => uint64;
4
+ export declare const minBalance: (a: Account | internal.primitives.StubUint64Compat) => uint64;
5
+ export declare const AcctParams: internal.opTypes.AcctParamsType;
@@ -0,0 +1,3 @@
1
+ import { Application, internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const getApp: (app: Application | internal.primitives.StubUint64Compat) => Application | undefined;
3
+ export declare const AppParams: internal.opTypes.AppParamsType;
@@ -0,0 +1,24 @@
1
+ import { Account, Application, bytes, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ import { Mutable } from '../typescript-helpers';
3
+ export declare class ApplicationData {
4
+ application: Mutable<Omit<Application, 'id' | 'address'>> & {
5
+ appLogs: bytes[];
6
+ };
7
+ isCreating: boolean;
8
+ get appLogs(): bytes[];
9
+ constructor();
10
+ }
11
+ export declare class ApplicationCls implements Application {
12
+ readonly id: uint64;
13
+ constructor(id?: uint64);
14
+ private get data();
15
+ get approvalProgram(): bytes;
16
+ get clearStateProgram(): bytes;
17
+ get globalNumUint(): uint64;
18
+ get globalNumBytes(): uint64;
19
+ get localNumUint(): uint64;
20
+ get localNumBytes(): uint64;
21
+ get extraProgramPages(): uint64;
22
+ get creator(): Account;
23
+ get address(): Account;
24
+ }
@@ -0,0 +1,2 @@
1
+ import { internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const AssetHolding: internal.opTypes.AssetHoldingType;
@@ -0,0 +1,3 @@
1
+ import { Asset, internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const getAsset: (asset: Asset | internal.primitives.StubUint64Compat) => Asset | undefined;
3
+ export declare const AssetParams: internal.opTypes.AssetParamsType;
@@ -0,0 +1,23 @@
1
+ import { Account, Asset, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ import { Mutable } from '../typescript-helpers';
3
+ export type AssetData = Mutable<Omit<Asset, 'id' | 'balance' | 'frozen'>>;
4
+ export declare class AssetCls implements Asset {
5
+ readonly id: uint64;
6
+ constructor(id?: internal.primitives.StubUint64Compat);
7
+ private get data();
8
+ get total(): uint64;
9
+ get decimals(): uint64;
10
+ get defaultFrozen(): boolean;
11
+ get unitName(): bytes;
12
+ get name(): bytes;
13
+ get url(): bytes;
14
+ get metadataHash(): bytes;
15
+ get manager(): Account;
16
+ get reserve(): Account;
17
+ get freeze(): Account;
18
+ get clawback(): Account;
19
+ get creator(): Account;
20
+ balance(account: Account): uint64;
21
+ frozen(account: Account): boolean;
22
+ private getAssetHolding;
23
+ }
@@ -0,0 +1,12 @@
1
+ import { bytes, internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const sha256: (a: internal.primitives.StubBytesCompat) => bytes;
3
+ export declare const sha3_256: (a: internal.primitives.StubBytesCompat) => bytes;
4
+ export declare const keccak256: (a: internal.primitives.StubBytesCompat) => bytes;
5
+ export declare const sha512_256: (a: internal.primitives.StubBytesCompat) => bytes;
6
+ export declare const ed25519verifyBare: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat, c: internal.primitives.StubBytesCompat) => boolean;
7
+ export declare const ed25519verify: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat, c: internal.primitives.StubBytesCompat) => boolean;
8
+ export declare const ecdsaVerify: (v: internal.opTypes.Ecdsa, a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat, c: internal.primitives.StubBytesCompat, d: internal.primitives.StubBytesCompat, e: internal.primitives.StubBytesCompat) => boolean;
9
+ export declare const ecdsaPkRecover: (v: internal.opTypes.Ecdsa, a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubBytesCompat, d: internal.primitives.StubBytesCompat) => readonly [bytes, bytes];
10
+ export declare const ecdsaPkDecompress: (v: internal.opTypes.Ecdsa, a: internal.primitives.StubBytesCompat) => readonly [bytes, bytes];
11
+ export declare const vrfVerify: (_s: internal.opTypes.VrfVerify, _a: internal.primitives.StubBytesCompat, _b: internal.primitives.StubBytesCompat, _c: internal.primitives.StubBytesCompat) => readonly [bytes, boolean];
12
+ export declare const EllipticCurve: internal.opTypes.EllipticCurveType;
@@ -0,0 +1,18 @@
1
+ import { Account, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ export declare class GlobalData {
3
+ minTxnFee: uint64;
4
+ minBalance: uint64;
5
+ maxTxnLife: uint64;
6
+ zeroAddress: Account;
7
+ logicSigVersion?: uint64;
8
+ round?: uint64;
9
+ latestTimestamp?: uint64;
10
+ groupId?: bytes;
11
+ callerApplicationId: uint64;
12
+ assetCreateMinBalance: uint64;
13
+ assetOptInMinBalance: uint64;
14
+ genesisHash: bytes;
15
+ opcodeBudget?: uint64;
16
+ constructor();
17
+ }
18
+ export declare const Global: internal.opTypes.GlobalType;
package/impl/gtxn.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const GTxn: internal.opTypes.GTxnType;
@@ -0,0 +1,11 @@
1
+ export { AcctParams, balance, minBalance } from './acct-params';
2
+ export { AppParams } from './app-params';
3
+ export { AssetHolding } from './asset-holding';
4
+ export { AssetParams } from './asset-params';
5
+ export * from './crypto';
6
+ export { Global } from './global';
7
+ export { GTxn } from './gtxn';
8
+ export * from './pure';
9
+ export { Txn, gaid } from './txn';
10
+ export { GITxn, ITxn, ITxnCreate } from './itxn';
11
+ export { Scratch } from './scratch';
@@ -0,0 +1,51 @@
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
+ import { Mutable } from '../typescript-helpers';
5
+ export declare class PaymentInnerTxn extends PaymentTransaction implements itxn.PaymentInnerTxn {
6
+ readonly isItxn?: true;
7
+ static create(fields: itxn.PaymentFields): PaymentInnerTxn;
8
+ constructor(fields: itxn.PaymentFields);
9
+ }
10
+ export declare class KeyRegistrationInnerTxn extends KeyRegistrationTransaction implements itxn.KeyRegistrationInnerTxn {
11
+ readonly isItxn?: true;
12
+ static create(fields: itxn.KeyRegistrationFields): KeyRegistrationInnerTxn;
13
+ constructor(fields: itxn.KeyRegistrationFields);
14
+ }
15
+ export declare class AssetConfigInnerTxn extends AssetConfigTransaction implements itxn.AssetConfigInnerTxn {
16
+ readonly isItxn?: true;
17
+ static create(fields: itxn.AssetConfigFields): AssetConfigInnerTxn;
18
+ constructor(fields: itxn.AssetConfigFields);
19
+ }
20
+ export declare class AssetTransferInnerTxn extends AssetTransferTransaction implements itxn.AssetTransferInnerTxn {
21
+ readonly isItxn?: true;
22
+ static create(fields: Partial<itxn.AssetTransferFields>): AssetTransferInnerTxn;
23
+ constructor(fields: itxn.AssetTransferFields);
24
+ }
25
+ export declare class AssetFreezeInnerTxn extends AssetFreezeTransaction implements itxn.AssetFreezeInnerTxn {
26
+ readonly isItxn?: true;
27
+ static create(fields: Partial<itxn.AssetFreezeFields>): AssetFreezeInnerTxn;
28
+ constructor(fields: itxn.AssetFreezeFields);
29
+ }
30
+ export declare class ApplicationInnerTxn extends ApplicationTransaction implements itxn.ApplicationInnerTxn {
31
+ readonly isItxn?: true;
32
+ static create(fields: Omit<itxn.ApplicationCallFields, 'onCompletion'> & {
33
+ onCompletion?: arc4.OnCompleteAction | uint64 | arc4.OnCompleteActionStr;
34
+ }): ApplicationInnerTxn;
35
+ constructor(fields: Mutable<itxn.ApplicationCallFields>);
36
+ }
37
+ export declare const createInnerTxn: <TFields extends InnerTxnFields>(fields: TFields) => PaymentInnerTxn | KeyRegistrationInnerTxn | AssetTransferInnerTxn | ApplicationInnerTxn | AssetConfigInnerTxn | AssetFreezeInnerTxn;
38
+ export declare function submitGroup<TFields extends itxn.InnerTxnList>(...transactionFields: TFields): itxn.TxnFor<TFields>;
39
+ export declare function payment(fields: itxn.PaymentFields): itxn.PaymentItxnParams;
40
+ export declare function keyRegistration(fields: itxn.KeyRegistrationFields): itxn.KeyRegistrationItxnParams;
41
+ export declare function assetConfig(fields: itxn.AssetConfigFields): itxn.AssetConfigItxnParams;
42
+ export declare function assetTransfer(fields: itxn.AssetTransferFields): itxn.AssetTransferItxnParams;
43
+ export declare function assetFreeze(fields: itxn.AssetFreezeFields): itxn.AssetFreezeItxnParams;
44
+ export declare function applicationCall(fields: itxn.ApplicationCallFields): itxn.ApplicationCallItxnParams;
45
+ export declare class ItxnParams<TFields extends InnerTxnFields, TTransaction extends InnerTxn> {
46
+ #private;
47
+ constructor(fields: TFields, type: TransactionType);
48
+ submit(): TTransaction;
49
+ set(p: Partial<TFields>): void;
50
+ copy(): ItxnParams<TFields, TTransaction>;
51
+ }
package/impl/itxn.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ import { internal, itxn, TransactionType } from '@algorandfoundation/algorand-typescript';
2
+ export type InnerTxn = itxn.PaymentInnerTxn | itxn.KeyRegistrationInnerTxn | itxn.AssetConfigInnerTxn | itxn.AssetTransferInnerTxn | itxn.AssetFreezeInnerTxn | itxn.ApplicationInnerTxn;
3
+ export type InnerTxnFields = (itxn.PaymentFields | itxn.KeyRegistrationFields | itxn.AssetConfigFields | itxn.AssetTransferFields | itxn.AssetFreezeFields | itxn.ApplicationCallFields) & {
4
+ type?: TransactionType;
5
+ };
6
+ export declare const GITxn: internal.opTypes.GITxnType;
7
+ export declare const ITxn: internal.opTypes.ITxnType;
8
+ export declare const ITxnCreate: internal.opTypes.ITxnCreateType;
package/impl/pure.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import { biguint, bytes, internal, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ export declare const addw: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => readonly [uint64, uint64];
3
+ export declare const base64Decode: (e: internal.opTypes.Base64, a: internal.primitives.StubBytesCompat) => bytes;
4
+ export declare const bitLength: (a: internal.primitives.StubUint64Compat | internal.primitives.StubBytesCompat) => uint64;
5
+ export declare const bsqrt: (a: internal.primitives.StubBigUintCompat) => biguint;
6
+ export declare const btoi: (a: internal.primitives.StubBytesCompat) => uint64;
7
+ export declare const bzero: (a: internal.primitives.StubUint64Compat) => bytes;
8
+ export declare const concat: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubBytesCompat) => bytes;
9
+ export declare const divmodw: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat, d: internal.primitives.StubUint64Compat) => readonly [uint64, uint64, uint64, uint64];
10
+ export declare const divw: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat) => uint64;
11
+ export declare const exp: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => uint64;
12
+ export declare const expw: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => readonly [uint64, uint64];
13
+ export declare const extract: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat) => bytes;
14
+ export declare const extractUint16: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat) => uint64;
15
+ export declare const extractUint32: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat) => uint64;
16
+ export declare const extractUint64: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat) => uint64;
17
+ export declare const getBit: (a: internal.primitives.StubUint64Compat | internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat) => uint64;
18
+ export declare const getByte: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat) => uint64;
19
+ export declare const itob: (a: internal.primitives.StubUint64Compat) => bytes;
20
+ export declare const mulw: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => readonly [uint64, uint64];
21
+ export declare const replace: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubBytesCompat) => bytes;
22
+ 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);
23
+ export declare const select: selectType;
24
+ type SetBitType = ((target: internal.primitives.StubBytesCompat, n: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat) => bytes) & ((target: internal.primitives.StubUint64Compat, n: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat) => uint64);
25
+ export declare const setBit: SetBitType;
26
+ export declare const setByte: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat) => bytes;
27
+ export declare const shl: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => uint64;
28
+ export declare const shr: (a: internal.primitives.StubUint64Compat, b: internal.primitives.StubUint64Compat) => uint64;
29
+ export declare const sqrt: (a: internal.primitives.StubUint64Compat) => uint64;
30
+ export declare const substring: (a: internal.primitives.StubBytesCompat, b: internal.primitives.StubUint64Compat, c: internal.primitives.StubUint64Compat) => bytes;
31
+ export declare const JsonRef: internal.opTypes.JsonRefType;
32
+ export {};
@@ -0,0 +1,2 @@
1
+ import { internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const Scratch: internal.opTypes.ScratchType;
@@ -0,0 +1,139 @@
1
+ import { Account, Application, arc4, Asset, bytes, gtxn, internal, TransactionType, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ import { Mutable, ObjectKeys } from '../typescript-helpers';
3
+ declare const baseDefaultFields: () => {
4
+ sender: Account;
5
+ fee: uint64;
6
+ firstValid: uint64;
7
+ firstValidTime: uint64;
8
+ lastValid: uint64;
9
+ note: bytes;
10
+ lease: bytes;
11
+ groupIndex: uint64;
12
+ txnId: bytes;
13
+ rekeyTo: Account;
14
+ };
15
+ export type TxnFields<TTxn> = Partial<Mutable<Pick<TTxn, ObjectKeys<TTxn>>>>;
16
+ declare abstract class TransactionBase {
17
+ protected constructor(fields: Partial<ReturnType<typeof baseDefaultFields>>);
18
+ readonly sender: Account;
19
+ readonly fee: uint64;
20
+ readonly firstValid: uint64;
21
+ readonly firstValidTime: uint64;
22
+ readonly lastValid: uint64;
23
+ readonly note: bytes;
24
+ readonly lease: bytes;
25
+ readonly groupIndex: uint64;
26
+ readonly txnId: bytes;
27
+ readonly rekeyTo: Account;
28
+ readonly scratchSpace: Array<bytes | uint64>;
29
+ setScratchSlot(index: internal.primitives.StubUint64Compat, value: internal.primitives.StubBytesCompat | internal.primitives.StubUint64Compat): void;
30
+ getScratchSlot(index: internal.primitives.StubUint64Compat): bytes | uint64;
31
+ }
32
+ export declare class PaymentTransaction extends TransactionBase implements gtxn.PaymentTxn {
33
+ static create(fields: TxnFields<gtxn.PaymentTxn>): PaymentTransaction;
34
+ protected constructor(fields: TxnFields<gtxn.PaymentTxn>);
35
+ readonly receiver: Account;
36
+ readonly amount: uint64;
37
+ readonly closeRemainderTo: Account;
38
+ readonly type: TransactionType.Payment;
39
+ readonly typeBytes: bytes;
40
+ }
41
+ export declare class KeyRegistrationTransaction extends TransactionBase implements gtxn.KeyRegistrationTxn {
42
+ static create(fields: TxnFields<gtxn.KeyRegistrationTxn>): KeyRegistrationTransaction;
43
+ protected constructor(fields: TxnFields<gtxn.KeyRegistrationTxn>);
44
+ readonly voteKey: bytes;
45
+ readonly selectionKey: bytes;
46
+ readonly voteFirst: uint64;
47
+ readonly voteLast: uint64;
48
+ readonly voteKeyDilution: uint64;
49
+ readonly nonparticipation: boolean;
50
+ readonly stateProofKey: bytes;
51
+ readonly type: TransactionType.KeyRegistration;
52
+ readonly typeBytes: bytes;
53
+ }
54
+ export declare class AssetConfigTransaction extends TransactionBase implements gtxn.AssetConfigTxn {
55
+ static create(fields: TxnFields<gtxn.AssetConfigTxn>): AssetConfigTransaction;
56
+ protected constructor(fields: TxnFields<gtxn.AssetConfigTxn>);
57
+ readonly configAsset: Asset;
58
+ readonly total: uint64;
59
+ readonly decimals: uint64;
60
+ readonly defaultFrozen: boolean;
61
+ readonly unitName: bytes;
62
+ readonly assetName: bytes;
63
+ readonly url: bytes;
64
+ readonly metadataHash: bytes;
65
+ readonly manager: Account;
66
+ readonly reserve: Account;
67
+ readonly freeze: Account;
68
+ readonly clawback: Account;
69
+ readonly createdAsset: Asset;
70
+ readonly type: TransactionType.AssetConfig;
71
+ readonly typeBytes: bytes;
72
+ }
73
+ export declare class AssetTransferTransaction extends TransactionBase implements gtxn.AssetTransferTxn {
74
+ static create(fields: TxnFields<gtxn.AssetTransferTxn>): AssetTransferTransaction;
75
+ protected constructor(fields: TxnFields<gtxn.AssetTransferTxn>);
76
+ readonly xferAsset: Asset;
77
+ readonly assetAmount: uint64;
78
+ readonly assetSender: Account;
79
+ readonly assetReceiver: Account;
80
+ readonly assetCloseTo: Account;
81
+ readonly type: TransactionType.AssetTransfer;
82
+ readonly typeBytes: bytes;
83
+ }
84
+ export declare class AssetFreezeTransaction extends TransactionBase implements gtxn.AssetFreezeTxn {
85
+ static create(fields: TxnFields<gtxn.AssetFreezeTxn>): AssetFreezeTransaction;
86
+ protected constructor(fields: TxnFields<gtxn.AssetFreezeTxn>);
87
+ readonly freezeAsset: Asset;
88
+ readonly freezeAccount: Account;
89
+ readonly frozen: boolean;
90
+ readonly type: TransactionType.AssetFreeze;
91
+ readonly typeBytes: bytes;
92
+ }
93
+ export type ApplicationTransactionFields = TxnFields<gtxn.ApplicationTxn> & Partial<{
94
+ appArgs: Array<bytes>;
95
+ accounts: Array<Account>;
96
+ assets: Array<Asset>;
97
+ apps: Array<Application>;
98
+ approvalProgramPages: Array<bytes>;
99
+ clearStateProgramPages: Array<bytes>;
100
+ appLogs: Array<bytes>;
101
+ scratchSpace: Array<bytes | uint64>;
102
+ }>;
103
+ export declare class ApplicationTransaction extends TransactionBase implements gtxn.ApplicationTxn {
104
+ #private;
105
+ static create(fields: ApplicationTransactionFields): ApplicationTransaction;
106
+ protected constructor(fields: ApplicationTransactionFields);
107
+ readonly appId: Application;
108
+ readonly onCompletion: arc4.OnCompleteActionStr;
109
+ readonly globalNumUint: uint64;
110
+ readonly globalNumBytes: uint64;
111
+ readonly localNumUint: uint64;
112
+ readonly localNumBytes: uint64;
113
+ readonly extraProgramPages: uint64;
114
+ readonly createdApp: Application;
115
+ get approvalProgram(): bytes;
116
+ get clearStateProgram(): bytes;
117
+ get numAppArgs(): uint64;
118
+ get numAccounts(): uint64;
119
+ get numAssets(): uint64;
120
+ get numApps(): uint64;
121
+ get numApprovalProgramPages(): uint64;
122
+ get numClearStateProgramPages(): uint64;
123
+ get numLogs(): uint64;
124
+ get lastLog(): bytes;
125
+ appArgs(index: internal.primitives.StubUint64Compat): bytes;
126
+ accounts(index: internal.primitives.StubUint64Compat): Account;
127
+ assets(index: internal.primitives.StubUint64Compat): Asset;
128
+ apps(index: internal.primitives.StubUint64Compat): Application;
129
+ approvalProgramPages(index: internal.primitives.StubUint64Compat): bytes;
130
+ clearStateProgramPages(index: internal.primitives.StubUint64Compat): bytes;
131
+ logs(index: internal.primitives.StubUint64Compat): bytes;
132
+ readonly type: TransactionType.ApplicationCall;
133
+ readonly typeBytes: bytes;
134
+ get appLogs(): bytes[];
135
+ appendLog(value: internal.primitives.StubBytesCompat): void;
136
+ }
137
+ export type Transaction = PaymentTransaction | KeyRegistrationTransaction | AssetConfigTransaction | AssetTransferTransaction | AssetFreezeTransaction | ApplicationTransaction;
138
+ export type AllTransactionFields = TxnFields<gtxn.PaymentTxn> & TxnFields<gtxn.KeyRegistrationTxn> & TxnFields<gtxn.AssetConfigTxn> & TxnFields<gtxn.AssetTransferTxn> & TxnFields<gtxn.AssetFreezeTxn> & ApplicationTransactionFields;
139
+ export {};
package/impl/txn.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { internal, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ export declare const gaid: (a: internal.primitives.StubUint64Compat) => uint64;
3
+ export declare const Txn: internal.opTypes.TxnType;
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { TestExecutionContext } from './test-execution-context';