@algorandfoundation/algokit-utils 10.0.0-alpha.12 → 10.0.0-alpha.13
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/algod-client/index.d.ts +2 -3
- package/algod-client/index.js +2 -5
- package/algod-client/index.mjs +2 -2
- package/indexer-client/index.d.ts +1 -2
- package/indexer-client/index.js +0 -5
- package/indexer-client/index.mjs +1 -2
- package/kmd-client/index.d.ts +1 -2
- package/kmd-client/index.js +0 -5
- package/kmd-client/index.mjs +1 -2
- package/package.json +1 -1
- package/packages/algod_client/src/apis/api-service.js +2 -2
- package/packages/algod_client/src/apis/api-service.mjs +2 -2
- package/packages/algod_client/src/core/model-runtime.js +2 -2
- package/packages/algod_client/src/core/model-runtime.js.map +1 -1
- package/packages/algod_client/src/core/model-runtime.mjs +2 -2
- package/packages/algod_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/algod_client/src/models/simulate-request.js +1 -1
- package/packages/algod_client/src/models/simulate-request.mjs +1 -1
- package/packages/algod_client/src/models/simulate-response.d.ts +2 -1
- package/packages/algod_client/src/models/simulate-response.js +6 -1
- package/packages/algod_client/src/models/simulate-response.js.map +1 -1
- package/packages/algod_client/src/models/simulate-response.mjs +6 -2
- package/packages/algod_client/src/models/simulate-response.mjs.map +1 -1
- package/packages/indexer_client/src/core/model-runtime.js +0 -15
- package/packages/indexer_client/src/core/model-runtime.js.map +1 -1
- package/packages/indexer_client/src/core/model-runtime.mjs +1 -13
- package/packages/indexer_client/src/core/model-runtime.mjs.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.js +2 -12
- package/packages/kmd_client/src/core/model-runtime.js.map +1 -1
- package/packages/kmd_client/src/core/model-runtime.mjs +3 -11
- package/packages/kmd_client/src/core/model-runtime.mjs.map +1 -1
- package/transactions/app-call.d.ts +1 -1
- package/transactions/app-call.js.map +1 -1
- package/transactions/app-call.mjs.map +1 -1
- package/transactions/method-call.d.ts +1 -1
- package/transactions/method-call.js.map +1 -1
- package/transactions/method-call.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +42 -42
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +43 -43
- package/types/app-client.d.ts +74 -74
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +1 -1
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +25 -25
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs.map +1 -1
- package/types/app.d.ts +1 -1
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +3 -6
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +1 -1
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +1 -1
- package/types/composer.js +3 -3
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +3 -3
- package/types/composer.mjs.map +1 -1
- package/types/debugging.d.ts +13 -9
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +0 -1
- package/types/lifecycle-events.js.map +1 -1
- package/types/lifecycle-events.mjs.map +1 -1
- package/types/transaction.d.ts +1 -1
- package/packages/algod_client/src/core/model-runtime.d.ts +0 -10
- package/packages/indexer_client/src/core/model-runtime.d.ts +0 -10
- package/packages/kmd_client/src/core/model-runtime.d.ts +0 -10
- package/types/expand.d.ts +0 -9
- package/types/expand.js +0 -0
- package/types/expand.mjs +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"method-call.mjs","names":["addr: Address","encodedArgs: Uint8Array[]"],"sources":["../../src/transactions/method-call.ts"],"sourcesContent":["import {\n ABIMethod,\n ABITupleType,\n ABIType,\n ABIUintType,\n ABIValue,\n argTypeIsReference,\n argTypeIsTransaction,\n} from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address, getAddress } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, Transaction, TransactionSigner, TransactionType } from '@algorandfoundation/algokit-transact'\nimport { TransactionWithSigner } from '../transaction'\nimport { AlgoAmount } from '../types/amount'\nimport { AppManager } from '../types/app-manager'\nimport { Expand } from '../types/expand'\nimport { calculateExtraProgramPages } from '../util'\nimport { AppCreateParams, AppDeleteParams, AppMethodCallParams, AppUpdateParams } from './app-call'\nimport { buildTransactionCommonData } from './common'\n\nconst ARGS_TUPLE_PACKING_THRESHOLD = 14 // 14+ args trigger tuple packing, excluding the method selector\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = Expand<AppMethodCall<AppCreateParams>>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = Expand<AppMethodCall<AppUpdateParams>>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = Expand<AppMethodCall<AppDeleteParams>>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = Expand<AppMethodCall<AppMethodCallParams>>\n\nexport type ProcessedAppCreateMethodCall = Expand<\n Omit<AppCreateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppUpdateMethodCall = Expand<\n Omit<AppUpdateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppCallMethodCall = Expand<\n Omit<AppCallMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\ntype AppMethodCallArgs = AppMethodCall<unknown>['args']\ntype AppMethodCallArg = NonNullable<AppMethodCallArgs>[number]\n\nexport type AsyncTransactionParams = {\n txn: Promise<Transaction>\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\nexport type TransactionParams = {\n txn: Transaction\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\ntype ExtractedMethodCallTransactionArg =\n | { data: TransactionParams; type: 'txn' }\n | {\n data: AsyncTransactionParams\n type: 'asyncTxn'\n }\n | { data: ProcessedAppCallMethodCall | ProcessedAppCreateMethodCall | ProcessedAppUpdateMethodCall; type: 'methodCall' }\n\nexport function extractComposerTransactionsFromAppMethodCallParams(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall | AppDeleteMethodCall,\n parentSigner?: TransactionSigner,\n): ExtractedMethodCallTransactionArg[] {\n const composerTransactions = new Array<ExtractedMethodCallTransactionArg>()\n const methodCallArgs = params.args\n if (!methodCallArgs) return []\n\n // Extract signer from params, falling back to parentSigner\n const currentSigner = params.signer ? ('signer' in params.signer ? params.signer.signer : params.signer) : parentSigner\n\n for (let i = 0; i < methodCallArgs.length; i++) {\n const arg = methodCallArgs[i]\n\n if (arg === undefined) {\n // is a transaction or default value placeholder, do nothing\n continue\n }\n if (isAbiValue(arg)) {\n // if is ABI value, also ignore\n continue\n }\n\n if (isTransactionWithSignerArg(arg)) {\n composerTransactions.push({\n data: {\n txn: arg.txn,\n signer: arg.signer,\n },\n type: 'txn',\n })\n\n continue\n }\n if (isAppCallMethodCallArg(arg)) {\n // Recursively extract nested method call transactions, passing the nested call itself and current signer as parent\n const nestedComposerTransactions = extractComposerTransactionsFromAppMethodCallParams(arg, currentSigner)\n composerTransactions.push(...nestedComposerTransactions)\n composerTransactions.push({\n data: {\n ...arg,\n signer: arg.signer ?? currentSigner,\n args: processAppMethodCallArgs(arg.args),\n },\n type: 'methodCall',\n } satisfies ExtractedMethodCallTransactionArg)\n\n continue\n }\n if (arg instanceof Promise) {\n composerTransactions.push({\n data: {\n txn: arg,\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n continue\n }\n\n composerTransactions.push({\n data: {\n txn: Promise.resolve(arg),\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n }\n\n return composerTransactions\n}\n\nexport function processAppMethodCallArgs(args: AppMethodCallArg[] | undefined): (ABIValue | undefined)[] | undefined {\n if (args === undefined) return undefined\n\n return args.map((arg) => {\n if (arg === undefined) {\n // Handle explicit placeholders (either transaction or default value)\n return undefined\n } else if (!isAbiValue(arg)) {\n // If the arg is not an ABIValue, it's must be a transaction, set to undefined\n // transaction arguments should be flattened out and added into the composer during the add process\n return undefined\n }\n return arg\n })\n}\n\nfunction isTransactionWithSignerArg(arg: AppMethodCallArg): arg is TransactionWithSigner {\n return typeof arg === 'object' && arg !== undefined && 'txn' in arg && 'signer' in arg\n}\n\nfunction isAppCallMethodCallArg(\n arg: AppMethodCallArg,\n): arg is AppMethodCall<AppCreateParams> | AppMethodCall<AppUpdateParams> | AppMethodCall<AppMethodCallParams> {\n return typeof arg === 'object' && arg !== undefined && 'method' in arg\n}\n\nconst isAbiValue = (x: unknown): x is ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n // If x is a POJO literal\n if (Object.getPrototypeOf(x) === Object.getPrototypeOf({})) {\n return Object.values(x as object).every(isAbiValue)\n }\n\n return (\n typeof x === 'bigint' ||\n typeof x === 'boolean' ||\n typeof x === 'number' ||\n typeof x === 'string' ||\n x instanceof Uint8Array ||\n x instanceof Address\n )\n}\n\n/**\n * Prepares method arguments for ABI encoding by building reference arrays and\n * replacing reference-type arguments (account, asset, application) with their indices.\n */\nfunction prepareArgsForEncoding(\n sender: Address,\n appId: bigint,\n method: ABIMethod,\n methodArgs: (ABIValue | undefined)[],\n accountReferences?: Address[],\n appReferences?: bigint[],\n assetReferences?: bigint[],\n): { accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[]; updatedArgs: (ABIValue | undefined)[] } {\n const accounts = [...(accountReferences ?? [])]\n const assets = [...(assetReferences ?? [])]\n const apps = [...(appReferences ?? [])]\n\n const updatedArgs = methodArgs.map((arg, i) => {\n const argType = method.args[i].type\n if (!argTypeIsReference(argType)) {\n return arg\n }\n switch (argType) {\n case 'account': {\n let addr: Address\n if (typeof arg === 'string') {\n addr = getAddress(arg)\n } else if (arg instanceof Uint8Array) {\n addr = new Address(arg)\n } else {\n throw new Error('Invalid value for account')\n }\n\n if (sender.equals(addr)) {\n return 0\n }\n\n const existing = accounts.findIndex((a) => a.equals(addr)) + 1\n if (existing) return existing\n\n accounts.push(addr)\n return accounts.length\n }\n case 'asset': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for asset')\n }\n\n const existing = assets.findIndex((a) => a === arg)\n if (existing === -1) {\n assets.push(arg)\n return assets.length - 1\n }\n\n return existing\n }\n case 'application': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for application')\n }\n\n if (arg === appId) return 0\n\n const existing = apps.findIndex((a) => a === arg) + 1\n if (existing) return existing\n\n apps.push(arg)\n return apps.length\n }\n }\n })\n\n return { accountReferences: accounts, appReferences: apps, assetReferences: assets, updatedArgs }\n}\n\n/**\n * Encode ABI method arguments with tuple packing support\n * Ports the logic from the Rust encode_method_arguments function\n */\nfunction encodeMethodArguments(method: ABIMethod, args: (ABIValue | undefined)[]): Uint8Array[] {\n const encodedArgs = new Array<Uint8Array>()\n\n // Insert method selector at the front\n encodedArgs.push(method.getSelector())\n\n // Get ABI types for non-transaction arguments\n const abiTypes = new Array<ABIType>()\n const abiValues = new Array<ABIValue>()\n\n // Process each method argument\n for (let i = 0; i < method.args.length; i++) {\n const methodArg = method.args[i]\n const argValue = args[i]\n\n if (argTypeIsTransaction(methodArg.type)) {\n // Transaction arguments are not ABI encoded - they're handled separately\n } else if (argTypeIsReference(methodArg.type)) {\n // Reference types are encoded as uint8 indexes\n const referenceType = methodArg.type\n if (typeof argValue === 'number') {\n abiTypes.push(new ABIUintType(8))\n abiValues.push(argValue)\n } else {\n throw new Error(`Invalid reference value for ${referenceType}: ${argValue}`)\n }\n } else if (argValue !== undefined) {\n // Regular ABI value\n abiTypes.push(methodArg.type)\n // it's safe to cast to ABIValue here because the abiType must be ABIValue\n abiValues.push(argValue as ABIValue)\n }\n\n // Skip undefined values (transaction placeholders)\n }\n\n if (abiValues.length !== abiTypes.length) {\n throw new Error('Mismatch in length of non-transaction arguments')\n }\n\n // Apply ARC-4 tuple packing for methods with more than 14 arguments\n // 14 instead of 15 in the ARC-4 because the first argument (method selector) is added separately\n if (abiTypes.length > ARGS_TUPLE_PACKING_THRESHOLD) {\n encodedArgs.push(...encodeArgsWithTuplePacking(abiTypes, abiValues))\n } else {\n encodedArgs.push(...encodeArgsIndividually(abiTypes, abiValues))\n }\n\n return encodedArgs\n}\n\n/**\n * Encode individual ABI values\n */\nfunction encodeArgsIndividually(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n for (let i = 0; i < abiTypes.length; i++) {\n const abiType = abiTypes[i]\n const abiValue = abiValues[i]\n const encoded = abiType.encode(abiValue)\n encodedArgs.push(encoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Encode ABI values with tuple packing for methods with many arguments\n */\nfunction encodeArgsWithTuplePacking(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n // Encode first 14 arguments individually\n const first14AbiTypes = abiTypes.slice(0, ARGS_TUPLE_PACKING_THRESHOLD)\n const first14AbiValues = abiValues.slice(0, ARGS_TUPLE_PACKING_THRESHOLD)\n encodedArgs.push(...encodeArgsIndividually(first14AbiTypes, first14AbiValues))\n\n // Pack remaining arguments into tuple at position 15\n const remainingAbiTypes = abiTypes.slice(ARGS_TUPLE_PACKING_THRESHOLD)\n const remainingAbiValues = abiValues.slice(ARGS_TUPLE_PACKING_THRESHOLD)\n\n if (remainingAbiTypes.length > 0) {\n const tupleType = new ABITupleType(remainingAbiTypes)\n const tupleValue = remainingAbiValues\n const tupleEncoded = tupleType.encode(tupleValue)\n encodedArgs.push(tupleEncoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Builds encoded ABI method arguments and resolves reference arrays\n */\nfunction buildMethodCallArgsAndReferences(params: {\n sender: Address\n appId: bigint\n method: ABIMethod\n args: (ABIValue | undefined)[]\n accountReferences?: Address[]\n appReferences?: bigint[]\n assetReferences?: bigint[]\n}): { args: Uint8Array[]; accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[] } {\n const { accountReferences, appReferences, assetReferences, updatedArgs } = prepareArgsForEncoding(\n params.sender,\n params.appId,\n params.method,\n params.args ?? [],\n params.accountReferences,\n params.appReferences,\n params.assetReferences,\n )\n\n const encodedArgs = encodeMethodArguments(params.method, updatedArgs)\n\n return {\n args: encodedArgs,\n accountReferences,\n appReferences,\n assetReferences,\n }\n}\n\nexport const buildAppCreateMethodCall = async (\n params: ProcessedAppCreateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const globalStateSchema =\n params.schema?.globalByteSlices !== undefined || params.schema?.globalInts !== undefined\n ? {\n numByteSlices: params.schema?.globalByteSlices ?? 0,\n numUints: params.schema?.globalInts ?? 0,\n }\n : undefined\n const localStateSchema =\n params.schema?.localByteSlices !== undefined || params.schema?.localInts !== undefined\n ? {\n numByteSlices: params.schema?.localByteSlices ?? 0,\n numUints: params.schema?.localInts ?? 0,\n }\n : undefined\n const extraProgramPages =\n params.extraProgramPages !== undefined ? params.extraProgramPages : calculateExtraProgramPages(approvalProgram!, clearStateProgram!)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: 0n,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: 0n,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n globalStateSchema: globalStateSchema,\n localStateSchema: localStateSchema,\n extraProgramPages: extraProgramPages,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppUpdateMethodCall = async (\n params: ProcessedAppUpdateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: OnApplicationComplete.UpdateApplication,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppCallMethodCall = async (\n params: ProcessedAppCallMethodCall,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n"],"mappings":";;;;;;;;;;;AAoBA,MAAM,+BAA+B;AAuFrC,SAAgB,mDACd,QACA,cACqC;CACrC,MAAM,uBAAuB,IAAI,OAA0C;CAC3E,MAAM,iBAAiB,OAAO;AAC9B,KAAI,CAAC,eAAgB,QAAO,EAAE;CAG9B,MAAM,gBAAgB,OAAO,SAAU,YAAY,OAAO,SAAS,OAAO,OAAO,SAAS,OAAO,SAAU;AAE3G,MAAK,IAAI,IAAI,GAAG,IAAI,eAAe,QAAQ,KAAK;EAC9C,MAAM,MAAM,eAAe;AAE3B,MAAI,QAAQ,OAEV;AAEF,MAAI,WAAW,IAAI,CAEjB;AAGF,MAAI,2BAA2B,IAAI,EAAE;AACnC,wBAAqB,KAAK;IACxB,MAAM;KACJ,KAAK,IAAI;KACT,QAAQ,IAAI;KACb;IACD,MAAM;IACP,CAAC;AAEF;;AAEF,MAAI,uBAAuB,IAAI,EAAE;GAE/B,MAAM,6BAA6B,mDAAmD,KAAK,cAAc;AACzG,wBAAqB,KAAK,GAAG,2BAA2B;AACxD,wBAAqB,KAAK;IACxB,MAAM;KACJ,GAAG;KACH,QAAQ,IAAI,UAAU;KACtB,MAAM,yBAAyB,IAAI,KAAK;KACzC;IACD,MAAM;IACP,CAA6C;AAE9C;;AAEF,MAAI,eAAe,SAAS;AAC1B,wBAAqB,KAAK;IACxB,MAAM;KACJ,KAAK;KACL,QAAQ;KACT;IACD,MAAM;IACP,CAAC;AACF;;AAGF,uBA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AiC;EACzD,QAAQ,WAAW;EACnB,OAAO,OAAO;EACd,QAAQ,OAAO;EACf,MAAM,OAAO,QAAQ,EAAE;EACJ;EACnB,eAAe,OAAO;EACtB,iBAAiB,OAAO;EACzB,CAAC;CAGF,MAAM,sBAAsB,OAAO,oBAAoB,OAAO,iBAAiB,SAAS;AAExF,QAAO,IAAI,YAAY;EACrB,GAAG;EACH,MAAM,gBAAgB;EACtB,SAAS;GACP,OAAO,OAAO;GACd,YAAY,OAAO,cAAc,sBAAsB;GACvD,MAAM,kBAAkB;GACxB,GAAI,sBACA,EAAE,kBAAkB,OAAO,kBAAkB,GAC7C;IACE,mBAAmB,kBAAkB;IACrC,eAAe,kBAAkB;IACjC,iBAAiB,kBAAkB;IACnC,eAAe,OAAO,eAAe,IAAI,WAAW,gBAAgB;IACrE;GACL,eAAe,OAAO;GACvB;EACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"method-call.mjs","names":["addr: Address","encodedArgs: Uint8Array[]"],"sources":["../../src/transactions/method-call.ts"],"sourcesContent":["import {\n ABIMethod,\n ABITupleType,\n ABIType,\n ABIUintType,\n ABIValue,\n argTypeIsReference,\n argTypeIsTransaction,\n} from '@algorandfoundation/algokit-abi'\nimport { SuggestedParams } from '@algorandfoundation/algokit-algod-client'\nimport { Address, Expand, getAddress } from '@algorandfoundation/algokit-common'\nimport { OnApplicationComplete, Transaction, TransactionSigner, TransactionType } from '@algorandfoundation/algokit-transact'\nimport { TransactionWithSigner } from '../transaction'\nimport { AlgoAmount } from '../types/amount'\nimport { AppManager } from '../types/app-manager'\nimport { calculateExtraProgramPages } from '../util'\nimport { AppCreateParams, AppDeleteParams, AppMethodCallParams, AppUpdateParams } from './app-call'\nimport { buildTransactionCommonData } from './common'\n\nconst ARGS_TUPLE_PACKING_THRESHOLD = 14 // 14+ args trigger tuple packing, excluding the method selector\n\n/** Parameters to define an ABI method call create transaction. */\nexport type AppCreateMethodCall = Expand<AppMethodCall<AppCreateParams>>\n/** Parameters to define an ABI method call update transaction. */\nexport type AppUpdateMethodCall = Expand<AppMethodCall<AppUpdateParams>>\n/** Parameters to define an ABI method call delete transaction. */\nexport type AppDeleteMethodCall = Expand<AppMethodCall<AppDeleteParams>>\n/** Parameters to define an ABI method call transaction. */\nexport type AppCallMethodCall = Expand<AppMethodCall<AppMethodCallParams>>\n\nexport type ProcessedAppCreateMethodCall = Expand<\n Omit<AppCreateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppUpdateMethodCall = Expand<\n Omit<AppUpdateMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\nexport type ProcessedAppCallMethodCall = Expand<\n Omit<AppCallMethodCall, 'args'> & {\n args?: (ABIValue | undefined)[]\n }\n>\n\n/** Types that can be used to define a transaction argument for an ABI call transaction. */\nexport type AppMethodCallTransactionArgument =\n // The following should match the partial `args` types from `AppMethodCall<T>` below\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n\n/** Parameters to define an ABI method call. */\nexport type AppMethodCall<T> = Expand<Omit<T, 'args'>> & {\n /** The ABI method to call */\n method: ABIMethod\n /** Arguments to the ABI method, either:\n * * An ABI value\n * * A transaction with explicit signer\n * * A transaction (where the signer will be automatically assigned)\n * * An unawaited transaction (e.g. from algorand.createTransaction.{transactionType}())\n * * Another method call (via method call params object)\n * * undefined (this represents a placeholder transaction argument that is fulfilled by another method call argument)\n */\n args?: (\n | ABIValue\n // The following should match the above `AppMethodCallTransactionArgument` type above\n | TransactionWithSigner\n | Transaction\n | Promise<Transaction>\n | AppMethodCall<AppCreateParams>\n | AppMethodCall<AppUpdateParams>\n | AppMethodCall<AppMethodCallParams>\n | undefined\n )[]\n}\n\ntype AppMethodCallArgs = AppMethodCall<unknown>['args']\ntype AppMethodCallArg = NonNullable<AppMethodCallArgs>[number]\n\nexport type AsyncTransactionParams = {\n txn: Promise<Transaction>\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\nexport type TransactionParams = {\n txn: Transaction\n signer?: TransactionSigner\n maxFee?: AlgoAmount\n}\n\ntype ExtractedMethodCallTransactionArg =\n | { data: TransactionParams; type: 'txn' }\n | {\n data: AsyncTransactionParams\n type: 'asyncTxn'\n }\n | { data: ProcessedAppCallMethodCall | ProcessedAppCreateMethodCall | ProcessedAppUpdateMethodCall; type: 'methodCall' }\n\nexport function extractComposerTransactionsFromAppMethodCallParams(\n params: AppCallMethodCall | AppCreateMethodCall | AppUpdateMethodCall | AppDeleteMethodCall,\n parentSigner?: TransactionSigner,\n): ExtractedMethodCallTransactionArg[] {\n const composerTransactions = new Array<ExtractedMethodCallTransactionArg>()\n const methodCallArgs = params.args\n if (!methodCallArgs) return []\n\n // Extract signer from params, falling back to parentSigner\n const currentSigner = params.signer ? ('signer' in params.signer ? params.signer.signer : params.signer) : parentSigner\n\n for (let i = 0; i < methodCallArgs.length; i++) {\n const arg = methodCallArgs[i]\n\n if (arg === undefined) {\n // is a transaction or default value placeholder, do nothing\n continue\n }\n if (isAbiValue(arg)) {\n // if is ABI value, also ignore\n continue\n }\n\n if (isTransactionWithSignerArg(arg)) {\n composerTransactions.push({\n data: {\n txn: arg.txn,\n signer: arg.signer,\n },\n type: 'txn',\n })\n\n continue\n }\n if (isAppCallMethodCallArg(arg)) {\n // Recursively extract nested method call transactions, passing the nested call itself and current signer as parent\n const nestedComposerTransactions = extractComposerTransactionsFromAppMethodCallParams(arg, currentSigner)\n composerTransactions.push(...nestedComposerTransactions)\n composerTransactions.push({\n data: {\n ...arg,\n signer: arg.signer ?? currentSigner,\n args: processAppMethodCallArgs(arg.args),\n },\n type: 'methodCall',\n } satisfies ExtractedMethodCallTransactionArg)\n\n continue\n }\n if (arg instanceof Promise) {\n composerTransactions.push({\n data: {\n txn: arg,\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n continue\n }\n\n composerTransactions.push({\n data: {\n txn: Promise.resolve(arg),\n signer: currentSigner,\n },\n type: 'asyncTxn',\n })\n }\n\n return composerTransactions\n}\n\nexport function processAppMethodCallArgs(args: AppMethodCallArg[] | undefined): (ABIValue | undefined)[] | undefined {\n if (args === undefined) return undefined\n\n return args.map((arg) => {\n if (arg === undefined) {\n // Handle explicit placeholders (either transaction or default value)\n return undefined\n } else if (!isAbiValue(arg)) {\n // If the arg is not an ABIValue, it's must be a transaction, set to undefined\n // transaction arguments should be flattened out and added into the composer during the add process\n return undefined\n }\n return arg\n })\n}\n\nfunction isTransactionWithSignerArg(arg: AppMethodCallArg): arg is TransactionWithSigner {\n return typeof arg === 'object' && arg !== undefined && 'txn' in arg && 'signer' in arg\n}\n\nfunction isAppCallMethodCallArg(\n arg: AppMethodCallArg,\n): arg is AppMethodCall<AppCreateParams> | AppMethodCall<AppUpdateParams> | AppMethodCall<AppMethodCallParams> {\n return typeof arg === 'object' && arg !== undefined && 'method' in arg\n}\n\nconst isAbiValue = (x: unknown): x is ABIValue => {\n if (Array.isArray(x)) return x.length == 0 || x.every(isAbiValue)\n\n // If x is a POJO literal\n if (Object.getPrototypeOf(x) === Object.getPrototypeOf({})) {\n return Object.values(x as object).every(isAbiValue)\n }\n\n return (\n typeof x === 'bigint' ||\n typeof x === 'boolean' ||\n typeof x === 'number' ||\n typeof x === 'string' ||\n x instanceof Uint8Array ||\n x instanceof Address\n )\n}\n\n/**\n * Prepares method arguments for ABI encoding by building reference arrays and\n * replacing reference-type arguments (account, asset, application) with their indices.\n */\nfunction prepareArgsForEncoding(\n sender: Address,\n appId: bigint,\n method: ABIMethod,\n methodArgs: (ABIValue | undefined)[],\n accountReferences?: Address[],\n appReferences?: bigint[],\n assetReferences?: bigint[],\n): { accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[]; updatedArgs: (ABIValue | undefined)[] } {\n const accounts = [...(accountReferences ?? [])]\n const assets = [...(assetReferences ?? [])]\n const apps = [...(appReferences ?? [])]\n\n const updatedArgs = methodArgs.map((arg, i) => {\n const argType = method.args[i].type\n if (!argTypeIsReference(argType)) {\n return arg\n }\n switch (argType) {\n case 'account': {\n let addr: Address\n if (typeof arg === 'string') {\n addr = getAddress(arg)\n } else if (arg instanceof Uint8Array) {\n addr = new Address(arg)\n } else {\n throw new Error('Invalid value for account')\n }\n\n if (sender.equals(addr)) {\n return 0\n }\n\n const existing = accounts.findIndex((a) => a.equals(addr)) + 1\n if (existing) return existing\n\n accounts.push(addr)\n return accounts.length\n }\n case 'asset': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for asset')\n }\n\n const existing = assets.findIndex((a) => a === arg)\n if (existing === -1) {\n assets.push(arg)\n return assets.length - 1\n }\n\n return existing\n }\n case 'application': {\n if (typeof arg !== 'bigint') {\n throw new Error('Invalid value for application')\n }\n\n if (arg === appId) return 0\n\n const existing = apps.findIndex((a) => a === arg) + 1\n if (existing) return existing\n\n apps.push(arg)\n return apps.length\n }\n }\n })\n\n return { accountReferences: accounts, appReferences: apps, assetReferences: assets, updatedArgs }\n}\n\n/**\n * Encode ABI method arguments with tuple packing support\n * Ports the logic from the Rust encode_method_arguments function\n */\nfunction encodeMethodArguments(method: ABIMethod, args: (ABIValue | undefined)[]): Uint8Array[] {\n const encodedArgs = new Array<Uint8Array>()\n\n // Insert method selector at the front\n encodedArgs.push(method.getSelector())\n\n // Get ABI types for non-transaction arguments\n const abiTypes = new Array<ABIType>()\n const abiValues = new Array<ABIValue>()\n\n // Process each method argument\n for (let i = 0; i < method.args.length; i++) {\n const methodArg = method.args[i]\n const argValue = args[i]\n\n if (argTypeIsTransaction(methodArg.type)) {\n // Transaction arguments are not ABI encoded - they're handled separately\n } else if (argTypeIsReference(methodArg.type)) {\n // Reference types are encoded as uint8 indexes\n const referenceType = methodArg.type\n if (typeof argValue === 'number') {\n abiTypes.push(new ABIUintType(8))\n abiValues.push(argValue)\n } else {\n throw new Error(`Invalid reference value for ${referenceType}: ${argValue}`)\n }\n } else if (argValue !== undefined) {\n // Regular ABI value\n abiTypes.push(methodArg.type)\n // it's safe to cast to ABIValue here because the abiType must be ABIValue\n abiValues.push(argValue as ABIValue)\n }\n\n // Skip undefined values (transaction placeholders)\n }\n\n if (abiValues.length !== abiTypes.length) {\n throw new Error('Mismatch in length of non-transaction arguments')\n }\n\n // Apply ARC-4 tuple packing for methods with more than 14 arguments\n // 14 instead of 15 in the ARC-4 because the first argument (method selector) is added separately\n if (abiTypes.length > ARGS_TUPLE_PACKING_THRESHOLD) {\n encodedArgs.push(...encodeArgsWithTuplePacking(abiTypes, abiValues))\n } else {\n encodedArgs.push(...encodeArgsIndividually(abiTypes, abiValues))\n }\n\n return encodedArgs\n}\n\n/**\n * Encode individual ABI values\n */\nfunction encodeArgsIndividually(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n for (let i = 0; i < abiTypes.length; i++) {\n const abiType = abiTypes[i]\n const abiValue = abiValues[i]\n const encoded = abiType.encode(abiValue)\n encodedArgs.push(encoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Encode ABI values with tuple packing for methods with many arguments\n */\nfunction encodeArgsWithTuplePacking(abiTypes: ABIType[], abiValues: ABIValue[]): Uint8Array[] {\n const encodedArgs: Uint8Array[] = []\n\n // Encode first 14 arguments individually\n const first14AbiTypes = abiTypes.slice(0, ARGS_TUPLE_PACKING_THRESHOLD)\n const first14AbiValues = abiValues.slice(0, ARGS_TUPLE_PACKING_THRESHOLD)\n encodedArgs.push(...encodeArgsIndividually(first14AbiTypes, first14AbiValues))\n\n // Pack remaining arguments into tuple at position 15\n const remainingAbiTypes = abiTypes.slice(ARGS_TUPLE_PACKING_THRESHOLD)\n const remainingAbiValues = abiValues.slice(ARGS_TUPLE_PACKING_THRESHOLD)\n\n if (remainingAbiTypes.length > 0) {\n const tupleType = new ABITupleType(remainingAbiTypes)\n const tupleValue = remainingAbiValues\n const tupleEncoded = tupleType.encode(tupleValue)\n encodedArgs.push(tupleEncoded)\n }\n\n return encodedArgs\n}\n\n/**\n * Builds encoded ABI method arguments and resolves reference arrays\n */\nfunction buildMethodCallArgsAndReferences(params: {\n sender: Address\n appId: bigint\n method: ABIMethod\n args: (ABIValue | undefined)[]\n accountReferences?: Address[]\n appReferences?: bigint[]\n assetReferences?: bigint[]\n}): { args: Uint8Array[]; accountReferences: Address[]; appReferences: bigint[]; assetReferences: bigint[] } {\n const { accountReferences, appReferences, assetReferences, updatedArgs } = prepareArgsForEncoding(\n params.sender,\n params.appId,\n params.method,\n params.args ?? [],\n params.accountReferences,\n params.appReferences,\n params.assetReferences,\n )\n\n const encodedArgs = encodeMethodArguments(params.method, updatedArgs)\n\n return {\n args: encodedArgs,\n accountReferences,\n appReferences,\n assetReferences,\n }\n}\n\nexport const buildAppCreateMethodCall = async (\n params: ProcessedAppCreateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const globalStateSchema =\n params.schema?.globalByteSlices !== undefined || params.schema?.globalInts !== undefined\n ? {\n numByteSlices: params.schema?.globalByteSlices ?? 0,\n numUints: params.schema?.globalInts ?? 0,\n }\n : undefined\n const localStateSchema =\n params.schema?.localByteSlices !== undefined || params.schema?.localInts !== undefined\n ? {\n numByteSlices: params.schema?.localByteSlices ?? 0,\n numUints: params.schema?.localInts ?? 0,\n }\n : undefined\n const extraProgramPages =\n params.extraProgramPages !== undefined ? params.extraProgramPages : calculateExtraProgramPages(approvalProgram!, clearStateProgram!)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: 0n,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: 0n,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n globalStateSchema: globalStateSchema,\n localStateSchema: localStateSchema,\n extraProgramPages: extraProgramPages,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppUpdateMethodCall = async (\n params: ProcessedAppUpdateMethodCall,\n appManager: AppManager,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const approvalProgram =\n typeof params.approvalProgram === 'string'\n ? (await appManager.compileTeal(params.approvalProgram)).compiledBase64ToBytes\n : params.approvalProgram\n const clearStateProgram =\n typeof params.clearStateProgram === 'string'\n ? (await appManager.compileTeal(params.clearStateProgram)).compiledBase64ToBytes\n : params.clearStateProgram\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: OnApplicationComplete.UpdateApplication,\n approvalProgram: approvalProgram,\n clearStateProgram: clearStateProgram,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n\nexport const buildAppCallMethodCall = async (\n params: ProcessedAppCallMethodCall,\n suggestedParams: SuggestedParams,\n defaultValidityWindow: bigint,\n): Promise<Transaction> => {\n const commonData = buildTransactionCommonData(params, suggestedParams, defaultValidityWindow)\n const accountReferences = params.accountReferences?.map((a) => getAddress(a))\n const argsAndReferences = buildMethodCallArgsAndReferences({\n sender: commonData.sender,\n appId: params.appId,\n method: params.method,\n args: params.args ?? [],\n accountReferences: accountReferences,\n appReferences: params.appReferences,\n assetReferences: params.assetReferences,\n })\n\n // If accessReferences is provided, we should not pass legacy foreign arrays\n const hasAccessReferences = params.accessReferences && params.accessReferences.length > 0\n\n return new Transaction({\n ...commonData,\n type: TransactionType.AppCall,\n appCall: {\n appId: params.appId,\n onComplete: params.onComplete ?? OnApplicationComplete.NoOp,\n args: argsAndReferences.args,\n ...(hasAccessReferences\n ? { accessReferences: params.accessReferences }\n : {\n accountReferences: argsAndReferences.accountReferences,\n appReferences: argsAndReferences.appReferences,\n assetReferences: argsAndReferences.assetReferences,\n boxReferences: params.boxReferences?.map(AppManager.getBoxReference),\n }),\n rejectVersion: params.rejectVersion,\n },\n })\n}\n"],"mappings":";;;;;;;;;;;AAmBA,MAAM,+BAA+B;AAuFrC,SAAgB,mDACd,QACA,cACqC;CACrC,MAAM,uBAAuB,IAAI,OAA0C;CAC3E,MAAM,iBAAiB,OAAO;AAC9B,KAAI,CAAC,eAAgB,QAAO,EAAE;CAG9B,MAAM,gBAAgB,OAAO,SAAU,YAAY,OAAO,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@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReadableAddress } from "../packages/common/src/address.js";
|
|
2
|
+
import { Expand } from "../packages/common/src/expand.js";
|
|
2
3
|
import { ABIValue } from "../packages/abi/src/abi-value.js";
|
|
3
4
|
import { ABIMethod } from "../packages/abi/src/abi-method.js";
|
|
4
5
|
import { OnApplicationComplete, ResourceReference } from "../packages/transact/src/transactions/app-call.js";
|
|
@@ -6,7 +7,6 @@ import { Transaction } from "../packages/transact/src/transactions/transaction.j
|
|
|
6
7
|
import { AddressWithTransactionSigner, SendingAddress, TransactionSigner } from "../packages/transact/src/signer.js";
|
|
7
8
|
import { AlgoAmount } from "./amount.js";
|
|
8
9
|
import { BoxIdentifier, BoxReference } from "./app-manager.js";
|
|
9
|
-
import { Expand } from "./expand.js";
|
|
10
10
|
import { AppCallParams, AppDeleteParams, AppMethodCallParams } from "../transactions/app-call.js";
|
|
11
11
|
import { AssetOptInParams, AssetOptOutParams, AssetTransferParams } from "../transactions/asset-transfer.js";
|
|
12
12
|
import { AssetConfigParams, AssetCreateParams, AssetDestroyParams, AssetFreezeParams } from "../transactions/asset-config.js";
|
|
@@ -348,8 +348,8 @@ declare class AlgorandClientTransactionCreator {
|
|
|
348
348
|
* @returns The application create transaction
|
|
349
349
|
*/
|
|
350
350
|
appCreate: (params: {
|
|
351
|
-
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
352
351
|
sender: SendingAddress;
|
|
352
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
353
353
|
rekeyTo?: ReadableAddress | undefined;
|
|
354
354
|
note?: string | Uint8Array | undefined;
|
|
355
355
|
lease?: string | Uint8Array | undefined;
|
|
@@ -364,7 +364,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
364
364
|
accountReferences?: ReadableAddress[] | undefined;
|
|
365
365
|
appReferences?: bigint[] | undefined;
|
|
366
366
|
assetReferences?: bigint[] | undefined;
|
|
367
|
-
boxReferences?: (
|
|
367
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
368
368
|
accessReferences?: ResourceReference[] | undefined;
|
|
369
369
|
rejectVersion?: number | undefined;
|
|
370
370
|
appId?: 0 | undefined;
|
|
@@ -433,7 +433,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
433
433
|
accountReferences?: ReadableAddress[] | undefined;
|
|
434
434
|
appReferences?: bigint[] | undefined;
|
|
435
435
|
assetReferences?: bigint[] | undefined;
|
|
436
|
-
boxReferences?: (
|
|
436
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
437
437
|
accessReferences?: ResourceReference[] | undefined;
|
|
438
438
|
rejectVersion?: number | undefined;
|
|
439
439
|
approvalProgram: string | Uint8Array;
|
|
@@ -568,8 +568,9 @@ declare class AlgorandClientTransactionCreator {
|
|
|
568
568
|
* @returns The application ABI method create transaction
|
|
569
569
|
*/
|
|
570
570
|
appCreateMethodCall: (params: {
|
|
571
|
-
|
|
571
|
+
appId?: 0 | undefined;
|
|
572
572
|
sender: SendingAddress;
|
|
573
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
573
574
|
rekeyTo?: ReadableAddress | undefined;
|
|
574
575
|
note?: string | Uint8Array | undefined;
|
|
575
576
|
lease?: string | Uint8Array | undefined;
|
|
@@ -579,27 +580,26 @@ declare class AlgorandClientTransactionCreator {
|
|
|
579
580
|
validityWindow?: number | bigint | undefined;
|
|
580
581
|
firstValidRound?: bigint | undefined;
|
|
581
582
|
lastValidRound?: bigint | undefined;
|
|
582
|
-
schema?: {
|
|
583
|
-
globalInts: number;
|
|
584
|
-
globalByteSlices: number;
|
|
585
|
-
localInts: number;
|
|
586
|
-
localByteSlices: number;
|
|
587
|
-
} | undefined;
|
|
588
|
-
approvalProgram: string | Uint8Array;
|
|
589
|
-
clearStateProgram: string | Uint8Array;
|
|
590
|
-
appId?: 0 | undefined;
|
|
591
583
|
onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.UpdateApplication | OnApplicationComplete.DeleteApplication | undefined;
|
|
592
584
|
accountReferences?: ReadableAddress[] | undefined;
|
|
593
585
|
appReferences?: bigint[] | undefined;
|
|
594
586
|
assetReferences?: bigint[] | undefined;
|
|
595
|
-
boxReferences?: (
|
|
587
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
596
588
|
accessReferences?: ResourceReference[] | undefined;
|
|
597
589
|
rejectVersion?: number | undefined;
|
|
590
|
+
approvalProgram: string | Uint8Array;
|
|
591
|
+
clearStateProgram: string | Uint8Array;
|
|
592
|
+
schema?: {
|
|
593
|
+
globalInts: number;
|
|
594
|
+
globalByteSlices: number;
|
|
595
|
+
localInts: number;
|
|
596
|
+
localByteSlices: number;
|
|
597
|
+
} | undefined;
|
|
598
598
|
extraProgramPages?: number | undefined;
|
|
599
599
|
method: ABIMethod;
|
|
600
|
-
args?: (Transaction |
|
|
601
|
-
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
600
|
+
args?: (Transaction | Promise<Transaction> | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
602
601
|
sender: SendingAddress;
|
|
602
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
603
603
|
rekeyTo?: ReadableAddress | undefined;
|
|
604
604
|
note?: string | Uint8Array | undefined;
|
|
605
605
|
lease?: string | Uint8Array | undefined;
|
|
@@ -614,7 +614,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
614
614
|
accountReferences?: ReadableAddress[] | undefined;
|
|
615
615
|
appReferences?: bigint[] | undefined;
|
|
616
616
|
assetReferences?: bigint[] | undefined;
|
|
617
|
-
boxReferences?: (
|
|
617
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
618
618
|
accessReferences?: ResourceReference[] | undefined;
|
|
619
619
|
rejectVersion?: number | undefined;
|
|
620
620
|
appId?: 0 | undefined;
|
|
@@ -645,7 +645,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
645
645
|
accountReferences?: ReadableAddress[] | undefined;
|
|
646
646
|
appReferences?: bigint[] | undefined;
|
|
647
647
|
assetReferences?: bigint[] | undefined;
|
|
648
|
-
boxReferences?: (
|
|
648
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
649
649
|
accessReferences?: ResourceReference[] | undefined;
|
|
650
650
|
rejectVersion?: number | undefined;
|
|
651
651
|
approvalProgram: string | Uint8Array;
|
|
@@ -702,8 +702,9 @@ declare class AlgorandClientTransactionCreator {
|
|
|
702
702
|
* @returns The application ABI method update transaction
|
|
703
703
|
*/
|
|
704
704
|
appUpdateMethodCall: (params: {
|
|
705
|
-
|
|
705
|
+
appId: bigint;
|
|
706
706
|
sender: SendingAddress;
|
|
707
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
707
708
|
rekeyTo?: ReadableAddress | undefined;
|
|
708
709
|
note?: string | Uint8Array | undefined;
|
|
709
710
|
lease?: string | Uint8Array | undefined;
|
|
@@ -713,20 +714,19 @@ declare class AlgorandClientTransactionCreator {
|
|
|
713
714
|
validityWindow?: number | bigint | undefined;
|
|
714
715
|
firstValidRound?: bigint | undefined;
|
|
715
716
|
lastValidRound?: bigint | undefined;
|
|
716
|
-
approvalProgram: string | Uint8Array;
|
|
717
|
-
clearStateProgram: string | Uint8Array;
|
|
718
|
-
appId: bigint;
|
|
719
717
|
onComplete?: OnApplicationComplete.UpdateApplication | undefined;
|
|
720
718
|
accountReferences?: ReadableAddress[] | undefined;
|
|
721
719
|
appReferences?: bigint[] | undefined;
|
|
722
720
|
assetReferences?: bigint[] | undefined;
|
|
723
|
-
boxReferences?: (
|
|
721
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
724
722
|
accessReferences?: ResourceReference[] | undefined;
|
|
725
723
|
rejectVersion?: number | undefined;
|
|
724
|
+
approvalProgram: string | Uint8Array;
|
|
725
|
+
clearStateProgram: string | Uint8Array;
|
|
726
726
|
method: ABIMethod;
|
|
727
|
-
args?: (Transaction |
|
|
728
|
-
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
727
|
+
args?: (Transaction | Promise<Transaction> | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
729
728
|
sender: SendingAddress;
|
|
729
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
730
730
|
rekeyTo?: ReadableAddress | undefined;
|
|
731
731
|
note?: string | Uint8Array | undefined;
|
|
732
732
|
lease?: string | Uint8Array | undefined;
|
|
@@ -741,7 +741,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
741
741
|
accountReferences?: ReadableAddress[] | undefined;
|
|
742
742
|
appReferences?: bigint[] | undefined;
|
|
743
743
|
assetReferences?: bigint[] | undefined;
|
|
744
|
-
boxReferences?: (
|
|
744
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
745
745
|
accessReferences?: ResourceReference[] | undefined;
|
|
746
746
|
rejectVersion?: number | undefined;
|
|
747
747
|
appId?: 0 | undefined;
|
|
@@ -772,7 +772,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
772
772
|
accountReferences?: ReadableAddress[] | undefined;
|
|
773
773
|
appReferences?: bigint[] | undefined;
|
|
774
774
|
assetReferences?: bigint[] | undefined;
|
|
775
|
-
boxReferences?: (
|
|
775
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
776
776
|
accessReferences?: ResourceReference[] | undefined;
|
|
777
777
|
rejectVersion?: number | undefined;
|
|
778
778
|
approvalProgram: string | Uint8Array;
|
|
@@ -827,8 +827,9 @@ declare class AlgorandClientTransactionCreator {
|
|
|
827
827
|
* @returns The application ABI method delete transaction
|
|
828
828
|
*/
|
|
829
829
|
appDeleteMethodCall: (params: {
|
|
830
|
-
|
|
830
|
+
appId: bigint;
|
|
831
831
|
sender: SendingAddress;
|
|
832
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
832
833
|
rekeyTo?: ReadableAddress | undefined;
|
|
833
834
|
note?: string | Uint8Array | undefined;
|
|
834
835
|
lease?: string | Uint8Array | undefined;
|
|
@@ -838,18 +839,17 @@ declare class AlgorandClientTransactionCreator {
|
|
|
838
839
|
validityWindow?: number | bigint | undefined;
|
|
839
840
|
firstValidRound?: bigint | undefined;
|
|
840
841
|
lastValidRound?: bigint | undefined;
|
|
841
|
-
appId: bigint;
|
|
842
842
|
onComplete?: OnApplicationComplete.DeleteApplication | undefined;
|
|
843
843
|
accountReferences?: ReadableAddress[] | undefined;
|
|
844
844
|
appReferences?: bigint[] | undefined;
|
|
845
845
|
assetReferences?: bigint[] | undefined;
|
|
846
|
-
boxReferences?: (
|
|
846
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
847
847
|
accessReferences?: ResourceReference[] | undefined;
|
|
848
848
|
rejectVersion?: number | undefined;
|
|
849
849
|
method: ABIMethod;
|
|
850
|
-
args?: (Transaction |
|
|
851
|
-
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
850
|
+
args?: (Transaction | Promise<Transaction> | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
852
851
|
sender: SendingAddress;
|
|
852
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
853
853
|
rekeyTo?: ReadableAddress | undefined;
|
|
854
854
|
note?: string | Uint8Array | undefined;
|
|
855
855
|
lease?: string | Uint8Array | undefined;
|
|
@@ -864,7 +864,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
864
864
|
accountReferences?: ReadableAddress[] | undefined;
|
|
865
865
|
appReferences?: bigint[] | undefined;
|
|
866
866
|
assetReferences?: bigint[] | undefined;
|
|
867
|
-
boxReferences?: (
|
|
867
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
868
868
|
accessReferences?: ResourceReference[] | undefined;
|
|
869
869
|
rejectVersion?: number | undefined;
|
|
870
870
|
appId?: 0 | undefined;
|
|
@@ -895,7 +895,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
895
895
|
accountReferences?: ReadableAddress[] | undefined;
|
|
896
896
|
appReferences?: bigint[] | undefined;
|
|
897
897
|
assetReferences?: bigint[] | undefined;
|
|
898
|
-
boxReferences?: (
|
|
898
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
899
899
|
accessReferences?: ResourceReference[] | undefined;
|
|
900
900
|
rejectVersion?: number | undefined;
|
|
901
901
|
approvalProgram: string | Uint8Array;
|
|
@@ -950,8 +950,9 @@ declare class AlgorandClientTransactionCreator {
|
|
|
950
950
|
* @returns The application ABI method call transaction
|
|
951
951
|
*/
|
|
952
952
|
appCallMethodCall: (params: {
|
|
953
|
-
|
|
953
|
+
appId: bigint;
|
|
954
954
|
sender: SendingAddress;
|
|
955
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
955
956
|
rekeyTo?: ReadableAddress | undefined;
|
|
956
957
|
note?: string | Uint8Array | undefined;
|
|
957
958
|
lease?: string | Uint8Array | undefined;
|
|
@@ -961,18 +962,17 @@ declare class AlgorandClientTransactionCreator {
|
|
|
961
962
|
validityWindow?: number | bigint | undefined;
|
|
962
963
|
firstValidRound?: bigint | undefined;
|
|
963
964
|
lastValidRound?: bigint | undefined;
|
|
964
|
-
appId: bigint;
|
|
965
965
|
onComplete?: OnApplicationComplete.NoOp | OnApplicationComplete.OptIn | OnApplicationComplete.CloseOut | OnApplicationComplete.DeleteApplication | undefined;
|
|
966
966
|
accountReferences?: ReadableAddress[] | undefined;
|
|
967
967
|
appReferences?: bigint[] | undefined;
|
|
968
968
|
assetReferences?: bigint[] | undefined;
|
|
969
|
-
boxReferences?: (
|
|
969
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
970
970
|
accessReferences?: ResourceReference[] | undefined;
|
|
971
971
|
rejectVersion?: number | undefined;
|
|
972
972
|
method: ABIMethod;
|
|
973
|
-
args?: (Transaction |
|
|
974
|
-
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
973
|
+
args?: (Transaction | Promise<Transaction> | ABIValue | TransactionWithSigner | AppMethodCall<{
|
|
975
974
|
sender: SendingAddress;
|
|
975
|
+
signer?: TransactionSigner | AddressWithTransactionSigner | undefined;
|
|
976
976
|
rekeyTo?: ReadableAddress | undefined;
|
|
977
977
|
note?: string | Uint8Array | undefined;
|
|
978
978
|
lease?: string | Uint8Array | undefined;
|
|
@@ -987,7 +987,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
987
987
|
accountReferences?: ReadableAddress[] | undefined;
|
|
988
988
|
appReferences?: bigint[] | undefined;
|
|
989
989
|
assetReferences?: bigint[] | undefined;
|
|
990
|
-
boxReferences?: (
|
|
990
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
991
991
|
accessReferences?: ResourceReference[] | undefined;
|
|
992
992
|
rejectVersion?: number | undefined;
|
|
993
993
|
appId?: 0 | undefined;
|
|
@@ -1018,7 +1018,7 @@ declare class AlgorandClientTransactionCreator {
|
|
|
1018
1018
|
accountReferences?: ReadableAddress[] | undefined;
|
|
1019
1019
|
appReferences?: bigint[] | undefined;
|
|
1020
1020
|
assetReferences?: bigint[] | undefined;
|
|
1021
|
-
boxReferences?: (
|
|
1021
|
+
boxReferences?: (BoxReference | BoxIdentifier)[] | undefined;
|
|
1022
1022
|
accessReferences?: ResourceReference[] | undefined;
|
|
1023
1023
|
rejectVersion?: number | undefined;
|
|
1024
1024
|
approvalProgram: string | Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-client-transaction-creator.js","names":[],"sources":["../../src/types/algorand-client-transaction-creator.ts"],"sourcesContent":["import { Transaction } from '@algorandfoundation/algokit-transact'\nimport { BuiltTransactions, TransactionComposer, TransactionComposerConfig } from './composer'\nimport { Expand } from './expand'\n\n/** Orchestrates creating transactions for `AlgorandClient`. */\nexport class AlgorandClientTransactionCreator {\n private _newGroup: () => TransactionComposer\n\n /**\n * Creates a new `AlgorandClientTransactionCreator`\n * @param newGroup A lambda that starts a new `TransactionComposer` transaction group\n * @example\n * ```typescript\n * const transactionCreator = new AlgorandClientTransactionCreator(() => new TransactionComposer())\n * ```\n */\n constructor(newGroup: (config?: TransactionComposerConfig) => TransactionComposer) {\n this._newGroup = newGroup\n }\n\n private _transaction<T>(c: (c: TransactionComposer) => (params: T) => TransactionComposer): (params: T) => Promise<Transaction> {\n return async (params: T) => {\n const composer = this._newGroup()\n const result = await c(composer).apply(composer, [params]).buildTransactions()\n return result.transactions.at(-1)!\n }\n }\n\n private _transactions<T>(\n c: (c: TransactionComposer) => (params: T) => TransactionComposer,\n ): (params: T) => Promise<Expand<BuiltTransactions>> {\n return async (params: T) => {\n const composer = this._newGroup()\n return await c(composer).apply(composer, [params]).buildTransactions()\n }\n }\n\n /**\n * Create a payment transaction to transfer Algo between accounts.\n * @param params The parameters for the payment transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.payment({\n * sender: 'SENDERADDRESS',\n * receiver: 'RECEIVERADDRESS',\n * amount: (4).algo(),\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.payment({\n * amount: (4).algo(),\n * receiver: 'RECEIVERADDRESS',\n * sender: 'SENDERADDRESS',\n * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The payment transaction\n */\n payment = this._transaction((c) => c.addPayment)\n /** Create a create Algorand Standard Asset transaction.\n *\n * The account that sends this transaction will automatically be\n * opted in to the asset and will hold all units after creation.\n *\n * @param params The parameters for the asset creation transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetCreate({ sender: \"CREATORADDRESS\", total: 100n})\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetCreate({\n * sender: 'CREATORADDRESS',\n * total: 100n,\n * decimals: 2,\n * assetName: 'asset',\n * unitName: 'unit',\n * url: 'url',\n * metadataHash: 'metadataHash',\n * defaultFrozen: false,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset create transaction\n */\n assetCreate = this._transaction((c) => c.addAssetCreate)\n /** Create an asset config transaction to reconfigure an existing Algorand Standard Asset.\n *\n * **Note:** The manager, reserve, freeze, and clawback addresses\n * are immutably empty if they are not set. If manager is not set then\n * all fields are immutable from that point forward.\n *\n * @param params The parameters for the asset config transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetConfig({ sender: \"MANAGERADDRESS\", assetId: 123456n, manager: \"MANAGERADDRESS\" })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetConfig({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset config transaction\n */\n assetConfig = this._transaction((c) => c.addAssetConfig)\n /** Create an Algorand Standard Asset freeze transaction.\n *\n * @param params The parameters for the asset freeze transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetFreeze({ sender: \"MANAGERADDRESS\", assetId: 123456n, account: \"ACCOUNTADDRESS\", frozen: true })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetFreeze({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * account: 'ACCOUNTADDRESS',\n * frozen: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset freeze transaction\n */\n assetFreeze = this._transaction((c) => c.addAssetFreeze)\n /** Create an Algorand Standard Asset destroy transaction.\n *\n * Created assets can be destroyed only by the asset manager account.\n * All of the assets must be owned by the creator of the asset before\n * the asset can be deleted.\n *\n * @param params The parameters for the asset destroy transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetDestroy({ sender: \"MANAGERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetDestroy({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset destroy transaction\n */\n assetDestroy = this._transaction((c) => c.addAssetDestroy)\n /** Create an Algorand Standard Asset transfer transaction.\n *\n * @param params The parameters for the asset transfer transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetTransfer({ sender: \"HOLDERADDRESS\", assetId: 123456n, amount: 1n, receiver: \"RECEIVERADDRESS\" })\n * ```\n * @example Advanced example (with clawback)\n * ```typescript\n * await algorand.createTransaction.assetTransfer({\n * sender: 'CLAWBACKADDRESS',\n * assetId: 123456n,\n * amount: 1n,\n * receiver: 'RECEIVERADDRESS',\n * clawbackTarget: 'HOLDERADDRESS',\n * // This field needs to be used with caution\n * closeAssetTo: 'ADDRESSTOCLOSETO'\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The result of the asset transfer transaction\n */\n assetTransfer = this._transaction((c) => c.addAssetTransfer)\n /** Create an Algorand Standard Asset opt-in transaction.\n *\n * @param params The parameters for the asset opt-in transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetOptIn({ sender: \"SENDERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetOptIn({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset opt-in transaction\n */\n assetOptIn = this._transaction((c) => c.addAssetOptIn)\n /** Create an asset opt-out transaction.\n *\n * *Note:* If the account has a balance of the asset,\n * it will lose those assets\n *\n * @param params The parameters for the asset opt-out transaction\n *\n * @example Basic example (without creator, will be retrieved from algod)\n * ```typescript\n * await algorand.createTransaction.assetOptOut({ sender: \"SENDERADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Basic example (with creator)\n * ```typescript\n * await algorand.createTransaction.assetOptOut({ sender: \"SENDERADDRESS\", creator: \"CREATORADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetOptOut({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * creator: 'CREATORADDRESS',\n * ensureZeroBalance: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset opt-out transaction\n */\n assetOptOut = this._transaction((c) => c.addAssetOptOut)\n /** Create an application create transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app creation transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appCreate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application create transaction\n */\n appCreate = this._transaction((c) => c.addAppCreate)\n /** Create an application update transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app update transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appUpdate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: OnApplicationComplete.UpdateApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application update transaction\n */\n appUpdate = this._transaction((c) => c.addAppUpdate)\n /** Create an application delete transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app deletion transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appDelete({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appDelete({\n * sender: 'CREATORADDRESS',\n * onComplete: OnApplicationComplete.DeleteApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application delete transaction\n */\n appDelete = this._transaction((c) => c.addAppDelete)\n /** Create an application call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app call transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appCall({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appCall({\n * sender: 'CREATORADDRESS',\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application call transaction\n */\n appCall = this._transaction((c) => c.addAppCall)\n /** Create an application create call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app creation transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCreateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method create transaction\n */\n appCreateMethodCall = this._transactions((c) => c.addAppCreateMethodCall)\n /** Create an application update call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app update transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appUpdateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: OnApplicationComplete.UpdateApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method update transaction\n */\n appUpdateMethodCall = this._transactions((c) => c.addAppUpdateMethodCall)\n /** Create an application delete call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app deletion transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appDeleteMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: OnApplicationComplete.DeleteApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method delete transaction\n */\n appDeleteMethodCall = this._transactions((c) => c.addAppDeleteMethodCall)\n /** Create an application call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app call transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCallMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method call transaction\n */\n appCallMethodCall = this._transactions((c) => c.addAppCallMethodCall)\n /**\n * Create an online key registration transaction.\n * @param params The parameters for the key registration transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.onlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.onlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The online key registration transaction\n */\n onlineKeyRegistration = this._transaction((c) => c.addOnlineKeyRegistration)\n /**\n * Create an offline key registration transaction.\n * @param params The parameters for the key registration transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.offlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.offlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The offline key registration transaction\n */\n offlineKeyRegistration = this._transaction((c) => c.addOfflineKeyRegistration)\n}\n"],"mappings":";;;AAKA,IAAa,mCAAb,MAA8C;CAC5C,AAAQ;;;;;;;;;CAUR,YAAY,UAAuE;AACjF,OAAK,YAAY;;CAGnB,AAAQ,aAAgB,GAAwG;AAC9H,SAAO,OAAO,WAAc;GAC1B,MAAM,WAAW,KAAK,WAAW;AAEjC,WADe,MAAM,EAAE,SAAS,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAChE,aAAa,GAAG,GAAG;;;CAIrC,AAAQ,cACN,GACmD;AACnD,SAAO,OAAO,WAAc;GAC1B,MAAM,WAAW,KAAK,WAAW;AACjC,UAAO,MAAM,EAAE,SAAS,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC1E,UAAU,KAAK,cAAc,MAAM,EAAE,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyChD,cAAc,KAAK,cAAc,MAAM,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCxD,cAAc,KAAK,cAAc,MAAM,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BxD,cAAc,KAAK,cAAc,MAAM,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCxD,eAAe,KAAK,cAAc,MAAM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,EAAE,0BAA0B"}
|
|
1
|
+
{"version":3,"file":"algorand-client-transaction-creator.js","names":[],"sources":["../../src/types/algorand-client-transaction-creator.ts"],"sourcesContent":["import { Expand } from '@algorandfoundation/algokit-common'\nimport { Transaction } from '@algorandfoundation/algokit-transact'\nimport { BuiltTransactions, TransactionComposer, TransactionComposerConfig } from './composer'\n\n/** Orchestrates creating transactions for `AlgorandClient`. */\nexport class AlgorandClientTransactionCreator {\n private _newGroup: () => TransactionComposer\n\n /**\n * Creates a new `AlgorandClientTransactionCreator`\n * @param newGroup A lambda that starts a new `TransactionComposer` transaction group\n * @example\n * ```typescript\n * const transactionCreator = new AlgorandClientTransactionCreator(() => new TransactionComposer())\n * ```\n */\n constructor(newGroup: (config?: TransactionComposerConfig) => TransactionComposer) {\n this._newGroup = newGroup\n }\n\n private _transaction<T>(c: (c: TransactionComposer) => (params: T) => TransactionComposer): (params: T) => Promise<Transaction> {\n return async (params: T) => {\n const composer = this._newGroup()\n const result = await c(composer).apply(composer, [params]).buildTransactions()\n return result.transactions.at(-1)!\n }\n }\n\n private _transactions<T>(\n c: (c: TransactionComposer) => (params: T) => TransactionComposer,\n ): (params: T) => Promise<Expand<BuiltTransactions>> {\n return async (params: T) => {\n const composer = this._newGroup()\n return await c(composer).apply(composer, [params]).buildTransactions()\n }\n }\n\n /**\n * Create a payment transaction to transfer Algo between accounts.\n * @param params The parameters for the payment transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.payment({\n * sender: 'SENDERADDRESS',\n * receiver: 'RECEIVERADDRESS',\n * amount: (4).algo(),\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.payment({\n * amount: (4).algo(),\n * receiver: 'RECEIVERADDRESS',\n * sender: 'SENDERADDRESS',\n * closeRemainderTo: 'CLOSEREMAINDERTOADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The payment transaction\n */\n payment = this._transaction((c) => c.addPayment)\n /** Create a create Algorand Standard Asset transaction.\n *\n * The account that sends this transaction will automatically be\n * opted in to the asset and will hold all units after creation.\n *\n * @param params The parameters for the asset creation transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetCreate({ sender: \"CREATORADDRESS\", total: 100n})\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetCreate({\n * sender: 'CREATORADDRESS',\n * total: 100n,\n * decimals: 2,\n * assetName: 'asset',\n * unitName: 'unit',\n * url: 'url',\n * metadataHash: 'metadataHash',\n * defaultFrozen: false,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset create transaction\n */\n assetCreate = this._transaction((c) => c.addAssetCreate)\n /** Create an asset config transaction to reconfigure an existing Algorand Standard Asset.\n *\n * **Note:** The manager, reserve, freeze, and clawback addresses\n * are immutably empty if they are not set. If manager is not set then\n * all fields are immutable from that point forward.\n *\n * @param params The parameters for the asset config transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetConfig({ sender: \"MANAGERADDRESS\", assetId: 123456n, manager: \"MANAGERADDRESS\" })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetConfig({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * manager: 'MANAGERADDRESS',\n * reserve: 'RESERVEADDRESS',\n * freeze: 'FREEZEADDRESS',\n * clawback: 'CLAWBACKADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset config transaction\n */\n assetConfig = this._transaction((c) => c.addAssetConfig)\n /** Create an Algorand Standard Asset freeze transaction.\n *\n * @param params The parameters for the asset freeze transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetFreeze({ sender: \"MANAGERADDRESS\", assetId: 123456n, account: \"ACCOUNTADDRESS\", frozen: true })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetFreeze({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * account: 'ACCOUNTADDRESS',\n * frozen: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset freeze transaction\n */\n assetFreeze = this._transaction((c) => c.addAssetFreeze)\n /** Create an Algorand Standard Asset destroy transaction.\n *\n * Created assets can be destroyed only by the asset manager account.\n * All of the assets must be owned by the creator of the asset before\n * the asset can be deleted.\n *\n * @param params The parameters for the asset destroy transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetDestroy({ sender: \"MANAGERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetDestroy({\n * sender: 'MANAGERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset destroy transaction\n */\n assetDestroy = this._transaction((c) => c.addAssetDestroy)\n /** Create an Algorand Standard Asset transfer transaction.\n *\n * @param params The parameters for the asset transfer transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetTransfer({ sender: \"HOLDERADDRESS\", assetId: 123456n, amount: 1n, receiver: \"RECEIVERADDRESS\" })\n * ```\n * @example Advanced example (with clawback)\n * ```typescript\n * await algorand.createTransaction.assetTransfer({\n * sender: 'CLAWBACKADDRESS',\n * assetId: 123456n,\n * amount: 1n,\n * receiver: 'RECEIVERADDRESS',\n * clawbackTarget: 'HOLDERADDRESS',\n * // This field needs to be used with caution\n * closeAssetTo: 'ADDRESSTOCLOSETO'\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The result of the asset transfer transaction\n */\n assetTransfer = this._transaction((c) => c.addAssetTransfer)\n /** Create an Algorand Standard Asset opt-in transaction.\n *\n * @param params The parameters for the asset opt-in transaction\n *\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.assetOptIn({ sender: \"SENDERADDRESS\", assetId: 123456n })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetOptIn({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset opt-in transaction\n */\n assetOptIn = this._transaction((c) => c.addAssetOptIn)\n /** Create an asset opt-out transaction.\n *\n * *Note:* If the account has a balance of the asset,\n * it will lose those assets\n *\n * @param params The parameters for the asset opt-out transaction\n *\n * @example Basic example (without creator, will be retrieved from algod)\n * ```typescript\n * await algorand.createTransaction.assetOptOut({ sender: \"SENDERADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Basic example (with creator)\n * ```typescript\n * await algorand.createTransaction.assetOptOut({ sender: \"SENDERADDRESS\", creator: \"CREATORADDRESS\", assetId: 123456n, ensureZeroBalance: true })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.assetOptOut({\n * sender: 'SENDERADDRESS',\n * assetId: 123456n,\n * creator: 'CREATORADDRESS',\n * ensureZeroBalance: true,\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The asset opt-out transaction\n */\n assetOptOut = this._transaction((c) => c.addAssetOptOut)\n /** Create an application create transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app creation transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appCreate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appCreate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application create transaction\n */\n appCreate = this._transaction((c) => c.addAppCreate)\n /** Create an application update transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app update transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appUpdate({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appUpdate({\n * sender: 'CREATORADDRESS',\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: OnApplicationComplete.UpdateApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application update transaction\n */\n appUpdate = this._transaction((c) => c.addAppUpdate)\n /** Create an application delete transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app deletion transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appDelete({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appDelete({\n * sender: 'CREATORADDRESS',\n * onComplete: OnApplicationComplete.DeleteApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application delete transaction\n */\n appDelete = this._transaction((c) => c.addAppDelete)\n /** Create an application call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app call transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.appCall({ sender: 'CREATORADDRESS' })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.appCall({\n * sender: 'CREATORADDRESS',\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application call transaction\n */\n appCall = this._transaction((c) => c.addAppCall)\n /** Create an application create call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app creation transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCreateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCreateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * schema: {\n * globalInts: 1,\n * globalByteSlices: 2,\n * localInts: 3,\n * localByteSlices: 4\n * },\n * extraProgramPages: 1,\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method create transaction\n */\n appCreateMethodCall = this._transactions((c) => c.addAppCreateMethodCall)\n /** Create an application update call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app update transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appUpdateMethodCall({ sender: 'CREATORADDRESS', approvalProgram: 'TEALCODE', clearStateProgram: 'TEALCODE', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appUpdateMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * approvalProgram: \"TEALCODE\",\n * clearStateProgram: \"TEALCODE\",\n * onComplete: OnApplicationComplete.UpdateApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method update transaction\n */\n appUpdateMethodCall = this._transactions((c) => c.addAppUpdateMethodCall)\n /** Create an application delete call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app deletion transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appDeleteMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appDeleteMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: OnApplicationComplete.DeleteApplication,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method delete transaction\n */\n appDeleteMethodCall = this._transactions((c) => c.addAppDeleteMethodCall)\n /** Create an application call with ABI method call transaction.\n *\n * Note: you may prefer to use `algorand.client` to get an app client for more advanced functionality.\n *\n * @param params The parameters for the app call transaction\n * @example Basic example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCallMethodCall({ sender: 'CREATORADDRESS', method: method, args: [\"arg1_value\"] })\n * ```\n * @example Advanced example\n * ```typescript\n * const method = new ABIMethod({\n * name: 'method',\n * args: [{ name: 'arg1', type: 'string' }],\n * returns: { type: 'string' },\n * })\n * await algorand.createTransaction.appCallMethodCall({\n * sender: 'CREATORADDRESS',\n * method: method,\n * args: [\"arg1_value\"],\n * onComplete: OnApplicationComplete.OptIn,\n * args: [new Uint8Array(1, 2, 3, 4)]\n * accountReferences: [\"ACCOUNT_1\"]\n * appReferences: [123n, 1234n]\n * assetReferences: [12345n]\n * boxReferences: [\"box1\", {appId: 1234n, name: \"box2\"}]\n * accessReferences: [{ appId: 1234n }]\n * lease: 'lease',\n * note: 'note',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * rejectVersion: 1,\n *})\n * ```\n * @returns The application ABI method call transaction\n */\n appCallMethodCall = this._transactions((c) => c.addAppCallMethodCall)\n /**\n * Create an online key registration transaction.\n * @param params The parameters for the key registration transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.onlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.onlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * voteKey: Uint8Array.from(Buffer.from(\"voteKeyBase64\", 'base64')),\n * selectionKey: Uint8Array.from(Buffer.from(\"selectionKeyBase64\", 'base64')),\n * stateProofKey: Uint8Array.from(Buffer.from(\"stateProofKeyBase64\", 'base64')),\n * voteFirst: 1n,\n * voteLast: 1000n,\n * voteKeyDilution: 1n,\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The online key registration transaction\n */\n onlineKeyRegistration = this._transaction((c) => c.addOnlineKeyRegistration)\n /**\n * Create an offline key registration transaction.\n * @param params The parameters for the key registration transaction\n * @example Basic example\n * ```typescript\n * await algorand.createTransaction.offlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * })\n * ```\n * @example Advanced example\n * ```typescript\n * await algorand.createTransaction.offlineKeyRegistration({\n * sender: 'SENDERADDRESS',\n * lease: 'lease',\n * note: 'note',\n * // Use this with caution, it's generally better to use algorand.account.rekeyAccount\n * rekeyTo: 'REKEYTOADDRESS',\n * // You wouldn't normally set this field\n * firstValidRound: 1000n,\n * validityWindow: 10,\n * extraFee: (1000).microAlgo(),\n * staticFee: (1000).microAlgo(),\n * // Max fee doesn't make sense with extraFee AND staticFee\n * // already specified, but here for completeness\n * maxFee: (3000).microAlgo(),\n * })\n * ```\n * @returns The offline key registration transaction\n */\n offlineKeyRegistration = this._transaction((c) => c.addOfflineKeyRegistration)\n}\n"],"mappings":";;;AAKA,IAAa,mCAAb,MAA8C;CAC5C,AAAQ;;;;;;;;;CAUR,YAAY,UAAuE;AACjF,OAAK,YAAY;;CAGnB,AAAQ,aAAgB,GAAwG;AAC9H,SAAO,OAAO,WAAc;GAC1B,MAAM,WAAW,KAAK,WAAW;AAEjC,WADe,MAAM,EAAE,SAAS,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,mBAAmB,EAChE,aAAa,GAAG,GAAG;;;CAIrC,AAAQ,cACN,GACmD;AACnD,SAAO,OAAO,WAAc;GAC1B,MAAM,WAAW,KAAK,WAAW;AACjC,UAAO,MAAM,EAAE,SAAS,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsC1E,UAAU,KAAK,cAAc,MAAM,EAAE,WAAW;;;;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