@algorandfoundation/algorand-typescript-testing 1.0.0-beta.32 → 1.0.0-beta.34
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 +3 -1
- package/application-spy.d.ts +33 -0
- package/arc4-CC8mc2EI.js +104 -0
- package/arc4-CC8mc2EI.js.map +1 -0
- package/asset-params-C0sz_Aya.js +201 -0
- package/asset-params-C0sz_Aya.js.map +1 -0
- package/{crypto-BMTigz9x.js → crypto-DumZR3uP.js} +107 -104
- package/crypto-DumZR3uP.js.map +1 -0
- package/errors.d.ts +1 -1
- package/impl/c2c.d.ts +11 -0
- package/impl/compiled.d.ts +1 -1
- package/impl/encoded-types.d.ts +1 -1
- package/impl/gtxn.d.ts +1 -1
- package/impl/inner-transactions.d.ts +28 -5
- package/impl/itxn.d.ts +1 -1
- package/impl/method-selector.d.ts +4 -1
- package/impl/transactions.d.ts +10 -9
- package/index.d.ts +1 -0
- package/index.mjs +145 -275
- package/index.mjs.map +1 -1
- package/{inner-transactions-Bz3Txrff.js → inner-transactions-DrYPl6aW.js} +346 -30
- package/inner-transactions-DrYPl6aW.js.map +1 -0
- package/internal/arc4.d.ts +1 -0
- package/internal/arc4.mjs +7 -5
- package/internal/arc4.mjs.map +1 -1
- package/internal/index.d.ts +2 -2
- package/internal/index.mjs +19 -19
- package/internal/index.mjs.map +1 -1
- package/internal/op.mjs +5 -4
- package/internal/op.mjs.map +1 -1
- package/{op-yjWBeorl.js → op-gBBDFbF6.js} +111 -110
- package/op-gBBDFbF6.js.map +1 -0
- package/package.json +4 -5
- package/{program-factory-CrdkPpT0.js → program-factory-7SPe2HW0.js} +15 -3
- package/program-factory-7SPe2HW0.js.map +1 -0
- package/{asset-params-CZmGYLQv.js → pure-A1MFEXtY.js} +5 -200
- package/pure-A1MFEXtY.js.map +1 -0
- package/{runtime-helpers-DHXdMtMR.js → runtime-helpers-BszTaREL.js} +120 -8
- package/runtime-helpers-BszTaREL.js.map +1 -0
- package/runtime-helpers.mjs +2 -3
- package/runtime-helpers.mjs.map +1 -1
- package/subcontexts/contract-context.d.ts +10 -0
- package/subcontexts/transaction-context.d.ts +4 -4
- package/test-execution-context.d.ts +16 -3
- package/test-transformer/jest-transformer.mjs +1 -1
- package/test-transformer/jest-transformer.mjs.map +1 -1
- package/test-transformer/node-factory.d.ts +1 -0
- package/test-transformer/vitest-transformer.mjs +1 -1
- package/test-transformer/vitest-transformer.mjs.map +1 -1
- package/typescript-helpers-CAukFXpp.js.map +1 -1
- package/typescript-helpers.d.ts +5 -0
- package/util.d.ts +1 -0
- package/value-generators/txn.d.ts +6 -6
- package/abi-metadata-Dqh8iYjB.js +0 -117
- package/abi-metadata-Dqh8iYjB.js.map +0 -1
- package/arc4-DMlP46RF.js +0 -40
- package/arc4-DMlP46RF.js.map +0 -1
- package/asset-params-CZmGYLQv.js.map +0 -1
- package/crypto-BMTigz9x.js.map +0 -1
- package/inner-transactions-Bz3Txrff.js.map +0 -1
- package/op-yjWBeorl.js.map +0 -1
- package/program-factory-CrdkPpT0.js.map +0 -1
- package/runtime-helpers-DHXdMtMR.js.map +0 -1
package/abi-metadata.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export declare const attachAbiMetadata: (contract: {
|
|
|
16
16
|
export declare const getContractAbiMetadata: <T extends Contract>(contract: T | {
|
|
17
17
|
new (): T;
|
|
18
18
|
}) => Record<string, AbiMetadata>;
|
|
19
|
-
export declare const getContractMethodAbiMetadata: <T extends Contract>(contract: T
|
|
19
|
+
export declare const getContractMethodAbiMetadata: <T extends Contract>(contract: T | {
|
|
20
|
+
new (): T;
|
|
21
|
+
}, methodName: string) => AbiMetadata;
|
|
20
22
|
export declare const getArc4Signature: (metadata: AbiMetadata) => string;
|
|
21
23
|
export declare const getArc4Selector: (metadata: AbiMetadata) => Uint8Array;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { bytes, Contract } from '@algorandfoundation/algorand-typescript';
|
|
2
|
+
import { OnCompleteAction } from '@algorandfoundation/algorand-typescript';
|
|
3
|
+
import type { ApplicationCallInnerTxnContext } from './impl/inner-transactions';
|
|
4
|
+
import type { AnyFunction, ConstructorFor } from './typescript-helpers';
|
|
5
|
+
export type AppSpyCb = (itxnContext: ApplicationCallInnerTxnContext) => void;
|
|
6
|
+
export declare class ApplicationSpy<TContract extends Contract = Contract> {
|
|
7
|
+
#private;
|
|
8
|
+
/**
|
|
9
|
+
* The `on` property is a proxy that allows you to register callbacks for specific method signatures.
|
|
10
|
+
* It dynamically creates methods based on the contract's methods.
|
|
11
|
+
*/
|
|
12
|
+
readonly on: _TypedApplicationSpyCallBacks<TContract>;
|
|
13
|
+
constructor(contract?: TContract | ConstructorFor<TContract>);
|
|
14
|
+
/**
|
|
15
|
+
* Registers a callback for a bare call (no arguments).
|
|
16
|
+
* @param callback - The callback to be executed when a bare call is detected.
|
|
17
|
+
*/
|
|
18
|
+
onBareCall(callback: AppSpyCb): void;
|
|
19
|
+
onBareCall(ocas: OnCompleteAction[], callback: AppSpyCb): void;
|
|
20
|
+
/**
|
|
21
|
+
* Registers a callback for a specific method signature.
|
|
22
|
+
* @param methodSignature
|
|
23
|
+
* @param callback
|
|
24
|
+
*/
|
|
25
|
+
onAbiCall(methodSignature: bytes, callback: AppSpyCb): void;
|
|
26
|
+
onAbiCall(methodSignature: bytes, ocas: OnCompleteAction[], callback: AppSpyCb): void;
|
|
27
|
+
private _tryGetMethod;
|
|
28
|
+
private createOnProxy;
|
|
29
|
+
}
|
|
30
|
+
type _TypedApplicationSpyCallBacks<TContract> = {
|
|
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
|
+
};
|
|
33
|
+
export {};
|
package/arc4-CC8mc2EI.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as arc4$1 from '@algorandfoundation/algorand-typescript/arc4';
|
|
2
|
+
import { OnCompleteAction } from '@algorandfoundation/algorand-typescript';
|
|
3
|
+
import { g as getContractMethodAbiMetadata, C as Contract, b as abimethod, c as baremethod } from './runtime-helpers-BszTaREL.js';
|
|
4
|
+
import { v as lazyContext } from './crypto-DumZR3uP.js';
|
|
5
|
+
import { m as methodSelector, q as ApplicationCallInnerTxnContext } from './inner-transactions-DrYPl6aW.js';
|
|
6
|
+
|
|
7
|
+
function _mergeNamespaces(n, m) {
|
|
8
|
+
m.forEach(function (e) {
|
|
9
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !(k in n)) {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
return Object.freeze(n);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function compileArc4(contract, options) {
|
|
23
|
+
let app;
|
|
24
|
+
const compiledAppEntry = lazyContext.value.getCompiledAppEntry(contract);
|
|
25
|
+
if (compiledAppEntry !== undefined) {
|
|
26
|
+
app = lazyContext.ledger.applicationDataMap.get(compiledAppEntry.value);
|
|
27
|
+
}
|
|
28
|
+
if (options?.templateVars) {
|
|
29
|
+
Object.entries(options.templateVars).forEach(([key, value]) => {
|
|
30
|
+
lazyContext.value.setTemplateVar(key, value, options.templateVarsPrefix);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
call: new Proxy({}, {
|
|
35
|
+
get: (_target, prop) => {
|
|
36
|
+
return (methodArgs) => {
|
|
37
|
+
const selector = methodSelector(prop, contract);
|
|
38
|
+
const abiMetadata = getContractMethodAbiMetadata(contract, prop);
|
|
39
|
+
const onCompleteActions = abiMetadata?.allowActions?.map((action) => OnCompleteAction[action]);
|
|
40
|
+
const itxnContext = ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields({
|
|
41
|
+
...getCommonApplicationCallFields(app, options),
|
|
42
|
+
onCompletion: onCompleteActions?.[0],
|
|
43
|
+
...methodArgs,
|
|
44
|
+
}, selector);
|
|
45
|
+
invokeCallback(itxnContext);
|
|
46
|
+
return {
|
|
47
|
+
itxn: itxnContext,
|
|
48
|
+
returnValue: itxnContext.loggedReturnValue,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
bareCreate: (methodArgs) => {
|
|
54
|
+
const itxnContext = ApplicationCallInnerTxnContext.createFromBareCreateApplicationCallFields({
|
|
55
|
+
...getCommonApplicationCallFields(app, options),
|
|
56
|
+
...methodArgs,
|
|
57
|
+
});
|
|
58
|
+
invokeCallback(itxnContext);
|
|
59
|
+
return itxnContext;
|
|
60
|
+
},
|
|
61
|
+
approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],
|
|
62
|
+
clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],
|
|
63
|
+
extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),
|
|
64
|
+
globalUints: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),
|
|
65
|
+
globalBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),
|
|
66
|
+
localUints: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),
|
|
67
|
+
localBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const invokeCallback = (itxnContext) => {
|
|
71
|
+
lazyContext.value.notifyApplicationSpies(itxnContext);
|
|
72
|
+
lazyContext.txn.activeGroup.addInnerTransactionGroup(...(itxnContext.itxns ?? []), itxnContext);
|
|
73
|
+
};
|
|
74
|
+
const getCommonApplicationCallFields = (app, options) => ({
|
|
75
|
+
approvalProgram: app?.application.approvalProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],
|
|
76
|
+
clearStateProgram: app?.application.clearStateProgram ?? [lazyContext.any.bytes(10), lazyContext.any.bytes(10)],
|
|
77
|
+
extraProgramPages: options?.extraProgramPages ?? app?.application.extraProgramPages ?? lazyContext.any.uint64(),
|
|
78
|
+
globalNumUint: options?.globalUints ?? app?.application.globalNumUint ?? lazyContext.any.uint64(),
|
|
79
|
+
globalNumBytes: options?.globalBytes ?? app?.application.globalNumBytes ?? lazyContext.any.uint64(),
|
|
80
|
+
localNumUint: options?.localUints ?? app?.application.localNumUint ?? lazyContext.any.uint64(),
|
|
81
|
+
localNumBytes: options?.localBytes ?? app?.application.localNumBytes ?? lazyContext.any.uint64(),
|
|
82
|
+
});
|
|
83
|
+
function abiCall(method, methodArgs, contract) {
|
|
84
|
+
const selector = methodSelector(method, contract);
|
|
85
|
+
const itxnContext = ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields(methodArgs, selector);
|
|
86
|
+
invokeCallback(itxnContext);
|
|
87
|
+
return {
|
|
88
|
+
itxn: itxnContext,
|
|
89
|
+
returnValue: itxnContext.loggedReturnValue,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
var arc4 = /*#__PURE__*/_mergeNamespaces({
|
|
94
|
+
__proto__: null,
|
|
95
|
+
Contract: Contract,
|
|
96
|
+
abiCall: abiCall,
|
|
97
|
+
abimethod: abimethod,
|
|
98
|
+
baremethod: baremethod,
|
|
99
|
+
compileArc4: compileArc4,
|
|
100
|
+
methodSelector: methodSelector
|
|
101
|
+
}, [arc4$1]);
|
|
102
|
+
|
|
103
|
+
export { arc4 as a, abiCall as b, compileArc4 as c };
|
|
104
|
+
//# sourceMappingURL=arc4-CC8mc2EI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arc4-CC8mc2EI.js","sources":["../src/impl/c2c.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\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 )\n invokeCallback(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 invokeCallback(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\nconst invokeCallback = (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\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 selector = methodSelector(method, contract)\n const itxnContext = ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields<TReturn>(methodArgs, selector)\n invokeCallback(itxnContext)\n\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAcM,SAAU,WAAW,CACzB,QAAmC,EACnC,OAAgC,EAAA;AAEhC,IAAA,IAAI,GAAgC;IACpC,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,mBAAmB,CAAC,QAAQ,CAAC;AACxE,IAAA,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAClC,QAAA,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC;IACzE;AAEA,IAAA,IAAI,OAAO,EAAE,YAAY,EAAE;AACzB,QAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAI;AAC5D,YAAA,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,kBAAkB,CAAC;AAC1E,QAAA,CAAC,CAAC;IACJ;IAEA,OAAO;AACL,QAAA,IAAI,EAAE,IAAI,KAAK,CAAC,EAA0B,EAAE;AAC1C,YAAA,GAAG,EAAE,CAAC,OAAO,EAAE,IAAI,KAAI;gBACrB,OAAO,CAAC,UAAuD,KAAI;oBACjE,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAc,EAAE,QAAQ,CAAC;oBACzD,MAAM,WAAW,GAAG,4BAA4B,CAAC,QAAQ,EAAE,IAAc,CAAC;AAC1E,oBAAA,MAAM,iBAAiB,GAAG,WAAW,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,MAAM,KAAK,gBAAgB,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,GAAG,EAAE,WAAW,CAAC,aAAa,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;AACjG,IAAA,cAAc,EAAE,OAAO,EAAE,WAAW,IAAI,GAAG,EAAE,WAAW,CAAC,cAAc,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE;AACnG,IAAA,YAAY,EAAE,OAAO,EAAE,UAAU,IAAI,GAAG,EAAE,WAAW,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;SAEc,OAAO,CACrB,MAAgD,EAChD,UAA6C,EAC7C,QAA0C,EAAA;IAE1C,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC;IACjD,MAAM,WAAW,GAAG,8BAA8B,CAAC,oCAAoC,CAAU,UAAU,EAAE,QAAQ,CAAC;IACtH,cAAc,CAAC,WAAW,CAAC;IAE3B,OAAO;AACL,QAAA,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,WAAW,CAAC,iBAAiB;KAC3C;AACH;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4';
|
|
2
|
+
import { encodingUtil } from '@algorandfoundation/puya-ts';
|
|
3
|
+
import { k as asMaybeUint64Cls, r as asMaybeBytesCls, a6 as asMaybeBigUintCls, a4 as BytesBackedCls, a5 as Uint64BackedCls, l as asUint64Cls, ai as encodeArc4Impl, I as InternalError, an as nameOfType, aD as getArc4Encoder, aC as arc4Encoders, H as AssetCls, t as ApplicationCls, A as AccountCls, x as Uint64, s as asUint8Array, f as asBytes, C as BigUint, F as Account, E as Bytes, v as lazyContext, h as asUint64 } from './crypto-DumZR3uP.js';
|
|
4
|
+
|
|
5
|
+
const booleanFromBytes = (val) => {
|
|
6
|
+
return encodingUtil.uint8ArrayToBigInt(asUint8Array(val)) > 0n;
|
|
7
|
+
};
|
|
8
|
+
const bigUintFromBytes = (val) => {
|
|
9
|
+
return BigUint(encodingUtil.uint8ArrayToBigInt(asUint8Array(val)));
|
|
10
|
+
};
|
|
11
|
+
const bytesFromBytes = (val) => {
|
|
12
|
+
return asBytes(val);
|
|
13
|
+
};
|
|
14
|
+
const stringFromBytes = (val) => {
|
|
15
|
+
return asBytes(val).toString();
|
|
16
|
+
};
|
|
17
|
+
const uint64FromBytes = (val) => {
|
|
18
|
+
return Uint64(encodingUtil.uint8ArrayToBigInt(asUint8Array(val)));
|
|
19
|
+
};
|
|
20
|
+
const onCompletionFromBytes = (val) => {
|
|
21
|
+
return Uint64(encodingUtil.uint8ArrayToBigInt(asUint8Array(val)));
|
|
22
|
+
};
|
|
23
|
+
const transactionTypeFromBytes = (val) => {
|
|
24
|
+
return Uint64(encodingUtil.uint8ArrayToBigInt(asUint8Array(val)));
|
|
25
|
+
};
|
|
26
|
+
const encoders = {
|
|
27
|
+
account: AccountCls.fromBytes,
|
|
28
|
+
application: ApplicationCls.fromBytes,
|
|
29
|
+
asset: AssetCls.fromBytes,
|
|
30
|
+
boolean: booleanFromBytes,
|
|
31
|
+
biguint: bigUintFromBytes,
|
|
32
|
+
bytes: bytesFromBytes,
|
|
33
|
+
string: stringFromBytes,
|
|
34
|
+
uint64: uint64FromBytes,
|
|
35
|
+
OnCompleteAction: onCompletionFromBytes,
|
|
36
|
+
TransactionType: transactionTypeFromBytes,
|
|
37
|
+
...arc4Encoders,
|
|
38
|
+
};
|
|
39
|
+
const getEncoder = (typeInfo) => {
|
|
40
|
+
return getArc4Encoder(typeInfo, encoders);
|
|
41
|
+
};
|
|
42
|
+
const toBytes = (val) => {
|
|
43
|
+
const uint64Val = asMaybeUint64Cls(val);
|
|
44
|
+
if (uint64Val !== undefined) {
|
|
45
|
+
return uint64Val.toBytes().asAlgoTs();
|
|
46
|
+
}
|
|
47
|
+
const bytesVal = asMaybeBytesCls(val);
|
|
48
|
+
if (bytesVal !== undefined) {
|
|
49
|
+
return bytesVal.asAlgoTs();
|
|
50
|
+
}
|
|
51
|
+
const bigUintVal = asMaybeBigUintCls(val);
|
|
52
|
+
if (bigUintVal !== undefined) {
|
|
53
|
+
return bigUintVal.toBytes().asAlgoTs();
|
|
54
|
+
}
|
|
55
|
+
if (val instanceof BytesBackedCls) {
|
|
56
|
+
return val.bytes;
|
|
57
|
+
}
|
|
58
|
+
if (val instanceof Uint64BackedCls) {
|
|
59
|
+
return asUint64Cls(val.uint64).toBytes().asAlgoTs();
|
|
60
|
+
}
|
|
61
|
+
if (val instanceof ARC4Encoded) {
|
|
62
|
+
return val.bytes;
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(val) || typeof val === 'object') {
|
|
65
|
+
return encodeArc4Impl('', val);
|
|
66
|
+
}
|
|
67
|
+
throw new InternalError(`Invalid type for bytes: ${nameOfType(val)}`);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const resolveAppIndex = (appIdOrIndex) => {
|
|
71
|
+
const input = asUint64(appIdOrIndex);
|
|
72
|
+
if (input >= 1001) {
|
|
73
|
+
return input;
|
|
74
|
+
}
|
|
75
|
+
const txn = lazyContext.activeGroup.activeTransaction;
|
|
76
|
+
return txn.apps(input).id;
|
|
77
|
+
};
|
|
78
|
+
const getApp = (app) => {
|
|
79
|
+
try {
|
|
80
|
+
const appId = asMaybeUint64Cls(app);
|
|
81
|
+
if (appId !== undefined) {
|
|
82
|
+
return lazyContext.ledger.getApplication(resolveAppIndex(appId));
|
|
83
|
+
}
|
|
84
|
+
return app;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const AppParams = {
|
|
91
|
+
appApprovalProgram(a) {
|
|
92
|
+
const app = getApp(a);
|
|
93
|
+
return app === undefined ? [Bytes(), false] : [app.approvalProgram, true];
|
|
94
|
+
},
|
|
95
|
+
appClearStateProgram(a) {
|
|
96
|
+
const app = getApp(a);
|
|
97
|
+
return app === undefined ? [Bytes(), false] : [app.clearStateProgram, true];
|
|
98
|
+
},
|
|
99
|
+
appGlobalNumUint(a) {
|
|
100
|
+
const app = getApp(a);
|
|
101
|
+
return app === undefined ? [Uint64(0), false] : [app.globalNumUint, true];
|
|
102
|
+
},
|
|
103
|
+
appGlobalNumByteSlice(a) {
|
|
104
|
+
const app = getApp(a);
|
|
105
|
+
return app === undefined ? [Uint64(0), false] : [app.globalNumBytes, true];
|
|
106
|
+
},
|
|
107
|
+
appLocalNumUint(a) {
|
|
108
|
+
const app = getApp(a);
|
|
109
|
+
return app === undefined ? [Uint64(0), false] : [app.localNumUint, true];
|
|
110
|
+
},
|
|
111
|
+
appLocalNumByteSlice(a) {
|
|
112
|
+
const app = getApp(a);
|
|
113
|
+
return app === undefined ? [Uint64(0), false] : [app.localNumBytes, true];
|
|
114
|
+
},
|
|
115
|
+
appExtraProgramPages(a) {
|
|
116
|
+
const app = getApp(a);
|
|
117
|
+
return app === undefined ? [Uint64(0), false] : [app.extraProgramPages, true];
|
|
118
|
+
},
|
|
119
|
+
appCreator(a) {
|
|
120
|
+
const app = getApp(a);
|
|
121
|
+
return app === undefined ? [Account(), false] : [app.creator, true];
|
|
122
|
+
},
|
|
123
|
+
appAddress(a) {
|
|
124
|
+
const app = getApp(a);
|
|
125
|
+
return app === undefined ? [Account(), false] : [app.address, true];
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const resolveAssetIndex = (assetIdOrIndex) => {
|
|
130
|
+
const input = asUint64(assetIdOrIndex);
|
|
131
|
+
if (input >= 1001) {
|
|
132
|
+
return input;
|
|
133
|
+
}
|
|
134
|
+
const txn = lazyContext.activeGroup.activeTransaction;
|
|
135
|
+
return txn.assets(input).id;
|
|
136
|
+
};
|
|
137
|
+
const getAsset = (asset) => {
|
|
138
|
+
try {
|
|
139
|
+
const assetId = asMaybeUint64Cls(asset);
|
|
140
|
+
if (assetId !== undefined) {
|
|
141
|
+
return lazyContext.ledger.getAsset(resolveAssetIndex(assetId));
|
|
142
|
+
}
|
|
143
|
+
return asset;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const AssetParams = {
|
|
150
|
+
assetTotal(a) {
|
|
151
|
+
const asset = getAsset(a);
|
|
152
|
+
return asset === undefined ? [Uint64(0), false] : [asset.total, true];
|
|
153
|
+
},
|
|
154
|
+
assetDecimals(a) {
|
|
155
|
+
const asset = getAsset(a);
|
|
156
|
+
return asset === undefined ? [Uint64(0), false] : [asset.decimals, true];
|
|
157
|
+
},
|
|
158
|
+
assetDefaultFrozen(a) {
|
|
159
|
+
const asset = getAsset(a);
|
|
160
|
+
return asset === undefined ? [false, false] : [asset.defaultFrozen, true];
|
|
161
|
+
},
|
|
162
|
+
assetUnitName(a) {
|
|
163
|
+
const asset = getAsset(a);
|
|
164
|
+
return asset === undefined ? [Bytes(), false] : [asset.unitName, true];
|
|
165
|
+
},
|
|
166
|
+
assetName(a) {
|
|
167
|
+
const asset = getAsset(a);
|
|
168
|
+
return asset === undefined ? [Bytes(), false] : [asset.name, true];
|
|
169
|
+
},
|
|
170
|
+
assetUrl(a) {
|
|
171
|
+
const asset = getAsset(a);
|
|
172
|
+
return asset === undefined ? [Bytes(), false] : [asset.url, true];
|
|
173
|
+
},
|
|
174
|
+
assetMetadataHash(a) {
|
|
175
|
+
const asset = getAsset(a);
|
|
176
|
+
return asset === undefined ? [Bytes(), false] : [asset.metadataHash, true];
|
|
177
|
+
},
|
|
178
|
+
assetManager(a) {
|
|
179
|
+
const asset = getAsset(a);
|
|
180
|
+
return asset === undefined ? [Account(), false] : [asset.manager, true];
|
|
181
|
+
},
|
|
182
|
+
assetReserve(a) {
|
|
183
|
+
const asset = getAsset(a);
|
|
184
|
+
return asset === undefined ? [Account(), false] : [asset.reserve, true];
|
|
185
|
+
},
|
|
186
|
+
assetFreeze(a) {
|
|
187
|
+
const asset = getAsset(a);
|
|
188
|
+
return asset === undefined ? [Account(), false] : [asset.freeze, true];
|
|
189
|
+
},
|
|
190
|
+
assetClawback(a) {
|
|
191
|
+
const asset = getAsset(a);
|
|
192
|
+
return asset === undefined ? [Account(), false] : [asset.clawback, true];
|
|
193
|
+
},
|
|
194
|
+
assetCreator(a) {
|
|
195
|
+
const asset = getAsset(a);
|
|
196
|
+
return asset === undefined ? [Account(), false] : [asset.creator, true];
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export { AppParams as A, getApp as a, getAsset as b, AssetParams as c, getEncoder as g, toBytes as t };
|
|
201
|
+
//# sourceMappingURL=asset-params-C0sz_Aya.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-params-C0sz_Aya.js","sources":["../src/encoders.ts","../src/impl/app-params.ts","../src/impl/asset-params.ts"],"sourcesContent":["import type { biguint, bytes, OnCompleteAction, TransactionType, uint64 } from '@algorandfoundation/algorand-typescript'\nimport { ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4'\nimport { encodingUtil } from '@algorandfoundation/puya-ts'\nimport { InternalError } from './errors'\nimport { BytesBackedCls, Uint64BackedCls } from './impl/base'\nimport { arc4Encoders, encodeArc4Impl, getArc4Encoder } from './impl/encoded-types'\nimport { BigUint, Uint64, type StubBytesCompat } from './impl/primitives'\nimport { AccountCls, ApplicationCls, AssetCls } from './impl/reference'\nimport type { DeliberateAny } from './typescript-helpers'\nimport { asBytes, asMaybeBigUintCls, asMaybeBytesCls, asMaybeUint64Cls, asUint64Cls, asUint8Array, nameOfType } from './util'\n\nexport type TypeInfo = {\n name: string\n genericArgs?: TypeInfo[] | Record<string, TypeInfo>\n}\n\nexport type fromBytes<T> = (val: Uint8Array | StubBytesCompat, typeInfo: TypeInfo, prefix?: 'none' | 'log') => T\n\nconst booleanFromBytes: fromBytes<boolean> = (val) => {\n return encodingUtil.uint8ArrayToBigInt(asUint8Array(val)) > 0n\n}\n\nconst bigUintFromBytes: fromBytes<biguint> = (val) => {\n return BigUint(encodingUtil.uint8ArrayToBigInt(asUint8Array(val)))\n}\n\nconst bytesFromBytes: fromBytes<bytes> = (val) => {\n return asBytes(val)\n}\n\nconst stringFromBytes: fromBytes<string> = (val) => {\n return asBytes(val).toString()\n}\n\nconst uint64FromBytes: fromBytes<uint64> = (val) => {\n return Uint64(encodingUtil.uint8ArrayToBigInt(asUint8Array(val)))\n}\n\nconst onCompletionFromBytes: fromBytes<OnCompleteAction> = (val) => {\n return Uint64(encodingUtil.uint8ArrayToBigInt(asUint8Array(val))) as OnCompleteAction\n}\n\nconst transactionTypeFromBytes: fromBytes<TransactionType> = (val) => {\n return Uint64(encodingUtil.uint8ArrayToBigInt(asUint8Array(val))) as TransactionType\n}\n\nexport const encoders: Record<string, fromBytes<DeliberateAny>> = {\n account: AccountCls.fromBytes,\n application: ApplicationCls.fromBytes,\n asset: AssetCls.fromBytes,\n boolean: booleanFromBytes,\n biguint: bigUintFromBytes,\n bytes: bytesFromBytes,\n string: stringFromBytes,\n uint64: uint64FromBytes,\n OnCompleteAction: onCompletionFromBytes,\n TransactionType: transactionTypeFromBytes,\n ...arc4Encoders,\n}\n\nexport const getEncoder = <T>(typeInfo: TypeInfo): fromBytes<T> => {\n return getArc4Encoder<T>(typeInfo, encoders)\n}\n\nexport const toBytes = (val: unknown): bytes => {\n const uint64Val = asMaybeUint64Cls(val)\n if (uint64Val !== undefined) {\n return uint64Val.toBytes().asAlgoTs()\n }\n const bytesVal = asMaybeBytesCls(val)\n if (bytesVal !== undefined) {\n return bytesVal.asAlgoTs()\n }\n const bigUintVal = asMaybeBigUintCls(val)\n if (bigUintVal !== undefined) {\n return bigUintVal.toBytes().asAlgoTs()\n }\n if (val instanceof BytesBackedCls) {\n return val.bytes\n }\n if (val instanceof Uint64BackedCls) {\n return asUint64Cls(val.uint64).toBytes().asAlgoTs()\n }\n if (val instanceof ARC4Encoded) {\n return val.bytes\n }\n if (Array.isArray(val) || typeof val === 'object') {\n return encodeArc4Impl('', val)\n }\n throw new InternalError(`Invalid type for bytes: ${nameOfType(val)}`)\n}\n","import type {\n Account as AccountType,\n Application as ApplicationType,\n bytes,\n gtxn,\n op,\n uint64,\n} from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { asMaybeUint64Cls, asUint64 } from '../util'\nimport { Bytes, Uint64, type StubUint64Compat } from './primitives'\nimport { Account } from './reference'\n\nconst resolveAppIndex = (appIdOrIndex: StubUint64Compat): uint64 => {\n const input = asUint64(appIdOrIndex)\n if (input >= 1001) {\n return input\n }\n const txn = lazyContext.activeGroup.activeTransaction as gtxn.ApplicationCallTxn\n return txn.apps(input).id\n}\n\nexport const getApp = (app: ApplicationType | StubUint64Compat): ApplicationType | undefined => {\n try {\n const appId = asMaybeUint64Cls(app)\n if (appId !== undefined) {\n return lazyContext.ledger.getApplication(resolveAppIndex(appId))\n }\n return app as ApplicationType\n } catch {\n return undefined\n }\n}\n\nexport const AppParams: typeof op.AppParams = {\n appApprovalProgram(a: ApplicationType | StubUint64Compat): readonly [bytes, boolean] {\n const app = getApp(a)\n return app === undefined ? [Bytes(), false] : [app.approvalProgram, true]\n },\n appClearStateProgram(a: ApplicationType | StubUint64Compat): readonly [bytes, boolean] {\n const app = getApp(a)\n return app === undefined ? [Bytes(), false] : [app.clearStateProgram, true]\n },\n appGlobalNumUint(a: ApplicationType | StubUint64Compat): readonly [uint64, boolean] {\n const app = getApp(a)\n return app === undefined ? [Uint64(0), false] : [app.globalNumUint, true]\n },\n appGlobalNumByteSlice(a: ApplicationType | StubUint64Compat): readonly [uint64, boolean] {\n const app = getApp(a)\n return app === undefined ? [Uint64(0), false] : [app.globalNumBytes, true]\n },\n appLocalNumUint(a: ApplicationType | StubUint64Compat): readonly [uint64, boolean] {\n const app = getApp(a)\n return app === undefined ? [Uint64(0), false] : [app.localNumUint, true]\n },\n appLocalNumByteSlice(a: ApplicationType | StubUint64Compat): readonly [uint64, boolean] {\n const app = getApp(a)\n return app === undefined ? [Uint64(0), false] : [app.localNumBytes, true]\n },\n appExtraProgramPages(a: ApplicationType | StubUint64Compat): readonly [uint64, boolean] {\n const app = getApp(a)\n return app === undefined ? [Uint64(0), false] : [app.extraProgramPages, true]\n },\n appCreator(a: ApplicationType | StubUint64Compat): readonly [AccountType, boolean] {\n const app = getApp(a)\n return app === undefined ? [Account(), false] : [app.creator, true]\n },\n appAddress(a: ApplicationType | StubUint64Compat): readonly [AccountType, boolean] {\n const app = getApp(a)\n return app === undefined ? [Account(), false] : [app.address, true]\n },\n}\n","import type { Account as AccountType, Asset as AssetType, bytes, gtxn, op, uint64 } from '@algorandfoundation/algorand-typescript'\nimport { lazyContext } from '../context-helpers/internal-context'\nimport { asMaybeUint64Cls, asUint64 } from '../util'\nimport { Bytes, Uint64, type StubUint64Compat } from './primitives'\nimport { Account } from './reference'\n\nconst resolveAssetIndex = (assetIdOrIndex: StubUint64Compat): uint64 => {\n const input = asUint64(assetIdOrIndex)\n if (input >= 1001) {\n return input\n }\n const txn = lazyContext.activeGroup.activeTransaction as gtxn.ApplicationCallTxn\n return txn.assets(input).id\n}\n\nexport const getAsset = (asset: AssetType | StubUint64Compat): AssetType | undefined => {\n try {\n const assetId = asMaybeUint64Cls(asset)\n if (assetId !== undefined) {\n return lazyContext.ledger.getAsset(resolveAssetIndex(assetId))\n }\n return asset as AssetType\n } catch {\n return undefined\n }\n}\n\nexport const AssetParams: typeof op.AssetParams = {\n assetTotal(a: AssetType | StubUint64Compat): readonly [uint64, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Uint64(0), false] : [asset.total, true]\n },\n assetDecimals(a: AssetType | StubUint64Compat): readonly [uint64, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Uint64(0), false] : [asset.decimals, true]\n },\n assetDefaultFrozen(a: AssetType | StubUint64Compat): readonly [boolean, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [false, false] : [asset.defaultFrozen, true]\n },\n assetUnitName(a: AssetType | StubUint64Compat): readonly [bytes, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Bytes(), false] : [asset.unitName, true]\n },\n assetName(a: AssetType | StubUint64Compat): readonly [bytes, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Bytes(), false] : [asset.name, true]\n },\n assetUrl(a: AssetType | StubUint64Compat): readonly [bytes, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Bytes(), false] : [asset.url, true]\n },\n assetMetadataHash(a: AssetType | StubUint64Compat): readonly [bytes, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Bytes(), false] : [asset.metadataHash, true]\n },\n assetManager(a: AssetType | StubUint64Compat): readonly [AccountType, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Account(), false] : [asset.manager, true]\n },\n assetReserve(a: AssetType | StubUint64Compat): readonly [AccountType, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Account(), false] : [asset.reserve, true]\n },\n assetFreeze(a: AssetType | StubUint64Compat): readonly [AccountType, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Account(), false] : [asset.freeze, true]\n },\n assetClawback(a: AssetType | StubUint64Compat): readonly [AccountType, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Account(), false] : [asset.clawback, true]\n },\n assetCreator(a: AssetType | StubUint64Compat): readonly [AccountType, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Account(), false] : [asset.creator, true]\n },\n}\n"],"names":[],"mappings":";;;;AAkBA,MAAM,gBAAgB,GAAuB,CAAC,GAAG,KAAI;IACnD,OAAO,YAAY,CAAC,kBAAkB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AAChE,CAAC;AAED,MAAM,gBAAgB,GAAuB,CAAC,GAAG,KAAI;AACnD,IAAA,OAAO,OAAO,CAAC,YAAY,CAAC,kBAAkB,CA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