@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.js
CHANGED
|
@@ -1,332 +1,313 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var ABIMethod = algosdk.ABIMethod;
|
|
10
|
-
var OnApplicationComplete = algosdk.OnApplicationComplete;
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
2
|
+
const require_util = require("./util.js");
|
|
3
|
+
const require_transaction = require("./transaction/transaction.js");
|
|
4
|
+
const require_app_manager = require("./types/app-manager.js");
|
|
5
|
+
const require_legacy_bridge = require("./transaction/legacy-bridge.js");
|
|
6
|
+
let algosdk = require("algosdk");
|
|
7
|
+
algosdk = require_runtime.__toESM(algosdk);
|
|
8
|
+
//#region src/app.ts
|
|
9
|
+
var ABIMethod = algosdk.default.ABIMethod;
|
|
10
|
+
var OnApplicationComplete = algosdk.default.OnApplicationComplete;
|
|
11
11
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
* @deprecated Use `algorand.send.appCreate()` / `algorand.createTransaction.appCreate()` / `algorand.send.appCreateMethodCall()`
|
|
13
|
+
* / `algorand.createTransaction.appCreateMethodCall()` instead
|
|
14
|
+
*
|
|
15
|
+
* Creates a smart contract app, returns the details of the created app.
|
|
16
|
+
* @param create The parameters to create the app with
|
|
17
|
+
* @param algod An algod client
|
|
18
|
+
* @returns The details of the created app, or the transaction to create it if `skipSending` and the compilation result
|
|
19
|
+
*/
|
|
20
20
|
async function createApp(create, algod) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
...result,
|
|
45
|
-
appId: 'appId' in result ? Number(result.appId) : 0,
|
|
46
|
-
appAddress: 'appAddress' in result ? result.appAddress.toString() : '',
|
|
47
|
-
};
|
|
21
|
+
const onComplete = getAppOnCompleteAction(create.onCompleteAction);
|
|
22
|
+
if (onComplete === algosdk.default.OnApplicationComplete.ClearStateOC) throw new Error("Cannot create an app with on-complete action of ClearState");
|
|
23
|
+
const result = create.args?.method ? await require_legacy_bridge.legacySendAppTransactionBridge(algod, create.from, create.args, create, {
|
|
24
|
+
sender: require_transaction.getSenderAddress(create.from),
|
|
25
|
+
onComplete,
|
|
26
|
+
approvalProgram: create.approvalProgram,
|
|
27
|
+
clearStateProgram: create.clearStateProgram,
|
|
28
|
+
method: create.args.method instanceof ABIMethod ? create.args.method : new ABIMethod(create.args.method),
|
|
29
|
+
extraProgramPages: create.schema.extraPages,
|
|
30
|
+
schema: create.schema
|
|
31
|
+
}, (c) => c.appCreateMethodCall, (c) => c.appCreateMethodCall) : await require_legacy_bridge.legacySendAppTransactionBridge(algod, create.from, create.args, create, {
|
|
32
|
+
sender: require_transaction.getSenderAddress(create.from),
|
|
33
|
+
onComplete,
|
|
34
|
+
approvalProgram: create.approvalProgram,
|
|
35
|
+
clearStateProgram: create.clearStateProgram,
|
|
36
|
+
extraProgramPages: create.schema.extraPages,
|
|
37
|
+
schema: create.schema
|
|
38
|
+
}, (c) => c.appCreate, (c) => c.appCreate);
|
|
39
|
+
return {
|
|
40
|
+
...result,
|
|
41
|
+
appId: "appId" in result ? Number(result.appId) : 0,
|
|
42
|
+
appAddress: "appAddress" in result ? result.appAddress.toString() : ""
|
|
43
|
+
};
|
|
48
44
|
}
|
|
49
45
|
/**
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
* @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
|
|
47
|
+
* / `algorand.createTransaction.appUpdateMethodCall()` instead
|
|
48
|
+
*
|
|
49
|
+
* Updates a smart contract app.
|
|
50
|
+
* @param update The parameters to update the app with
|
|
51
|
+
* @param algod An algod client
|
|
52
|
+
* @returns The transaction send result and the compilation result
|
|
53
|
+
*/
|
|
58
54
|
async function updateApp(update, algod) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
clearStateProgram: update.clearStateProgram,
|
|
74
|
-
}, (c) => c.appUpdate, (c) => c.appUpdate);
|
|
55
|
+
return update.args?.method ? await require_legacy_bridge.legacySendAppTransactionBridge(algod, update.from, update.args, update, {
|
|
56
|
+
appId: BigInt(update.appId),
|
|
57
|
+
sender: require_transaction.getSenderAddress(update.from),
|
|
58
|
+
onComplete: algosdk.default.OnApplicationComplete.UpdateApplicationOC,
|
|
59
|
+
approvalProgram: update.approvalProgram,
|
|
60
|
+
clearStateProgram: update.clearStateProgram,
|
|
61
|
+
method: update.args.method instanceof ABIMethod ? update.args.method : new ABIMethod(update.args.method)
|
|
62
|
+
}, (c) => c.appUpdateMethodCall, (c) => c.appUpdateMethodCall) : await require_legacy_bridge.legacySendAppTransactionBridge(algod, update.from, update.args, update, {
|
|
63
|
+
appId: BigInt(update.appId),
|
|
64
|
+
sender: require_transaction.getSenderAddress(update.from),
|
|
65
|
+
onComplete: algosdk.default.OnApplicationComplete.UpdateApplicationOC,
|
|
66
|
+
approvalProgram: update.approvalProgram,
|
|
67
|
+
clearStateProgram: update.clearStateProgram
|
|
68
|
+
}, (c) => c.appUpdate, (c) => c.appUpdate);
|
|
75
69
|
}
|
|
76
70
|
/**
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
71
|
+
* @deprecated Use `algosdk.OnApplicationComplete` directly instead.
|
|
72
|
+
*
|
|
73
|
+
* Returns a `algosdk.OnApplicationComplete` for the given onCompleteAction.
|
|
74
|
+
*
|
|
75
|
+
* If given `undefined` will return `OnApplicationComplete.NoOpOC`.
|
|
76
|
+
*
|
|
77
|
+
* If given an `AppCallType` will convert the string enum to the correct underlying `algosdk.OnApplicationComplete`.
|
|
78
|
+
*
|
|
79
|
+
* @param onCompletionAction The on completion action
|
|
80
|
+
* @returns The `algosdk.OnApplicationComplete`
|
|
81
|
+
*/
|
|
88
82
|
function getAppOnCompleteAction(onCompletionAction) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
case OnApplicationComplete.UpdateApplicationOC:
|
|
105
|
-
return OnApplicationComplete.UpdateApplicationOC;
|
|
106
|
-
case 'delete_application':
|
|
107
|
-
case OnApplicationComplete.DeleteApplicationOC:
|
|
108
|
-
return OnApplicationComplete.DeleteApplicationOC;
|
|
109
|
-
}
|
|
83
|
+
switch (onCompletionAction) {
|
|
84
|
+
case void 0:
|
|
85
|
+
case "no_op":
|
|
86
|
+
case OnApplicationComplete.NoOpOC: return OnApplicationComplete.NoOpOC;
|
|
87
|
+
case "opt_in":
|
|
88
|
+
case OnApplicationComplete.OptInOC: return OnApplicationComplete.OptInOC;
|
|
89
|
+
case "close_out":
|
|
90
|
+
case OnApplicationComplete.CloseOutOC: return OnApplicationComplete.CloseOutOC;
|
|
91
|
+
case "clear_state":
|
|
92
|
+
case OnApplicationComplete.ClearStateOC: return OnApplicationComplete.ClearStateOC;
|
|
93
|
+
case "update_application":
|
|
94
|
+
case OnApplicationComplete.UpdateApplicationOC: return OnApplicationComplete.UpdateApplicationOC;
|
|
95
|
+
case "delete_application":
|
|
96
|
+
case OnApplicationComplete.DeleteApplicationOC: return OnApplicationComplete.DeleteApplicationOC;
|
|
97
|
+
}
|
|
110
98
|
}
|
|
111
99
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
100
|
+
* @deprecated Use `algorand.send.appUpdate()` / `algorand.createTransaction.appUpdate()` / `algorand.send.appUpdateMethodCall()`
|
|
101
|
+
* / `algorand.createTransaction.appUpdateMethodCall()` instead
|
|
102
|
+
*
|
|
103
|
+
* Issues a call to a given app.
|
|
104
|
+
* @param call The call details.
|
|
105
|
+
* @param algod An algod client
|
|
106
|
+
* @returns The result of the call
|
|
107
|
+
*/
|
|
120
108
|
async function callApp(call, algod) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method),
|
|
135
|
-
}, (c) => c.appCallMethodCall, (c) => c.appCallMethodCall)
|
|
136
|
-
: await legacyBridge.legacySendAppTransactionBridge(algod, call.from, call.args, call, {
|
|
137
|
-
appId: BigInt(call.appId),
|
|
138
|
-
sender: transaction.getSenderAddress(call.from),
|
|
139
|
-
onComplete,
|
|
140
|
-
}, (c) => c.appCall, (c) => c.appCall);
|
|
109
|
+
const onComplete = getAppOnCompleteAction(call.callType);
|
|
110
|
+
if (onComplete === algosdk.default.OnApplicationComplete.UpdateApplicationOC) throw new Error("Cannot execute an app call with on-complete action of Update");
|
|
111
|
+
if (call.args?.method && onComplete === algosdk.default.OnApplicationComplete.ClearStateOC) throw new Error("Cannot execute an ABI method call with on-complete action of ClearState");
|
|
112
|
+
return call.args?.method ? await require_legacy_bridge.legacySendAppTransactionBridge(algod, call.from, call.args, call, {
|
|
113
|
+
appId: BigInt(call.appId),
|
|
114
|
+
sender: require_transaction.getSenderAddress(call.from),
|
|
115
|
+
onComplete,
|
|
116
|
+
method: call.args.method instanceof ABIMethod ? call.args.method : new ABIMethod(call.args.method)
|
|
117
|
+
}, (c) => c.appCallMethodCall, (c) => c.appCallMethodCall) : await require_legacy_bridge.legacySendAppTransactionBridge(algod, call.from, call.args, call, {
|
|
118
|
+
appId: BigInt(call.appId),
|
|
119
|
+
sender: require_transaction.getSenderAddress(call.from),
|
|
120
|
+
onComplete
|
|
121
|
+
}, (c) => c.appCall, (c) => c.appCall);
|
|
141
122
|
}
|
|
142
123
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
124
|
+
* @deprecated Use `AppManager.getABIReturn` instead.
|
|
125
|
+
*
|
|
126
|
+
* Returns any ABI return values for the given app call arguments and transaction confirmation.
|
|
127
|
+
* @param args The arguments that were used for the call
|
|
128
|
+
* @param confirmation The transaction confirmation from algod
|
|
129
|
+
* @returns The return value for the method call
|
|
130
|
+
*/
|
|
150
131
|
function getABIReturn(args, confirmation) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const method = 'txnCount' in args.method ? args.method : new ABIMethod(args.method);
|
|
155
|
-
return types_appManager.AppManager.getABIReturn(confirmation, method);
|
|
132
|
+
if (!args || !args.method) return;
|
|
133
|
+
const method = "txnCount" in args.method ? args.method : new ABIMethod(args.method);
|
|
134
|
+
return require_app_manager.AppManager.getABIReturn(confirmation, method);
|
|
156
135
|
}
|
|
157
136
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
137
|
+
* @deprecated Use `algorand.app.getGlobalState` instead.
|
|
138
|
+
*
|
|
139
|
+
* Returns the current global state values for the given app ID
|
|
140
|
+
* @param appId The ID of the app return global state for
|
|
141
|
+
* @param algod An algod client instance
|
|
142
|
+
* @returns The current global state
|
|
143
|
+
*/
|
|
165
144
|
async function getAppGlobalState(appId, algod) {
|
|
166
|
-
|
|
145
|
+
return await new require_app_manager.AppManager(algod).getGlobalState(BigInt(appId));
|
|
167
146
|
}
|
|
168
147
|
/**
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
148
|
+
* @deprecated Use `algorand.app.getLocalState` instead.
|
|
149
|
+
*
|
|
150
|
+
* Returns the current global state values for the given app ID and account
|
|
151
|
+
* @param appId The ID of the app return global state for
|
|
152
|
+
* @param account Either the string address of an account or an account object for the account to get local state for the given app
|
|
153
|
+
* @param algod An algod client instance
|
|
154
|
+
* @returns The current local state for the given (app, account) combination
|
|
155
|
+
*/
|
|
177
156
|
async function getAppLocalState(appId, account, algod) {
|
|
178
|
-
|
|
157
|
+
return new require_app_manager.AppManager(algod).getLocalState(BigInt(appId), require_transaction.getSenderAddress(account));
|
|
179
158
|
}
|
|
180
159
|
/**
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
160
|
+
* @deprecated Use `algorand.app.getBoxNames` instead.
|
|
161
|
+
* Returns the names of the boxes for the given app.
|
|
162
|
+
* @param appId The ID of the app return box names for
|
|
163
|
+
* @param algod An algod client instance
|
|
164
|
+
* @returns The current box names
|
|
165
|
+
*/
|
|
187
166
|
async function getAppBoxNames(appId, algod) {
|
|
188
|
-
|
|
167
|
+
return new require_app_manager.AppManager(algod).getBoxNames(BigInt(appId));
|
|
189
168
|
}
|
|
190
169
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
170
|
+
* @deprecated Use `algorand.app.getBoxValue` instead.
|
|
171
|
+
* Returns the value of the given box name for the given app.
|
|
172
|
+
* @param appId The ID of the app return box names for
|
|
173
|
+
* @param boxName The name of the box to return either as a string, binary array or `BoxName`
|
|
174
|
+
* @param algod An algod client instance
|
|
175
|
+
* @returns The current box value as a byte array
|
|
176
|
+
*/
|
|
198
177
|
async function getAppBoxValue(appId, boxName, algod) {
|
|
199
|
-
|
|
178
|
+
return new require_app_manager.AppManager(algod).getBoxValue(BigInt(appId), typeof boxName !== "string" && "name" in boxName ? boxName.nameRaw : boxName);
|
|
200
179
|
}
|
|
201
180
|
/**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
181
|
+
* @deprecated Use `algorand.app.getBoxValues` instead.
|
|
182
|
+
* Returns the value of the given box names for the given app.
|
|
183
|
+
* @param appId The ID of the app return box names for
|
|
184
|
+
* @param boxNames The names of the boxes to return either as a string, binary array or `BoxName`
|
|
185
|
+
* @param algod An algod client instance
|
|
186
|
+
* @returns The current box values as a byte array in the same order as the passed in box names
|
|
187
|
+
*/
|
|
209
188
|
async function getAppBoxValues(appId, boxNames, algod) {
|
|
210
|
-
|
|
189
|
+
return new require_app_manager.AppManager(algod).getBoxValues(BigInt(appId), boxNames.map((b) => typeof b !== "string" && "name" in b ? b.nameRaw : b));
|
|
211
190
|
}
|
|
212
191
|
/**
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
192
|
+
* @deprecated Use `algorand.app.getBoxValueFromABIType` instead.
|
|
193
|
+
* Returns the value of the given box name for the given app decoded based on the given ABI type.
|
|
194
|
+
* @param request The parameters for the box value request
|
|
195
|
+
* @param algod An algod client instance
|
|
196
|
+
* @returns The current box value as an ABI value
|
|
197
|
+
*/
|
|
219
198
|
async function getAppBoxValueFromABIType(request, algod) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
199
|
+
return new require_app_manager.AppManager(algod).getBoxValueFromABIType({
|
|
200
|
+
appId: BigInt(request.appId),
|
|
201
|
+
boxName: typeof request.boxName !== "string" && "name" in request.boxName ? request.boxName.nameRaw : request.boxName,
|
|
202
|
+
type: request.type
|
|
203
|
+
});
|
|
225
204
|
}
|
|
226
205
|
/**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
206
|
+
* @deprecated Use `algorand.app.getBoxValuesFromABIType` instead.
|
|
207
|
+
* Returns the value of the given box names for the given app decoded based on the given ABI type.
|
|
208
|
+
* @param request The parameters for the box value request
|
|
209
|
+
* @param algod An algod client instance
|
|
210
|
+
* @returns The current box values as an ABI value in the same order as the passed in box names
|
|
211
|
+
*/
|
|
233
212
|
async function getAppBoxValuesFromABIType(request, algod) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
213
|
+
return new require_app_manager.AppManager(algod).getBoxValuesFromABIType({
|
|
214
|
+
appId: BigInt(request.appId),
|
|
215
|
+
boxNames: request.boxNames.map((b) => typeof b !== "string" && "name" in b ? b.nameRaw : b),
|
|
216
|
+
type: request.type
|
|
217
|
+
});
|
|
239
218
|
}
|
|
240
219
|
/**
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
220
|
+
* @deprecated Use `AppManager.decodeAppState` instead.
|
|
221
|
+
*
|
|
222
|
+
* Converts an array of global/local state values from the algod api to a more friendly
|
|
223
|
+
* generic object keyed by the UTF-8 value of the key.
|
|
224
|
+
* @param state A `global-state`, `local-state`, `global-state-deltas` or `local-state-deltas`
|
|
225
|
+
* @returns An object keyeed by the UTF-8 representation of the key with various parsings of the values
|
|
226
|
+
*/
|
|
248
227
|
function decodeAppState(state) {
|
|
249
|
-
|
|
228
|
+
return require_app_manager.AppManager.decodeAppState(state.map(({ key, value }) => ({
|
|
229
|
+
key: Buffer.from(key, "utf-8"),
|
|
230
|
+
value
|
|
231
|
+
})));
|
|
250
232
|
}
|
|
251
233
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
234
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
235
|
+
*
|
|
236
|
+
* Returns the app args ready to load onto an app `Transaction` object
|
|
237
|
+
* @param args The app call args
|
|
238
|
+
* @returns The args ready to load into a `Transaction`
|
|
239
|
+
*/
|
|
258
240
|
function getAppArgsForTransaction(args) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
};
|
|
241
|
+
if (!args) return void 0;
|
|
242
|
+
const encoder = new TextEncoder();
|
|
243
|
+
return {
|
|
244
|
+
accounts: args?.accounts?.map(_getAccountAddress),
|
|
245
|
+
appArgs: args?.appArgs?.map((a) => typeof a === "string" ? encoder.encode(a) : a),
|
|
246
|
+
boxes: args.boxes?.map(getBoxReference),
|
|
247
|
+
foreignApps: args?.apps,
|
|
248
|
+
foreignAssets: args?.assets,
|
|
249
|
+
lease: require_transaction.encodeLease(args?.lease)
|
|
250
|
+
};
|
|
270
251
|
}
|
|
271
252
|
/**
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
253
|
+
* @deprecated Use `TransactionComposer` methods to construct transactions instead.
|
|
254
|
+
*
|
|
255
|
+
* Returns the app args ready to load onto an ABI method call in `AtomicTransactionComposer`
|
|
256
|
+
* @param args The ABI app call args
|
|
257
|
+
* @param from The transaction signer
|
|
258
|
+
* @returns The parameters ready to pass into `addMethodCall` within AtomicTransactionComposer
|
|
259
|
+
*/
|
|
279
260
|
async function getAppArgsForABICall(args, from) {
|
|
280
|
-
|
|
261
|
+
return require_legacy_bridge._getAppArgsForABICall(args, from);
|
|
281
262
|
}
|
|
282
263
|
/**
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
264
|
+
* @deprecated Use `AppManager.getBoxReference()` instead.
|
|
265
|
+
*
|
|
266
|
+
* Returns a `algosdk.BoxReference` given a `BoxIdentifier` or `BoxReference`.
|
|
267
|
+
* @param box The box to return a reference for
|
|
268
|
+
* @returns The box reference ready to pass into a `Transaction`
|
|
269
|
+
*/
|
|
289
270
|
function getBoxReference(box) {
|
|
290
|
-
|
|
271
|
+
return require_legacy_bridge._getBoxReference(box);
|
|
291
272
|
}
|
|
292
273
|
function _getAccountAddress(account) {
|
|
293
|
-
|
|
274
|
+
return typeof account === "string" ? account : algosdk.default.encodeAddress(account.publicKey);
|
|
294
275
|
}
|
|
295
276
|
/**
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
277
|
+
* @deprecated Use `algorand.app.getById` instead.
|
|
278
|
+
*
|
|
279
|
+
* Gets the current data for the given app from algod.
|
|
280
|
+
*
|
|
281
|
+
* @param appId The id of the app
|
|
282
|
+
* @param algod An algod client
|
|
283
|
+
* @returns The data about the app
|
|
284
|
+
*/
|
|
304
285
|
async function getAppById(appId, algod) {
|
|
305
|
-
|
|
286
|
+
return await algod.getApplicationByID(require_util.toNumber(appId)).do();
|
|
306
287
|
}
|
|
307
288
|
/**
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
289
|
+
* @deprecated Use `algorand.app.compileTeal` instead.
|
|
290
|
+
*
|
|
291
|
+
* Compiles the given TEAL using algod and returns the result, including source map.
|
|
292
|
+
*
|
|
293
|
+
* @param algod An algod client
|
|
294
|
+
* @param tealCode The TEAL code
|
|
295
|
+
* @returns The information about the compiled file
|
|
296
|
+
*/
|
|
316
297
|
async function compileTeal(tealCode, algod) {
|
|
317
|
-
|
|
298
|
+
return await new require_app_manager.AppManager(algod).compileTeal(tealCode);
|
|
318
299
|
}
|
|
319
300
|
/**
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
301
|
+
* @deprecated Use `abiMethod.getSignature()` or `new ABIMethod(abiMethodParams).getSignature()` instead.
|
|
302
|
+
*
|
|
303
|
+
* Returns the encoded ABI spec for a given ABI Method
|
|
304
|
+
* @param method The method to return a signature for
|
|
305
|
+
* @returns The encoded ABI method spec e.g. `method_name(uint64,string)string`
|
|
306
|
+
*/
|
|
326
307
|
const getABIMethodSignature = (method) => {
|
|
327
|
-
|
|
308
|
+
return "getSignature" in method ? method.getSignature() : new ABIMethod(method).getSignature();
|
|
328
309
|
};
|
|
329
|
-
|
|
310
|
+
//#endregion
|
|
330
311
|
exports.callApp = callApp;
|
|
331
312
|
exports.compileTeal = compileTeal;
|
|
332
313
|
exports.createApp = createApp;
|
|
@@ -346,4 +327,5 @@ exports.getAppLocalState = getAppLocalState;
|
|
|
346
327
|
exports.getAppOnCompleteAction = getAppOnCompleteAction;
|
|
347
328
|
exports.getBoxReference = getBoxReference;
|
|
348
329
|
exports.updateApp = updateApp;
|
|
349
|
-
|
|
330
|
+
|
|
331
|
+
//# sourceMappingURL=app.js.map
|