@algorandfoundation/algokit-utils 1.0.0-beta.4 → 1.0.0-beta.41
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 +9 -2
- package/{dist/account.d.ts → account.d.ts} +41 -36
- package/account.d.ts.map +1 -0
- package/{dist/account.js → account.js} +59 -44
- package/account.js.map +1 -0
- 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/{dist/deploy-app.js → app-deploy.js} +158 -121
- package/app-deploy.js.map +1 -0
- package/app.d.ts +153 -0
- package/app.d.ts.map +1 -0
- package/app.js +582 -0
- package/app.js.map +1 -0
- package/index.d.ts +14 -0
- package/index.d.ts.map +1 -0
- package/{dist/index.js → index.js} +7 -3
- package/index.js.map +1 -0
- package/{dist/indexer-lookup.d.ts → indexer-lookup.d.ts} +11 -4
- package/indexer-lookup.d.ts.map +1 -0
- package/{dist/indexer-lookup.js → indexer-lookup.js} +19 -9
- package/indexer-lookup.js.map +1 -0
- package/{dist/localnet.d.ts → localnet.d.ts} +10 -10
- package/localnet.d.ts.map +1 -0
- package/{dist/localnet.js → localnet.js} +16 -16
- 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 +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 +121 -0
- package/transaction.d.ts.map +1 -0
- package/transaction.js +364 -0
- package/transaction.js.map +1 -0
- package/transfer.d.ts +22 -0
- package/transfer.d.ts.map +1 -0
- package/transfer.js +67 -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 +3 -3
- package/types/algo-http-client-with-retry.js.map +1 -0
- package/{dist/types → types}/algod.d.ts +28 -15
- package/types/algod.d.ts.map +1 -0
- package/{dist/algo-amount.d.ts → types/amount.d.ts} +9 -3
- package/types/amount.d.ts.map +1 -0
- package/{dist/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/{dist/types/appspec.js → types/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 +624 -0
- package/types/indexer.d.ts.map +1 -0
- package/{dist/types → types}/indexer.js +9 -0
- package/types/indexer.js.map +1 -0
- 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 +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/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 -71
- package/dist/application-client.d.ts.map +0 -1
- package/dist/application-client.js +0 -145
- 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/indexer-lookup.d.ts.map +0 -1
- package/dist/indexer-lookup.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/types/appspec.d.ts +0 -79
- package/dist/types/appspec.d.ts.map +0 -1
- package/dist/types/appspec.js.map +0 -1
- package/dist/types/indexer.d.ts +0 -314
- package/dist/types/indexer.d.ts.map +0 -1
- package/dist/types/indexer.js.map +0 -1
- package/dist/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/dist/urlTokenBaseHTTPClient.js.map +0 -1
- /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}/urlTokenBaseHTTPClient.d.ts +0 -0
- /package/{dist → types}/urlTokenBaseHTTPClient.js +0 -0
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { Indexer } from 'algosdk';
|
|
2
2
|
import SearchForTransactions from 'algosdk/dist/types/client/v2/indexer/searchForTransactions';
|
|
3
|
-
import { ApplicationResult, TransactionLookupResult, TransactionSearchResults } from './types/indexer';
|
|
3
|
+
import { AccountLookupResult, ApplicationResult, TransactionLookupResult, TransactionSearchResults } from './types/indexer';
|
|
4
4
|
/**
|
|
5
5
|
* Looks up a transaction by ID using Indexer.
|
|
6
|
-
* @param indexer An indexer client
|
|
7
6
|
* @param transactionId The ID of the transaction to look up
|
|
7
|
+
* @param indexer An indexer client
|
|
8
8
|
* @returns The result of the look-up
|
|
9
9
|
*/
|
|
10
10
|
export declare function lookupTransactionById(transactionId: string, indexer: Indexer): Promise<TransactionLookupResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Looks up an account by address using Indexer.
|
|
13
|
+
* @param transactionId The address of the account to look up
|
|
14
|
+
* @param indexer An indexer client
|
|
15
|
+
* @returns The result of the look-up
|
|
16
|
+
*/
|
|
17
|
+
export declare function lookupAccountByAddress(accountAddress: string, indexer: Indexer): Promise<AccountLookupResult>;
|
|
11
18
|
/**
|
|
12
19
|
* Looks up applications that were created by the given address.
|
|
13
20
|
* @param indexer An indexer instance
|
|
14
21
|
* @param address The address of the creator to look up
|
|
15
22
|
* @param getAll Whether or not to include deleted applications
|
|
16
|
-
* @param paginationLimit The number of records to return per paginated request, default
|
|
23
|
+
* @param paginationLimit The number of records to return per paginated request, default 1000
|
|
17
24
|
* @returns The list of application results
|
|
18
25
|
*/
|
|
19
26
|
export declare function lookupAccountCreatedApplicationByAddress(indexer: Indexer, address: string, getAll?: boolean | undefined, paginationLimit?: number): Promise<ApplicationResult[]>;
|
|
@@ -21,7 +28,7 @@ export declare function lookupAccountCreatedApplicationByAddress(indexer: Indexe
|
|
|
21
28
|
* Allows transactions to be searched for the given criteria.
|
|
22
29
|
* @param indexer An indexer client
|
|
23
30
|
* @param searchCriteria The criteria to search for
|
|
24
|
-
* @param paginationLimit The number of records to return per paginated request, default
|
|
31
|
+
* @param paginationLimit The number of records to return per paginated request, default 1000
|
|
25
32
|
* @returns The search results
|
|
26
33
|
*/
|
|
27
34
|
export declare function searchTransactions(indexer: Indexer, searchCriteria: (s: SearchForTransactions) => SearchForTransactions, paginationLimit?: number): Promise<TransactionSearchResults>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer-lookup.d.ts","sourceRoot":"","sources":["../src/indexer-lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,qBAAqB,MAAM,4DAA4D,CAAA;AAC9F,OAAO,EACL,mBAAmB,EAEnB,iBAAiB,EACjB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,iBAAiB,CAAA;AAIxB;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAErH;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAEnH;AAED;;;;;;;GAOG;AACH,wBAAsB,wCAAwC,CAC5D,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,OAAO,GAAG,SAAqB,EACvC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAmB9B;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,qBAAqB,EACnE,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,wBAAwB,CAAC,CA0BnC;AAID,wBAAsB,uBAAuB,CAAC,OAAO,EAAE,QAAQ,SAAS;IAAE,EAAE,EAAE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,EAEhG,YAAY,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,OAAO,EAAE,EAC1C,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,KAAK,QAAQ,GAC7C,OAAO,CAAC,OAAO,EAAE,CAAC,CAoBpB"}
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.executePaginatedRequest = exports.searchTransactions = exports.lookupAccountCreatedApplicationByAddress = exports.lookupTransactionById = void 0;
|
|
3
|
+
exports.executePaginatedRequest = exports.searchTransactions = exports.lookupAccountCreatedApplicationByAddress = exports.lookupAccountByAddress = exports.lookupTransactionById = void 0;
|
|
4
4
|
const DEFAULT_INDEXER_MAX_API_RESOURCES_PER_ACCOUNT = 1000; //MaxAPIResourcesPerAccount: This is the default maximum, though may be provider specific
|
|
5
5
|
/**
|
|
6
6
|
* Looks up a transaction by ID using Indexer.
|
|
7
|
-
* @param indexer An indexer client
|
|
8
7
|
* @param transactionId The ID of the transaction to look up
|
|
8
|
+
* @param indexer An indexer client
|
|
9
9
|
* @returns The result of the look-up
|
|
10
10
|
*/
|
|
11
11
|
async function lookupTransactionById(transactionId, indexer) {
|
|
12
12
|
return (await indexer.lookupTransactionByID(transactionId).do());
|
|
13
13
|
}
|
|
14
14
|
exports.lookupTransactionById = lookupTransactionById;
|
|
15
|
+
/**
|
|
16
|
+
* Looks up an account by address using Indexer.
|
|
17
|
+
* @param transactionId The address of the account to look up
|
|
18
|
+
* @param indexer An indexer client
|
|
19
|
+
* @returns The result of the look-up
|
|
20
|
+
*/
|
|
21
|
+
async function lookupAccountByAddress(accountAddress, indexer) {
|
|
22
|
+
return (await indexer.lookupAccountByID(accountAddress).do());
|
|
23
|
+
}
|
|
24
|
+
exports.lookupAccountByAddress = lookupAccountByAddress;
|
|
15
25
|
/**
|
|
16
26
|
* Looks up applications that were created by the given address.
|
|
17
27
|
* @param indexer An indexer instance
|
|
18
28
|
* @param address The address of the creator to look up
|
|
19
29
|
* @param getAll Whether or not to include deleted applications
|
|
20
|
-
* @param paginationLimit The number of records to return per paginated request, default
|
|
30
|
+
* @param paginationLimit The number of records to return per paginated request, default 1000
|
|
21
31
|
* @returns The list of application results
|
|
22
32
|
*/
|
|
23
33
|
async function lookupAccountCreatedApplicationByAddress(indexer, address, getAll = undefined, paginationLimit) {
|
|
@@ -42,17 +52,17 @@ exports.lookupAccountCreatedApplicationByAddress = lookupAccountCreatedApplicati
|
|
|
42
52
|
* Allows transactions to be searched for the given criteria.
|
|
43
53
|
* @param indexer An indexer client
|
|
44
54
|
* @param searchCriteria The criteria to search for
|
|
45
|
-
* @param paginationLimit The number of records to return per paginated request, default
|
|
55
|
+
* @param paginationLimit The number of records to return per paginated request, default 1000
|
|
46
56
|
* @returns The search results
|
|
47
57
|
*/
|
|
48
58
|
async function searchTransactions(indexer, searchCriteria, paginationLimit) {
|
|
49
59
|
let currentRound = 0;
|
|
50
|
-
const
|
|
60
|
+
const transactions = await executePaginatedRequest((response) => {
|
|
51
61
|
if ('message' in response) {
|
|
52
62
|
throw { status: 404, ...response };
|
|
53
63
|
}
|
|
54
|
-
if (
|
|
55
|
-
currentRound =
|
|
64
|
+
if (response['current-round'] > currentRound) {
|
|
65
|
+
currentRound = response['current-round'];
|
|
56
66
|
}
|
|
57
67
|
return response.transactions;
|
|
58
68
|
}, (nextToken) => {
|
|
@@ -63,9 +73,9 @@ async function searchTransactions(indexer, searchCriteria, paginationLimit) {
|
|
|
63
73
|
return s;
|
|
64
74
|
});
|
|
65
75
|
return {
|
|
66
|
-
'current-round': currentRound
|
|
76
|
+
'current-round': currentRound,
|
|
67
77
|
'next-token': '',
|
|
68
|
-
transactions:
|
|
78
|
+
transactions: transactions,
|
|
69
79
|
};
|
|
70
80
|
}
|
|
71
81
|
exports.searchTransactions = searchTransactions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer-lookup.js","sourceRoot":"","sources":["../src/indexer-lookup.ts"],"names":[],"mappings":";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K,CAAC,CAAA;QACtB,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;QAClC,IAAI,CAAC,SAAS,EAAE;YACd,MAAK;SACN;KACF;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAxBD,0DAwBC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { Account, Algodv2, Kmd } from 'algosdk';
|
|
2
|
-
import { AlgoAmount } from './
|
|
2
|
+
import { AlgoAmount } from './types/amount';
|
|
3
3
|
/** Returns true if the algod client is pointing to a LocalNet Algorand network */
|
|
4
4
|
export declare function isLocalNet(algod: Algodv2): Promise<boolean>;
|
|
5
5
|
/**
|
|
6
6
|
* Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name.
|
|
7
7
|
*
|
|
8
|
-
* This is useful to get idempotent accounts from
|
|
8
|
+
* This is useful to get idempotent accounts from LocalNet without having to specify the private key (which will change when resetting the LocalNet).
|
|
9
9
|
*
|
|
10
|
-
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh
|
|
10
|
+
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
|
|
11
11
|
*
|
|
12
|
-
* If this is used via
|
|
12
|
+
* If this is used via `getAccount`, then you can even use the same code that runs on production without changes for local development!
|
|
13
13
|
*
|
|
14
14
|
* @param walletAccount The wallet details with:
|
|
15
15
|
* * `name`: The name of the wallet to retrieve / create
|
|
16
|
-
* * `fundWith`: The number of Algos to fund the account with it it gets created, if not specified then 1000 Algos will be funded from the dispenser account
|
|
16
|
+
* * `fundWith`: The number of Algos to fund the account with it it gets created, if not specified then 1000 Algos will be funded from the dispenser account
|
|
17
17
|
* @param algod An algod client
|
|
18
|
-
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
18
|
+
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
19
19
|
*
|
|
20
20
|
* @returns An Algorand account with private key loaded - either one that already existed in the given KMD wallet, or a new one that is funded for you
|
|
21
21
|
*/
|
|
@@ -30,10 +30,10 @@ export declare function getOrCreateKmdWalletAccount(walletAccount: {
|
|
|
30
30
|
* * `name`: The name of the wallet to retrieve an account from
|
|
31
31
|
* * `predicate`: An optional filter to use to find the account (otherwise it will return a random account from the wallet)
|
|
32
32
|
* @param algod An algod client
|
|
33
|
-
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
33
|
+
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
34
34
|
* @example Get default funded account in a LocalNet
|
|
35
35
|
*
|
|
36
|
-
* ```
|
|
36
|
+
* ```typescript
|
|
37
37
|
* const defaultDispenserAccount = await getKmdWalletAccount(algod,
|
|
38
38
|
* 'unencrypted-default-wallet',
|
|
39
39
|
* a => a.status !== 'Offline' && a.amount > 1_000_000_000
|
|
@@ -48,7 +48,7 @@ export declare function getKmdWalletAccount(walletAccount: {
|
|
|
48
48
|
* Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts)
|
|
49
49
|
*
|
|
50
50
|
* @param algod An algod client
|
|
51
|
-
* @param
|
|
51
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
52
52
|
*/
|
|
53
|
-
export declare function getLocalNetDispenserAccount(algod: Algodv2,
|
|
53
|
+
export declare function getLocalNetDispenserAccount(algod: Algodv2, kmd?: Kmd): Promise<Account>;
|
|
54
54
|
//# sourceMappingURL=localnet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localnet.d.ts","sourceRoot":"","sources":["../src/localnet.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAKxD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAE3C,kFAAkF;AAClF,wBAAsB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,UAAU,CAAA;CAAE,EACtD,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,OAAO,CAAC,CAmClB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CACvC,aAAa,EAAE;IACb,IAAI,EAAE,MAAM,CAAA;IAEZ,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAA;CACtD,EACD,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAmC9B;AAED;;;;;GAKG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAW7F"}
|
|
@@ -5,11 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getLocalNetDispenserAccount = exports.getKmdWalletAccount = exports.getOrCreateKmdWalletAccount = exports.isLocalNet = void 0;
|
|
7
7
|
const algosdk_1 = __importDefault(require("algosdk"));
|
|
8
|
+
const _1 = require("./");
|
|
8
9
|
const account_1 = require("./account");
|
|
9
|
-
const algo_amount_1 = require("./algo-amount");
|
|
10
|
-
const config_1 = require("./config");
|
|
11
10
|
const network_client_1 = require("./network-client");
|
|
12
11
|
const transfer_1 = require("./transfer");
|
|
12
|
+
const amount_1 = require("./types/amount");
|
|
13
13
|
/** Returns true if the algod client is pointing to a LocalNet Algorand network */
|
|
14
14
|
async function isLocalNet(algod) {
|
|
15
15
|
const params = await algod.getTransactionParams().do();
|
|
@@ -19,17 +19,17 @@ exports.isLocalNet = isLocalNet;
|
|
|
19
19
|
/**
|
|
20
20
|
* Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name.
|
|
21
21
|
*
|
|
22
|
-
* This is useful to get idempotent accounts from
|
|
22
|
+
* This is useful to get idempotent accounts from LocalNet without having to specify the private key (which will change when resetting the LocalNet).
|
|
23
23
|
*
|
|
24
|
-
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh
|
|
24
|
+
* This significantly speeds up local dev time and improves experience since you can write code that *just works* first go without manual config in a fresh LocalNet.
|
|
25
25
|
*
|
|
26
|
-
* If this is used via
|
|
26
|
+
* If this is used via `getAccount`, then you can even use the same code that runs on production without changes for local development!
|
|
27
27
|
*
|
|
28
28
|
* @param walletAccount The wallet details with:
|
|
29
29
|
* * `name`: The name of the wallet to retrieve / create
|
|
30
|
-
* * `fundWith`: The number of Algos to fund the account with it it gets created, if not specified then 1000 Algos will be funded from the dispenser account
|
|
30
|
+
* * `fundWith`: The number of Algos to fund the account with it it gets created, if not specified then 1000 Algos will be funded from the dispenser account
|
|
31
31
|
* @param algod An algod client
|
|
32
|
-
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
32
|
+
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
33
33
|
*
|
|
34
34
|
* @returns An Algorand account with private key loaded - either one that already existed in the given KMD wallet, or a new one that is funded for you
|
|
35
35
|
*/
|
|
@@ -47,11 +47,11 @@ async function getOrCreateKmdWalletAccount(walletAccount, algod, kmdClient) {
|
|
|
47
47
|
// Get the account from the new KMD wallet
|
|
48
48
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
49
49
|
const account = (await getKmdWalletAccount(walletAccount, algod, kmd));
|
|
50
|
-
|
|
50
|
+
_1.Config.logger.info(`LocalNet account '${walletAccount.name}' doesn't yet exist; created account ${account.addr} with keys stored in KMD and funding with ${walletAccount.fundWith?.algos ?? 1000} ALGOs`);
|
|
51
51
|
// Fund the account from the dispenser
|
|
52
52
|
await (0, transfer_1.transferAlgos)({
|
|
53
|
-
amount: walletAccount.fundWith ??
|
|
54
|
-
from: await (0, account_1.getDispenserAccount)(algod),
|
|
53
|
+
amount: walletAccount.fundWith ?? amount_1.AlgoAmount.Algos(1000),
|
|
54
|
+
from: await (0, account_1.getDispenserAccount)(algod, kmd),
|
|
55
55
|
to: account.addr,
|
|
56
56
|
}, algod);
|
|
57
57
|
return account;
|
|
@@ -64,10 +64,10 @@ exports.getOrCreateKmdWalletAccount = getOrCreateKmdWalletAccount;
|
|
|
64
64
|
* * `name`: The name of the wallet to retrieve an account from
|
|
65
65
|
* * `predicate`: An optional filter to use to find the account (otherwise it will return a random account from the wallet)
|
|
66
66
|
* @param algod An algod client
|
|
67
|
-
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
67
|
+
* @param kmdClient A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
68
68
|
* @example Get default funded account in a LocalNet
|
|
69
69
|
*
|
|
70
|
-
* ```
|
|
70
|
+
* ```typescript
|
|
71
71
|
* const defaultDispenserAccount = await getKmdWalletAccount(algod,
|
|
72
72
|
* 'unencrypted-default-wallet',
|
|
73
73
|
* a => a.status !== 'Offline' && a.amount > 1_000_000_000
|
|
@@ -101,21 +101,21 @@ async function getKmdWalletAccount(walletAccount, algod, kmdClient) {
|
|
|
101
101
|
}
|
|
102
102
|
const accountKey = (await kmd.exportKey(walletHandle, '', keyIds[i])).private_key;
|
|
103
103
|
const accountMnemonic = algosdk_1.default.secretKeyToMnemonic(accountKey);
|
|
104
|
-
return (0, account_1.
|
|
104
|
+
return (0, account_1.mnemonicAccount)(accountMnemonic);
|
|
105
105
|
}
|
|
106
106
|
exports.getKmdWalletAccount = getKmdWalletAccount;
|
|
107
107
|
/**
|
|
108
108
|
* Returns an Algorand account with private key loaded for the default LocalNet dispenser account (that can be used to fund other accounts)
|
|
109
109
|
*
|
|
110
110
|
* @param algod An algod client
|
|
111
|
-
* @param
|
|
111
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
112
112
|
*/
|
|
113
|
-
async function getLocalNetDispenserAccount(algod,
|
|
113
|
+
async function getLocalNetDispenserAccount(algod, kmd) {
|
|
114
114
|
if (!(await isLocalNet(algod))) {
|
|
115
115
|
throw "Can't get default account from non LocalNet network";
|
|
116
116
|
}
|
|
117
117
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
118
|
-
return (await getKmdWalletAccount({ name: 'unencrypted-default-wallet', predicate: (a) => a.status !== 'Offline' && a.amount > 1000000000 }, algod,
|
|
118
|
+
return (await getKmdWalletAccount({ name: 'unencrypted-default-wallet', predicate: (a) => a.status !== 'Offline' && a.amount > 1000000000 }, algod, kmd));
|
|
119
119
|
}
|
|
120
120
|
exports.getLocalNetDispenserAccount = getLocalNetDispenserAccount;
|
|
121
121
|
//# sourceMappingURL=localnet.js.map
|
package/localnet.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localnet.js","sourceRoot":"","sources":["../src/localnet.ts"],"names":[],"mappings":";;;;;;AAAA,sDAAwD;AACxD,yBAA2B;AAC3B,uCAAgE;AAChE,qDAAmD;AACnD,yCAA0C;AAC1C,2CAA2C;AAE3C,kFAAkF;AAC3E,KAAK,UAAU,UAAU,CAAC,KAAc;IAC7C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAA;IAEtD,OAAO,MAAM,CAAC,SAAS,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,KAAK,YAAY,CAAA;AAC9E,CAAC;AAJD,gCAIC;AAED;;;;;;;;;;;;;;;;GAgBG;AACI,KAAK,UAAU,2BAA2B,CAC/C,aAAsD,EACtD,KAAc,EACd,SAAe;IAEf,MAAM,GAAG,GAAG,SAAS,IAAI,IA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;IAEjF,MAAM,eAAe,GAAG,iBAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;IAC/D,OAAO,IAAA,yBAAe,EAAC,eAAe,CAAC,CAAA;AACzC,CAAC;AA3CD,kDA2CC;AAED;;;;;GAKG;AACI,KAAK,UAAU,2BAA2B,CAAC,KAAc,EAAE,GAAS;IACzE,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE;QAC9B,MAAM,qDAAqD,CAAA;KAC5D;IAED,oEAAoE;IACpE,OAAO,CAAC,MAAM,mBAAmB,CAC/B,EAAE,IAAI,EAAE,4BAA4B,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,CAAC,MAAM,GAAG,UAAa,EAAE,EAC5G,KAAK,EACL,GAAG,CACJ,CAAE,CAAA;AACL,CAAC;AAXD,kEAWC"}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { Algodv2, Indexer, Kmd } from 'algosdk';
|
|
2
|
-
import {
|
|
3
|
-
/** Config for an Algorand SDK client */
|
|
4
|
-
export interface AlgoClientConfig {
|
|
5
|
-
/** Base URL of the server e.g. http://localhost, https://testnet-api.algonode.cloud/, etc. */
|
|
6
|
-
server: string;
|
|
7
|
-
/** The port to use e.g. 4001, 443, etc. */
|
|
8
|
-
port?: string | number;
|
|
9
|
-
/** The token to use for API authentication (or undefined if none needed) - can be a string, or an object with the header key => value */
|
|
10
|
-
token?: string | TokenHeader;
|
|
11
|
-
}
|
|
2
|
+
import { AlgoClientConfig } from './types/network-client';
|
|
12
3
|
/** Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment not algod-side) */
|
|
13
4
|
export declare function getAlgodConfigFromEnvironment(): AlgoClientConfig;
|
|
14
5
|
/** Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment not algod-side) */
|
|
@@ -29,24 +20,24 @@ export declare function getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexe
|
|
|
29
20
|
* @param config The config if you want to override the default (getting config from process.env)
|
|
30
21
|
* @example Default (load from environment variables)
|
|
31
22
|
*
|
|
32
|
-
* ```
|
|
23
|
+
* ```typescript
|
|
33
24
|
* // Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN
|
|
34
25
|
* // Automatically detects if you are using PureStake to switch in the right header name for ALGOD_TOKEN
|
|
35
26
|
* const algod = getAlgoClient()
|
|
36
27
|
* await algod.healthCheck().do()
|
|
37
28
|
* ```
|
|
38
29
|
* @example AlgoNode (testnet)
|
|
39
|
-
* ```
|
|
30
|
+
* ```typescript
|
|
40
31
|
* const algod = getAlgoClient(getAlgoNodeConfig('testnet', 'algod'))
|
|
41
32
|
* await algod.healthCheck().do()
|
|
42
33
|
* ```
|
|
43
34
|
* @example AlgoNode (mainnet)
|
|
44
|
-
* ```
|
|
35
|
+
* ```typescript
|
|
45
36
|
* const algod = getAlgoClient(getAlgoNodeConfig('mainnet', 'algod'))
|
|
46
37
|
* await algod.healthCheck().do()
|
|
47
38
|
* ```
|
|
48
|
-
* @example Custom (e.g. default
|
|
49
|
-
* ```
|
|
39
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
40
|
+
* ```typescript
|
|
50
41
|
* const algod = getAlgoClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
51
42
|
* await algod.healthCheck().do()
|
|
52
43
|
* ```
|
|
@@ -57,24 +48,24 @@ export declare function getAlgoClient(config?: AlgoClientConfig): Algodv2;
|
|
|
57
48
|
* @param config The config if you want to override the default (getting config from process.env)
|
|
58
49
|
* @example Default (load from environment variables)
|
|
59
50
|
*
|
|
60
|
-
* ```
|
|
51
|
+
* ```typescript
|
|
61
52
|
* // Uses process.env.INDEXER_SERVER, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN
|
|
62
53
|
* // Automatically detects if you are using PureStake to switch in the right header name for INDEXER_TOKEN
|
|
63
54
|
* const indexer = getAlgoIndexerClient()
|
|
64
55
|
* await indexer.makeHealthCheck().do()
|
|
65
56
|
* ```
|
|
66
57
|
* @example AlgoNode (testnet)
|
|
67
|
-
* ```
|
|
58
|
+
* ```typescript
|
|
68
59
|
* const indexer = getAlgoIndexerClient(getAlgoNodeConfig('testnet', 'indexer'))
|
|
69
60
|
* await indexer.makeHealthCheck().do()
|
|
70
61
|
* ```
|
|
71
62
|
* @example AlgoNode (mainnet)
|
|
72
|
-
* ```
|
|
63
|
+
* ```typescript
|
|
73
64
|
* const indexer = getAlgoIndexerClient(getAlgoNodeConfig('mainnet', 'indexer'))
|
|
74
65
|
* await indexer.makeHealthCheck().do()
|
|
75
66
|
* ```
|
|
76
|
-
* @example Custom (e.g. default
|
|
77
|
-
* ```
|
|
67
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
68
|
+
* ```typescript
|
|
78
69
|
* const indexer = getAlgoIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
79
70
|
* await indexer.makeHealthCheck().do()
|
|
80
71
|
* ```
|
|
@@ -83,17 +74,17 @@ export declare function getAlgoIndexerClient(config?: AlgoClientConfig): Indexer
|
|
|
83
74
|
/**
|
|
84
75
|
* Returns a KMD SDK client that automatically retries on idempotent calls
|
|
85
76
|
*
|
|
86
|
-
* KMD client allows you to export private keys, which is useful to get the default account in a
|
|
77
|
+
* KMD client allows you to export private keys, which is useful to get the default account in a LocalNet network.
|
|
87
78
|
*
|
|
88
79
|
* @param config The config if you want to override the default (getting config from process.env)
|
|
89
80
|
* @example Default (load from environment variables)
|
|
90
81
|
*
|
|
91
|
-
* ```
|
|
82
|
+
* ```typescript
|
|
92
83
|
* // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN
|
|
93
84
|
* const kmd = getAlgoKmdClient()
|
|
94
85
|
* ```
|
|
95
|
-
* @example Custom (e.g. default
|
|
96
|
-
* ```
|
|
86
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
87
|
+
* ```typescript
|
|
97
88
|
* const kmd = getAlgoKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
98
89
|
* ```
|
|
99
90
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-client.d.ts","sourceRoot":"","sources":["../src/network-client.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAGxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,mIAAmI;AACnI,wBAAgB,6BAA6B,IAAI,gBAAgB,CAchE;AAED,qIAAqI;AACrI,wBAAgB,+BAA+B,IAAI,gBAAgB,CAclE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,gBAAgB,CAK/G;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,gBAAgB,CAM7G;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAIhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAIvE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,GAAG,CAK/D;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -25,7 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.isLocalNet = exports.getAlgoKmdClient = exports.getAlgoIndexerClient = exports.getAlgoClient = exports.getDefaultLocalNetConfig = exports.getAlgoNodeConfig = exports.getIndexerConfigFromEnvironment = exports.getAlgodConfigFromEnvironment = void 0;
|
|
27
27
|
const algosdk_1 = __importStar(require("algosdk"));
|
|
28
|
-
const algo_http_client_with_retry_1 = require("./algo-http-client-with-retry");
|
|
28
|
+
const algo_http_client_with_retry_1 = require("./types/algo-http-client-with-retry");
|
|
29
29
|
/** Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment not algod-side) */
|
|
30
30
|
function getAlgodConfigFromEnvironment() {
|
|
31
31
|
if (!process || !process.env) {
|
|
@@ -92,24 +92,24 @@ function getAlgoTokenHeader(server, token, defaultHeader) {
|
|
|
92
92
|
* @param config The config if you want to override the default (getting config from process.env)
|
|
93
93
|
* @example Default (load from environment variables)
|
|
94
94
|
*
|
|
95
|
-
* ```
|
|
95
|
+
* ```typescript
|
|
96
96
|
* // Uses process.env.ALGOD_SERVER, process.env.ALGOD_PORT and process.env.ALGOD_TOKEN
|
|
97
97
|
* // Automatically detects if you are using PureStake to switch in the right header name for ALGOD_TOKEN
|
|
98
98
|
* const algod = getAlgoClient()
|
|
99
99
|
* await algod.healthCheck().do()
|
|
100
100
|
* ```
|
|
101
101
|
* @example AlgoNode (testnet)
|
|
102
|
-
* ```
|
|
102
|
+
* ```typescript
|
|
103
103
|
* const algod = getAlgoClient(getAlgoNodeConfig('testnet', 'algod'))
|
|
104
104
|
* await algod.healthCheck().do()
|
|
105
105
|
* ```
|
|
106
106
|
* @example AlgoNode (mainnet)
|
|
107
|
-
* ```
|
|
107
|
+
* ```typescript
|
|
108
108
|
* const algod = getAlgoClient(getAlgoNodeConfig('mainnet', 'algod'))
|
|
109
109
|
* await algod.healthCheck().do()
|
|
110
110
|
* ```
|
|
111
|
-
* @example Custom (e.g. default
|
|
112
|
-
* ```
|
|
111
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
112
|
+
* ```typescript
|
|
113
113
|
* const algod = getAlgoClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
114
114
|
* await algod.healthCheck().do()
|
|
115
115
|
* ```
|
|
@@ -125,24 +125,24 @@ exports.getAlgoClient = getAlgoClient;
|
|
|
125
125
|
* @param config The config if you want to override the default (getting config from process.env)
|
|
126
126
|
* @example Default (load from environment variables)
|
|
127
127
|
*
|
|
128
|
-
* ```
|
|
128
|
+
* ```typescript
|
|
129
129
|
* // Uses process.env.INDEXER_SERVER, process.env.INDEXER_PORT and process.env.INDEXER_TOKEN
|
|
130
130
|
* // Automatically detects if you are using PureStake to switch in the right header name for INDEXER_TOKEN
|
|
131
131
|
* const indexer = getAlgoIndexerClient()
|
|
132
132
|
* await indexer.makeHealthCheck().do()
|
|
133
133
|
* ```
|
|
134
134
|
* @example AlgoNode (testnet)
|
|
135
|
-
* ```
|
|
135
|
+
* ```typescript
|
|
136
136
|
* const indexer = getAlgoIndexerClient(getAlgoNodeConfig('testnet', 'indexer'))
|
|
137
137
|
* await indexer.makeHealthCheck().do()
|
|
138
138
|
* ```
|
|
139
139
|
* @example AlgoNode (mainnet)
|
|
140
|
-
* ```
|
|
140
|
+
* ```typescript
|
|
141
141
|
* const indexer = getAlgoIndexerClient(getAlgoNodeConfig('mainnet', 'indexer'))
|
|
142
142
|
* await indexer.makeHealthCheck().do()
|
|
143
143
|
* ```
|
|
144
|
-
* @example Custom (e.g. default
|
|
145
|
-
* ```
|
|
144
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
145
|
+
* ```typescript
|
|
146
146
|
* const indexer = getAlgoIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
147
147
|
* await indexer.makeHealthCheck().do()
|
|
148
148
|
* ```
|
|
@@ -156,23 +156,23 @@ exports.getAlgoIndexerClient = getAlgoIndexerClient;
|
|
|
156
156
|
/**
|
|
157
157
|
* Returns a KMD SDK client that automatically retries on idempotent calls
|
|
158
158
|
*
|
|
159
|
-
* KMD client allows you to export private keys, which is useful to get the default account in a
|
|
159
|
+
* KMD client allows you to export private keys, which is useful to get the default account in a LocalNet network.
|
|
160
160
|
*
|
|
161
161
|
* @param config The config if you want to override the default (getting config from process.env)
|
|
162
162
|
* @example Default (load from environment variables)
|
|
163
163
|
*
|
|
164
|
-
* ```
|
|
164
|
+
* ```typescript
|
|
165
165
|
* // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN
|
|
166
166
|
* const kmd = getAlgoKmdClient()
|
|
167
167
|
* ```
|
|
168
|
-
* @example Custom (e.g. default
|
|
169
|
-
* ```
|
|
168
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
169
|
+
* ```typescript
|
|
170
170
|
* const kmd = getAlgoKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
171
171
|
* ```
|
|
172
172
|
*/
|
|
173
173
|
function getAlgoKmdClient(config) {
|
|
174
174
|
const { token, server } = config ?? getAlgodConfigFromEnvironment();
|
|
175
|
-
// We can only use Kmd on the
|
|
175
|
+
// We can only use Kmd on the LocalNet otherwise it's not exposed so this makes some assumptions
|
|
176
176
|
// (e.g. same token and server as algod and port 4002 by default)
|
|
177
177
|
return new algosdk_1.Kmd(token, server, process?.env?.KMD_PORT ?? '4002');
|
|
178
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-client.js","sourceRoot":"","sources":["../src/network-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAwD;AAExD
|
|
1
|
+
{"version":3,"file":"network-client.js","sourceRoot":"","sources":["../src/network-client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAwD;AAExD,qFAA6E;AAG7E,mIAAmI;AACnI,SAAgB,6BAA6B;IAC3C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,kGAAkG,CAAC,CAAA;KACpH;IAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,yGAAyG,CAAC,CAAA;KAC3H;IAED,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QAChC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU;QAC5B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW;KAC/B,CAAA;AACH,CAAC;AAdD,sEAcC;AAED,qIAAqI;AACrI,SAAgB,+BAA+B;IAC7C,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,oGAAoG,CAAC,CAAA;KACtH;IAED,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,6GAA6G,CAAC,CAAA;KAC/H;IAED,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QAClC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY;QAC9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MAAM,mBAAmB,GAAG,IAAI,qDAAuB,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACxG,OAAO,IAAI,iBAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAA;AACzD,CAAC;AAJD,sCAIC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,SAAgB,oBAAoB,CAAC,MAAyB;IAC5D,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,+BAA+B,EAAE,CAAA;IAC3E,MAAM,mBAAmB,GAAG,IAAI,qDAAuB,CAAC,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,qBAAqB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IAC/H,OAAO,IAAI,iBAAO,CAAC,mBAAmB,CAAC,CAAA;AACzC,CAAC;AAJD,oDAIC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,gBAAgB,CAAC,MAAyB;IACxD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,6BAA6B,EAAE,CAAA;IACnE,gGAAgG;IAChG,iEAAiE;IACjE,OAAO,IAAI,aAAG,CAAC,KAAe,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,IAAI,MAAM,CAAC,CAAA;AAC3E,CAAC;AALD,4CAKC;AAED,uCAAuC;AAA9B,sGAAA,UAAU,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
+
"main": "index.js",
|
|
3
|
+
"types": "index.d.ts",
|
|
2
4
|
"name": "@algorandfoundation/algokit-utils",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
5
|
+
"version": "1.0.0-beta.41",
|
|
4
6
|
"private": false,
|
|
5
7
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
6
8
|
"author": "Algorand Foundation",
|
|
@@ -8,101 +10,11 @@
|
|
|
8
10
|
"engines": {
|
|
9
11
|
"node": ">=16.0"
|
|
10
12
|
},
|
|
11
|
-
"main": "./dist/index.js",
|
|
12
13
|
"files": [
|
|
13
|
-
"
|
|
14
|
+
"**/*"
|
|
14
15
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"build": "run-s build:*",
|
|
17
|
-
"build:0-clean": "rimraf dist coverage",
|
|
18
|
-
"build:1-compile": "tsc -p tsconfig.build.json",
|
|
19
|
-
"build:2-copy-pkg-json": "npx --yes @makerx/ts-toolkit@latest copy-package-json",
|
|
20
|
-
"test": "jest --coverage --passWithNoTests",
|
|
21
|
-
"lint": "eslint ./src/ --ext .ts",
|
|
22
|
-
"lint:fix": "eslint ./src/ --ext .ts --fix",
|
|
23
|
-
"check-types": "tsc --noEmit",
|
|
24
|
-
"audit": "npm audit",
|
|
25
|
-
"format": "prettier --write .",
|
|
26
|
-
"commit-lint": "commitlint --edit -o",
|
|
27
|
-
"semantic-release": "semantic-release"
|
|
28
|
-
},
|
|
29
16
|
"dependencies": {
|
|
30
|
-
"algosdk": "^2.
|
|
17
|
+
"algosdk": "^2.2.0",
|
|
31
18
|
"buffer": "^6.0.3"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@commitlint/cli": "^17.4.3",
|
|
35
|
-
"@commitlint/config-conventional": "^17.4.3",
|
|
36
|
-
"@makerx/eslint-config": "3.0.0",
|
|
37
|
-
"@makerx/prettier-config": "2.0.0",
|
|
38
|
-
"@makerx/ts-config": "1.0.1",
|
|
39
|
-
"@tsconfig/node16": "^1.0.3",
|
|
40
|
-
"@types/jest": "^29.2.3",
|
|
41
|
-
"@types/uuid": "^9.0.1",
|
|
42
|
-
"conventional-changelog-conventionalcommits": "^5.0.0",
|
|
43
|
-
"eslint": "8.36.0",
|
|
44
|
-
"npm-run-all": "^4.1.5",
|
|
45
|
-
"prettier": "2.8.4",
|
|
46
|
-
"rimraf": "^4.4.0",
|
|
47
|
-
"semantic-release": "^20.1.0",
|
|
48
|
-
"tiny-invariant": "^1.3.1",
|
|
49
|
-
"ts-jest": "^29.0.3",
|
|
50
|
-
"ts-node": "^10.9.1",
|
|
51
|
-
"typescript": "^4.9.3",
|
|
52
|
-
"uuid": "^9.0.0"
|
|
53
|
-
},
|
|
54
|
-
"release": {
|
|
55
|
-
"branches": [
|
|
56
|
-
{
|
|
57
|
-
"name": "main",
|
|
58
|
-
"prerelease": "beta"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"name": "release"
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
"plugins": [
|
|
65
|
-
[
|
|
66
|
-
"@semantic-release/commit-analyzer",
|
|
67
|
-
{
|
|
68
|
-
"preset": "conventionalcommits",
|
|
69
|
-
"releaseRules": [
|
|
70
|
-
{
|
|
71
|
-
"type": "build",
|
|
72
|
-
"release": "patch"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"type": "chore",
|
|
76
|
-
"release": "patch"
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
[
|
|
82
|
-
"@semantic-release/release-notes-generator",
|
|
83
|
-
{
|
|
84
|
-
"preset": "conventionalcommits",
|
|
85
|
-
"presetConfig": {
|
|
86
|
-
"types": [
|
|
87
|
-
{
|
|
88
|
-
"type": "feat",
|
|
89
|
-
"section": "Features"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"type": "fix",
|
|
93
|
-
"section": "Bug Fixes"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"type": "build",
|
|
97
|
-
"section": "Dependencies and Other Build Updates",
|
|
98
|
-
"hidden": false
|
|
99
|
-
}
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
"@semantic-release/npm",
|
|
105
|
-
"@semantic-release/github"
|
|
106
|
-
]
|
|
107
19
|
}
|
|
108
20
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Account, Algodv2, Kmd } from 'algosdk';
|
|
2
|
+
import { GetTestAccountParams } from '../types/testing';
|
|
3
|
+
/**
|
|
4
|
+
* Creates an ephemeral Algorand account for the purposes of testing.
|
|
5
|
+
* Returns a newly created random test account that is funded from the dispenser
|
|
6
|
+
* DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!
|
|
7
|
+
* Note: By default this will log the mnemonic of the account.
|
|
8
|
+
* @param param0 The config for the test account to generate
|
|
9
|
+
* @param algod An algod client
|
|
10
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
11
|
+
* @returns The account, with private key loaded
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTestAccount({ suppressLog, initialFunds }: GetTestAccountParams, algod: Algodv2, kmd?: Kmd): Promise<Account>;
|
|
14
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/testing/account.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAIxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBrI"}
|