@algorandfoundation/algorand-typescript-testing 1.0.0-alpha.26 → 1.0.0-alpha.27
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/{arc4-C2kLuQFA.js → arc4-CnIpYz0b.js} +4 -4
- package/{arc4-C2kLuQFA.js.map → arc4-CnIpYz0b.js.map} +1 -1
- package/{asset-params-CxUqHD3q.js → asset-params-KGSWLcH2.js} +2 -2
- package/{asset-params-CxUqHD3q.js.map → asset-params-KGSWLcH2.js.map} +1 -1
- package/constants.d.ts +1 -1
- package/{crypto-DWjdfYp-.js → crypto-CVMAVA34.js} +21 -10
- package/crypto-CVMAVA34.js.map +1 -0
- package/impl/block.d.ts +2 -2
- package/impl/crypto.d.ts +7 -7
- package/impl/encoded-types.d.ts +3 -3
- package/impl/global.d.ts +2 -2
- package/impl/primitives.d.ts +4 -0
- package/impl/reference.d.ts +2 -1
- package/impl/transactions.d.ts +8 -8
- package/index.mjs +6 -6
- package/{inner-transactions-u0A_np7-.js → inner-transactions-C7RrBqFR.js} +5 -5
- package/inner-transactions-C7RrBqFR.js.map +1 -0
- package/internal/arc4.mjs +5 -5
- package/internal/index.mjs +10 -10
- package/internal/op.mjs +4 -4
- package/{op-Dy3_aHqI.js → op-DPCWaAow.js} +8 -8
- package/op-DPCWaAow.js.map +1 -0
- package/package.json +3 -3
- package/{pure-CvD6Yaq3.js → pure--bthQrOR.js} +5 -5
- package/pure--bthQrOR.js.map +1 -0
- package/{runtime-helpers-Dh8cPhFj.js → runtime-helpers-DetvL6IX.js} +2 -2
- package/{runtime-helpers-Dh8cPhFj.js.map → runtime-helpers-DetvL6IX.js.map} +1 -1
- package/runtime-helpers.mjs +2 -2
- package/subcontexts/transaction-context.d.ts +1 -1
- package/crypto-DWjdfYp-.js.map +0 -1
- package/inner-transactions-u0A_np7-.js.map +0 -1
- package/op-Dy3_aHqI.js.map +0 -1
- package/pure-CvD6Yaq3.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
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 } from './crypto-
|
|
5
|
-
import { m as methodSelector, q as ApplicationCallInnerTxnContext } from './inner-transactions-
|
|
3
|
+
import { g as getContractMethodAbiMetadata, C as Contract, b as abimethod, c as baremethod } from './runtime-helpers-DetvL6IX.js';
|
|
4
|
+
import { v as lazyContext } from './crypto-CVMAVA34.js';
|
|
5
|
+
import { m as methodSelector, q as ApplicationCallInnerTxnContext } from './inner-transactions-C7RrBqFR.js';
|
|
6
6
|
|
|
7
7
|
function _mergeNamespaces(n, m) {
|
|
8
8
|
m.forEach(function (e) {
|
|
@@ -105,4 +105,4 @@ var arc4 = /*#__PURE__*/_mergeNamespaces({
|
|
|
105
105
|
}, [arc4$1]);
|
|
106
106
|
|
|
107
107
|
export { arc4 as a, abiCall as b, compileArc4 as c };
|
|
108
|
-
//# sourceMappingURL=arc4-
|
|
108
|
+
//# sourceMappingURL=arc4-CnIpYz0b.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc4-
|
|
1
|
+
{"version":3,"file":"arc4-CnIpYz0b.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 abiMetadata = contract ? getContractMethodAbiMetadata(contract, method.name) : undefined\n const selector = methodSelector(method, contract)\n const itxnContext = ApplicationCallInnerTxnContext.createFromTypedApplicationCallFields<TReturn>(\n {\n ...methodArgs,\n onCompletion: methodArgs.onCompletion ?? abiMetadata?.allowActions?.map((action) => OnCompleteAction[action])[0],\n },\n selector,\n )\n invokeCallback(itxnContext)\n\n return {\n itxn: itxnContext,\n returnValue: itxnContext.loggedReturnValue,\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAc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AAC,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;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;AACjD,IAAA,MAAM,WAAW,GAAG,8BAA8B,CAAC,oCAAoC,CACrF;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;KACjH,EACD,QAAQ,CACT;IACD,cAAc,CAAC,WAAW,CAAC;IAE3B,OAAO;AACL,QAAA,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,WAAW,CAAC,iBAAiB;KAC3C;AACH;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ARC4Encoded } from '@algorandfoundation/algorand-typescript/arc4';
|
|
2
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, ao as nameOfType, aF as getArc4Encoder, aE as arc4Encoders, H as AssetCls, t as ApplicationCls, A as AccountCls, aC as getMaxLengthOfStaticContentType, a0 as CodeError, 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-
|
|
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, ao as nameOfType, aF as getArc4Encoder, aE as arc4Encoders, H as AssetCls, t as ApplicationCls, A as AccountCls, aC as getMaxLengthOfStaticContentType, a0 as CodeError, 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-CVMAVA34.js';
|
|
4
4
|
|
|
5
5
|
const booleanFromBytes = (val) => {
|
|
6
6
|
return encodingUtil.uint8ArrayToBigInt(asUint8Array(val)) > 0n;
|
|
@@ -209,4 +209,4 @@ const AssetParams = {
|
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
export { AppParams as A, getApp as a, getAsset as b, AssetParams as c, getEncoder as g, minLengthForType as m, toBytes as t };
|
|
212
|
-
//# sourceMappingURL=asset-params-
|
|
212
|
+
//# sourceMappingURL=asset-params-KGSWLcH2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-params-CxUqHD3q.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 { CodeError, InternalError } from './errors'\nimport { BytesBackedCls, Uint64BackedCls } from './impl/base'\nimport { arc4Encoders, encodeArc4Impl, getArc4Encoder, getMaxLengthOfStaticContentType } 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, false)\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(undefined, val)\n }\n throw new InternalError(`Invalid type for bytes: ${nameOfType(val)}`)\n}\n\nexport const minLengthForType = (typeInfo: TypeInfo): number | undefined => {\n try {\n return getMaxLengthOfStaticContentType(typeInfo, false)\n } catch (e) {\n if (e instanceof CodeError && e.message.startsWith('unsupported type')) {\n return undefined\n }\n throw e\n }\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, bo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AC,QAAQ,EAAE,IAAI,CAAC;KACzE;AACD,IAAA,YAAY,CAAC,CAA+B,EAAA;AAC1C,QAAA,MAAM,KAAK,GAAG,QAAQ,CAAC,CAAC,CAAC;QACzB,OAAO,KAAK,KAAK,SAAS,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;KACxE;;;;;"}
|
|
1
|
+
{"version":3,"file":"asset-params-KGSWLcH2.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 { CodeError, InternalError } from './errors'\nimport { BytesBackedCls, Uint64BackedCls } from './impl/base'\nimport { arc4Encoders, encodeArc4Impl, getArc4Encoder, getMaxLengthOfStaticContentType } 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, false)\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(undefined, val)\n }\n throw new InternalError(`Invalid type for bytes: ${nameOfType(val)}`)\n}\n\nexport const minLengthForType = (typeInfo: TypeInfo): number | undefined => {\n try {\n return getMaxLengthOfStaticContentType(typeInfo, false)\n } catch (e) {\n if (e instanceof CodeError && e.message.startsWith('unsupported type')) {\n return undefined\n }\n throw e\n }\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<32>, boolean] {\n const asset = getAsset(a)\n return asset === undefined ? [Bytes() as bytes<32>, 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,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,MAAM,cAAc,GAAqB,C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|
17
17
|
export declare const DEFAULT_ASSET_CREATE_MIN_BALANCE = 1000000;
|
|
18
18
|
export declare const DEFAULT_ASSET_OPT_IN_MIN_BALANCE = 10000;
|
|
19
|
-
export declare const DEFAULT_GLOBAL_GENESIS_HASH: import("@algorandfoundation/algorand-typescript").bytes
|
|
19
|
+
export declare const DEFAULT_GLOBAL_GENESIS_HASH: import("@algorandfoundation/algorand-typescript").bytes<32>;
|
|
20
20
|
export declare const ZERO_ADDRESS: import("@algorandfoundation/algorand-typescript").bytes;
|
|
21
21
|
/**
|
|
22
22
|
"\x09" # pragma version 9
|
|
@@ -413,6 +413,14 @@ class BytesCls extends AlgoTsPrimitiveCls {
|
|
|
413
413
|
valueOf() {
|
|
414
414
|
return encodingUtil.uint8ArrayToHex(this.#v);
|
|
415
415
|
}
|
|
416
|
+
toFixed(options) {
|
|
417
|
+
if (options.checked !== false) {
|
|
418
|
+
if (this.#v.length !== options.length) {
|
|
419
|
+
throw new CodeError(`Invalid bytes constant length of ${this.#v.length}, expected ${options.length}`);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return new BytesCls(this.#v);
|
|
423
|
+
}
|
|
416
424
|
static [Symbol.hasInstance](x) {
|
|
417
425
|
return isInstanceOfTypeByName(x, BytesCls);
|
|
418
426
|
}
|
|
@@ -506,7 +514,7 @@ const DEFAULT_ASSET_OPT_IN_MIN_BALANCE = 10_000;
|
|
|
506
514
|
const DEFAULT_GLOBAL_GENESIS_HASH = Bytes(new Uint8Array([
|
|
507
515
|
133, 89, 181, 20, 120, 253, 137, 193, 118, 67, 208, 93, 21, 168, 174, 107, 16, 171, 71, 187, 109, 138, 49, 136, 17, 86, 230, 189, 59,
|
|
508
516
|
174, 149, 209,
|
|
509
|
-
]));
|
|
517
|
+
])).toFixed({ length: 32 });
|
|
510
518
|
// algorand encoded address of 32 zero bytes
|
|
511
519
|
const ZERO_ADDRESS = Bytes.fromBase32('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
|
|
512
520
|
/**
|
|
@@ -955,6 +963,9 @@ class AccountCls extends BytesBackedCls {
|
|
|
955
963
|
}
|
|
956
964
|
super(addressBytes.slice(0, 32));
|
|
957
965
|
}
|
|
966
|
+
get bytes() {
|
|
967
|
+
return super.bytes.toFixed({ length: 32 });
|
|
968
|
+
}
|
|
958
969
|
get data() {
|
|
959
970
|
return lazyContext.getAccountData(this);
|
|
960
971
|
}
|
|
@@ -1078,7 +1089,7 @@ const getDefaultAssetData = () => ({
|
|
|
1078
1089
|
unitName: lazyContext.any.bytes(4),
|
|
1079
1090
|
name: lazyContext.any.bytes(32),
|
|
1080
1091
|
url: lazyContext.any.bytes(10),
|
|
1081
|
-
metadataHash: lazyContext.any.bytes(32),
|
|
1092
|
+
metadataHash: lazyContext.any.bytes(32).toFixed({ length: 32 }),
|
|
1082
1093
|
manager: Account(ZERO_ADDRESS),
|
|
1083
1094
|
freeze: Account(ZERO_ADDRESS),
|
|
1084
1095
|
clawback: Account(ZERO_ADDRESS),
|
|
@@ -1918,7 +1929,7 @@ class StaticBytesImpl extends StaticBytes {
|
|
|
1918
1929
|
value;
|
|
1919
1930
|
typeInfo;
|
|
1920
1931
|
constructor(typeInfo, value) {
|
|
1921
|
-
super(value);
|
|
1932
|
+
super(value ?? Bytes());
|
|
1922
1933
|
this.typeInfo = typeof typeInfo === 'string' ? JSON.parse(typeInfo) : typeInfo;
|
|
1923
1934
|
const uint8ArrayValue = asUint8Array(value ?? new Uint8Array(StaticBytesImpl.getMaxBytesLength(this.typeInfo)));
|
|
1924
1935
|
this.value = StaticArrayImpl.fromBytesImpl(uint8ArrayValue, typeInfo);
|
|
@@ -2348,25 +2359,25 @@ const sha256 = (a) => {
|
|
|
2348
2359
|
const bytesA = BytesCls.fromCompat(a);
|
|
2349
2360
|
const hashArray = js_sha256.sha256.create().update(bytesA.asUint8Array()).digest();
|
|
2350
2361
|
const hashBytes = BytesCls.fromCompat(new Uint8Array(hashArray));
|
|
2351
|
-
return hashBytes.asAlgoTs();
|
|
2362
|
+
return hashBytes.asAlgoTs().toFixed({ length: 32 });
|
|
2352
2363
|
};
|
|
2353
2364
|
const sha3_256 = (a) => {
|
|
2354
2365
|
const bytesA = BytesCls.fromCompat(a);
|
|
2355
2366
|
const hashArray = js_sha3.sha3_256.create().update(bytesA.asUint8Array()).digest();
|
|
2356
2367
|
const hashBytes = BytesCls.fromCompat(new Uint8Array(hashArray));
|
|
2357
|
-
return hashBytes.asAlgoTs();
|
|
2368
|
+
return hashBytes.asAlgoTs().toFixed({ length: 32 });
|
|
2358
2369
|
};
|
|
2359
2370
|
const keccak256 = (a) => {
|
|
2360
2371
|
const bytesA = BytesCls.fromCompat(a);
|
|
2361
2372
|
const hashArray = js_sha3.keccak256.create().update(bytesA.asUint8Array()).digest();
|
|
2362
2373
|
const hashBytes = BytesCls.fromCompat(new Uint8Array(hashArray));
|
|
2363
|
-
return hashBytes.asAlgoTs();
|
|
2374
|
+
return hashBytes.asAlgoTs().toFixed({ length: 32 });
|
|
2364
2375
|
};
|
|
2365
2376
|
const sha512_256 = (a) => {
|
|
2366
2377
|
const bytesA = BytesCls.fromCompat(a);
|
|
2367
2378
|
const hashArray = js_sha512.sha512_256.create().update(bytesA.asUint8Array()).digest();
|
|
2368
2379
|
const hashBytes = BytesCls.fromCompat(new Uint8Array(hashArray));
|
|
2369
|
-
return hashBytes.asAlgoTs();
|
|
2380
|
+
return hashBytes.asAlgoTs().toFixed({ length: 32 });
|
|
2370
2381
|
};
|
|
2371
2382
|
const ed25519verifyBare = (a, b, c) => {
|
|
2372
2383
|
const bytesA = BytesCls.fromCompat(a);
|
|
@@ -2408,7 +2419,7 @@ const ecdsaPkRecover = (v, a, b, c, d) => {
|
|
|
2408
2419
|
const pubKey = ecdsa.recoverPubKey(dataBytes.asUint8Array(), { r: rBytes.asUint8Array(), s: sBytes.asUint8Array() }, recoveryId.asNumber());
|
|
2409
2420
|
const x = pubKey.getX().toArray('be');
|
|
2410
2421
|
const y = pubKey.getY().toArray('be');
|
|
2411
|
-
return [Bytes(x), Bytes(y)];
|
|
2422
|
+
return [Bytes(x).toFixed({ length: 32 }), Bytes(y).toFixed({ length: 32 })];
|
|
2412
2423
|
};
|
|
2413
2424
|
const ecdsaPkDecompress = (v, a) => {
|
|
2414
2425
|
const bytesA = BytesCls.fromCompat(a);
|
|
@@ -2417,7 +2428,7 @@ const ecdsaPkDecompress = (v, a) => {
|
|
|
2417
2428
|
const pubKey = keyPair.getPublic();
|
|
2418
2429
|
const x = pubKey.getX().toArray('be');
|
|
2419
2430
|
const y = pubKey.getY().toArray('be');
|
|
2420
|
-
return [Bytes(new Uint8Array(x)), Bytes(new Uint8Array(y))];
|
|
2431
|
+
return [Bytes(new Uint8Array(x)).toFixed({ length: 32 }), Bytes(new Uint8Array(y)).toFixed({ length: 32 })];
|
|
2421
2432
|
};
|
|
2422
2433
|
const vrfVerify = (_s, _a, _b, _c) => {
|
|
2423
2434
|
throw new NotImplementedError('vrfVerify');
|
|
@@ -2436,4 +2447,4 @@ const curveMap = {
|
|
|
2436
2447
|
};
|
|
2437
2448
|
|
|
2438
2449
|
export { AvmError as $, AccountCls as A, BigUintCls as B, BigUint as C, MAX_BYTES_SIZE as D, Bytes as E, Account as F, getRandomBytes as G, AssetCls as H, InternalError as I, MAX_UINT512 as J, AddressImpl as K, MAX_UINT8 as L, MAX_UINT64 as M, UintNImpl as N, MAX_UINT16 as O, MAX_UINT32 as P, MAX_UINT128 as Q, MAX_UINT256 as R, DynamicBytesImpl as S, TRANSACTION_GROUP_MAX_SIZE as T, Uint64Cls as U, BITS_IN_BYTE as V, StrImpl as W, BaseContract as X, ContextManager as Y, DEFAULT_TEMPLATE_VAR_PREFIX as Z, AssertError as _, asNumber as a, isUint64 as a$, CodeError as a0, NotImplementedError as a1, toExternalValue as a2, assert as a3, BytesBackedCls as a4, Uint64BackedCls as a5, asMaybeBigUintCls as a6, contract as a7, err as a8, sha512_256 as a9, StructImpl as aA, StaticBytesImpl as aB, getMaxLengthOfStaticContentType as aC, interpretAsArc4Impl as aD, arc4Encoders as aE, getArc4Encoder as aF, EllipticCurve as aG, ecdsaPkDecompress as aH, ecdsaPkRecover as aI, ecdsaVerify as aJ, ed25519verify as aK, ed25519verifyBare as aL, keccak256 as aM, mimc as aN, sha256 as aO, sha3_256 as aP, vrfVerify as aQ, getApplicationAddress as aR, getObjectReference as aS, MIN_TXN_FEE as aT, DEFAULT_ACCOUNT_MIN_BALANCE as aU, DEFAULT_MAX_TXN_LIFE as aV, ZERO_ADDRESS as aW, DEFAULT_ASSET_CREATE_MIN_BALANCE as aX, DEFAULT_ASSET_OPT_IN_MIN_BALANCE as aY, DEFAULT_GLOBAL_GENESIS_HASH as aZ, asBigUint as a_, combineIntoMaxBytePages as aa, MAX_ITEMS_IN_LOG as ab, asBytesCls as ac, MAX_BOX_SIZE as ad, conactUint8Arrays as ae, getArc4Encoded as af, BytesMap as ag, ContractOptionsSymbol as ah, encodeArc4Impl as ai, asApplication as aj, asAsset as ak, asAccount as al, ConventionalRouting as am, getArc4TypeName as an, nameOfType as ao, checkBigUint as ap, checkBytes as aq, flattenAsBytes as ar, arc4EncodedLengthImpl as as, decodeArc4Impl as at, UFixedNxMImpl as au, ByteImpl as av, BoolImpl as aw, StaticArrayImpl as ax, DynamicArrayImpl as ay, TupleImpl as az, BytesCls as b, binaryStringToBytes as b0, UINT64_SIZE as b1, AlgoTsPrimitiveCls as c, Uint64Map as d, AccountMap as e, asBytes as f, Asset as g, asUint64 as h, iterBigInt as i, Application as j, asMaybeUint64Cls as k, asUint64Cls as l, AssetHolding as m, AccountData as n, ApplicationData as o, getDefaultAssetData as p, asBigInt as q, asMaybeBytesCls as r, asUint8Array as s, ApplicationCls as t, ABI_RETURN_VALUE_LOG_PREFIX as u, lazyContext as v, invariant as w, Uint64 as x, getRandomBigInt as y, asBigUintCls as z };
|
|
2439
|
-
//# sourceMappingURL=crypto-
|
|
2450
|
+
//# sourceMappingURL=crypto-CVMAVA34.js.map
|