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

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 (58) hide show
  1. package/abi-metadata.d.ts +16 -0
  2. package/collections/custom-key-map.d.ts +29 -0
  3. package/constants.d.ts +27 -0
  4. package/context-helpers/internal-context.d.ts +26 -0
  5. package/decode-logs.d.ts +9 -0
  6. package/encoders.d.ts +9 -0
  7. package/errors.d.ts +5 -0
  8. package/impl/account.d.ts +32 -0
  9. package/impl/acct-params.d.ts +5 -0
  10. package/impl/app-global.d.ts +2 -0
  11. package/impl/app-local.d.ts +2 -0
  12. package/impl/app-params.d.ts +3 -0
  13. package/impl/application.d.ts +30 -0
  14. package/impl/asset-holding.d.ts +2 -0
  15. package/impl/asset-params.d.ts +3 -0
  16. package/impl/asset.d.ts +24 -0
  17. package/impl/base.d.ts +18 -0
  18. package/impl/block.d.ts +2 -0
  19. package/impl/box.d.ts +2 -0
  20. package/impl/crypto.d.ts +12 -0
  21. package/impl/encoded-types.d.ts +165 -0
  22. package/impl/global.d.ts +18 -0
  23. package/impl/gtxn.d.ts +2 -0
  24. package/impl/index.d.ts +15 -0
  25. package/impl/inner-transactions.d.ts +51 -0
  26. package/impl/itxn.d.ts +8 -0
  27. package/impl/pure.d.ts +32 -0
  28. package/impl/scratch.d.ts +4 -0
  29. package/impl/state.d.ts +103 -0
  30. package/impl/transactions.d.ts +140 -0
  31. package/impl/txn.d.ts +3 -0
  32. package/index.d.ts +1 -0
  33. package/index.mjs +4563 -0
  34. package/index.mjs.map +1 -0
  35. package/package.json +45 -0
  36. package/runtime-helpers-DlIX78iw.js +1426 -0
  37. package/runtime-helpers-DlIX78iw.js.map +1 -0
  38. package/runtime-helpers.d.ts +11 -0
  39. package/runtime-helpers.mjs +8 -0
  40. package/runtime-helpers.mjs.map +1 -0
  41. package/set-up.d.ts +11 -0
  42. package/subcontexts/contract-context.d.ts +9 -0
  43. package/subcontexts/ledger-context.d.ts +45 -0
  44. package/subcontexts/transaction-context.d.ts +67 -0
  45. package/test-execution-context.d.ts +53 -0
  46. package/test-transformer/errors.d.ts +3 -0
  47. package/test-transformer/helpers.d.ts +3 -0
  48. package/test-transformer/index.d.ts +6 -0
  49. package/test-transformer/index.mjs +458 -0
  50. package/test-transformer/index.mjs.map +1 -0
  51. package/test-transformer/node-factory.d.ts +14 -0
  52. package/test-transformer/supported-binary-op-string.d.ts +4 -0
  53. package/test-transformer/visitors.d.ts +11 -0
  54. package/typescript-helpers.d.ts +15 -0
  55. package/util.d.ts +29 -0
  56. package/value-generators/avm.d.ts +23 -0
  57. package/value-generators/index.d.ts +6 -0
  58. package/value-generators/txn.d.ts +10 -0
@@ -0,0 +1,103 @@
1
+ import { Account, BoxMap as BoxMapType, BoxRef as BoxRefType, Box as BoxType, bytes, GlobalStateOptions, GlobalState as GlobalStateType, internal, LocalState as LocalStateType, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ export declare class GlobalStateCls<ValueType> {
3
+ #private;
4
+ private readonly _type;
5
+ key: bytes | undefined;
6
+ get hasKey(): boolean;
7
+ delete: () => void;
8
+ static [Symbol.hasInstance](x: unknown): x is GlobalStateCls<unknown>;
9
+ get value(): ValueType;
10
+ set value(v: ValueType);
11
+ get hasValue(): boolean;
12
+ constructor(key?: bytes | string, value?: ValueType);
13
+ }
14
+ export declare class LocalStateCls<ValueType> {
15
+ #private;
16
+ delete: () => void;
17
+ get value(): ValueType;
18
+ set value(v: ValueType);
19
+ get hasValue(): boolean;
20
+ }
21
+ export declare class LocalStateMapCls<ValueType> {
22
+ #private;
23
+ getValue(account: Account): LocalStateCls<ValueType>;
24
+ }
25
+ export declare function GlobalState<ValueType>(options?: GlobalStateOptions<ValueType>): GlobalStateType<ValueType>;
26
+ export declare function LocalState<ValueType>(options?: {
27
+ key?: bytes | string;
28
+ }): LocalStateType<ValueType>;
29
+ export declare class BoxCls<TValue> {
30
+ #private;
31
+ private readonly _type;
32
+ static [Symbol.hasInstance](x: unknown): x is BoxCls<unknown>;
33
+ constructor(key?: internal.primitives.StubBytesCompat);
34
+ private get fromBytes();
35
+ get value(): TValue;
36
+ set value(v: TValue);
37
+ get hasKey(): boolean;
38
+ get key(): bytes;
39
+ set key(key: internal.primitives.StubBytesCompat);
40
+ get exists(): boolean;
41
+ get length(): uint64;
42
+ get(options: {
43
+ default: TValue;
44
+ }): TValue;
45
+ delete(): boolean;
46
+ maybe(): readonly [TValue, boolean];
47
+ }
48
+ export declare class BoxMapCls<TKey, TValue> {
49
+ #private;
50
+ private readonly _type;
51
+ static [Symbol.hasInstance](x: unknown): x is BoxMapCls<unknown, unknown>;
52
+ private get fromBytes();
53
+ constructor(keyPrefix?: internal.primitives.StubBytesCompat);
54
+ get hasKeyPrefix(): boolean;
55
+ get keyPrefix(): bytes;
56
+ set keyPrefix(keyPrefix: internal.primitives.StubBytesCompat);
57
+ get(key: TKey, options?: {
58
+ default: TValue;
59
+ }): TValue;
60
+ set(key: TKey, value: TValue): void;
61
+ delete(key: TKey): boolean;
62
+ has(key: TKey): boolean;
63
+ maybe(key: TKey): readonly [TValue, boolean];
64
+ length(key: TKey): uint64;
65
+ private getFullKey;
66
+ }
67
+ export declare class BoxRefCls {
68
+ #private;
69
+ private readonly _type;
70
+ static [Symbol.hasInstance](x: unknown): x is BoxRefCls;
71
+ constructor(key?: internal.primitives.StubBytesCompat);
72
+ get hasKey(): boolean;
73
+ get key(): bytes;
74
+ set key(key: internal.primitives.StubBytesCompat);
75
+ get value(): bytes;
76
+ set value(v: internal.primitives.StubBytesCompat);
77
+ get exists(): boolean;
78
+ create(options: {
79
+ size: internal.primitives.StubUint64Compat;
80
+ }): boolean;
81
+ get(options: {
82
+ default: internal.primitives.StubBytesCompat;
83
+ }): bytes;
84
+ put(value: internal.primitives.StubBytesCompat): void;
85
+ splice(start: internal.primitives.StubUint64Compat, length: internal.primitives.StubUint64Compat, value: internal.primitives.StubBytesCompat): void;
86
+ replace(start: internal.primitives.StubUint64Compat, value: internal.primitives.StubBytesCompat): void;
87
+ extract(start: internal.primitives.StubUint64Compat, length: internal.primitives.StubUint64Compat): bytes;
88
+ delete(): boolean;
89
+ resize(newSize: uint64): void;
90
+ maybe(): readonly [bytes, boolean];
91
+ get length(): uint64;
92
+ private get backingValue();
93
+ private set backingValue(value);
94
+ }
95
+ export declare function Box<TValue>(options?: {
96
+ key: bytes | string;
97
+ }): BoxType<TValue>;
98
+ export declare function BoxMap<TKey, TValue>(options?: {
99
+ keyPrefix: bytes | string;
100
+ }): BoxMapType<TKey, TValue>;
101
+ export declare function BoxRef(options?: {
102
+ key: bytes | string;
103
+ }): BoxRefType;
@@ -0,0 +1,140 @@
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: Record<number, 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
+ logArc4ReturnValue(value: unknown): void;
137
+ }
138
+ export type Transaction = PaymentTransaction | KeyRegistrationTransaction | AssetConfigTransaction | AssetTransferTransaction | AssetFreezeTransaction | ApplicationTransaction;
139
+ export type AllTransactionFields = TxnFields<gtxn.PaymentTxn> & TxnFields<gtxn.KeyRegistrationTxn> & TxnFields<gtxn.AssetConfigTxn> & TxnFields<gtxn.AssetTransferTxn> & TxnFields<gtxn.AssetFreezeTxn> & ApplicationTransactionFields;
140
+ 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';