@algorandfoundation/algokit-utils 1.0.0-beta.3 → 1.0.0-beta.30
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 +1 -1
- package/{dist/account.d.ts → account.d.ts} +36 -32
- package/account.d.ts.map +1 -0
- package/{dist/account.js → account.js} +55 -41
- package/account.js.map +1 -0
- 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 +118 -0
- package/app.d.ts.map +1 -0
- package/app.js +533 -0
- package/app.js.map +1 -0
- package/application-client.d.ts +10 -0
- package/application-client.d.ts.map +1 -0
- package/application-client.js +15 -0
- package/application-client.js.map +1 -0
- package/deploy-app.d.ts +96 -0
- package/deploy-app.d.ts.map +1 -0
- package/{dist/deploy-app.js → deploy-app.js} +139 -114
- package/deploy-app.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.d.ts.map +1 -0
- package/{dist/index.js → index.js} +6 -2
- package/index.js.map +1 -0
- package/{dist/localnet.d.ts → localnet.d.ts} +6 -6
- package/localnet.d.ts.map +1 -0
- package/{dist/localnet.js → localnet.js} +12 -12
- package/localnet.js.map +1 -0
- package/{dist/network-client.d.ts → network-client.d.ts} +15 -24
- package/network-client.d.ts.map +1 -0
- package/{dist/network-client.js → network-client.js} +16 -16
- package/{dist/network-client.js.map → network-client.js.map} +1 -1
- package/package.json +5 -93
- 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 +120 -0
- package/transaction.d.ts.map +1 -0
- package/transaction.js +316 -0
- package/transaction.js.map +1 -0
- package/transfer.d.ts +21 -0
- package/transfer.d.ts.map +1 -0
- package/transfer.js +65 -0
- package/transfer.js.map +1 -0
- 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/{dist → types}/algo-http-client-with-retry.js +2 -2
- package/types/algo-http-client-with-retry.js.map +1 -0
- package/{dist/types → types}/algod.d.ts +22 -9
- package/types/algod.d.ts.map +1 -0
- package/{dist/algo-amount.d.ts → types/amount.d.ts} +3 -1
- package/types/amount.d.ts.map +1 -0
- package/{dist/algo-amount.js → types/amount.js} +7 -1
- package/types/amount.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/application-client.d.ts +232 -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 +77 -0
- package/types/appspec.d.ts.map +1 -0
- package/types/appspec.js +15 -0
- package/types/appspec.js.map +1 -0
- 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/{dist/types → types}/indexer.d.ts +8 -9
- package/{dist/types → types}/indexer.d.ts.map +1 -1
- package/{dist/config.d.ts → types/logging.d.ts} +2 -16
- package/types/logging.d.ts.map +1 -0
- package/{dist/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 +85 -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/LICENSE +0 -21
- package/dist/account.d.ts.map +0 -1
- package/dist/account.js.map +0 -1
- package/dist/algo-amount.d.ts.map +0 -1
- package/dist/algo-amount.js.map +0 -1
- package/dist/algo-http-client-with-retry.d.ts.map +0 -1
- package/dist/algo-http-client-with-retry.js.map +0 -1
- package/dist/app.d.ts +0 -150
- package/dist/app.d.ts.map +0 -1
- package/dist/app.js +0 -156
- package/dist/app.js.map +0 -1
- package/dist/application-client.d.ts +0 -1
- package/dist/application-client.d.ts.map +0 -1
- package/dist/application-client.js +0 -69
- package/dist/application-client.js.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/deploy-app.d.ts +0 -149
- package/dist/deploy-app.d.ts.map +0 -1
- package/dist/deploy-app.js.map +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/localnet.d.ts.map +0 -1
- package/dist/localnet.js.map +0 -1
- package/dist/network-client.d.ts.map +0 -1
- package/dist/package.json +0 -20
- package/dist/transaction.d.ts +0 -152
- package/dist/transaction.d.ts.map +0 -1
- package/dist/transaction.js +0 -268
- package/dist/transaction.js.map +0 -1
- package/dist/transfer.d.ts +0 -24
- package/dist/transfer.d.ts.map +0 -1
- package/dist/transfer.js +0 -33
- package/dist/transfer.js.map +0 -1
- package/dist/types/algod.d.ts.map +0 -1
- package/dist/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/dist/urlTokenBaseHTTPClient.js.map +0 -1
- /package/{dist/indexer-lookup.d.ts → indexer-lookup.d.ts} +0 -0
- /package/{dist/indexer-lookup.d.ts.map → indexer-lookup.d.ts.map} +0 -0
- /package/{dist/indexer-lookup.js → indexer-lookup.js} +0 -0
- /package/{dist/indexer-lookup.js.map → indexer-lookup.js.map} +0 -0
- /package/{dist → types}/algo-http-client-with-retry.d.ts +0 -0
- /package/{dist/types → types}/algod.js +0 -0
- /package/{dist/types → types}/algod.js.map +0 -0
- /package/{dist/types → types}/indexer.js +0 -0
- /package/{dist/types → types}/indexer.js.map +0 -0
- /package/{dist → types}/urlTokenBaseHTTPClient.d.ts +0 -0
- /package/{dist → types}/urlTokenBaseHTTPClient.js +0 -0
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ npm install @algorandfoundation/algokit-utils
|
|
|
18
18
|
|
|
19
19
|
## Guiding principles
|
|
20
20
|
|
|
21
|
-
This library follows the [Guiding Principles of AlgoKit](https://github.com/algorandfoundation/algokit-cli#guiding-principles).
|
|
21
|
+
This library follows the [Guiding Principles of AlgoKit](https://github.com/algorandfoundation/algokit-cli/docs/algokit.md#guiding-principles).
|
|
22
22
|
|
|
23
23
|
## Contributing
|
|
24
24
|
|
|
@@ -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
|
|
@@ -77,11 +81,11 @@ export declare function getAccountAddressAsUint8Array(account: Account | string)
|
|
|
77
81
|
export declare function getAccountAddressAsString(addressEncodedInB64: string): string;
|
|
78
82
|
/** Returns an account (with private key loaded) that can act as a dispenser
|
|
79
83
|
*
|
|
80
|
-
* If running on
|
|
84
|
+
* If running on LocalNet then it will return the default dispenser account automatically,
|
|
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
ADDED
|
@@ -0,0 +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,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"}
|
|
@@ -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
|
|
@@ -130,15 +143,16 @@ function getAccountAddressAsString(addressEncodedInB64) {
|
|
|
130
143
|
exports.getAccountAddressAsString = getAccountAddressAsString;
|
|
131
144
|
/** Returns an account (with private key loaded) that can act as a dispenser
|
|
132
145
|
*
|
|
133
|
-
* If running on
|
|
146
|
+
* If running on LocalNet then it will return the default dispenser account automatically,
|
|
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) {
|
|
139
|
-
// If we are running against
|
|
152
|
+
async function getDispenserAccount(algod, kmd) {
|
|
153
|
+
// If we are running against LocalNet 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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"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"}
|
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
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import algosdk, { ABIValue, Algodv2 } from 'algosdk';
|
|
2
|
+
import { ApplicationResponse, EvalDelta, PendingTransactionResponse, TealValue } from './types/algod';
|
|
3
|
+
import { ABIAppCallArgs, ABIReturn, AppCallArgs, AppCallParams, AppCallTransactionResult, AppCompilationResult, AppReference, AppState, BoxName, BoxValueRequestParams, BoxValuesRequestParams, CompiledTeal, CreateAppParams, RawAppCallArgs, UpdateAppParams } from './types/app';
|
|
4
|
+
import { SendTransactionFrom } from './types/transaction';
|
|
5
|
+
/**
|
|
6
|
+
* Creates a smart contract app, returns the details of the created app.
|
|
7
|
+
* @param create The parameters to create the app with
|
|
8
|
+
* @param algod An algod client
|
|
9
|
+
* @returns The details of the created app, or the transaction to create it if `skipSending`
|
|
10
|
+
*/
|
|
11
|
+
export declare function createApp(create: CreateAppParams, algod: Algodv2): Promise<Partial<AppCompilationResult> & AppCallTransactionResult & AppReference>;
|
|
12
|
+
/**
|
|
13
|
+
* Updates a smart contract app.
|
|
14
|
+
* @param update The parameters to update the app with
|
|
15
|
+
* @param algod An algod client
|
|
16
|
+
* @returns The transaction
|
|
17
|
+
*/
|
|
18
|
+
export declare function updateApp(update: UpdateAppParams, algod: Algodv2): Promise<Partial<AppCompilationResult> & AppCallTransactionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Issues a call to a given app.
|
|
21
|
+
* @param call The call details.
|
|
22
|
+
* @param algod An algod client
|
|
23
|
+
* @returns The result of the call
|
|
24
|
+
*/
|
|
25
|
+
export declare function callApp(call: AppCallParams, algod: Algodv2): Promise<AppCallTransactionResult>;
|
|
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;
|
|
83
|
+
/** Returns the app args ready to load onto an app @see {Transaction} object */
|
|
84
|
+
export declare function getAppArgsForTransaction(args?: RawAppCallArgs): {
|
|
85
|
+
accounts: string[] | undefined;
|
|
86
|
+
appArgs: Uint8Array[] | undefined;
|
|
87
|
+
boxes: algosdk.BoxReference[] | undefined;
|
|
88
|
+
foreignApps: number[] | undefined;
|
|
89
|
+
foreignAssets: number[] | undefined;
|
|
90
|
+
lease: Uint8Array | undefined;
|
|
91
|
+
} | undefined;
|
|
92
|
+
/** Returns the app args ready to load onto an ABI method call in @see AtomicTransactionComposer */
|
|
93
|
+
export declare function getAppArgsForABICall(args: ABIAppCallArgs, from: SendTransactionFrom): {
|
|
94
|
+
method: algosdk.ABIMethod;
|
|
95
|
+
sender: string;
|
|
96
|
+
signer: algosdk.TransactionSigner;
|
|
97
|
+
boxes: algosdk.BoxReference[] | undefined;
|
|
98
|
+
lease: Uint8Array | undefined;
|
|
99
|
+
methodArgs: (string | number | bigint | boolean | Uint8Array | algosdk.ABIValue[] | algosdk.TransactionWithSigner)[];
|
|
100
|
+
rekeyTo: undefined;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Gets the current data for the given app from algod.
|
|
104
|
+
*
|
|
105
|
+
* @param appId The id of the app
|
|
106
|
+
* @param algod An algod client
|
|
107
|
+
* @returns The data about the app
|
|
108
|
+
*/
|
|
109
|
+
export declare function getAppByIndex(appId: number, algod: Algodv2): Promise<ApplicationResponse>;
|
|
110
|
+
/**
|
|
111
|
+
* Compiles the given TEAL using algod and returns the result.
|
|
112
|
+
*
|
|
113
|
+
* @param algod An algod client
|
|
114
|
+
* @param tealCode The TEAL code
|
|
115
|
+
* @returns The information about the compiled file
|
|
116
|
+
*/
|
|
117
|
+
export declare function compileTeal(tealCode: string, algod: Algodv2): Promise<CompiledTeal>;
|
|
118
|
+
//# sourceMappingURL=app.d.ts.map
|
package/app.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"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"}
|