@algorandfoundation/algokit-utils 7.0.0-beta.21 → 7.0.0-beta.23
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/app-deploy.js +2 -10
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +2 -10
- package/app-deploy.mjs.map +1 -1
- package/package.json +1 -1
- package/transaction/legacy-bridge.js +1 -1
- package/transaction/legacy-bridge.js.map +1 -1
- package/transaction/legacy-bridge.mjs +1 -1
- package/transaction/legacy-bridge.mjs.map +1 -1
- package/types/account-manager.js +1 -1
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +1 -1
- package/types/account-manager.mjs.map +1 -1
- package/types/algorand-client-interface.d.ts +1 -1
- package/types/algorand-client-transaction-creator.d.ts +1 -1
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +1 -1
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +1 -1
- package/types/algorand-client.js +1 -1
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +1 -1
- package/types/algorand-client.mjs.map +1 -1
- package/types/app-arc56.d.ts +4 -4
- package/types/app-arc56.js.map +1 -1
- package/types/app-arc56.mjs.map +1 -1
- package/types/app-client.d.ts +3 -4
- package/types/app-client.js +2 -6
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +2 -6
- 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 +1 -1
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-manager.js +103 -10
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +103 -10
- package/types/app-manager.mjs.map +1 -1
- package/types/asset-manager.d.ts +1 -1
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs.map +1 -1
- package/types/composer.d.ts +3 -3
- package/types/composer.js +3 -5
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +3 -3
- package/types/composer.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 +1 -1
- package/types/kmd-account-manager.mjs.map +1 -1
package/app-deploy.js
CHANGED
|
@@ -30,7 +30,7 @@ var types_composer = require('./types/composer.js');
|
|
|
30
30
|
*/
|
|
31
31
|
async function deployApp(deployment, algod, indexer) {
|
|
32
32
|
const appManager = new types_appManager.AppManager(algod);
|
|
33
|
-
const newGroup = () => new types_composer.
|
|
33
|
+
const newGroup = () => new types_composer.TransactionComposer({
|
|
34
34
|
algod,
|
|
35
35
|
getSigner: () => transaction.getSenderTransactionSigner(deployment.from),
|
|
36
36
|
getSuggestedParams: async () => deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),
|
|
@@ -253,15 +253,7 @@ async function performTemplateSubstitutionAndCompile(tealCode, algod, templatePa
|
|
|
253
253
|
* @returns The TEAL without comments
|
|
254
254
|
*/
|
|
255
255
|
function stripTealComments(tealCode) {
|
|
256
|
-
|
|
257
|
-
const regex = /\/\/(?=([^"\\]*(\\.|"([^"\\]*\\.)*[^"\\]*"))*[^"]*$)/;
|
|
258
|
-
tealCode = tealCode
|
|
259
|
-
.split('\n')
|
|
260
|
-
.map((tealCodeLine) => {
|
|
261
|
-
return tealCodeLine.split(regex)[0].trim();
|
|
262
|
-
})
|
|
263
|
-
.join('\n');
|
|
264
|
-
return tealCode;
|
|
256
|
+
return types_appManager.AppManager.stripTealComments(tealCode);
|
|
265
257
|
}
|
|
266
258
|
|
|
267
259
|
exports.deployApp = deployApp;
|
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 TransactionComposer, {\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 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 // 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","TransactionComposer","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,sBAAmB,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,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,UAAU,CAAC,eAAe;QAC3C,iBAAiB,EAAE,UAAU,CAAC,iBAAiB;AAC/C,QAAA,MAAM,EAAEC,4BAAgB,CAAC,UAAU,CAAC,IAAI,CAA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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,CAAA;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,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,UAAU,CAAC,eAAe;QAC3C,iBAAiB,EAAE,UA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mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { APP_DEPLOY_NOTE_DAPP } from './types/app.mjs';
|
|
|
7
7
|
import { AppDeployer } from './types/app-deployer.mjs';
|
|
8
8
|
import { AppManager } from './types/app-manager.mjs';
|
|
9
9
|
import { AssetManager } from './types/asset-manager.mjs';
|
|
10
|
-
import TransactionComposer from './types/composer.mjs';
|
|
10
|
+
import { TransactionComposer } from './types/composer.mjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* @deprecated Use `algorand.appDeployer.deploy` instead.
|
|
@@ -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 TransactionComposer, {\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 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 // find // outside quotes, i.e. won't pick up \"//not a comment\"\n const regex = /\\/\\/(?=([^\"\\\\]*(\\\\.|\"([^\"\\\\]*\\\\.)*[^\"\\\\]*\"))*[^\"]*$)/\n\n tealCode = tealCode\n .split('\\n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,EAAA;IACnH,OAAO,UAAU,CAAC,0CAA0C,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;AAChF,CAAC;AAED;;;;;;;;;;AAUG;AACa,SAAA,2BAA2B,CAAC,QAAgB,EAAE,cAAmC,EAAA;IAC/F,OAAO,UAAU,CAAC,yBAAyB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;AACvE,CAAC;AAED;;;;;;;;;;;;AAYG;AACI,eAAe,qCAAqC,CACzD,QAAgB,EAChB,KAAc,EACd,cAAmC,EACnC,kBAAsC,EAAA;AAEtC,IAAA,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAEtC,IAAA,QAAQ,GAAG,2BAA2B,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;IAEhE,IAAI,kBAAkB,EAAE;AACtB,QAAA,QAAQ,GAAG,8BAA8B,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;KACxE;AAED,IAAA,OAAO,MAAM,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAC,QAAgB,EAAA;;IAEhD,MAAM,KAAK,GAAG,sDAAsD,CAAA;AAEpE,IAAA,QAAQ,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.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":";;;;;;;;;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;;AAUG;AACa,SAAA,2BAA2B,CAAC,QAAgB,EAAE,cAAmC,EAAA;IAC/F,OAAO,UAAU,CAAC,yBAAyB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;AACvE,CAAC;AAED;;;;;;;;;;;;AAYG;AACI,eAAe,qCAAqC,CACzD,QAAgB,EAChB,KAAc,EACd,cAAmC,EACnC,kBAAsC,EAAA;AAEtC,IAAA,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAEtC,IAAA,QAAQ,GAAG,2BAA2B,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;IAEhE,IAAI,kBAAkB,EAAE;AACtB,QAAA,QAAQ,GAAG,8BAA8B,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;KACxE;AAED,IAAA,OAAO,MAAM,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAED;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAAC,QAAgB,EAAA;AAChD,IAAA,OAAO,UAAU,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAC/C;;;;"}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-utils",
|
|
9
|
-
"version": "7.0.0-beta.
|
|
9
|
+
"version": "7.0.0-beta.23",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
12
12
|
"author": "Algorand Foundation",
|
|
@@ -12,7 +12,7 @@ var ABIMethod = algosdk.ABIMethod;
|
|
|
12
12
|
/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */
|
|
13
13
|
async function legacySendTransactionBridge(algod, from, sendParams, params, txn, send, suggestedParams) {
|
|
14
14
|
const appManager = new types_appManager.AppManager(algod);
|
|
15
|
-
const newGroup = () => new types_composer.
|
|
15
|
+
const newGroup = () => new types_composer.TransactionComposer({
|
|
16
16
|
algod,
|
|
17
17
|
getSigner: () => transaction.getSenderTransactionSigner(from),
|
|
18
18
|
getSuggestedParams: async () => (suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-bridge.js","sources":["../../src/transaction/legacy-bridge.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgorandClientTransactionCreator } from '../types/algorand-client-transaction-creator'\nimport { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender'\nimport { ABIAppCallArgs, BoxIdentifier as LegacyBoxIdentifier, BoxReference as LegacyBoxReference, RawAppCallArgs } from '../types/app'\nimport { AppManager, BoxReference } from '../types/app-manager'\nimport { AssetManager } from '../types/asset-manager'\nimport TransactionComposer, {\n AppCallMethodCall,\n AppCallParams,\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n BuiltTransactions,\n CommonTransactionParams,\n} from '../types/composer'\nimport {\n SendParams,\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionNote,\n} from '../types/transaction'\nimport { encodeLease, encodeTransactionNote, getSenderAddress, getSenderTransactionSigner } from './transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Transaction = algosdk.Transaction\nimport ABIMethod = algosdk.ABIMethod\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */\nexport async function legacySendTransactionBridge<T extends CommonTransactionParams, TResult extends SendSingleTransactionResult>(\n algod: Algodv2,\n from: SendTransactionFrom,\n sendParams: SendTransactionParams,\n params: T,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(from),\n getSuggestedParams: async () => (suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()),\n appManager,\n })\n const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager)\n const transactionCreator = new AlgorandClientTransactionCreator(newGroup)\n\n if (sendParams.fee) {\n params.staticFee = sendParams.fee\n }\n\n if (sendParams.maxFee) {\n params.maxFee = sendParams.maxFee\n }\n\n if (sendParams.atc || sendParams.skipSending) {\n const transaction = await txn(transactionCreator)(params)\n const txns = 'transactions' in transaction ? transaction.transactions : [transaction]\n if (sendParams.atc) {\n const baseIndex = sendParams.atc.count()\n txns\n .map((txn, i) => ({\n txn,\n signer:\n 'signers' in transaction ? transaction.signers.get(i) ?? getSenderTransactionSigner(from) : getSenderTransactionSigner(from),\n }))\n .forEach((t) => sendParams.atc!.addTransaction(t))\n // Populate ATC with method calls\n if ('transactions' in transaction) {\n transaction.methodCalls.forEach((m, i) => sendParams.atc!['methodCalls'].set(i + baseIndex, m))\n }\n }\n return { transaction: txns.at(-1)!, transactions: txns }\n }\n\n return { ...(await send(transactionSender)({ ...sendParams, ...params })) }\n}\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour for app transactions and new `AlgorandClient` behaviour. */\nexport async function legacySendAppTransactionBridge<\n T extends\n | AppCreateParams\n | AppUpdateParams\n | AppDeleteParams\n | AppCallParams\n | AppCreateMethodCall\n | AppUpdateMethodCall\n | AppDeleteMethodCall\n | AppCallMethodCall,\n TResult extends SendSingleTransactionResult,\n>(\n algod: Algodv2,\n from: SendTransactionFrom,\n appArgs: RawAppCallArgs | ABIAppCallArgs | undefined,\n sendParams: SendTransactionParams & { note?: TransactionNote },\n params: Omit<T, 'accountReferences' | 'appReferences' | 'assetReferences' | 'boxReferences' | 'args' | 'lease' | 'rekeyTo' | 'note'>,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const encoder = new TextEncoder()\n\n const paramsWithAppArgs = {\n ...params,\n accountReferences: appArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: appArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: appArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: appArgs?.boxes?.map(_getBoxReference)?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: appArgs?.lease,\n rekeyTo: appArgs?.rekeyTo ? getSenderAddress(appArgs?.rekeyTo) : undefined,\n args: appArgs\n ? 'methodArgs' in appArgs\n ? (await _getAppArgsForABICall(appArgs, from)).methodArgs\n : appArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n note: encodeTransactionNote(sendParams?.note),\n } as T\n\n return await legacySendTransactionBridge(algod, from, sendParams, paramsWithAppArgs, txn, send, suggestedParams)\n}\n\n/**\n * @deprecated\n */\nexport async function _getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n const signer = getSenderTransactionSigner(from)\n const methodArgs = await Promise.all(\n ('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => {\n if (a === undefined) {\n throw new Error(`Argument at position ${index} does not have a value`)\n }\n if (typeof a !== 'object') {\n return a\n }\n // Handle the various forms of transactions to wrangle them for ATC\n return 'txn' in a\n ? a\n : a instanceof Promise\n ? { txn: (await a).transaction, signer }\n : 'transaction' in a\n ? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer }\n : 'txID' in a\n ? { txn: a, signer }\n : a\n }),\n )\n return {\n method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method),\n sender: getSenderAddress(from),\n signer: signer,\n boxes: args.boxes?.map(_getBoxReference),\n lease: encodeLease(args.lease),\n appForeignApps: args.apps,\n appForeignAssets: args.assets,\n appAccounts: args.accounts?.map(_getAccountAddress),\n methodArgs: methodArgs,\n rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined,\n }\n}\n\nfunction _getAccountAddress(account: string | algosdk.Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/** @deprecated */\nexport function _getBoxReference(box: LegacyBoxIdentifier | LegacyBoxReference | algosdk.BoxReference): algosdk.BoxReference {\n const encoder = new TextEncoder()\n\n if (typeof box === 'object' && 'appIndex' in box) {\n return box\n }\n\n const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box }\n return {\n appIndex: ref.appId,\n name:\n typeof ref.name === 'string'\n ? encoder.encode(ref.name)\n : 'length' in ref.name\n ? ref.name\n : algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey,\n } as algosdk.BoxReference\n}\n"],"names":["AppManager","TransactionComposer","getSenderTransactionSigner","AlgorandClientTransactionSender","AssetManager","AlgorandClientTransactionCreator","transaction","getSenderAddress","encodeTransactionNote","encodeLease"],"mappings":";;;;;;;;;;AA6BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAEpC;AACO,eAAe,2BAA2B,CAC/C,KAAc,EACd,IAAyB,EACzB,UAAiC,EACjC,MAAS,EACT,GAEwF,EACxF,IAA0F,EAC1F,eAAyC,EAAA;AAEzC,IAAA,MAAM,UAAU,GAAG,IAAIA,2BAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAIC,sBAAmB,CAAC;QACtB,KAAK;AACL,QAAA,SAAS,EAAE,MAAMC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IAAI,CAAC,OAAO,GAAGF,4BAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS;KACxH,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAiC,EAAA;AAC3D,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACzF,CAAC;AAED;AACM,SAAU,gBAAgB,CAAC,GAAoE,EAAA;AACnG,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IAEjC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,UAAU,IAAI,GAAG,EAAE;AAChD,QAAA,OAAO,GAAG,CAAA;KACX;IAED,MAAM,GAAG,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,IAAI,GAAG,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;IACrF,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,KAAK;AACnB,QAAA,IAAI,EACF,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;cACxB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;AAC1B,cAAE,QAAQ,IAAI,GAAG,CAAC,IAAI;kBAClB,GAAG,CAAC,IAAI;AACV,kBAAE,OAAO,CAAC,aAAa,CAACA,4BAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAA;AAC3B;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"legacy-bridge.js","sources":["../../src/transaction/legacy-bridge.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgorandClientTransactionCreator } from '../types/algorand-client-transaction-creator'\nimport { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender'\nimport { ABIAppCallArgs, BoxIdentifier as LegacyBoxIdentifier, BoxReference as LegacyBoxReference, RawAppCallArgs } from '../types/app'\nimport { AppManager, BoxReference } from '../types/app-manager'\nimport { AssetManager } from '../types/asset-manager'\nimport {\n AppCallMethodCall,\n AppCallParams,\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n BuiltTransactions,\n CommonTransactionParams,\n TransactionComposer,\n} from '../types/composer'\nimport {\n SendParams,\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionNote,\n} from '../types/transaction'\nimport { encodeLease, encodeTransactionNote, getSenderAddress, getSenderTransactionSigner } from './transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Transaction = algosdk.Transaction\nimport ABIMethod = algosdk.ABIMethod\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */\nexport async function legacySendTransactionBridge<T extends CommonTransactionParams, TResult extends SendSingleTransactionResult>(\n algod: Algodv2,\n from: SendTransactionFrom,\n sendParams: SendTransactionParams,\n params: T,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(from),\n getSuggestedParams: async () => (suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()),\n appManager,\n })\n const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager)\n const transactionCreator = new AlgorandClientTransactionCreator(newGroup)\n\n if (sendParams.fee) {\n params.staticFee = sendParams.fee\n }\n\n if (sendParams.maxFee) {\n params.maxFee = sendParams.maxFee\n }\n\n if (sendParams.atc || sendParams.skipSending) {\n const transaction = await txn(transactionCreator)(params)\n const txns = 'transactions' in transaction ? transaction.transactions : [transaction]\n if (sendParams.atc) {\n const baseIndex = sendParams.atc.count()\n txns\n .map((txn, i) => ({\n txn,\n signer:\n 'signers' in transaction ? transaction.signers.get(i) ?? getSenderTransactionSigner(from) : getSenderTransactionSigner(from),\n }))\n .forEach((t) => sendParams.atc!.addTransaction(t))\n // Populate ATC with method calls\n if ('transactions' in transaction) {\n transaction.methodCalls.forEach((m, i) => sendParams.atc!['methodCalls'].set(i + baseIndex, m))\n }\n }\n return { transaction: txns.at(-1)!, transactions: txns }\n }\n\n return { ...(await send(transactionSender)({ ...sendParams, ...params })) }\n}\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour for app transactions and new `AlgorandClient` behaviour. */\nexport async function legacySendAppTransactionBridge<\n T extends\n | AppCreateParams\n | AppUpdateParams\n | AppDeleteParams\n | AppCallParams\n | AppCreateMethodCall\n | AppUpdateMethodCall\n | AppDeleteMethodCall\n | AppCallMethodCall,\n TResult extends SendSingleTransactionResult,\n>(\n algod: Algodv2,\n from: SendTransactionFrom,\n appArgs: RawAppCallArgs | ABIAppCallArgs | undefined,\n sendParams: SendTransactionParams & { note?: TransactionNote },\n params: Omit<T, 'accountReferences' | 'appReferences' | 'assetReferences' | 'boxReferences' | 'args' | 'lease' | 'rekeyTo' | 'note'>,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const encoder = new TextEncoder()\n\n const paramsWithAppArgs = {\n ...params,\n accountReferences: appArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: appArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: appArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: appArgs?.boxes?.map(_getBoxReference)?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: appArgs?.lease,\n rekeyTo: appArgs?.rekeyTo ? getSenderAddress(appArgs?.rekeyTo) : undefined,\n args: appArgs\n ? 'methodArgs' in appArgs\n ? (await _getAppArgsForABICall(appArgs, from)).methodArgs\n : appArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n note: encodeTransactionNote(sendParams?.note),\n } as T\n\n return await legacySendTransactionBridge(algod, from, sendParams, paramsWithAppArgs, txn, send, suggestedParams)\n}\n\n/**\n * @deprecated\n */\nexport async function _getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n const signer = getSenderTransactionSigner(from)\n const methodArgs = await Promise.all(\n ('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => {\n if (a === undefined) {\n throw new Error(`Argument at position ${index} does not have a value`)\n }\n if (typeof a !== 'object') {\n return a\n }\n // Handle the various forms of transactions to wrangle them for ATC\n return 'txn' in a\n ? a\n : a instanceof Promise\n ? { txn: (await a).transaction, signer }\n : 'transaction' in a\n ? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer }\n : 'txID' in a\n ? { txn: a, signer }\n : a\n }),\n )\n return {\n method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method),\n sender: getSenderAddress(from),\n signer: signer,\n boxes: args.boxes?.map(_getBoxReference),\n lease: encodeLease(args.lease),\n appForeignApps: args.apps,\n appForeignAssets: args.assets,\n appAccounts: args.accounts?.map(_getAccountAddress),\n methodArgs: methodArgs,\n rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined,\n }\n}\n\nfunction _getAccountAddress(account: string | algosdk.Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/** @deprecated */\nexport function _getBoxReference(box: LegacyBoxIdentifier | LegacyBoxReference | algosdk.BoxReference): algosdk.BoxReference {\n const encoder = new TextEncoder()\n\n if (typeof box === 'object' && 'appIndex' in box) {\n return box\n }\n\n const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box }\n return {\n appIndex: ref.appId,\n name:\n typeof ref.name === 'string'\n ? encoder.encode(ref.name)\n : 'length' in ref.name\n ? ref.name\n : algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey,\n } as algosdk.BoxReference\n}\n"],"names":["AppManager","TransactionComposer","getSenderTransactionSigner","AlgorandClientTransactionSender","AssetManager","AlgorandClientTransactionCreator","transaction","getSenderAddress","encodeTransactionNote","encodeLease"],"mappings":";;;;;;;;;;AA8BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAEpC;AACO,eAAe,2BAA2B,CAC/C,KAAc,EACd,IAAyB,EACzB,UAAiC,EACjC,MAAS,EACT,GAEwF,EACxF,IAA0F,EAC1F,eAAyC,EAAA;AAEzC,IAAA,MAAM,UAAU,GAAG,IAAIA,2BAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAIC,kCAAmB,CAAC;QACtB,KAAK;AACL,QAAA,SAAS,EAAE,MAAMC,sCAA0B,CAAC,IAAI,CAAC;QACjD,kBAAkB,EAAE,aAAa,eAAe,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC;QACpH,UAAU;AACX,KAAA,CAAC,CAAA;AACJ,IAAA,MAAM,iBAAiB,GAAG,IAAIC,qEAA+B,CAAC,QAAQ,EAAE,IAAIC,+BAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAA;AACtH,IAAA,MAAM,kBAAkB,GAAG,IAAIC,uEAAgC,CAAC,QAAQ,CAAC,CAAA;AAEzE,IAAA,IAAI,UAAU,CAAC,GAAG,EAAE;A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,OAAO,GAAG,CAAA;KACX;IAED,MAAM,GAAG,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,IAAI,GAAG,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;IACrF,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,KAAK;AACnB,QAAA,IAAI,EACF,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;cACxB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;AAC1B,cAAE,QAAQ,IAAI,GAAG,CAAC,IAAI;kBAClB,GAAG,CAAC,IAAI;AACV,kBAAE,OAAO,CAAC,aAAa,CAACA,4BAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAA;AAC3B;;;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { AlgorandClientTransactionCreator } from '../types/algorand-client-trans
|
|
|
3
3
|
import { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender.mjs';
|
|
4
4
|
import { AppManager } from '../types/app-manager.mjs';
|
|
5
5
|
import { AssetManager } from '../types/asset-manager.mjs';
|
|
6
|
-
import TransactionComposer from '../types/composer.mjs';
|
|
6
|
+
import { TransactionComposer } from '../types/composer.mjs';
|
|
7
7
|
import { getSenderTransactionSigner, getSenderAddress, encodeTransactionNote, encodeLease } from './transaction.mjs';
|
|
8
8
|
|
|
9
9
|
var ABIMethod = algosdk.ABIMethod;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-bridge.mjs","sources":["../../src/transaction/legacy-bridge.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgorandClientTransactionCreator } from '../types/algorand-client-transaction-creator'\nimport { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender'\nimport { ABIAppCallArgs, BoxIdentifier as LegacyBoxIdentifier, BoxReference as LegacyBoxReference, RawAppCallArgs } from '../types/app'\nimport { AppManager, BoxReference } from '../types/app-manager'\nimport { AssetManager } from '../types/asset-manager'\nimport TransactionComposer, {\n AppCallMethodCall,\n AppCallParams,\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n BuiltTransactions,\n CommonTransactionParams,\n} from '../types/composer'\nimport {\n SendParams,\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionNote,\n} from '../types/transaction'\nimport { encodeLease, encodeTransactionNote, getSenderAddress, getSenderTransactionSigner } from './transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Transaction = algosdk.Transaction\nimport ABIMethod = algosdk.ABIMethod\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */\nexport async function legacySendTransactionBridge<T extends CommonTransactionParams, TResult extends SendSingleTransactionResult>(\n algod: Algodv2,\n from: SendTransactionFrom,\n sendParams: SendTransactionParams,\n params: T,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(from),\n getSuggestedParams: async () => (suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()),\n appManager,\n })\n const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager)\n const transactionCreator = new AlgorandClientTransactionCreator(newGroup)\n\n if (sendParams.fee) {\n params.staticFee = sendParams.fee\n }\n\n if (sendParams.maxFee) {\n params.maxFee = sendParams.maxFee\n }\n\n if (sendParams.atc || sendParams.skipSending) {\n const transaction = await txn(transactionCreator)(params)\n const txns = 'transactions' in transaction ? transaction.transactions : [transaction]\n if (sendParams.atc) {\n const baseIndex = sendParams.atc.count()\n txns\n .map((txn, i) => ({\n txn,\n signer:\n 'signers' in transaction ? transaction.signers.get(i) ?? getSenderTransactionSigner(from) : getSenderTransactionSigner(from),\n }))\n .forEach((t) => sendParams.atc!.addTransaction(t))\n // Populate ATC with method calls\n if ('transactions' in transaction) {\n transaction.methodCalls.forEach((m, i) => sendParams.atc!['methodCalls'].set(i + baseIndex, m))\n }\n }\n return { transaction: txns.at(-1)!, transactions: txns }\n }\n\n return { ...(await send(transactionSender)({ ...sendParams, ...params })) }\n}\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour for app transactions and new `AlgorandClient` behaviour. */\nexport async function legacySendAppTransactionBridge<\n T extends\n | AppCreateParams\n | AppUpdateParams\n | AppDeleteParams\n | AppCallParams\n | AppCreateMethodCall\n | AppUpdateMethodCall\n | AppDeleteMethodCall\n | AppCallMethodCall,\n TResult extends SendSingleTransactionResult,\n>(\n algod: Algodv2,\n from: SendTransactionFrom,\n appArgs: RawAppCallArgs | ABIAppCallArgs | undefined,\n sendParams: SendTransactionParams & { note?: TransactionNote },\n params: Omit<T, 'accountReferences' | 'appReferences' | 'assetReferences' | 'boxReferences' | 'args' | 'lease' | 'rekeyTo' | 'note'>,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const encoder = new TextEncoder()\n\n const paramsWithAppArgs = {\n ...params,\n accountReferences: appArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: appArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: appArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: appArgs?.boxes?.map(_getBoxReference)?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: appArgs?.lease,\n rekeyTo: appArgs?.rekeyTo ? getSenderAddress(appArgs?.rekeyTo) : undefined,\n args: appArgs\n ? 'methodArgs' in appArgs\n ? (await _getAppArgsForABICall(appArgs, from)).methodArgs\n : appArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n note: encodeTransactionNote(sendParams?.note),\n } as T\n\n return await legacySendTransactionBridge(algod, from, sendParams, paramsWithAppArgs, txn, send, suggestedParams)\n}\n\n/**\n * @deprecated\n */\nexport async function _getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n const signer = getSenderTransactionSigner(from)\n const methodArgs = await Promise.all(\n ('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => {\n if (a === undefined) {\n throw new Error(`Argument at position ${index} does not have a value`)\n }\n if (typeof a !== 'object') {\n return a\n }\n // Handle the various forms of transactions to wrangle them for ATC\n return 'txn' in a\n ? a\n : a instanceof Promise\n ? { txn: (await a).transaction, signer }\n : 'transaction' in a\n ? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer }\n : 'txID' in a\n ? { txn: a, signer }\n : a\n }),\n )\n return {\n method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method),\n sender: getSenderAddress(from),\n signer: signer,\n boxes: args.boxes?.map(_getBoxReference),\n lease: encodeLease(args.lease),\n appForeignApps: args.apps,\n appForeignAssets: args.assets,\n appAccounts: args.accounts?.map(_getAccountAddress),\n methodArgs: methodArgs,\n rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined,\n }\n}\n\nfunction _getAccountAddress(account: string | algosdk.Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/** @deprecated */\nexport function _getBoxReference(box: LegacyBoxIdentifier | LegacyBoxReference | algosdk.BoxReference): algosdk.BoxReference {\n const encoder = new TextEncoder()\n\n if (typeof box === 'object' && 'appIndex' in box) {\n return box\n }\n\n const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box }\n return {\n appIndex: ref.appId,\n name:\n typeof ref.name === 'string'\n ? encoder.encode(ref.name)\n : 'length' in ref.name\n ? ref.name\n : algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey,\n } as algosdk.BoxReference\n}\n"],"names":[],"mappings":";;;;;;;;AA6BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAEpC;AACO,eAAe,2BAA2B,CAC/C,KAAc,EACd,IAAyB,EACzB,UAAiC,EACjC,MAAS,EACT,GAEwF,EACxF,IAA0F,EAC1F,eAAyC,EAAA;AAEzC,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ,GAAG,MACf,IAAI,mBAAmB,CAAC;QACtB,KAAK;AACL,QAAA,SAAS,EAAE,MAAM,0BAA0B,CAAC,IAAI,CAAC;QACjD,kBAAkB,EAAE,aAAa,eAAe,GAAG,EAAE,GAAG,eAAe,EAAE,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAC;QACpH,UAAU;AACX,KAAA,CAAC,CAAA;AACJ,IAAA,MAAM,iBAAiB,GAAG,IAAI,+BAA+B,CAAC,QAAQ,EAAE,IAAI,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAA;AACtH,IAAA,MAAM,kBAAkB,GAAG,IAAI,gCAAgC,CAAC,QAAQ,CAAC,CAAA;AAEzE,IAAA,IAAI,UAAU,CAAC,GAAG,EAAE;AAClB,QAAA,MAAM,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,CAAA;KAClC;AAED,IAAA,IAAI,UAAU,CAAC,MAAM,EAAE;AACrB,QAAA,MAAM,CAAC,MAAM,GAA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G,EAAE,CAAA;IACrF,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,KAAK;AACnB,QAAA,IAAI,EACF,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;cACxB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;AAC1B,cAAE,QAAQ,IAAI,GAAG,CAAC,IAAI;kBAClB,GAAG,CAAC,IAAI;AACV,kBAAE,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAA;AAC3B;;;;"}
|
|
1
|
+
{"version":3,"file":"legacy-bridge.mjs","sources":["../../src/transaction/legacy-bridge.ts"],"sourcesContent":["import algosdk from 'algosdk'\nimport { AlgorandClientTransactionCreator } from '../types/algorand-client-transaction-creator'\nimport { AlgorandClientTransactionSender } from '../types/algorand-client-transaction-sender'\nimport { ABIAppCallArgs, BoxIdentifier as LegacyBoxIdentifier, BoxReference as LegacyBoxReference, RawAppCallArgs } from '../types/app'\nimport { AppManager, BoxReference } from '../types/app-manager'\nimport { AssetManager } from '../types/asset-manager'\nimport {\n AppCallMethodCall,\n AppCallParams,\n AppCreateMethodCall,\n AppCreateParams,\n AppDeleteMethodCall,\n AppDeleteParams,\n AppUpdateMethodCall,\n AppUpdateParams,\n BuiltTransactions,\n CommonTransactionParams,\n TransactionComposer,\n} from '../types/composer'\nimport {\n SendParams,\n SendSingleTransactionResult,\n SendTransactionFrom,\n SendTransactionParams,\n SendTransactionResult,\n TransactionNote,\n} from '../types/transaction'\nimport { encodeLease, encodeTransactionNote, getSenderAddress, getSenderTransactionSigner } from './transaction'\nimport Algodv2 = algosdk.Algodv2\nimport Transaction = algosdk.Transaction\nimport ABIMethod = algosdk.ABIMethod\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour and new `AlgorandClient` behaviour. */\nexport async function legacySendTransactionBridge<T extends CommonTransactionParams, TResult extends SendSingleTransactionResult>(\n algod: Algodv2,\n from: SendTransactionFrom,\n sendParams: SendTransactionParams,\n params: T,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const appManager = new AppManager(algod)\n const newGroup = () =>\n new TransactionComposer({\n algod,\n getSigner: () => getSenderTransactionSigner(from),\n getSuggestedParams: async () => (suggestedParams ? { ...suggestedParams } : await algod.getTransactionParams().do()),\n appManager,\n })\n const transactionSender = new AlgorandClientTransactionSender(newGroup, new AssetManager(algod, newGroup), appManager)\n const transactionCreator = new AlgorandClientTransactionCreator(newGroup)\n\n if (sendParams.fee) {\n params.staticFee = sendParams.fee\n }\n\n if (sendParams.maxFee) {\n params.maxFee = sendParams.maxFee\n }\n\n if (sendParams.atc || sendParams.skipSending) {\n const transaction = await txn(transactionCreator)(params)\n const txns = 'transactions' in transaction ? transaction.transactions : [transaction]\n if (sendParams.atc) {\n const baseIndex = sendParams.atc.count()\n txns\n .map((txn, i) => ({\n txn,\n signer:\n 'signers' in transaction ? transaction.signers.get(i) ?? getSenderTransactionSigner(from) : getSenderTransactionSigner(from),\n }))\n .forEach((t) => sendParams.atc!.addTransaction(t))\n // Populate ATC with method calls\n if ('transactions' in transaction) {\n transaction.methodCalls.forEach((m, i) => sendParams.atc!['methodCalls'].set(i + baseIndex, m))\n }\n }\n return { transaction: txns.at(-1)!, transactions: txns }\n }\n\n return { ...(await send(transactionSender)({ ...sendParams, ...params })) }\n}\n\n/** @deprecated Bridges between legacy `sendTransaction` behaviour for app transactions and new `AlgorandClient` behaviour. */\nexport async function legacySendAppTransactionBridge<\n T extends\n | AppCreateParams\n | AppUpdateParams\n | AppDeleteParams\n | AppCallParams\n | AppCreateMethodCall\n | AppUpdateMethodCall\n | AppDeleteMethodCall\n | AppCallMethodCall,\n TResult extends SendSingleTransactionResult,\n>(\n algod: Algodv2,\n from: SendTransactionFrom,\n appArgs: RawAppCallArgs | ABIAppCallArgs | undefined,\n sendParams: SendTransactionParams & { note?: TransactionNote },\n params: Omit<T, 'accountReferences' | 'appReferences' | 'assetReferences' | 'boxReferences' | 'args' | 'lease' | 'rekeyTo' | 'note'>,\n txn:\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<Transaction>)\n | ((c: AlgorandClientTransactionCreator) => (params: T) => Promise<BuiltTransactions>),\n send: (c: AlgorandClientTransactionSender) => (params: T & SendParams) => Promise<TResult>,\n suggestedParams?: algosdk.SuggestedParams,\n): Promise<(SendTransactionResult | TResult) & { transactions: Transaction[] }> {\n const encoder = new TextEncoder()\n\n const paramsWithAppArgs = {\n ...params,\n accountReferences: appArgs?.accounts?.map((a) => (typeof a === 'string' ? a : algosdk.encodeAddress(a.publicKey))),\n appReferences: appArgs?.apps?.map((a) => BigInt(a)),\n assetReferences: appArgs?.assets?.map((a) => BigInt(a)),\n boxReferences: appArgs?.boxes?.map(_getBoxReference)?.map((r) => ({ appId: BigInt(r.appIndex), name: r.name }) satisfies BoxReference),\n lease: appArgs?.lease,\n rekeyTo: appArgs?.rekeyTo ? getSenderAddress(appArgs?.rekeyTo) : undefined,\n args: appArgs\n ? 'methodArgs' in appArgs\n ? (await _getAppArgsForABICall(appArgs, from)).methodArgs\n : appArgs?.appArgs?.map((a) => (typeof a === 'string' ? encoder.encode(a) : a))\n : undefined,\n note: encodeTransactionNote(sendParams?.note),\n } as T\n\n return await legacySendTransactionBridge(algod, from, sendParams, paramsWithAppArgs, txn, send, suggestedParams)\n}\n\n/**\n * @deprecated\n */\nexport async function _getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom) {\n const signer = getSenderTransactionSigner(from)\n const methodArgs = await Promise.all(\n ('methodArgs' in args ? args.methodArgs : args)?.map(async (a, index) => {\n if (a === undefined) {\n throw new Error(`Argument at position ${index} does not have a value`)\n }\n if (typeof a !== 'object') {\n return a\n }\n // Handle the various forms of transactions to wrangle them for ATC\n return 'txn' in a\n ? a\n : a instanceof Promise\n ? { txn: (await a).transaction, signer }\n : 'transaction' in a\n ? { txn: a.transaction, signer: 'signer' in a ? getSenderTransactionSigner(a.signer) : signer }\n : 'txID' in a\n ? { txn: a, signer }\n : a\n }),\n )\n return {\n method: 'txnCount' in args.method ? args.method : new ABIMethod(args.method),\n sender: getSenderAddress(from),\n signer: signer,\n boxes: args.boxes?.map(_getBoxReference),\n lease: encodeLease(args.lease),\n appForeignApps: args.apps,\n appForeignAssets: args.assets,\n appAccounts: args.accounts?.map(_getAccountAddress),\n methodArgs: methodArgs,\n rekeyTo: args?.rekeyTo ? (typeof args.rekeyTo === 'string' ? args.rekeyTo : getSenderAddress(args.rekeyTo)) : undefined,\n }\n}\n\nfunction _getAccountAddress(account: string | algosdk.Address) {\n return typeof account === 'string' ? account : algosdk.encodeAddress(account.publicKey)\n}\n\n/** @deprecated */\nexport function _getBoxReference(box: LegacyBoxIdentifier | LegacyBoxReference | algosdk.BoxReference): algosdk.BoxReference {\n const encoder = new TextEncoder()\n\n if (typeof box === 'object' && 'appIndex' in box) {\n return box\n }\n\n const ref = typeof box === 'object' && 'appId' in box ? box : { appId: 0, name: box }\n return {\n appIndex: ref.appId,\n name:\n typeof ref.name === 'string'\n ? encoder.encode(ref.name)\n : 'length' in ref.name\n ? ref.name\n : algosdk.decodeAddress(getSenderAddress(ref.name)).publicKey,\n } as algosdk.BoxReference\n}\n"],"names":[],"mappings":";;;;;;;;AA8BA,IAAO,SAAS,GAAG,OAAO,CAAC,SAAS,CAAA;AAEpC;AACO,eAAe,2BAA2B,CAC/C,KAAc,EACd,IAAyB,EACzB,UAAiC,EACjC,MAAS,EACT,GAEwF,EACxF,IAA0F,EAC1F,eAAyC,EAAA;AAEzC,IAAA,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,KAAK,CAAC,CAAA;AACxC,IAAA,MAAM,QAAQ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AAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,GAAG,IAAI,CAAC,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS;KACxH,CAAA;AACH,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAiC,EAAA;AAC3D,IAAA,OAAO,OAAO,OAAO,KAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;AACzF,CAAC;AAED;AACM,SAAU,gBAAgB,CAAC,GAAoE,EAAA;AACnG,IAAA,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAA;IAEjC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,UAAU,IAAI,GAAG,EAAE;AAChD,QAAA,OAAO,GAAG,CAAA;KACX;IAED,MAAM,GAAG,GAAG,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,IAAI,GAAG,GAAG,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;IACrF,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,KAAK;AACnB,QAAA,IAAI,EACF,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;cACxB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;AAC1B,cAAE,QAAQ,IAAI,GAAG,CAAC,IAAI;kBAClB,GAAG,CAAC,IAAI;AACV,kBAAE,OAAO,CAAC,aAAa,CAAC,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;KAC5C,CAAA;AAC3B;;;;"}
|
package/types/account-manager.js
CHANGED
|
@@ -39,7 +39,7 @@ class AccountManager {
|
|
|
39
39
|
this._kmdAccountManager = new types_kmdAccountManager.KmdAccountManager(clientManager);
|
|
40
40
|
}
|
|
41
41
|
_getComposer(getSuggestedParams) {
|
|
42
|
-
return new types_composer.
|
|
42
|
+
return new types_composer.TransactionComposer({
|
|
43
43
|
algod: this._clientManager.algod,
|
|
44
44
|
getSigner: this.getSigner.bind(this),
|
|
45
45
|
getSuggestedParams: getSuggestedParams ?? (() => this._clientManager.algod.getTransactionParams().do()),
|