@algorandfoundation/algokit-utils 7.0.0-beta.9 → 7.0.1
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/LICENSE +21 -0
- package/README.md +9 -2
- package/account/account.js +6 -4
- package/account/account.js.map +1 -1
- package/account/account.mjs +6 -4
- package/account/account.mjs.map +1 -1
- package/account/get-account-config-from-environment.js.map +1 -1
- package/account/get-account-config-from-environment.mjs.map +1 -1
- package/account/get-account.js.map +1 -1
- package/account/get-account.mjs.map +1 -1
- package/account/get-dispenser-account.js.map +1 -1
- package/account/get-dispenser-account.mjs.map +1 -1
- package/account/mnemonic-account.js.map +1 -1
- package/account/mnemonic-account.mjs.map +1 -1
- package/amount.js.map +1 -1
- package/amount.mjs.map +1 -1
- package/app-client.js.map +1 -1
- package/app-client.mjs.map +1 -1
- package/app-deploy.js +2 -10
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +3 -11
- package/app-deploy.mjs.map +1 -1
- package/app.d.ts +2 -2
- package/app.js +2 -2
- package/app.js.map +1 -1
- package/app.mjs +2 -2
- package/app.mjs.map +1 -1
- package/asset.js.map +1 -1
- package/asset.mjs.map +1 -1
- package/debugging/debugging.js.map +1 -1
- package/debugging/debugging.mjs.map +1 -1
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +6 -0
- package/index.js.map +1 -1
- package/index.mjs +2 -1
- package/index.mjs.map +1 -1
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs.map +1 -1
- package/localnet/get-kmd-wallet-account.js.map +1 -1
- package/localnet/get-kmd-wallet-account.mjs.map +1 -1
- package/localnet/get-localnet-dispenser-account.js.map +1 -1
- package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
- package/localnet/is-localnet.js.map +1 -1
- package/localnet/is-localnet.mjs.map +1 -1
- package/network-client.js.map +1 -1
- package/network-client.mjs.map +1 -1
- package/package.json +5 -5
- package/testing/account.js.map +1 -1
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/indexer.js.map +1 -1
- package/testing/indexer.mjs.map +1 -1
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs.map +1 -1
- package/testing/transaction-logger.js.map +1 -1
- package/testing/transaction-logger.mjs.map +1 -1
- package/transaction/legacy-bridge.js +2 -2
- package/transaction/legacy-bridge.js.map +1 -1
- package/transaction/legacy-bridge.mjs +3 -3
- package/transaction/legacy-bridge.mjs.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.js +1 -0
- package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.mjs +1 -0
- package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +14 -7
- package/transaction/transaction.js +57 -31
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +55 -30
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +1 -1
- package/types/account-manager.js +10 -8
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +11 -9
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +9 -0
- package/types/account.js.map +1 -1
- package/types/account.mjs.map +1 -1
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs.map +1 -1
- package/types/algorand-client-interface.d.ts +2 -2
- package/types/algorand-client-transaction-creator.d.ts +5 -3
- package/types/algorand-client-transaction-creator.js +3 -1
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +3 -1
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +12 -8
- package/types/algorand-client-transaction-sender.js +6 -2
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +6 -2
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +3 -4
- package/types/algorand-client.js +2 -5
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +4 -4
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.js.map +1 -1
- package/types/amount.mjs.map +1 -1
- package/types/app-arc56.d.ts +31 -20
- package/types/app-arc56.js.map +1 -1
- package/types/app-arc56.mjs.map +1 -1
- package/types/app-client.d.ts +21 -10
- package/types/app-client.js +143 -36
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +141 -34
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.js +1 -1
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +2 -2
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +32 -21
- package/types/app-factory.js +8 -2
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +8 -2
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.js +105 -23
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +105 -23
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.js +8 -2
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +8 -2
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +8 -7
- package/types/app.js.map +1 -1
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +4 -4
- package/types/asset-manager.js +2 -2
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +2 -2
- package/types/asset-manager.mjs.map +1 -1
- package/types/async-event-emitter.d.ts +1 -10
- package/types/async-event-emitter.js +0 -5
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs +1 -6
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.js +2 -2
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +2 -2
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +56 -30
- package/types/composer.js +103 -47
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +104 -46
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +0 -4
- package/types/config.js.map +1 -1
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +1 -1
- package/types/debugging.js +1 -1
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +1 -1
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs.map +1 -1
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs.map +1 -1
- package/types/kmd-account-manager.js +1 -1
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +2 -2
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +10 -0
- package/types/lifecycle-events.js +8 -0
- package/types/lifecycle-events.js.map +1 -0
- package/types/lifecycle-events.mjs +8 -0
- package/types/lifecycle-events.mjs.map +1 -0
- package/types/logging.js.map +1 -1
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +2 -3
- package/types/logic-error.js +3 -3
- package/types/logic-error.js.map +1 -1
- package/types/logic-error.mjs +3 -3
- package/types/logic-error.mjs.map +1 -1
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +1 -1
- package/types/transaction.d.ts +1 -1
- package/types/urlTokenBaseHTTPClient.js.map +1 -1
- package/types/urlTokenBaseHTTPClient.mjs.map +1 -1
- package/util.js.map +1 -1
- package/util.mjs.map +1 -1
package/app-deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-deploy.js","sources":["../src/app-deploy.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { compileTeal, getAppOnCompleteAction } from './app'\nimport { _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge'\nimport { getSenderAddress, getSenderTransactionSigner } from './transaction/transaction'\nimport { AlgorandClientTransactionSender } from './types/algorand-client-transaction-sender'\nimport {\n ABIReturn,\n APP_DEPLOY_NOTE_DAPP,\n AppCompilationResult,\n AppDeployMetadata,\n AppDeploymentParams,\n AppLookup,\n AppMetadata,\n CompiledTeal,\n TealTemplateParams,\n} from './types/app'\nimport { AppDeployer } from './types/app-deployer'\nimport { AppManager, BoxReference } from './types/app-manager'\nimport { AssetManager } from './types/asset-manager'\nimport AlgoKitComposer, {\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n} from './types/composer'\nimport { Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Indexer = algosdk.Indexer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * @deprecated Use `algorand.appDeployer.deploy` instead.\n *\n * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.\n *\n * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param deployment The arguments to control the app deployment\n * @param algod An algod client\n * @param indexer An indexer client, needed if `existingDeployments` not passed in\n * @returns The app reference of the new/existing app\n */\nexport async function deployApp(\n deployment: AppDeploymentParams,\n algod: Algodv2,\n indexer?: Indexer,\n): Promise<\n Partial<AppCompilationResult> &\n (\n | (ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'create' | 'update' })\n | (ConfirmedTransactionResults &\n AppMetadata & {\n return?: ABIReturn\n deleteReturn?: ABIReturn\n deleteResult: ConfirmedTransactionResult\n operationPerformed: 'replace'\n })\n | (AppMetadata & { operationPerformed: 'nothing' })\n )\n> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new AlgoKitComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(deployment.from),\n getSuggestedParams: async () =>\n deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),\n appManager,\n })\n const deployer = new AppDeployer(\n appManager,\n new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager),\n indexer,\n )\n\n const createParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.createArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.createArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.createArgs?.lease,\n rekeyTo: deployment.createArgs?.rekeyTo ? getSenderAddress(deployment.createArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n extraProgramPages: deployment.schema.extraPages,\n onComplete: getAppOnCompleteAction(deployment.createOnCompleteAction) as Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.ClearStateOC\n >,\n schema: deployment.schema,\n } satisfies Partial<AppCreateParams>\n\n const updateParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.updateArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.updateArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.updateArgs?.lease,\n rekeyTo: deployment.updateArgs?.rekeyTo ? getSenderAddress(deployment.updateArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n } satisfies Partial<AppUpdateParams>\n\n const deleteParams = {\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.deleteArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.deleteArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.deleteArgs?.lease,\n rekeyTo: deployment.deleteArgs?.rekeyTo ? getSenderAddress(deployment.deleteArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n } satisfies Partial<AppDeleteParams>\n\n const encoder = new TextEncoder()\n\n const result = await deployer.deploy({\n createParams: deployment.createArgs?.method\n ? ({\n ...createParams,\n method:\n 'txnCount' in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.ABIMethod(deployment.createArgs.method),\n args: (await _getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs,\n } satisfies AppCreateMethodCall)\n : ({\n ...createParams,\n args:\n 'appArgs' in (deployment?.createArgs ?? {})\n ? deployment.createArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies AppCreateParams),\n updateParams: deployment.updateArgs?.method\n ? ({\n ...updateParams,\n method:\n 'txnCount' in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.ABIMethod(deployment.updateArgs.method),\n args: (await _getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppUpdateMethodCall, 'appId'>)\n : ({\n ...updateParams,\n args:\n 'appArgs' in (deployment?.updateArgs ?? {})\n ? deployment.updateArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppUpdateParams, 'appId'>),\n deleteParams: deployment.deleteArgs?.method\n ? ({\n ...deleteParams,\n method:\n 'txnCount' in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.ABIMethod(deployment.deleteArgs.method),\n args: (await _getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppDeleteMethodCall, 'appId'>)\n : ({\n ...deleteParams,\n args:\n 'appArgs' in (deployment?.deleteArgs ?? {})\n ? deployment.deleteArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppDeleteParams, 'appId'>),\n metadata: deployment.metadata,\n deployTimeParams: deployment.deployTimeParams,\n onSchemaBreak: deployment.onSchemaBreak,\n onUpdate: deployment.onUpdate,\n existingDeployments: deployment.existingDeployments\n ? {\n creator: deployment.existingDeployments.creator,\n apps: Object.fromEntries(\n Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [\n name,\n { ...app, appId: BigInt(app.appId), createdRound: BigInt(app.createdRound), updatedRound: BigInt(app.updatedRound) },\n ]),\n ),\n }\n : undefined,\n maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,\n populateAppCallResources: deployment.populateAppCallResources,\n suppressLog: deployment.suppressLog,\n })\n\n return { ...result, appId: Number(result.appId), createdRound: Number(result.createdRound), updatedRound: Number(result.updatedRound) }\n}\n\n/**\n * @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead.\n *\n * Returns true is there is a breaking change in the application state schema from before to after.\n * i.e. if the schema becomes larger, since applications can't ask for more schema after creation.\n * Otherwise, there is no error, the app just doesn't store data in the extra schema :(\n *\n * @param before The existing schema\n * @param after The new schema\n * @returns Whether or not there is a breaking change\n */\nexport function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: modelsv2.ApplicationStateSchema) {\n return before.numByteSlice < after.numByteSlice || before.numUint < after.numUint\n}\n\n/**\n * @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead.\n *\n * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction.\n *\n * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).\n *\n * @param creatorAccount The account (with private key loaded) or string address of an account that is the creator of the apps you want to search for\n * @param indexer An indexer client\n * @returns A name-based lookup of the app information (id, address)\n */\nexport async function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup> {\n const lookup = await new AppDeployer(undefined!, undefined!, indexer).getCreatorAppsByName(getSenderAddress(creatorAccount))\n\n return {\n creator: lookup.creator,\n apps: Object.fromEntries(\n Object.entries(lookup.apps).map(([name, app]) => [\n name,\n { ...app, appId: Number(app.appId), createdRound: Number(app.createdRound), updatedRound: Number(app.updatedRound) },\n ]),\n ),\n }\n}\n\n/**\n * @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead.\n *\n * Return the transaction note for an app deployment.\n * @param metadata The metadata of the deployment\n * @returns The transaction note as a utf-8 string\n */\nexport function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Arc2TransactionNote {\n return {\n dAppName: APP_DEPLOY_NOTE_DAPP,\n data: metadata,\n format: 'j',\n }\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead\n *\n * Replaces deploy-time deployment control parameters within the given teal code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are not undefined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealCode The TEAL code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n */\nexport function replaceDeployTimeControlParams(tealCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n return AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params)\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateParams` instead\n *\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @returns The TEAL code with replacements\n */\nexport function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams) {\n return AppManager.replaceTealTemplateParams(tealCode, templateParams)\n}\n\n/**\n * @deprecated Use `algorand.appManager.compileTealTemplate` instead.\n *\n * Performs template substitution of a teal file and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param algod An algod client\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n */\nexport async function performTemplateSubstitutionAndCompile(\n tealCode: string,\n algod: Algodv2,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: AppDeployMetadata,\n): Promise<CompiledTeal> {\n tealCode = stripTealComments(tealCode)\n\n tealCode = performTemplateSubstitution(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await compileTeal(tealCode, algod)\n}\n\n/**\n * @deprecated Use `AppManager.stripTealComments` instead.\n *\n * Remove comments from TEAL Code\n *\n * @param tealCode The TEAL logic to compile\n * @returns The TEAL without comments\n */\nexport function stripTealComments(tealCode: string) {\n // find // outside quotes, i.e. won't pick up \"//not a comment\"\n const regex = /\\/\\/(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)/\n\n tealCode = tealCode\n .split('\\n')\n .map((tealCodeLine) => {\n return tealCodeLine.split(regex)[0].trim()\n })\n .join('\\n')\n\n return tealCode\n}\n"],"names":["AppManager","AlgoKitComposer","getSenderTransactionSigner","AppDeployer","AlgorandClientTransactionSender","AssetManager","getSenderAddress","_getBoxReference","getAppOnCompleteAction","_getAppArgsForABICall","APP_DEPLOY_NOTE_DAPP","compileTeal"],"mappings":";;;;;;;;;;;;;AAgCA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,SAAS,CAC7B,UAA+B,EAC/B,KAAc,EACd,OAAiB,EAAA;AAejB,IAAA,MAAM,UAAU,GAAG,IAAIA,2BAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAIC,sBAAe,CAAC;QAClB,KAAK;QACL,SAAS,EAAE,MAAMC,sCAA0B,CAAC,UAAU,CAAC,IAAI,CAAC;QAC5D,kBAAkB,EAAE,YAClB,UAAU,CAAC,iBAAiB,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE;QAC9G,UAAU;AACX,KAAA,CAAC,CAAA;IACJ,MAAM,QAAQ,GAAG,IAAIC,6BAAW,CAC9B,UAAU,EACV,IAAIC,qEAA+B,CAAC,QAAQ,EAAE,IAAIC,+BAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,EAC5F,OAAO,CACR,CAAA;AAED,IAAA,MAAM,YAAY,GAAG;QACnB,eAAe,EAAE,U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,GAAG,QAAQ;SAChB,KAAK,CAAC,IAAI,CAAC;AACX,SAAA,GAAG,CAAC,CAAC,YAAY,KAAI;AACpB,QAAA,OAAO,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AAC5C,KAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAA;AAEb,IAAA,OAAO,QAAQ,CAAA;AACjB;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"app-deploy.js","sources":["../src/app-deploy.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { compileTeal, getAppOnCompleteAction } from './app'\nimport { _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge'\nimport { getSenderAddress, getSenderTransactionSigner } from './transaction/transaction'\nimport { AlgorandClientTransactionSender } from './types/algorand-client-transaction-sender'\nimport {\n ABIReturn,\n APP_DEPLOY_NOTE_DAPP,\n AppCompilationResult,\n AppDeployMetadata,\n AppDeploymentParams,\n AppLookup,\n AppMetadata,\n CompiledTeal,\n TealTemplateParams,\n} from './types/app'\nimport { AppDeployer } from './types/app-deployer'\nimport { AppManager, BoxReference } from './types/app-manager'\nimport { AssetManager } from './types/asset-manager'\nimport {\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n TransactionComposer,\n} from './types/composer'\nimport { Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Indexer = algosdk.Indexer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * @deprecated Use `algorand.appDeployer.deploy` instead.\n *\n * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.\n *\n * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param deployment The arguments to control the app deployment\n * @param algod An algod client\n * @param indexer An indexer client, needed if `existingDeployments` not passed in\n * @returns The app reference of the new/existing app\n */\nexport async function deployApp(\n deployment: AppDeploymentParams,\n algod: Algodv2,\n indexer?: Indexer,\n): Promise<\n Partial<AppCompilationResult> &\n (\n | (ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'create' | 'update' })\n | (ConfirmedTransactionResults &\n AppMetadata & {\n return?: ABIReturn\n deleteReturn?: ABIReturn\n deleteResult: ConfirmedTransactionResult\n operationPerformed: 'replace'\n })\n | (AppMetadata & { operationPerformed: 'nothing' })\n )\n> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(deployment.from),\n getSuggestedParams: async () =>\n deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),\n appManager,\n })\n const deployer = new AppDeployer(\n appManager,\n new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager),\n indexer,\n )\n\n const createParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.createArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.createArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.createArgs?.lease,\n rekeyTo: deployment.createArgs?.rekeyTo ? getSenderAddress(deployment.createArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n extraProgramPages: deployment.schema.extraPages,\n onComplete: getAppOnCompleteAction(deployment.createOnCompleteAction) as Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.ClearStateOC\n >,\n schema: deployment.schema,\n } satisfies Partial<AppCreateParams>\n\n const updateParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.updateArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.updateArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.updateArgs?.lease,\n rekeyTo: deployment.updateArgs?.rekeyTo ? getSenderAddress(deployment.updateArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n } satisfies Partial<AppUpdateParams>\n\n const deleteParams = {\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.deleteArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.deleteArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.deleteArgs?.lease,\n rekeyTo: deployment.deleteArgs?.rekeyTo ? getSenderAddress(deployment.deleteArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n } satisfies Partial<AppDeleteParams>\n\n const encoder = new TextEncoder()\n\n const result = await deployer.deploy({\n createParams: deployment.createArgs?.method\n ? ({\n ...createParams,\n method:\n 'txnCount' in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.ABIMethod(deployment.createArgs.method),\n args: (await _getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs,\n } satisfies AppCreateMethodCall)\n : ({\n ...createParams,\n args:\n 'appArgs' in (deployment?.createArgs ?? {})\n ? deployment.createArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies AppCreateParams),\n updateParams: deployment.updateArgs?.method\n ? ({\n ...updateParams,\n method:\n 'txnCount' in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.ABIMethod(deployment.updateArgs.method),\n args: (await _getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppUpdateMethodCall, 'appId'>)\n : ({\n ...updateParams,\n args:\n 'appArgs' in (deployment?.updateArgs ?? {})\n ? deployment.updateArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppUpdateParams, 'appId'>),\n deleteParams: deployment.deleteArgs?.method\n ? ({\n ...deleteParams,\n method:\n 'txnCount' in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.ABIMethod(deployment.deleteArgs.method),\n args: (await _getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppDeleteMethodCall, 'appId'>)\n : ({\n ...deleteParams,\n args:\n 'appArgs' in (deployment?.deleteArgs ?? {})\n ? deployment.deleteArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppDeleteParams, 'appId'>),\n metadata: deployment.metadata,\n deployTimeParams: deployment.deployTimeParams,\n onSchemaBreak: deployment.onSchemaBreak,\n onUpdate: deployment.onUpdate,\n existingDeployments: deployment.existingDeployments\n ? {\n creator: deployment.existingDeployments.creator,\n apps: Object.fromEntries(\n Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [\n name,\n { ...app, appId: BigInt(app.appId), createdRound: BigInt(app.createdRound), updatedRound: BigInt(app.updatedRound) },\n ]),\n ),\n }\n : undefined,\n maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,\n populateAppCallResources: deployment.populateAppCallResources,\n suppressLog: deployment.suppressLog,\n })\n\n return { ...result, appId: Number(result.appId), createdRound: Number(result.createdRound), updatedRound: Number(result.updatedRound) }\n}\n\n/**\n * @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead.\n *\n * Returns true is there is a breaking change in the application state schema from before to after.\n * i.e. if the schema becomes larger, since applications can't ask for more schema after creation.\n * Otherwise, there is no error, the app just doesn't store data in the extra schema :(\n *\n * @param before The existing schema\n * @param after The new schema\n * @returns Whether or not there is a breaking change\n */\nexport function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: modelsv2.ApplicationStateSchema) {\n return before.numByteSlice < after.numByteSlice || before.numUint < after.numUint\n}\n\n/**\n * @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead.\n *\n * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction.\n *\n * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).\n *\n * @param creatorAccount The account (with private key loaded) or string address of an account that is the creator of the apps you want to search for\n * @param indexer An indexer client\n * @returns A name-based lookup of the app information (id, address)\n */\nexport async function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup> {\n const lookup = await new AppDeployer(undefined!, undefined!, indexer).getCreatorAppsByName(getSenderAddress(creatorAccount))\n\n return {\n creator: lookup.creator,\n apps: Object.fromEntries(\n Object.entries(lookup.apps).map(([name, app]) => [\n name,\n { ...app, appId: Number(app.appId), createdRound: Number(app.createdRound), updatedRound: Number(app.updatedRound) },\n ]),\n ),\n }\n}\n\n/**\n * @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead.\n *\n * Return the transaction note for an app deployment.\n * @param metadata The metadata of the deployment\n * @returns The transaction note as a utf-8 string\n */\nexport function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Arc2TransactionNote {\n return {\n dAppName: APP_DEPLOY_NOTE_DAPP,\n data: metadata,\n format: 'j',\n }\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead\n *\n * Replaces deploy-time deployment control parameters within the given teal code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are not undefined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealCode The TEAL code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n */\nexport function replaceDeployTimeControlParams(tealCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n return AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params)\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateParams` instead\n *\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @returns The TEAL code with replacements\n */\nexport function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams) {\n return AppManager.replaceTealTemplateParams(tealCode, templateParams)\n}\n\n/**\n * @deprecated Use `algorand.appManager.compileTealTemplate` instead.\n *\n * Performs template substitution of a teal file and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param algod An algod client\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n */\nexport async function performTemplateSubstitutionAndCompile(\n tealCode: string,\n algod: Algodv2,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: AppDeployMetadata,\n): Promise<CompiledTeal> {\n tealCode = stripTealComments(tealCode)\n\n tealCode = performTemplateSubstitution(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await compileTeal(tealCode, algod)\n}\n\n/**\n * @deprecated Use `AppManager.stripTealComments` instead.\n *\n * Remove comments from TEAL Code\n *\n * @param tealCode The TEAL logic to compile\n * @returns The TEAL without comments\n */\nexport function stripTealComments(tealCode: string) {\n return AppManager.stripTealComments(tealCode)\n}\n"],"names":["AppManager","TransactionComposer","getSenderTransactionSigner","AppDeployer","AlgorandClientTransactionSender","AssetManager","getSenderAddress","_getBoxReference","getAppOnCompleteAction","_getAppArgsForABICall","APP_DEPLOY_NOTE_DAPP","compileTeal"],"mappings":";;;;;;;;;;;;;AAiCA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,SAAS,CAC7B,UAA+B,EAC/B,KAAc,EACd,OAAiB,EAAA;AAejB,IAAA,MAAM,UAAU,GAAG,IAAIA,2BAAU,CAAC,KAAK,CAAC;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAIC,kCAAmB,CAAC;QACtB,KAAK;QACL,SAAS,EAAE,MAAMC,sCAA0B,CAAC,UAAU,CAAC,IAAI,CAAC;QAC5D,kBAAkB,EAAE,YAClB,UAAU,CAAC,iBAAiB,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE;QAC9G,UAAU;AACX,KAAA,CAAC;IACJ,MAAM,QAAQ,GAAG,IAAIC,6BAAW,CAC9B,UAAU,EACV,IAAIC,qEAA+B,CAAC,QAAQ,EAAE,IAAIC,+BAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,EAC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'./types/app-manager.mjs';
|
|
9
9
|
import { AssetManager } from './types/asset-manager.mjs';
|
|
10
|
-
import
|
|
10
|
+
import { TransactionComposer } from './types/composer.mjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Use `algorand.appDeployer.deploy` instead.
|
|
@@ -28,7 +28,7 @@ import AlgoKitComposer from './types/composer.mjs';
|
|
|
28
28
|
*/
|
|
29
29
|
async function deployApp(deployment, algod, indexer) {
|
|
30
30
|
const appManager = new AppManager(algod);
|
|
31
|
-
const newGroup = () => new
|
|
31
|
+
const newGroup = () => new TransactionComposer({
|
|
32
32
|
algod,
|
|
33
33
|
getSigner: () => getSenderTransactionSigner(deployment.from),
|
|
34
34
|
getSuggestedParams: async () => deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),
|
|
@@ -251,15 +251,7 @@ async function performTemplateSubstitutionAndCompile(tealCode, algod, templatePa
|
|
|
251
251
|
* @returns The TEAL without comments
|
|
252
252
|
*/
|
|
253
253
|
function stripTealComments(tealCode) {
|
|
254
|
-
|
|
255
|
-
const regex = /\/\/(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)/;
|
|
256
|
-
tealCode = tealCode
|
|
257
|
-
.split('\n')
|
|
258
|
-
.map((tealCodeLine) => {
|
|
259
|
-
return tealCodeLine.split(regex)[0].trim();
|
|
260
|
-
})
|
|
261
|
-
.join('\n');
|
|
262
|
-
return tealCode;
|
|
254
|
+
return AppManager.stripTealComments(tealCode);
|
|
263
255
|
}
|
|
264
256
|
|
|
265
257
|
export { deployApp, getAppDeploymentTransactionNote, getCreatorAppsByName, isSchemaIsBroken, performTemplateSubstitution, performTemplateSubstitutionAndCompile, replaceDeployTimeControlParams, stripTealComments };
|
package/app-deploy.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-deploy.mjs","sources":["../src/app-deploy.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { compileTeal, getAppOnCompleteAction } from './app'\nimport { _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge'\nimport { getSenderAddress, getSenderTransactionSigner } from './transaction/transaction'\nimport { AlgorandClientTransactionSender } from './types/algorand-client-transaction-sender'\nimport {\n ABIReturn,\n APP_DEPLOY_NOTE_DAPP,\n AppCompilationResult,\n AppDeployMetadata,\n AppDeploymentParams,\n AppLookup,\n AppMetadata,\n CompiledTeal,\n TealTemplateParams,\n} from './types/app'\nimport { AppDeployer } from './types/app-deployer'\nimport { AppManager, BoxReference } from './types/app-manager'\nimport { AssetManager } from './types/asset-manager'\nimport AlgoKitComposer, {\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n} from './types/composer'\nimport { Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Indexer = algosdk.Indexer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * @deprecated Use `algorand.appDeployer.deploy` instead.\n *\n * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.\n *\n * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param deployment The arguments to control the app deployment\n * @param algod An algod client\n * @param indexer An indexer client, needed if `existingDeployments` not passed in\n * @returns The app reference of the new/existing app\n */\nexport async function deployApp(\n deployment: AppDeploymentParams,\n algod: Algodv2,\n indexer?: Indexer,\n): Promise<\n Partial<AppCompilationResult> &\n (\n | (ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'create' | 'update' })\n | (ConfirmedTransactionResults &\n AppMetadata & {\n return?: ABIReturn\n deleteReturn?: ABIReturn\n deleteResult: ConfirmedTransactionResult\n operationPerformed: 'replace'\n })\n | (AppMetadata & { operationPerformed: 'nothing' })\n )\n> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new AlgoKitComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(deployment.from),\n getSuggestedParams: async () =>\n deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),\n appManager,\n })\n const deployer = new AppDeployer(\n appManager,\n new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager),\n indexer,\n )\n\n const createParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.createArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.createArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.createArgs?.lease,\n rekeyTo: deployment.createArgs?.rekeyTo ? getSenderAddress(deployment.createArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n extraProgramPages: deployment.schema.extraPages,\n onComplete: getAppOnCompleteAction(deployment.createOnCompleteAction) as Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.ClearStateOC\n >,\n schema: deployment.schema,\n } satisfies Partial<AppCreateParams>\n\n const updateParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.updateArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.updateArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.updateArgs?.lease,\n rekeyTo: deployment.updateArgs?.rekeyTo ? getSenderAddress(deployment.updateArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n } satisfies Partial<AppUpdateParams>\n\n const deleteParams = {\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.deleteArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.deleteArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.deleteArgs?.lease,\n rekeyTo: deployment.deleteArgs?.rekeyTo ? getSenderAddress(deployment.deleteArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n } satisfies Partial<AppDeleteParams>\n\n const encoder = new TextEncoder()\n\n const result = await deployer.deploy({\n createParams: deployment.createArgs?.method\n ? ({\n ...createParams,\n method:\n 'txnCount' in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.ABIMethod(deployment.createArgs.method),\n args: (await _getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs,\n } satisfies AppCreateMethodCall)\n : ({\n ...createParams,\n args:\n 'appArgs' in (deployment?.createArgs ?? {})\n ? deployment.createArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies AppCreateParams),\n updateParams: deployment.updateArgs?.method\n ? ({\n ...updateParams,\n method:\n 'txnCount' in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.ABIMethod(deployment.updateArgs.method),\n args: (await _getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppUpdateMethodCall, 'appId'>)\n : ({\n ...updateParams,\n args:\n 'appArgs' in (deployment?.updateArgs ?? {})\n ? deployment.updateArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppUpdateParams, 'appId'>),\n deleteParams: deployment.deleteArgs?.method\n ? ({\n ...deleteParams,\n method:\n 'txnCount' in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.ABIMethod(deployment.deleteArgs.method),\n args: (await _getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppDeleteMethodCall, 'appId'>)\n : ({\n ...deleteParams,\n args:\n 'appArgs' in (deployment?.deleteArgs ?? {})\n ? deployment.deleteArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppDeleteParams, 'appId'>),\n metadata: deployment.metadata,\n deployTimeParams: deployment.deployTimeParams,\n onSchemaBreak: deployment.onSchemaBreak,\n onUpdate: deployment.onUpdate,\n existingDeployments: deployment.existingDeployments\n ? {\n creator: deployment.existingDeployments.creator,\n apps: Object.fromEntries(\n Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [\n name,\n { ...app, appId: BigInt(app.appId), createdRound: BigInt(app.createdRound), updatedRound: BigInt(app.updatedRound) },\n ]),\n ),\n }\n : undefined,\n maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,\n populateAppCallResources: deployment.populateAppCallResources,\n suppressLog: deployment.suppressLog,\n })\n\n return { ...result, appId: Number(result.appId), createdRound: Number(result.createdRound), updatedRound: Number(result.updatedRound) }\n}\n\n/**\n * @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead.\n *\n * Returns true is there is a breaking change in the application state schema from before to after.\n * i.e. if the schema becomes larger, since applications can't ask for more schema after creation.\n * Otherwise, there is no error, the app just doesn't store data in the extra schema :(\n *\n * @param before The existing schema\n * @param after The new schema\n * @returns Whether or not there is a breaking change\n */\nexport function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: modelsv2.ApplicationStateSchema) {\n return before.numByteSlice < after.numByteSlice || before.numUint < after.numUint\n}\n\n/**\n * @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead.\n *\n * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction.\n *\n * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).\n *\n * @param creatorAccount The account (with private key loaded) or string address of an account that is the creator of the apps you want to search for\n * @param indexer An indexer client\n * @returns A name-based lookup of the app information (id, address)\n */\nexport async function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup> {\n const lookup = await new AppDeployer(undefined!, undefined!, indexer).getCreatorAppsByName(getSenderAddress(creatorAccount))\n\n return {\n creator: lookup.creator,\n apps: Object.fromEntries(\n Object.entries(lookup.apps).map(([name, app]) => [\n name,\n { ...app, appId: Number(app.appId), createdRound: Number(app.createdRound), updatedRound: Number(app.updatedRound) },\n ]),\n ),\n }\n}\n\n/**\n * @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead.\n *\n * Return the transaction note for an app deployment.\n * @param metadata The metadata of the deployment\n * @returns The transaction note as a utf-8 string\n */\nexport function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Arc2TransactionNote {\n return {\n dAppName: APP_DEPLOY_NOTE_DAPP,\n data: metadata,\n format: 'j',\n }\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead\n *\n * Replaces deploy-time deployment control parameters within the given teal code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are not undefined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealCode The TEAL code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n */\nexport function replaceDeployTimeControlParams(tealCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n return AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params)\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateParams` instead\n *\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @returns The TEAL code with replacements\n */\nexport function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams) {\n return AppManager.replaceTealTemplateParams(tealCode, templateParams)\n}\n\n/**\n * @deprecated Use `algorand.appManager.compileTealTemplate` instead.\n *\n * Performs template substitution of a teal file and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param algod An algod client\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n */\nexport async function performTemplateSubstitutionAndCompile(\n tealCode: string,\n algod: Algodv2,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: AppDeployMetadata,\n): Promise<CompiledTeal> {\n tealCode = stripTealComments(tealCode)\n\n tealCode = performTemplateSubstitution(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await compileTeal(tealCode, algod)\n}\n\n/**\n * @deprecated Use `AppManager.stripTealComments` instead.\n *\n * Remove comments from TEAL Code\n *\n * @param tealCode The TEAL logic to compile\n * @returns The TEAL without comments\n */\nexport function stripTealComments(tealCode: string) {\n // find // outside quotes, i.e. won't pick up \"//not a comment\"\n const regex = /\\/\\/(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)/\n\n tealCode = tealCode\n .split('\\n')\n .map((tealCodeLine) => {\n return tealCodeLine.split(regex)[0].trim()\n })\n .join('\\n')\n\n return tealCode\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAgCA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,SAAS,CAC7B,UAA+B,EAC/B,KAAc,EACd,OAAiB,EAAA;AAejB,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAI,eAAe,CAAC;QAClB,KAAK;QACL,SAAS,EAAE,MAAM,0BAA0B,CAAC,UAAU,CAAC,IAAI,CAAC;QAC5D,kBAAkB,EAAE,YAClB,UAAU,CAAC,iBAAiB,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE;QAC9G,UAAU;AACX,KAAA,CAAC,CAAA;IACJ,MAAM,QAAQ,GAAG,IAAI,WAAW,CAC9B,UAAU,EACV,IAAI,+BAA+B,CAAC,QAAQ,EAAE,IAAI,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,EAC5F,OAAO,CACR,CAAA;AAED,IAAA,MAAM,YAAY,GAAG;QACnB,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;AAC/C,QAAA,MAAM,EAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC;AACzC,QAAA,iBAAiB,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,QAAQ,GAAG,CAAC,GAA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
|
|
1
|
+
{"version":3,"file":"app-deploy.mjs","sources":["../src/app-deploy.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { compileTeal, getAppOnCompleteAction } from './app'\nimport { _getAppArgsForABICall, _getBoxReference } from './transaction/legacy-bridge'\nimport { getSenderAddress, getSenderTransactionSigner } from './transaction/transaction'\nimport { AlgorandClientTransactionSender } from './types/algorand-client-transaction-sender'\nimport {\n ABIReturn,\n APP_DEPLOY_NOTE_DAPP,\n AppCompilationResult,\n AppDeployMetadata,\n AppDeploymentParams,\n AppLookup,\n AppMetadata,\n CompiledTeal,\n TealTemplateParams,\n} from './types/app'\nimport { AppDeployer } from './types/app-deployer'\nimport { AppManager, BoxReference } from './types/app-manager'\nimport { AssetManager } from './types/asset-manager'\nimport {\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n TransactionComposer,\n} from './types/composer'\nimport { Arc2TransactionNote, ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Indexer = algosdk.Indexer\nimport modelsv2 = algosdk.modelsv2\n\n/**\n * @deprecated Use `algorand.appDeployer.deploy` instead.\n *\n * Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.\n *\n * To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md\n *\n * **Note:** When using the return from this function be sure to check `operationPerformed` to get access to various return properties like `transaction`, `confirmation` and `deleteResult`.\n *\n * **Note:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'replace'`) the existing app will be deleted and re-created.\n *\n * **Note:** if there is an update (different TEAL code) to an existing app (and `onUpdate` is set to `'replace'`) the existing app will be deleted and re-created.\n * @param deployment The arguments to control the app deployment\n * @param algod An algod client\n * @param indexer An indexer client, needed if `existingDeployments` not passed in\n * @returns The app reference of the new/existing app\n */\nexport async function deployApp(\n deployment: AppDeploymentParams,\n algod: Algodv2,\n indexer?: Indexer,\n): Promise<\n Partial<AppCompilationResult> &\n (\n | (ConfirmedTransactionResults & AppMetadata & { return?: ABIReturn; operationPerformed: 'create' | 'update' })\n | (ConfirmedTransactionResults &\n AppMetadata & {\n return?: ABIReturn\n deleteReturn?: ABIReturn\n deleteResult: ConfirmedTransactionResult\n operationPerformed: 'replace'\n })\n | (AppMetadata & { operationPerformed: 'nothing' })\n )\n> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(deployment.from),\n getSuggestedParams: async () =>\n deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),\n appManager,\n })\n const deployer = new AppDeployer(\n appManager,\n new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager),\n indexer,\n )\n\n const createParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.createArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.createArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.createArgs?.lease,\n rekeyTo: deployment.createArgs?.rekeyTo ? getSenderAddress(deployment.createArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n extraProgramPages: deployment.schema.extraPages,\n onComplete: getAppOnCompleteAction(deployment.createOnCompleteAction) as Exclude<\n algosdk.OnApplicationComplete,\n algosdk.OnApplicationComplete.ClearStateOC\n >,\n schema: deployment.schema,\n } satisfies Partial<AppCreateParams>\n\n const updateParams = {\n approvalProgram: deployment.approvalProgram,\n clearStateProgram: deployment.clearStateProgram,\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.updateArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.updateArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.updateArgs?.lease,\n rekeyTo: deployment.updateArgs?.rekeyTo ? getSenderAddress(deployment.updateArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n } satisfies Partial<AppUpdateParams>\n\n const deleteParams = {\n sender: getSenderAddress(deployment.from),\n accountReferences: deployment.deleteArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: deployment.deleteArgs?.boxes\n ?.map(_getBoxReference)\n ?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: deployment.deleteArgs?.lease,\n rekeyTo: deployment.deleteArgs?.rekeyTo ? getSenderAddress(deployment.deleteArgs?.rekeyTo) : undefined,\n staticFee: deployment.fee,\n maxFee: deployment.maxFee,\n onComplete: algosdk.OnApplicationComplete.DeleteApplicationOC,\n } satisfies Partial<AppDeleteParams>\n\n const encoder = new TextEncoder()\n\n const result = await deployer.deploy({\n createParams: deployment.createArgs?.method\n ? ({\n ...createParams,\n method:\n 'txnCount' in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.ABIMethod(deployment.createArgs.method),\n args: (await _getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs,\n } satisfies AppCreateMethodCall)\n : ({\n ...createParams,\n args:\n 'appArgs' in (deployment?.createArgs ?? {})\n ? deployment.createArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies AppCreateParams),\n updateParams: deployment.updateArgs?.method\n ? ({\n ...updateParams,\n method:\n 'txnCount' in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.ABIMethod(deployment.updateArgs.method),\n args: (await _getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppUpdateMethodCall, 'appId'>)\n : ({\n ...updateParams,\n args:\n 'appArgs' in (deployment?.updateArgs ?? {})\n ? deployment.updateArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppUpdateParams, 'appId'>),\n deleteParams: deployment.deleteArgs?.method\n ? ({\n ...deleteParams,\n method:\n 'txnCount' in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.ABIMethod(deployment.deleteArgs.method),\n args: (await _getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs,\n } satisfies Omit<AppDeleteMethodCall, 'appId'>)\n : ({\n ...deleteParams,\n args:\n 'appArgs' in (deployment?.deleteArgs ?? {})\n ? deployment.deleteArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n } satisfies Omit<AppDeleteParams, 'appId'>),\n metadata: deployment.metadata,\n deployTimeParams: deployment.deployTimeParams,\n onSchemaBreak: deployment.onSchemaBreak,\n onUpdate: deployment.onUpdate,\n existingDeployments: deployment.existingDeployments\n ? {\n creator: deployment.existingDeployments.creator,\n apps: Object.fromEntries(\n Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [\n name,\n { ...app, appId: BigInt(app.appId), createdRound: BigInt(app.createdRound), updatedRound: BigInt(app.updatedRound) },\n ]),\n ),\n }\n : undefined,\n maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,\n populateAppCallResources: deployment.populateAppCallResources,\n suppressLog: deployment.suppressLog,\n })\n\n return { ...result, appId: Number(result.appId), createdRound: Number(result.createdRound), updatedRound: Number(result.updatedRound) }\n}\n\n/**\n * @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead.\n *\n * Returns true is there is a breaking change in the application state schema from before to after.\n * i.e. if the schema becomes larger, since applications can't ask for more schema after creation.\n * Otherwise, there is no error, the app just doesn't store data in the extra schema :(\n *\n * @param before The existing schema\n * @param after The new schema\n * @returns Whether or not there is a breaking change\n */\nexport function isSchemaIsBroken(before: modelsv2.ApplicationStateSchema, after: modelsv2.ApplicationStateSchema) {\n return before.numByteSlice < after.numByteSlice || before.numUint < after.numUint\n}\n\n/**\n * @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead.\n *\n * Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an `AppDeployNote` in the transaction note of the creation transaction.\n *\n * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).\n *\n * @param creatorAccount The account (with private key loaded) or string address of an account that is the creator of the apps you want to search for\n * @param indexer An indexer client\n * @returns A name-based lookup of the app information (id, address)\n */\nexport async function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup> {\n const lookup = await new AppDeployer(undefined!, undefined!, indexer).getCreatorAppsByName(getSenderAddress(creatorAccount))\n\n return {\n creator: lookup.creator,\n apps: Object.fromEntries(\n Object.entries(lookup.apps).map(([name, app]) => [\n name,\n { ...app, appId: Number(app.appId), createdRound: Number(app.createdRound), updatedRound: Number(app.updatedRound) },\n ]),\n ),\n }\n}\n\n/**\n * @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead.\n *\n * Return the transaction note for an app deployment.\n * @param metadata The metadata of the deployment\n * @returns The transaction note as a utf-8 string\n */\nexport function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): Arc2TransactionNote {\n return {\n dAppName: APP_DEPLOY_NOTE_DAPP,\n data: metadata,\n format: 'j',\n }\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead\n *\n * Replaces deploy-time deployment control parameters within the given teal code.\n *\n * * `TMPL_UPDATABLE` for updatability / immutability control\n * * `TMPL_DELETABLE` for deletability / permanence control\n *\n * Note: If these values are not undefined, but the corresponding `TMPL_*` value\n * isn't in the teal code it will throw an exception.\n *\n * @param tealCode The TEAL code to substitute\n * @param params The deploy-time deployment control parameter value to replace\n * @returns The replaced TEAL code\n */\nexport function replaceDeployTimeControlParams(tealCode: string, params: { updatable?: boolean; deletable?: boolean }) {\n return AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params)\n}\n\n/**\n * @deprecated Use `AppManager.replaceTealTemplateParams` instead\n *\n * Performs template substitution of a teal file.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @returns The TEAL code with replacements\n */\nexport function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams) {\n return AppManager.replaceTealTemplateParams(tealCode, templateParams)\n}\n\n/**\n * @deprecated Use `algorand.appManager.compileTealTemplate` instead.\n *\n * Performs template substitution of a teal file and compiles it, returning the compiled result.\n *\n * Looks for `TMPL_{parameter}` for template replacements.\n *\n * @param tealCode The TEAL logic to compile\n * @param algod An algod client\n * @param templateParams Any parameters to replace in the .teal file before compiling\n * @param deploymentMetadata The deployment metadata the app will be deployed with\n * @returns The information about the compiled code\n */\nexport async function performTemplateSubstitutionAndCompile(\n tealCode: string,\n algod: Algodv2,\n templateParams?: TealTemplateParams,\n deploymentMetadata?: AppDeployMetadata,\n): Promise<CompiledTeal> {\n tealCode = stripTealComments(tealCode)\n\n tealCode = performTemplateSubstitution(tealCode, templateParams)\n\n if (deploymentMetadata) {\n tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata)\n }\n\n return await compileTeal(tealCode, algod)\n}\n\n/**\n * @deprecated Use `AppManager.stripTealComments` instead.\n *\n * Remove comments from TEAL Code\n *\n * @param tealCode The TEAL logic to compile\n * @returns The TEAL without comments\n */\nexport function stripTealComments(tealCode: string) {\n return AppManager.stripTealComments(tealCode)\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAiCA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,SAAS,CAC7B,UAA+B,EAC/B,KAAc,EACd,OAAiB,EAAA;AAejB,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAI,mBAAmB,CAAC;QACtB,KAAK;QACL,SAAS,EAAE,MAAM,0BAA0B,CAAC,UAAU,CAAC,IAAI,CAAC;QAC5D,kBAAkB,EAAE,YAClB,UAAU,CAAC,iBAAiB,GAAG,EAAE,GAAG,UAAU,CAAC,iBAAiB,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE;QAC9G,UAAU;AACX,KAAA,CAAC;IACJ,MAAM,QAAQ,GAAG,IAAI,WAAW,CAC9B,UAAU,EACV,IAAI,+BAA+B,CAAC,QAAQ,EAAE,IAAI,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,EAC5F,OAAO,CACR;AAED,IAAA,MAAM,YAAY,GAAG;QACnB,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;AAC/C,QAAA,MAAM,EAAE,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC;AACzC,QAAA,iBAAiB,EAAE,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,KAAK,QAAQ,GAAG,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AAChI,QAAA,aAAa,EAAE,UAAU,CAAC,UAAU,EAAE,IAAI,EAA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EAAE,cAAmC,EAAA;IAC/F,OAAO,UAAU,CAAC,yBAAyB,CAAC,QAAQ,EAAE,cAAc,CAAC;AACvE;AAEA;;;;;;;;;;;;AAYG;AACI,eAAe,qCAAqC,CACzD,QAAgB,EAChB,KAAc,EACd,cAAmC,EACnC,kBAAsC,EAAA;AAEtC,IAAA,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC;AAEtC,IAAA,QAAQ,GAAG,2BAA2B,CAAC,QAAQ,EAAE,cAAc,CAAC;IAEhE,IAAI,kBAAkB,EAAE;AACtB,QAAA,QAAQ,GAAG,8BAA8B,CAAC,QAAQ,EAAE,kBAAkB,CAAC;;AAGzE,IAAA,OAAO,MAAM,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC;AAC3C;AAEA;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAC,QAAgB,EAAA;AAChD,IAAA,OAAO,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC;AAC/C;;;;"}
|
package/app.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export declare function decodeAppState(state: {
|
|
|
133
133
|
value: modelsv2.TealValue | modelsv2.EvalDelta;
|
|
134
134
|
}[]): AppState;
|
|
135
135
|
/**
|
|
136
|
-
* @deprecated Use `
|
|
136
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
137
137
|
*
|
|
138
138
|
* Returns the app args ready to load onto an app `Transaction` object
|
|
139
139
|
* @param args The app call args
|
|
@@ -148,7 +148,7 @@ export declare function getAppArgsForTransaction(args?: RawAppCallArgs): {
|
|
|
148
148
|
lease: Uint8Array | undefined;
|
|
149
149
|
} | undefined;
|
|
150
150
|
/**
|
|
151
|
-
* @deprecated Use `
|
|
151
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
152
152
|
*
|
|
153
153
|
* Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`
|
|
154
154
|
* @param args The ABI app call args
|
package/app.js
CHANGED
|
@@ -246,7 +246,7 @@ function decodeAppState(state) {
|
|
|
246
246
|
return types_appManager.AppManager.decodeAppState(state);
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
249
|
-
* @deprecated Use `
|
|
249
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
250
250
|
*
|
|
251
251
|
* Returns the app args ready to load onto an app `Transaction` object
|
|
252
252
|
* @param args The app call args
|
|
@@ -266,7 +266,7 @@ function getAppArgsForTransaction(args) {
|
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
/**
|
|
269
|
-
* @deprecated Use `
|
|
269
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
270
270
|
*
|
|
271
271
|
* Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`
|
|
272
272
|
* @param args The ABI app call args
|
package/app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.createTransaction.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":["legacySendAppT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Ae,CAAC,GAAwD,EAAA;AACtF,IAAA,OAAOC,6BAAgB,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAyB,EAAA;AACnD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACzF,CAAC;AAED;;;;;;;;AAQG;AACI,eAAe,UAAU,CAAC,KAAsB,EAAE,KAAc,EAAA;IACrE,OAAO,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,MAAM,KAAK,CAAC,kBAAkB,CAACC,aAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AACzG,CAAC;AAED;;;;;;;;AAQG;AACI,eAAe,WAAW,CAAC,QAAgB,EAAE,KAAc,EAAA;IAChE,OAAO,MAAM,IAAIJ,2BAAU,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;AAMG;AACU,MAAA,qBAAqB,GAAG,CAAC,MAAmC,KAAI;IAC3E,OAAO,cAAc,IAAI,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAA;AAChG;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"app.js","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.createTransaction.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `TransactionComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `TransactionComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":["legacySendAppTransactionBridge","getSenderAddress","AppManager","encodeLease","_getAppArgsForABICall","_getBoxReference","toNumber"],"mappings":";;;;;;;;AA0BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS;AAKpC,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ;AAClC,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB;AAE5D;;;;;;;;AAQG;AACI,eAAe,SAAS,CAC7B,MAAuB,EACvB,KAAc,EAAA;IAEd,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAAM,CAAC,gBAAgB,CAAC;IAClE,IAAI,UAAU,KAAK,OAAO,CAAC,qBAAqB,CAAC,YAAY,EAAE;AAC7D,QAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC;;AAG/E,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE;AAC1B,UAAE,MAAMA,2CAA8B,CAClC,KAAK,EACL,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,IAAI,EACX,MAAM,EACN;AACE,YAAA,MAAM,EAAEC,4BAAgB,CAAC,MAAM,CAAC,IAAI,CAAC;YACrC,UAAU;YACV,eAAe,EAAE,MAAM,CAAC,eAAe;YACvC,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;YAC3C,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,YAAY,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC,MAAM,C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AA,OAAOC,6BAAgB,CAAC,GAAG,CAAC;AAC9B;AAEA,SAAS,kBAAkB,CAAC,OAAyB,EAAA;AACnD,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC;AACzF;AAEA;;;;;;;;AAQG;AACI,eAAe,UAAU,CAAC,KAAsB,EAAE,KAAc,EAAA;IACrE,OAAO,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,MAAM,KAAK,CAAC,kBAAkB,CAACC,aAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACzG;AAEA;;;;;;;;AAQG;AACI,eAAe,WAAW,CAAC,QAAgB,EAAE,KAAc,EAAA;IAChE,OAAO,MAAM,IAAIJ,2BAAU,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC;AAC1D;AAEA;;;;;;AAMG;AACU,MAAA,qBAAqB,GAAG,CAAC,MAAmC,KAAI;IAC3E,OAAO,cAAc,IAAI,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE;AAChG;;;;;;;;;;;;;;;;;;;;;;"}
|
package/app.mjs
CHANGED
|
@@ -244,7 +244,7 @@ function decodeAppState(state) {
|
|
|
244
244
|
return AppManager.decodeAppState(state);
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
247
|
-
* @deprecated Use `
|
|
247
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
248
248
|
*
|
|
249
249
|
* Returns the app args ready to load onto an app `Transaction` object
|
|
250
250
|
* @param args The app call args
|
|
@@ -264,7 +264,7 @@ function getAppArgsForTransaction(args) {
|
|
|
264
264
|
};
|
|
265
265
|
}
|
|
266
266
|
/**
|
|
267
|
-
* @deprecated Use `
|
|
267
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
268
268
|
*
|
|
269
269
|
* Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`
|
|
270
270
|
* @param args The ABI app call args
|
package/app.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.mjs","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.createTransaction.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `AlgoKitComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":[],"mappings":";;;;;;AA0BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAKpC,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;AAClC,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAA;AAE5D;;;;;;;;AAQG;AACI,eAAe,SAAS,CAC7B,MAAuB,EACvB,KAAc,EAAA;IAEd,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAA;IAClE,IAAI,UAAU,KAAK,OAAO,CAAC,qBAAqB,CAAC,YAAY,EAAE;AAC7D,QAAA,MAAM,IAAI,KAAK,CAAC,4DAA4D,C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gB,EAAE,KAAc,EAAA;IAChE,OAAO,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;AAC1D,CAAC;AAED;;;;;;AAMG;AACU,MAAA,qBAAqB,GAAG,CAAC,MAAmC,KAAI;IAC3E,OAAO,cAAc,IAAI,MAAM,GAAG,MAAM,CAAC,YAAY,EAAE,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,YAAY,EAAE,CAAA;AAChG;;;;"}
|
|
1
|
+
{"version":3,"file":"app.mjs","sources":["../src/app.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { _getAppArgsForABICall, _getBoxReference, legacySendAppTransactionBridge } from './transaction/legacy-bridge'\nimport { encodeLease, getSenderAddress } from './transaction/transaction'\nimport {\n ABIAppCallArgs,\n ABIReturn,\n AppCallArgs,\n AppCallParams,\n AppCallTransactionResult,\n AppCallType,\n AppCompilationResult,\n AppReference,\n AppState,\n BoxIdentifier,\n BoxName,\n BoxReference,\n BoxValueRequestParams,\n BoxValuesRequestParams,\n CompiledTeal,\n CreateAppParams,\n RawAppCallArgs,\n UpdateAppParams,\n} from './types/app'\nimport { AppManager } from './types/app-manager'\nimport { SendTransactionFrom } from './types/transaction'\nimport { toNumber } from './util'\nimport ABIMethod = algosdk.ABIMethod\nimport ABIMethodParams = algosdk.ABIMethodParams\nimport ABIValue = algosdk.ABIValue\nimport Address = algosdk.Address\nimport Algodv2 = algosdk.Algodv2\nimport modelsv2 = algosdk.modelsv2\nimport OnApplicationComplete = algosdk.OnApplicationComplete\n\n/**\n * @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`\n * / `algorand.createTransaction.appCreateMethodCall()` instead\n *\n * Creates a smart contract app, returns the details of the created app.\n * @param create The parameters to create the app with\n * @param algod An algod client\n * @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result\n */\nexport async function createApp(\n create: CreateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference> {\n const onComplete = getAppOnCompleteAction(create.onCompleteAction)\n if (onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot create an app with on-complete action of ClearState')\n }\n\n const result = create.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreateMethodCall,\n (c) => c.appCreateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n create.from,\n create.args,\n create,\n {\n sender: getSenderAddress(create.from),\n onComplete,\n approvalProgram: create.approvalProgram,\n clearStateProgram: create.clearStateProgram,\n extraProgramPages: create.schema.extraPages,\n schema: create.schema,\n },\n (c) => c.appCreate,\n (c) => c.appCreate,\n )\n\n return { ...result, appId: 'appId' in result ? Number(result.appId) : 0, appAddress: 'appAddress' in result ? result.appAddress : '' }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Updates a smart contract app.\n * @param update The parameters to update the app with\n * @param algod An algod client\n * @returns The transaction send result and the compilation result\n */\nexport async function updateApp(\n update: UpdateAppParams,\n algod: Algodv2,\n): Promise<Partial<AppCompilationResult> & AppCallTransactionResult> {\n return update.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method),\n },\n (c) => c.appUpdateMethodCall,\n (c) => c.appUpdateMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n update.from,\n update.args,\n update,\n {\n appId: BigInt(update.appId),\n sender: getSenderAddress(update.from),\n onComplete: algosdk.OnApplicationComplete.UpdateApplicationOC,\n approvalProgram: update.approvalProgram,\n clearStateProgram: update.clearStateProgram,\n },\n (c) => c.appUpdate,\n (c) => c.appUpdate,\n )\n}\n\n/**\n * @deprecated Use `algosdk.OnApplicationComplete` directly instead.\n *\n * Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.\n *\n * If given `undefined` will return `OnApplicationComplete.NoOpOC`.\n *\n * If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.\n *\n * @param onCompletionAction The on completion action\n * @returns The `algosdk.OnApplicationComplete`\n */\nexport function getAppOnCompleteAction(onCompletionAction?: AppCallType | OnApplicationComplete) {\n switch (onCompletionAction) {\n case undefined:\n case 'no_op':\n case OnApplicationComplete.NoOpOC:\n return OnApplicationComplete.NoOpOC\n case 'opt_in':\n case OnApplicationComplete.OptInOC:\n return OnApplicationComplete.OptInOC\n case 'close_out':\n case OnApplicationComplete.CloseOutOC:\n return OnApplicationComplete.CloseOutOC\n case 'clear_state':\n case OnApplicationComplete.ClearStateOC:\n return OnApplicationComplete.ClearStateOC\n case 'update_application':\n case OnApplicationComplete.UpdateApplicationOC:\n return OnApplicationComplete.UpdateApplicationOC\n case 'delete_application':\n case OnApplicationComplete.DeleteApplicationOC:\n return OnApplicationComplete.DeleteApplicationOC\n }\n}\n\n/**\n * @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`\n * / `algorand.createTransaction.appUpdateMethodCall()` instead\n *\n * Issues a call to a given app.\n * @param call The call details.\n * @param algod An algod client\n * @returns The result of the call\n */\nexport async function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult> {\n const onComplete = getAppOnCompleteAction(call.callType)\n if (onComplete === algosdk.OnApplicationComplete.UpdateApplicationOC) {\n throw new Error('Cannot execute an app call with on-complete action of Update')\n }\n if (call.args?.method && onComplete === algosdk.OnApplicationComplete.ClearStateOC) {\n throw new Error('Cannot execute an ABI method call with on-complete action of ClearState')\n }\n\n return call.args?.method\n ? await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n onComplete: onComplete as any,\n method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),\n },\n (c) => c.appCallMethodCall,\n (c) => c.appCallMethodCall,\n )\n : await legacySendAppTransactionBridge(\n algod,\n call.from,\n call.args,\n call,\n {\n appId: BigInt(call.appId),\n sender: getSenderAddress(call.from),\n onComplete,\n },\n (c) => c.appCall,\n (c) => c.appCall,\n )\n}\n\n/**\n * @deprecated Use `AppManager.getABIReturn` instead.\n *\n * Returns any ABI return values for the given app call arguments and transaction confirmation.\n * @param args The arguments that were used for the call\n * @param confirmation The transaction confirmation from algod\n * @returns The return value for the method call\n */\nexport function getABIReturn(args?: AppCallArgs, confirmation?: modelsv2.PendingTransactionResponse): ABIReturn | undefined {\n if (!args || !args.method) {\n return undefined\n }\n const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method)\n\n return AppManager.getABIReturn(confirmation, method)\n}\n\n/**\n * @deprecated Use `algorand.app.getGlobalState` instead.\n *\n * Returns the current global state values for the given app ID\n * @param appId The ID of the app return global state for\n * @param algod An algod client instance\n * @returns The current global state\n */\nexport async function getAppGlobalState(appId: number | bigint, algod: Algodv2) {\n return await new AppManager(algod).getGlobalState(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getLocalState` instead.\n *\n * Returns the current global state values for the given app ID and account\n * @param appId The ID of the app return global state for\n * @param account Either the string address of an account or an account object for the account to get local state for the given app\n * @param algod An algod client instance\n * @returns The current local state for the given (app, account) combination\n */\nexport async function getAppLocalState(appId: number | bigint, account: string | SendTransactionFrom, algod: Algodv2) {\n return new AppManager(algod).getLocalState(BigInt(appId), getSenderAddress(account))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxNames` instead.\n * Returns the names of the boxes for the given app.\n * @param appId The ID of the app return box names for\n * @param algod An algod client instance\n * @returns The current box names\n */\nexport async function getAppBoxNames(appId: number | bigint, algod: Algodv2): Promise<BoxName[]> {\n return new AppManager(algod).getBoxNames(BigInt(appId))\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValue` instead.\n * Returns the value of the given box name for the given app.\n * @param appId The ID of the app return box names for\n * @param boxName The name of the box to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box value as a byte array\n */\nexport async function getAppBoxValue(appId: number | bigint, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array> {\n return new AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== 'string' && 'name' in boxName ? boxName.nameRaw : boxName)\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValues` instead.\n * Returns the value of the given box names for the given app.\n * @param appId The ID of the app return box names for\n * @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`\n * @param algod An algod client instance\n * @returns The current box values as a byte array in the same order as the passed in box names\n */\nexport async function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]> {\n return new AppManager(algod).getBoxValues(\n BigInt(appId),\n boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n )\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValueFromABIType` instead.\n * Returns the value of the given box name for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box value as an ABI value\n */\nexport async function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue> {\n return new AppManager(algod).getBoxValueFromABIType({\n appId: BigInt(request.appId),\n boxName: typeof request.boxName !== 'string' && 'name' in request.boxName ? request.boxName.nameRaw : request.boxName,\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.\n * Returns the value of the given box names for the given app decoded based on the given ABI type.\n * @param request The parameters for the box value request\n * @param algod An algod client instance\n * @returns The current box values as an ABI value in the same order as the passed in box names\n */\nexport async function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]> {\n return new AppManager(algod).getBoxValuesFromABIType({\n appId: BigInt(request.appId),\n boxNames: request.boxNames.map((b) => (typeof b !== 'string' && 'name' in b ? b.nameRaw : b)),\n type: request.type,\n })\n}\n\n/**\n * @deprecated Use `AppManager.decodeAppState` instead.\n *\n * Converts an array of global/local state values from the algod api to a more friendly\n * generic object keyed by the UTF-8 value of the key.\n * @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`\n * @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values\n */\nexport function decodeAppState(state: { key: string; value: modelsv2.TealValue | modelsv2.EvalDelta }[]): AppState {\n return AppManager.decodeAppState(state)\n}\n\n/**\n * @deprecated Use `TransactionComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an app `Transaction` object\n * @param args The app call args\n * @returns The args ready to load into a `Transaction`\n */\nexport function getAppArgsForTransaction(args?: RawAppCallArgs) {\n if (!args) return undefined\n\n const encoder = new TextEncoder()\n return {\n accounts: args?.accounts?.map(_getAccountAddress),\n appArgs: args?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a)),\n boxes: args.boxes?.map(getBoxReference),\n foreignApps: args?.apps,\n foreignAssets: args?.assets,\n lease: encodeLease(args?.lease),\n }\n}\n\n/**\n * @deprecated Use `TransactionComposer` methods to construct transactions instead.\n *\n * Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`\n * @param args The ABI app call args\n * @param from The transaction signer\n * @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer\n */\nexport async function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n return _getAppArgsForABICall(args, from)\n}\n\n/**\n * @deprecated Use `AppManager.getBoxReference()` instead.\n *\n * Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.\n * @param box The box to return a reference for\n * @returns The box reference ready to pass into a `Transaction`\n */\nexport function getBoxReference(box: BoxIdentifier | BoxReference | algosdk.BoxReference): algosdk.BoxReference {\n return _getBoxReference(box)\n}\n\nfunction _getAccountAddress(account: string | Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/**\n * @deprecated Use `algorand.app.getById` instead.\n *\n * Gets the current data for the given app from algod.\n *\n * @param appId The id of the app\n * @param algod An algod client\n * @returns The data about the app\n */\nexport async function getAppById(appId: number | bigint, algod: Algodv2) {\n return modelsv2.Application.from_obj_for_encoding(await algod.getApplicationByID(toNumber(appId)).do())\n}\n\n/**\n * @deprecated Use `algorand.app.compileTeal` instead.\n *\n * Compiles the given TEAL using algod and returns the result, including source map.\n *\n * @param algod An algod client\n * @param tealCode The TEAL code\n * @returns The information about the compiled file\n */\nexport async function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal> {\n return await new AppManager(algod).compileTeal(tealCode)\n}\n\n/**\n * @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.\n *\n * Returns the encoded ABI spec for a given ABI Method\n * @param method The method to return a signature for\n * @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`\n */\nexport const getABIMethodSignature = (method: ABIMethodParams | ABIMethod) => {\n return 'getSignature' in method ? method.getSignature() : new ABIMethod(method).getSignature()\n}\n"],"names":[],"mappings":";;;;;;AA0BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS;AAKpC,IAAO,QAAQ,GAAG,OAAO,CAAC,QAAQ;AAClC,IAAO,qBAAqB,GAAG,OAAO,CAAC,qBAAqB;AAE5D;;;;;;;;AAQG;AACI,eAAe,SAAS,CAC7B,MAAuB,EACvB,KAAc,EAAA;IAEd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