@algorandfoundation/algokit-utils 1.0.0-beta.3 → 1.0.0-beta.31
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/README.md +1 -1
- package/{dist/account.d.ts → account.d.ts} +36 -32
- package/account.d.ts.map +1 -0
- package/{dist/account.js → account.js} +55 -41
- package/account.js.map +1 -0
- package/amount.d.ts +8 -0
- package/amount.d.ts.map +1 -0
- package/amount.js +24 -0
- package/amount.js.map +1 -0
- package/app.d.ts +118 -0
- package/app.d.ts.map +1 -0
- package/app.js +541 -0
- package/app.js.map +1 -0
- package/application-client.d.ts +10 -0
- package/application-client.d.ts.map +1 -0
- package/application-client.js +15 -0
- package/application-client.js.map +1 -0
- package/deploy-app.d.ts +96 -0
- package/deploy-app.d.ts.map +1 -0
- package/{dist/deploy-app.js → deploy-app.js} +139 -114
- package/deploy-app.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.d.ts.map +1 -0
- package/{dist/index.js → index.js} +6 -2
- package/index.js.map +1 -0
- package/{dist/localnet.d.ts → localnet.d.ts} +6 -6
- package/localnet.d.ts.map +1 -0
- package/{dist/localnet.js → localnet.js} +12 -12
- package/localnet.js.map +1 -0
- package/{dist/network-client.d.ts → network-client.d.ts} +15 -24
- package/network-client.d.ts.map +1 -0
- package/{dist/network-client.js → network-client.js} +16 -16
- package/{dist/network-client.js.map → network-client.js.map} +1 -1
- package/package.json +5 -93
- package/testing/account.d.ts +14 -0
- package/testing/account.d.ts.map +1 -0
- package/testing/account.js +31 -0
- package/testing/account.js.map +1 -0
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
- package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
- package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
- package/testing/fixtures/algorand-fixture.d.ts +20 -0
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
- package/testing/fixtures/algorand-fixture.js +49 -0
- package/testing/fixtures/algorand-fixture.js.map +1 -0
- package/testing/fixtures/index.d.ts +3 -0
- package/testing/fixtures/index.d.ts.map +1 -0
- package/testing/fixtures/index.js +19 -0
- package/testing/fixtures/index.js.map +1 -0
- package/testing/index.d.ts +6 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/index.js +22 -0
- package/testing/index.js.map +1 -0
- package/testing/indexer.d.ts +12 -0
- package/testing/indexer.d.ts.map +1 -0
- package/testing/indexer.js +39 -0
- package/testing/indexer.js.map +1 -0
- package/testing/test-logger.d.ts +39 -0
- package/testing/test-logger.d.ts.map +1 -0
- package/testing/test-logger.js +69 -0
- package/testing/test-logger.js.map +1 -0
- package/testing/transaction-logger.d.ts +29 -0
- package/testing/transaction-logger.d.ts.map +1 -0
- package/testing/transaction-logger.js +71 -0
- package/testing/transaction-logger.js.map +1 -0
- package/transaction.d.ts +120 -0
- package/transaction.d.ts.map +1 -0
- package/transaction.js +316 -0
- package/transaction.js.map +1 -0
- package/transfer.d.ts +21 -0
- package/transfer.d.ts.map +1 -0
- package/transfer.js +65 -0
- package/transfer.js.map +1 -0
- package/types/account.d.ts +55 -0
- package/types/account.d.ts.map +1 -0
- package/types/account.js +91 -0
- package/types/account.js.map +1 -0
- package/types/algo-http-client-with-retry.d.ts.map +1 -0
- package/{dist → types}/algo-http-client-with-retry.js +2 -2
- package/types/algo-http-client-with-retry.js.map +1 -0
- package/{dist/types → types}/algod.d.ts +22 -9
- package/types/algod.d.ts.map +1 -0
- package/{dist/algo-amount.d.ts → types/amount.d.ts} +3 -1
- package/types/amount.d.ts.map +1 -0
- package/{dist/algo-amount.js → types/amount.js} +7 -1
- package/types/amount.js.map +1 -0
- package/types/app.d.ts +286 -0
- package/types/app.d.ts.map +1 -0
- package/types/app.js +32 -0
- package/types/app.js.map +1 -0
- package/types/application-client.d.ts +232 -0
- package/types/application-client.d.ts.map +1 -0
- package/types/application-client.js +470 -0
- package/types/application-client.js.map +1 -0
- package/types/appspec.d.ts +77 -0
- package/types/appspec.d.ts.map +1 -0
- package/types/appspec.js +15 -0
- package/types/appspec.js.map +1 -0
- package/types/config.d.ts +15 -0
- package/types/config.d.ts.map +1 -0
- package/types/config.js +27 -0
- package/types/config.js.map +1 -0
- package/{dist/types → types}/indexer.d.ts +8 -9
- package/{dist/types → types}/indexer.d.ts.map +1 -1
- package/{dist/config.d.ts → types/logging.d.ts} +2 -16
- package/types/logging.d.ts.map +1 -0
- package/{dist/config.js → types/logging.js} +5 -24
- package/types/logging.js.map +1 -0
- package/types/logic-error.d.ts +33 -0
- package/types/logic-error.d.ts.map +1 -0
- package/types/logic-error.js +46 -0
- package/types/logic-error.js.map +1 -0
- package/types/network-client.d.ts +11 -0
- package/types/network-client.d.ts.map +1 -0
- package/types/network-client.js +3 -0
- package/types/network-client.js.map +1 -0
- package/types/testing.d.ts +89 -0
- package/types/testing.d.ts.map +1 -0
- package/types/testing.js +3 -0
- package/types/testing.js.map +1 -0
- package/types/transaction.d.ts +85 -0
- package/types/transaction.d.ts.map +1 -0
- package/types/transaction.js +3 -0
- package/types/transaction.js.map +1 -0
- package/types/transfer.d.ts +32 -0
- package/types/transfer.d.ts.map +1 -0
- package/types/transfer.js +3 -0
- package/types/transfer.js.map +1 -0
- package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
- package/types/urlTokenBaseHTTPClient.js.map +1 -0
- package/LICENSE +0 -21
- package/dist/account.d.ts.map +0 -1
- package/dist/account.js.map +0 -1
- package/dist/algo-amount.d.ts.map +0 -1
- package/dist/algo-amount.js.map +0 -1
- package/dist/algo-http-client-with-retry.d.ts.map +0 -1
- package/dist/algo-http-client-with-retry.js.map +0 -1
- package/dist/app.d.ts +0 -150
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -156
- package/dist/app.js.map +0 -1
- package/dist/application-client.d.ts +0 -1
- package/dist/application-client.d.ts.map +0 -1
- package/dist/application-client.js +0 -69
- package/dist/application-client.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/deploy-app.d.ts +0 -149
- package/dist/deploy-app.d.ts.map +0 -1
- package/dist/deploy-app.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/localnet.d.ts.map +0 -1
- package/dist/localnet.js.map +0 -1
- package/dist/network-client.d.ts.map +0 -1
- package/dist/package.json +0 -20
- package/dist/transaction.d.ts +0 -152
- package/dist/transaction.d.ts.map +0 -1
- package/dist/transaction.js +0 -268
- package/dist/transaction.js.map +0 -1
- package/dist/transfer.d.ts +0 -24
- package/dist/transfer.d.ts.map +0 -1
- package/dist/transfer.js +0 -33
- package/dist/transfer.js.map +0 -1
- package/dist/types/algod.d.ts.map +0 -1
- package/dist/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/dist/urlTokenBaseHTTPClient.js.map +0 -1
- /package/{dist/indexer-lookup.d.ts → indexer-lookup.d.ts} +0 -0
- /package/{dist/indexer-lookup.d.ts.map → indexer-lookup.d.ts.map} +0 -0
- /package/{dist/indexer-lookup.js → indexer-lookup.js} +0 -0
- /package/{dist/indexer-lookup.js.map → indexer-lookup.js.map} +0 -0
- /package/{dist → types}/algo-http-client-with-retry.d.ts +0 -0
- /package/{dist/types → types}/algod.js +0 -0
- /package/{dist/types → types}/algod.js.map +0 -0
- /package/{dist/types → types}/indexer.js +0 -0
- /package/{dist/types → types}/indexer.js.map +0 -0
- /package/{dist → types}/urlTokenBaseHTTPClient.d.ts +0 -0
- /package/{dist → types}/urlTokenBaseHTTPClient.js +0 -0
package/deploy-app.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Algodv2, Indexer } from 'algosdk';
|
|
2
|
+
import { ApplicationStateSchema } from './types/algod';
|
|
3
|
+
import { ABIReturn, AppCompilationResult, AppDeploymentParams, AppDeployMetadata, AppLookup, AppMetadata, CompiledTeal, TealTemplateParams } from './types/app';
|
|
4
|
+
import { ConfirmedTransactionResult, ConfirmedTransactionResults, SendTransactionFrom } from './types/transaction';
|
|
5
|
+
/**
|
|
6
|
+
* Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
|
|
7
|
+
*
|
|
8
|
+
* 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
|
|
9
|
+
*
|
|
10
|
+
* **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`.
|
|
11
|
+
*
|
|
12
|
+
* **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.
|
|
13
|
+
*
|
|
14
|
+
* **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.
|
|
15
|
+
* @param deployment The arguments to control the app deployment
|
|
16
|
+
* @param algod An algod client
|
|
17
|
+
* @param indexer An indexer client, needed if `existingDeployments` not passed in
|
|
18
|
+
* @returns The app reference of the new/existing app
|
|
19
|
+
*/
|
|
20
|
+
export declare function deployApp(deployment: AppDeploymentParams, algod: Algodv2, indexer?: Indexer): Promise<Partial<AppCompilationResult> & ((ConfirmedTransactionResults & AppMetadata & {
|
|
21
|
+
return?: ABIReturn;
|
|
22
|
+
operationPerformed: 'create' | 'update';
|
|
23
|
+
}) | (ConfirmedTransactionResults & AppMetadata & {
|
|
24
|
+
return?: ABIReturn;
|
|
25
|
+
deleteReturn?: ABIReturn;
|
|
26
|
+
deleteResult: ConfirmedTransactionResult;
|
|
27
|
+
operationPerformed: 'replace';
|
|
28
|
+
}) | (AppMetadata & {
|
|
29
|
+
operationPerformed: 'nothing';
|
|
30
|
+
}))>;
|
|
31
|
+
/** Returns true is there is a breaking change in the application state schema from before to after.
|
|
32
|
+
* i.e. if the schema becomes larger, since applications can't ask for more schema after creation.
|
|
33
|
+
* Otherwise, there is no error, the app just doesn't store data in the extra schema :(
|
|
34
|
+
*
|
|
35
|
+
* @param before The existing schema
|
|
36
|
+
* @param after The new schema
|
|
37
|
+
* @returns Whether or not there is a breaking change
|
|
38
|
+
*/
|
|
39
|
+
export declare function isSchemaIsBroken(before: ApplicationStateSchema, after: ApplicationStateSchema): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an @see {AppDeployNote} in the transaction note of the creation transaction.
|
|
42
|
+
*
|
|
43
|
+
* **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).
|
|
44
|
+
*
|
|
45
|
+
* @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
|
|
46
|
+
* @param indexer An indexer client
|
|
47
|
+
* @returns A name-based lookup of the app information (id, address)
|
|
48
|
+
*/
|
|
49
|
+
export declare function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup>;
|
|
50
|
+
/**
|
|
51
|
+
* Return the transaction note for an app deployment.
|
|
52
|
+
* @param metadata The metadata of the deployment
|
|
53
|
+
* @returns The transaction note as a utf-8 string
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): {
|
|
56
|
+
dAppName: string;
|
|
57
|
+
data: AppDeployMetadata;
|
|
58
|
+
format: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Replaces deploy-time deployment control parameters within the given teal code.
|
|
62
|
+
*
|
|
63
|
+
* @see {UPDATABLE_TEMPLATE_NAME}
|
|
64
|
+
* @see {DELETABLE_TEMPLATE_NAME}
|
|
65
|
+
*
|
|
66
|
+
* @param tealCode The TEAL code to substitute
|
|
67
|
+
* @param params The deploy-time deployment control parameter value to replace
|
|
68
|
+
* @returns The replaced TEAL code
|
|
69
|
+
*/
|
|
70
|
+
export declare function replaceDeployTimeControlParams(tealCode: string, params: {
|
|
71
|
+
updatable?: boolean;
|
|
72
|
+
deletable?: boolean;
|
|
73
|
+
}): string;
|
|
74
|
+
/**
|
|
75
|
+
* Performs template substitution of a teal file.
|
|
76
|
+
*
|
|
77
|
+
* Looks for `TMPL_{parameter}` for template replacements.
|
|
78
|
+
*
|
|
79
|
+
* @param tealCode The TEAL logic to compile
|
|
80
|
+
* @param templateParams Any parameters to replace in the .teal file before compiling
|
|
81
|
+
* @returns The TEAL code with replacements
|
|
82
|
+
*/
|
|
83
|
+
export declare function performTemplateSubstitution(tealCode: string, templateParams?: TealTemplateParams): string;
|
|
84
|
+
/**
|
|
85
|
+
* Performs template substitution of a teal file and compiles it, returning the compiled result.
|
|
86
|
+
*
|
|
87
|
+
* Looks for `TMPL_{parameter}` for template replacements.
|
|
88
|
+
*
|
|
89
|
+
* @param tealCode The TEAL logic to compile
|
|
90
|
+
* @param algod An algod client
|
|
91
|
+
* @param templateParams Any parameters to replace in the .teal file before compiling
|
|
92
|
+
* @param deploymentMetadata The deployment metadata the app will be deployed with
|
|
93
|
+
* @returns The information about the compiled code
|
|
94
|
+
*/
|
|
95
|
+
export declare function performTemplateSubstitutionAndCompile(tealCode: string, algod: Algodv2, templateParams?: TealTemplateParams, deploymentMetadata?: AppDeployMetadata): Promise<CompiledTeal>;
|
|
96
|
+
//# sourceMappingURL=deploy-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-app.d.ts","sourceRoot":"","sources":["../src/deploy-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAoD,OAAO,EAAmB,MAAM,SAAS,CAAA;AAK7G,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EACL,SAAS,EACT,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,WAAW,EAEX,YAAY,EAIZ,kBAAkB,EAEnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,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wBAAsB,qCAAqC,CACzD,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,kBAAkB,EACnC,kBAAkB,CAAC,EAAE,iBAAiB,GACrC,OAAO,CAAC,YAAY,CAAC,CAQvB"}
|
|
@@ -1,88 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.performTemplateSubstitutionAndCompile = exports.
|
|
3
|
+
exports.performTemplateSubstitutionAndCompile = exports.performTemplateSubstitution = exports.replaceDeployTimeControlParams = exports.getAppDeploymentTransactionNote = exports.getCreatorAppsByName = exports.isSchemaIsBroken = exports.deployApp = void 0;
|
|
4
4
|
const algosdk_1 = require("algosdk");
|
|
5
|
+
const _1 = require("./");
|
|
5
6
|
const app_1 = require("./app");
|
|
6
|
-
const config_1 = require("./config");
|
|
7
7
|
const indexer_lookup_1 = require("./indexer-lookup");
|
|
8
8
|
const transaction_1 = require("./transaction");
|
|
9
|
-
|
|
10
|
-
exports.DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE';
|
|
11
|
-
exports.APP_DEPLOY_NOTE_PREFIX = 'APP_DEPLOY::';
|
|
12
|
-
/** What action to perform when deploying an app and an update is detected in the TEAL code */
|
|
13
|
-
var OnUpdate;
|
|
14
|
-
(function (OnUpdate) {
|
|
15
|
-
/** Fail the deployment */
|
|
16
|
-
OnUpdate[OnUpdate["Fail"] = 0] = "Fail";
|
|
17
|
-
/** Update the app */
|
|
18
|
-
OnUpdate[OnUpdate["UpdateApp"] = 1] = "UpdateApp";
|
|
19
|
-
/** Delete the app and create a new one in its place */
|
|
20
|
-
OnUpdate[OnUpdate["ReplaceApp"] = 2] = "ReplaceApp";
|
|
21
|
-
})(OnUpdate = exports.OnUpdate || (exports.OnUpdate = {}));
|
|
22
|
-
/** What action to perform when deploying an app and a breaking schema change is detected */
|
|
23
|
-
var OnSchemaBreak;
|
|
24
|
-
(function (OnSchemaBreak) {
|
|
25
|
-
/** Fail the deployment */
|
|
26
|
-
OnSchemaBreak[OnSchemaBreak["Fail"] = 0] = "Fail";
|
|
27
|
-
/** Delete the app and create a new one in its place */
|
|
28
|
-
OnSchemaBreak[OnSchemaBreak["ReplaceApp"] = 1] = "ReplaceApp";
|
|
29
|
-
})(OnSchemaBreak = exports.OnSchemaBreak || (exports.OnSchemaBreak = {}));
|
|
9
|
+
const app_2 = require("./types/app");
|
|
30
10
|
/**
|
|
31
11
|
* Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
|
|
32
12
|
*
|
|
33
13
|
* 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
|
|
34
14
|
*
|
|
35
|
-
* **Note:**
|
|
15
|
+
* **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`.
|
|
36
16
|
*
|
|
37
|
-
* **Note:** if there is
|
|
38
|
-
*
|
|
17
|
+
* **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.
|
|
18
|
+
*
|
|
19
|
+
* **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.
|
|
20
|
+
* @param deployment The arguments to control the app deployment
|
|
39
21
|
* @param algod An algod client
|
|
40
|
-
* @param indexer An indexer client
|
|
22
|
+
* @param indexer An indexer client, needed if `existingDeployments` not passed in
|
|
41
23
|
* @returns The app reference of the new/existing app
|
|
42
24
|
*/
|
|
43
25
|
async function deployApp(deployment, algod, indexer) {
|
|
44
|
-
const { metadata, deployTimeParameters, onSchemaBreak, onUpdate, existingDeployments, createArgs, updateArgs, deleteArgs, ...appParams } = deployment;
|
|
26
|
+
const { metadata, deployTimeParams: deployTimeParameters, onSchemaBreak, onUpdate, existingDeployments, createArgs, updateArgs, deleteArgs, ...appParams } = deployment;
|
|
45
27
|
if (existingDeployments && existingDeployments.creator !== (0, transaction_1.getSenderAddress)(appParams.from)) {
|
|
46
28
|
throw new Error(`Received invalid existingDeployments value for creator ${existingDeployments.creator} when attempting to deploy for creator ${appParams.from}`);
|
|
47
29
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
30
|
+
if (!existingDeployments && !indexer) {
|
|
31
|
+
throw new Error(`Didn't receive an indexer client, but also didn't receive an existingDeployments cache - one of them must be provided`);
|
|
32
|
+
}
|
|
33
|
+
_1.Config.getLogger(appParams.suppressLog).info(`Idempotently deploying app "${metadata.name}" from creator ${(0, transaction_1.getSenderAddress)(appParams.from)} using ${appParams.approvalProgram.length} bytes of teal code and ${appParams.clearStateProgram.length} bytes of teal code`);
|
|
34
|
+
const compiledApproval = typeof appParams.approvalProgram === 'string'
|
|
35
|
+
? await performTemplateSubstitutionAndCompile(appParams.approvalProgram, algod, deployTimeParameters, metadata)
|
|
36
|
+
: undefined;
|
|
37
|
+
appParams.approvalProgram = compiledApproval ? compiledApproval.compiledBase64ToBytes : appParams.approvalProgram;
|
|
38
|
+
const compiledClear = typeof appParams.clearStateProgram === 'string'
|
|
39
|
+
? await performTemplateSubstitutionAndCompile(appParams.clearStateProgram, algod, deployTimeParameters)
|
|
40
|
+
: undefined;
|
|
41
|
+
appParams.clearStateProgram = compiledClear ? compiledClear.compiledBase64ToBytes : appParams.clearStateProgram;
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
43
|
+
const apps = existingDeployments ?? (await getCreatorAppsByName(appParams.from, indexer));
|
|
44
|
+
const create = async (atc) => {
|
|
60
45
|
const result = await (0, app_1.createApp)({
|
|
61
46
|
...appParams,
|
|
62
47
|
args: createArgs,
|
|
63
48
|
note: getAppDeploymentTransactionNote(metadata),
|
|
64
|
-
|
|
49
|
+
atc,
|
|
65
50
|
skipWaiting: false,
|
|
66
51
|
}, algod);
|
|
67
52
|
return {
|
|
68
53
|
transaction: result.transaction,
|
|
54
|
+
transactions: result.transactions,
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
69
56
|
confirmation: result.confirmation,
|
|
70
|
-
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
58
|
+
confirmations: result.confirmations,
|
|
59
|
+
return: result.return,
|
|
60
|
+
appId: result.appId,
|
|
71
61
|
appAddress: result.appAddress,
|
|
72
62
|
createdMetadata: metadata,
|
|
73
63
|
createdRound: Number(result.confirmation?.['confirmed-round']),
|
|
74
64
|
updatedRound: Number(result.confirmation?.['confirmed-round']),
|
|
75
65
|
...metadata,
|
|
76
66
|
deleted: false,
|
|
67
|
+
operationPerformed: 'create',
|
|
68
|
+
compiledApproval,
|
|
69
|
+
compiledClear,
|
|
77
70
|
};
|
|
78
71
|
};
|
|
79
72
|
const existingApp = apps.apps[metadata.name];
|
|
80
|
-
if (!existingApp) {
|
|
81
|
-
|
|
73
|
+
if (!existingApp || existingApp.deleted) {
|
|
74
|
+
_1.Config.getLogger(appParams.suppressLog).info(`App ${metadata.name} not found in apps created by ${(0, transaction_1.getSenderAddress)(appParams.from)}; deploying app with version ${metadata.version}.`);
|
|
82
75
|
return await create();
|
|
83
76
|
}
|
|
84
|
-
|
|
85
|
-
const existingAppRecord = await (0, app_1.getAppByIndex)(existingApp.
|
|
77
|
+
_1.Config.getLogger(appParams.suppressLog).info(`Existing app ${metadata.name} found by creator ${(0, transaction_1.getSenderAddress)(appParams.from)}, with app id ${existingApp.appId} and version ${existingApp.version}.`);
|
|
78
|
+
const existingAppRecord = await (0, app_1.getAppByIndex)(existingApp.appId, algod);
|
|
86
79
|
const existingApproval = existingAppRecord.params['approval-program'];
|
|
87
80
|
const existingClear = existingAppRecord.params['clear-state-program'];
|
|
88
81
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -100,34 +93,28 @@ async function deployApp(deployment, algod, indexer) {
|
|
|
100
93
|
const newApproval = Buffer.from(appParams.approvalProgram).toString('base64');
|
|
101
94
|
const newClear = Buffer.from(appParams.clearStateProgram).toString('base64');
|
|
102
95
|
const isUpdate = newApproval !== existingApproval || newClear !== existingClear;
|
|
103
|
-
const isSchemaBreak =
|
|
96
|
+
const isSchemaBreak = isSchemaIsBroken(existingGlobalSchema, newGlobalSchema) || isSchemaIsBroken(existingLocalSchema, newLocalSchema);
|
|
104
97
|
const replace = async () => {
|
|
98
|
+
const atc = new algosdk_1.AtomicTransactionComposer();
|
|
105
99
|
// Create
|
|
106
|
-
|
|
107
|
-
const { transaction: createTransaction
|
|
100
|
+
_1.Config.getLogger(appParams.suppressLog).info(`Deploying a new ${metadata.name} app for ${(0, transaction_1.getSenderAddress)(appParams.from)}; deploying app with version ${metadata.version}.`);
|
|
101
|
+
const { transaction: createTransaction } = await create(atc);
|
|
102
|
+
const createTransactions = atc.clone().buildGroup();
|
|
108
103
|
// Delete
|
|
109
|
-
|
|
104
|
+
_1.Config.getLogger(appParams.suppressLog).warn(`Deleting existing ${metadata.name} app with id ${existingApp.appId} from ${(0, transaction_1.getSenderAddress)(appParams.from)} account.`);
|
|
110
105
|
const { transaction: deleteTransaction } = await (0, app_1.callApp)({
|
|
111
|
-
|
|
106
|
+
appId: existingApp.appId,
|
|
112
107
|
callType: 'delete',
|
|
113
108
|
from: appParams.from,
|
|
114
109
|
args: deleteArgs,
|
|
115
110
|
transactionParams: appParams.transactionParams,
|
|
116
111
|
suppressLog: appParams.suppressLog,
|
|
117
112
|
skipSending: true,
|
|
113
|
+
atc,
|
|
118
114
|
}, algod);
|
|
119
115
|
// Ensure create and delete happen atomically
|
|
120
|
-
const { confirmations } = await (0, transaction_1.
|
|
121
|
-
|
|
122
|
-
{
|
|
123
|
-
transaction: createTransaction,
|
|
124
|
-
signer: appParams.from,
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
transaction: deleteTransaction,
|
|
128
|
-
signer: appParams.from,
|
|
129
|
-
},
|
|
130
|
-
],
|
|
116
|
+
const { transactions, confirmations, returns } = await (0, transaction_1.sendAtomicTransactionComposer)({
|
|
117
|
+
atc,
|
|
131
118
|
sendParams: {
|
|
132
119
|
maxRoundsToWaitForConfirmation: appParams.maxRoundsToWaitForConfirmation,
|
|
133
120
|
skipWaiting: false,
|
|
@@ -135,16 +122,22 @@ async function deployApp(deployment, algod, indexer) {
|
|
|
135
122
|
},
|
|
136
123
|
}, algod);
|
|
137
124
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
138
|
-
const createConfirmation = confirmations[
|
|
125
|
+
const createConfirmation = confirmations[createTransactions.length - 1];
|
|
139
126
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
140
|
-
const deleteConfirmation = confirmations[1];
|
|
127
|
+
const deleteConfirmation = confirmations[confirmations.length - 1];
|
|
141
128
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
142
129
|
const newAppIndex = createConfirmation['application-index'];
|
|
143
|
-
|
|
130
|
+
_1.Config.getLogger(appParams.suppressLog).warn(`Sent transactions ${createTransaction.txID()} to create app with id ${newAppIndex} and ${deleteTransaction.txID()} to delete app with id ${existingApp.appId} from ${(0, transaction_1.getSenderAddress)(appParams.from)} account.`);
|
|
144
131
|
return {
|
|
145
132
|
transaction: createTransaction,
|
|
133
|
+
transactions: transactions,
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
146
135
|
confirmation: createConfirmation,
|
|
147
|
-
|
|
136
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
137
|
+
confirmations: confirmations,
|
|
138
|
+
return: returns[0],
|
|
139
|
+
deleteReturn: returns[1],
|
|
140
|
+
appId: newAppIndex,
|
|
148
141
|
appAddress: (0, algosdk_1.getApplicationAddress)(newAppIndex),
|
|
149
142
|
createdMetadata: metadata,
|
|
150
143
|
createdRound: Number(createConfirmation['confirmed-round']),
|
|
@@ -152,12 +145,15 @@ async function deployApp(deployment, algod, indexer) {
|
|
|
152
145
|
...metadata,
|
|
153
146
|
deleted: false,
|
|
154
147
|
deleteResult: { transaction: deleteTransaction, confirmation: deleteConfirmation },
|
|
148
|
+
operationPerformed: 'replace',
|
|
149
|
+
compiledApproval,
|
|
150
|
+
compiledClear,
|
|
155
151
|
};
|
|
156
152
|
};
|
|
157
153
|
const update = async () => {
|
|
158
|
-
|
|
154
|
+
_1.Config.getLogger(appParams.suppressLog).info(`Updating existing ${metadata.name} app for ${(0, transaction_1.getSenderAddress)(appParams.from)} to version ${metadata.version}.`);
|
|
159
155
|
const result = await (0, app_1.updateApp)({
|
|
160
|
-
|
|
156
|
+
appId: existingApp.appId,
|
|
161
157
|
from: appParams.from,
|
|
162
158
|
args: updateArgs,
|
|
163
159
|
note: getAppDeploymentTransactionNote(metadata),
|
|
@@ -170,18 +166,26 @@ async function deployApp(deployment, algod, indexer) {
|
|
|
170
166
|
}, algod);
|
|
171
167
|
return {
|
|
172
168
|
transaction: result.transaction,
|
|
169
|
+
transactions: result.transactions,
|
|
170
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
173
171
|
confirmation: result.confirmation,
|
|
174
|
-
|
|
172
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
173
|
+
confirmations: result.confirmations,
|
|
174
|
+
return: result.return,
|
|
175
|
+
appId: existingApp.appId,
|
|
175
176
|
appAddress: existingApp.appAddress,
|
|
176
177
|
createdMetadata: existingApp.createdMetadata,
|
|
177
178
|
createdRound: existingApp.createdRound,
|
|
178
179
|
updatedRound: Number(result.confirmation?.['confirmed-round']),
|
|
179
180
|
...metadata,
|
|
180
181
|
deleted: false,
|
|
182
|
+
operationPerformed: 'update',
|
|
183
|
+
compiledApproval,
|
|
184
|
+
compiledClear,
|
|
181
185
|
};
|
|
182
186
|
};
|
|
183
187
|
if (isSchemaBreak) {
|
|
184
|
-
|
|
188
|
+
_1.Config.getLogger(appParams.suppressLog).warn(`Detected a breaking app schema change in app ${existingApp.appId}:`, {
|
|
185
189
|
from: {
|
|
186
190
|
global: existingGlobalSchema,
|
|
187
191
|
local: existingLocalSchema,
|
|
@@ -191,47 +195,47 @@ async function deployApp(deployment, algod, indexer) {
|
|
|
191
195
|
local: newLocalSchema,
|
|
192
196
|
},
|
|
193
197
|
});
|
|
194
|
-
if (onSchemaBreak === undefined || onSchemaBreak === 'fail' || onSchemaBreak === OnSchemaBreak.Fail) {
|
|
198
|
+
if (onSchemaBreak === undefined || onSchemaBreak === 'fail' || onSchemaBreak === app_2.OnSchemaBreak.Fail) {
|
|
195
199
|
throw new Error('Schema break detected and onSchemaBreak=OnSchemaBreak.Fail, stopping deployment. ' +
|
|
196
200
|
'If you want to try deleting and recreating the app then ' +
|
|
197
201
|
're-run with onSchemaBreak=OnSchemaBreak.ReplaceApp');
|
|
198
202
|
}
|
|
199
203
|
if (existingApp.deletable) {
|
|
200
|
-
|
|
204
|
+
_1.Config.getLogger(appParams.suppressLog).info('App is deletable and onSchemaBreak=ReplaceApp, will attempt to create new app and delete old app');
|
|
201
205
|
}
|
|
202
206
|
else {
|
|
203
|
-
|
|
207
|
+
_1.Config.getLogger(appParams.suppressLog).info('App is not deletable but onSchemaBreak=ReplaceApp, will attempt to delete app, delete will most likely fail');
|
|
204
208
|
}
|
|
205
209
|
return await replace();
|
|
206
210
|
}
|
|
207
211
|
if (isUpdate) {
|
|
208
|
-
|
|
209
|
-
if (onUpdate === undefined || onUpdate === 'fail' || onUpdate === OnUpdate.Fail) {
|
|
212
|
+
_1.Config.getLogger(appParams.suppressLog).info(`Detected a TEAL update in app ${existingApp.appId} for creator ${(0, transaction_1.getSenderAddress)(appParams.from)}`);
|
|
213
|
+
if (onUpdate === undefined || onUpdate === 'fail' || onUpdate === app_2.OnUpdate.Fail) {
|
|
210
214
|
throw new Error('Update detected and onUpdate=Fail, stopping deployment. ' +
|
|
211
215
|
'If you want to try deleting and recreating the app then ' +
|
|
212
216
|
're-run with onUpdate=UpdateApp');
|
|
213
217
|
}
|
|
214
|
-
if (onUpdate === 'update' || onUpdate === OnUpdate.UpdateApp) {
|
|
218
|
+
if (onUpdate === 'update' || onUpdate === app_2.OnUpdate.UpdateApp) {
|
|
215
219
|
if (existingApp.updatable) {
|
|
216
|
-
|
|
220
|
+
_1.Config.getLogger(appParams.suppressLog).info(`App is updatable and onUpdate=UpdateApp, updating app...`);
|
|
217
221
|
}
|
|
218
222
|
else {
|
|
219
|
-
|
|
223
|
+
_1.Config.getLogger(appParams.suppressLog).warn(`App is not updatable but onUpdate=UpdateApp, will attempt to update app, update will most likely fail`);
|
|
220
224
|
}
|
|
221
225
|
return await update();
|
|
222
226
|
}
|
|
223
|
-
if (onUpdate === 'replace' || onUpdate === OnUpdate.ReplaceApp) {
|
|
227
|
+
if (onUpdate === 'replace' || onUpdate === app_2.OnUpdate.ReplaceApp) {
|
|
224
228
|
if (existingApp.deletable) {
|
|
225
|
-
|
|
229
|
+
_1.Config.getLogger(appParams.suppressLog).warn('App is deletable and onUpdate=ReplaceApp, creating new app and deleting old app...');
|
|
226
230
|
}
|
|
227
231
|
else {
|
|
228
|
-
|
|
232
|
+
_1.Config.getLogger(appParams.suppressLog).warn('App is not deletable and onUpdate=ReplaceApp, will attempt to create new app and delete old app, delete will most likely fail');
|
|
229
233
|
}
|
|
230
234
|
return await replace();
|
|
231
235
|
}
|
|
232
236
|
}
|
|
233
|
-
|
|
234
|
-
return existingApp;
|
|
237
|
+
_1.Config.getLogger(appParams.suppressLog).debug('No detected changes in app, nothing to do.');
|
|
238
|
+
return { ...existingApp, operationPerformed: 'nothing', compiledApproval, compiledClear };
|
|
235
239
|
}
|
|
236
240
|
exports.deployApp = deployApp;
|
|
237
241
|
/** Returns true is there is a breaking change in the application state schema from before to after.
|
|
@@ -242,20 +246,20 @@ exports.deployApp = deployApp;
|
|
|
242
246
|
* @param after The new schema
|
|
243
247
|
* @returns Whether or not there is a breaking change
|
|
244
248
|
*/
|
|
245
|
-
function
|
|
249
|
+
function isSchemaIsBroken(before, after) {
|
|
246
250
|
return before['num-byte-slice'] < after['num-byte-slice'] || before['num-uint'] < after['num-uint'];
|
|
247
251
|
}
|
|
248
|
-
exports.
|
|
252
|
+
exports.isSchemaIsBroken = isSchemaIsBroken;
|
|
249
253
|
/**
|
|
250
254
|
* Returns a lookup of name => app metadata (id, address, ...metadata) for all apps created by the given account that have an @see {AppDeployNote} in the transaction note of the creation transaction.
|
|
251
255
|
*
|
|
252
256
|
* **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).
|
|
253
257
|
*
|
|
254
|
-
* @param indexer An indexer client
|
|
255
258
|
* @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
|
|
259
|
+
* @param indexer An indexer client
|
|
256
260
|
* @returns A name-based lookup of the app information (id, address)
|
|
257
261
|
*/
|
|
258
|
-
async function getCreatorAppsByName(
|
|
262
|
+
async function getCreatorAppsByName(creatorAccount, indexer) {
|
|
259
263
|
const appLookup = {};
|
|
260
264
|
const creatorAddress = typeof creatorAccount !== 'string' ? (0, transaction_1.getSenderAddress)(creatorAccount) : creatorAccount;
|
|
261
265
|
// Extract all apps that account created
|
|
@@ -272,7 +276,7 @@ async function getCreatorAppsByName(indexer, creatorAccount) {
|
|
|
272
276
|
.applicationID(createdApp.id)
|
|
273
277
|
.address(creatorAddress)
|
|
274
278
|
.addressRole('sender')
|
|
275
|
-
.notePrefix(Buffer.from(
|
|
279
|
+
.notePrefix(Buffer.from(app_2.APP_DEPLOY_NOTE_DAPP).toString('base64')));
|
|
276
280
|
// Triple check the transaction is intact by filtering for the one we want:
|
|
277
281
|
// * application-id is 0 when the app is first created
|
|
278
282
|
// * also verify the sender to prevent a potential security risk
|
|
@@ -297,17 +301,17 @@ async function getCreatorAppsByName(indexer, creatorAccount) {
|
|
|
297
301
|
const decoder = new TextDecoder();
|
|
298
302
|
const noteAsBase64 = decoder.decode(Buffer.from(note));
|
|
299
303
|
const noteAsString = Buffer.from(noteAsBase64, 'base64').toString('utf-8');
|
|
300
|
-
if (!noteAsString.startsWith(`${
|
|
304
|
+
if (!noteAsString.startsWith(`${app_2.APP_DEPLOY_NOTE_DAPP}:j{`))
|
|
301
305
|
// Clearly not APP_DEPLOY JSON; ignoring...
|
|
302
306
|
return;
|
|
303
|
-
return JSON.parse(noteAsString.substring(
|
|
307
|
+
return JSON.parse(noteAsString.substring(app_2.APP_DEPLOY_NOTE_DAPP.length + 2));
|
|
304
308
|
};
|
|
305
309
|
try {
|
|
306
310
|
const creationNote = parseNote(appCreationTransaction.note);
|
|
307
311
|
const updateNote = parseNote(latestAppUpdateTransaction.note);
|
|
308
312
|
if (creationNote?.name) {
|
|
309
313
|
appLookup[creationNote.name] = {
|
|
310
|
-
|
|
314
|
+
appId: createdApp.id,
|
|
311
315
|
appAddress: (0, algosdk_1.getApplicationAddress)(createdApp.id),
|
|
312
316
|
createdMetadata: creationNote,
|
|
313
317
|
createdRound: Number(appCreationTransaction['confirmed-round']),
|
|
@@ -318,7 +322,7 @@ async function getCreatorAppsByName(indexer, creatorAccount) {
|
|
|
318
322
|
}
|
|
319
323
|
}
|
|
320
324
|
catch (e) {
|
|
321
|
-
|
|
325
|
+
_1.Config.logger.warn(`Received error trying to retrieve app with ${createdApp.id} for creator ${creatorAddress}; failing silently`, e);
|
|
322
326
|
return;
|
|
323
327
|
}
|
|
324
328
|
}));
|
|
@@ -334,7 +338,11 @@ exports.getCreatorAppsByName = getCreatorAppsByName;
|
|
|
334
338
|
* @returns The transaction note as a utf-8 string
|
|
335
339
|
*/
|
|
336
340
|
function getAppDeploymentTransactionNote(metadata) {
|
|
337
|
-
return
|
|
341
|
+
return {
|
|
342
|
+
dAppName: app_2.APP_DEPLOY_NOTE_DAPP,
|
|
343
|
+
data: metadata,
|
|
344
|
+
format: 'j',
|
|
345
|
+
};
|
|
338
346
|
}
|
|
339
347
|
exports.getAppDeploymentTransactionNote = getAppDeploymentTransactionNote;
|
|
340
348
|
/**
|
|
@@ -348,28 +356,35 @@ exports.getAppDeploymentTransactionNote = getAppDeploymentTransactionNote;
|
|
|
348
356
|
* @returns The replaced TEAL code
|
|
349
357
|
*/
|
|
350
358
|
function replaceDeployTimeControlParams(tealCode, params) {
|
|
351
|
-
|
|
352
|
-
.
|
|
353
|
-
|
|
359
|
+
if (params.updatable !== undefined) {
|
|
360
|
+
if (!tealCode.includes(app_2.UPDATABLE_TEMPLATE_NAME)) {
|
|
361
|
+
throw new Error(`Deploy-time updatability control requested for app deployment, but ${app_2.UPDATABLE_TEMPLATE_NAME} not present in TEAL code`);
|
|
362
|
+
}
|
|
363
|
+
tealCode = tealCode.replace(new RegExp(app_2.UPDATABLE_TEMPLATE_NAME, 'g'), (params.updatable ? 1 : 0).toString());
|
|
364
|
+
}
|
|
365
|
+
if (params.deletable !== undefined) {
|
|
366
|
+
if (!tealCode.includes(app_2.DELETABLE_TEMPLATE_NAME)) {
|
|
367
|
+
throw new Error(`Deploy-time deletability control requested for app deployment, but ${app_2.DELETABLE_TEMPLATE_NAME} not present in TEAL code`);
|
|
368
|
+
}
|
|
369
|
+
tealCode = tealCode.replace(new RegExp(app_2.DELETABLE_TEMPLATE_NAME, 'g'), (params.deletable ? 1 : 0).toString());
|
|
370
|
+
}
|
|
371
|
+
return tealCode;
|
|
354
372
|
}
|
|
355
373
|
exports.replaceDeployTimeControlParams = replaceDeployTimeControlParams;
|
|
356
374
|
/**
|
|
357
|
-
* Performs template substitution of a teal file
|
|
375
|
+
* Performs template substitution of a teal file.
|
|
358
376
|
*
|
|
359
377
|
* Looks for `TMPL_{parameter}` for template replacements.
|
|
360
378
|
*
|
|
361
379
|
* @param tealCode The TEAL logic to compile
|
|
362
|
-
* @param
|
|
363
|
-
* @
|
|
364
|
-
* @param deploymentMetadata The deployment metadata the app will be deployed with
|
|
365
|
-
* @returns The information about the compiled code
|
|
380
|
+
* @param templateParams Any parameters to replace in the .teal file before compiling
|
|
381
|
+
* @returns The TEAL code with replacements
|
|
366
382
|
*/
|
|
367
|
-
|
|
368
|
-
if (
|
|
369
|
-
for (const key in
|
|
370
|
-
const value =
|
|
371
|
-
const token = `TMPL_${key}`;
|
|
372
|
-
// todo: handle uint8array
|
|
383
|
+
function performTemplateSubstitution(tealCode, templateParams) {
|
|
384
|
+
if (templateParams !== undefined) {
|
|
385
|
+
for (const key in templateParams) {
|
|
386
|
+
const value = templateParams[key];
|
|
387
|
+
const token = `TMPL_${key.replace(/^TMPL_/, '')}`;
|
|
373
388
|
tealCode = tealCode.replace(new RegExp(token, 'g'), typeof value === 'string'
|
|
374
389
|
? `0x${Buffer.from(value, 'utf-8').toString('hex')}`
|
|
375
390
|
: ArrayBuffer.isView(value)
|
|
@@ -377,16 +392,26 @@ async function performTemplateSubstitutionAndCompile(tealCode, algod, templatePa
|
|
|
377
392
|
: value.toString());
|
|
378
393
|
}
|
|
379
394
|
}
|
|
395
|
+
return tealCode;
|
|
396
|
+
}
|
|
397
|
+
exports.performTemplateSubstitution = performTemplateSubstitution;
|
|
398
|
+
/**
|
|
399
|
+
* Performs template substitution of a teal file and compiles it, returning the compiled result.
|
|
400
|
+
*
|
|
401
|
+
* Looks for `TMPL_{parameter}` for template replacements.
|
|
402
|
+
*
|
|
403
|
+
* @param tealCode The TEAL logic to compile
|
|
404
|
+
* @param algod An algod client
|
|
405
|
+
* @param templateParams Any parameters to replace in the .teal file before compiling
|
|
406
|
+
* @param deploymentMetadata The deployment metadata the app will be deployed with
|
|
407
|
+
* @returns The information about the compiled code
|
|
408
|
+
*/
|
|
409
|
+
async function performTemplateSubstitutionAndCompile(tealCode, algod, templateParams, deploymentMetadata) {
|
|
410
|
+
tealCode = performTemplateSubstitution(tealCode, templateParams);
|
|
380
411
|
if (deploymentMetadata) {
|
|
381
412
|
tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata);
|
|
382
413
|
}
|
|
383
|
-
|
|
384
|
-
return {
|
|
385
|
-
teal: tealCode,
|
|
386
|
-
compiled: compiled.result,
|
|
387
|
-
compiledHash: compiled.hash,
|
|
388
|
-
compiledBase64ToBytes: new Uint8Array(Buffer.from(compiled.result, 'base64')),
|
|
389
|
-
};
|
|
414
|
+
return await (0, app_1.compileTeal)(tealCode, algod);
|
|
390
415
|
}
|
|
391
416
|
exports.performTemplateSubstitutionAndCompile = performTemplateSubstitutionAndCompile;
|
|
392
417
|
//# sourceMappingURL=deploy-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-app.js","sourceRoot":"","sources":["../src/deploy-app.ts"],"names":[],"mappings":";;;AAAA,qCAA6G;AAC7G,yBAA2B;AAC3B,+BAAiF;AACjF,qDAA+F;AAC/F,+CAA+E;AAE/E,qCAcoB;AAGpB;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,SAAS,CAC7B,UAA+B,EAC/B,KAAc,EACd,OAAiB;IAejB,MAAM,EACJ,QAAQ,EACR,gBAAgB,EAAE,oBAAoB,EACtC,aAAa,EACb,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,UAAU,EACV,GAAG,SAAS,EACb,GAAG,UAAU,CAAA;IAEd,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,OAAO,KAAK,IAAA,8BAAgB,EAAC,SAAS,CAAC,IAAI,CAAC,EAAE;QAC3F,MAAM,IAAI,KAAK,CACb,0DAA0D,mBAAmB,CAAC,OAAO,0CAA0C,SAAS,CAAC,IAAI,EAAE,CAChJ,CAAA;KACF;IACD,IAAI,CAAC,mBAAmB,IAAI,CAAC,OAAO,EAAE;QACpC,MAAM,IAAI,KAAK,CAAC,uHAAuH,CAAC,CAAA;KACzI;IAED,SAAM,CAAC,SAAS,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,IAAI,CAC1C,+BAA+B,QAAQ,CAAC,IAAI,kBAAkB,IAAA,8BAAgB,EAAC,SAAS,CAAC,IAAI,CAAC,UAC5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;IAEtC,QAAQ,GAAG,2BAA2B,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAA;IAEhE,IAAI,kBAAkB,EAAE;QACtB,QAAQ,GAAG,8BAA8B,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAA;KACxE;IAED,OAAO,MAAM,IAAA,iBAAW,EAAC,QAAQ,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAbD,sFAaC"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UpdatableConfig } from './types/config';
|
|
2
|
+
export * from './account';
|
|
3
|
+
export * from './amount';
|
|
4
|
+
export * from './app';
|
|
5
|
+
export * from './application-client';
|
|
6
|
+
export * from './deploy-app';
|
|
7
|
+
export * from './indexer-lookup';
|
|
8
|
+
export * from './localnet';
|
|
9
|
+
export * from './network-client';
|
|
10
|
+
export * from './transaction';
|
|
11
|
+
export * from './transfer';
|
|
12
|
+
/** The AlgoKit config. To update it use the configure method. */
|
|
13
|
+
export declare const Config: UpdatableConfig;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAE1B,iEAAiE;AACjE,eAAO,MAAM,MAAM,iBAAwB,CAAA"}
|