@algorandfoundation/algokit-utils 1.0.0 → 1.1.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/account.d.ts +11 -10
- package/account.d.ts.map +1 -1
- package/account.js +13 -12
- package/account.js.map +1 -1
- package/amount.d.ts +15 -3
- package/amount.d.ts.map +1 -1
- package/amount.js +15 -3
- package/amount.js.map +1 -1
- 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/{deploy-app.d.ts → app-deploy.d.ts} +16 -14
- package/app-deploy.d.ts.map +1 -0
- package/{deploy-app.js → app-deploy.js} +47 -28
- package/app-deploy.js.map +1 -0
- package/app.d.ts +53 -8
- package/app.d.ts.map +1 -1
- package/app.js +305 -146
- package/app.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/indexer-lookup.d.ts +11 -4
- package/indexer-lookup.d.ts.map +1 -1
- package/indexer-lookup.js +19 -9
- package/indexer-lookup.js.map +1 -1
- package/localnet.d.ts +7 -7
- package/localnet.js +7 -7
- package/network-client.d.ts +4 -4
- package/network-client.js +5 -5
- package/network-client.js.map +1 -1
- package/package.json +1 -1
- package/testing/account.d.ts +2 -2
- package/testing/account.js +2 -2
- package/testing/fixtures/algorand-fixture.d.ts +6 -2
- package/testing/fixtures/algorand-fixture.d.ts.map +1 -1
- package/testing/fixtures/algorand-fixture.js +19 -8
- package/testing/fixtures/algorand-fixture.js.map +1 -1
- package/testing/indexer.d.ts.map +1 -1
- package/testing/indexer.js +1 -0
- package/testing/indexer.js.map +1 -1
- package/testing/test-logger.d.ts +3 -1
- package/testing/test-logger.d.ts.map +1 -1
- package/testing/test-logger.js +4 -2
- package/testing/test-logger.js.map +1 -1
- package/testing/transaction-logger.d.ts +4 -4
- package/testing/transaction-logger.d.ts.map +1 -1
- package/testing/transaction-logger.js +4 -4
- package/testing/transaction-logger.js.map +1 -1
- package/transaction.d.ts +54 -13
- package/transaction.d.ts.map +1 -1
- package/transaction.js +201 -93
- package/transaction.js.map +1 -1
- package/transfer.d.ts +4 -3
- package/transfer.d.ts.map +1 -1
- package/transfer.js +10 -8
- package/transfer.js.map +1 -1
- package/types/account.d.ts +6 -3
- package/types/account.d.ts.map +1 -1
- package/types/account.js +7 -2
- package/types/account.js.map +1 -1
- package/types/algo-http-client-with-retry.js +1 -1
- package/types/algo-http-client-with-retry.js.map +1 -1
- package/types/algod.d.ts +6 -6
- package/types/algod.d.ts.map +1 -1
- package/types/amount.d.ts +6 -2
- package/types/amount.d.ts.map +1 -1
- package/types/amount.js +6 -2
- package/types/amount.js.map +1 -1
- package/types/{application-client.d.ts → app-client.d.ts} +75 -22
- package/types/app-client.d.ts.map +1 -0
- package/types/{application-client.js → app-client.js} +135 -56
- package/types/app-client.js.map +1 -0
- package/types/app-spec.d.ts +136 -0
- package/types/app-spec.d.ts.map +1 -0
- package/types/{appspec.js → app-spec.js} +5 -7
- package/types/app-spec.js.map +1 -0
- package/types/app.d.ts +23 -17
- package/types/app.d.ts.map +1 -1
- package/types/app.js.map +1 -1
- package/types/config.d.ts +19 -2
- package/types/config.d.ts.map +1 -1
- package/types/config.js +28 -2
- package/types/config.js.map +1 -1
- package/types/indexer.d.ts +360 -49
- package/types/indexer.d.ts.map +1 -1
- package/types/indexer.js +9 -0
- package/types/indexer.js.map +1 -1
- package/types/logic-error.d.ts +5 -1
- package/types/logic-error.d.ts.map +1 -1
- package/types/logic-error.js +6 -2
- package/types/logic-error.js.map +1 -1
- package/types/testing.d.ts +9 -9
- package/types/testing.d.ts.map +1 -1
- package/types/transaction.d.ts +54 -9
- package/types/transaction.d.ts.map +1 -1
- package/types/transfer.d.ts +7 -7
- package/types/transfer.d.ts.map +1 -1
- package/application-client.d.ts +0 -10
- package/application-client.d.ts.map +0 -1
- package/application-client.js +0 -15
- package/application-client.js.map +0 -1
- package/deploy-app.d.ts.map +0 -1
- package/deploy-app.js.map +0 -1
- package/types/application-client.d.ts.map +0 -1
- package/types/application-client.js.map +0 -1
- package/types/appspec.d.ts +0 -77
- package/types/appspec.d.ts.map +0 -1
- package/types/appspec.js.map +0 -1
package/index.js
CHANGED
|
@@ -19,8 +19,8 @@ const config_1 = require("./types/config");
|
|
|
19
19
|
__exportStar(require("./account"), exports);
|
|
20
20
|
__exportStar(require("./amount"), exports);
|
|
21
21
|
__exportStar(require("./app"), exports);
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./deploy
|
|
22
|
+
__exportStar(require("./app-client"), exports);
|
|
23
|
+
__exportStar(require("./app-deploy"), exports);
|
|
24
24
|
__exportStar(require("./indexer-lookup"), exports);
|
|
25
25
|
__exportStar(require("./localnet"), exports);
|
|
26
26
|
__exportStar(require("./network-client"), exports);
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAgD;AAEhD,4CAAyB;AACzB,2CAAwB;AACxB,wCAAqB;AACrB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,2CAAgD;AAEhD,4CAAyB;AACzB,2CAAwB;AACxB,wCAAqB;AACrB,+CAA4B;AAC5B,+CAA4B;AAC5B,mDAAgC;AAChC,6CAA0B;AAC1B,mDAAgC;AAChC,gDAA6B;AAC7B,6CAA0B;AAE1B,iEAAiE;AACpD,QAAA,MAAM,GAAG,IAAI,wBAAe,EAAE,CAAA"}
|
package/indexer-lookup.d.ts
CHANGED
|
@@ -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>;
|
package/indexer-lookup.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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"}
|
package/indexer-lookup.js
CHANGED
|
@@ -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;
|
package/indexer-lookup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer-lookup.js","sourceRoot":"","sources":["../src/indexer-lookup.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"indexer-lookup.js","sourceRoot":"","sources":["../src/indexer-lookup.ts"],"names":[],"mappings":";;;AAUA,MAAM,6CAA6C,GAAG,IAAI,CAAA,CAAC,yFAAyF;AAEpJ;;;;;GAKG;AACI,KAAK,UAAU,qBAAqB,CAAC,aAAqB,EAAE,OAAgB;IACjF,OAAO,CAAC,MAAM,OAAO,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC,EAAE,EAAE,CAA4B,CAAA;AAC7F,CAAC;AAFD,sDAEC;AAED;;;;;GAKG;AACI,KAAK,UAAU,sBAAsB,CAAC,cAAsB,EAAE,OAAgB;IACnF,OAAO,CAAC,MAAM,OAAO,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,EAAE,EAAE,CAAwB,CAAA;AACtF,CAAC;AAFD,wDAEC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,wCAAwC,CAC5D,OAAgB,EAChB,OAAe,EACf,SAA8B,SAAS,EACvC,eAAwB;IAExB,OAAO,MAAM,uBAAuB,CAClC,CAAC,QAA8D,EAAE,EAAE;QACjE,IAAI,SAAS,IAAI,QAAQ,EAAE;YACzB,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAA;SACnC;QACD,OAAO,QAAQ,CAAC,YAAY,CAAA;IAC9B,CAAC,EACD,CAAC,SAAS,EAAE,EAAE;QACZ,IAAI,CAAC,GAAG,OAAO;aACZ,gCAAgC,CAAC,OAAO,CAAC;aACzC,UAAU,CAAC,MAAM,CAAC;aAClB,KAAK,CAAC,eAAe,IAAI,6CAA6C,CAAC,CAAA;QAC1E,IAAI,SAAS,EAAE;YAC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GAAG,YAAY,CAAC,SAAS,CAAC,CAAA;QACvC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,EAAE,EAAE,CAAA;QACnC,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;QACpC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,MAAK;SACN;QACD,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,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"}
|
package/localnet.d.ts
CHANGED
|
@@ -5,17 +5,17 @@ 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,7 +30,7 @@ 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
|
|
@@ -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 kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
51
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
52
52
|
*/
|
|
53
53
|
export declare function getLocalNetDispenserAccount(algod: Algodv2, kmd?: Kmd): Promise<Account>;
|
|
54
54
|
//# sourceMappingURL=localnet.d.ts.map
|
package/localnet.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -64,7 +64,7 @@ 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
|
|
@@ -108,7 +108,7 @@ exports.getKmdWalletAccount = getKmdWalletAccount;
|
|
|
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 kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
111
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
112
112
|
*/
|
|
113
113
|
async function getLocalNetDispenserAccount(algod, kmd) {
|
|
114
114
|
if (!(await isLocalNet(algod))) {
|
package/network-client.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare function getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexe
|
|
|
36
36
|
* const algod = getAlgoClient(getAlgoNodeConfig('mainnet', 'algod'))
|
|
37
37
|
* await algod.healthCheck().do()
|
|
38
38
|
* ```
|
|
39
|
-
* @example Custom (e.g. default
|
|
39
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
40
40
|
* ```typescript
|
|
41
41
|
* const algod = getAlgoClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
42
42
|
* await algod.healthCheck().do()
|
|
@@ -64,7 +64,7 @@ export declare function getAlgoClient(config?: AlgoClientConfig): Algodv2;
|
|
|
64
64
|
* const indexer = getAlgoIndexerClient(getAlgoNodeConfig('mainnet', 'indexer'))
|
|
65
65
|
* await indexer.makeHealthCheck().do()
|
|
66
66
|
* ```
|
|
67
|
-
* @example Custom (e.g. default
|
|
67
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
68
68
|
* ```typescript
|
|
69
69
|
* const indexer = getAlgoIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
70
70
|
* await indexer.makeHealthCheck().do()
|
|
@@ -74,7 +74,7 @@ export declare function getAlgoIndexerClient(config?: AlgoClientConfig): Indexer
|
|
|
74
74
|
/**
|
|
75
75
|
* Returns a KMD SDK client that automatically retries on idempotent calls
|
|
76
76
|
*
|
|
77
|
-
* 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.
|
|
78
78
|
*
|
|
79
79
|
* @param config The config if you want to override the default (getting config from process.env)
|
|
80
80
|
* @example Default (load from environment variables)
|
|
@@ -83,7 +83,7 @@ export declare function getAlgoIndexerClient(config?: AlgoClientConfig): Indexer
|
|
|
83
83
|
* // Uses process.env.ALGOD_SERVER, process.env.KMD_PORT (or if not specified: port 4002) and process.env.ALGOD_TOKEN
|
|
84
84
|
* const kmd = getAlgoKmdClient()
|
|
85
85
|
* ```
|
|
86
|
-
* @example Custom (e.g. default
|
|
86
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
87
87
|
* ```typescript
|
|
88
88
|
* const kmd = getAlgoKmdClient({server: 'http://localhost', port: '4002', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
89
89
|
* ```
|
package/network-client.js
CHANGED
|
@@ -108,7 +108,7 @@ function getAlgoTokenHeader(server, token, defaultHeader) {
|
|
|
108
108
|
* const algod = getAlgoClient(getAlgoNodeConfig('mainnet', 'algod'))
|
|
109
109
|
* await algod.healthCheck().do()
|
|
110
110
|
* ```
|
|
111
|
-
* @example Custom (e.g. default
|
|
111
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
112
112
|
* ```typescript
|
|
113
113
|
* const algod = getAlgoClient({server: 'http://localhost', port: '4001', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
114
114
|
* await algod.healthCheck().do()
|
|
@@ -141,7 +141,7 @@ exports.getAlgoClient = getAlgoClient;
|
|
|
141
141
|
* const indexer = getAlgoIndexerClient(getAlgoNodeConfig('mainnet', 'indexer'))
|
|
142
142
|
* await indexer.makeHealthCheck().do()
|
|
143
143
|
* ```
|
|
144
|
-
* @example Custom (e.g. default
|
|
144
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
145
145
|
* ```typescript
|
|
146
146
|
* const indexer = getAlgoIndexerClient({server: 'http://localhost', port: '8980', token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'})
|
|
147
147
|
* await indexer.makeHealthCheck().do()
|
|
@@ -156,7 +156,7 @@ 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)
|
|
@@ -165,14 +165,14 @@ exports.getAlgoIndexerClient = getAlgoIndexerClient;
|
|
|
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
|
|
168
|
+
* @example Custom (e.g. default LocalNet, although we recommend loading this into a .env and using the Default option instead)
|
|
169
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
|
}
|
package/network-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;QAC9B,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa;KACjC,CAAA;AACH,CAAC;AAdD,0EAcC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAA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AAI,MAAM,CAAC,CAAA;AAC3E,CAAC;AALD,4CAKC;AAED,uCAAuC;AAA9B,sGAAA,UAAU,OAAA"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"main": "index.js",
|
|
3
3
|
"types": "index.d.ts",
|
|
4
4
|
"name": "@algorandfoundation/algokit-utils",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.1.1-beta.1",
|
|
6
6
|
"private": false,
|
|
7
7
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
8
8
|
"author": "Algorand Foundation",
|
package/testing/account.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { Account, Algodv2, Kmd } from 'algosdk';
|
|
|
2
2
|
import { GetTestAccountParams } from '../types/testing';
|
|
3
3
|
/**
|
|
4
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
|
|
5
|
+
* Returns a newly created random test account that is funded from the dispenser
|
|
6
6
|
* DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!
|
|
7
7
|
* Note: By default this will log the mnemonic of the account.
|
|
8
8
|
* @param param0 The config for the test account to generate
|
|
9
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
|
|
10
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
11
11
|
* @returns The account, with private key loaded
|
|
12
12
|
*/
|
|
13
13
|
export declare function getTestAccount({ suppressLog, initialFunds }: GetTestAccountParams, algod: Algodv2, kmd?: Kmd): Promise<Account>;
|
package/testing/account.js
CHANGED
|
@@ -10,12 +10,12 @@ const account_1 = require("../account");
|
|
|
10
10
|
const transfer_1 = require("../transfer");
|
|
11
11
|
/**
|
|
12
12
|
* Creates an ephemeral Algorand account for the purposes of testing.
|
|
13
|
-
* Returns a newly created random test account that is funded from the dispenser
|
|
13
|
+
* Returns a newly created random test account that is funded from the dispenser
|
|
14
14
|
* DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!
|
|
15
15
|
* Note: By default this will log the mnemonic of the account.
|
|
16
16
|
* @param param0 The config for the test account to generate
|
|
17
17
|
* @param algod An algod client
|
|
18
|
-
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
18
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
19
19
|
* @returns The account, with private key loaded
|
|
20
20
|
*/
|
|
21
21
|
async function getTestAccount({ suppressLog, initialFunds }, algod, kmd) {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { AlgorandFixture, AlgorandFixtureConfig } from '../../types/testing';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a test fixture for automated testing against Algorand.
|
|
4
|
-
* By default it tests against
|
|
4
|
+
* By default it tests against an environment variable specified client
|
|
5
|
+
* if the standard environment variables are specified, otherwise against
|
|
6
|
+
* a default LocalNet instance, but you can pass in an algod, indexer
|
|
7
|
+
* and/or kmd if you want to test against an explicitly defined network.
|
|
5
8
|
*
|
|
6
9
|
* @example ```typescript
|
|
7
10
|
* const algorand = algorandFixture()
|
|
8
11
|
*
|
|
9
12
|
* beforeEach(algorand.beforeEach, 10_000)
|
|
10
13
|
*
|
|
11
|
-
* test('My test', () => {
|
|
14
|
+
* test('My test', async () => {
|
|
12
15
|
* const {algod, indexer, testAccount, ...} = algorand.context
|
|
16
|
+
* // test things...
|
|
13
17
|
* })
|
|
14
18
|
* ```
|
|
15
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-fixture.d.ts","sourceRoot":"","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"algorand-fixture.d.ts","sourceRoot":"","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAuD,MAAM,qBAAqB,CAAA;AAEjI;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe,mBAAoB,qBAAqB,KAAG,eAyCvE,CAAA"}
|
|
@@ -5,15 +5,19 @@ const __1 = require("../");
|
|
|
5
5
|
const __2 = require("../../");
|
|
6
6
|
/**
|
|
7
7
|
* Creates a test fixture for automated testing against Algorand.
|
|
8
|
-
* By default it tests against
|
|
8
|
+
* By default it tests against an environment variable specified client
|
|
9
|
+
* if the standard environment variables are specified, otherwise against
|
|
10
|
+
* a default LocalNet instance, but you can pass in an algod, indexer
|
|
11
|
+
* and/or kmd if you want to test against an explicitly defined network.
|
|
9
12
|
*
|
|
10
13
|
* @example ```typescript
|
|
11
14
|
* const algorand = algorandFixture()
|
|
12
15
|
*
|
|
13
16
|
* beforeEach(algorand.beforeEach, 10_000)
|
|
14
17
|
*
|
|
15
|
-
* test('My test', () => {
|
|
18
|
+
* test('My test', async () => {
|
|
16
19
|
* const {algod, indexer, testAccount, ...} = algorand.context
|
|
20
|
+
* // test things...
|
|
17
21
|
* })
|
|
18
22
|
* ```
|
|
19
23
|
*
|
|
@@ -21,18 +25,25 @@ const __2 = require("../../");
|
|
|
21
25
|
* @returns The fixture
|
|
22
26
|
*/
|
|
23
27
|
const algorandFixture = (fixtureConfig) => {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
28
|
+
const algodConfig = process && process.env && process.env.ALGOD_SERVER ? (0, __2.getAlgodConfigFromEnvironment)() : (0, __2.getDefaultLocalNetConfig)('algod');
|
|
29
|
+
const indexerConfig = process && process.env && process.env.INDEXER_SERVER ? (0, __2.getIndexerConfigFromEnvironment)() : (0, __2.getDefaultLocalNetConfig)('indexer');
|
|
30
|
+
const kmdConfig = process && process.env && process.env.ALGOD_SERVER
|
|
31
|
+
? { ...algodConfig, port: process?.env?.KMD_PORT ?? '4002' }
|
|
32
|
+
: (0, __2.getDefaultLocalNetConfig)('kmd');
|
|
33
|
+
const algod = fixtureConfig?.algod ?? (0, __2.getAlgoClient)(algodConfig);
|
|
34
|
+
const indexer = fixtureConfig?.indexer ?? (0, __2.getAlgoIndexerClient)(indexerConfig);
|
|
35
|
+
const kmd = fixtureConfig?.kmd ?? (0, __2.getAlgoKmdClient)(kmdConfig);
|
|
27
36
|
let context;
|
|
28
37
|
const beforeEach = async () => {
|
|
38
|
+
__2.Config.configure({ debug: true });
|
|
29
39
|
const transactionLogger = new __1.TransactionLogger();
|
|
40
|
+
const transactionLoggerAlgod = transactionLogger.capture(algod);
|
|
30
41
|
context = {
|
|
31
|
-
algod:
|
|
42
|
+
algod: transactionLoggerAlgod,
|
|
32
43
|
indexer: indexer,
|
|
33
44
|
kmd: kmd,
|
|
34
|
-
testAccount: await (0, __1.getTestAccount)({ initialFunds: fixtureConfig?.testAccountFunding ?? (0, __2.algos)(10), suppressLog: true },
|
|
35
|
-
generateAccount: (params) => (0, __1.getTestAccount)(params,
|
|
45
|
+
testAccount: await (0, __1.getTestAccount)({ initialFunds: fixtureConfig?.testAccountFunding ?? (0, __2.algos)(10), suppressLog: true }, transactionLoggerAlgod, kmd),
|
|
46
|
+
generateAccount: (params) => (0, __1.getTestAccount)(params, transactionLoggerAlgod, kmd),
|
|
36
47
|
transactionLogger: transactionLogger,
|
|
37
48
|
waitForIndexer: () => transactionLogger.waitForIndexer(indexer),
|
|
38
49
|
waitForIndexerTransaction: (transactionId) => (0, __1.runWhenIndexerCaughtUp)(() => (0, __2.lookupTransactionById)(transactionId, indexer)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"algorand-fixture.js","sourceRoot":"","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"names":[],"mappings":";;;AAAA,2BAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"algorand-fixture.js","sourceRoot":"","sources":["../../../src/testing/fixtures/algorand-fixture.ts"],"names":[],"mappings":";;;AAAA,2BAA+E;AAC/E,8BAUe;AAIf;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,eAA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B,OAAO,EAAE,OAAO;YAChB,GAAG,EAAE,GAAG;YACR,WAAW,EAAE,MAAM,IAAA,kBAAc,EAC/B,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,IAAI,IAAA,SAAK,EAAC,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,EACnF,sBAAsB,EACtB,GAAG,CACJ;YACD,eAAe,EAAE,CAAC,MAA4B,EAAE,EAAE,CAAC,IAAA,kBAAc,EAAC,MAAM,EAAE,sBAAsB,EAAE,GAAG,CAAC;YACtG,iBAAiB,EAAE,iBAAiB;YACpC,cAAc,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,cAAc,CAAC,OAAO,CAAC;YAC/D,yBAAyB,EAAE,CAAC,aAAqB,EAAE,EAAE,CAAC,IAAA,0BAAsB,EAAC,GAAG,EAAE,CAAC,IAAA,yBAAqB,EAAC,aAAa,EAAE,OAAO,CAAC,CAAC;SAClI,CAAA;IACH,CAAC,CAAA;IAED,OAAO;QACL,IAAI,OAAO;YACT,OAAO,OAAO,CAAA;QAChB,CAAC;QACD,UAAU;KACX,CAAA;AACH,CAAC,CAAA;AAzCY,QAAA,eAAe,mBAyC3B"}
|
package/testing/indexer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/testing/indexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/testing/indexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAuBjF"}
|
package/testing/indexer.js
CHANGED
package/testing/indexer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../src/testing/indexer.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACI,KAAK,UAAU,sBAAsB,CAAI,GAAqB;IACnE,IAAI,MAAM,GAAa,IAAI,CAAA;IAC3B,IAAI,EAAE,GAAG,KAAK,CAAA;IACd,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,OAAO,CAAC,EAAE,EAAE;QACV,IAAI;YACF,MAAM,GAAG,MAAM,GAAG,EAAE,CAAA;YACpB,EAAE,GAAG,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../src/testing/indexer.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACI,KAAK,UAAU,sBAAsB,CAAI,GAAqB;IACnE,IAAI,MAAM,GAAa,IAAI,CAAA;IAC3B,IAAI,EAAE,GAAG,KAAK,CAAA;IACd,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,OAAO,CAAC,EAAE,EAAE;QACV,IAAI;YACF,MAAM,GAAG,MAAM,GAAG,EAAE,CAAA;YACpB,EAAE,GAAG,IAAI,CAAA;YACT,8DAA8D;SAC/D;QAAC,OAAO,CAAM,EAAE;YACf,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,EAAE;gBACrB,KAAK,EAAE,CAAA;gBACP,IAAI,KAAK,GAAG,EAAE,EAAE;oBACd,MAAM,CAAC,CAAA;iBACR;gBACD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAA;aAC/D;iBAAM;gBACL,MAAM,CAAC,CAAA;aACR;SACF;KACF;IAED,OAAO,MAAW,CAAA;AACpB,CAAC;AAvBD,wDAuBC"}
|
package/testing/test-logger.d.ts
CHANGED
|
@@ -19,7 +19,9 @@ export declare class TestLogger implements Logger {
|
|
|
19
19
|
* Returns a captured log snapshot.
|
|
20
20
|
* This helps ensure that the provided configuration items won't appear
|
|
21
21
|
* with random values in the log snapshot, but rather will get substituted with predictable ids.
|
|
22
|
-
*
|
|
22
|
+
*
|
|
23
|
+
* https://jestjs.io/docs/snapshot-testing#2-tests-should-be-deterministic
|
|
24
|
+
*
|
|
23
25
|
* @example Jest Example
|
|
24
26
|
* ```typescript
|
|
25
27
|
* const logger = new TestLogger()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-logger.d.ts","sourceRoot":"","sources":["../../src/testing/test-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD;;GAEG;AACH,qBAAa,UAAW,YAAW,MAAM;IACvC,OAAO,CAAC,cAAc,CAAoB;IAC1C,OAAO,CAAC,IAAI,CAAU;IAEtB;;;OAGG;gBACS,cAAc,CAAC,EAAE,MAAM;IAKnC,0CAA0C;IAC1C,IAAI,YAAY,IAAI,MAAM,EAAE,CAE3B;IAED,uCAAuC;IACvC,KAAK;IAIL
|
|
1
|
+
{"version":3,"file":"test-logger.d.ts","sourceRoot":"","sources":["../../src/testing/test-logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAEpD;;GAEG;AACH,qBAAa,UAAW,YAAW,MAAM;IACvC,OAAO,CAAC,cAAc,CAAoB;IAC1C,OAAO,CAAC,IAAI,CAAU;IAEtB;;;OAGG;gBACS,cAAc,CAAC,EAAE,MAAM;IAKnC,0CAA0C;IAC1C,IAAI,YAAY,IAAI,MAAM,EAAE,CAE3B;IAED,uCAAuC;IACvC,KAAK;IAIL;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,MAAM,CAAC,EAAE,iBAAiB;IAczC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI;IAI1D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI;IAIzD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI;IAIzD,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI;IAI5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI;CAI3D"}
|
package/testing/test-logger.js
CHANGED
|
@@ -26,7 +26,9 @@ class TestLogger {
|
|
|
26
26
|
* Returns a captured log snapshot.
|
|
27
27
|
* This helps ensure that the provided configuration items won't appear
|
|
28
28
|
* with random values in the log snapshot, but rather will get substituted with predictable ids.
|
|
29
|
-
*
|
|
29
|
+
*
|
|
30
|
+
* https://jestjs.io/docs/snapshot-testing#2-tests-should-be-deterministic
|
|
31
|
+
*
|
|
30
32
|
* @example Jest Example
|
|
31
33
|
* ```typescript
|
|
32
34
|
* const logger = new TestLogger()
|
|
@@ -41,7 +43,7 @@ class TestLogger {
|
|
|
41
43
|
let snapshot = this.capturedLogs.join('\n');
|
|
42
44
|
transactionIds?.forEach((txn, id) => (snapshot = snapshot.replace(new RegExp(typeof txn === 'string' ? txn : txn.txID(), 'g'), `TXID_${id + 1}`)));
|
|
43
45
|
accounts?.forEach((sender, id) => (snapshot = snapshot.replace(new RegExp(typeof sender === 'string' ? sender : (0, __1.getSenderAddress)(sender), 'g'), `ACCOUNT_${id + 1}`)));
|
|
44
|
-
apps?.forEach((app, id) => (snapshot = snapshot.replace(new RegExp(`\\b${app.toString()}\\b`, 'g'), `APP_${id + 1}`)));
|
|
46
|
+
apps?.forEach((app, id) => (snapshot = snapshot.replace(new RegExp(`\\b${app.toString()}\\b(?! bytes)`, 'g'), `APP_${id + 1}`)));
|
|
45
47
|
return snapshot;
|
|
46
48
|
}
|
|
47
49
|
error(message, ...optionalParams) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-logger.js","sourceRoot":"","sources":["../../src/testing/test-logger.ts"],"names":[],"mappings":";;;AAAA,2BAAsC;AAItC;;GAEG;AACH,MAAa,UAAU;IAIrB;;;OAGG;IACH,YAAY,cAAuB;QACjC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,CAAC;IAED,0CAA0C;IAC1C,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAED,uCAAuC;IACvC,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"test-logger.js","sourceRoot":"","sources":["../../src/testing/test-logger.ts"],"names":[],"mappings":";;;AAAA,2BAAsC;AAItC;;GAEG;AACH,MAAa,UAAU;IAIrB;;;OAGG;IACH,YAAY,cAAuB;QACjC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAA;QACpC,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,CAAC;IAED,0CAA0C;IAC1C,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,IAAI,CAAA;IAClB,CAAC;IAED,uCAAuC;IACvC,KAAK;QACH,IAAI,CAAC,IAAI,GAAG,EAAE,CAAA;IAChB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,MAA0B;QACvC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAA;QACrE,IAAI,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3C,cAAc,EAAE,OAAO,CACrB,CA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,CAAC;CACF;AAzED,gCAyEC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Algodv2, Indexer } from 'algosdk';
|
|
2
2
|
/**
|
|
3
|
-
* Allows you to keep track of Algorand transaction IDs by wrapping an
|
|
3
|
+
* Allows you to keep track of Algorand transaction IDs by wrapping an `Algodv2` in a proxy.
|
|
4
4
|
* Useful for automated tests.
|
|
5
5
|
*/
|
|
6
6
|
export declare class TransactionLogger {
|
|
@@ -19,11 +19,11 @@ export declare class TransactionLogger {
|
|
|
19
19
|
logRawTransaction(signedTransactions: Uint8Array | Uint8Array[]): void;
|
|
20
20
|
/** Return a proxy that wraps the given Algodv2 with this transaction logger.
|
|
21
21
|
*
|
|
22
|
-
* @param algod The
|
|
23
|
-
* @returns The wrapped
|
|
22
|
+
* @param algod The `Algodv2` to wrap
|
|
23
|
+
* @returns The wrapped `Algodv2`, any transactions sent using this algod instance will be logged by this transaction logger
|
|
24
24
|
*/
|
|
25
25
|
capture(algod: Algodv2): Algodv2;
|
|
26
|
-
/** Wait until all logged transactions IDs appear in the given
|
|
26
|
+
/** Wait until all logged transactions IDs appear in the given `Indexer`. */
|
|
27
27
|
waitForIndexer(indexer: Indexer): Promise<void>;
|
|
28
28
|
}
|
|
29
29
|
//# sourceMappingURL=transaction-logger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-logger.d.ts","sourceRoot":"","sources":["../../src/testing/transaction-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,OAAO,EAAE,MAAM,SAAS,CAAA;AAGnE;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,mBAAmB,CAAe;IAE1C;;OAEG;IACH,IAAI,kBAAkB,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAE3C;IAED;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,EAAE;IAY/D;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIhC
|
|
1
|
+
{"version":3,"file":"transaction-logger.d.ts","sourceRoot":"","sources":["../../src/testing/transaction-logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAA2B,OAAO,EAAE,MAAM,SAAS,CAAA;AAGnE;;;GAGG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,mBAAmB,CAAe;IAE1C;;OAEG;IACH,IAAI,kBAAkB,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC,CAE3C;IAED;;OAEG;IACH,KAAK;IAIL;;OAEG;IACH,iBAAiB,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,EAAE;IAY/D;;;;OAIG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAIhC,4EAA4E;IACtE,cAAc,CAAC,OAAO,EAAE,OAAO;CAGtC"}
|
|
@@ -4,7 +4,7 @@ exports.TransactionLogger = void 0;
|
|
|
4
4
|
const algosdk_1 = require("algosdk");
|
|
5
5
|
const _1 = require("./");
|
|
6
6
|
/**
|
|
7
|
-
* Allows you to keep track of Algorand transaction IDs by wrapping an
|
|
7
|
+
* Allows you to keep track of Algorand transaction IDs by wrapping an `Algodv2` in a proxy.
|
|
8
8
|
* Useful for automated tests.
|
|
9
9
|
*/
|
|
10
10
|
class TransactionLogger {
|
|
@@ -40,13 +40,13 @@ class TransactionLogger {
|
|
|
40
40
|
}
|
|
41
41
|
/** Return a proxy that wraps the given Algodv2 with this transaction logger.
|
|
42
42
|
*
|
|
43
|
-
* @param algod The
|
|
44
|
-
* @returns The wrapped
|
|
43
|
+
* @param algod The `Algodv2` to wrap
|
|
44
|
+
* @returns The wrapped `Algodv2`, any transactions sent using this algod instance will be logged by this transaction logger
|
|
45
45
|
*/
|
|
46
46
|
capture(algod) {
|
|
47
47
|
return new Proxy(algod, new TransactionLoggingAlgodv2ProxyHandler(this));
|
|
48
48
|
}
|
|
49
|
-
/** Wait until all logged transactions IDs appear in the given
|
|
49
|
+
/** Wait until all logged transactions IDs appear in the given `Indexer`. */
|
|
50
50
|
async waitForIndexer(indexer) {
|
|
51
51
|
await Promise.all(this._sentTransactionIds.map((txnId) => (0, _1.runWhenIndexerCaughtUp)(() => indexer.lookupTransactionByID(txnId).do())));
|
|
52
52
|
}
|