@algorandfoundation/algokit-utils 1.0.0-beta.2 → 1.0.0-beta.21

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.
Files changed (183) hide show
  1. package/{dist/account.d.ts → account.d.ts} +29 -31
  2. package/account.d.ts.map +1 -0
  3. package/{dist/account.js → account.js} +43 -43
  4. package/account.js.map +1 -0
  5. package/amount.d.ts +8 -0
  6. package/amount.d.ts.map +1 -0
  7. package/amount.js +24 -0
  8. package/amount.js.map +1 -0
  9. package/app.d.ts +51 -0
  10. package/app.d.ts.map +1 -0
  11. package/app.js +288 -0
  12. package/app.js.map +1 -0
  13. package/application-client.d.ts +10 -0
  14. package/application-client.d.ts.map +1 -0
  15. package/application-client.js +15 -0
  16. package/application-client.js.map +1 -0
  17. package/deploy-app.d.ts +93 -0
  18. package/deploy-app.d.ts.map +1 -0
  19. package/{dist/deploy-app.js → deploy-app.js} +129 -137
  20. package/deploy-app.js.map +1 -0
  21. package/index.d.ts +14 -0
  22. package/index.d.ts.map +1 -0
  23. package/{dist/index.js → index.js} +6 -4
  24. package/index.js.map +1 -0
  25. package/{dist/indexer-lookup.d.ts → indexer-lookup.d.ts} +1 -1
  26. package/{dist/indexer-lookup.d.ts.map → indexer-lookup.d.ts.map} +1 -1
  27. package/{dist/localnet.d.ts → localnet.d.ts} +4 -4
  28. package/localnet.d.ts.map +1 -0
  29. package/{dist/localnet.js → localnet.js} +10 -10
  30. package/localnet.js.map +1 -0
  31. package/{dist/network-client.d.ts → network-client.d.ts} +11 -20
  32. package/network-client.d.ts.map +1 -0
  33. package/{dist/network-client.js → network-client.js} +11 -11
  34. package/{dist/network-client.js.map → network-client.js.map} +1 -1
  35. package/package.json +4 -92
  36. package/testing/account.d.ts +14 -0
  37. package/testing/account.d.ts.map +1 -0
  38. package/testing/account.js +31 -0
  39. package/testing/account.js.map +1 -0
  40. package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
  41. package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
  42. package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
  43. package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
  44. package/testing/fixtures/algorand-fixture.d.ts +20 -0
  45. package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
  46. package/testing/fixtures/algorand-fixture.js +49 -0
  47. package/testing/fixtures/algorand-fixture.js.map +1 -0
  48. package/testing/fixtures/index.d.ts +3 -0
  49. package/testing/fixtures/index.d.ts.map +1 -0
  50. package/testing/fixtures/index.js +19 -0
  51. package/testing/fixtures/index.js.map +1 -0
  52. package/testing/index.d.ts +6 -0
  53. package/testing/index.d.ts.map +1 -0
  54. package/testing/index.js +22 -0
  55. package/testing/index.js.map +1 -0
  56. package/testing/indexer.d.ts +12 -0
  57. package/testing/indexer.d.ts.map +1 -0
  58. package/testing/indexer.js +39 -0
  59. package/testing/indexer.js.map +1 -0
  60. package/testing/test-logger.d.ts +39 -0
  61. package/testing/test-logger.d.ts.map +1 -0
  62. package/testing/test-logger.js +69 -0
  63. package/testing/test-logger.js.map +1 -0
  64. package/testing/transaction-logger.d.ts +29 -0
  65. package/testing/transaction-logger.d.ts.map +1 -0
  66. package/testing/transaction-logger.js +71 -0
  67. package/testing/transaction-logger.js.map +1 -0
  68. package/transaction.d.ts +80 -0
  69. package/transaction.d.ts.map +1 -0
  70. package/{dist/transaction.js → transaction.js} +88 -106
  71. package/transaction.js.map +1 -0
  72. package/transfer.d.ts +21 -0
  73. package/transfer.d.ts.map +1 -0
  74. package/transfer.js +65 -0
  75. package/transfer.js.map +1 -0
  76. package/types/account.d.ts +52 -0
  77. package/types/account.d.ts.map +1 -0
  78. package/types/account.js +86 -0
  79. package/types/account.js.map +1 -0
  80. package/types/algo-http-client-with-retry.d.ts.map +1 -0
  81. package/{dist → types}/algo-http-client-with-retry.js +2 -2
  82. package/types/algo-http-client-with-retry.js.map +1 -0
  83. package/{dist/algod-type.d.ts → types/algod.d.ts} +6 -7
  84. package/types/algod.d.ts.map +1 -0
  85. package/{dist/algod-type.js → types/algod.js} +1 -1
  86. package/types/algod.js.map +1 -0
  87. package/{dist/algo-amount.d.ts → types/amount.d.ts} +3 -1
  88. package/types/amount.d.ts.map +1 -0
  89. package/{dist/algo-amount.js → types/amount.js} +7 -1
  90. package/types/amount.js.map +1 -0
  91. package/types/app.d.ts +234 -0
  92. package/types/app.d.ts.map +1 -0
  93. package/types/app.js +32 -0
  94. package/types/app.js.map +1 -0
  95. package/types/application-client.d.ts +155 -0
  96. package/types/application-client.d.ts.map +1 -0
  97. package/types/application-client.js +348 -0
  98. package/types/application-client.js.map +1 -0
  99. package/types/appspec.d.ts +77 -0
  100. package/types/appspec.d.ts.map +1 -0
  101. package/types/appspec.js +15 -0
  102. package/types/appspec.js.map +1 -0
  103. package/types/config.d.ts +15 -0
  104. package/types/config.d.ts.map +1 -0
  105. package/types/config.js +27 -0
  106. package/types/config.js.map +1 -0
  107. package/{dist/indexer-type.d.ts → types/indexer.d.ts} +9 -10
  108. package/types/indexer.d.ts.map +1 -0
  109. package/{dist/indexer-type.js → types/indexer.js} +1 -1
  110. package/types/indexer.js.map +1 -0
  111. package/{dist/config.d.ts → types/logging.d.ts} +3 -15
  112. package/types/logging.d.ts.map +1 -0
  113. package/types/logging.js +27 -0
  114. package/types/logging.js.map +1 -0
  115. package/types/logic-error.d.ts +33 -0
  116. package/types/logic-error.d.ts.map +1 -0
  117. package/types/logic-error.js +46 -0
  118. package/types/logic-error.js.map +1 -0
  119. package/types/network-client.d.ts +11 -0
  120. package/types/network-client.d.ts.map +1 -0
  121. package/types/network-client.js +3 -0
  122. package/types/network-client.js.map +1 -0
  123. package/types/testing.d.ts +89 -0
  124. package/types/testing.d.ts.map +1 -0
  125. package/types/testing.js +3 -0
  126. package/types/testing.js.map +1 -0
  127. package/types/transaction.d.ts +67 -0
  128. package/types/transaction.d.ts.map +1 -0
  129. package/types/transaction.js +3 -0
  130. package/types/transaction.js.map +1 -0
  131. package/types/transfer.d.ts +32 -0
  132. package/types/transfer.d.ts.map +1 -0
  133. package/types/transfer.js +3 -0
  134. package/types/transfer.js.map +1 -0
  135. package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
  136. package/types/urlTokenBaseHTTPClient.js.map +1 -0
  137. package/LICENSE +0 -21
  138. package/README.md +0 -31
  139. package/dist/account.d.ts.map +0 -1
  140. package/dist/account.js.map +0 -1
  141. package/dist/algo-amount.d.ts.map +0 -1
  142. package/dist/algo-amount.js.map +0 -1
  143. package/dist/algo-http-client-with-retry.d.ts.map +0 -1
  144. package/dist/algo-http-client-with-retry.js.map +0 -1
  145. package/dist/algod-type.d.ts.map +0 -1
  146. package/dist/algod-type.js.map +0 -1
  147. package/dist/app.d.ts +0 -150
  148. package/dist/app.d.ts.map +0 -1
  149. package/dist/app.js +0 -160
  150. package/dist/app.js.map +0 -1
  151. package/dist/application-client.d.ts +0 -1
  152. package/dist/application-client.d.ts.map +0 -1
  153. package/dist/application-client.js +0 -69
  154. package/dist/application-client.js.map +0 -1
  155. package/dist/config.d.ts.map +0 -1
  156. package/dist/config.js +0 -28
  157. package/dist/config.js.map +0 -1
  158. package/dist/deploy-app.d.ts +0 -149
  159. package/dist/deploy-app.d.ts.map +0 -1
  160. package/dist/deploy-app.js.map +0 -1
  161. package/dist/index.d.ts +0 -13
  162. package/dist/index.d.ts.map +0 -1
  163. package/dist/index.js.map +0 -1
  164. package/dist/indexer-type.d.ts.map +0 -1
  165. package/dist/indexer-type.js.map +0 -1
  166. package/dist/localnet.d.ts.map +0 -1
  167. package/dist/localnet.js.map +0 -1
  168. package/dist/network-client.d.ts.map +0 -1
  169. package/dist/package.json +0 -20
  170. package/dist/transaction.d.ts +0 -147
  171. package/dist/transaction.d.ts.map +0 -1
  172. package/dist/transaction.js.map +0 -1
  173. package/dist/transfer.d.ts +0 -24
  174. package/dist/transfer.d.ts.map +0 -1
  175. package/dist/transfer.js +0 -33
  176. package/dist/transfer.js.map +0 -1
  177. package/dist/urlTokenBaseHTTPClient.d.ts.map +0 -1
  178. package/dist/urlTokenBaseHTTPClient.js.map +0 -1
  179. /package/{dist/indexer-lookup.js → indexer-lookup.js} +0 -0
  180. /package/{dist/indexer-lookup.js.map → indexer-lookup.js.map} +0 -0
  181. /package/{dist → types}/algo-http-client-with-retry.d.ts +0 -0
  182. /package/{dist → types}/urlTokenBaseHTTPClient.d.ts +0 -0
  183. /package/{dist → types}/urlTokenBaseHTTPClient.js +0 -0
package/app.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAQgB;AAChB,mCAA+B;AAC/B,yBAA2B;AAC3B,+CAA8G;AAE9G,qCAYoB;AAEpB;;;;;GAKG;AACI,KAAK,UAAU,SAAS,CAC7B,MAAuB,EACvB,KAAc;IAEd,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,GAAG,MAAM,CAAA;IAElI,MAAM,gBAAgB,GAAG,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IACtG,MAAM,eAAe,GAAG,gBAAgB,CAAC,CAAC,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,CAAA;IAC5F,MAAM,aAAa,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC7F,MAAM,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC,KAAK,CAAA;IAEhF,MAAM,WAAW,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KACrG,CAAA;AACH,CAAC;AA5ED,4DA4EC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,aAAa,CAAC,KAAa,EAAE,KAAc;IAC/D,OAAO,CAAC,MAAM,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAwB,CAAA;AAC5E,CAAC;AAFD,sCAEC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAAC,QAAgB,EAAE,KAAc;IAChE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,CAAA;IACnE,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,QAAQ,CAAC,MAAM;QACzB,YAAY,EAAE,QAAQ,CAAC,IAAI;QAC3B,qBAAqB,EAAE,IAAI,UAAU,CAAC,eAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC7E,SAAS,EAAE,IAAI,mBAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;KAChD,CAAA;AACH,CAAC;AATD,kCASC"}
@@ -0,0 +1,10 @@
1
+ import { Algodv2 } from 'algosdk';
2
+ import { ApplicationClient, AppSpecAppDetails } from './types/application-client';
3
+ /**
4
+ * Create a new ApplicationClient instance
5
+ * @param appDetails The details of the app
6
+ * @param algod An algod instance
7
+ * @returns The application client
8
+ */
9
+ export declare function getApplicationClient(appDetails: AppSpecAppDetails, algod: Algodv2): ApplicationClient;
10
+ //# sourceMappingURL=application-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-client.d.ts","sourceRoot":"","sources":["../src/application-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEjF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,qBAEjF"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getApplicationClient = void 0;
4
+ const application_client_1 = require("./types/application-client");
5
+ /**
6
+ * Create a new ApplicationClient instance
7
+ * @param appDetails The details of the app
8
+ * @param algod An algod instance
9
+ * @returns The application client
10
+ */
11
+ function getApplicationClient(appDetails, algod) {
12
+ return new application_client_1.ApplicationClient(appDetails, algod);
13
+ }
14
+ exports.getApplicationClient = getApplicationClient;
15
+ //# sourceMappingURL=application-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application-client.js","sourceRoot":"","sources":["../src/application-client.ts"],"names":[],"mappings":";;;AACA,mEAAiF;AAEjF;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,UAA6B,EAAE,KAAc;IAChF,OAAO,IAAI,sCAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;AACjD,CAAC;AAFD,oDAEC"}
@@ -0,0 +1,93 @@
1
+ import { Algodv2, Indexer } from 'algosdk';
2
+ import { ApplicationStateSchema } from './types/algod';
3
+ import { AppCompilationResult, AppDeploymentParams, AppDeployMetadata, AppLookup, AppMetadata, CompiledTeal, TealTemplateParameters } from './types/app';
4
+ import { ConfirmedTransactionResult, 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> & ((ConfirmedTransactionResult & AppMetadata & {
21
+ operationPerformed: 'create' | 'update';
22
+ }) | (ConfirmedTransactionResult & AppMetadata & {
23
+ deleteResult: ConfirmedTransactionResult;
24
+ operationPerformed: 'replace';
25
+ }) | (AppMetadata & {
26
+ operationPerformed: 'nothing';
27
+ }))>;
28
+ /** Returns true is there is a breaking change in the application state schema from before to after.
29
+ * i.e. if the schema becomes larger, since applications can't ask for more schema after creation.
30
+ * Otherwise, there is no error, the app just doesn't store data in the extra schema :(
31
+ *
32
+ * @param before The existing schema
33
+ * @param after The new schema
34
+ * @returns Whether or not there is a breaking change
35
+ */
36
+ export declare function isSchemaIsBroken(before: ApplicationStateSchema, after: ApplicationStateSchema): boolean;
37
+ /**
38
+ * 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.
39
+ *
40
+ * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).
41
+ *
42
+ * @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
43
+ * @param indexer An indexer client
44
+ * @returns A name-based lookup of the app information (id, address)
45
+ */
46
+ export declare function getCreatorAppsByName(creatorAccount: SendTransactionFrom | string, indexer: Indexer): Promise<AppLookup>;
47
+ /**
48
+ * Return the transaction note for an app deployment.
49
+ * @param metadata The metadata of the deployment
50
+ * @returns The transaction note as a utf-8 string
51
+ */
52
+ export declare function getAppDeploymentTransactionNote(metadata: AppDeployMetadata): {
53
+ dAppName: string;
54
+ data: AppDeployMetadata;
55
+ format: string;
56
+ };
57
+ /**
58
+ * Replaces deploy-time deployment control parameters within the given teal code.
59
+ *
60
+ * @see {UPDATABLE_TEMPLATE_NAME}
61
+ * @see {DELETABLE_TEMPLATE_NAME}
62
+ *
63
+ * @param tealCode The TEAL code to substitute
64
+ * @param params The deploy-time deployment control parameter value to replace
65
+ * @returns The replaced TEAL code
66
+ */
67
+ export declare function replaceDeployTimeControlParams(tealCode: string, params: {
68
+ updatable?: boolean;
69
+ deletable?: boolean;
70
+ }): string;
71
+ /**
72
+ * Performs template substitution of a teal file.
73
+ *
74
+ * Looks for `TMPL_{parameter}` for template replacements.
75
+ *
76
+ * @param tealCode The TEAL logic to compile
77
+ * @param templateParameters Any parameters to replace in the .teal file before compiling
78
+ * @returns The TEAL code with replacements
79
+ */
80
+ export declare function performTemplateSubstitution(tealCode: string, templateParameters?: TealTemplateParameters): string;
81
+ /**
82
+ * Performs template substitution of a teal file and compiles it, returning the compiled result.
83
+ *
84
+ * Looks for `TMPL_{parameter}` for template replacements.
85
+ *
86
+ * @param tealCode The TEAL logic to compile
87
+ * @param algod An algod client
88
+ * @param templateParameters Any parameters to replace in the .teal file before compiling
89
+ * @param deploymentMetadata The deployment metadata the app will be deployed with
90
+ * @returns The information about the compiled code
91
+ */
92
+ export declare function performTemplateSubstitutionAndCompile(tealCode: string, algod: Algodv2, templateParameters?: TealTemplateParameters, deploymentMetadata?: AppDeployMetadata): Promise<CompiledTeal>;
93
+ //# 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,EAAyB,OAAO,EAAmB,MAAM,SAAS,CAAA;AAKlF,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,WAAW,EAEX,YAAY,EAIZ,sBAAsB,EAEvB,M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B,KAAK,EAAE,OAAO,EACd,kBAAkB,CAAC,EAAE,sBAAsB,EAC3C,kBAAkB,CAAC,EAAE,iBAAiB,GACrC,OAAO,CAAC,YAAY,CAAC,CAQvB"}
@@ -1,43 +1,25 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.performTemplateSubstitutionAndCompile = exports.replaceDeployTimeControlParams = exports.getAppDeploymentTransactionNote = exports.getCreatorAppsByName = exports.schemaIsBroken = exports.deployApp = exports.OnSchemaBreak = exports.OnUpdate = exports.APP_DEPLOY_NOTE_PREFIX = exports.DELETABLE_TEMPLATE_NAME = exports.UPDATABLE_TEMPLATE_NAME = void 0;
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
- exports.UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE';
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:** if there is a breaking state schema change to an existing app (and `onSchemaBreak` is set to `'delete'`) the existing app will be deleted and re-created.
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 an update (different TEAL code) to an existing app (and `onUpdate` is set to `'delete'`) the existing app will be deleted and re-created.
38
- * @param deployment The arguments to control the app deployment, including:
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) {
@@ -45,19 +27,20 @@ async function deployApp(deployment, algod, indexer) {
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
- if (!appParams.suppressLog) {
49
- config_1.AlgoKitConfig.logger.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`);
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`);
50
32
  }
51
- appParams.approvalProgram =
52
- typeof appParams.approvalProgram === 'string'
53
- ? (await performTemplateSubstitutionAndCompile(appParams.approvalProgram, algod, deployTimeParameters, metadata))
54
- .compiledBase64ToBytes
55
- : appParams.approvalProgram;
56
- appParams.clearStateProgram =
57
- typeof appParams.clearStateProgram === 'string'
58
- ? (await performTemplateSubstitutionAndCompile(appParams.clearStateProgram, algod, deployTimeParameters)).compiledBase64ToBytes
59
- : appParams.clearStateProgram;
60
- const apps = existingDeployments ?? (await getCreatorAppsByName(indexer, appParams.from));
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));
61
44
  const create = async (skipSending) => {
62
45
  const result = await (0, app_1.createApp)({
63
46
  ...appParams,
@@ -68,27 +51,27 @@ async function deployApp(deployment, algod, indexer) {
68
51
  }, algod);
69
52
  return {
70
53
  transaction: result.transaction,
54
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
71
55
  confirmation: result.confirmation,
72
- appIndex: result.appIndex,
56
+ appId: result.appId,
73
57
  appAddress: result.appAddress,
74
58
  createdMetadata: metadata,
75
59
  createdRound: Number(result.confirmation?.['confirmed-round']),
76
60
  updatedRound: Number(result.confirmation?.['confirmed-round']),
77
61
  ...metadata,
78
62
  deleted: false,
63
+ operationPerformed: 'create',
64
+ compiledApproval,
65
+ compiledClear,
79
66
  };
80
67
  };
81
68
  const existingApp = apps.apps[metadata.name];
82
- if (!existingApp) {
83
- if (!appParams.suppressLog) {
84
- config_1.AlgoKitConfig.logger.info(`App ${metadata.name} not found in apps created by ${(0, transaction_1.getSenderAddress)(appParams.from)}; deploying app with version ${metadata.version}.`);
85
- }
69
+ if (!existingApp || existingApp.deleted) {
70
+ _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}.`);
86
71
  return await create();
87
72
  }
88
- if (!appParams.suppressLog) {
89
- config_1.AlgoKitConfig.logger.info(`Existing app ${metadata.name} found by creator ${(0, transaction_1.getSenderAddress)(appParams.from)}, with app index ${existingApp.appIndex} and version ${existingApp.version}.`);
90
- }
91
- const existingAppRecord = await (0, app_1.getAppByIndex)(existingApp.appIndex, algod);
73
+ _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}.`);
74
+ const existingAppRecord = await (0, app_1.getAppByIndex)(existingApp.appId, algod);
92
75
  const existingApproval = existingAppRecord.params['approval-program'];
93
76
  const existingClear = existingAppRecord.params['clear-state-program'];
94
77
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -106,19 +89,15 @@ async function deployApp(deployment, algod, indexer) {
106
89
  const newApproval = Buffer.from(appParams.approvalProgram).toString('base64');
107
90
  const newClear = Buffer.from(appParams.clearStateProgram).toString('base64');
108
91
  const isUpdate = newApproval !== existingApproval || newClear !== existingClear;
109
- const isSchemaBreak = schemaIsBroken(existingGlobalSchema, newGlobalSchema) || schemaIsBroken(existingLocalSchema, newLocalSchema);
92
+ const isSchemaBreak = isSchemaIsBroken(existingGlobalSchema, newGlobalSchema) || isSchemaIsBroken(existingLocalSchema, newLocalSchema);
110
93
  const replace = async () => {
111
94
  // Create
112
- if (!appParams.suppressLog) {
113
- config_1.AlgoKitConfig.logger.info(`Deploying a new ${metadata.name} app for ${(0, transaction_1.getSenderAddress)(appParams.from)}; deploying app with version ${metadata.version}.`);
114
- }
115
- const { transaction: createTransaction, ...newApp } = await create(true);
95
+ _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}.`);
96
+ const { transaction: createTransaction } = await create(true);
116
97
  // Delete
117
- if (!appParams.suppressLog) {
118
- config_1.AlgoKitConfig.logger.warn(`Deleting existing ${metadata.name} app with index ${existingApp.appIndex} from ${(0, transaction_1.getSenderAddress)(appParams.from)} account.`);
119
- }
98
+ _1.Config.getLogger(appParams.suppressLog).warn(`Deleting existing ${metadata.name} app with id ${existingApp.appId} from ${(0, transaction_1.getSenderAddress)(appParams.from)} account.`);
120
99
  const { transaction: deleteTransaction } = await (0, app_1.callApp)({
121
- appIndex: existingApp.appIndex,
100
+ appId: existingApp.appId,
122
101
  callType: 'delete',
123
102
  from: appParams.from,
124
103
  args: deleteArgs,
@@ -150,13 +129,12 @@ async function deployApp(deployment, algod, indexer) {
150
129
  const deleteConfirmation = confirmations[1];
151
130
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
152
131
  const newAppIndex = createConfirmation['application-index'];
153
- if (!appParams.suppressLog) {
154
- config_1.AlgoKitConfig.logger.warn(`Sent transactions ${createTransaction.txID()} to create app with index ${newAppIndex} and ${deleteTransaction.txID()} to delete app with index ${existingApp.appIndex} from ${(0, transaction_1.getSenderAddress)(appParams.from)} account.`);
155
- }
132
+ _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.`);
156
133
  return {
157
134
  transaction: createTransaction,
135
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
158
136
  confirmation: createConfirmation,
159
- appIndex: newAppIndex,
137
+ appId: newAppIndex,
160
138
  appAddress: (0, algosdk_1.getApplicationAddress)(newAppIndex),
161
139
  createdMetadata: metadata,
162
140
  createdRound: Number(createConfirmation['confirmed-round']),
@@ -164,14 +142,15 @@ async function deployApp(deployment, algod, indexer) {
164
142
  ...metadata,
165
143
  deleted: false,
166
144
  deleteResult: { transaction: deleteTransaction, confirmation: deleteConfirmation },
145
+ operationPerformed: 'replace',
146
+ compiledApproval,
147
+ compiledClear,
167
148
  };
168
149
  };
169
150
  const update = async () => {
170
- if (!appParams.suppressLog) {
171
- config_1.AlgoKitConfig.logger.info(`Updating existing ${metadata.name} app for ${(0, transaction_1.getSenderAddress)(appParams.from)} to version ${metadata.version}.`);
172
- }
151
+ _1.Config.getLogger(appParams.suppressLog).info(`Updating existing ${metadata.name} app for ${(0, transaction_1.getSenderAddress)(appParams.from)} to version ${metadata.version}.`);
173
152
  const result = await (0, app_1.updateApp)({
174
- appIndex: existingApp.appIndex,
153
+ appId: existingApp.appId,
175
154
  from: appParams.from,
176
155
  args: updateArgs,
177
156
  note: getAppDeploymentTransactionNote(metadata),
@@ -184,80 +163,72 @@ async function deployApp(deployment, algod, indexer) {
184
163
  }, algod);
185
164
  return {
186
165
  transaction: result.transaction,
166
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
187
167
  confirmation: result.confirmation,
188
- appIndex: existingApp.appIndex,
168
+ appId: existingApp.appId,
189
169
  appAddress: existingApp.appAddress,
190
170
  createdMetadata: existingApp.createdMetadata,
191
171
  createdRound: existingApp.createdRound,
192
172
  updatedRound: Number(result.confirmation?.['confirmed-round']),
193
173
  ...metadata,
194
174
  deleted: false,
175
+ operationPerformed: 'update',
176
+ compiledApproval,
177
+ compiledClear,
195
178
  };
196
179
  };
197
180
  if (isSchemaBreak) {
198
- if (!appParams.suppressLog) {
199
- config_1.AlgoKitConfig.logger.warn(`Detected a breaking app schema change in app ${existingApp.appIndex}:`, {
200
- from: {
201
- global: existingGlobalSchema,
202
- local: existingLocalSchema,
203
- },
204
- to: {
205
- global: newGlobalSchema,
206
- local: newLocalSchema,
207
- },
208
- });
209
- }
210
- if (onSchemaBreak === undefined || onSchemaBreak === 'fail' || onSchemaBreak === OnSchemaBreak.Fail) {
181
+ _1.Config.getLogger(appParams.suppressLog).warn(`Detected a breaking app schema change in app ${existingApp.appId}:`, {
182
+ from: {
183
+ global: existingGlobalSchema,
184
+ local: existingLocalSchema,
185
+ },
186
+ to: {
187
+ global: newGlobalSchema,
188
+ local: newLocalSchema,
189
+ },
190
+ });
191
+ if (onSchemaBreak === undefined || onSchemaBreak === 'fail' || onSchemaBreak === app_2.OnSchemaBreak.Fail) {
211
192
  throw new Error('Schema break detected and onSchemaBreak=OnSchemaBreak.Fail, stopping deployment. ' +
212
193
  'If you want to try deleting and recreating the app then ' +
213
194
  're-run with onSchemaBreak=OnSchemaBreak.ReplaceApp');
214
195
  }
215
- if (!appParams.suppressLog) {
216
- if (existingApp.deletable) {
217
- config_1.AlgoKitConfig.logger.info('App is deletable and onSchemaBreak=ReplaceApp, will attempt to create new app and delete old app');
218
- }
219
- else {
220
- config_1.AlgoKitConfig.logger.info('App is not deletable but onSchemaBreak=ReplaceApp, will attempt to delete app, delete will most likely fail');
221
- }
196
+ if (existingApp.deletable) {
197
+ _1.Config.getLogger(appParams.suppressLog).info('App is deletable and onSchemaBreak=ReplaceApp, will attempt to create new app and delete old app');
198
+ }
199
+ else {
200
+ _1.Config.getLogger(appParams.suppressLog).info('App is not deletable but onSchemaBreak=ReplaceApp, will attempt to delete app, delete will most likely fail');
222
201
  }
223
202
  return await replace();
224
203
  }
225
204
  if (isUpdate) {
226
- if (!appParams.suppressLog) {
227
- config_1.AlgoKitConfig.logger.info(`Detected a TEAL update in app ${existingApp.appIndex} for creator ${(0, transaction_1.getSenderAddress)(appParams.from)}`);
228
- }
229
- if (onUpdate === undefined || onUpdate === 'fail' || onUpdate === OnUpdate.Fail) {
205
+ _1.Config.getLogger(appParams.suppressLog).info(`Detected a TEAL update in app ${existingApp.appId} for creator ${(0, transaction_1.getSenderAddress)(appParams.from)}`);
206
+ if (onUpdate === undefined || onUpdate === 'fail' || onUpdate === app_2.OnUpdate.Fail) {
230
207
  throw new Error('Update detected and onUpdate=Fail, stopping deployment. ' +
231
208
  'If you want to try deleting and recreating the app then ' +
232
209
  're-run with onUpdate=UpdateApp');
233
210
  }
234
- if (onUpdate === 'update' || onUpdate === OnUpdate.UpdateApp) {
235
- if (!appParams.suppressLog) {
236
- if (existingApp.updatable) {
237
- config_1.AlgoKitConfig.logger.info(`App is updatable and onUpdate=UpdateApp, updating app...`);
238
- }
239
- else {
240
- config_1.AlgoKitConfig.logger.warn(`App is not updatable but onUpdate=UpdateApp, will attempt to update app, update will most likely fail`);
241
- }
211
+ if (onUpdate === 'update' || onUpdate === app_2.OnUpdate.UpdateApp) {
212
+ if (existingApp.updatable) {
213
+ _1.Config.getLogger(appParams.suppressLog).info(`App is updatable and onUpdate=UpdateApp, updating app...`);
214
+ }
215
+ else {
216
+ _1.Config.getLogger(appParams.suppressLog).warn(`App is not updatable but onUpdate=UpdateApp, will attempt to update app, update will most likely fail`);
242
217
  }
243
218
  return await update();
244
219
  }
245
- if (onUpdate === 'replace' || onUpdate === OnUpdate.ReplaceApp) {
246
- if (!appParams.suppressLog) {
247
- if (existingApp.deletable) {
248
- config_1.AlgoKitConfig.logger.warn('App is deletable and onUpdate=ReplaceApp, creating new app and deleting old app...');
249
- }
250
- else {
251
- config_1.AlgoKitConfig.logger.warn('App is not deletable and onUpdate=ReplaceApp, will attempt to create new app and delete old app, delete will most likely fail');
252
- }
220
+ if (onUpdate === 'replace' || onUpdate === app_2.OnUpdate.ReplaceApp) {
221
+ if (existingApp.deletable) {
222
+ _1.Config.getLogger(appParams.suppressLog).warn('App is deletable and onUpdate=ReplaceApp, creating new app and deleting old app...');
223
+ }
224
+ else {
225
+ _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');
253
226
  }
254
227
  return await replace();
255
228
  }
256
229
  }
257
- if (!appParams.suppressLog) {
258
- config_1.AlgoKitConfig.logger.debug('No detected changes in app, nothing to do.');
259
- }
260
- return existingApp;
230
+ _1.Config.getLogger(appParams.suppressLog).debug('No detected changes in app, nothing to do.');
231
+ return { ...existingApp, operationPerformed: 'nothing', compiledApproval, compiledClear };
261
232
  }
262
233
  exports.deployApp = deployApp;
263
234
  /** Returns true is there is a breaking change in the application state schema from before to after.
@@ -268,20 +239,20 @@ exports.deployApp = deployApp;
268
239
  * @param after The new schema
269
240
  * @returns Whether or not there is a breaking change
270
241
  */
271
- function schemaIsBroken(before, after) {
242
+ function isSchemaIsBroken(before, after) {
272
243
  return before['num-byte-slice'] < after['num-byte-slice'] || before['num-uint'] < after['num-uint'];
273
244
  }
274
- exports.schemaIsBroken = schemaIsBroken;
245
+ exports.isSchemaIsBroken = isSchemaIsBroken;
275
246
  /**
276
247
  * 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.
277
248
  *
278
249
  * **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).
279
250
  *
280
- * @param indexer An indexer client
281
251
  * @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
252
+ * @param indexer An indexer client
282
253
  * @returns A name-based lookup of the app information (id, address)
283
254
  */
284
- async function getCreatorAppsByName(indexer, creatorAccount) {
255
+ async function getCreatorAppsByName(creatorAccount, indexer) {
285
256
  const appLookup = {};
286
257
  const creatorAddress = typeof creatorAccount !== 'string' ? (0, transaction_1.getSenderAddress)(creatorAccount) : creatorAccount;
287
258
  // Extract all apps that account created
@@ -298,7 +269,7 @@ async function getCreatorAppsByName(indexer, creatorAccount) {
298
269
  .applicationID(createdApp.id)
299
270
  .address(creatorAddress)
300
271
  .addressRole('sender')
301
- .notePrefix(Buffer.from(exports.APP_DEPLOY_NOTE_PREFIX).toString('base64')));
272
+ .notePrefix(Buffer.from(app_2.APP_DEPLOY_NOTE_DAPP).toString('base64')));
302
273
  // Triple check the transaction is intact by filtering for the one we want:
303
274
  // * application-id is 0 when the app is first created
304
275
  // * also verify the sender to prevent a potential security risk
@@ -323,17 +294,17 @@ async function getCreatorAppsByName(indexer, creatorAccount) {
323
294
  const decoder = new TextDecoder();
324
295
  const noteAsBase64 = decoder.decode(Buffer.from(note));
325
296
  const noteAsString = Buffer.from(noteAsBase64, 'base64').toString('utf-8');
326
- if (!noteAsString.startsWith(`${exports.APP_DEPLOY_NOTE_PREFIX}{`))
297
+ if (!noteAsString.startsWith(`${app_2.APP_DEPLOY_NOTE_DAPP}:j{`))
327
298
  // Clearly not APP_DEPLOY JSON; ignoring...
328
299
  return;
329
- return JSON.parse(noteAsString.substring(exports.APP_DEPLOY_NOTE_PREFIX.length));
300
+ return JSON.parse(noteAsString.substring(app_2.APP_DEPLOY_NOTE_DAPP.length + 2));
330
301
  };
331
302
  try {
332
303
  const creationNote = parseNote(appCreationTransaction.note);
333
304
  const updateNote = parseNote(latestAppUpdateTransaction.note);
334
305
  if (creationNote?.name) {
335
306
  appLookup[creationNote.name] = {
336
- appIndex: createdApp.id,
307
+ appId: createdApp.id,
337
308
  appAddress: (0, algosdk_1.getApplicationAddress)(createdApp.id),
338
309
  createdMetadata: creationNote,
339
310
  createdRound: Number(appCreationTransaction['confirmed-round']),
@@ -344,7 +315,7 @@ async function getCreatorAppsByName(indexer, creatorAccount) {
344
315
  }
345
316
  }
346
317
  catch (e) {
347
- config_1.AlgoKitConfig.logger.warn(`Received error trying to retrieve app with ${createdApp.id} for creator ${creatorAddress}; failing silently`, e);
318
+ _1.Config.logger.warn(`Received error trying to retrieve app with ${createdApp.id} for creator ${creatorAddress}; failing silently`, e);
348
319
  return;
349
320
  }
350
321
  }));
@@ -360,7 +331,11 @@ exports.getCreatorAppsByName = getCreatorAppsByName;
360
331
  * @returns The transaction note as a utf-8 string
361
332
  */
362
333
  function getAppDeploymentTransactionNote(metadata) {
363
- return `${exports.APP_DEPLOY_NOTE_PREFIX}${JSON.stringify(metadata)}`;
334
+ return {
335
+ dAppName: app_2.APP_DEPLOY_NOTE_DAPP,
336
+ data: metadata,
337
+ format: 'j',
338
+ };
364
339
  }
365
340
  exports.getAppDeploymentTransactionNote = getAppDeploymentTransactionNote;
366
341
  /**
@@ -374,28 +349,35 @@ exports.getAppDeploymentTransactionNote = getAppDeploymentTransactionNote;
374
349
  * @returns The replaced TEAL code
375
350
  */
376
351
  function replaceDeployTimeControlParams(tealCode, params) {
377
- return tealCode
378
- .replace(exports.UPDATABLE_TEMPLATE_NAME, (params.updatable ? 1 : 0).toString())
379
- .replace(exports.DELETABLE_TEMPLATE_NAME, (params.deletable ? 1 : 0).toString());
352
+ if (params.updatable !== undefined) {
353
+ if (!tealCode.includes(app_2.UPDATABLE_TEMPLATE_NAME)) {
354
+ throw new Error(`Deploy-time updatability control requested for app deployment, but ${app_2.UPDATABLE_TEMPLATE_NAME} not present in TEAL code`);
355
+ }
356
+ tealCode = tealCode.replace(new RegExp(app_2.UPDATABLE_TEMPLATE_NAME, 'g'), (params.updatable ? 1 : 0).toString());
357
+ }
358
+ if (params.deletable !== undefined) {
359
+ if (!tealCode.includes(app_2.DELETABLE_TEMPLATE_NAME)) {
360
+ throw new Error(`Deploy-time deletability control requested for app deployment, but ${app_2.DELETABLE_TEMPLATE_NAME} not present in TEAL code`);
361
+ }
362
+ tealCode = tealCode.replace(new RegExp(app_2.DELETABLE_TEMPLATE_NAME, 'g'), (params.deletable ? 1 : 0).toString());
363
+ }
364
+ return tealCode;
380
365
  }
381
366
  exports.replaceDeployTimeControlParams = replaceDeployTimeControlParams;
382
367
  /**
383
- * Performs template substitution of a teal file and compiles it, returning the compiled result and optionally caching on the file system.
368
+ * Performs template substitution of a teal file.
384
369
  *
385
370
  * Looks for `TMPL_{parameter}` for template replacements.
386
371
  *
387
372
  * @param tealCode The TEAL logic to compile
388
- * @param algod An algod client
389
373
  * @param templateParameters Any parameters to replace in the .teal file before compiling
390
- * @param deploymentMetadata The deployment metadata the app will be deployed with
391
- * @returns The information about the compiled code
374
+ * @returns The TEAL code with replacements
392
375
  */
393
- async function performTemplateSubstitutionAndCompile(tealCode, algod, templateParameters, deploymentMetadata) {
376
+ function performTemplateSubstitution(tealCode, templateParameters) {
394
377
  if (templateParameters !== undefined) {
395
378
  for (const key in templateParameters) {
396
379
  const value = templateParameters[key];
397
- const token = `TMPL_${key}`;
398
- // todo: handle uint8array
380
+ const token = `TMPL_${key.replace(/^TMPL_/, '')}`;
399
381
  tealCode = tealCode.replace(new RegExp(token, 'g'), typeof value === 'string'
400
382
  ? `0x${Buffer.from(value, 'utf-8').toString('hex')}`
401
383
  : ArrayBuffer.isView(value)
@@ -403,16 +385,26 @@ async function performTemplateSubstitutionAndCompile(tealCode, algod, templatePa
403
385
  : value.toString());
404
386
  }
405
387
  }
388
+ return tealCode;
389
+ }
390
+ exports.performTemplateSubstitution = performTemplateSubstitution;
391
+ /**
392
+ * Performs template substitution of a teal file and compiles it, returning the compiled result.
393
+ *
394
+ * Looks for `TMPL_{parameter}` for template replacements.
395
+ *
396
+ * @param tealCode The TEAL logic to compile
397
+ * @param algod An algod client
398
+ * @param templateParameters Any parameters to replace in the .teal file before compiling
399
+ * @param deploymentMetadata The deployment metadata the app will be deployed with
400
+ * @returns The information about the compiled code
401
+ */
402
+ async function performTemplateSubstitutionAndCompile(tealCode, algod, templateParameters, deploymentMetadata) {
403
+ tealCode = performTemplateSubstitution(tealCode, templateParameters);
406
404
  if (deploymentMetadata) {
407
405
  tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata);
408
406
  }
409
- const compiled = await algod.compile(tealCode).do();
410
- return {
411
- teal: tealCode,
412
- compiled: compiled.result,
413
- compiledHash: compiled.hash,
414
- compiledBase64ToBytes: new Uint8Array(Buffer.from(compiled.result, 'base64')),
415
- };
407
+ return await (0, app_1.compileTeal)(tealCode, algod);
416
408
  }
417
409
  exports.performTemplateSubstitutionAndCompile = performTemplateSubstitutionAndCompile;
418
410
  //# sourceMappingURL=deploy-app.js.map