@algorandfoundation/algokit-utils 1.0.0-beta.9 → 1.0.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/account.d.ts +35 -31
- package/account.d.ts.map +1 -1
- package/account.js +53 -39
- package/account.js.map +1 -1
- package/amount.d.ts +8 -0
- package/amount.d.ts.map +1 -0
- package/amount.js +24 -0
- package/amount.js.map +1 -0
- package/app.d.ts +64 -145
- package/app.d.ts.map +1 -1
- package/app.js +197 -39
- package/app.js.map +1 -1
- package/application-client.d.ts +9 -112
- package/application-client.d.ts.map +1 -1
- package/application-client.js +11 -254
- package/application-client.js.map +1 -1
- package/deploy-app.d.ts +20 -91
- package/deploy-app.d.ts.map +1 -1
- package/deploy-app.js +84 -93
- package/deploy-app.js.map +1 -1
- package/index.d.ts +4 -2
- package/index.d.ts.map +1 -1
- package/index.js +5 -2
- package/index.js.map +1 -1
- package/localnet.d.ts +4 -4
- package/localnet.d.ts.map +1 -1
- package/localnet.js +10 -10
- package/localnet.js.map +1 -1
- package/network-client.d.ts +11 -20
- package/network-client.d.ts.map +1 -1
- package/network-client.js +11 -11
- 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 +20 -0
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -0
- package/testing/fixtures/algorand-fixture.js +49 -0
- package/testing/fixtures/algorand-fixture.js.map +1 -0
- package/testing/fixtures/index.d.ts +3 -0
- package/testing/fixtures/index.d.ts.map +1 -0
- package/testing/fixtures/index.js +19 -0
- package/testing/fixtures/index.js.map +1 -0
- package/testing/index.d.ts +6 -0
- package/testing/index.d.ts.map +1 -0
- package/testing/index.js +22 -0
- package/testing/index.js.map +1 -0
- package/testing/indexer.d.ts +12 -0
- package/testing/indexer.d.ts.map +1 -0
- package/testing/indexer.js +39 -0
- package/testing/indexer.js.map +1 -0
- package/testing/test-logger.d.ts +39 -0
- package/testing/test-logger.d.ts.map +1 -0
- package/testing/test-logger.js +69 -0
- package/testing/test-logger.js.map +1 -0
- package/testing/transaction-logger.d.ts +29 -0
- package/testing/transaction-logger.d.ts.map +1 -0
- package/testing/transaction-logger.js +71 -0
- package/testing/transaction-logger.js.map +1 -0
- package/transaction.d.ts +4 -81
- package/transaction.d.ts.map +1 -1
- package/transaction.js +39 -89
- package/transaction.js.map +1 -1
- package/transfer.d.ts +13 -16
- package/transfer.d.ts.map +1 -1
- package/transfer.js +35 -3
- package/transfer.js.map +1 -1
- package/types/account.d.ts +52 -0
- package/types/account.d.ts.map +1 -0
- package/types/account.js +86 -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} +2 -2
- package/types/algo-http-client-with-retry.js.map +1 -0
- package/types/algod.d.ts +22 -9
- package/types/algod.d.ts.map +1 -1
- package/{algo-amount.d.ts → types/amount.d.ts} +3 -1
- package/types/amount.d.ts.map +1 -0
- package/{algo-amount.js → types/amount.js} +7 -1
- package/types/amount.js.map +1 -0
- package/types/app.d.ts +279 -0
- package/types/app.d.ts.map +1 -0
- package/types/app.js +32 -0
- package/types/app.js.map +1 -0
- package/types/application-client.d.ts +229 -0
- package/types/application-client.d.ts.map +1 -0
- package/types/application-client.js +470 -0
- package/types/application-client.js.map +1 -0
- package/types/appspec.d.ts +1 -2
- package/types/appspec.d.ts.map +1 -1
- package/types/appspec.js.map +1 -1
- package/types/config.d.ts +15 -0
- package/types/config.d.ts.map +1 -0
- package/types/config.js +27 -0
- package/types/config.js.map +1 -0
- package/types/indexer.d.ts +8 -9
- package/types/indexer.d.ts.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 +33 -0
- package/types/logic-error.d.ts.map +1 -0
- package/types/logic-error.js +46 -0
- package/types/logic-error.js.map +1 -0
- package/types/network-client.d.ts +11 -0
- package/types/network-client.d.ts.map +1 -0
- package/types/network-client.js +3 -0
- package/types/network-client.js.map +1 -0
- package/types/testing.d.ts +89 -0
- package/types/testing.d.ts.map +1 -0
- package/types/testing.js +3 -0
- package/types/testing.js.map +1 -0
- package/types/transaction.d.ts +67 -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/config.d.ts.map +0 -1
- package/config.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
package/account.d.ts
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
|
-
import algosdk, { Account, Algodv2, Kmd } from 'algosdk';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import algosdk, { Account, Algodv2, Kmd, MultisigMetadata, TransactionSigner } from 'algosdk';
|
|
2
|
+
import { MultisigAccount, SigningAccount, TransactionSignerAccount } from './types/account';
|
|
3
|
+
import { AlgoAmount } from './types/amount';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Returns an account wrapper that supports partial or full multisig signing.
|
|
6
|
+
* @param multisigParams The parameters that define the multisig account
|
|
7
|
+
* @param signingAccounts The signers that are currently present
|
|
8
|
+
* @returns A multisig account wrapper
|
|
6
9
|
*/
|
|
7
|
-
export declare
|
|
10
|
+
export declare function multisigAccount(multisigParams: MultisigMetadata, signingAccounts: (Account | SigningAccount)[]): MultisigAccount;
|
|
11
|
+
/**
|
|
12
|
+
* Returns an account wrapper that supports a rekeyed account.
|
|
13
|
+
* @param account The account, with private key loaded, that is signing
|
|
14
|
+
* @param sender The address of the rekeyed account that will act as a sender
|
|
15
|
+
* @returns The @see SigningAccount wrapper
|
|
16
|
+
*/
|
|
17
|
+
export declare function rekeyedAccount(account: Account, sender: string): SigningAccount;
|
|
18
|
+
/**
|
|
19
|
+
* Returns an account wrapper that supports a transaction signer with associated sender address.
|
|
20
|
+
* @param signer The transaction signer
|
|
21
|
+
* @param sender The address of sender account
|
|
22
|
+
* @returns The @see SigningAccount wrapper
|
|
23
|
+
*/
|
|
24
|
+
export declare function transactionSignerAccount(signer: TransactionSigner, sender: string): TransactionSignerAccount;
|
|
8
25
|
/** Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
|
|
9
26
|
*
|
|
10
27
|
* This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.
|
|
@@ -12,24 +29,30 @@ export declare const DISPENSER_ACCOUNT = "DISPENSER";
|
|
|
12
29
|
* @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,
|
|
13
30
|
* never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.
|
|
14
31
|
*/
|
|
15
|
-
export declare function
|
|
32
|
+
export declare function mnemonicAccount(mnemonicSecret: string): Account;
|
|
33
|
+
/** Returns a new, random Algorand account with secret key loaded.
|
|
34
|
+
*
|
|
35
|
+
* This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export declare function randomAccount(): Account;
|
|
16
39
|
/**
|
|
17
40
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
18
41
|
*
|
|
19
42
|
* Note: This function expects to run in a Node.js environment.
|
|
20
43
|
*
|
|
21
44
|
* ## Convention:
|
|
22
|
-
* * **Non-LocalNet:** will load process.env['{NAME}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
45
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
23
46
|
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
24
|
-
* If process.env['{NAME}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
25
|
-
* * **LocalNet:** will load the account from a KMD wallet called {NAME} and if that wallet doesn't exist it will create it and fund the account for you
|
|
47
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
48
|
+
* * **LocalNet:** will load the account from a KMD wallet called \{NAME\} and if that wallet doesn't exist it will create it and fund the account for you
|
|
26
49
|
*
|
|
27
50
|
* This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).
|
|
28
51
|
*
|
|
29
52
|
* @example Default
|
|
30
53
|
*
|
|
31
54
|
* If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
|
|
32
|
-
* ```
|
|
55
|
+
* ```typescript
|
|
33
56
|
* const account = await getAccount('ACCOUNT', algod)
|
|
34
57
|
* ```
|
|
35
58
|
*
|
|
@@ -46,25 +69,6 @@ export declare function getAccount(account: {
|
|
|
46
69
|
name: string;
|
|
47
70
|
fundWith?: AlgoAmount;
|
|
48
71
|
} | string, algod: Algodv2, kmdClient?: Kmd): Promise<Account | SigningAccount>;
|
|
49
|
-
/**
|
|
50
|
-
* Parameters for the getTestAccount function.
|
|
51
|
-
*/
|
|
52
|
-
interface GetTestAccountParams {
|
|
53
|
-
/** Initial funds to ensure the account has */
|
|
54
|
-
initialFunds: AlgoAmount;
|
|
55
|
-
/** Whether to suppress the log (which includes a mnemonic) or not (default: do not supress the log) */
|
|
56
|
-
suppressLog?: boolean;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Creates an ephemeral Algorand account for the purposes of testing.
|
|
60
|
-
* Returns a newly created random test account that is funded from the dispenser @see {getDispenserAccount}
|
|
61
|
-
* DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!
|
|
62
|
-
* Note: By default this will log the mnemonic of the account.
|
|
63
|
-
* @param param0 The config for the test account to generate
|
|
64
|
-
* @param algod An algod client
|
|
65
|
-
* @returns The account, with private key loaded
|
|
66
|
-
*/
|
|
67
|
-
export declare function getTestAccount({ suppressLog, initialFunds }: GetTestAccountParams, algod: Algodv2): Promise<Account>;
|
|
68
72
|
/** Returns an account's address as a byte array
|
|
69
73
|
*
|
|
70
74
|
* @param account Either an account (with private key loaded) or the string address of an account
|
|
@@ -81,7 +85,7 @@ export declare function getAccountAddressAsString(addressEncodedInB64: string):
|
|
|
81
85
|
* otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC @see {getAccount}
|
|
82
86
|
*
|
|
83
87
|
* @param algod An algod client
|
|
88
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables @see {getAlgoKmdClient}
|
|
84
89
|
*/
|
|
85
|
-
export declare function getDispenserAccount(algod: Algodv2): Promise<algosdk.Account | SigningAccount>;
|
|
86
|
-
export {};
|
|
90
|
+
export declare function getDispenserAccount(algod: Algodv2, kmd?: Kmd): Promise<algosdk.Account | SigningAccount>;
|
|
87
91
|
//# sourceMappingURL=account.d.ts.map
|
package/account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAI7F,OAAO,EAAqB,eAAe,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAA;AAC9G,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,OAAO,GAAG,cAAc,CAAC,EAAE,mBAE9G;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAE9D;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,wBAAwB,CAE5G;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAGvC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,MAAM,EACzD,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,OAAO,GAAG,cAAc,CAAC,CAmCnC;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,cAEtE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,6CAIlE"}
|
package/account.js
CHANGED
|
@@ -3,17 +3,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDispenserAccount = exports.getAccountAddressAsString = exports.getAccountAddressAsUint8Array = exports.
|
|
6
|
+
exports.getDispenserAccount = exports.getAccountAddressAsString = exports.getAccountAddressAsUint8Array = exports.getAccount = exports.randomAccount = exports.mnemonicAccount = exports.transactionSignerAccount = exports.rekeyedAccount = exports.multisigAccount = void 0;
|
|
7
7
|
const algosdk_1 = __importDefault(require("algosdk"));
|
|
8
|
-
const
|
|
8
|
+
const _1 = require("./");
|
|
9
9
|
const localnet_1 = require("./localnet");
|
|
10
10
|
const network_client_1 = require("./network-client");
|
|
11
|
-
const
|
|
12
|
-
const transfer_1 = require("./transfer");
|
|
11
|
+
const account_1 = require("./types/account");
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
13
|
+
* Returns an account wrapper that supports partial or full multisig signing.
|
|
14
|
+
* @param multisigParams The parameters that define the multisig account
|
|
15
|
+
* @param signingAccounts The signers that are currently present
|
|
16
|
+
* @returns A multisig account wrapper
|
|
15
17
|
*/
|
|
16
|
-
|
|
18
|
+
function multisigAccount(multisigParams, signingAccounts) {
|
|
19
|
+
return new account_1.MultisigAccount(multisigParams, signingAccounts);
|
|
20
|
+
}
|
|
21
|
+
exports.multisigAccount = multisigAccount;
|
|
22
|
+
/**
|
|
23
|
+
* Returns an account wrapper that supports a rekeyed account.
|
|
24
|
+
* @param account The account, with private key loaded, that is signing
|
|
25
|
+
* @param sender The address of the rekeyed account that will act as a sender
|
|
26
|
+
* @returns The @see SigningAccount wrapper
|
|
27
|
+
*/
|
|
28
|
+
function rekeyedAccount(account, sender) {
|
|
29
|
+
return new account_1.SigningAccount(account, sender);
|
|
30
|
+
}
|
|
31
|
+
exports.rekeyedAccount = rekeyedAccount;
|
|
32
|
+
/**
|
|
33
|
+
* Returns an account wrapper that supports a transaction signer with associated sender address.
|
|
34
|
+
* @param signer The transaction signer
|
|
35
|
+
* @param sender The address of sender account
|
|
36
|
+
* @returns The @see SigningAccount wrapper
|
|
37
|
+
*/
|
|
38
|
+
function transactionSignerAccount(signer, sender) {
|
|
39
|
+
return { addr: sender, signer };
|
|
40
|
+
}
|
|
41
|
+
exports.transactionSignerAccount = transactionSignerAccount;
|
|
17
42
|
/** Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
|
|
18
43
|
*
|
|
19
44
|
* This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.
|
|
@@ -21,28 +46,38 @@ exports.DISPENSER_ACCOUNT = 'DISPENSER';
|
|
|
21
46
|
* @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,
|
|
22
47
|
* never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.
|
|
23
48
|
*/
|
|
24
|
-
function
|
|
49
|
+
function mnemonicAccount(mnemonicSecret) {
|
|
25
50
|
// This method is confusingly named, so this function provides a more dev friendly "wrapper" name
|
|
26
51
|
return algosdk_1.default.mnemonicToSecretKey(mnemonicSecret);
|
|
27
52
|
}
|
|
28
|
-
exports.
|
|
53
|
+
exports.mnemonicAccount = mnemonicAccount;
|
|
54
|
+
/** Returns a new, random Algorand account with secret key loaded.
|
|
55
|
+
*
|
|
56
|
+
* This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
function randomAccount() {
|
|
60
|
+
// This method is confusingly named, so this function provides a more dev friendly "wrapper" name
|
|
61
|
+
return algosdk_1.default.generateAccount();
|
|
62
|
+
}
|
|
63
|
+
exports.randomAccount = randomAccount;
|
|
29
64
|
/**
|
|
30
65
|
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
31
66
|
*
|
|
32
67
|
* Note: This function expects to run in a Node.js environment.
|
|
33
68
|
*
|
|
34
69
|
* ## Convention:
|
|
35
|
-
* * **Non-LocalNet:** will load process.env['{NAME}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
70
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
36
71
|
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
37
|
-
* If process.env['{NAME}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
38
|
-
* * **LocalNet:** will load the account from a KMD wallet called {NAME} and if that wallet doesn't exist it will create it and fund the account for you
|
|
72
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
73
|
+
* * **LocalNet:** will load the account from a KMD wallet called \{NAME\} and if that wallet doesn't exist it will create it and fund the account for you
|
|
39
74
|
*
|
|
40
75
|
* This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).
|
|
41
76
|
*
|
|
42
77
|
* @example Default
|
|
43
78
|
*
|
|
44
79
|
* If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
|
|
45
|
-
* ```
|
|
80
|
+
* ```typescript
|
|
46
81
|
* const account = await getAccount('ACCOUNT', algod)
|
|
47
82
|
* ```
|
|
48
83
|
*
|
|
@@ -71,12 +106,12 @@ async function getAccount(account, algod, kmdClient) {
|
|
|
71
106
|
const envKey = `${name.toUpperCase()}_MNEMONIC`;
|
|
72
107
|
if (process.env[envKey]) {
|
|
73
108
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
74
|
-
const signer =
|
|
109
|
+
const signer = mnemonicAccount(process.env[envKey]);
|
|
75
110
|
const senderKey = `${name.toUpperCase()}_SENDER`;
|
|
76
111
|
if (process.env[senderKey]) {
|
|
77
|
-
|
|
112
|
+
_1.Config.logger.debug(`Using rekeyed account ${signer.addr} for sender ${process.env[senderKey]} for ${name} account`);
|
|
78
113
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
79
|
-
return new
|
|
114
|
+
return new account_1.SigningAccount(signer, process.env[senderKey]);
|
|
80
115
|
}
|
|
81
116
|
else {
|
|
82
117
|
return signer;
|
|
@@ -90,28 +125,6 @@ async function getAccount(account, algod, kmdClient) {
|
|
|
90
125
|
throw `Missing environment variable ${envKey} when looking for account ${name}`;
|
|
91
126
|
}
|
|
92
127
|
exports.getAccount = getAccount;
|
|
93
|
-
/**
|
|
94
|
-
* Creates an ephemeral Algorand account for the purposes of testing.
|
|
95
|
-
* Returns a newly created random test account that is funded from the dispenser @see {getDispenserAccount}
|
|
96
|
-
* DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!
|
|
97
|
-
* Note: By default this will log the mnemonic of the account.
|
|
98
|
-
* @param param0 The config for the test account to generate
|
|
99
|
-
* @param algod An algod client
|
|
100
|
-
* @returns The account, with private key loaded
|
|
101
|
-
*/
|
|
102
|
-
async function getTestAccount({ suppressLog, initialFunds }, algod) {
|
|
103
|
-
const account = algosdk_1.default.generateAccount();
|
|
104
|
-
config_1.AlgoKitConfig.getLogger(suppressLog).info(`New test account created with address '${account.addr}' and mnemonic '${algosdk_1.default.secretKeyToMnemonic(account.sk)}'.`);
|
|
105
|
-
// If we are running against LocalNet we can use the default account within it
|
|
106
|
-
// otherwise use an automation account specified via environment variables and ensure it's populated with ALGOs
|
|
107
|
-
const canFundFromDefaultAccount = await (0, network_client_1.isLocalNet)(algod);
|
|
108
|
-
const dispenser = canFundFromDefaultAccount ? await (0, localnet_1.getLocalNetDispenserAccount)(algod) : await getAccount(exports.DISPENSER_ACCOUNT, algod);
|
|
109
|
-
await (0, transfer_1.transferAlgos)({ from: dispenser, to: account.addr, amount: initialFunds, note: 'Funding test account', suppressLog }, algod);
|
|
110
|
-
const accountInfo = await algod.accountInformation(account.addr).do();
|
|
111
|
-
config_1.AlgoKitConfig.getLogger(suppressLog).info('Test account funded; account balance: %d µAlgos', accountInfo.amount);
|
|
112
|
-
return account;
|
|
113
|
-
}
|
|
114
|
-
exports.getTestAccount = getTestAccount;
|
|
115
128
|
/** Returns an account's address as a byte array
|
|
116
129
|
*
|
|
117
130
|
* @param account Either an account (with private key loaded) or the string address of an account
|
|
@@ -134,11 +147,12 @@ exports.getAccountAddressAsString = getAccountAddressAsString;
|
|
|
134
147
|
* otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC @see {getAccount}
|
|
135
148
|
*
|
|
136
149
|
* @param algod An algod client
|
|
150
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables @see {getAlgoKmdClient}
|
|
137
151
|
*/
|
|
138
|
-
async function getDispenserAccount(algod) {
|
|
152
|
+
async function getDispenserAccount(algod, kmd) {
|
|
139
153
|
// If we are running against a sandbox we can use the default account within it, otherwise use an automation account specified via environment variables and ensure it's populated with ALGOs
|
|
140
154
|
const canFundFromDefaultAccount = await (0, network_client_1.isLocalNet)(algod);
|
|
141
|
-
return canFundFromDefaultAccount ? await (0, localnet_1.getLocalNetDispenserAccount)(algod) : await getAccount(
|
|
155
|
+
return canFundFromDefaultAccount ? await (0, localnet_1.getLocalNetDispenserAccount)(algod, kmd) : await getAccount(account_1.DISPENSER_ACCOUNT, algod);
|
|
142
156
|
}
|
|
143
157
|
exports.getDispenserAccount = getDispenserAccount;
|
|
144
158
|
//# sourceMappingURL=account.js.map
|
package/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6F;AAC7F,yBAA2B;AAC3B,yCAAqF;AACrF,qDAA6C;AAC7C,6CAA8G;AAG9G;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,cAAgC,EAAE,eAA6C;IAC7G,OAAO,IAAI,yBAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAFD,0CAEC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,OAAgB,EAAE,MAAc;IAC7D,OAAO,IAAI,wBAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;AAC5C,CAAC;AAFD,wCAEC;AAED;;;;;GAKG;AACH,SAAgB,wBAAwB,CAAC,MAAyB,EAAE,MAAc;IAChF,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AACjC,CAAC;AAFD,4DAEC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,cAAsB;IACpD,iGAAiG;IACjG,OAAO,iBAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAA;AACpD,CAAC;AAHD,0CAGC;AAED;;;;GAIG;AACH,SAAgB,aAAa;IAC3B,iGAAiG;IACjG,OAAO,iBAAO,CAAC,eAAe,EAAE,CAAA;AAClC,CAAC;AAHD,sCAGC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACI,KAAK,UAAU,UAAU,CAC9B,OAAyD,EACzD,KAAc,EACd,SAAe;IAEf,IAAI,IAAY,CAAA;IAChB,IAAI,QAAQ,GAA2B,SAAS,CAAA;IAChD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE;QAC/B,IAAI,GAAG,OAAO,CAAA;KACf;SAAM;QACL,IAAI,GAAG,OAAO,CAAC,IAAI,C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AC,OAAyB;IACrE,OAAO,iBAAO,CAAC,aAAa,CAAC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,CAAA;AAC9F,CAAC;AAFD,sEAEC;AAED;;;GAGG;AACH,SAAgB,yBAAyB,CAAC,mBAA2B;IACnE,OAAO,iBAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAA;AAC1E,CAAC;AAFD,8DAEC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,mBAAmB,CAAC,KAAc,EAAE,GAAS;IACjE,6LAA6L;IAC7L,MAAM,yBAAyB,GAAG,MAAM,IAAA,2BAAU,EAAC,KAAK,CAAC,CAAA;IACzD,OAAO,yBAAyB,CAAC,CAAC,CAAC,MAAM,IAAA,sCAA2B,EAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,UAAU,CAAC,2BAAiB,EAAE,KAAK,CAAC,CAAA;AAC/H,CAAC;AAJD,kDAIC"}
|
package/amount.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AlgoAmount } from './types/amount';
|
|
2
|
+
/** Returns an amount of Algos using @see AlgoAmount */
|
|
3
|
+
export declare const algos: (algos: number) => AlgoAmount;
|
|
4
|
+
/** Returns an amount of µAlgos using @see AlgoAmount */
|
|
5
|
+
export declare const microAlgos: (microAlgos: number) => AlgoAmount;
|
|
6
|
+
/** Returns an amount of µAlgos to cover standard fees for the given number of transactions using @see AlgoAmount */
|
|
7
|
+
export declare const transactionFees: (numberOfTransactions: number) => AlgoAmount;
|
|
8
|
+
//# sourceMappingURL=amount.d.ts.map
|
package/amount.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../src/amount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,uDAAuD;AACvD,eAAO,MAAM,KAAK,UAAW,MAAM,eAElC,CAAA;AAED,wDAAwD;AACxD,eAAO,MAAM,UAAU,eAAgB,MAAM,eAE5C,CAAA;AAED,oHAAoH;AACpH,eAAO,MAAM,eAAe,yBAA0B,MAAM,eAE3D,CAAA"}
|
package/amount.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
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.transactionFees = exports.microAlgos = exports.algos = void 0;
|
|
7
|
+
const algosdk_1 = __importDefault(require("algosdk"));
|
|
8
|
+
const amount_1 = require("./types/amount");
|
|
9
|
+
/** Returns an amount of Algos using @see AlgoAmount */
|
|
10
|
+
const algos = (algos) => {
|
|
11
|
+
return amount_1.AlgoAmount.Algos(algos);
|
|
12
|
+
};
|
|
13
|
+
exports.algos = algos;
|
|
14
|
+
/** Returns an amount of µAlgos using @see AlgoAmount */
|
|
15
|
+
const microAlgos = (microAlgos) => {
|
|
16
|
+
return amount_1.AlgoAmount.MicroAlgos(microAlgos);
|
|
17
|
+
};
|
|
18
|
+
exports.microAlgos = microAlgos;
|
|
19
|
+
/** Returns an amount of µAlgos to cover standard fees for the given number of transactions using @see AlgoAmount */
|
|
20
|
+
const transactionFees = (numberOfTransactions) => {
|
|
21
|
+
return amount_1.AlgoAmount.MicroAlgos(numberOfTransactions * algosdk_1.default.ALGORAND_MIN_TX_FEE);
|
|
22
|
+
};
|
|
23
|
+
exports.transactionFees = transactionFees;
|
|
24
|
+
//# sourceMappingURL=amount.js.map
|
package/amount.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../src/amount.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAC7B,2CAA2C;AAE3C,uDAAuD;AAChD,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE;IACrC,OAAO,mBAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA;AAFY,QAAA,KAAK,SAEjB;AAED,wDAAwD;AACjD,MAAM,UAAU,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC/C,OAAO,mBAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAC1C,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAED,oHAAoH;AAC7G,MAAM,eAAe,GAAG,CAAC,oBAA4B,EAAE,EAAE;IAC9D,OAAO,mBAAU,CAAC,UAAU,CAAC,oBAAoB,GAAG,iBAAO,CAAC,mBAAmB,CAAC,CAAA;AAClF,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B"}
|
package/app.d.ts
CHANGED
|
@@ -1,157 +1,21 @@
|
|
|
1
|
-
import algosdk, {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare const APP_PAGE_MAX_SIZE = 2048;
|
|
6
|
-
/** First 4 bytes of SHA-512/256 hash of "return" */
|
|
7
|
-
export declare const ABI_RETURN_PREFIX: Uint8Array;
|
|
8
|
-
/** Information about an Algorand app */
|
|
9
|
-
export interface AppReference {
|
|
10
|
-
/** The index of the app */
|
|
11
|
-
appIndex: number;
|
|
12
|
-
/** The Algorand address of the account associated with the app */
|
|
13
|
-
appAddress: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* A grouping of the app ID and name of the box in an Uint8Array
|
|
17
|
-
*/
|
|
18
|
-
export interface BoxReference {
|
|
19
|
-
/**
|
|
20
|
-
* A unique application index
|
|
21
|
-
*/
|
|
22
|
-
appIndex: number;
|
|
23
|
-
/**
|
|
24
|
-
* Name of box to reference
|
|
25
|
-
*/
|
|
26
|
-
name: Uint8Array | string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* App call args with raw values (minus some processing like encoding strings as binary)
|
|
30
|
-
*/
|
|
31
|
-
export interface RawAppCallArgs {
|
|
32
|
-
/** The address of any accounts to load in */
|
|
33
|
-
accounts?: (string | Address)[];
|
|
34
|
-
/** Any application arguments to pass through */
|
|
35
|
-
appArgs?: (Uint8Array | string)[];
|
|
36
|
-
/** Any box references to load */
|
|
37
|
-
boxes?: BoxReference[];
|
|
38
|
-
/** IDs of any apps to load into the foreignApps array */
|
|
39
|
-
apps?: number[];
|
|
40
|
-
/** IDs of any assets to load into the foreignAssets array */
|
|
41
|
-
assets?: number[];
|
|
42
|
-
/** The optional lease for the transaction */
|
|
43
|
-
lease?: string | Uint8Array;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* App call args for an ABI call
|
|
47
|
-
*/
|
|
48
|
-
export interface ABIAppCallArgs {
|
|
49
|
-
/** The ABI method to call, either:
|
|
50
|
-
* * {method_name e.g. `hello`}; or
|
|
51
|
-
* * {method_signature e.g. `hello(string)string`} */
|
|
52
|
-
method: ABIMethodParams | ABIMethod;
|
|
53
|
-
/** The ABI args to pass in */
|
|
54
|
-
args: ABIArgument[];
|
|
55
|
-
/** The optional lease for the transaction */
|
|
56
|
-
lease?: string | Uint8Array;
|
|
57
|
-
}
|
|
58
|
-
/** Arguments to pass to an app call either:
|
|
59
|
-
* * The raw app call values to pass through into the transaction (after processing); or
|
|
60
|
-
* * An ABI method definition (method and args)
|
|
61
|
-
**/
|
|
62
|
-
export type AppCallArgs = RawAppCallArgs | ABIAppCallArgs;
|
|
63
|
-
/** Base interface for common data passed to an app create or update. */
|
|
64
|
-
interface CreateOrUpdateAppParams extends SendTransactionParams {
|
|
65
|
-
/** The account (with private key loaded) that will send the µALGOs */
|
|
66
|
-
from: SendTransactionFrom;
|
|
67
|
-
/** The approval program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */
|
|
68
|
-
approvalProgram: Uint8Array | string;
|
|
69
|
-
/** The clear state program as raw teal (string) or compiled teal, base 64 encoded as a byte array (Uint8Array) */
|
|
70
|
-
clearStateProgram: Uint8Array | string;
|
|
71
|
-
/** Optional transaction parameters */
|
|
72
|
-
transactionParams?: SuggestedParams;
|
|
73
|
-
/** The (optional) transaction note */
|
|
74
|
-
note?: TransactionNote;
|
|
75
|
-
/** The arguments passed in to the app call */
|
|
76
|
-
args?: AppCallArgs;
|
|
77
|
-
}
|
|
78
|
-
/** Parameters that are passed in when creating an app. */
|
|
79
|
-
export interface CreateAppParams extends CreateOrUpdateAppParams {
|
|
80
|
-
/** The storage schema to request for the created app */
|
|
81
|
-
schema: AppStorageSchema;
|
|
82
|
-
}
|
|
83
|
-
/** Parameters that are passed in when updating an app. */
|
|
84
|
-
export interface UpdateAppParams extends CreateOrUpdateAppParams {
|
|
85
|
-
/** The index of the app to update */
|
|
86
|
-
appIndex: number;
|
|
87
|
-
}
|
|
88
|
-
export interface AppCallParams extends SendTransactionParams {
|
|
89
|
-
/** The index of the app to call */
|
|
90
|
-
appIndex: number;
|
|
91
|
-
/** The type of call, everything except create (@see {createApp} ) and update (@see {updateApp} ) */
|
|
92
|
-
callType: 'optin' | 'closeout' | 'clearstate' | 'delete' | 'normal';
|
|
93
|
-
/** The account to make the call from */
|
|
94
|
-
from: SendTransactionFrom;
|
|
95
|
-
/** Optional transaction parameters */
|
|
96
|
-
transactionParams?: SuggestedParams;
|
|
97
|
-
/** The (optional) transaction note */
|
|
98
|
-
note?: TransactionNote;
|
|
99
|
-
/** The arguments passed in to the app call */
|
|
100
|
-
args?: AppCallArgs;
|
|
101
|
-
}
|
|
102
|
-
/** Parameters representing the storage schema of an app. */
|
|
103
|
-
export interface AppStorageSchema {
|
|
104
|
-
/** Restricts number of ints in per-user local state */
|
|
105
|
-
localInts: number;
|
|
106
|
-
/** Restricts number of byte slices in per-user local state */
|
|
107
|
-
localByteSlices: number;
|
|
108
|
-
/** Restricts number of ints in global state */
|
|
109
|
-
globalInts: number;
|
|
110
|
-
/** Restricts number of byte slices in global state */
|
|
111
|
-
globalByteSlices: number;
|
|
112
|
-
/** Any extra pages that are needed for the smart contract; if left blank then the right number of pages will be calculated based on the teal code size */
|
|
113
|
-
extraPages?: number;
|
|
114
|
-
}
|
|
115
|
-
/** Information about a compiled teal program */
|
|
116
|
-
export interface CompiledTeal {
|
|
117
|
-
/** Original TEAL code */
|
|
118
|
-
teal: string;
|
|
119
|
-
/** The compiled code */
|
|
120
|
-
compiled: string;
|
|
121
|
-
/** The has returned by the compiler */
|
|
122
|
-
compiledHash: string;
|
|
123
|
-
/** The base64 encoded code as a byte array */
|
|
124
|
-
compiledBase64ToBytes: Uint8Array;
|
|
125
|
-
}
|
|
126
|
-
/** Result from calling an app */
|
|
127
|
-
export interface AppCallTransactionResult extends SendTransactionResult {
|
|
128
|
-
/** If an ABI method was called the processed return value */
|
|
129
|
-
return?: ABIReturn;
|
|
130
|
-
}
|
|
131
|
-
/** The return value of an ABI method call */
|
|
132
|
-
export type ABIReturn = {
|
|
133
|
-
rawReturnValue: Uint8Array;
|
|
134
|
-
returnValue: ABIValue;
|
|
135
|
-
decodeError: undefined;
|
|
136
|
-
} | {
|
|
137
|
-
rawReturnValue: undefined;
|
|
138
|
-
returnValue: undefined;
|
|
139
|
-
decodeError: Error;
|
|
140
|
-
};
|
|
1
|
+
import algosdk, { ABIValue, Algodv2 } from 'algosdk';
|
|
2
|
+
import { ApplicationResponse, EvalDelta, PendingTransactionResponse, TealValue } from './types/algod';
|
|
3
|
+
import { ABIReturn, AppCallArgs, AppCallParams, AppCallTransactionResult, AppCompilationResult, AppReference, AppState, BoxName, BoxValueRequestParams, BoxValuesRequestParams, CompiledTeal, CreateAppParams, UpdateAppParams } from './types/app';
|
|
4
|
+
import { SendTransactionFrom } from './types/transaction';
|
|
141
5
|
/**
|
|
142
6
|
* Creates a smart contract app, returns the details of the created app.
|
|
143
7
|
* @param create The parameters to create the app with
|
|
144
8
|
* @param algod An algod client
|
|
145
9
|
* @returns The details of the created app, or the transaction to create it if `skipSending`
|
|
146
10
|
*/
|
|
147
|
-
export declare function createApp(create: CreateAppParams, algod: Algodv2): Promise<AppCallTransactionResult & AppReference>;
|
|
11
|
+
export declare function createApp(create: CreateAppParams, algod: Algodv2): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference>;
|
|
148
12
|
/**
|
|
149
13
|
* Updates a smart contract app.
|
|
150
14
|
* @param update The parameters to update the app with
|
|
151
15
|
* @param algod An algod client
|
|
152
16
|
* @returns The transaction
|
|
153
17
|
*/
|
|
154
|
-
export declare function updateApp(update: UpdateAppParams, algod: Algodv2): Promise<AppCallTransactionResult>;
|
|
18
|
+
export declare function updateApp(update: UpdateAppParams, algod: Algodv2): Promise<Partial<AppCompilationResult> & AppCallTransactionResult>;
|
|
155
19
|
/**
|
|
156
20
|
* Issues a call to a given app.
|
|
157
21
|
* @param call The call details.
|
|
@@ -160,6 +24,62 @@ export declare function updateApp(update: UpdateAppParams, algod: Algodv2): Prom
|
|
|
160
24
|
*/
|
|
161
25
|
export declare function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult>;
|
|
162
26
|
export declare function getABIReturn(args?: AppCallArgs, confirmation?: PendingTransactionResponse): ABIReturn | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the current global state values for the given app ID
|
|
29
|
+
* @param appId The ID of the app return global state for
|
|
30
|
+
* @param algod An algod client instance
|
|
31
|
+
* @returns The current global state
|
|
32
|
+
*/
|
|
33
|
+
export declare function getAppGlobalState(appId: number, algod: Algodv2): Promise<AppState>;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the current global state values for the given app ID and account
|
|
36
|
+
* @param appId The ID of the app return global state for
|
|
37
|
+
* @param account Either the string address of an account or an account object for the account to get local state for the given app
|
|
38
|
+
* @param algod An algod client instance
|
|
39
|
+
* @returns The current local state for the given (app, account) combination
|
|
40
|
+
*/
|
|
41
|
+
export declare function getAppLocalState(appId: number, account: string | SendTransactionFrom, algod: Algodv2): Promise<AppState>;
|
|
42
|
+
/**
|
|
43
|
+
* Returns the names of the boxes for the given app.
|
|
44
|
+
* @param appId The ID of the app return box names for
|
|
45
|
+
* @param algod An algod client instance
|
|
46
|
+
* @returns The current box names
|
|
47
|
+
*/
|
|
48
|
+
export declare function getAppBoxNames(appId: number, algod: Algodv2): Promise<BoxName[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the value of the given box name for the given app.
|
|
51
|
+
* @param appId The ID of the app return box names for
|
|
52
|
+
* @param boxName The name of the box to return either as a string, binary array or @see BoxName
|
|
53
|
+
* @param algod An algod client instance
|
|
54
|
+
* @returns The current box value as a byte array
|
|
55
|
+
*/
|
|
56
|
+
export declare function getAppBoxValue(appId: number, boxName: string | Uint8Array | BoxName, algod: Algodv2): Promise<Uint8Array>;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the value of the given box names for the given app.
|
|
59
|
+
* @param appId The ID of the app return box names for
|
|
60
|
+
* @param boxNames The names of the boxes to return either as a string, binary array or @see BoxName
|
|
61
|
+
* @param algod An algod client instance
|
|
62
|
+
* @returns The current box values as a byte array in the same order as the passed in box names
|
|
63
|
+
*/
|
|
64
|
+
export declare function getAppBoxValues(appId: number, boxNames: (string | Uint8Array | BoxName)[], algod: Algodv2): Promise<Uint8Array[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the value of the given box name for the given app decoded based on the given ABI type.
|
|
67
|
+
* @param request The parameters for the box value request
|
|
68
|
+
* @param algod An algod client instance
|
|
69
|
+
* @returns The current box value as an ABI value
|
|
70
|
+
*/
|
|
71
|
+
export declare function getAppBoxValueFromABIType(request: BoxValueRequestParams, algod: Algodv2): Promise<ABIValue>;
|
|
72
|
+
/**
|
|
73
|
+
* Returns the value of the given box names for the given app decoded based on the given ABI type.
|
|
74
|
+
* @param request The parameters for the box value request
|
|
75
|
+
* @param algod An algod client instance
|
|
76
|
+
* @returns The current box values as an ABI value in the same order as the passed in box names
|
|
77
|
+
*/
|
|
78
|
+
export declare function getAppBoxValuesFromABIType(request: BoxValuesRequestParams, algod: Algodv2): Promise<ABIValue[]>;
|
|
79
|
+
export declare function decodeAppState(state: {
|
|
80
|
+
key: string;
|
|
81
|
+
value: TealValue | EvalDelta;
|
|
82
|
+
}[]): AppState;
|
|
163
83
|
/** Returns the app args ready to load onto an app @see {Transaction} object */
|
|
164
84
|
export declare function getAppArgsForTransaction(args?: AppCallArgs): {
|
|
165
85
|
accounts: string[] | undefined;
|
|
@@ -172,11 +92,11 @@ export declare function getAppArgsForTransaction(args?: AppCallArgs): {
|
|
|
172
92
|
/**
|
|
173
93
|
* Gets the current data for the given app from algod.
|
|
174
94
|
*
|
|
175
|
-
* @param
|
|
95
|
+
* @param appId The id of the app
|
|
176
96
|
* @param algod An algod client
|
|
177
97
|
* @returns The data about the app
|
|
178
98
|
*/
|
|
179
|
-
export declare function getAppByIndex(
|
|
99
|
+
export declare function getAppByIndex(appId: number, algod: Algodv2): Promise<ApplicationResponse>;
|
|
180
100
|
/**
|
|
181
101
|
* Compiles the given TEAL using algod and returns the result.
|
|
182
102
|
*
|
|
@@ -185,5 +105,4 @@ export declare function getAppByIndex(appIndex: number, algod: Algodv2): Promise
|
|
|
185
105
|
* @returns The information about the compiled file
|
|
186
106
|
*/
|
|
187
107
|
export declare function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal>;
|
|
188
|
-
export {};
|
|
189
108
|
//# sourceMappingURL=app.d.ts.map
|
package/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAEd,QAAQ,EACR,OAAO,EAMR,MAAM,SAAS,CAAA;AAIhB,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,0BAA0B,EAAE,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