@algorandfoundation/algorand-typescript-testing 1.0.0-alpha.30 → 1.0.0-alpha.32
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/README.md +1 -1
- package/abi-metadata.d.ts +1 -23
- package/application-spy.d.ts +2 -3
- package/{arc4-BYjC4AJ-.js → arc4-NUIDD7u8.js} +11 -5
- package/arc4-NUIDD7u8.js.map +1 -0
- package/{asset-params-RLJZOv1g.js → asset-params-DUSsiQc-.js} +42 -8
- package/asset-params-DUSsiQc-.js.map +1 -0
- package/collections/custom-key-map.d.ts +3 -9
- package/constants.d.ts +1 -55
- package/context-helpers/context-manager.d.ts +1 -7
- package/context-helpers/context-util.d.ts +1 -3
- package/context-helpers/internal-context.d.ts +0 -27
- package/decode-logs.d.ts +0 -2
- package/impl/acct-params.d.ts +1 -7
- package/impl/app-global.d.ts +1 -2
- package/impl/app-local.d.ts +1 -2
- package/impl/app-params.d.ts +1 -4
- package/impl/asset-holding.d.ts +1 -2
- package/impl/asset-params.d.ts +1 -4
- package/impl/base-32.d.ts +1 -2
- package/impl/base-contract.d.ts +1 -9
- package/impl/base.d.ts +1 -19
- package/impl/block.d.ts +1 -3
- package/impl/box.d.ts +1 -2
- package/impl/c2c.d.ts +1 -16
- package/impl/clone.d.ts +1 -1
- package/impl/compiled.d.ts +1 -3
- package/impl/contract.d.ts +1 -14
- package/impl/crypto.d.ts +1 -22
- package/impl/emit.d.ts +1 -1
- package/impl/encoded-types/array-proxy.d.ts +1 -9
- package/impl/encoded-types/constants.d.ts +1 -4
- package/impl/encoded-types/encoded-types.d.ts +0 -204
- package/impl/encoded-types/helpers.d.ts +1 -28
- package/impl/encoded-types/index.d.ts +1 -3
- package/impl/encoded-types/types.d.ts +1 -21
- package/impl/encoded-types/utils.d.ts +1 -7
- package/impl/ensure-budget.d.ts +1 -3
- package/impl/global.d.ts +1 -3
- package/impl/gtxn.d.ts +1 -9
- package/impl/index.d.ts +1 -18
- package/impl/inner-transactions.d.ts +2 -27
- package/impl/itxn-compose.d.ts +1 -2
- package/impl/itxn.d.ts +1 -7
- package/impl/log.d.ts +1 -3
- package/impl/logicSigArg.d.ts +1 -3
- package/impl/match.d.ts +1 -3
- package/impl/method-selector.d.ts +1 -6
- package/impl/online-stake.d.ts +1 -2
- package/impl/primitives.d.ts +1 -234
- package/impl/pure.d.ts +0 -39
- package/impl/reference.d.ts +0 -69
- package/impl/scratch.d.ts +1 -4
- package/impl/state.d.ts +1 -85
- package/impl/template-var.d.ts +1 -1
- package/impl/transactions.d.ts +10 -31
- package/impl/txn.d.ts +1 -4
- package/impl/urange.d.ts +1 -2
- package/impl/voter-params.d.ts +1 -3
- package/index.d.ts +1 -1
- package/index.mjs +77 -45
- package/index.mjs.map +1 -1
- package/{inner-transactions-9Gd-ixgB.js → inner-transactions-DRcscck-.js} +80 -35
- package/inner-transactions-DRcscck-.js.map +1 -0
- package/internal/arc4.d.ts +1 -5
- package/internal/arc4.mjs +5 -5
- package/internal/index.d.ts +1 -39
- package/internal/index.mjs +24 -11
- package/internal/index.mjs.map +1 -1
- package/internal/op.d.ts +1 -19
- package/internal/op.mjs +4 -4
- package/{op-B3R2dQEa.js → op-CVk0hPaW.js} +211 -160
- package/op-CVk0hPaW.js.map +1 -0
- package/package.json +1 -1
- package/{program-factory-BjjbFsSQ.js → program-factory-CnCxBkRE.js} +43 -22
- package/program-factory-CnCxBkRE.js.map +1 -0
- package/{pure-4m0o0eKt.js → pure-DhEtcaWK.js} +43 -3
- package/pure-DhEtcaWK.js.map +1 -0
- package/{runtime-helpers-DoDd8Yn6.js → runtime-helpers-DupU6hSL.js} +16 -2
- package/runtime-helpers-DupU6hSL.js.map +1 -0
- package/runtime-helpers.d.ts +1 -11
- package/runtime-helpers.mjs +2 -2
- package/subcontexts/contract-context.d.ts +2 -15
- package/subcontexts/ledger-context.d.ts +16 -28
- package/subcontexts/transaction-context.d.ts +19 -32
- package/test-transformer/errors.d.ts +1 -3
- package/test-transformer/helpers.d.ts +1 -3
- package/test-transformer/jest-transformer.mjs +1 -1
- package/test-transformer/node-factory.d.ts +1 -17
- package/test-transformer/program-factory.d.ts +0 -3
- package/test-transformer/supported-binary-op-string.d.ts +1 -4
- package/test-transformer/visitors.d.ts +1 -11
- package/test-transformer/vitest-transformer.mjs +1 -1
- package/util.d.ts +23 -51
- package/{utils-DFDk1QqV.js → utils-Bkc_IVMO.js} +237 -98
- package/utils-Bkc_IVMO.js.map +1 -0
- package/value-generators/arc4.d.ts +21 -21
- package/value-generators/avm.d.ts +9 -10
- package/value-generators/index.d.ts +0 -1
- package/value-generators/txn.d.ts +2 -3
- package/arc4-BYjC4AJ-.js.map +0 -1
- package/asset-params-RLJZOv1g.js.map +0 -1
- package/inner-transactions-9Gd-ixgB.js.map +0 -1
- package/op-B3R2dQEa.js.map +0 -1
- package/program-factory-BjjbFsSQ.js.map +0 -1
- package/pure-4m0o0eKt.js.map +0 -1
- package/runtime-helpers-DoDd8Yn6.js.map +0 -1
- package/utils-DFDk1QqV.js.map +0 -1
package/README.md
CHANGED
|
@@ -287,7 +287,7 @@ To dig deeper into the capabilities of `algorand-typescript-testing`, continue w
|
|
|
287
287
|
|
|
288
288
|
#### Contents
|
|
289
289
|
|
|
290
|
-
- [Testing Guide](./docs/testing-guide
|
|
290
|
+
- [Testing Guide](./docs/testing-guide.md)
|
|
291
291
|
- [Examples](./docs/examples.md)
|
|
292
292
|
- [Coverage](./docs/coverage.md)
|
|
293
293
|
- [FQA](./docs/faq.md)
|
package/abi-metadata.d.ts
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { Contract } from './impl/contract';
|
|
3
|
-
export interface AbiMetadata {
|
|
4
|
-
methodName: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
methodSignature: string | undefined;
|
|
7
|
-
argTypes: string[];
|
|
8
|
-
returnType: string;
|
|
9
|
-
onCreate?: arc4.CreateOptions;
|
|
10
|
-
allowActions?: OnCompleteActionStr[];
|
|
11
|
-
resourceEncoding?: arc4.ResourceEncodingOptions;
|
|
12
|
-
}
|
|
13
|
-
export declare const attachAbiMetadata: (contract: {
|
|
14
|
-
new (): Contract;
|
|
15
|
-
}, methodName: string, metadata: AbiMetadata) => void;
|
|
16
|
-
export declare const getContractAbiMetadata: <T extends Contract>(contract: T | {
|
|
17
|
-
new (): T;
|
|
18
|
-
}) => Record<string, AbiMetadata>;
|
|
19
|
-
export declare const getContractMethodAbiMetadata: <T extends Contract>(contract: T | {
|
|
20
|
-
new (): T;
|
|
21
|
-
}, methodName: string) => AbiMetadata;
|
|
22
|
-
export declare const getArc4Signature: (metadata: AbiMetadata) => string;
|
|
23
|
-
export declare const getArc4Selector: (metadata: AbiMetadata) => Uint8Array;
|
|
1
|
+
export {};
|
package/application-spy.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class ApplicationSpy<TContract extends Contract = Contract> {
|
|
|
9
9
|
* The `on` property is a proxy that allows you to register callbacks for specific method signatures.
|
|
10
10
|
* It dynamically creates methods based on the contract's methods.
|
|
11
11
|
*/
|
|
12
|
-
readonly on:
|
|
12
|
+
readonly on: TypedApplicationSpyCallBacks<TContract>;
|
|
13
13
|
constructor(contract?: TContract | ConstructorFor<TContract>);
|
|
14
14
|
/**
|
|
15
15
|
* Registers a callback for a bare call (no arguments).
|
|
@@ -27,7 +27,6 @@ export declare class ApplicationSpy<TContract extends Contract = Contract> {
|
|
|
27
27
|
private _tryGetMethod;
|
|
28
28
|
private createOnProxy;
|
|
29
29
|
}
|
|
30
|
-
type
|
|
30
|
+
export type TypedApplicationSpyCallBacks<TContract> = {
|
|
31
31
|
[key in keyof TContract as key extends 'approvalProgram' | 'clearStateProgram' ? never : TContract[key] extends AnyFunction ? key extends string ? key : never : never]: (callback: AppSpyCb) => void;
|
|
32
32
|
};
|
|
33
|
-
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as arc4$1 from '@algorandfoundation/algorand-typescript/arc4';
|
|
2
2
|
import { OnCompleteAction } from '@algorandfoundation/algorand-typescript';
|
|
3
|
-
import { g as getContractMethodAbiMetadata, C as Contract, b as abimethod, c as baremethod } from './runtime-helpers-
|
|
4
|
-
import { v as lazyContext, a0 as arc4EncodedLength } from './utils-
|
|
5
|
-
import { A as ApplicationCallInnerTxnContext, m as methodSelector } from './inner-transactions-
|
|
6
|
-
import { A as Address, B as Bool, b as Byte, c as DynamicArray, D as DynamicBytes, F as FixedArray, R as ReferenceArray, d as StaticArray, e as StaticBytes, S as Str, f as Struct, T as Tuple, h as UFixed, U as Uint, i as decodeArc4, j as encodeArc4, k as interpretAsArc4 } from './asset-params-
|
|
3
|
+
import { g as getContractMethodAbiMetadata, C as Contract, b as abimethod, c as baremethod } from './runtime-helpers-DupU6hSL.js';
|
|
4
|
+
import { v as lazyContext, a0 as arc4EncodedLength } from './utils-Bkc_IVMO.js';
|
|
5
|
+
import { A as ApplicationCallInnerTxnContext, m as methodSelector } from './inner-transactions-DRcscck-.js';
|
|
6
|
+
import { A as Address, B as Bool, b as Byte, c as DynamicArray, D as DynamicBytes, F as FixedArray, R as ReferenceArray, d as StaticArray, e as StaticBytes, S as Str, f as Struct, T as Tuple, h as UFixed, U as Uint, i as decodeArc4, j as encodeArc4, k as interpretAsArc4 } from './asset-params-DUSsiQc-.js';
|
|
7
7
|
|
|
8
8
|
function _mergeNamespaces(n, m) {
|
|
9
9
|
m.forEach(function (e) {
|
|
@@ -20,6 +20,7 @@ function _mergeNamespaces(n, m) {
|
|
|
20
20
|
return Object.freeze(n);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/** @internal */
|
|
23
24
|
function compileArc4(contract, options) {
|
|
24
25
|
let app;
|
|
25
26
|
const compiledAppEntry = lazyContext.value.getCompiledAppEntry(contract);
|
|
@@ -68,6 +69,7 @@ function compileArc4(contract, options) {
|
|
|
68
69
|
localBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),
|
|
69
70
|
};
|
|
70
71
|
}
|
|
72
|
+
/** @internal */
|
|
71
73
|
const invokeAbiCall = (itxnContext) => {
|
|
72
74
|
lazyContext.value.notifyApplicationSpies(itxnContext);
|
|
73
75
|
lazyContext.txn.activeGroup.addInnerTransactionGroup(...(itxnContext.itxns ?? []), itxnContext);
|
|
@@ -81,6 +83,7 @@ const getCommonApplicationCallFields = (app, options) => ({
|
|
|
81
83
|
localNumUint: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),
|
|
82
84
|
localNumBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),
|
|
83
85
|
});
|
|
86
|
+
/** @internal */
|
|
84
87
|
function getApplicationCallInnerTxnContext(method, methodArgs, contract) {
|
|
85
88
|
const abiMetadata = contract ? getContractMethodAbiMetadata(contract, method.name) : undefined;
|
|
86
89
|
const selector = methodSelector(method, contract);
|
|
@@ -89,6 +92,7 @@ function getApplicationCallInnerTxnContext(method, methodArgs, contract) {
|
|
|
89
92
|
onCompletion: methodArgs.onCompletion ?? abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])[0],
|
|
90
93
|
}, selector, abiMetadata?.resourceEncoding);
|
|
91
94
|
}
|
|
95
|
+
/** @internal */
|
|
92
96
|
function abiCall(method, methodArgs, contract) {
|
|
93
97
|
const itxnContext = getApplicationCallInnerTxnContext(method, methodArgs, contract);
|
|
94
98
|
invokeAbiCall(itxnContext);
|
|
@@ -98,6 +102,8 @@ function abiCall(method, methodArgs, contract) {
|
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
/** @internal */
|
|
106
|
+
|
|
101
107
|
var arc4 = /*#__PURE__*/_mergeNamespaces({
|
|
102
108
|
__proto__: null,
|
|
103
109
|
Address: Address,
|
|
@@ -127,4 +133,4 @@ var arc4 = /*#__PURE__*/_mergeNamespaces({
|
|
|
127
133
|
}, [arc4$1]);
|
|
128
134
|
|
|
129
135
|
export { arc4 as a, abiCall as b, compileArc4 as c, getApplicationCallInnerTxnContext as g };
|
|
130
|
-
//# sourceMappingURL=arc4-
|
|
136
|
+
//# sourceMappingURL=arc4-NUIDD7u8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arc4-NUIDD7u8.js","sources":["../src/impl/c2c.ts","../src/internal/arc4.ts"],"sourcesContent":["import { type CompileContractOptions, type Contract, OnCompleteAction } from '@algorandfoundation/algorand-typescript'\nimport type {\n BareCreateApplicationCallFields,\n ContractProxy,\n TypedApplicationCallFields,\n} from '@algorandfoundation/algorand-typescript/arc4'\nimport { getContractMethodAbiMetadata } from '../abi-metadata'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport type { ConstructorFor, DeliberateAny, InstanceMethod } from '../typescript-helpers'\nimport type { ApplicationCallInnerTxn } from './inner-transactions'\nimport { ApplicationCallInnerTxnContext } from './inner-transactions'\nimport { methodSelector } from './method-selector'\nimport type { ApplicationData } from './reference'\n\n/** @internal */\nexport function compileArc4<TContract extends Contract>(\n contract: ConstructorFor<TContract>,\n options?: CompileContractOptions,\n): ContractProxy<TContract> {\n let app: ApplicationData | undefined\n const compiledAppEntry = lazyContext.value.getCompiledAppEntry(contract)\n if (compiledAppEntry !== undefined) {\n app = lazyContext.ledger.applicationDataMap.get(compiledAppEntry.value)\n }\n\n if (options?.templateVars) {\n Object.entries(options.templateVars).forEach(([key, value]) => {\n lazyContext.value.setTemplateVar(key, value, options.templateVarsPrefix)\n })\n }\n\n return {\n call: new Proxy({} as unknown as TContract, {\n get: (_target, prop) => {\n return (methodArgs: TypedApplicationCallFields<DeliberateAny[]>) => {\n const selector = methodSelector(prop as string, contract)\n const abiMetadata = getContractMethodAbiMetadata(contract, prop as string)\n const onCompleteActions = abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])\n const itxnContext = ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields(\n {\n ...getCommonApplicationCallFields(app, options),\n onCompletion: onCompleteActions?.[0],\n ...methodArgs,\n },\n selector,\n abiMetadata?.resourceEncoding,\n )\n invokeAbiCall(itxnContext)\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n }\n },\n }),\n\n bareCreate: (methodArgs?: BareCreateApplicationCallFields) => {\n const itxnContext = ApplicationCallInnerTxnContext.createFromBareCreateApplicationCallFields({\n ...getCommonApplicationCallFields(app, options),\n ...methodArgs,\n })\n invokeAbiCall(itxnContext)\n return itxnContext\n },\n approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),\n globalUints: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),\n globalBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),\n localUints: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),\n localBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),\n } as unknown as ContractProxy<TContract>\n}\n\n/** @internal */\nexport const invokeAbiCall = (itxnContext: ApplicationCallInnerTxnContext) => {\n lazyContext.value.notifyApplicationSpies(itxnContext)\n lazyContext.txn.activeGroup.addInnerTransactionGroup(...(itxnContext.itxns ?? []), itxnContext)\n}\nconst getCommonApplicationCallFields = (app: ApplicationData | undefined, options: CompileContractOptions | undefined) => ({\n approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],\n extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),\n globalNumUint: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),\n globalNumBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),\n localNumUint: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),\n localNumBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),\n})\n\n/** @internal */\nexport function getApplicationCallInnerTxnContext<TArgs extends DeliberateAny[], TReturn = void>(\n method: InstanceMethod<Contract, TArgs, TReturn>,\n methodArgs: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n) {\n const abiMetadata = contract ? getContractMethodAbiMetadata(contract, method.name) : undefined\n const selector = methodSelector(method, contract)\n return ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields<TReturn>(\n {\n ...methodArgs,\n onCompletion: methodArgs.onCompletion ?? abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])[0],\n },\n selector,\n abiMetadata?.resourceEncoding,\n )\n}\n/** @internal */\nexport function abiCall<TArgs extends DeliberateAny[], TReturn>(\n method: InstanceMethod<Contract, TArgs, TReturn>,\n methodArgs: TypedApplicationCallFields<TArgs>,\n contract?: Contract | { new (): Contract },\n): { itxn: ApplicationCallInnerTxn; returnValue: TReturn | undefined } {\n const itxnContext = getApplicationCallInnerTxnContext(method, methodArgs, contract)\n\n invokeAbiCall(itxnContext)\n\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n}\n","/** @internal */\nexport * from '@algorandfoundation/algorand-typescript/arc4'\n/** @internal */\nexport { abiCall, compileArc4 } from '../impl/c2c'\n/** @internal */\nexport { abimethod, baremethod, Contract } from '../impl/contract'\n/** @internal */\nexport {\n Address,\n arc4EncodedLength,\n Bool,\n Byte,\n decodeArc4,\n DynamicArray,\n DynamicBytes,\n encodeArc4,\n FixedArray,\n interpretAsArc4,\n ReferenceArray,\n StaticArray,\n StaticBytes,\n Str,\n Struct,\n Tuple,\n UFixed,\n Uint,\n} from '../impl/encoded-types'\n/** @internal */\nexport { methodSelector } from '../impl/method-selector'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAcA;AACM,SAAU,WAAW,CACzB,QAAmC,EACnC,OAAgC,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AW,CAAC,YAAY,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;AAC9F,IAAA,aAAa,EAAE,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,WAAW,CAAC,aAAa,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;AACjG,CAAA,CAAC;AAEF;SACgB,iCAAiC,CAC/C,MAAgD,EAChD,UAA6C,EAC7C,QAA0C,EAAA;AAE1C,IAAA,MAAM,WAAW,GAAG,QAAQ,GAAG,4BAA4B,CAAC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,SAAS;IAC9F,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC;IACjD,OAAO,8BAA8B,CAAC,oCAAoC,CACxE;AACE,QAAA,GAAG,UAAU;QACb,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,MAAM,KAAK,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACjH,KAAA,EACD,QAAQ,EACR,WAAW,EAAE,gBAAgB,CAC9B;AACH;AACA;SACgB,OAAO,CACrB,MAAgD,EAChD,UAA6C,EAC7C,QAA0C,EAAA;IAE1C,MAAM,WAAW,GAAG,iCAAiC,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC;IAEnF,aAAa,CAAC,WAAW,CAAC;IAE1B,OAAO;AACL,QAAA,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,WAAW,CAAC,iBAAiB;KAC3C;AACH;;ACxHA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { FixedArray as FixedArray$1, ReferenceArray as ReferenceArray$1, Ecdsa,
|
|
|
2
2
|
import { Address as Address$1, Bool as Bool$1, Byte as Byte$1, DynamicArray as DynamicArray$1, DynamicBytes as DynamicBytes$1, StaticArray as StaticArray$1, StaticBytes as StaticBytes$1, Str as Str$1, Struct as Struct$1, Tuple as Tuple$1, UFixed as UFixed$1, Uint as Uint$1, ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4';
|
|
3
3
|
import { encodingUtil } from '@algorandfoundation/puya-ts';
|
|
4
4
|
import assert from 'assert';
|
|
5
|
-
import { au as arrayUtil, av as ALGORAND_ADDRESS_BYTE_LENGTH, aw as ALGORAND_CHECKSUM_BYTE_LENGTH, ax as isBytes, ay as getUint8Array, E as Account, az as TRUE_BIGINT_VALUE, aA as FALSE_BIGINT_VALUE, D as Bytes, a4 as asBytesCls, u as ABI_RETURN_VALUE_LOG_PREFIX, s as asUint8Array, aB as getNativeValue, aC as areAllARC4Encoded, aD as checkItemTypeName, aE as readLength, a6 as conactUint8Arrays, aF as encodeLength, aG as ABI_LENGTH_SIZE, f as asBytes, aH as getMaxLengthOfStaticContentType, a as asNumber, aI as IS_INITIALISING_FROM_BYTES_SYMBOL, aJ as trimTrailingDecimalZeros, aK as regExpNxM, aL as maxBigIntValue, aM as maxBytesLength, h as asUint64, aq as asBigUint, at as UINT64_SIZE, aN as validBitSizes, y as asBigUintCls, k as asMaybeUint64Cls, r as asMaybeBytesCls, Z as asMaybeBigUintCls, X as BytesBackedCls, Y as Uint64BackedCls, l as asUint64Cls, aO as transactionTypeFromBytes, aP as onCompletionFromBytes, aQ as uint64FromBytes, aR as stringFromBytes, aS as bytesFromBytes, aT as bigUintFromBytes, aU as booleanFromBytes, G as AssetCls, t as ApplicationCls, A as AccountCls,
|
|
5
|
+
import { au as arrayUtil, av as ALGORAND_ADDRESS_BYTE_LENGTH, aw as ALGORAND_CHECKSUM_BYTE_LENGTH, ax as isBytes, ay as getUint8Array, E as Account, az as TRUE_BIGINT_VALUE, aA as FALSE_BIGINT_VALUE, D as Bytes, a4 as asBytesCls, u as ABI_RETURN_VALUE_LOG_PREFIX, s as asUint8Array, aB as getNativeValue, aC as areAllARC4Encoded, aD as checkItemTypeName, aE as readLength, a6 as conactUint8Arrays, aF as encodeLength, aG as ABI_LENGTH_SIZE, f as asBytes, aH as getMaxLengthOfStaticContentType, a as asNumber, aI as IS_INITIALISING_FROM_BYTES_SYMBOL, aJ as trimTrailingDecimalZeros, aK as regExpNxM, aL as maxBigIntValue, aM as maxBytesLength, h as asUint64, aq as asBigUint, at as UINT64_SIZE, aN as validBitSizes, y as asBigUintCls, k as asMaybeUint64Cls, r as asMaybeBytesCls, Z as asMaybeBigUintCls, X as BytesBackedCls, Y as Uint64BackedCls, l as asUint64Cls, aO as transactionTypeFromBytes, aP as onCompletionFromBytes, aQ as uint64FromBytes, aR as stringFromBytes, aS as bytesFromBytes, aT as bigUintFromBytes, aU as booleanFromBytes, G as AssetCls, t as ApplicationCls, A as AccountCls, U as Uint64Cls, q as asBigInt, B as BigUintCls, b as BytesCls, aV as holdsDynamicLengthContent, aW as uint8ArrayToNumber, aX as findBoolTypes, aY as compressMultipleBool, aZ as findBool, ag as FixedBytes, a_ as LOGIC_DATA_PREFIX, v as lazyContext, a$ as PROGRAM_TAG, w as Uint64 } from './utils-Bkc_IVMO.js';
|
|
6
6
|
import { a as AvmError, b as avmInvariant, C as CodeError, I as InternalError, n as nameOfType, N as NotImplementedError } from './typescript-helpers-sobuICoc.js';
|
|
7
7
|
import elliptic from 'elliptic';
|
|
8
8
|
import js_sha256 from 'js-sha256';
|
|
@@ -10,6 +10,7 @@ import js_sha3 from 'js-sha3';
|
|
|
10
10
|
import js_sha512 from 'js-sha512';
|
|
11
11
|
import nacl from 'tweetnacl';
|
|
12
12
|
|
|
13
|
+
/** @internal */
|
|
13
14
|
const arrayProxyHandler = () => ({
|
|
14
15
|
get(target, prop) {
|
|
15
16
|
const idx = prop ? parseInt(prop.toString(), 10) : NaN;
|
|
@@ -47,6 +48,7 @@ const arrayProxyHandler = () => ({
|
|
|
47
48
|
},
|
|
48
49
|
});
|
|
49
50
|
|
|
51
|
+
/** @internal */
|
|
50
52
|
class Uint extends Uint$1 {
|
|
51
53
|
value;
|
|
52
54
|
bitSize;
|
|
@@ -88,6 +90,7 @@ class Uint extends Uint$1 {
|
|
|
88
90
|
return parseInt(typeInfo.genericArgs[0].name, 10);
|
|
89
91
|
}
|
|
90
92
|
}
|
|
93
|
+
/** @internal */
|
|
91
94
|
class UFixed extends UFixed$1 {
|
|
92
95
|
value;
|
|
93
96
|
bitSize;
|
|
@@ -134,6 +137,7 @@ class UFixed extends UFixed$1 {
|
|
|
134
137
|
return parseInt(genericArgs.n.name, 10);
|
|
135
138
|
}
|
|
136
139
|
}
|
|
140
|
+
/** @internal */
|
|
137
141
|
class Byte extends Byte$1 {
|
|
138
142
|
typeInfo;
|
|
139
143
|
value;
|
|
@@ -164,6 +168,7 @@ class Byte extends Byte$1 {
|
|
|
164
168
|
return Uint.getMaxBitsLength(typeInfo);
|
|
165
169
|
}
|
|
166
170
|
}
|
|
171
|
+
/** @internal */
|
|
167
172
|
class Str extends Str$1 {
|
|
168
173
|
typeInfo;
|
|
169
174
|
value;
|
|
@@ -197,6 +202,7 @@ class Str extends Str$1 {
|
|
|
197
202
|
return result;
|
|
198
203
|
}
|
|
199
204
|
}
|
|
205
|
+
/** @internal */
|
|
200
206
|
class Bool extends Bool$1 {
|
|
201
207
|
value;
|
|
202
208
|
typeInfo;
|
|
@@ -228,6 +234,7 @@ class Bool extends Bool$1 {
|
|
|
228
234
|
return result;
|
|
229
235
|
}
|
|
230
236
|
}
|
|
237
|
+
/** @internal */
|
|
231
238
|
class StaticArray extends StaticArray$1 {
|
|
232
239
|
value;
|
|
233
240
|
uint8ArrayValue;
|
|
@@ -316,6 +323,7 @@ class StaticArray extends StaticArray$1 {
|
|
|
316
323
|
return result;
|
|
317
324
|
}
|
|
318
325
|
}
|
|
326
|
+
/** @internal */
|
|
319
327
|
class Address extends Address$1 {
|
|
320
328
|
typeInfo;
|
|
321
329
|
value;
|
|
@@ -367,6 +375,7 @@ class Address extends Address$1 {
|
|
|
367
375
|
return result;
|
|
368
376
|
}
|
|
369
377
|
}
|
|
378
|
+
/** @internal */
|
|
370
379
|
class DynamicArray extends DynamicArray$1 {
|
|
371
380
|
value;
|
|
372
381
|
uint8ArrayValue;
|
|
@@ -453,6 +462,7 @@ class DynamicArray extends DynamicArray$1 {
|
|
|
453
462
|
return conactUint8Arrays(encodeLength(items.length).asUint8Array(), encode(items));
|
|
454
463
|
}
|
|
455
464
|
}
|
|
465
|
+
/** @internal */
|
|
456
466
|
class Tuple extends Tuple$1 {
|
|
457
467
|
value;
|
|
458
468
|
uint8ArrayValue;
|
|
@@ -521,6 +531,7 @@ class Tuple extends Tuple$1 {
|
|
|
521
531
|
return result;
|
|
522
532
|
}
|
|
523
533
|
}
|
|
534
|
+
/** @internal */
|
|
524
535
|
class Struct extends Struct$1 {
|
|
525
536
|
uint8ArrayValue;
|
|
526
537
|
genericArgs;
|
|
@@ -588,6 +599,7 @@ class Struct extends Struct$1 {
|
|
|
588
599
|
return result;
|
|
589
600
|
}
|
|
590
601
|
}
|
|
602
|
+
/** @internal */
|
|
591
603
|
class DynamicBytes extends DynamicBytes$1 {
|
|
592
604
|
typeInfo;
|
|
593
605
|
value;
|
|
@@ -639,6 +651,7 @@ class DynamicBytes extends DynamicBytes$1 {
|
|
|
639
651
|
return result;
|
|
640
652
|
}
|
|
641
653
|
}
|
|
654
|
+
/** @internal */
|
|
642
655
|
class StaticBytes extends StaticBytes$1 {
|
|
643
656
|
value;
|
|
644
657
|
typeInfo;
|
|
@@ -690,6 +703,7 @@ class StaticBytes extends StaticBytes$1 {
|
|
|
690
703
|
return result;
|
|
691
704
|
}
|
|
692
705
|
}
|
|
706
|
+
/** @internal */
|
|
693
707
|
class ReferenceArray extends ReferenceArray$1 {
|
|
694
708
|
_values;
|
|
695
709
|
typeInfo;
|
|
@@ -734,6 +748,7 @@ class ReferenceArray extends ReferenceArray$1 {
|
|
|
734
748
|
return getEncoder(this.typeInfo)(bytesValue, this.typeInfo);
|
|
735
749
|
}
|
|
736
750
|
}
|
|
751
|
+
/** @internal */
|
|
737
752
|
class FixedArray extends FixedArray$1 {
|
|
738
753
|
_values;
|
|
739
754
|
size;
|
|
@@ -903,10 +918,12 @@ const isDynamicLengthType = (value) => {
|
|
|
903
918
|
value instanceof DynamicArray ||
|
|
904
919
|
value instanceof DynamicBytes);
|
|
905
920
|
};
|
|
921
|
+
/** @internal */
|
|
906
922
|
function encodeArc4(sourceTypeInfoString, source) {
|
|
907
923
|
const arc4Encoded = getArc4Encoded(source, sourceTypeInfoString);
|
|
908
924
|
return arc4Encoded.bytes;
|
|
909
925
|
}
|
|
926
|
+
/** @internal */
|
|
910
927
|
function decodeArc4(sourceTypeInfoString, targetTypeInfoString, bytes, prefix = 'none') {
|
|
911
928
|
const sourceTypeInfo = JSON.parse(sourceTypeInfoString);
|
|
912
929
|
const targetTypeInfo = JSON.parse(targetTypeInfoString);
|
|
@@ -914,25 +931,24 @@ function decodeArc4(sourceTypeInfoString, targetTypeInfoString, bytes, prefix =
|
|
|
914
931
|
const source = encoder(bytes, sourceTypeInfo, prefix);
|
|
915
932
|
return getNativeValue(source, targetTypeInfo);
|
|
916
933
|
}
|
|
934
|
+
/** @internal */
|
|
917
935
|
function interpretAsArc4(typeInfoString, bytes, prefix = 'none') {
|
|
918
936
|
const typeInfo = JSON.parse(typeInfoString);
|
|
919
937
|
return getEncoder(typeInfo)(bytes, typeInfo, prefix);
|
|
920
938
|
}
|
|
939
|
+
/** @internal */
|
|
921
940
|
const getArc4Encoded = (value, sourceTypeInfoString) => {
|
|
922
941
|
if (value instanceof ARC4Encoded) {
|
|
923
942
|
return value;
|
|
924
943
|
}
|
|
925
944
|
if (value instanceof AccountCls) {
|
|
926
|
-
|
|
927
|
-
return index >= 0 ? new Uint({ name: 'Uint<64>', genericArgs: [{ name: '64' }] }, asBigInt(index)) : getArc4Encoded(value.bytes);
|
|
945
|
+
return getArc4Encoded(value.bytes);
|
|
928
946
|
}
|
|
929
947
|
if (value instanceof AssetCls) {
|
|
930
|
-
|
|
931
|
-
return index >= 0 ? new Uint({ name: 'Uint<64>', genericArgs: [{ name: '64' }] }, asBigInt(index)) : getArc4Encoded(value.id);
|
|
948
|
+
return getArc4Encoded(value.id);
|
|
932
949
|
}
|
|
933
950
|
if (value instanceof ApplicationCls) {
|
|
934
|
-
|
|
935
|
-
return index >= 0 ? new Uint({ name: 'Uint<64>', genericArgs: [{ name: '64' }] }, asBigInt(index)) : getArc4Encoded(value.id);
|
|
951
|
+
return getArc4Encoded(value.id);
|
|
936
952
|
}
|
|
937
953
|
if (typeof value === 'boolean') {
|
|
938
954
|
return new Bool({ name: 'Bool' }, value);
|
|
@@ -1002,6 +1018,7 @@ const getArc4Encoded = (value, sourceTypeInfoString) => {
|
|
|
1002
1018
|
}
|
|
1003
1019
|
throw new CodeError(`Unsupported type for encoding: ${typeof value}`);
|
|
1004
1020
|
};
|
|
1021
|
+
/** @internal */
|
|
1005
1022
|
const toBytes = (val, sourceTypeInfoString) => {
|
|
1006
1023
|
const uint64Val = asMaybeUint64Cls(val, false);
|
|
1007
1024
|
if (uint64Val !== undefined) {
|
|
@@ -1026,6 +1043,7 @@ const toBytes = (val, sourceTypeInfoString) => {
|
|
|
1026
1043
|
}
|
|
1027
1044
|
throw new InternalError(`Invalid type for bytes: ${nameOfType(val)}`);
|
|
1028
1045
|
};
|
|
1046
|
+
/** @internal */
|
|
1029
1047
|
const getEncoder = (typeInfo) => {
|
|
1030
1048
|
const mutableTupleFromBytes = (value, typeInfo, prefix = 'none') => {
|
|
1031
1049
|
const tuple = Tuple.fromBytes(value, typeInfo, prefix);
|
|
@@ -1099,36 +1117,42 @@ const getEncoder = (typeInfo) => {
|
|
|
1099
1117
|
return encoder;
|
|
1100
1118
|
};
|
|
1101
1119
|
|
|
1120
|
+
/** @internal */
|
|
1102
1121
|
const sha256 = (a) => {
|
|
1103
1122
|
const bytesA = BytesCls.fromCompat(a);
|
|
1104
1123
|
const hashArray = js_sha256.sha256.create().update(bytesA.asUint8Array()).digest();
|
|
1105
1124
|
const hashBytes = FixedBytes(32, new Uint8Array(hashArray));
|
|
1106
1125
|
return hashBytes;
|
|
1107
1126
|
};
|
|
1127
|
+
/** @internal */
|
|
1108
1128
|
const sha3_256 = (a) => {
|
|
1109
1129
|
const bytesA = BytesCls.fromCompat(a);
|
|
1110
1130
|
const hashArray = js_sha3.sha3_256.create().update(bytesA.asUint8Array()).digest();
|
|
1111
1131
|
const hashBytes = FixedBytes(32, new Uint8Array(hashArray));
|
|
1112
1132
|
return hashBytes;
|
|
1113
1133
|
};
|
|
1134
|
+
/** @internal */
|
|
1114
1135
|
const keccak256 = (a) => {
|
|
1115
1136
|
const bytesA = BytesCls.fromCompat(a);
|
|
1116
1137
|
const hashArray = js_sha3.keccak256.create().update(bytesA.asUint8Array()).digest();
|
|
1117
1138
|
const hashBytes = FixedBytes(32, new Uint8Array(hashArray));
|
|
1118
1139
|
return hashBytes;
|
|
1119
1140
|
};
|
|
1141
|
+
/** @internal */
|
|
1120
1142
|
const sha512_256 = (a) => {
|
|
1121
1143
|
const bytesA = BytesCls.fromCompat(a);
|
|
1122
1144
|
const hashArray = js_sha512.sha512_256.create().update(bytesA.asUint8Array()).digest();
|
|
1123
1145
|
const hashBytes = FixedBytes(32, new Uint8Array(hashArray));
|
|
1124
1146
|
return hashBytes;
|
|
1125
1147
|
};
|
|
1148
|
+
/** @internal */
|
|
1126
1149
|
const ed25519verifyBare = (a, b, c) => {
|
|
1127
1150
|
const bytesA = BytesCls.fromCompat(a);
|
|
1128
1151
|
const bytesB = BytesCls.fromCompat(b);
|
|
1129
1152
|
const bytesC = BytesCls.fromCompat(c);
|
|
1130
1153
|
return nacl.sign.detached.verify(bytesA.asUint8Array(), bytesB.asUint8Array(), bytesC.asUint8Array());
|
|
1131
1154
|
};
|
|
1155
|
+
/** @internal */
|
|
1132
1156
|
const ed25519verify = (a, b, c) => {
|
|
1133
1157
|
const txn = lazyContext.activeGroup.activeTransaction;
|
|
1134
1158
|
const programBytes = asBytesCls(txn.onCompletion == OnCompleteAction.ClearState ? txn.clearStateProgram : txn.approvalProgram);
|
|
@@ -1138,6 +1162,7 @@ const ed25519verify = (a, b, c) => {
|
|
|
1138
1162
|
const data = LOGIC_DATA_PREFIX.concat(addressBytes).concat(asBytes(a));
|
|
1139
1163
|
return ed25519verifyBare(data, b, c);
|
|
1140
1164
|
};
|
|
1165
|
+
/** @internal */
|
|
1141
1166
|
const ecdsaVerify = (v, a, b, c, d, e) => {
|
|
1142
1167
|
const dataBytes = BytesCls.fromCompat(a);
|
|
1143
1168
|
const sigRBytes = BytesCls.fromCompat(b);
|
|
@@ -1151,6 +1176,7 @@ const ecdsaVerify = (v, a, b, c, d, e) => {
|
|
|
1151
1176
|
const keyPair = ecdsa.keyFromPublic(publicKey.asUint8Array());
|
|
1152
1177
|
return keyPair.verify(dataBytes.asUint8Array(), { r: sigRBytes.asUint8Array(), s: sigSBytes.asUint8Array() });
|
|
1153
1178
|
};
|
|
1179
|
+
/** @internal */
|
|
1154
1180
|
const ecdsaPkRecover = (v, a, b, c, d) => {
|
|
1155
1181
|
if (v !== Ecdsa.Secp256k1) {
|
|
1156
1182
|
throw new InternalError(`Unsupported ECDSA curve: ${v}`);
|
|
@@ -1165,6 +1191,7 @@ const ecdsaPkRecover = (v, a, b, c, d) => {
|
|
|
1165
1191
|
const y = pubKey.getY().toArray('be');
|
|
1166
1192
|
return [FixedBytes(32, x), FixedBytes(32, y)];
|
|
1167
1193
|
};
|
|
1194
|
+
/** @internal */
|
|
1168
1195
|
const ecdsaPkDecompress = (v, a) => {
|
|
1169
1196
|
const bytesA = BytesCls.fromCompat(a);
|
|
1170
1197
|
const ecdsa = new elliptic.ec(curveMap[v]);
|
|
@@ -1174,14 +1201,17 @@ const ecdsaPkDecompress = (v, a) => {
|
|
|
1174
1201
|
const y = pubKey.getY().toArray('be');
|
|
1175
1202
|
return [FixedBytes(32, new Uint8Array(x)), FixedBytes(32, new Uint8Array(y))];
|
|
1176
1203
|
};
|
|
1204
|
+
/** @internal */
|
|
1177
1205
|
const vrfVerify = (_s, _a, _b, _c) => {
|
|
1178
1206
|
throw new NotImplementedError('vrfVerify');
|
|
1179
1207
|
};
|
|
1208
|
+
/** @internal */
|
|
1180
1209
|
const EllipticCurve = new Proxy({}, {
|
|
1181
1210
|
get: (_target, prop) => {
|
|
1182
1211
|
throw new NotImplementedError(`EllipticCurve.${prop.toString()}`);
|
|
1183
1212
|
},
|
|
1184
1213
|
});
|
|
1214
|
+
/** @internal */
|
|
1185
1215
|
const mimc = (_c, _a) => {
|
|
1186
1216
|
throw new NotImplementedError('mimc');
|
|
1187
1217
|
};
|
|
@@ -1198,6 +1228,7 @@ const resolveAppIndex = (appIdOrIndex) => {
|
|
|
1198
1228
|
const txn = lazyContext.activeGroup.activeTransaction;
|
|
1199
1229
|
return txn.apps(input).id;
|
|
1200
1230
|
};
|
|
1231
|
+
/** @internal */
|
|
1201
1232
|
const getApp = (app) => {
|
|
1202
1233
|
try {
|
|
1203
1234
|
const appId = asMaybeUint64Cls(app);
|
|
@@ -1210,6 +1241,7 @@ const getApp = (app) => {
|
|
|
1210
1241
|
return undefined;
|
|
1211
1242
|
}
|
|
1212
1243
|
};
|
|
1244
|
+
/** @internal */
|
|
1213
1245
|
const AppParams = {
|
|
1214
1246
|
appApprovalProgram(a) {
|
|
1215
1247
|
const app = getApp(a);
|
|
@@ -1257,6 +1289,7 @@ const resolveAssetIndex = (assetIdOrIndex) => {
|
|
|
1257
1289
|
const txn = lazyContext.activeGroup.activeTransaction;
|
|
1258
1290
|
return txn.assets(input).id;
|
|
1259
1291
|
};
|
|
1292
|
+
/** @internal */
|
|
1260
1293
|
const getAsset = (asset) => {
|
|
1261
1294
|
try {
|
|
1262
1295
|
const assetId = asMaybeUint64Cls(asset);
|
|
@@ -1269,6 +1302,7 @@ const getAsset = (asset) => {
|
|
|
1269
1302
|
return undefined;
|
|
1270
1303
|
}
|
|
1271
1304
|
};
|
|
1305
|
+
/** @internal */
|
|
1272
1306
|
const AssetParams = {
|
|
1273
1307
|
assetTotal(a) {
|
|
1274
1308
|
const asset = getAsset(a);
|
|
@@ -1321,4 +1355,4 @@ const AssetParams = {
|
|
|
1321
1355
|
};
|
|
1322
1356
|
|
|
1323
1357
|
export { Address as A, Bool as B, vrfVerify as C, DynamicBytes as D, EllipticCurve as E, FixedArray as F, ReferenceArray as R, Str as S, Tuple as T, Uint as U, getArc4Encoded as a, Byte as b, DynamicArray as c, StaticArray as d, StaticBytes as e, Struct as f, getEncoder as g, UFixed as h, decodeArc4 as i, encodeArc4 as j, interpretAsArc4 as k, getApp as l, getAsset as m, AppParams as n, AssetParams as o, ecdsaPkDecompress as p, ecdsaPkRecover as q, ecdsaVerify as r, sha512_256 as s, toBytes as t, ed25519verify as u, ed25519verifyBare as v, keccak256 as w, mimc as x, sha256 as y, sha3_256 as z };
|
|
1324
|
-
//# sourceMappingURL=asset-params-
|
|
1358
|
+
//# sourceMappingURL=asset-params-DUSsiQc-.js.map
|