@algorandfoundation/algokit-utils 6.1.1-beta.1 → 6.1.1-beta.2
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/package.json +1 -1
- package/testing/account.d.ts +17 -2
- package/testing/account.d.ts.map +1 -1
- package/testing/account.js +5 -10
- package/testing/account.js.map +1 -1
- package/testing/account.mjs +5 -10
- package/testing/account.mjs.map +1 -1
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"**"
|
|
7
7
|
],
|
|
8
8
|
"name": "@algorandfoundation/algokit-utils",
|
|
9
|
-
"version": "6.1.1-beta.
|
|
9
|
+
"version": "6.1.1-beta.2",
|
|
10
10
|
"private": false,
|
|
11
11
|
"description": "A set of core Algorand utilities written in TypeScript and released via npm that make it easier to build solutions on Algorand.",
|
|
12
12
|
"author": "Algorand Foundation",
|
package/testing/account.d.ts
CHANGED
|
@@ -2,14 +2,29 @@ import algosdk from 'algosdk';
|
|
|
2
2
|
import { AlgorandClient } from '../';
|
|
3
3
|
import { GetTestAccountParams } from '../types/testing';
|
|
4
4
|
import Account = algosdk.Account;
|
|
5
|
+
import Algodv2 = algosdk.Algodv2;
|
|
6
|
+
import Kmd = algosdk.Kmd;
|
|
5
7
|
/**
|
|
8
|
+
* @deprecated Use `getTestAccount(params, algorandClient)` instead. The `algorandClient` object can be created using `AlgorandClient.fromClients({ algod, kmd })`.
|
|
9
|
+
*
|
|
6
10
|
* Creates an ephemeral Algorand account for the purposes of testing.
|
|
7
11
|
* Returns a newly created random test account that is funded from the dispenser
|
|
8
12
|
* DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!
|
|
9
13
|
* Note: By default this will log the mnemonic of the account.
|
|
10
|
-
* @param
|
|
14
|
+
* @param params The config for the test account to generate
|
|
15
|
+
* @param algod An algod client
|
|
16
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
17
|
+
* @returns The account, with private key loaded
|
|
18
|
+
*/
|
|
19
|
+
export declare function getTestAccount(params: GetTestAccountParams, algod: Algodv2, kmd?: Kmd): Promise<Account>;
|
|
20
|
+
/**
|
|
21
|
+
* Creates an ephemeral Algorand account for the purposes of testing.
|
|
22
|
+
* Returns a newly created random test account that is funded from the dispenser
|
|
23
|
+
* DO NOT USE THIS TO CREATE A MAINNET ACCOUNT!
|
|
24
|
+
* Note: By default this will log the mnemonic of the account.
|
|
25
|
+
* @param params The config for the test account to generate
|
|
11
26
|
* @param algorand An AlgorandClient client
|
|
12
27
|
* @returns The account, with private key loaded
|
|
13
28
|
*/
|
|
14
|
-
export declare function getTestAccount(
|
|
29
|
+
export declare function getTestAccount(params: GetTestAccountParams, algorand: AlgorandClient): Promise<Account>;
|
|
15
30
|
//# sourceMappingURL=account.d.ts.map
|
package/testing/account.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/testing/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAU,MAAM,KAAK,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/testing/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,cAAc,EAAU,MAAM,KAAK,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAChC,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAChC,OAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AAExB;;;;;;;;;;;GAWG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;AAC/G;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA"}
|
package/testing/account.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var algosdk = require('algosdk');
|
|
4
|
+
var types_algorandClient = require('../types/algorand-client.js');
|
|
4
5
|
var config = require('../config.js');
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Note: By default this will log the mnemonic of the account.
|
|
11
|
-
* @param param0 The config for the test account to generate
|
|
12
|
-
* @param algorand An AlgorandClient client
|
|
13
|
-
* @returns The account, with private key loaded
|
|
14
|
-
*/
|
|
15
|
-
async function getTestAccount({ suppressLog, initialFunds, accountGetter }, algorand) {
|
|
7
|
+
async function getTestAccount({ suppressLog, initialFunds, accountGetter }, algodOrAlgorandClient, kmd) {
|
|
8
|
+
const algorand = algodOrAlgorandClient instanceof types_algorandClient.AlgorandClient
|
|
9
|
+
? algodOrAlgorandClient
|
|
10
|
+
: types_algorandClient.AlgorandClient.fromClients({ algod: algodOrAlgorandClient, kmd });
|
|
16
11
|
const account = accountGetter ? await accountGetter(algorand) : algosdk.generateAccount();
|
|
17
12
|
config.Config.getLogger(suppressLog).info(`New test account created with address '${account.addr}' and mnemonic '${algosdk.secretKeyToMnemonic(account.sk)}'.`);
|
|
18
13
|
const dispenser = await algorand.account.dispenserFromEnvironment();
|
package/testing/account.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sources":["../../src/testing/account.ts"],"sourcesContent":[null],"names":["Config"],"mappings":"
|
|
1
|
+
{"version":3,"file":"account.js","sources":["../../src/testing/account.ts"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
|
|
|
1
1
|
import algosdk from 'algosdk';
|
|
2
|
+
import { AlgorandClient } from '../types/algorand-client.mjs';
|
|
2
3
|
import { Config } from '../config.mjs';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* Note: By default this will log the mnemonic of the account.
|
|
9
|
-
* @param param0 The config for the test account to generate
|
|
10
|
-
* @param algorand An AlgorandClient client
|
|
11
|
-
* @returns The account, with private key loaded
|
|
12
|
-
*/
|
|
13
|
-
async function getTestAccount({ suppressLog, initialFunds, accountGetter }, algorand) {
|
|
5
|
+
async function getTestAccount({ suppressLog, initialFunds, accountGetter }, algodOrAlgorandClient, kmd) {
|
|
6
|
+
const algorand = algodOrAlgorandClient instanceof AlgorandClient
|
|
7
|
+
? algodOrAlgorandClient
|
|
8
|
+
: AlgorandClient.fromClients({ algod: algodOrAlgorandClient, kmd });
|
|
14
9
|
const account = accountGetter ? await accountGetter(algorand) : algosdk.generateAccount();
|
|
15
10
|
Config.getLogger(suppressLog).info(`New test account created with address '${account.addr}' and mnemonic '${algosdk.secretKeyToMnemonic(account.sk)}'.`);
|
|
16
11
|
const dispenser = await algorand.account.dispenserFromEnvironment();
|
package/testing/account.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.mjs","sources":["../../src/testing/account.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"account.mjs","sources":["../../src/testing/account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AA8BO,eAAe,cAAc,CAClC,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAwB,EAClE,qBAA+C,EAC/C,GAAS,EAAA;AAET,IAAA,MAAM,QAAQ,GACZ,qBAAqB,YAAY,cAAc;AAC7C,UAAE,qBAAqB;AACvB,UAAE,cAAc,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,EAAE,CAAC,CAAA;AAEvE,IAA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