@algorandfoundation/algokit-utils 9.2.0 → 9.2.1-beta.2
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/_virtual/_rolldown/runtime.js +33 -0
- package/_virtual/_rolldown/runtime.mjs +13 -0
- package/account/account.d.ts +25 -30
- package/account/account.js +151 -146
- package/account/account.js.map +1 -1
- package/account/account.mjs +149 -144
- package/account/account.mjs.map +1 -1
- package/account/get-account-config-from-environment.d.ts +7 -2
- package/account/get-account-config-from-environment.js +19 -21
- package/account/get-account-config-from-environment.js.map +1 -1
- package/account/get-account-config-from-environment.mjs +19 -19
- package/account/get-account-config-from-environment.mjs.map +1 -1
- package/account/get-account.d.ts +14 -12
- package/account/get-account.js +56 -59
- package/account/get-account.js.map +1 -1
- package/account/get-account.mjs +56 -57
- package/account/get-account.mjs.map +1 -1
- package/account/get-dispenser-account.d.ts +9 -5
- package/account/get-dispenser-account.js +20 -18
- package/account/get-dispenser-account.js.map +1 -1
- package/account/get-dispenser-account.mjs +20 -16
- package/account/get-dispenser-account.mjs.map +1 -1
- package/account/mnemonic-account.d.ts +7 -3
- package/account/mnemonic-account.js +17 -17
- package/account/mnemonic-account.js.map +1 -1
- package/account/mnemonic-account.mjs +15 -15
- package/account/mnemonic-account.mjs.map +1 -1
- package/amount.d.ts +40 -35
- package/amount.js +33 -34
- package/amount.js.map +1 -1
- package/amount.mjs +33 -32
- package/amount.mjs.map +1 -1
- package/app-client.d.ts +10 -6
- package/app-client.js +91 -86
- package/app-client.js.map +1 -1
- package/app-client.mjs +91 -84
- package/app-client.mjs.map +1 -1
- package/app-deploy.d.ts +26 -24
- package/app-deploy.js +235 -253
- package/app-deploy.js.map +1 -1
- package/app-deploy.mjs +233 -251
- package/app-deploy.mjs.map +1 -1
- package/app.d.ts +45 -46
- package/app.js +253 -271
- package/app.js.map +1 -1
- package/app.mjs +249 -267
- package/app.mjs.map +1 -1
- package/asset.d.ts +16 -12
- package/asset.js +116 -122
- package/asset.js.map +1 -1
- package/asset.mjs +116 -120
- package/asset.mjs.map +1 -1
- package/config.d.ts +7 -2
- package/config.js +5 -7
- package/config.js.map +1 -1
- package/config.mjs +5 -4
- package/config.mjs.map +1 -1
- package/debugging/debugging.d.ts +5 -1
- package/debugging/debugging.js +11 -11
- package/debugging/debugging.js.map +1 -1
- package/debugging/debugging.mjs +11 -9
- package/debugging/debugging.mjs.map +1 -1
- package/dispenser-client.d.ts +7 -2
- package/dispenser-client.js +23 -24
- package/dispenser-client.js.map +1 -1
- package/dispenser-client.mjs +23 -22
- package/dispenser-client.mjs.map +1 -1
- package/index.d.ts +27 -18
- package/index.js +140 -143
- package/index.mjs +27 -29
- package/indexer-lookup.d.ts +18 -11
- package/indexer-lookup.js +112 -120
- package/indexer-lookup.js.map +1 -1
- package/indexer-lookup.mjs +105 -118
- package/indexer-lookup.mjs.map +1 -1
- package/localnet/get-kmd-wallet-account.d.ts +9 -7
- package/localnet/get-kmd-wallet-account.js +28 -26
- package/localnet/get-kmd-wallet-account.js.map +1 -1
- package/localnet/get-kmd-wallet-account.mjs +28 -24
- package/localnet/get-kmd-wallet-account.mjs.map +1 -1
- package/localnet/get-localnet-dispenser-account.d.ts +7 -5
- package/localnet/get-localnet-dispenser-account.js +17 -15
- package/localnet/get-localnet-dispenser-account.js.map +1 -1
- package/localnet/get-localnet-dispenser-account.mjs +17 -13
- package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.d.ts +10 -8
- package/localnet/get-or-create-kmd-wallet-account.js +28 -26
- package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
- package/localnet/get-or-create-kmd-wallet-account.mjs +28 -24
- package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
- package/localnet/is-localnet.d.ts +7 -3
- package/localnet/is-localnet.js +9 -10
- package/localnet/is-localnet.js.map +1 -1
- package/localnet/is-localnet.mjs +9 -8
- package/localnet/is-localnet.mjs.map +1 -1
- package/network-client.d.ts +17 -15
- package/network-client.js +115 -116
- package/network-client.js.map +1 -1
- package/network-client.mjs +115 -114
- package/network-client.mjs.map +1 -1
- package/package.json +12 -3
- package/testing/account.d.ts +11 -9
- package/testing/account.js +31 -33
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +29 -31
- package/testing/account.mjs.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +7 -2
- package/testing/fixtures/algokit-log-capture-fixture.js +36 -41
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -1
- package/testing/fixtures/algokit-log-capture-fixture.mjs +36 -39
- package/testing/fixtures/algokit-log-capture-fixture.mjs.map +1 -1
- package/testing/fixtures/algorand-fixture.d.ts +9 -4
- package/testing/fixtures/algorand-fixture.js +67 -62
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/fixtures/algorand-fixture.mjs +66 -59
- package/testing/fixtures/algorand-fixture.mjs.map +1 -1
- package/testing/index.d.ts +7 -5
- package/testing/index.js +13 -18
- package/testing/index.mjs +7 -7
- package/testing/indexer.d.ts +5 -1
- package/testing/indexer.js +28 -37
- package/testing/indexer.js.map +1 -1
- package/testing/indexer.mjs +28 -35
- package/testing/indexer.mjs.map +1 -1
- package/testing/test-logger.d.ts +41 -36
- package/testing/test-logger.js +71 -76
- package/testing/test-logger.js.map +1 -1
- package/testing/test-logger.mjs +71 -74
- package/testing/test-logger.mjs.map +1 -1
- package/testing/transaction-logger.d.ts +30 -27
- package/testing/transaction-logger.js +77 -93
- package/testing/transaction-logger.js.map +1 -1
- package/testing/transaction-logger.mjs +74 -90
- package/testing/transaction-logger.mjs.map +1 -1
- package/transaction/legacy-bridge.js +100 -111
- package/transaction/legacy-bridge.js.map +1 -1
- package/transaction/legacy-bridge.mjs +97 -108
- package/transaction/legacy-bridge.mjs.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.d.ts +7 -5
- package/transaction/perform-atomic-transaction-composer-simulate.js +31 -36
- package/transaction/perform-atomic-transaction-composer-simulate.js.map +1 -1
- package/transaction/perform-atomic-transaction-composer-simulate.mjs +28 -33
- package/transaction/perform-atomic-transaction-composer-simulate.mjs.map +1 -1
- package/transaction/transaction.d.ts +34 -35
- package/transaction/transaction.js +716 -914
- package/transaction/transaction.js.map +1 -1
- package/transaction/transaction.mjs +713 -911
- package/transaction/transaction.mjs.map +1 -1
- package/transfer/transfer-algos.d.ts +9 -5
- package/transfer/transfer-algos.js +26 -27
- package/transfer/transfer-algos.js.map +1 -1
- package/transfer/transfer-algos.mjs +26 -25
- package/transfer/transfer-algos.mjs.map +1 -1
- package/transfer/transfer.d.ts +11 -8
- package/transfer/transfer.js +94 -100
- package/transfer/transfer.js.map +1 -1
- package/transfer/transfer.mjs +94 -98
- package/transfer/transfer.mjs.map +1 -1
- package/types/account-manager.d.ts +432 -429
- package/types/account-manager.js +591 -602
- package/types/account-manager.js.map +1 -1
- package/types/account-manager.mjs +587 -599
- package/types/account-manager.mjs.map +1 -1
- package/types/account.d.ts +192 -202
- package/types/account.js +91 -88
- package/types/account.js.map +1 -1
- package/types/account.mjs +88 -86
- package/types/account.mjs.map +1 -1
- package/types/algo-http-client-with-retry.d.ts +15 -10
- package/types/algo-http-client-with-retry.js +70 -92
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algo-http-client-with-retry.mjs +69 -90
- package/types/algo-http-client-with-retry.mjs.map +1 -1
- package/types/algorand-client-transaction-creator.d.ts +778 -771
- package/types/algorand-client-transaction-creator.js +733 -732
- package/types/algorand-client-transaction-creator.js.map +1 -1
- package/types/algorand-client-transaction-creator.mjs +732 -730
- package/types/algorand-client-transaction-creator.mjs.map +1 -1
- package/types/algorand-client-transaction-sender.d.ts +1090 -1360
- package/types/algorand-client-transaction-sender.js +930 -961
- package/types/algorand-client-transaction-sender.js.map +1 -1
- package/types/algorand-client-transaction-sender.mjs +927 -959
- package/types/algorand-client-transaction-sender.mjs.map +1 -1
- package/types/algorand-client.d.ts +239 -236
- package/types/algorand-client.js +322 -320
- package/types/algorand-client.js.map +1 -1
- package/types/algorand-client.mjs +321 -318
- package/types/algorand-client.mjs.map +1 -1
- package/types/amount.d.ts +47 -43
- package/types/amount.js +66 -70
- package/types/amount.js.map +1 -1
- package/types/amount.mjs +63 -68
- package/types/amount.mjs.map +1 -1
- package/types/app-arc56.d.ts +235 -272
- package/types/app-arc56.js +124 -170
- package/types/app-arc56.js.map +1 -1
- package/types/app-arc56.mjs +121 -168
- package/types/app-arc56.mjs.map +1 -1
- package/types/app-client.d.ts +1128 -2009
- package/types/app-client.js +1633 -1791
- package/types/app-client.js.map +1 -1
- package/types/app-client.mjs +1624 -1783
- package/types/app-client.mjs.map +1 -1
- package/types/app-deployer.d.ts +139 -141
- package/types/app-deployer.js +344 -384
- package/types/app-deployer.js.map +1 -1
- package/types/app-deployer.mjs +341 -382
- package/types/app-deployer.mjs.map +1 -1
- package/types/app-factory.d.ts +762 -932
- package/types/app-factory.js +496 -488
- package/types/app-factory.js.map +1 -1
- package/types/app-factory.mjs +491 -484
- package/types/app-factory.mjs.map +1 -1
- package/types/app-manager.d.ts +304 -310
- package/types/app-manager.js +422 -475
- package/types/app-manager.js.map +1 -1
- package/types/app-manager.mjs +419 -473
- package/types/app-manager.mjs.map +1 -1
- package/types/app-spec.d.ts +118 -117
- package/types/app-spec.js +125 -135
- package/types/app-spec.js.map +1 -1
- package/types/app-spec.mjs +121 -132
- package/types/app-spec.mjs.map +1 -1
- package/types/app.d.ts +229 -241
- package/types/app.js +36 -28
- package/types/app.js.map +1 -1
- package/types/app.mjs +33 -26
- package/types/app.mjs.map +1 -1
- package/types/asset-manager.d.ts +204 -199
- package/types/asset-manager.js +165 -174
- package/types/asset-manager.js.map +1 -1
- package/types/asset-manager.mjs +164 -172
- package/types/asset-manager.mjs.map +1 -1
- package/types/asset.d.ts +95 -91
- package/types/asset.js +0 -3
- package/types/asset.mjs +0 -2
- package/types/async-event-emitter.d.ts +18 -13
- package/types/async-event-emitter.js +37 -49
- package/types/async-event-emitter.js.map +1 -1
- package/types/async-event-emitter.mjs +36 -47
- package/types/async-event-emitter.mjs.map +1 -1
- package/types/client-manager.d.ts +453 -451
- package/types/client-manager.js +602 -598
- package/types/client-manager.js.map +1 -1
- package/types/client-manager.mjs +597 -594
- package/types/client-manager.mjs.map +1 -1
- package/types/composer.d.ts +1211 -1258
- package/types/composer.js +1436 -1498
- package/types/composer.js.map +1 -1
- package/types/composer.mjs +1430 -1493
- package/types/composer.mjs.map +1 -1
- package/types/config.d.ts +53 -48
- package/types/config.js +78 -77
- package/types/config.js.map +1 -1
- package/types/config.mjs +77 -75
- package/types/config.mjs.map +1 -1
- package/types/debugging.d.ts +25 -23
- package/types/debugging.js +9 -11
- package/types/debugging.js.map +1 -1
- package/types/debugging.mjs +8 -9
- package/types/debugging.mjs.map +1 -1
- package/types/dispenser-client.d.ts +57 -52
- package/types/dispenser-client.js +120 -141
- package/types/dispenser-client.js.map +1 -1
- package/types/dispenser-client.mjs +119 -139
- package/types/dispenser-client.mjs.map +1 -1
- package/types/expand.d.ts +5 -3
- package/types/expand.js +0 -3
- package/types/expand.mjs +0 -2
- package/types/indexer.d.ts +104 -100
- package/types/indexer.js +36 -31
- package/types/indexer.js.map +1 -1
- package/types/indexer.mjs +32 -30
- package/types/indexer.mjs.map +1 -1
- package/types/instance-of.d.ts +5 -3
- package/types/instance-of.js +0 -3
- package/types/instance-of.mjs +0 -2
- package/types/kmd-account-manager.d.ts +75 -70
- package/types/kmd-account-manager.js +150 -184
- package/types/kmd-account-manager.js.map +1 -1
- package/types/kmd-account-manager.mjs +147 -182
- package/types/kmd-account-manager.mjs.map +1 -1
- package/types/lifecycle-events.d.ts +13 -8
- package/types/lifecycle-events.js +10 -7
- package/types/lifecycle-events.js.map +1 -1
- package/types/lifecycle-events.mjs +9 -7
- package/types/lifecycle-events.mjs.map +1 -1
- package/types/logging.d.ts +15 -11
- package/types/logging.js +30 -31
- package/types/logging.js.map +1 -1
- package/types/logging.mjs +29 -29
- package/types/logging.mjs.map +1 -1
- package/types/logic-error.d.ts +33 -29
- package/types/logic-error.js +50 -49
- package/types/logic-error.js.map +1 -1
- package/types/logic-error.mjs +49 -47
- package/types/logic-error.mjs.map +1 -1
- package/types/network-client.d.ts +32 -27
- package/types/network-client.js +10 -9
- package/types/network-client.js.map +1 -1
- package/types/network-client.mjs +9 -7
- package/types/network-client.mjs.map +1 -1
- package/types/testing.d.ts +131 -132
- package/types/testing.js +0 -3
- package/types/testing.mjs +0 -2
- package/types/transaction.d.ts +110 -110
- package/types/transaction.js +0 -3
- package/types/transaction.mjs +0 -2
- package/types/transfer.d.ts +70 -66
- package/types/transfer.js +0 -3
- package/types/transfer.mjs +0 -2
- package/util.js +73 -118
- package/util.js.map +1 -1
- package/util.mjs +73 -116
- package/util.mjs.map +1 -1
- package/account/index.d.ts +0 -5
- package/debugging/index.d.ts +0 -1
- package/index.js.map +0 -1
- package/index.mjs.map +0 -1
- package/localnet/index.d.ts +0 -4
- package/testing/_asset.d.ts +0 -3
- package/testing/fixtures/index.d.ts +0 -2
- package/testing/index.js.map +0 -1
- package/testing/index.mjs.map +0 -1
- package/transaction/index.d.ts +0 -2
- package/transaction/legacy-bridge.d.ts +0 -35
- package/transfer/index.d.ts +0 -2
- package/types/asset.js.map +0 -1
- package/types/asset.mjs.map +0 -1
- package/types/expand.js.map +0 -1
- package/types/expand.mjs.map +0 -1
- package/types/instance-of.js.map +0 -1
- package/types/instance-of.mjs.map +0 -1
- package/types/testing.js.map +0 -1
- package/types/testing.mjs.map +0 -1
- package/types/transaction.js.map +0 -1
- package/types/transaction.mjs.map +0 -1
- package/types/transfer.js.map +0 -1
- package/types/transfer.mjs.map +0 -1
- package/util.d.ts +0 -48
package/app-deploy.js
CHANGED
|
@@ -1,279 +1,260 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_app = require("./types/app.js");
|
|
3
|
+
const require_transaction = require("./transaction/transaction.js");
|
|
4
|
+
const require_app_manager = require("./types/app-manager.js");
|
|
5
|
+
const require_composer = require("./types/composer.js");
|
|
6
|
+
const require_algorand_client_transaction_sender = require("./types/algorand-client-transaction-sender.js");
|
|
7
|
+
const require_asset_manager = require("./types/asset-manager.js");
|
|
8
|
+
const require_legacy_bridge = require("./transaction/legacy-bridge.js");
|
|
9
|
+
const require_app$1 = require("./app.js");
|
|
10
|
+
const require_app_deployer = require("./types/app-deployer.js");
|
|
11
|
+
let algosdk = require("algosdk");
|
|
12
|
+
algosdk = require_runtime.__toESM(algosdk);
|
|
13
|
+
//#region src/app-deploy.ts
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
* @deprecated Use `algorand.appDeployer.deploy` instead.
|
|
16
|
+
*
|
|
17
|
+
* Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
|
|
18
|
+
*
|
|
19
|
+
* To understand the architecture decisions behind this functionality please see https://github.com/algorandfoundation/algokit-cli/blob/main/docs/src/content/docs/architecture-decisions/2023-01-12_smart-contract-deployment.md
|
|
20
|
+
*
|
|
21
|
+
* **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`.
|
|
22
|
+
*
|
|
23
|
+
* **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.
|
|
24
|
+
*
|
|
25
|
+
* **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.
|
|
26
|
+
* @param deployment The arguments to control the app deployment
|
|
27
|
+
* @param algod An algod client
|
|
28
|
+
* @param indexer An indexer client, needed if `existingDeployments` not passed in
|
|
29
|
+
* @returns The app reference of the new/existing app
|
|
30
|
+
*/
|
|
31
31
|
async function deployApp(deployment, algod, indexer) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
])),
|
|
143
|
-
}
|
|
144
|
-
: undefined,
|
|
145
|
-
maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,
|
|
146
|
-
populateAppCallResources: deployment.populateAppCallResources,
|
|
147
|
-
suppressLog: deployment.suppressLog,
|
|
148
|
-
});
|
|
149
|
-
return {
|
|
150
|
-
...result,
|
|
151
|
-
appAddress: result.appAddress.toString(),
|
|
152
|
-
appId: Number(result.appId),
|
|
153
|
-
createdRound: Number(result.createdRound),
|
|
154
|
-
updatedRound: Number(result.updatedRound),
|
|
155
|
-
};
|
|
32
|
+
const appManager = new require_app_manager.AppManager(algod);
|
|
33
|
+
const newGroup = () => new require_composer.TransactionComposer({
|
|
34
|
+
algod,
|
|
35
|
+
getSigner: () => require_transaction.getSenderTransactionSigner(deployment.from),
|
|
36
|
+
getSuggestedParams: async () => deployment.transactionParams ? { ...deployment.transactionParams } : await algod.getTransactionParams().do(),
|
|
37
|
+
appManager
|
|
38
|
+
});
|
|
39
|
+
const deployer = new require_app_deployer.AppDeployer(appManager, new require_algorand_client_transaction_sender.AlgorandClientTransactionSender(newGroup, new require_asset_manager.AssetManager(algod, newGroup), appManager), indexer);
|
|
40
|
+
const createParams = {
|
|
41
|
+
approvalProgram: deployment.approvalProgram,
|
|
42
|
+
clearStateProgram: deployment.clearStateProgram,
|
|
43
|
+
sender: require_transaction.getSenderAddress(deployment.from),
|
|
44
|
+
accountReferences: deployment.createArgs?.accounts?.map((a) => typeof a === "string" ? a : algosdk.default.encodeAddress(a.publicKey)),
|
|
45
|
+
appReferences: deployment.createArgs?.apps?.map((a) => BigInt(a)),
|
|
46
|
+
assetReferences: deployment.createArgs?.assets?.map((a) => BigInt(a)),
|
|
47
|
+
boxReferences: deployment.createArgs?.boxes?.map(require_legacy_bridge._getBoxReference)?.map((r) => ({
|
|
48
|
+
appId: BigInt(r.appIndex),
|
|
49
|
+
name: r.name
|
|
50
|
+
})),
|
|
51
|
+
lease: deployment.createArgs?.lease,
|
|
52
|
+
rekeyTo: deployment.createArgs?.rekeyTo ? require_transaction.getSenderAddress(deployment.createArgs?.rekeyTo) : void 0,
|
|
53
|
+
staticFee: deployment.fee,
|
|
54
|
+
maxFee: deployment.maxFee,
|
|
55
|
+
extraProgramPages: deployment.schema.extraPages,
|
|
56
|
+
onComplete: require_app$1.getAppOnCompleteAction(deployment.createOnCompleteAction),
|
|
57
|
+
schema: deployment.schema
|
|
58
|
+
};
|
|
59
|
+
const updateParams = {
|
|
60
|
+
approvalProgram: deployment.approvalProgram,
|
|
61
|
+
clearStateProgram: deployment.clearStateProgram,
|
|
62
|
+
sender: require_transaction.getSenderAddress(deployment.from),
|
|
63
|
+
accountReferences: deployment.updateArgs?.accounts?.map((a) => typeof a === "string" ? a : algosdk.default.encodeAddress(a.publicKey)),
|
|
64
|
+
appReferences: deployment.updateArgs?.apps?.map((a) => BigInt(a)),
|
|
65
|
+
assetReferences: deployment.updateArgs?.assets?.map((a) => BigInt(a)),
|
|
66
|
+
boxReferences: deployment.updateArgs?.boxes?.map(require_legacy_bridge._getBoxReference)?.map((r) => ({
|
|
67
|
+
appId: BigInt(r.appIndex),
|
|
68
|
+
name: r.name
|
|
69
|
+
})),
|
|
70
|
+
lease: deployment.updateArgs?.lease,
|
|
71
|
+
rekeyTo: deployment.updateArgs?.rekeyTo ? require_transaction.getSenderAddress(deployment.updateArgs?.rekeyTo) : void 0,
|
|
72
|
+
staticFee: deployment.fee,
|
|
73
|
+
maxFee: deployment.maxFee,
|
|
74
|
+
onComplete: algosdk.default.OnApplicationComplete.UpdateApplicationOC
|
|
75
|
+
};
|
|
76
|
+
const deleteParams = {
|
|
77
|
+
sender: require_transaction.getSenderAddress(deployment.from),
|
|
78
|
+
accountReferences: deployment.deleteArgs?.accounts?.map((a) => typeof a === "string" ? a : algosdk.default.encodeAddress(a.publicKey)),
|
|
79
|
+
appReferences: deployment.deleteArgs?.apps?.map((a) => BigInt(a)),
|
|
80
|
+
assetReferences: deployment.deleteArgs?.assets?.map((a) => BigInt(a)),
|
|
81
|
+
boxReferences: deployment.deleteArgs?.boxes?.map(require_legacy_bridge._getBoxReference)?.map((r) => ({
|
|
82
|
+
appId: BigInt(r.appIndex),
|
|
83
|
+
name: r.name
|
|
84
|
+
})),
|
|
85
|
+
lease: deployment.deleteArgs?.lease,
|
|
86
|
+
rekeyTo: deployment.deleteArgs?.rekeyTo ? require_transaction.getSenderAddress(deployment.deleteArgs?.rekeyTo) : void 0,
|
|
87
|
+
staticFee: deployment.fee,
|
|
88
|
+
maxFee: deployment.maxFee,
|
|
89
|
+
onComplete: algosdk.default.OnApplicationComplete.DeleteApplicationOC
|
|
90
|
+
};
|
|
91
|
+
const encoder = new TextEncoder();
|
|
92
|
+
const result = await deployer.deploy({
|
|
93
|
+
createParams: deployment.createArgs?.method ? {
|
|
94
|
+
...createParams,
|
|
95
|
+
method: "txnCount" in deployment.createArgs.method ? deployment.createArgs.method : new algosdk.default.ABIMethod(deployment.createArgs.method),
|
|
96
|
+
args: (await require_legacy_bridge._getAppArgsForABICall(deployment.createArgs, deployment.from)).methodArgs
|
|
97
|
+
} : {
|
|
98
|
+
...createParams,
|
|
99
|
+
args: "appArgs" in (deployment?.createArgs ?? {}) ? deployment.createArgs?.appArgs?.map((a) => typeof a === "string" ? encoder.encode(a) : a) : void 0
|
|
100
|
+
},
|
|
101
|
+
updateParams: deployment.updateArgs?.method ? {
|
|
102
|
+
...updateParams,
|
|
103
|
+
method: "txnCount" in deployment.updateArgs.method ? deployment.updateArgs.method : new algosdk.default.ABIMethod(deployment.updateArgs.method),
|
|
104
|
+
args: (await require_legacy_bridge._getAppArgsForABICall(deployment.updateArgs, deployment.from)).methodArgs
|
|
105
|
+
} : {
|
|
106
|
+
...updateParams,
|
|
107
|
+
args: "appArgs" in (deployment?.updateArgs ?? {}) ? deployment.updateArgs?.appArgs?.map((a) => typeof a === "string" ? encoder.encode(a) : a) : void 0
|
|
108
|
+
},
|
|
109
|
+
deleteParams: deployment.deleteArgs?.method ? {
|
|
110
|
+
...deleteParams,
|
|
111
|
+
method: "txnCount" in deployment.deleteArgs.method ? deployment.deleteArgs.method : new algosdk.default.ABIMethod(deployment.deleteArgs.method),
|
|
112
|
+
args: (await require_legacy_bridge._getAppArgsForABICall(deployment.deleteArgs, deployment.from)).methodArgs
|
|
113
|
+
} : {
|
|
114
|
+
...deleteParams,
|
|
115
|
+
args: "appArgs" in (deployment?.deleteArgs ?? {}) ? deployment.deleteArgs?.appArgs?.map((a) => typeof a === "string" ? encoder.encode(a) : a) : void 0
|
|
116
|
+
},
|
|
117
|
+
metadata: deployment.metadata,
|
|
118
|
+
deployTimeParams: deployment.deployTimeParams,
|
|
119
|
+
onSchemaBreak: deployment.onSchemaBreak,
|
|
120
|
+
onUpdate: deployment.onUpdate,
|
|
121
|
+
existingDeployments: deployment.existingDeployments ? {
|
|
122
|
+
creator: algosdk.Address.fromString(deployment.existingDeployments.creator),
|
|
123
|
+
apps: Object.fromEntries(Object.entries(deployment.existingDeployments.apps).map(([name, app]) => [name, {
|
|
124
|
+
...app,
|
|
125
|
+
appAddress: algosdk.Address.fromString(app.appAddress),
|
|
126
|
+
appId: BigInt(app.appId),
|
|
127
|
+
createdRound: BigInt(app.createdRound),
|
|
128
|
+
updatedRound: BigInt(app.updatedRound)
|
|
129
|
+
}]))
|
|
130
|
+
} : void 0,
|
|
131
|
+
maxRoundsToWaitForConfirmation: deployment.maxRoundsToWaitForConfirmation,
|
|
132
|
+
populateAppCallResources: deployment.populateAppCallResources,
|
|
133
|
+
suppressLog: deployment.suppressLog
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
...result,
|
|
137
|
+
appAddress: result.appAddress.toString(),
|
|
138
|
+
appId: Number(result.appId),
|
|
139
|
+
createdRound: Number(result.createdRound),
|
|
140
|
+
updatedRound: Number(result.updatedRound)
|
|
141
|
+
};
|
|
156
142
|
}
|
|
157
143
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
144
|
+
* @deprecated Use `before.numByteSlice < after.numByteSlice || before.numUint < after.numUint` instead.
|
|
145
|
+
*
|
|
146
|
+
* Returns true is there is a breaking change in the application state schema from before to after.
|
|
147
|
+
* i.e. if the schema becomes larger, since applications can't ask for more schema after creation.
|
|
148
|
+
* Otherwise, there is no error, the app just doesn't store data in the extra schema :(
|
|
149
|
+
*
|
|
150
|
+
* @param before The existing schema
|
|
151
|
+
* @param after The new schema
|
|
152
|
+
* @returns Whether or not there is a breaking change
|
|
153
|
+
*/
|
|
168
154
|
function isSchemaIsBroken(before, after) {
|
|
169
|
-
|
|
155
|
+
return before.numByteSlice < after.numByteSlice || before.numUint < after.numUint;
|
|
170
156
|
}
|
|
171
157
|
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
158
|
+
* @deprecated Use `algorand.appDeployer.getCreatorAppsByName` instead.
|
|
159
|
+
*
|
|
160
|
+
* 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.
|
|
161
|
+
*
|
|
162
|
+
* **Note:** It's recommended this is only called once and then stored since it's a somewhat expensive operation (multiple indexer calls).
|
|
163
|
+
*
|
|
164
|
+
* @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
|
|
165
|
+
* @param indexer An indexer client
|
|
166
|
+
* @returns A name-based lookup of the app information (id, address)
|
|
167
|
+
*/
|
|
182
168
|
async function getCreatorAppsByName(creatorAccount, indexer) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
},
|
|
195
|
-
])),
|
|
196
|
-
};
|
|
169
|
+
const lookup = await new require_app_deployer.AppDeployer(void 0, void 0, indexer).getCreatorAppsByName(require_transaction.getSenderAddress(creatorAccount));
|
|
170
|
+
return {
|
|
171
|
+
creator: lookup.creator.toString(),
|
|
172
|
+
apps: Object.fromEntries(Object.entries(lookup.apps).map(([name, app]) => [name, {
|
|
173
|
+
...app,
|
|
174
|
+
appAddress: app.appAddress.toString(),
|
|
175
|
+
appId: Number(app.appId),
|
|
176
|
+
createdRound: Number(app.createdRound),
|
|
177
|
+
updatedRound: Number(app.updatedRound)
|
|
178
|
+
}]))
|
|
179
|
+
};
|
|
197
180
|
}
|
|
198
181
|
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
182
|
+
* @deprecated Use `{ dAppName: APP_DEPLOY_NOTE_DAPP, data: metadata, format: 'j' }` instead.
|
|
183
|
+
*
|
|
184
|
+
* Return the transaction note for an app deployment.
|
|
185
|
+
* @param metadata The metadata of the deployment
|
|
186
|
+
* @returns The transaction note as a utf-8 string
|
|
187
|
+
*/
|
|
205
188
|
function getAppDeploymentTransactionNote(metadata) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
189
|
+
return {
|
|
190
|
+
dAppName: require_app.APP_DEPLOY_NOTE_DAPP,
|
|
191
|
+
data: metadata,
|
|
192
|
+
format: "j"
|
|
193
|
+
};
|
|
211
194
|
}
|
|
212
195
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
196
|
+
* @deprecated Use `AppManager.replaceTealTemplateDeployTimeControlParams` instead
|
|
197
|
+
*
|
|
198
|
+
* Replaces deploy-time deployment control parameters within the given teal code.
|
|
199
|
+
*
|
|
200
|
+
* * `TMPL_UPDATABLE` for updatability / immutability control
|
|
201
|
+
* * `TMPL_DELETABLE` for deletability / permanence control
|
|
202
|
+
*
|
|
203
|
+
* Note: If these values are not undefined, but the corresponding `TMPL_*` value
|
|
204
|
+
* isn't in the teal code it will throw an exception.
|
|
205
|
+
*
|
|
206
|
+
* @param tealCode The TEAL code to substitute
|
|
207
|
+
* @param params The deploy-time deployment control parameter value to replace
|
|
208
|
+
* @returns The replaced TEAL code
|
|
209
|
+
*/
|
|
227
210
|
function replaceDeployTimeControlParams(tealCode, params) {
|
|
228
|
-
|
|
211
|
+
return require_app_manager.AppManager.replaceTealTemplateDeployTimeControlParams(tealCode, params);
|
|
229
212
|
}
|
|
230
213
|
/**
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
214
|
+
* @deprecated Use `AppManager.replaceTealTemplateParams` instead
|
|
215
|
+
*
|
|
216
|
+
* Performs template substitution of a teal file.
|
|
217
|
+
*
|
|
218
|
+
* Looks for `TMPL_{parameter}` for template replacements.
|
|
219
|
+
*
|
|
220
|
+
* @param tealCode The TEAL logic to compile
|
|
221
|
+
* @param templateParams Any parameters to replace in the .teal file before compiling
|
|
222
|
+
* @returns The TEAL code with replacements
|
|
223
|
+
*/
|
|
241
224
|
function performTemplateSubstitution(tealCode, templateParams) {
|
|
242
|
-
|
|
225
|
+
return require_app_manager.AppManager.replaceTealTemplateParams(tealCode, templateParams);
|
|
243
226
|
}
|
|
244
227
|
/**
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
228
|
+
* @deprecated Use `algorand.appManager.compileTealTemplate` instead.
|
|
229
|
+
*
|
|
230
|
+
* Performs template substitution of a teal file and compiles it, returning the compiled result.
|
|
231
|
+
*
|
|
232
|
+
* Looks for `TMPL_{parameter}` for template replacements.
|
|
233
|
+
*
|
|
234
|
+
* @param tealCode The TEAL logic to compile
|
|
235
|
+
* @param algod An algod client
|
|
236
|
+
* @param templateParams Any parameters to replace in the .teal file before compiling
|
|
237
|
+
* @param deploymentMetadata The deployment metadata the app will be deployed with
|
|
238
|
+
* @returns The information about the compiled code
|
|
239
|
+
*/
|
|
257
240
|
async function performTemplateSubstitutionAndCompile(tealCode, algod, templateParams, deploymentMetadata) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
return await app.compileTeal(tealCode, algod);
|
|
241
|
+
tealCode = stripTealComments(tealCode);
|
|
242
|
+
tealCode = performTemplateSubstitution(tealCode, templateParams);
|
|
243
|
+
if (deploymentMetadata) tealCode = replaceDeployTimeControlParams(tealCode, deploymentMetadata);
|
|
244
|
+
return await require_app$1.compileTeal(tealCode, algod);
|
|
264
245
|
}
|
|
265
246
|
/**
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
247
|
+
* @deprecated Use `AppManager.stripTealComments` instead.
|
|
248
|
+
*
|
|
249
|
+
* Remove comments from TEAL Code
|
|
250
|
+
*
|
|
251
|
+
* @param tealCode The TEAL logic to compile
|
|
252
|
+
* @returns The TEAL without comments
|
|
253
|
+
*/
|
|
273
254
|
function stripTealComments(tealCode) {
|
|
274
|
-
|
|
255
|
+
return require_app_manager.AppManager.stripTealComments(tealCode);
|
|
275
256
|
}
|
|
276
|
-
|
|
257
|
+
//#endregion
|
|
277
258
|
exports.deployApp = deployApp;
|
|
278
259
|
exports.getAppDeploymentTransactionNote = getAppDeploymentTransactionNote;
|
|
279
260
|
exports.getCreatorAppsByName = getCreatorAppsByName;
|
|
@@ -282,4 +263,5 @@ exports.performTemplateSubstitution = performTemplateSubstitution;
|
|
|
282
263
|
exports.performTemplateSubstitutionAndCompile = performTemplateSubstitutionAndCompile;
|
|
283
264
|
exports.replaceDeployTimeControlParams = replaceDeployTimeControlParams;
|
|
284
265
|
exports.stripTealComments = stripTealComments;
|
|
285
|
-
|
|
266
|
+
|
|
267
|
+
//# sourceMappingURL=app-deploy.js.map
|