@algorandfoundation/algokit-utils 2.3.3-beta.3 → 2.3.3-beta.5
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/account.d.ts.map +1 -0
- package/cjs/account.js.map +1 -0
- package/cjs/amount.d.ts.map +1 -0
- package/cjs/amount.js.map +1 -0
- package/cjs/app-client.d.ts.map +1 -0
- package/cjs/app-client.js.map +1 -0
- package/cjs/app-deploy.d.ts.map +1 -0
- package/cjs/app-deploy.js.map +1 -0
- package/cjs/app.d.ts.map +1 -0
- package/cjs/app.js.map +1 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js.map +1 -0
- package/cjs/indexer-lookup.d.ts.map +1 -0
- package/cjs/indexer-lookup.js.map +1 -0
- package/cjs/localnet.d.ts.map +1 -0
- package/{localnet.js → cjs/localnet.js} +1 -1
- package/cjs/localnet.js.map +1 -0
- package/cjs/network-client.d.ts.map +1 -0
- package/cjs/network-client.js.map +1 -0
- package/cjs/testing/account.d.ts.map +1 -0
- package/cjs/testing/account.js.map +1 -0
- package/cjs/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
- package/cjs/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
- package/cjs/testing/fixtures/algorand-fixture.d.ts.map +1 -0
- package/cjs/testing/fixtures/algorand-fixture.js.map +1 -0
- package/cjs/testing/fixtures/index.d.ts.map +1 -0
- package/cjs/testing/fixtures/index.js.map +1 -0
- package/cjs/testing/index.d.ts.map +1 -0
- package/cjs/testing/index.js.map +1 -0
- package/cjs/testing/indexer.d.ts.map +1 -0
- package/cjs/testing/indexer.js.map +1 -0
- package/cjs/testing/test-logger.d.ts.map +1 -0
- package/{testing → cjs/testing}/test-logger.js +2 -0
- package/cjs/testing/test-logger.js.map +1 -0
- package/cjs/testing/transaction-logger.d.ts.map +1 -0
- package/{testing → cjs/testing}/transaction-logger.js +2 -3
- package/cjs/testing/transaction-logger.js.map +1 -0
- package/cjs/transaction.d.ts.map +1 -0
- package/cjs/transaction.js.map +1 -0
- package/cjs/transfer.d.ts.map +1 -0
- package/cjs/transfer.js.map +1 -0
- package/cjs/types/account.d.ts +66 -0
- package/cjs/types/account.d.ts.map +1 -0
- package/{types → cjs/types}/account.js +7 -0
- package/cjs/types/account.js.map +1 -0
- package/cjs/types/algo-http-client-with-retry.d.ts.map +1 -0
- package/{types → cjs/types}/algo-http-client-with-retry.js +16 -16
- package/cjs/types/algo-http-client-with-retry.js.map +1 -0
- package/cjs/types/amount.d.ts +24 -0
- package/cjs/types/amount.d.ts.map +1 -0
- package/{types → cjs/types}/amount.js +1 -0
- package/cjs/types/amount.js.map +1 -0
- package/cjs/types/app-client.d.ts +408 -0
- package/cjs/types/app-client.d.ts.map +1 -0
- package/{types → cjs/types}/app-client.js +13 -0
- package/cjs/types/app-client.js.map +1 -0
- package/cjs/types/app-spec.d.ts.map +1 -0
- package/{types → cjs/types}/app-spec.js.map +1 -1
- package/cjs/types/app.d.ts +308 -0
- package/cjs/types/app.d.ts.map +1 -0
- package/cjs/types/app.js.map +1 -0
- package/cjs/types/config.d.ts.map +1 -0
- package/{types → cjs/types}/config.js +1 -0
- package/cjs/types/config.js.map +1 -0
- package/cjs/types/indexer.d.ts.map +1 -0
- package/cjs/types/indexer.js.map +1 -0
- package/cjs/types/logging.d.ts.map +1 -0
- package/cjs/types/logging.js.map +1 -0
- package/cjs/types/logic-error.d.ts.map +1 -0
- package/{types → cjs/types}/logic-error.js +5 -2
- package/cjs/types/logic-error.js.map +1 -0
- package/cjs/types/network-client.d.ts +20 -0
- package/cjs/types/network-client.d.ts.map +1 -0
- package/cjs/types/network-client.js.map +1 -0
- package/cjs/types/testing.d.ts.map +1 -0
- package/{types → cjs/types}/testing.js.map +1 -1
- package/cjs/types/transaction.d.ts +111 -0
- package/cjs/types/transaction.d.ts.map +1 -0
- package/{types → cjs/types}/transaction.js.map +1 -1
- package/cjs/types/transfer.d.ts +32 -0
- package/cjs/types/transfer.d.ts.map +1 -0
- package/{types → cjs/types}/transfer.js.map +1 -1
- package/cjs/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
- package/{types → cjs/types}/urlTokenBaseHTTPClient.js +4 -0
- package/cjs/types/urlTokenBaseHTTPClient.js.map +1 -0
- package/cjs/util.d.ts.map +1 -0
- package/cjs/util.js.map +1 -0
- package/esm/account.js +170 -0
- package/esm/account.js.map +1 -0
- package/esm/amount.js +27 -0
- package/esm/amount.js.map +1 -0
- package/esm/app-client.js +76 -0
- package/esm/app-client.js.map +1 -0
- package/esm/app-deploy.js +446 -0
- package/esm/app-deploy.js.map +1 -0
- package/esm/app.js +572 -0
- package/esm/app.js.map +1 -0
- package/esm/index.js +14 -0
- package/esm/index.js.map +1 -0
- package/esm/indexer-lookup.js +98 -0
- package/esm/indexer-lookup.js.map +1 -0
- package/esm/localnet.js +111 -0
- package/esm/localnet.js.map +1 -0
- package/esm/network-client.js +179 -0
- package/esm/network-client.js.map +1 -0
- package/esm/testing/account.js +24 -0
- package/esm/testing/account.js.map +1 -0
- package/esm/testing/fixtures/algokit-log-capture-fixture.js +39 -0
- package/esm/testing/fixtures/algokit-log-capture-fixture.js.map +1 -0
- package/esm/testing/fixtures/algorand-fixture.js +53 -0
- package/esm/testing/fixtures/algorand-fixture.js.map +1 -0
- package/esm/testing/fixtures/index.js +3 -0
- package/esm/testing/fixtures/index.js.map +1 -0
- package/esm/testing/index.js +6 -0
- package/esm/testing/index.js.map +1 -0
- package/esm/testing/indexer.js +36 -0
- package/esm/testing/indexer.js.map +1 -0
- package/esm/testing/test-logger.js +69 -0
- package/esm/testing/test-logger.js.map +1 -0
- package/esm/testing/transaction-logger.js +66 -0
- package/esm/testing/transaction-logger.js.map +1 -0
- package/esm/transaction.js +365 -0
- package/esm/transaction.js.map +1 -0
- package/esm/transfer.js +59 -0
- package/esm/transfer.js.map +1 -0
- package/esm/types/account.js +90 -0
- package/esm/types/account.js.map +1 -0
- package/esm/types/algo-http-client-with-retry.js +58 -0
- package/esm/types/algo-http-client-with-retry.js.map +1 -0
- package/esm/types/amount.js +35 -0
- package/esm/types/amount.js.map +1 -0
- package/esm/types/app-client.js +624 -0
- package/esm/types/app-client.js.map +1 -0
- package/esm/types/app-spec.js +2 -0
- package/esm/types/app-spec.js.map +1 -0
- package/esm/types/app.js +33 -0
- package/esm/types/app.js.map +1 -0
- package/esm/types/config.js +50 -0
- package/esm/types/config.js.map +1 -0
- package/esm/types/indexer.js +31 -0
- package/esm/types/indexer.js.map +1 -0
- package/esm/types/logging.js +24 -0
- package/esm/types/logging.js.map +1 -0
- package/esm/types/logic-error.js +49 -0
- package/esm/types/logic-error.js.map +1 -0
- package/esm/types/network-client.js +2 -0
- package/esm/types/network-client.js.map +1 -0
- package/esm/types/testing.js +2 -0
- package/esm/types/testing.js.map +1 -0
- package/esm/types/transaction.js +2 -0
- package/esm/types/transaction.js.map +1 -0
- package/esm/types/transfer.js +2 -0
- package/esm/types/transfer.js.map +1 -0
- package/esm/types/urlTokenBaseHTTPClient.js +151 -0
- package/esm/types/urlTokenBaseHTTPClient.js.map +1 -0
- package/esm/util.js +20 -0
- package/esm/util.js.map +1 -0
- package/package.json +42 -6
- package/types/account.d.ts +125 -63
- package/types/account.d.ts.map +1 -1
- package/types/amount.d.ts +18 -22
- package/types/amount.d.ts.map +1 -1
- package/types/app-client.d.ts +70 -407
- package/types/app-client.d.ts.map +1 -1
- package/types/app-deploy.d.ts +101 -0
- package/types/app-deploy.d.ts.map +1 -0
- package/types/app.d.ts +145 -290
- package/types/app.d.ts.map +1 -1
- package/types/index.d.ts +14 -0
- package/types/index.d.ts.map +1 -0
- package/types/indexer-lookup.d.ts +38 -0
- package/types/indexer-lookup.d.ts.map +1 -0
- package/types/localnet.d.ts +54 -0
- package/types/localnet.d.ts.map +1 -0
- package/types/network-client.d.ts +96 -19
- package/types/network-client.d.ts.map +1 -1
- package/types/testing/account.d.ts +14 -0
- package/types/testing/account.d.ts.map +1 -0
- package/types/testing/fixtures/algokit-log-capture-fixture.d.ts +19 -0
- package/types/testing/fixtures/algokit-log-capture-fixture.d.ts.map +1 -0
- package/types/testing/fixtures/algorand-fixture.d.ts +48 -0
- package/types/testing/fixtures/algorand-fixture.d.ts.map +1 -0
- package/types/testing/fixtures/index.d.ts +3 -0
- package/types/testing/fixtures/index.d.ts.map +1 -0
- package/types/testing/index.d.ts +6 -0
- package/types/testing/index.d.ts.map +1 -0
- package/types/testing/indexer.d.ts +12 -0
- package/types/testing/indexer.d.ts.map +1 -0
- package/types/testing/test-logger.d.ts +41 -0
- package/types/testing/test-logger.d.ts.map +1 -0
- package/types/testing/transaction-logger.d.ts +29 -0
- package/types/testing/transaction-logger.d.ts.map +1 -0
- package/types/transaction.d.ts +133 -106
- package/types/transaction.d.ts.map +1 -1
- package/types/transfer.d.ts +21 -31
- package/types/transfer.d.ts.map +1 -1
- package/types/types/account.d.ts +66 -0
- package/types/types/account.d.ts.map +1 -0
- package/types/types/algo-http-client-with-retry.d.ts +14 -0
- package/types/types/algo-http-client-with-retry.d.ts.map +1 -0
- package/types/types/amount.d.ts +24 -0
- package/types/types/amount.d.ts.map +1 -0
- package/types/types/app-client.d.ts +408 -0
- package/types/types/app-client.d.ts.map +1 -0
- package/types/types/app-spec.d.ts +154 -0
- package/types/types/app-spec.d.ts.map +1 -0
- package/types/types/app.d.ts +308 -0
- package/types/types/app.d.ts.map +1 -0
- package/types/types/config.d.ts +32 -0
- package/types/types/config.d.ts.map +1 -0
- package/types/types/indexer.d.ts +623 -0
- package/types/types/indexer.d.ts.map +1 -0
- package/types/types/logging.d.ts +13 -0
- package/types/types/logging.d.ts.map +1 -0
- package/types/types/logic-error.d.ts +37 -0
- package/types/types/logic-error.d.ts.map +1 -0
- package/types/types/network-client.d.ts +20 -0
- package/types/types/network-client.d.ts.map +1 -0
- package/types/types/testing.d.ts +89 -0
- package/types/types/testing.d.ts.map +1 -0
- package/types/types/transaction.d.ts +111 -0
- package/types/types/transaction.d.ts.map +1 -0
- package/types/types/transfer.d.ts +32 -0
- package/types/types/transfer.d.ts.map +1 -0
- package/types/types/urlTokenBaseHTTPClient.d.ts +41 -0
- package/types/types/urlTokenBaseHTTPClient.d.ts.map +1 -0
- package/types/util.d.ts +10 -0
- package/types/util.d.ts.map +1 -0
- package/account.d.ts.map +0 -1
- package/account.js.map +0 -1
- package/amount.d.ts.map +0 -1
- package/amount.js.map +0 -1
- package/app-client.d.ts.map +0 -1
- package/app-client.js.map +0 -1
- package/app-deploy.d.ts.map +0 -1
- package/app-deploy.js.map +0 -1
- package/app.d.ts.map +0 -1
- package/app.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/indexer-lookup.d.ts.map +0 -1
- package/indexer-lookup.js.map +0 -1
- package/localnet.d.ts.map +0 -1
- package/localnet.js.map +0 -1
- package/network-client.d.ts.map +0 -1
- package/network-client.js.map +0 -1
- package/testing/account.d.ts.map +0 -1
- package/testing/account.js.map +0 -1
- package/testing/fixtures/algokit-log-capture-fixture.d.ts.map +0 -1
- package/testing/fixtures/algokit-log-capture-fixture.js.map +0 -1
- package/testing/fixtures/algorand-fixture.d.ts.map +0 -1
- package/testing/fixtures/algorand-fixture.js.map +0 -1
- package/testing/fixtures/index.d.ts.map +0 -1
- package/testing/fixtures/index.js.map +0 -1
- package/testing/index.d.ts.map +0 -1
- package/testing/index.js.map +0 -1
- package/testing/indexer.d.ts.map +0 -1
- package/testing/indexer.js.map +0 -1
- package/testing/test-logger.d.ts.map +0 -1
- package/testing/test-logger.js.map +0 -1
- package/testing/transaction-logger.d.ts.map +0 -1
- package/testing/transaction-logger.js.map +0 -1
- package/transaction.d.ts.map +0 -1
- package/transaction.js.map +0 -1
- package/transfer.d.ts.map +0 -1
- package/transfer.js.map +0 -1
- package/types/account.js.map +0 -1
- package/types/algo-http-client-with-retry.d.ts.map +0 -1
- package/types/algo-http-client-with-retry.js.map +0 -1
- package/types/amount.js.map +0 -1
- package/types/app-client.js.map +0 -1
- package/types/app-spec.d.ts.map +0 -1
- package/types/app.js.map +0 -1
- package/types/config.d.ts.map +0 -1
- package/types/config.js.map +0 -1
- package/types/indexer.d.ts.map +0 -1
- package/types/indexer.js.map +0 -1
- package/types/logging.d.ts.map +0 -1
- package/types/logging.js.map +0 -1
- package/types/logic-error.d.ts.map +0 -1
- package/types/logic-error.js.map +0 -1
- package/types/network-client.js.map +0 -1
- package/types/testing.d.ts.map +0 -1
- package/types/urlTokenBaseHTTPClient.d.ts.map +0 -1
- package/types/urlTokenBaseHTTPClient.js.map +0 -1
- package/util.d.ts.map +0 -1
- package/util.js.map +0 -1
- /package/{account.d.ts → cjs/account.d.ts} +0 -0
- /package/{account.js → cjs/account.js} +0 -0
- /package/{amount.d.ts → cjs/amount.d.ts} +0 -0
- /package/{amount.js → cjs/amount.js} +0 -0
- /package/{app-client.d.ts → cjs/app-client.d.ts} +0 -0
- /package/{app-client.js → cjs/app-client.js} +0 -0
- /package/{app-deploy.d.ts → cjs/app-deploy.d.ts} +0 -0
- /package/{app-deploy.js → cjs/app-deploy.js} +0 -0
- /package/{app.d.ts → cjs/app.d.ts} +0 -0
- /package/{app.js → cjs/app.js} +0 -0
- /package/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/{index.js → cjs/index.js} +0 -0
- /package/{indexer-lookup.d.ts → cjs/indexer-lookup.d.ts} +0 -0
- /package/{indexer-lookup.js → cjs/indexer-lookup.js} +0 -0
- /package/{localnet.d.ts → cjs/localnet.d.ts} +0 -0
- /package/{network-client.d.ts → cjs/network-client.d.ts} +0 -0
- /package/{network-client.js → cjs/network-client.js} +0 -0
- /package/{testing → cjs/testing}/account.d.ts +0 -0
- /package/{testing → cjs/testing}/account.js +0 -0
- /package/{testing → cjs/testing}/fixtures/algokit-log-capture-fixture.d.ts +0 -0
- /package/{testing → cjs/testing}/fixtures/algokit-log-capture-fixture.js +0 -0
- /package/{testing → cjs/testing}/fixtures/algorand-fixture.d.ts +0 -0
- /package/{testing → cjs/testing}/fixtures/algorand-fixture.js +0 -0
- /package/{testing → cjs/testing}/fixtures/index.d.ts +0 -0
- /package/{testing → cjs/testing}/fixtures/index.js +0 -0
- /package/{testing → cjs/testing}/index.d.ts +0 -0
- /package/{testing → cjs/testing}/index.js +0 -0
- /package/{testing → cjs/testing}/indexer.d.ts +0 -0
- /package/{testing → cjs/testing}/indexer.js +0 -0
- /package/{testing → cjs/testing}/test-logger.d.ts +0 -0
- /package/{testing → cjs/testing}/transaction-logger.d.ts +0 -0
- /package/{transaction.d.ts → cjs/transaction.d.ts} +0 -0
- /package/{transaction.js → cjs/transaction.js} +0 -0
- /package/{transfer.d.ts → cjs/transfer.d.ts} +0 -0
- /package/{transfer.js → cjs/transfer.js} +0 -0
- /package/{types → cjs/types}/algo-http-client-with-retry.d.ts +0 -0
- /package/{types → cjs/types}/app-spec.d.ts +0 -0
- /package/{types → cjs/types}/app-spec.js +0 -0
- /package/{types → cjs/types}/app.js +0 -0
- /package/{types → cjs/types}/config.d.ts +0 -0
- /package/{types → cjs/types}/indexer.d.ts +0 -0
- /package/{types → cjs/types}/indexer.js +0 -0
- /package/{types → cjs/types}/logging.d.ts +0 -0
- /package/{types → cjs/types}/logging.js +0 -0
- /package/{types → cjs/types}/logic-error.d.ts +0 -0
- /package/{types → cjs/types}/network-client.js +0 -0
- /package/{types → cjs/types}/testing.d.ts +0 -0
- /package/{types → cjs/types}/testing.js +0 -0
- /package/{types → cjs/types}/transaction.js +0 -0
- /package/{types → cjs/types}/transfer.js +0 -0
- /package/{types → cjs/types}/urlTokenBaseHTTPClient.d.ts +0 -0
- /package/{util.d.ts → cjs/util.d.ts} +0 -0
- /package/{util.js → cjs/util.js} +0 -0
|
@@ -4,6 +4,7 @@ exports.URLTokenBaseHTTPClient = void 0;
|
|
|
4
4
|
const buffer_1 = require("buffer");
|
|
5
5
|
const cross_fetch_1 = require("cross-fetch");
|
|
6
6
|
class URLTokenBaseHTTPError extends Error {
|
|
7
|
+
response;
|
|
7
8
|
constructor(message, response) {
|
|
8
9
|
super(message);
|
|
9
10
|
this.response = response;
|
|
@@ -17,6 +18,9 @@ class URLTokenBaseHTTPError extends Error {
|
|
|
17
18
|
* This is the default implementation of BaseHTTPClient.
|
|
18
19
|
*/
|
|
19
20
|
class URLTokenBaseHTTPClient {
|
|
21
|
+
defaultHeaders;
|
|
22
|
+
baseURL;
|
|
23
|
+
tokenHeader;
|
|
20
24
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
25
|
constructor(tokenHeader, baseServer, port, defaultHeaders = {}) {
|
|
22
26
|
this.defaultHeaders = defaultHeaders;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlTokenBaseHTTPClient.js","sourceRoot":"","sources":["../../../src/types/urlTokenBaseHTTPClient.ts"],"names":[],"mappings":";;;AAKA,mCAA+B;AAC/B,6CAAmC;AAkBnC,MAAM,qBAAsB,SAAQ,KAAK;IACH;IAApC,YAAY,OAAe,EAAS,QAAgC;QAClE,KAAK,CAAC,OAAO,CAAC,CAAA;QADoB,aAAQ,GAAR,QAAQ,CAAwB;QAElE,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAA;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;CACF;AAID;;;;GAIG;AACH,MAAa,sBAAsB;IAKyD;IAJzE,OAAO,CAAK;IACZ,WAAW,CAAa;IAEzC,8DAA8D;IAC9D,YAAY,WAAwB,EAAE,UAAkB,EAAE,IAAsB,EAAU,iBAAsC,EAAE;QAAxC,mBAAc,GAAd,cAAc,CAA0B;QAChI,6EAA6E;QAC7E,0EAA0E;QAC1E,8BAA8B;QAC9B,MAAM,eAAe,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,GAAG,CAAA;QAChF,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,eAAe,CAAC,CAAA;QAC9C,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;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CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;YACxD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,IAAI;YACV,OAAO;SACR,CAAC,CAAA;QAEF,OAAO,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;IACxD,CAAC;CACF;AA9JD,wDA8JC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,UAAW,MAAM,GAAG,MAAM,WAa9C,CAAA;AAED,qBAAa,qBAAsB,SAAQ,KAAK;CAAG"}
|
package/cjs/util.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACI,MAAM,QAAQ,GAAG,CAAC,KAAsB,EAAE,EAAE;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAE3C,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;QAC3C,MAAM,IAAI,qBAAqB,CAC7B,kBAAkB,KAAK,sFAAsF,CAC9G,CAAA;KACF;SAAM,IAAI,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;QAClD,MAAM,IAAI,qBAAqB,CAC7B,kBAAkB,KAAK,uFAAuF,CAC/G,CAAA;KACF;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC,CAAA;AAbY,QAAA,QAAQ,YAapB;AAED,MAAa,qBAAsB,SAAQ,KAAK;CAAG;AAAnD,sDAAmD"}
|
package/esm/account.js
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import algosdk from 'algosdk';
|
|
2
|
+
import { Config } from './';
|
|
3
|
+
import { getLocalNetDispenserAccount, getOrCreateKmdWalletAccount } from './localnet';
|
|
4
|
+
import { isLocalNet } from './network-client';
|
|
5
|
+
import { getSenderAddress } from './transaction';
|
|
6
|
+
import { DISPENSER_ACCOUNT, MultisigAccount, SigningAccount } from './types/account';
|
|
7
|
+
/**
|
|
8
|
+
* Returns an account wrapper that supports partial or full multisig signing.
|
|
9
|
+
* @param multisigParams The parameters that define the multisig account
|
|
10
|
+
* @param signingAccounts The signers that are currently present
|
|
11
|
+
* @returns A multisig account wrapper
|
|
12
|
+
*/
|
|
13
|
+
export function multisigAccount(multisigParams, signingAccounts) {
|
|
14
|
+
return new MultisigAccount(multisigParams, signingAccounts);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns an account wrapper that supports a rekeyed account.
|
|
18
|
+
* @param signer The account, with private key loaded, that is signing
|
|
19
|
+
* @param sender The address of the rekeyed account that will act as a sender
|
|
20
|
+
* @returns The SigningAccount wrapper
|
|
21
|
+
*/
|
|
22
|
+
export function rekeyedAccount(signer, sender) {
|
|
23
|
+
return new SigningAccount(signer, sender);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Returns an account wrapper that supports a transaction signer with associated sender address.
|
|
27
|
+
* @param signer The transaction signer
|
|
28
|
+
* @param sender The address of sender account
|
|
29
|
+
* @returns The SigningAccount wrapper
|
|
30
|
+
*/
|
|
31
|
+
export function transactionSignerAccount(signer, sender) {
|
|
32
|
+
return { addr: sender, signer };
|
|
33
|
+
}
|
|
34
|
+
/** Returns an Algorand account with secret key loaded (i.e. that can sign transactions) by taking the mnemonic secret.
|
|
35
|
+
*
|
|
36
|
+
* This is a wrapper around algosdk.mnemonicToSecretKey to provide a more friendly/obvious name.
|
|
37
|
+
*
|
|
38
|
+
* @param mnemonicSecret The mnemonic secret representing the private key of an account; **Note: Be careful how the mnemonic is handled**,
|
|
39
|
+
* never commit it into source control and ideally load it from the environment (ideally via a secret storage service) rather than the file system.
|
|
40
|
+
*/
|
|
41
|
+
export function mnemonicAccount(mnemonicSecret) {
|
|
42
|
+
// This method is confusingly named, so this function provides a more dev friendly "wrapper" name
|
|
43
|
+
return algosdk.mnemonicToSecretKey(mnemonicSecret);
|
|
44
|
+
}
|
|
45
|
+
/** Returns a new, random Algorand account with secret key loaded.
|
|
46
|
+
*
|
|
47
|
+
* This is a wrapper around algosdk.generateAccount to provide a more friendly/obvious name.
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
export function randomAccount() {
|
|
51
|
+
// This method is confusingly named, so this function provides a more dev friendly "wrapper" name
|
|
52
|
+
return algosdk.generateAccount();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns an Algorand account with private key loaded by convention based on the given name identifier.
|
|
56
|
+
*
|
|
57
|
+
* Note: This function expects to run in a Node.js environment.
|
|
58
|
+
*
|
|
59
|
+
* ## Convention:
|
|
60
|
+
* * **Non-LocalNet:** will load process.env['\{NAME\}_MNEMONIC'] as a mnemonic secret; **Note: Be careful how the mnemonic is handled**,
|
|
61
|
+
* never commit it into source control and ideally load it via a secret storage service rather than the file system.
|
|
62
|
+
* If process.env['\{NAME\}_SENDER'] is defined then it will use that for the sender address (i.e. to support rekeyed accounts)
|
|
63
|
+
* * **LocalNet:** will load the account from a KMD wallet called \{NAME\} and if that wallet doesn't exist it will create it and fund the account for you
|
|
64
|
+
*
|
|
65
|
+
* This allows you to write code that will work seamlessly in production and local development (LocalNet) without manual config locally (including when you reset the LocalNet).
|
|
66
|
+
*
|
|
67
|
+
* @example Default
|
|
68
|
+
*
|
|
69
|
+
* If you have a mnemonic secret loaded into `process.env.ACCOUNT_MNEMONIC` then you can call the following to get that private key loaded into an account object:
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* If that code runs against LocalNet then a wallet called `ACCOUNT` will automatically be created with an account that is automatically funded with 1000 (default) ALGOs from the default LocalNet dispenser.
|
|
75
|
+
*
|
|
76
|
+
* @param account The details of the account to get, either the name identifier (string) or an object with:
|
|
77
|
+
* * `config`: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) OR
|
|
78
|
+
* * `name`: string: The name identifier of the account (deprecated)
|
|
79
|
+
* And optionally
|
|
80
|
+
* * `fundWith`: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 Algos will be funded from the dispenser account
|
|
81
|
+
* @param algod An algod client
|
|
82
|
+
* @param kmdClient An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
|
|
83
|
+
* @returns The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
|
|
84
|
+
*/
|
|
85
|
+
export async function getAccount(account, algod, kmdClient) {
|
|
86
|
+
let name;
|
|
87
|
+
let fundWith = undefined;
|
|
88
|
+
let config;
|
|
89
|
+
if (typeof account === 'string') {
|
|
90
|
+
name = account;
|
|
91
|
+
config = getAccountConfigFromEnvironment(name);
|
|
92
|
+
}
|
|
93
|
+
else if ('name' in account) {
|
|
94
|
+
name = account.name;
|
|
95
|
+
config = getAccountConfigFromEnvironment(name);
|
|
96
|
+
fundWith = account.fundWith;
|
|
97
|
+
}
|
|
98
|
+
else if ('config' in account) {
|
|
99
|
+
config = account.config;
|
|
100
|
+
name = config.accountName;
|
|
101
|
+
fundWith = account.fundWith;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
throw new Error('Missing name or account config');
|
|
105
|
+
}
|
|
106
|
+
if (config.accountMnemonic) {
|
|
107
|
+
const signer = mnemonicAccount(config.accountMnemonic);
|
|
108
|
+
const sender = config.senderAddress || config.senderMnemonic;
|
|
109
|
+
if (sender) {
|
|
110
|
+
Config.logger.debug(`Using rekeyed account ${signer.addr} for sender ${sender} for ${name} account`);
|
|
111
|
+
return new SigningAccount(signer, sender);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
return signer;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (await isLocalNet(algod)) {
|
|
118
|
+
const account = await getOrCreateKmdWalletAccount({ name, fundWith }, algod, kmdClient);
|
|
119
|
+
config.accountMnemonic = algosdk.secretKeyToMnemonic(account.sk);
|
|
120
|
+
return account;
|
|
121
|
+
}
|
|
122
|
+
throw new Error(`Missing environment variable ${name.toUpperCase()}_MNEMONIC when looking for account ${name}`);
|
|
123
|
+
}
|
|
124
|
+
/** Returns an account's address as a byte array
|
|
125
|
+
*
|
|
126
|
+
* @param account Either an account (with private key loaded) or the string address of an account
|
|
127
|
+
*/
|
|
128
|
+
export function getAccountAddressAsUint8Array(account) {
|
|
129
|
+
return algosdk.decodeAddress(typeof account === 'string' ? account : getSenderAddress(account)).publicKey;
|
|
130
|
+
}
|
|
131
|
+
/** Returns the string address of an Algorand account from a base64 encoded version of the underlying byte array of the address public key
|
|
132
|
+
*
|
|
133
|
+
* @param addressEncodedInB64 The base64 encoded version of the underlying byte array of the address public key
|
|
134
|
+
*/
|
|
135
|
+
export function getAccountAddressAsString(addressEncodedInB64) {
|
|
136
|
+
return algosdk.encodeAddress(Buffer.from(addressEncodedInB64, 'base64'));
|
|
137
|
+
}
|
|
138
|
+
/** Returns an account (with private key loaded) that can act as a dispenser
|
|
139
|
+
*
|
|
140
|
+
* If running on LocalNet then it will return the default dispenser account automatically,
|
|
141
|
+
* otherwise it will load the account mnemonic stored in process.env.DISPENSER_MNEMONIC
|
|
142
|
+
*
|
|
143
|
+
* @param algod An algod client
|
|
144
|
+
* @param kmd A KMD client, if not specified then a default KMD client will be loaded from environment variables
|
|
145
|
+
*/
|
|
146
|
+
export async function getDispenserAccount(algod, kmd) {
|
|
147
|
+
// If we are running against LocalNet we can use the default account within it, otherwise use an automation account specified via environment variables and ensure it's populated with ALGOs
|
|
148
|
+
const canFundFromDefaultAccount = await isLocalNet(algod);
|
|
149
|
+
return canFundFromDefaultAccount ? await getLocalNetDispenserAccount(algod, kmd) : await getAccount(DISPENSER_ACCOUNT, algod);
|
|
150
|
+
}
|
|
151
|
+
/** Returns the Account configuration from environment variables
|
|
152
|
+
*
|
|
153
|
+
* @param accountName account name
|
|
154
|
+
*
|
|
155
|
+
* @example environment variables
|
|
156
|
+
* {accountName}_MNEMONIC
|
|
157
|
+
* {accountName}_SENDER
|
|
158
|
+
*
|
|
159
|
+
*/
|
|
160
|
+
export function getAccountConfigFromEnvironment(accountName) {
|
|
161
|
+
if (!process || !process.env) {
|
|
162
|
+
throw new Error('Attempt to get account with private key from a non Node.js context; not supported!');
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
accountMnemonic: process.env[`${accountName.toUpperCase()}_MNEMONIC`] || '',
|
|
166
|
+
senderAddress: process.env[`${accountName.toUpperCase()}_SENDER`],
|
|
167
|
+
accountName,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account.ts"],"names":[],"mappings":"AAAA,OAAO,OAAuE,MAAM,SAAS,CAAA;AAC7F,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAA;AAC3B,OAAO,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAA;AACrF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAiB,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAA4B,MAAM,iBAAiB,CAAA;AAI7H;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,cAAgC,EAAE,eAA6C;IAC7G,OAAO,IAAI,eAAe,CAAC,cAAc,EAAE,eAAe,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAe,EAAE,MAAc;IAC5D,OAAO,IAAI,cAAc,CAAC,M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5L,MAAM,yBAAyB,GAAG,MAAM,UAAU,CAAC,KAAK,CAAC,CAAA;IACzD,OAAO,yBAAyB,CAAC,CAAC,CAAC,MAAM,2BAA2B,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,UAAU,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAA;AAC/H,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,+BAA+B,CAAC,WAAmB;IACjE,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;QAC5B,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAA;KACtG;IAED,OAAO;QACL,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,IAAI,EAAE;QAC3E,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,WAAW,EAAE,SAAS,CAAC;QACjE,WAAW;KACZ,CAAA;AACH,CAAC"}
|
package/esm/amount.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import algosdk from 'algosdk';
|
|
2
|
+
import { AlgoAmount } from './types/amount';
|
|
3
|
+
Number.prototype.microAlgos = function () {
|
|
4
|
+
return AlgoAmount.MicroAlgos(this);
|
|
5
|
+
};
|
|
6
|
+
Number.prototype.algos = function () {
|
|
7
|
+
return AlgoAmount.Algos(this);
|
|
8
|
+
};
|
|
9
|
+
/** Returns an amount of Algos using AlgoAmount
|
|
10
|
+
* @param algos The amount in Algos
|
|
11
|
+
*/
|
|
12
|
+
export const algos = (algos) => {
|
|
13
|
+
return AlgoAmount.Algos(algos);
|
|
14
|
+
};
|
|
15
|
+
/** Returns an amount of µAlgos using AlgoAmount
|
|
16
|
+
* @param microAlgos The amount in µAlgos
|
|
17
|
+
*/
|
|
18
|
+
export const microAlgos = (microAlgos) => {
|
|
19
|
+
return AlgoAmount.MicroAlgos(microAlgos);
|
|
20
|
+
};
|
|
21
|
+
/** Returns an amount of µAlgos to cover standard fees for the given number of transactions using AlgoAmount
|
|
22
|
+
* @param numberOfTransactions The of standard transaction fees to return the amount of ALGOs
|
|
23
|
+
*/
|
|
24
|
+
export const transactionFees = (numberOfTransactions) => {
|
|
25
|
+
return AlgoAmount.MicroAlgos(numberOfTransactions * algosdk.ALGORAND_MIN_TX_FEE);
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/amount.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAS3C,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG;IAC5B,OAAO,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;AACpC,CAAC,CAAA;AAED,MAAM,CAAC,SAAS,CAAC,KAAK,GAAG;IACvB,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC/B,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,EAAE;IACrC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,UAAkB,EAAE,EAAE;IAC/C,OAAO,UAAU,CAAC,UAAU,CAAC,UAAU,CAAC,CAAA;AAC1C,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,oBAA4B,EAAE,EAAE;IAC9D,OAAO,UAAU,CAAC,UAAU,CAAC,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAA;AAClF,CAAC,CAAA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ApplicationClient } from './types/app-client';
|
|
2
|
+
/**
|
|
3
|
+
* Create a new ApplicationClient instance
|
|
4
|
+
* @param appDetails The details of the app
|
|
5
|
+
* @param algod An algod instance
|
|
6
|
+
*
|
|
7
|
+
* @example Resolve by creator and name
|
|
8
|
+
* const client = algokit.getAppClient(
|
|
9
|
+
* {
|
|
10
|
+
* resolveBy: 'creatorAndName',
|
|
11
|
+
* app: {appSpec},
|
|
12
|
+
* sender: {account},
|
|
13
|
+
* creatorAddress: {creator},
|
|
14
|
+
* findExistingUsing: indexerClient,
|
|
15
|
+
* },
|
|
16
|
+
* algodClient,
|
|
17
|
+
* )
|
|
18
|
+
*
|
|
19
|
+
* @example Resolve by id:
|
|
20
|
+
* const client = algokit.getAppClient(
|
|
21
|
+
* {
|
|
22
|
+
* resolveBy: 'id',
|
|
23
|
+
* app: {appSpec},
|
|
24
|
+
* sender: {account},
|
|
25
|
+
* id: {id},
|
|
26
|
+
* },
|
|
27
|
+
* algodClient,
|
|
28
|
+
* )
|
|
29
|
+
*
|
|
30
|
+
* @returns The application client
|
|
31
|
+
*/
|
|
32
|
+
export function getAppClient(appDetails, algod) {
|
|
33
|
+
return new ApplicationClient(appDetails, algod);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Create a new ApplicationClient instance by id
|
|
37
|
+
* @param appDetails The details of the app
|
|
38
|
+
* @param algod An algod instance
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* const client = algokit.getAppClientById(
|
|
42
|
+
* {
|
|
43
|
+
* app: {appSpec},
|
|
44
|
+
* sender: {account},
|
|
45
|
+
* id: {id},
|
|
46
|
+
* },
|
|
47
|
+
* algodClient,
|
|
48
|
+
* )
|
|
49
|
+
*
|
|
50
|
+
* @returns The application client
|
|
51
|
+
*/
|
|
52
|
+
export function getAppClientById(appDetails, algod) {
|
|
53
|
+
return new ApplicationClient({ ...appDetails, resolveBy: 'id' }, algod);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a new ApplicationClient instance by creator and name
|
|
57
|
+
* @param appDetails The details of the app by creator and name
|
|
58
|
+
* @param algod An algod instance
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* const client = algokit.getAppClientByCreatorAndName(
|
|
62
|
+
* {
|
|
63
|
+
* app: {appSpec},
|
|
64
|
+
* sender: {account},
|
|
65
|
+
* creatorAddress: {account.addr},
|
|
66
|
+
* findExistingUsing: {indexerClient},
|
|
67
|
+
* },
|
|
68
|
+
* algodClient,
|
|
69
|
+
* )
|
|
70
|
+
*
|
|
71
|
+
* @returns The application client
|
|
72
|
+
*/
|
|
73
|
+
export function getAppClientByCreatorAndName(appDetails, algod) {
|
|
74
|
+
return new ApplicationClient({ ...appDetails, resolveBy: 'creatorAndName' }, algod);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=app-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-client.js","sourceRoot":"","sources":["../../src/app-client.ts"],"names":[],"mappings":"AACA,OAAO,EAA+E,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAEnI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,YAAY,CAAC,UAA6B,EAAE,KAAc;IACxE,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAA;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAiC,EAAE,KAAc;IAChF,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,KAAK,CAAC,CAAA;AACzE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,4BAA4B,CAAC,UAA6C,EAAE,KAAc;IACxG,OAAO,IAAI,iBAAiB,CAAC,EAAE,GAAG,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC,CAAA;AACrF,CAAC"}
|