@algorandfoundation/algorand-typescript-testing 1.0.0-alpha.4 → 1.0.0-alpha.6

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.
@@ -1,4 +1,4 @@
1
- import { Account } from '@algorandfoundation/algorand-typescript';
1
+ import { Account, internal } from '@algorandfoundation/algorand-typescript';
2
2
  import { DeliberateAny } from '../typescript-helpers';
3
3
  export declare abstract class CustomKeyMap<TKey, TValue> implements Map<TKey, TValue> {
4
4
  #private;
@@ -7,6 +7,7 @@ export declare abstract class CustomKeyMap<TKey, TValue> implements Map<TKey, TV
7
7
  delete(key: TKey): boolean;
8
8
  forEach(callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void, thisArg?: DeliberateAny): void;
9
9
  get(key: TKey): TValue | undefined;
10
+ getOrFail(key: TKey): TValue;
10
11
  has(key: TKey): boolean;
11
12
  set(key: TKey, value: TValue): this;
12
13
  get size(): number;
@@ -20,3 +21,9 @@ export declare class AccountMap<TValue> extends CustomKeyMap<Account, TValue> {
20
21
  constructor();
21
22
  private static getAddressStrFromAccount;
22
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/impl/account.d.ts CHANGED
@@ -1,4 +1,5 @@
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';
3
4
  import { BytesBackedCls } from './base';
4
5
  export declare class AssetHolding {
@@ -7,8 +8,8 @@ export declare class AssetHolding {
7
8
  constructor(balance: internal.primitives.StubUint64Compat, frozen: boolean);
8
9
  }
9
10
  export declare class AccountData {
10
- optedAssets: Map<bigint, AssetHolding>;
11
- optedApplications: Map<bigint, Application>;
11
+ optedAssets: Uint64Map<AssetHolding>;
12
+ optedApplications: Uint64Map<Application>;
12
13
  account: Mutable<Omit<Account, 'bytes' | 'isOptedIn'>>;
13
14
  constructor();
14
15
  }
@@ -0,0 +1,2 @@
1
+ import { internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const AppGlobal: internal.opTypes.AppGlobalType;
@@ -0,0 +1,2 @@
1
+ import { internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const AppLocal: internal.opTypes.AppLocalType;
@@ -1,9 +1,13 @@
1
- import { Account, Application, bytes, uint64 } from '@algorandfoundation/algorand-typescript';
1
+ import { Account, Application, bytes, LocalState, uint64 } from '@algorandfoundation/algorand-typescript';
2
+ import { BytesMap } from '../collections/custom-key-map';
2
3
  import { Mutable } from '../typescript-helpers';
3
4
  import { Uint64BackedCls } from './base';
5
+ import { GlobalStateCls } from './state';
4
6
  export declare class ApplicationData {
5
7
  application: Mutable<Omit<Application, 'id' | 'address'>> & {
6
8
  appLogs: bytes[];
9
+ globalStates: BytesMap<GlobalStateCls<unknown>>;
10
+ localStates: BytesMap<LocalState<unknown>>;
7
11
  };
8
12
  isCreating: boolean;
9
13
  get appLogs(): bytes[];
@@ -0,0 +1,2 @@
1
+ import { internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const Block: internal.opTypes.BlockType;
package/impl/index.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  export { AcctParams, balance, minBalance } from './acct-params';
2
+ export { AppGlobal } from './app-global';
3
+ export { AppLocal } from './app-local';
2
4
  export { AppParams } from './app-params';
3
5
  export { AssetHolding } from './asset-holding';
4
6
  export { AssetParams } from './asset-params';
5
7
  export * from './crypto';
6
8
  export { Global } from './global';
7
9
  export { GTxn } from './gtxn';
10
+ export { GITxn, ITxn, ITxnCreate } from './itxn';
8
11
  export * from './pure';
12
+ export { Scratch, gloadBytes, gloadUint64 } from './scratch';
13
+ export { Block } from './block';
9
14
  export { Txn, gaid } from './txn';
10
- export { GITxn, ITxn, ITxnCreate } from './itxn';
11
- export { Scratch } from './scratch';
package/impl/scratch.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  import { internal } from '@algorandfoundation/algorand-typescript';
2
+ export declare const gloadUint64: internal.opTypes.GloadUint64Type;
3
+ export declare const gloadBytes: internal.opTypes.GloadBytesType;
2
4
  export declare const Scratch: internal.opTypes.ScratchType;
@@ -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>;
@@ -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: Array<bytes | uint64>;
101
+ scratchSpace: Record<number, bytes | uint64>;
102
102
  }>;
103
103
  export declare class ApplicationTransaction extends TransactionBase implements gtxn.ApplicationTxn {
104
104
  #private;