@algorandfoundation/algokit-utils 4.0.0-beta.1 → 4.0.0-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/cjs/dispenser-client.d.ts +6 -6
- package/cjs/dispenser-client.js +8 -8
- package/cjs/transfer.js +2 -2
- package/cjs/types/dispenser-client.d.ts +5 -5
- package/cjs/types/dispenser-client.d.ts.map +1 -1
- package/cjs/types/dispenser-client.js +10 -6
- package/cjs/types/dispenser-client.js.map +1 -1
- package/cjs/types/transfer.d.ts +2 -2
- package/esm/dispenser-client.js +7 -7
- package/esm/transfer.js +3 -3
- package/esm/types/dispenser-client.js +4 -3
- package/esm/types/dispenser-client.js.map +1 -1
- package/package.json +1 -1
- package/types/dispenser-client.d.ts +6 -6
- package/types/types/dispenser-client.d.ts +5 -5
- package/types/types/dispenser-client.d.ts.map +1 -1
- package/types/types/transfer.d.ts +2 -2
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestNetDispenserApiClient, TestNetDispenserApiClientParams } from './types/dispenser-client';
|
|
2
2
|
/**
|
|
3
|
-
* Create a new
|
|
3
|
+
* Create a new TestNetDispenserApiClient instance.
|
|
4
4
|
* Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
|
|
5
5
|
*
|
|
6
|
-
* @param params An object containing parameters for the
|
|
6
|
+
* @param params An object containing parameters for the TestNetDispenserApiClient class.
|
|
7
7
|
* Or null if you want the client to load the access token from the environment variable `ALGOKIT_DISPENSER_ACCESS_TOKEN`.
|
|
8
8
|
* @example
|
|
9
|
-
* const client = algokit.
|
|
9
|
+
* const client = algokit.getTestNetDispenserApiClient(
|
|
10
10
|
* {
|
|
11
11
|
* authToken: 'your_auth_token',
|
|
12
12
|
* requestTimeout: 15,
|
|
13
13
|
* }
|
|
14
14
|
* )
|
|
15
15
|
*
|
|
16
|
-
* @returns An instance of the
|
|
16
|
+
* @returns An instance of the TestNetDispenserApiClient class.
|
|
17
17
|
*/
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function getTestNetDispenserApiClient(params?: TestNetDispenserApiClientParams | null): TestNetDispenserApiClient;
|
|
19
19
|
//# sourceMappingURL=dispenser-client.d.ts.map
|
package/cjs/dispenser-client.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getTestNetDispenserApiClient = void 0;
|
|
4
4
|
const dispenser_client_1 = require("./types/dispenser-client");
|
|
5
5
|
/**
|
|
6
|
-
* Create a new
|
|
6
|
+
* Create a new TestNetDispenserApiClient instance.
|
|
7
7
|
* Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
|
|
8
8
|
*
|
|
9
|
-
* @param params An object containing parameters for the
|
|
9
|
+
* @param params An object containing parameters for the TestNetDispenserApiClient class.
|
|
10
10
|
* Or null if you want the client to load the access token from the environment variable `ALGOKIT_DISPENSER_ACCESS_TOKEN`.
|
|
11
11
|
* @example
|
|
12
|
-
* const client = algokit.
|
|
12
|
+
* const client = algokit.getTestNetDispenserApiClient(
|
|
13
13
|
* {
|
|
14
14
|
* authToken: 'your_auth_token',
|
|
15
15
|
* requestTimeout: 15,
|
|
16
16
|
* }
|
|
17
17
|
* )
|
|
18
18
|
*
|
|
19
|
-
* @returns An instance of the
|
|
19
|
+
* @returns An instance of the TestNetDispenserApiClient class.
|
|
20
20
|
*/
|
|
21
|
-
function
|
|
22
|
-
return new dispenser_client_1.
|
|
21
|
+
function getTestNetDispenserApiClient(params = null) {
|
|
22
|
+
return new dispenser_client_1.TestNetDispenserApiClient(params);
|
|
23
23
|
}
|
|
24
|
-
exports.
|
|
24
|
+
exports.getTestNetDispenserApiClient = getTestNetDispenserApiClient;
|
|
25
25
|
//# sourceMappingURL=dispenser-client.js.map
|
package/cjs/transfer.js
CHANGED
|
@@ -15,7 +15,7 @@ async function fundUsingDispenserApi(dispenserClient, addressToFund, fundAmount)
|
|
|
15
15
|
return { transactionId: response.txId, amount: response.amount };
|
|
16
16
|
}
|
|
17
17
|
async function fundUsingTransfer({ algod, addressToFund, funding, fundAmount, transactionParams, sendParams, note, kmd, }) {
|
|
18
|
-
if (funding.fundingSource instanceof dispenser_client_1.
|
|
18
|
+
if (funding.fundingSource instanceof dispenser_client_1.TestNetDispenserApiClient) {
|
|
19
19
|
throw new Error('Dispenser API client is not supported in this context.');
|
|
20
20
|
}
|
|
21
21
|
const from = funding.fundingSource ?? (await (0, _1.getDispenserAccount)(algod, kmd));
|
|
@@ -82,7 +82,7 @@ async function ensureFunded(funding, algod, kmd) {
|
|
|
82
82
|
const currentSpendingBalance = (0, _1.microAlgos)(balance - minimumBalanceRequirement.microAlgos);
|
|
83
83
|
const fundAmount = (0, util_1.calculateFundAmount)(minSpendingBalance.microAlgos, currentSpendingBalance.microAlgos, minFundingIncrement?.microAlgos ?? 0);
|
|
84
84
|
if (fundAmount !== null) {
|
|
85
|
-
if ((await (0, network_client_1.isTestNet)(algod)) && fundingSource instanceof dispenser_client_1.
|
|
85
|
+
if ((await (0, network_client_1.isTestNet)(algod)) && fundingSource instanceof dispenser_client_1.TestNetDispenserApiClient) {
|
|
86
86
|
return fundUsingDispenserApi(fundingSource, addressToFund, fundAmount);
|
|
87
87
|
}
|
|
88
88
|
else {
|
|
@@ -5,12 +5,12 @@ export interface DispenserFundResponse {
|
|
|
5
5
|
export interface DispenserLimitResponse {
|
|
6
6
|
amount: number;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface TestNetDispenserApiClientParams {
|
|
9
9
|
authToken: string;
|
|
10
10
|
requestTimeout: number | null;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* `
|
|
13
|
+
* `TestNetDispenserApiClient` is a class that provides methods to interact with the [Algorand TestNet Dispenser API](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md).
|
|
14
14
|
* It allows you to fund an address with Algos, refund a transaction, and get the funding limit for the Algo asset.
|
|
15
15
|
*
|
|
16
16
|
* The class requires an authentication token and a request timeout to be initialized. The authentication token can be provided
|
|
@@ -27,7 +27,7 @@ export interface DispenserApiTestnetClientParams {
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```typescript
|
|
30
|
-
* const client = new
|
|
30
|
+
* const client = new TestNetDispenserApiClient({ authToken: 'your_auth_token', requestTimeout: 30 });
|
|
31
31
|
* const fundResponse = await client.fund('your_address', 100);
|
|
32
32
|
* const limitResponse = await client.getLimit();
|
|
33
33
|
* await client.refund('your_transaction_id');
|
|
@@ -35,10 +35,10 @@ export interface DispenserApiTestnetClientParams {
|
|
|
35
35
|
*
|
|
36
36
|
* @throws {Error} If neither the environment variable 'ALGOKIT_DISPENSER_ACCESS_TOKEN' nor the authToken parameter were provided.
|
|
37
37
|
*/
|
|
38
|
-
export declare class
|
|
38
|
+
export declare class TestNetDispenserApiClient {
|
|
39
39
|
private _authToken;
|
|
40
40
|
private _requestTimeout;
|
|
41
|
-
constructor(params:
|
|
41
|
+
constructor(params: TestNetDispenserApiClientParams | null);
|
|
42
42
|
get authToken(): string;
|
|
43
43
|
get requestTimeout(): number;
|
|
44
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispenser-client.d.ts","sourceRoot":"","sources":["../../../src/types/dispenser-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispenser-client.d.ts","sourceRoot":"","sources":["../../../src/types/dispenser-client.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,eAAe,CAAQ;gBAEnB,MAAM,EAAE,+BAA+B,GAAG,IAAI;IAgB1D,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;;;;;;;OASG;YACW,uBAAuB;IAuCrC;;;;;;;OAOG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAY3E;;;;OAIG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAWlD"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
6
|
+
exports.TestNetDispenserApiClient = void 0;
|
|
7
|
+
const cross_fetch_1 = __importDefault(require("cross-fetch"));
|
|
4
8
|
const baseUrl = 'https://api.dispenser.algorandfoundation.tools';
|
|
5
9
|
const dispenserRequestTimeout = 15;
|
|
6
10
|
const dispenserAccessTokenKey = 'ALGOKIT_DISPENSER_ACCESS_TOKEN';
|
|
@@ -16,7 +20,7 @@ const dispenserAssets = {
|
|
|
16
20
|
},
|
|
17
21
|
};
|
|
18
22
|
/**
|
|
19
|
-
* `
|
|
23
|
+
* `TestNetDispenserApiClient` is a class that provides methods to interact with the [Algorand TestNet Dispenser API](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md).
|
|
20
24
|
* It allows you to fund an address with Algos, refund a transaction, and get the funding limit for the Algo asset.
|
|
21
25
|
*
|
|
22
26
|
* The class requires an authentication token and a request timeout to be initialized. The authentication token can be provided
|
|
@@ -33,7 +37,7 @@ const dispenserAssets = {
|
|
|
33
37
|
*
|
|
34
38
|
* @example
|
|
35
39
|
* ```typescript
|
|
36
|
-
* const client = new
|
|
40
|
+
* const client = new TestNetDispenserApiClient({ authToken: 'your_auth_token', requestTimeout: 30 });
|
|
37
41
|
* const fundResponse = await client.fund('your_address', 100);
|
|
38
42
|
* const limitResponse = await client.getLimit();
|
|
39
43
|
* await client.refund('your_transaction_id');
|
|
@@ -41,7 +45,7 @@ const dispenserAssets = {
|
|
|
41
45
|
*
|
|
42
46
|
* @throws {Error} If neither the environment variable 'ALGOKIT_DISPENSER_ACCESS_TOKEN' nor the authToken parameter were provided.
|
|
43
47
|
*/
|
|
44
|
-
class
|
|
48
|
+
class TestNetDispenserApiClient {
|
|
45
49
|
_authToken;
|
|
46
50
|
_requestTimeout;
|
|
47
51
|
constructor(params) {
|
|
@@ -83,7 +87,7 @@ class DispenserApiTestnetClient {
|
|
|
83
87
|
if (body) {
|
|
84
88
|
requestArgs.body = JSON.stringify(body);
|
|
85
89
|
}
|
|
86
|
-
const response = await
|
|
90
|
+
const response = await (0, cross_fetch_1.default)(`${baseUrl}/${urlSuffix}`, requestArgs);
|
|
87
91
|
if (!response.ok) {
|
|
88
92
|
let error_message = `Error processing dispenser API request: ${response.status}`;
|
|
89
93
|
let error_response = null;
|
|
@@ -135,5 +139,5 @@ class DispenserApiTestnetClient {
|
|
|
135
139
|
return { amount: content.amount };
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
|
-
exports.
|
|
142
|
+
exports.TestNetDispenserApiClient = TestNetDispenserApiClient;
|
|
139
143
|
//# sourceMappingURL=dispenser-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispenser-client.js","sourceRoot":"","sources":["../../../src/types/dispenser-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispenser-client.js","sourceRoot":"","sources":["../../../src/types/dispenser-client.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA+B;AAE/B,MAAM,OAAO,GAAG,gDAAgD,CAAA;AAChE,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAClC,MAAM,uBAAuB,GAAG,gCAAgC,CAAA;AAEhE,IAAK,kBAEJ;AAFD,WAAK,kBAAkB;IACrB,2DAAQ,CAAA;AACV,CAAC,EAFI,kBAAkB,KAAlB,kBAAkB,QAEtB;AAED,MAAM,eAAe,GAAG;IACtB,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE;QACzB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,MAAM;KACpB;CACF,CAAA;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAa,yBAAyB;IAC5B,UAAU,CAAQ;IAClB,eAAe,CAAQ;IAE/B,YAAY,MAA8C;QACxD,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;QAE7D,IAAI,MAAM,EAAE,SAAS,EAAE;YACrB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,SAAS,CAAA;SACnC;aAAM,IAAI,gBAAgB,EAAE;YAC3B,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAA;SACnC;aAAM;YACL,MAAM,IAAI,KAAK,CACb,wFAAwF,uBAAuB,kCAAkC,CAClJ,CAAA;SACF;QAED,IAAI,CAAC,eAAe,GAAG,MAAM,EAAE,cAAc,IAAI,uBAAuB,CAAA;IAC1E,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IAED;;;;;;;;;OASG;IACK,KAAK,CAAC,uBAAuB,CACnC,SAAiB,EACjB,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e,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAC1D,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAChG,MAAM,CACP,CAAA;QAED,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACrC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;IACvD,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB;QAC9B,MAAM,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,mBAAmB,EAAE,WAAW,EAAE,EAAE,MAAM,CAAC,CAAA;IAC5G,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,uBAAuB,CACjD,IAAI,CAAC,SAAS,EACd,QAAQ,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,QAAQ,EAChE,IAAI,EACJ,KAAK,CACN,CAAA;QACD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAErC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;IACnC,CAAC;CACF;AA1HD,8DA0HC"}
|
package/cjs/types/transfer.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SuggestedParams } from 'algosdk';
|
|
2
2
|
import { AlgoAmount } from './amount';
|
|
3
|
-
import {
|
|
3
|
+
import { TestNetDispenserApiClient } from './dispenser-client';
|
|
4
4
|
import { SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction';
|
|
5
5
|
/** Parameters for `transferAlgos` call. */
|
|
6
6
|
export interface AlgoTransferParams extends SendTransactionParams {
|
|
@@ -20,7 +20,7 @@ export interface EnsureFundedParams extends SendTransactionParams {
|
|
|
20
20
|
/** The account to fund */
|
|
21
21
|
accountToFund: SendTransactionFrom | string;
|
|
22
22
|
/** The account to use as a funding source, will default to using the dispenser account returned by `algokit.getDispenserAccount` */
|
|
23
|
-
fundingSource?: SendTransactionFrom |
|
|
23
|
+
fundingSource?: SendTransactionFrom | TestNetDispenserApiClient;
|
|
24
24
|
/** The minimum balance of ALGOs that the account should have available to spend (i.e. on top of minimum balance requirement) */
|
|
25
25
|
minSpendingBalance: AlgoAmount;
|
|
26
26
|
/** When issuing a funding amount, the minimum amount to transfer (avoids many small transfers if this gets called often on an active account) */
|
package/esm/dispenser-client.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestNetDispenserApiClient } from './types/dispenser-client';
|
|
2
2
|
/**
|
|
3
|
-
* Create a new
|
|
3
|
+
* Create a new TestNetDispenserApiClient instance.
|
|
4
4
|
* Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
|
|
5
5
|
*
|
|
6
|
-
* @param params An object containing parameters for the
|
|
6
|
+
* @param params An object containing parameters for the TestNetDispenserApiClient class.
|
|
7
7
|
* Or null if you want the client to load the access token from the environment variable `ALGOKIT_DISPENSER_ACCESS_TOKEN`.
|
|
8
8
|
* @example
|
|
9
|
-
* const client = algokit.
|
|
9
|
+
* const client = algokit.getTestNetDispenserApiClient(
|
|
10
10
|
* {
|
|
11
11
|
* authToken: 'your_auth_token',
|
|
12
12
|
* requestTimeout: 15,
|
|
13
13
|
* }
|
|
14
14
|
* )
|
|
15
15
|
*
|
|
16
|
-
* @returns An instance of the
|
|
16
|
+
* @returns An instance of the TestNetDispenserApiClient class.
|
|
17
17
|
*/
|
|
18
|
-
export function
|
|
19
|
-
return new
|
|
18
|
+
export function getTestNetDispenserApiClient(params = null) {
|
|
19
|
+
return new TestNetDispenserApiClient(params);
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=dispenser-client.js.map
|
package/esm/transfer.js
CHANGED
|
@@ -2,14 +2,14 @@ import algosdk from 'algosdk';
|
|
|
2
2
|
import { Config, getDispenserAccount, microAlgos } from './';
|
|
3
3
|
import { isTestNet } from './network-client';
|
|
4
4
|
import { encodeTransactionNote, getSenderAddress, getTransactionParams, sendTransaction } from './transaction';
|
|
5
|
-
import {
|
|
5
|
+
import { TestNetDispenserApiClient } from './types/dispenser-client';
|
|
6
6
|
import { calculateFundAmount } from './util';
|
|
7
7
|
async function fundUsingDispenserApi(dispenserClient, addressToFund, fundAmount) {
|
|
8
8
|
const response = await dispenserClient.fund(addressToFund, fundAmount);
|
|
9
9
|
return { transactionId: response.txId, amount: response.amount };
|
|
10
10
|
}
|
|
11
11
|
async function fundUsingTransfer({ algod, addressToFund, funding, fundAmount, transactionParams, sendParams, note, kmd, }) {
|
|
12
|
-
if (funding.fundingSource instanceof
|
|
12
|
+
if (funding.fundingSource instanceof TestNetDispenserApiClient) {
|
|
13
13
|
throw new Error('Dispenser API client is not supported in this context.');
|
|
14
14
|
}
|
|
15
15
|
const from = funding.fundingSource ?? (await getDispenserAccount(algod, kmd));
|
|
@@ -75,7 +75,7 @@ export async function ensureFunded(funding, algod, kmd) {
|
|
|
75
75
|
const currentSpendingBalance = microAlgos(balance - minimumBalanceRequirement.microAlgos);
|
|
76
76
|
const fundAmount = calculateFundAmount(minSpendingBalance.microAlgos, currentSpendingBalance.microAlgos, minFundingIncrement?.microAlgos ?? 0);
|
|
77
77
|
if (fundAmount !== null) {
|
|
78
|
-
if ((await isTestNet(algod)) && fundingSource instanceof
|
|
78
|
+
if ((await isTestNet(algod)) && fundingSource instanceof TestNetDispenserApiClient) {
|
|
79
79
|
return fundUsingDispenserApi(fundingSource, addressToFund, fundAmount);
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fetch from 'cross-fetch';
|
|
1
2
|
const baseUrl = 'https://api.dispenser.algorandfoundation.tools';
|
|
2
3
|
const dispenserRequestTimeout = 15;
|
|
3
4
|
const dispenserAccessTokenKey = 'ALGOKIT_DISPENSER_ACCESS_TOKEN';
|
|
@@ -13,7 +14,7 @@ const dispenserAssets = {
|
|
|
13
14
|
},
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
|
-
* `
|
|
17
|
+
* `TestNetDispenserApiClient` is a class that provides methods to interact with the [Algorand TestNet Dispenser API](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md).
|
|
17
18
|
* It allows you to fund an address with Algos, refund a transaction, and get the funding limit for the Algo asset.
|
|
18
19
|
*
|
|
19
20
|
* The class requires an authentication token and a request timeout to be initialized. The authentication token can be provided
|
|
@@ -30,7 +31,7 @@ const dispenserAssets = {
|
|
|
30
31
|
*
|
|
31
32
|
* @example
|
|
32
33
|
* ```typescript
|
|
33
|
-
* const client = new
|
|
34
|
+
* const client = new TestNetDispenserApiClient({ authToken: 'your_auth_token', requestTimeout: 30 });
|
|
34
35
|
* const fundResponse = await client.fund('your_address', 100);
|
|
35
36
|
* const limitResponse = await client.getLimit();
|
|
36
37
|
* await client.refund('your_transaction_id');
|
|
@@ -38,7 +39,7 @@ const dispenserAssets = {
|
|
|
38
39
|
*
|
|
39
40
|
* @throws {Error} If neither the environment variable 'ALGOKIT_DISPENSER_ACCESS_TOKEN' nor the authToken parameter were provided.
|
|
40
41
|
*/
|
|
41
|
-
export class
|
|
42
|
+
export class TestNetDispenserApiClient {
|
|
42
43
|
_authToken;
|
|
43
44
|
_requestTimeout;
|
|
44
45
|
constructor(params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispenser-client.js","sourceRoot":"","sources":["../../../src/types/dispenser-client.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,gDAAgD,CAAA;AAChE,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAClC,MAAM,uBAAuB,GAAG,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E,MAAM,CAAC,CAAA;IAC5G,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ;QACZ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,uBAAuB,CACjD,IAAI,CAAC,SAAS,EACd,QAAQ,eAAe,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,QAAQ,EAChE,IAAI,EACJ,KAAK,CACN,CAAA;QACD,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAErC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAA;IACnC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"main": "./cjs/index.js",
|
|
3
3
|
"types": "./types/index.d.ts",
|
|
4
4
|
"name": "@algorandfoundation/algokit-utils",
|
|
5
|
-
"version": "4.0.0-beta.
|
|
5
|
+
"version": "4.0.0-beta.2",
|
|
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",
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TestNetDispenserApiClient, TestNetDispenserApiClientParams } from './types/dispenser-client';
|
|
2
2
|
/**
|
|
3
|
-
* Create a new
|
|
3
|
+
* Create a new TestNetDispenserApiClient instance.
|
|
4
4
|
* Refer to [docs](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md) on guidance to obtain an access token.
|
|
5
5
|
*
|
|
6
|
-
* @param params An object containing parameters for the
|
|
6
|
+
* @param params An object containing parameters for the TestNetDispenserApiClient class.
|
|
7
7
|
* Or null if you want the client to load the access token from the environment variable `ALGOKIT_DISPENSER_ACCESS_TOKEN`.
|
|
8
8
|
* @example
|
|
9
|
-
* const client = algokit.
|
|
9
|
+
* const client = algokit.getTestNetDispenserApiClient(
|
|
10
10
|
* {
|
|
11
11
|
* authToken: 'your_auth_token',
|
|
12
12
|
* requestTimeout: 15,
|
|
13
13
|
* }
|
|
14
14
|
* )
|
|
15
15
|
*
|
|
16
|
-
* @returns An instance of the
|
|
16
|
+
* @returns An instance of the TestNetDispenserApiClient class.
|
|
17
17
|
*/
|
|
18
|
-
export declare function
|
|
18
|
+
export declare function getTestNetDispenserApiClient(params?: TestNetDispenserApiClientParams | null): TestNetDispenserApiClient;
|
|
19
19
|
//# sourceMappingURL=dispenser-client.d.ts.map
|
|
@@ -5,12 +5,12 @@ export interface DispenserFundResponse {
|
|
|
5
5
|
export interface DispenserLimitResponse {
|
|
6
6
|
amount: number;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface TestNetDispenserApiClientParams {
|
|
9
9
|
authToken: string;
|
|
10
10
|
requestTimeout: number | null;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* `
|
|
13
|
+
* `TestNetDispenserApiClient` is a class that provides methods to interact with the [Algorand TestNet Dispenser API](https://github.com/algorandfoundation/algokit/blob/main/docs/testnet_api.md).
|
|
14
14
|
* It allows you to fund an address with Algos, refund a transaction, and get the funding limit for the Algo asset.
|
|
15
15
|
*
|
|
16
16
|
* The class requires an authentication token and a request timeout to be initialized. The authentication token can be provided
|
|
@@ -27,7 +27,7 @@ export interface DispenserApiTestnetClientParams {
|
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```typescript
|
|
30
|
-
* const client = new
|
|
30
|
+
* const client = new TestNetDispenserApiClient({ authToken: 'your_auth_token', requestTimeout: 30 });
|
|
31
31
|
* const fundResponse = await client.fund('your_address', 100);
|
|
32
32
|
* const limitResponse = await client.getLimit();
|
|
33
33
|
* await client.refund('your_transaction_id');
|
|
@@ -35,10 +35,10 @@ export interface DispenserApiTestnetClientParams {
|
|
|
35
35
|
*
|
|
36
36
|
* @throws {Error} If neither the environment variable 'ALGOKIT_DISPENSER_ACCESS_TOKEN' nor the authToken parameter were provided.
|
|
37
37
|
*/
|
|
38
|
-
export declare class
|
|
38
|
+
export declare class TestNetDispenserApiClient {
|
|
39
39
|
private _authToken;
|
|
40
40
|
private _requestTimeout;
|
|
41
|
-
constructor(params:
|
|
41
|
+
constructor(params: TestNetDispenserApiClientParams | null);
|
|
42
42
|
get authToken(): string;
|
|
43
43
|
get requestTimeout(): number;
|
|
44
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispenser-client.d.ts","sourceRoot":"","sources":["../../../src/types/dispenser-client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispenser-client.d.ts","sourceRoot":"","sources":["../../../src/types/dispenser-client.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,+BAA+B;IAC9C,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,eAAe,CAAQ;gBAEnB,MAAM,EAAE,+BAA+B,GAAG,IAAI;IAgB1D,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;;;;;;;OASG;YACW,uBAAuB;IAuCrC;;;;;;;OAOG;IACG,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAY3E;;;;OAIG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD;;;;OAIG;IACG,QAAQ,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAWlD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SuggestedParams } from 'algosdk';
|
|
2
2
|
import { AlgoAmount } from './amount';
|
|
3
|
-
import {
|
|
3
|
+
import { TestNetDispenserApiClient } from './dispenser-client';
|
|
4
4
|
import { SendTransactionFrom, SendTransactionParams, TransactionNote } from './transaction';
|
|
5
5
|
/** Parameters for `transferAlgos` call. */
|
|
6
6
|
export interface AlgoTransferParams extends SendTransactionParams {
|
|
@@ -20,7 +20,7 @@ export interface EnsureFundedParams extends SendTransactionParams {
|
|
|
20
20
|
/** The account to fund */
|
|
21
21
|
accountToFund: SendTransactionFrom | string;
|
|
22
22
|
/** The account to use as a funding source, will default to using the dispenser account returned by `algokit.getDispenserAccount` */
|
|
23
|
-
fundingSource?: SendTransactionFrom |
|
|
23
|
+
fundingSource?: SendTransactionFrom | TestNetDispenserApiClient;
|
|
24
24
|
/** The minimum balance of ALGOs that the account should have available to spend (i.e. on top of minimum balance requirement) */
|
|
25
25
|
minSpendingBalance: AlgoAmount;
|
|
26
26
|
/** When issuing a funding amount, the minimum amount to transfer (avoids many small transfers if this gets called often on an active account) */
|