@algorandfoundation/algokit-utils 1.0.0-beta.9 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/account.d.ts +41 -36
- package/account.d.ts.map +1 -1
- package/account.js +59 -44
- package/account.js.map +1 -1
- package/amount.d.ts +20 -0
- package/amount.d.ts.map +1 -0
- package/amount.js +36 -0
- package/amount.js.map +1 -0
- package/app-client.d.ts +14 -0
- package/app-client.d.ts.map +1 -0
- package/app-client.js +19 -0
- package/app-client.js.map +1 -0
- package/app-deploy.d.ts +95 -0
- package/app-deploy.d.ts.map +1 -0
- package/{deploy-app.js → app-deploy.js} +129 -119
- package/app-deploy.js.map +1 -0
- package/app.d.ts +112 -148
- package/app.d.ts.map +1 -1
- package/app.js +460 -143
- package/app.js.map +1 -1
- package/index.d.ts +6 -4
- package/index.d.ts.map +1 -1
- package/index.js +7 -4
- package/index.js.map +1 -1
- package/indexer-lookup.d.ts +11 -4
- package/indexer-lookup.d.ts.map +1 -1
- package/indexer-lookup.js +19 -9
- package/indexer-lookup.js.map +1 -1
- package/localnet.d.ts +10 -10
- package/localnet.d.ts.map +1 -1
- package/localnet.js +16 -16
- package/localnet.js.map +1 -1
- package/network-client.d.ts +15 -24
- package/network-client.d.ts.map +1 -1
- package/network-client.js +16 -16
- package/network-client.js.map +1 -1
- package/package.json +2 -2
- package/testing/account.d.ts +14 -0
- package/testing/account.d.ts.map +1 -0
- package/testing/account.js +31 -0
- package/testing/account.js.map +1 -0
- package/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
- package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
- package/testing/fixtures/algokit-log-capture-fixture.js +43 -0
- package/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
- package/testing/fixtures/algorand-fixture.d.ts +24 -0
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
- package/testing/fixtures/algorand-fixture.js +60 -0
- package/testing/fixtures/algorand-fixture.js.map +1 -0
- package/testing/fixtures/index.d.ts +3 -0
- package/testing/fixtures/index.d.ts.map +1 -0
- package/testing/fixtures/index.js +19 -0
- package/testing/fixtures/index.js.map +1 -0
- package/testing/index.d.ts +6 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/index.js +22 -0
- package/testing/index.js.map +1 -0
- package/testing/indexer.d.ts +12 -0
- package/testing/indexer.d.ts.map +1 -0
- package/testing/indexer.js +40 -0
- package/testing/indexer.js.map +1 -0
- package/testing/test-logger.d.ts +41 -0
- package/testing/test-logger.d.ts.map +1 -0
- package/testing/test-logger.js +71 -0
- package/testing/test-logger.js.map +1 -0
- package/testing/transaction-logger.d.ts +29 -0
- package/testing/transaction-logger.d.ts.map +1 -0
- package/testing/transaction-logger.js +71 -0
- package/testing/transaction-logger.js.map +1 -0
- package/transaction.d.ts +55 -91
- package/transaction.d.ts.map +1 -1
- package/transaction.js +213 -155
- package/transaction.js.map +1 -1
- package/transfer.d.ts +14 -16
- package/transfer.d.ts.map +1 -1
- package/transfer.js +38 -4
- package/transfer.js.map +1 -1
- package/types/account.d.ts +55 -0
- package/types/account.d.ts.map +1 -0
- package/types/account.js +91 -0
- package/types/account.js.map +1 -0
- package/types/algo-http-client-with-retry.d.ts.map +1 -0
- package/{algo-http-client-with-retry.js → types/algo-http-client-with-retry.js} +3 -3
- package/types/algo-http-client-with-retry.js.map +1 -0
- package/types/algod.d.ts +28 -15
- package/types/algod.d.ts.map +1 -1
- package/{algo-amount.d.ts → types/amount.d.ts} +9 -3
- package/types/amount.d.ts.map +1 -0
- package/{algo-amount.js → types/amount.js} +13 -3
- package/types/amount.js.map +1 -0
- package/types/app-client.d.ts +282 -0
- package/types/app-client.d.ts.map +1 -0
- package/types/app-client.js +529 -0
- package/types/app-client.js.map +1 -0
- package/types/app-spec.d.ts +141 -0
- package/types/app-spec.d.ts.map +1 -0
- package/types/{appspec.js → app-spec.js} +5 -7
- package/types/app-spec.js.map +1 -0
- package/types/app.d.ts +285 -0
- package/types/app.d.ts.map +1 -0
- package/types/app.js +32 -0
- package/types/app.js.map +1 -0
- package/types/config.d.ts +32 -0
- package/types/config.d.ts.map +1 -0
- package/types/config.js +53 -0
- package/types/config.js.map +1 -0
- package/types/indexer.d.ts +368 -58
- package/types/indexer.d.ts.map +1 -1
- package/types/indexer.js +9 -0
- package/types/indexer.js.map +1 -1
- package/{config.d.ts → types/logging.d.ts} +2 -16
- package/types/logging.d.ts.map +1 -0
- package/{config.js → types/logging.js} +5 -24
- package/types/logging.js.map +1 -0
- package/types/logic-error.d.ts +37 -0
- package/types/logic-error.d.ts.map +1 -0
- package/types/logic-error.js +50 -0
- package/types/logic-error.js.map +1 -0
- package/types/network-client.d.ts +11 -0
- package/types/network-client.d.ts.map +1 -0
- package/types/network-client.js +3 -0
- package/types/network-client.js.map +1 -0
- package/types/testing.d.ts +89 -0
- package/types/testing.d.ts.map +1 -0
- package/types/testing.js +3 -0
- package/types/testing.js.map +1 -0
- package/types/transaction.d.ts +112 -0
- package/types/transaction.d.ts.map +1 -0
- package/types/transaction.js +3 -0
- package/types/transaction.js.map +1 -0
- package/types/transfer.d.ts +32 -0
- package/types/transfer.d.ts.map +1 -0
- package/types/transfer.js +3 -0
- package/types/transfer.js.map +1 -0
- package/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
- package/types/urlTokenBaseHTTPClient.js.map +1 -0
- package/algo-amount.d.ts.map +0 -1
- package/algo-amount.js.map +0 -1
- package/algo-http-client-with-retry.d.ts.map +0 -1
- package/algo-http-client-with-retry.js.map +0 -1
- package/application-client.d.ts +0 -113
- package/application-client.d.ts.map +0 -1
- package/application-client.js +0 -258
- package/application-client.js.map +0 -1
- package/config.d.ts.map +0 -1
- package/config.js.map +0 -1
- package/deploy-app.d.ts +0 -164
- package/deploy-app.d.ts.map +0 -1
- package/deploy-app.js.map +0 -1
- package/types/appspec.d.ts +0 -78
- package/types/appspec.d.ts.map +0 -1
- package/types/appspec.js.map +0 -1
- package/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/urlTokenBaseHTTPClient.js.map +0 -1
- /package/{algo-http-client-with-retry.d.ts → types/algo-http-client-with-retry.d.ts} +0 -0
- /package/{urlTokenBaseHTTPClient.d.ts → types/urlTokenBaseHTTPClient.d.ts} +0 -0
- /package/{urlTokenBaseHTTPClient.js → types/urlTokenBaseHTTPClient.js} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import algosdk, { Account, MultisigMetadata, Transaction, TransactionSigner } from 'algosdk';
|
|
2
|
+
/**
|
|
3
|
+
* The account name identifier used for fund dispensing in test environments
|
|
4
|
+
*/
|
|
5
|
+
export declare const DISPENSER_ACCOUNT = "DISPENSER";
|
|
6
|
+
/** Account wrapper that supports partial or full multisig signing. */
|
|
7
|
+
export declare class MultisigAccount {
|
|
8
|
+
_params: algosdk.MultisigMetadata;
|
|
9
|
+
_signingAccounts: (algosdk.Account | SigningAccount)[];
|
|
10
|
+
_addr: string;
|
|
11
|
+
_signer: TransactionSigner;
|
|
12
|
+
/** The parameters for the multisig account */
|
|
13
|
+
get params(): Readonly<algosdk.MultisigMetadata>;
|
|
14
|
+
/** The list of accounts that are present to sign */
|
|
15
|
+
get signingAccounts(): Readonly<(algosdk.Account | SigningAccount)[]>;
|
|
16
|
+
/** The address of the multisig account */
|
|
17
|
+
get addr(): Readonly<string>;
|
|
18
|
+
get signer(): TransactionSigner;
|
|
19
|
+
constructor(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]);
|
|
20
|
+
/**
|
|
21
|
+
* Sign the given transaction
|
|
22
|
+
* @param transaction Either a transaction object or a raw, partially signed transaction
|
|
23
|
+
* @returns The transaction signed by the present signers
|
|
24
|
+
*/
|
|
25
|
+
sign(transaction: Transaction | Uint8Array): Uint8Array;
|
|
26
|
+
}
|
|
27
|
+
/** Account wrapper that supports a rekeyed account */
|
|
28
|
+
export declare class SigningAccount implements Account {
|
|
29
|
+
private _account;
|
|
30
|
+
private _signer;
|
|
31
|
+
private _sender;
|
|
32
|
+
/**
|
|
33
|
+
* Algorand address of the sender
|
|
34
|
+
*/
|
|
35
|
+
get addr(): Readonly<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Secret key belonging to the signer
|
|
38
|
+
*/
|
|
39
|
+
get sk(): Readonly<Uint8Array>;
|
|
40
|
+
/**
|
|
41
|
+
* Transaction signer for the underlying signing account
|
|
42
|
+
*/
|
|
43
|
+
get signer(): TransactionSigner;
|
|
44
|
+
/**
|
|
45
|
+
* Algorand account of the sender address and signer private key
|
|
46
|
+
*/
|
|
47
|
+
get sender(): Account;
|
|
48
|
+
constructor(account: Account, sender: string | undefined);
|
|
49
|
+
}
|
|
50
|
+
/** A wrapper around `TransactionSigner` that also has the sender address. */
|
|
51
|
+
export interface TransactionSignerAccount {
|
|
52
|
+
addr: Readonly<string>;
|
|
53
|
+
signer: TransactionSigner;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/types/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE5F;;GAEG;AACH,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAE5C,sEAAsE;AACtE,qBAAa,eAAe;IAC1B,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAA;IACjC,gBAAgB,EAAE,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,CAAA;IACtD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,iBAAiB,CAAA;IAE1B,8CAA8C;IAC9C,IAAI,MAAM,IAAI,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAE/C;IAED,oDAAoD;IACpD,IAAI,eAAe,IAAI,QAAQ,CAAC,CAAC,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,CAAC,CAEpE;IAED,0CAA0C;IAC1C,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE3B;IAED,IAAI,MAAM,IAAI,iBAAiB,CAE9B;gBAEW,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE;IAU3F;;;;OAIG;IACI,IAAI,CAAC,WAAW,EAAE,WAAW,GAAG,UAAU,GAAG,UAAU;CAY/D;AAED,sDAAsD;AACtD,qBAAa,cAAe,YAAW,OAAO;IAC5C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAmB;IAClC,OAAO,CAAC,OAAO,CAAQ;IAEvB;;OAEG;IACH,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,CAAC,CAE3B;IAED;;OAEG;IACH,IAAI,EAAE,IAAI,QAAQ,CAAC,UAAU,CAAC,CAE7B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,iBAAiB,CAE9B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAKpB;gBAEW,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS;CAKzD;AAED,6EAA6E;AAC7E,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAA;IACtB,MAAM,EAAE,iBAAiB,CAAA;CAC1B"}
|
package/types/account.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SigningAccount = exports.MultisigAccount = exports.DISPENSER_ACCOUNT = void 0;
|
|
7
|
+
const algosdk_1 = __importDefault(require("algosdk"));
|
|
8
|
+
/**
|
|
9
|
+
* The account name identifier used for fund dispensing in test environments
|
|
10
|
+
*/
|
|
11
|
+
exports.DISPENSER_ACCOUNT = 'DISPENSER';
|
|
12
|
+
/** Account wrapper that supports partial or full multisig signing. */
|
|
13
|
+
class MultisigAccount {
|
|
14
|
+
/** The parameters for the multisig account */
|
|
15
|
+
get params() {
|
|
16
|
+
return this._params;
|
|
17
|
+
}
|
|
18
|
+
/** The list of accounts that are present to sign */
|
|
19
|
+
get signingAccounts() {
|
|
20
|
+
return this._signingAccounts;
|
|
21
|
+
}
|
|
22
|
+
/** The address of the multisig account */
|
|
23
|
+
get addr() {
|
|
24
|
+
return this._addr;
|
|
25
|
+
}
|
|
26
|
+
get signer() {
|
|
27
|
+
return this._signer;
|
|
28
|
+
}
|
|
29
|
+
constructor(multisigParams, signingAccounts) {
|
|
30
|
+
this._params = multisigParams;
|
|
31
|
+
this._signingAccounts = signingAccounts;
|
|
32
|
+
this._addr = algosdk_1.default.multisigAddress(multisigParams);
|
|
33
|
+
this._signer = algosdk_1.default.makeMultiSigAccountTransactionSigner(multisigParams, signingAccounts.map((a) => a.sk));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Sign the given transaction
|
|
37
|
+
* @param transaction Either a transaction object or a raw, partially signed transaction
|
|
38
|
+
* @returns The transaction signed by the present signers
|
|
39
|
+
*/
|
|
40
|
+
sign(transaction) {
|
|
41
|
+
let signedTxn = 'from' in transaction ? undefined : transaction;
|
|
42
|
+
for (const signer of this._signingAccounts) {
|
|
43
|
+
if (signedTxn) {
|
|
44
|
+
signedTxn = algosdk_1.default.appendSignMultisigTransaction(signedTxn, this._params, signer.sk).blob;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
signedTxn = algosdk_1.default.signMultisigTransaction(transaction, this._params, signer.sk).blob;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
51
|
+
return signedTxn;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.MultisigAccount = MultisigAccount;
|
|
55
|
+
/** Account wrapper that supports a rekeyed account */
|
|
56
|
+
class SigningAccount {
|
|
57
|
+
/**
|
|
58
|
+
* Algorand address of the sender
|
|
59
|
+
*/
|
|
60
|
+
get addr() {
|
|
61
|
+
return this._sender;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Secret key belonging to the signer
|
|
65
|
+
*/
|
|
66
|
+
get sk() {
|
|
67
|
+
return this._account.sk;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Transaction signer for the underlying signing account
|
|
71
|
+
*/
|
|
72
|
+
get signer() {
|
|
73
|
+
return this._signer;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Algorand account of the sender address and signer private key
|
|
77
|
+
*/
|
|
78
|
+
get sender() {
|
|
79
|
+
return {
|
|
80
|
+
addr: this._sender,
|
|
81
|
+
sk: this._account.sk,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
constructor(account, sender) {
|
|
85
|
+
this._account = account;
|
|
86
|
+
this._sender = sender ?? account.addr;
|
|
87
|
+
this._signer = algosdk_1.default.makeBasicAccountTransactionSigner(account);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
exports.SigningAccount = SigningAccount;
|
|
91
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/types/account.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA4F;AAE5F;;GAEG;AACU,QAAA,iBAAiB,GAAG,WAAW,CAAA;AAE5C,sEAAsE;AACtE,MAAa,eAAe;IAM1B,8CAA8C;IAC9C,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,oDAAoD;IACpD,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAA;IAC9B,CAAC;IAED,0CAA0C;IAC1C,IAAI,IAAI;QAC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,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC1C,OAAO,CAAC,sBAAsB,CAAC;IAI5B,MAAM,CACV,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,UAAU,EAChB,KAAK,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EACrB,cAAc,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC1C,OAAO,CAAC,sBAAsB,CAAC;CAGnC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AlgoHttpClientWithRetry = void 0;
|
|
4
|
-
const
|
|
4
|
+
const __1 = require("../");
|
|
5
5
|
const urlTokenBaseHTTPClient_1 = require("./urlTokenBaseHTTPClient");
|
|
6
6
|
/** A HTTP Client that wraps the Algorand SDK HTTP Client with retries */
|
|
7
7
|
class AlgoHttpClientWithRetry extends urlTokenBaseHTTPClient_1.URLTokenBaseHTTPClient {
|
|
@@ -26,7 +26,7 @@ class AlgoHttpClientWithRetry extends urlTokenBaseHTTPClient_1.URLTokenBaseHTTPC
|
|
|
26
26
|
if (delayTimeMs > 0) {
|
|
27
27
|
await new Promise((r) => setTimeout(r, delayTimeMs));
|
|
28
28
|
}
|
|
29
|
-
|
|
29
|
+
__1.Config.logger.warn(`algosdk request failed ${numTries} times. Retrying in ${delayTimeMs}ms: ${err}`);
|
|
30
30
|
}
|
|
31
31
|
} while (!response && ++numTries <= AlgoHttpClientWithRetry.MAX_TRIES);
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
@@ -42,7 +42,6 @@ class AlgoHttpClientWithRetry extends urlTokenBaseHTTPClient_1.URLTokenBaseHTTPC
|
|
|
42
42
|
return await this.callWithRetry(() => super.delete(relativePath, data, query, requestHeaders));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
exports.AlgoHttpClientWithRetry = AlgoHttpClientWithRetry;
|
|
46
45
|
AlgoHttpClientWithRetry.MAX_TRIES = 5;
|
|
47
46
|
AlgoHttpClientWithRetry.MAX_BACKOFF_MS = 10000;
|
|
48
47
|
// These lists come from https://visionmedia.github.io/superagent/#retrying-requests
|
|
@@ -59,4 +58,5 @@ AlgoHttpClientWithRetry.RETRY_ERROR_CODES = [
|
|
|
59
58
|
'EAI_AGAIN',
|
|
60
59
|
'EPROTO', // We get this intermittently with AlgoNode API
|
|
61
60
|
];
|
|
61
|
+
exports.AlgoHttpClientWithRetry = AlgoHttpClientWithRetry;
|
|
62
62
|
//# sourceMappingURL=algo-http-client-with-retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"algo-http-client-with-retry.js","sourceRoot":"","sources":["../../src/types/algo-http-client-with-retry.ts"],"names":[],"mappings":";;;AACA,2BAA4B;AAC5B,qEAAiE;AAEjE,yEAAyE;AACzE,MAAa,uBAAwB,SAAQ,+CAAsB;IAmBzD,KAAK,CAAC,aAAa,CAAC,IAA2C;QACrE,IAAI,QAA4C,CAAA;QAChD,IAAI,QAAQ,GAAG,CAAC,CAAA;QAChB,GAAG;YACD,IAAI;gBACF,QAAQ,GAAG,MAAM,IAAI,EAAE,CAAA;gBACvB,8DAA8D;aAC/D;YAAC,OAAO,GAAQ,EAAE;gBACjB,IAAI,QAAQ,IAAI,uBAAuB,CAAC,SAAS,EAAE;oBACjD,MAAM,GAAG,CAAA;iBACV;gBACD,iDAAiD;gBACjD,IACE,CAAC,CAAC,uBAAuB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,uBAAuB,CAAC,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAClI;oBACA,MAAM,GAAG,CAAA;iBACV;gBACD,gEAAgE;gBAChE,MAAM,WAAW,GAAG,QAAQ,IAA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AE,cAAc,CAAC,CAAC,CAAA;IAChG,CAAC;;AAnEuB,iCAAS,GAAG,CAAC,CAAA;AACb,sCAAc,GAAG,KAAK,CAAA;AAE9C,oFAAoF;AACpF,mHAAmH;AAC3F,0CAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;AACxD,yCAAiB,GAAG;IAC1C,WAAW;IACX,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,OAAO;IACP,WAAW;IACX,aAAa;IACb,WAAW;IACX,QAAQ,EAAE,+CAA+C;CAC1D,CAAA;AAjBU,0DAAuB"}
|
package/types/algod.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EncodedSignedTransaction } from 'algosdk';
|
|
2
|
-
/** The response from the pending transaction API
|
|
2
|
+
/** The response from the pending transaction API https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2transactionspendingtxid */
|
|
3
3
|
export interface PendingTransactionResponse {
|
|
4
4
|
/**
|
|
5
|
-
* The application
|
|
5
|
+
* The application id if the transaction was found and it created an
|
|
6
6
|
* application.
|
|
7
7
|
*/
|
|
8
8
|
'application-index'?: number;
|
|
@@ -11,7 +11,7 @@ export interface PendingTransactionResponse {
|
|
|
11
11
|
*/
|
|
12
12
|
'asset-closing-amount'?: number;
|
|
13
13
|
/**
|
|
14
|
-
* The asset
|
|
14
|
+
* The asset id if the transaction was found and it created an asset.
|
|
15
15
|
*/
|
|
16
16
|
'asset-index'?: number;
|
|
17
17
|
/**
|
|
@@ -60,19 +60,33 @@ export interface PendingTransactionResponse {
|
|
|
60
60
|
*/
|
|
61
61
|
txn: EncodedSignedTransaction;
|
|
62
62
|
}
|
|
63
|
-
/** Represents a TEAL value delta
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
/** Represents a TEAL value delta https://developer.algorand.org/docs/rest-apis/algod/v2/#evaldelta */
|
|
64
|
+
export type EvalDelta = {
|
|
65
|
+
/**
|
|
66
|
+
* Value `1` refers to **bytes**, value `2` refers to **uint**
|
|
67
|
+
*/
|
|
68
|
+
action: 1;
|
|
69
|
+
/**
|
|
70
|
+
* Bytes value.
|
|
71
|
+
*/
|
|
66
72
|
bytes: string;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
73
|
+
} | {
|
|
74
|
+
/**
|
|
75
|
+
* Value `1` refers to **bytes**, value `2` refers to **uint**
|
|
76
|
+
*/
|
|
77
|
+
action: 2;
|
|
78
|
+
/**
|
|
79
|
+
* Uint value.
|
|
80
|
+
*/
|
|
81
|
+
uint: number | bigint;
|
|
82
|
+
};
|
|
83
|
+
/** The response from the application API https://developer.algorand.org/docs/rest-apis/algod/v2/#get-v2applicationsapplication-id */
|
|
70
84
|
export interface ApplicationResponse {
|
|
71
85
|
id: number;
|
|
72
86
|
params: ApplicationParams;
|
|
73
87
|
}
|
|
74
|
-
/** Stores the global information associated with an application
|
|
75
|
-
interface ApplicationParams {
|
|
88
|
+
/** Stores the global information associated with an application https://developer.algorand.org/docs/rest-apis/algod/v2/#applicationparams */
|
|
89
|
+
export interface ApplicationParams {
|
|
76
90
|
/** Address of the account that created the app */
|
|
77
91
|
creator: string;
|
|
78
92
|
/** Base64 encoded TEAL approval program */
|
|
@@ -92,9 +106,9 @@ interface ApplicationParams {
|
|
|
92
106
|
'local-state-schema'?: ApplicationStateSchema;
|
|
93
107
|
}
|
|
94
108
|
/**
|
|
95
|
-
* Represents a TEAL value
|
|
109
|
+
* Represents a TEAL value https://developer.algorand.org/docs/rest-apis/algod/v2/#tealvalue
|
|
96
110
|
*/
|
|
97
|
-
type TealValue = {
|
|
111
|
+
export type TealValue = {
|
|
98
112
|
/**
|
|
99
113
|
* (tt) value type. Value `1` refers to **bytes**, value `2` refers to **uint**
|
|
100
114
|
*/
|
|
@@ -113,12 +127,11 @@ type TealValue = {
|
|
|
113
127
|
*/
|
|
114
128
|
uint: number | bigint;
|
|
115
129
|
};
|
|
116
|
-
/** Specifies maximums on the number of each type that may be stored
|
|
130
|
+
/** Specifies maximums on the number of each type that may be stored https://developer.algorand.org/docs/rest-apis/algod/v2/#applicationstateschema */
|
|
117
131
|
export interface ApplicationStateSchema {
|
|
118
132
|
/** [nbs] num of byte slices */
|
|
119
133
|
'num-byte-slice': number;
|
|
120
134
|
/** [nui] num of uints */
|
|
121
135
|
'num-uint': number;
|
|
122
136
|
}
|
|
123
|
-
export {};
|
|
124
137
|
//# sourceMappingURL=algod.d.ts.map
|
package/types/algod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algod.d.ts","sourceRoot":"","sources":["../../src/types/algod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAElD
|
|
1
|
+
{"version":3,"file":"algod.d.ts","sourceRoot":"","sources":["../../src/types/algod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAElD,0IAA0I;AAC1I,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAA;IAClD;;OAEG;IACH,YAAY,CAAC,EAAE,0BAA0B,EAAE,CAAA;IAC3C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAA;IACjD;;OAEG;IACH,IAAI,CA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AEG;IACH,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;CACtB,CAAA;AAEL,sJAAsJ;AACtJ,MAAM,WAAW,sBAAsB;IACrC,+BAA+B;IAC/B,gBAAgB,EAAE,MAAM,CAAA;IACxB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAA;CACnB"}
|
|
@@ -10,9 +10,15 @@ export declare class AlgoAmount {
|
|
|
10
10
|
} | {
|
|
11
11
|
microAlgos: number;
|
|
12
12
|
});
|
|
13
|
-
|
|
13
|
+
toString(): string;
|
|
14
|
+
/** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,
|
|
15
|
+
* but it's not recommended to use this to convert to a number, it's much safer to explicitly call
|
|
16
|
+
* the algos or microAlgos properties
|
|
17
|
+
*/
|
|
18
|
+
valueOf(): number;
|
|
19
|
+
/** Create a `AlgoAmount` object representing the given number of Algos */
|
|
14
20
|
static Algos(amount: number): AlgoAmount;
|
|
15
|
-
/** Create a
|
|
21
|
+
/** Create a `AlgoAmount` object representing the given number of µAlgos */
|
|
16
22
|
static MicroAlgos(amount: number): AlgoAmount;
|
|
17
23
|
}
|
|
18
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=amount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,qBAAa,UAAU;IACrB,OAAO,CAAC,kBAAkB,CAAA;IAE1B,8CAA8C;IAC9C,IAAI,UAAU,WAEb;IAED,6CAA6C;IAC7C,IAAI,KAAK,WAER;gBAEW,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;IAI9D,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB,0EAA0E;IAC1E,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM;IAI3B,2EAA2E;IAC3E,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM;CAGjC"}
|
|
@@ -18,14 +18,24 @@ class AlgoAmount {
|
|
|
18
18
|
constructor(amount) {
|
|
19
19
|
this.amountInMicroAlgos = 'microAlgos' in amount ? amount.microAlgos : algosdk_1.default.algosToMicroalgos(amount.algos);
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
toString() {
|
|
22
|
+
return `${this.microAlgos.toLocaleString('en-US')} µALGO${this.microAlgos === 1 ? '' : 's'}`;
|
|
23
|
+
}
|
|
24
|
+
/** valueOf allows you to use `AlgoAmount` in comparison operations such as `<` and `>=` etc.,
|
|
25
|
+
* but it's not recommended to use this to convert to a number, it's much safer to explicitly call
|
|
26
|
+
* the algos or microAlgos properties
|
|
27
|
+
*/
|
|
28
|
+
valueOf() {
|
|
29
|
+
return this.microAlgos;
|
|
30
|
+
}
|
|
31
|
+
/** Create a `AlgoAmount` object representing the given number of Algos */
|
|
22
32
|
static Algos(amount) {
|
|
23
33
|
return new AlgoAmount({ algos: amount });
|
|
24
34
|
}
|
|
25
|
-
/** Create a
|
|
35
|
+
/** Create a `AlgoAmount` object representing the given number of µAlgos */
|
|
26
36
|
static MicroAlgos(amount) {
|
|
27
37
|
return new AlgoAmount({ microAlgos: amount });
|
|
28
38
|
}
|
|
29
39
|
}
|
|
30
40
|
exports.AlgoAmount = AlgoAmount;
|
|
31
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/types/amount.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAE7B,0FAA0F;AAC1F,MAAa,UAAU;IAGrB,8CAA8C;IAC9C,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAChC,CAAC;IAED,6CAA6C;IAC7C,IAAI,KAAK;QACP,OAAO,iBAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;IAC3D,CAAC;IAED,YAAY,MAAkD;QAC5D,IAAI,CAAC,kBAAkB,GAAG,YAAY,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,iBAAO,CAAC,iBAAiB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAChH,CAAC;IAED,QAAQ;QACN,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,IAAI,CAAC,UAAU,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAA;IAC9F,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,0EAA0E;IAC1E,MAAM,CAAC,KAAK,CAAC,MAAc;QACzB,OAAO,IAAI,UAAU,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IAC1C,CAAC;IAED,2EAA2E;IAC3E,MAAM,CAAC,UAAU,CAAC,MAAc;QAC9B,OAAO,IAAI,UAAU,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAA;IAC/C,CAAC;CACF;AAtCD,gCAsCC"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { ABIMethod, ABIMethodParams, ABIType, ABIValue, Algodv2, Indexer, SuggestedParams } from 'algosdk';
|
|
2
|
+
import { AlgoAmount } from './amount';
|
|
3
|
+
import { ABIAppCallArg, ABIAppCallArgs, AppCallArgs, AppLookup, AppMetadata, AppReference, AppState, BoxName, OnSchemaBreak, OnUpdate, RawAppCallArgs, TealTemplateParams } from './app';
|
|
4
|
+
import { AppSpec } from './app-spec';
|
|
5
|
+
import { SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction';
|
|
6
|
+
/** Configuration to resolve app by creator and name `getCreatorAppsByName` */
|
|
7
|
+
export type ResolveAppByCreatorAndName = {
|
|
8
|
+
/** The address of the app creator account to resolve the app by */
|
|
9
|
+
creatorAddress: string;
|
|
10
|
+
/** The optional name to resolve the app by within the creator account (default: uses the name in the ABI contract) */
|
|
11
|
+
name?: string;
|
|
12
|
+
} & ({
|
|
13
|
+
/** indexer An indexer instance to search the creator account apps */
|
|
14
|
+
indexer: Indexer;
|
|
15
|
+
} | {
|
|
16
|
+
/** Optional cached value of the existing apps for the given creator, `getCreatorAppsByName` */
|
|
17
|
+
existingDeployments: AppLookup;
|
|
18
|
+
});
|
|
19
|
+
/** Configuration to resolve app by ID */
|
|
20
|
+
export interface ResolveAppById {
|
|
21
|
+
/** The id of an existing app to call using this client, or 0 if the app hasn't been created yet */
|
|
22
|
+
id: number;
|
|
23
|
+
/** The optional name to use to mark the app when deploying `ApplicationClient.deploy` (default: uses the name in the ABI contract) */
|
|
24
|
+
name?: string;
|
|
25
|
+
}
|
|
26
|
+
/** The details of an ARC-0032 app spec specified app */
|
|
27
|
+
export type AppSpecAppDetails = {
|
|
28
|
+
/** The ARC-0032 application spec as either:
|
|
29
|
+
* * Parsed JSON `AppSpec`
|
|
30
|
+
* * Raw JSON string
|
|
31
|
+
*/
|
|
32
|
+
app: AppSpec | string;
|
|
33
|
+
/** Default sender to use for transactions issued by this application client */
|
|
34
|
+
sender?: SendTransactionFrom;
|
|
35
|
+
/** Default suggested params object to use */
|
|
36
|
+
params?: SuggestedParams;
|
|
37
|
+
} & (ResolveAppById | ResolveAppByCreatorAndName);
|
|
38
|
+
/** Parameters to pass into ApplicationClient.deploy */
|
|
39
|
+
export interface AppClientDeployParams {
|
|
40
|
+
/** The version of the contract, uses "1.0" by default */
|
|
41
|
+
version?: string;
|
|
42
|
+
/** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
|
|
43
|
+
sender?: SendTransactionFrom;
|
|
44
|
+
/** Parameters to control transaction sending */
|
|
45
|
+
sendParams?: Omit<SendTransactionParams, 'skipSending' | 'skipWaiting'>;
|
|
46
|
+
/** Any deploy-time parameters to replace in the TEAL code */
|
|
47
|
+
deployTimeParams?: TealTemplateParams;
|
|
48
|
+
/** Whether or not to allow updates in the contract using the deploy-time updatability control if present in your contract.
|
|
49
|
+
* If this is not specified then it will automatically be determined based on the AppSpec definition
|
|
50
|
+
**/
|
|
51
|
+
allowUpdate?: boolean;
|
|
52
|
+
/** Whether or not to allow deletes in the contract using the deploy-time deletability control if present in your contract.
|
|
53
|
+
* If this is not specified then it will automatically be determined based on the AppSpec definition
|
|
54
|
+
**/
|
|
55
|
+
allowDelete?: boolean;
|
|
56
|
+
/** What action to perform if a schema break is detected */
|
|
57
|
+
onSchemaBreak?: 'replace' | 'fail' | OnSchemaBreak;
|
|
58
|
+
/** What action to perform if a TEAL update is detected */
|
|
59
|
+
onUpdate?: 'update' | 'replace' | 'fail' | OnUpdate;
|
|
60
|
+
/** Any args to pass to any create transaction that is issued as part of deployment */
|
|
61
|
+
createArgs?: AppClientCallArgs;
|
|
62
|
+
/** Any args to pass to any update transaction that is issued as part of deployment */
|
|
63
|
+
updateArgs?: AppClientCallArgs;
|
|
64
|
+
/** Any args to pass to any delete transaction that is issued as part of deployment */
|
|
65
|
+
deleteArgs?: AppClientCallArgs;
|
|
66
|
+
}
|
|
67
|
+
/** The arguments to pass to an Application Client smart contract call */
|
|
68
|
+
export type AppClientCallArgs = {
|
|
69
|
+
/** Raw argument values to pass to the smart contract call */
|
|
70
|
+
args?: RawAppCallArgs;
|
|
71
|
+
} | {
|
|
72
|
+
/** If calling an ABI method then either the name of the method, or the ABI signature */
|
|
73
|
+
method: string;
|
|
74
|
+
/** Either the ABI arguments or an object with the ABI arguments and other parameters like boxes */
|
|
75
|
+
methodArgs: Omit<ABIAppCallArgs, 'method'> | ABIAppCallArg[];
|
|
76
|
+
};
|
|
77
|
+
/** Parameters to construct a ApplicationClient contract call */
|
|
78
|
+
export type AppClientCallParams = AppClientCallArgs & {
|
|
79
|
+
/** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
|
|
80
|
+
sender?: SendTransactionFrom;
|
|
81
|
+
/** The transaction note for the smart contract call */
|
|
82
|
+
note?: TransactionNote;
|
|
83
|
+
/** Parameters to control transaction sending */
|
|
84
|
+
sendParams?: SendTransactionParams;
|
|
85
|
+
};
|
|
86
|
+
export interface AppClientCompilationParams {
|
|
87
|
+
/** Any deploy-time parameters to replace in the TEAL code */
|
|
88
|
+
deployTimeParams?: TealTemplateParams;
|
|
89
|
+
updatable?: boolean;
|
|
90
|
+
deletable?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** Parameters for creating a contract using ApplicationClient */
|
|
93
|
+
export type AppClientCreateParams = AppClientCallParams & AppClientCompilationParams;
|
|
94
|
+
/** Parameters for updating a contract using ApplicationClient */
|
|
95
|
+
export type AppClientUpdateParams = AppClientCreateParams;
|
|
96
|
+
/** Parameters for funding an app account */
|
|
97
|
+
export interface FundAppAccountParams {
|
|
98
|
+
amount: AlgoAmount;
|
|
99
|
+
/** The optional sender to send the transaction from, will use the application client's default sender by default if specified */
|
|
100
|
+
sender?: SendTransactionFrom;
|
|
101
|
+
/** The transaction note for the smart contract call */
|
|
102
|
+
note?: TransactionNote;
|
|
103
|
+
/** Parameters to control transaction sending */
|
|
104
|
+
sendParams?: SendTransactionParams;
|
|
105
|
+
}
|
|
106
|
+
/** Source maps for an Algorand app */
|
|
107
|
+
export interface AppSourceMaps {
|
|
108
|
+
/** The source map of the approval program */
|
|
109
|
+
approvalSourceMap: SourceMapExport;
|
|
110
|
+
/** The source map of the clear program */
|
|
111
|
+
clearSourceMap: SourceMapExport;
|
|
112
|
+
}
|
|
113
|
+
export interface SourceMapExport {
|
|
114
|
+
version: number;
|
|
115
|
+
sources: string[];
|
|
116
|
+
names: string[];
|
|
117
|
+
mappings: string;
|
|
118
|
+
}
|
|
119
|
+
/** Application client - a class that wraps an ARC-0032 app spec and provides high productivity methods to deploy and call the app */
|
|
120
|
+
export declare class ApplicationClient {
|
|
121
|
+
private algod;
|
|
122
|
+
private indexer?;
|
|
123
|
+
private appSpec;
|
|
124
|
+
private sender;
|
|
125
|
+
private params;
|
|
126
|
+
private existingDeployments;
|
|
127
|
+
private _appId;
|
|
128
|
+
private _appAddress;
|
|
129
|
+
private _creator;
|
|
130
|
+
private _appName;
|
|
131
|
+
private _approvalSourceMap;
|
|
132
|
+
private _clearSourceMap;
|
|
133
|
+
/**
|
|
134
|
+
* Create a new ApplicationClient instance
|
|
135
|
+
* @param appDetails The details of the app
|
|
136
|
+
* @param algod An algod instance
|
|
137
|
+
* @param indexer An indexer instance
|
|
138
|
+
*/
|
|
139
|
+
constructor(appDetails: AppSpecAppDetails, algod: Algodv2);
|
|
140
|
+
/**
|
|
141
|
+
* Compiles the approval and clear programs and sets up the source map.
|
|
142
|
+
* @param compilation The deploy-time parameters for the compilation
|
|
143
|
+
* @returns The compiled approval and clear programs
|
|
144
|
+
*/
|
|
145
|
+
compile(compilation?: AppClientCompilationParams): Promise<{
|
|
146
|
+
approvalCompiled: import("./app").CompiledTeal;
|
|
147
|
+
clearCompiled: import("./app").CompiledTeal;
|
|
148
|
+
}>;
|
|
149
|
+
/**
|
|
150
|
+
* Export the current source maps for the app.
|
|
151
|
+
* @returns The source maps
|
|
152
|
+
*/
|
|
153
|
+
exportSourceMaps(): AppSourceMaps;
|
|
154
|
+
/**
|
|
155
|
+
* Import source maps for the app.
|
|
156
|
+
* @param sourceMaps The source maps to import
|
|
157
|
+
*/
|
|
158
|
+
importSourceMaps(sourceMaps: AppSourceMaps): void;
|
|
159
|
+
/**
|
|
160
|
+
* Idempotently deploy (create, update/delete if changed) an app against the given name via the given creator account, including deploy-time template placeholder substitutions.
|
|
161
|
+
*
|
|
162
|
+
* 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
|
|
163
|
+
*
|
|
164
|
+
* **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.
|
|
165
|
+
*
|
|
166
|
+
* **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.
|
|
167
|
+
* @param deploy Deployment details
|
|
168
|
+
* @returns The metadata and transaction result(s) of the deployment, or just the metadata if it didn't need to issue transactions
|
|
169
|
+
*/
|
|
170
|
+
deploy(deploy?: AppClientDeployParams): Promise<(Partial<import("./app").AppCompilationResult> & import("./transaction").ConfirmedTransactionResults & AppMetadata & {
|
|
171
|
+
return?: import("./app").ABIReturn | undefined;
|
|
172
|
+
operationPerformed: "update" | "create";
|
|
173
|
+
}) | (Partial<import("./app").AppCompilationResult> & import("./transaction").ConfirmedTransactionResults & AppMetadata & {
|
|
174
|
+
return?: import("./app").ABIReturn | undefined;
|
|
175
|
+
deleteReturn?: import("./app").ABIReturn | undefined;
|
|
176
|
+
deleteResult: import("./transaction").ConfirmedTransactionResult;
|
|
177
|
+
operationPerformed: "replace";
|
|
178
|
+
}) | (Partial<import("./app").AppCompilationResult> & AppMetadata & {
|
|
179
|
+
operationPerformed: "nothing";
|
|
180
|
+
})>;
|
|
181
|
+
create(create?: AppClientCreateParams): Promise<Partial<import("./app").AppCompilationResult> & import("./app").AppCallTransactionResult & AppReference>;
|
|
182
|
+
update(update?: AppClientUpdateParams): Promise<Partial<import("./app").AppCompilationResult> & import("./app").AppCallTransactionResult>;
|
|
183
|
+
call(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
184
|
+
optIn(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
185
|
+
closeOut(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
186
|
+
clearState(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
187
|
+
delete(call?: AppClientCallParams): Promise<import("./app").AppCallTransactionResult>;
|
|
188
|
+
private _call;
|
|
189
|
+
/**
|
|
190
|
+
* Funds ALGOs into the app account for this app.
|
|
191
|
+
* @param fund The parameters for the funding or the funding amount
|
|
192
|
+
* @returns The result of the funding
|
|
193
|
+
*/
|
|
194
|
+
fundAppAccount(fund: FundAppAccountParams | AlgoAmount): Promise<import("./transaction").SendTransactionResult>;
|
|
195
|
+
/**
|
|
196
|
+
* Returns global state for the current app.
|
|
197
|
+
* @returns The global state
|
|
198
|
+
*/
|
|
199
|
+
getGlobalState(): Promise<AppState>;
|
|
200
|
+
/**
|
|
201
|
+
* Returns local state for the given account / account address.
|
|
202
|
+
* @returns The global state
|
|
203
|
+
*/
|
|
204
|
+
getLocalState(account: string | SendTransactionFrom): Promise<AppState>;
|
|
205
|
+
/**
|
|
206
|
+
* Returns the names of all current boxes for the current app.
|
|
207
|
+
* @returns The names of the boxes
|
|
208
|
+
*/
|
|
209
|
+
getBoxNames(): Promise<BoxName[]>;
|
|
210
|
+
/**
|
|
211
|
+
* Returns the value of the given box for the current app.
|
|
212
|
+
* @param name The name of the box to return either as a string, binary array or `BoxName`
|
|
213
|
+
* @returns The current box value as a byte array
|
|
214
|
+
*/
|
|
215
|
+
getBoxValue(name: BoxName | string | Uint8Array): Promise<Uint8Array>;
|
|
216
|
+
/**
|
|
217
|
+
* Returns the value of the given box for the current app.
|
|
218
|
+
* @param name The name of the box to return either as a string, binary array or `BoxName`
|
|
219
|
+
* @returns The current box value as a byte array
|
|
220
|
+
*/
|
|
221
|
+
getBoxValueFromABIType(name: BoxName | string | Uint8Array, type: ABIType): Promise<ABIValue>;
|
|
222
|
+
/**
|
|
223
|
+
* Returns the values of all current boxes for the current app.
|
|
224
|
+
* Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
|
|
225
|
+
* @param filter Optional filter to filter which boxes' values are returned
|
|
226
|
+
* @returns The (name, value) pair of the boxes with values as raw byte arrays
|
|
227
|
+
*/
|
|
228
|
+
getBoxValues(filter?: (name: BoxName) => boolean): Promise<{
|
|
229
|
+
name: BoxName;
|
|
230
|
+
value: Uint8Array;
|
|
231
|
+
}[]>;
|
|
232
|
+
/**
|
|
233
|
+
* Returns the values of all current boxes for the current app decoded using an ABI Type.
|
|
234
|
+
* Note: This will issue multiple HTTP requests (one per box) and it's not an atomic operation so values may be out of sync.
|
|
235
|
+
* @param type The ABI type to decode the values with
|
|
236
|
+
* @param filter Optional filter to filter which boxes' values are returned
|
|
237
|
+
* @returns The (name, value) pair of the boxes with values as the ABI Value
|
|
238
|
+
*/
|
|
239
|
+
getBoxValuesFromABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
|
|
240
|
+
name: BoxName;
|
|
241
|
+
value: ABIValue;
|
|
242
|
+
}[]>;
|
|
243
|
+
/** @deprecated Use `getBoxValuesFromABIType` instead */
|
|
244
|
+
getBoxValuesAsABIType(type: ABIType, filter?: (name: BoxName) => boolean): Promise<{
|
|
245
|
+
name: BoxName;
|
|
246
|
+
value: ABIValue;
|
|
247
|
+
}[]>;
|
|
248
|
+
/**
|
|
249
|
+
* Returns the arguments for an app call for the given ABI method or raw method specification.
|
|
250
|
+
* @param args The call args specific to this application client
|
|
251
|
+
* @returns The call args ready to pass into an app call
|
|
252
|
+
*/
|
|
253
|
+
getCallArgs(args?: AppClientCallArgs): AppCallArgs | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* Returns the ABI Method parameters for the given method name string for the app represented by this application client instance
|
|
256
|
+
* @param method Either the name of the method or the ABI method spec definition string
|
|
257
|
+
* @returns The ABI method params for the given method
|
|
258
|
+
*/
|
|
259
|
+
getABIMethodParams(method: string): ABIMethodParams | undefined;
|
|
260
|
+
/**
|
|
261
|
+
* Returns the ABI Method for the given method name string for the app represented by this application client instance
|
|
262
|
+
* @param method Either the name of the method or the ABI method spec definition string
|
|
263
|
+
* @returns The ABI method for the given method
|
|
264
|
+
*/
|
|
265
|
+
getABIMethod(method: string): ABIMethod | undefined;
|
|
266
|
+
/**
|
|
267
|
+
* Gets the reference information for the current application instance.
|
|
268
|
+
* `appId` will be 0 if it can't find an app.
|
|
269
|
+
* @returns The app reference, or if deployed using the `deploy` method, the app metadata too
|
|
270
|
+
*/
|
|
271
|
+
getAppReference(): Promise<AppMetadata | AppReference>;
|
|
272
|
+
/**
|
|
273
|
+
* Takes an error that may include a logic error from a smart contract call and re-exposes the error to include source code information via the source map.
|
|
274
|
+
* This is automatically used within `ApplicationClient` but if you pass `skipSending: true` e.g. if doing a group transaction
|
|
275
|
+
* then you can use this in a try/catch block to get better debugging information.
|
|
276
|
+
* @param e The error to parse
|
|
277
|
+
* @param isClear Whether or not the code was running the clear state program
|
|
278
|
+
* @returns The new error, or if there was no logic error or source map then the wrapped error with source details
|
|
279
|
+
*/
|
|
280
|
+
exposeLogicError(e: Error, isClear?: boolean): Error;
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=app-client.d.ts.map
|