@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
package/esm/types/app.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** The name of the TEAL template variable for deploy-time immutability control */
|
|
2
|
+
export const UPDATABLE_TEMPLATE_NAME = 'TMPL_UPDATABLE';
|
|
3
|
+
/** The name of the TEAL template variable for deploy-time permanence control */
|
|
4
|
+
export const DELETABLE_TEMPLATE_NAME = 'TMPL_DELETABLE';
|
|
5
|
+
/** The app create/update ARC-2 transaction note prefix */
|
|
6
|
+
export const APP_DEPLOY_NOTE_DAPP = 'ALGOKIT_DEPLOYER';
|
|
7
|
+
/** The maximum number of bytes in a single app code page */
|
|
8
|
+
export const APP_PAGE_MAX_SIZE = 2048;
|
|
9
|
+
/** First 4 bytes of SHA-512/256 hash of "return" for retrieving ABI return values */
|
|
10
|
+
export const ABI_RETURN_PREFIX = new Uint8Array([21, 31, 124, 117]);
|
|
11
|
+
/** What action to perform when deploying an app and an update is detected in the TEAL code */
|
|
12
|
+
export var OnUpdate;
|
|
13
|
+
(function (OnUpdate) {
|
|
14
|
+
/** Fail the deployment */
|
|
15
|
+
OnUpdate[OnUpdate["Fail"] = 0] = "Fail";
|
|
16
|
+
/** Update the app */
|
|
17
|
+
OnUpdate[OnUpdate["UpdateApp"] = 1] = "UpdateApp";
|
|
18
|
+
/** Delete the app and create a new one in its place */
|
|
19
|
+
OnUpdate[OnUpdate["ReplaceApp"] = 2] = "ReplaceApp";
|
|
20
|
+
/** Create a new app */
|
|
21
|
+
OnUpdate[OnUpdate["AppendApp"] = 3] = "AppendApp";
|
|
22
|
+
})(OnUpdate || (OnUpdate = {}));
|
|
23
|
+
/** What action to perform when deploying an app and a breaking schema change is detected */
|
|
24
|
+
export var OnSchemaBreak;
|
|
25
|
+
(function (OnSchemaBreak) {
|
|
26
|
+
/** Fail the deployment */
|
|
27
|
+
OnSchemaBreak[OnSchemaBreak["Fail"] = 0] = "Fail";
|
|
28
|
+
/** Delete the app and create a new one in its place */
|
|
29
|
+
OnSchemaBreak[OnSchemaBreak["ReplaceApp"] = 1] = "ReplaceApp";
|
|
30
|
+
/** Create a new app */
|
|
31
|
+
OnSchemaBreak[OnSchemaBreak["AppendApp"] = 2] = "AppendApp";
|
|
32
|
+
})(OnSchemaBreak || (OnSchemaBreak = {}));
|
|
33
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/types/app.ts"],"names":[],"mappings":"AAqBA,kFAAkF;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAgB,CAAA;AAEvD,gFAAgF;AAChF,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAgB,CAAA;AAEvD,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAG,kBAAkB,CAAA;AAEtD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAErC,qFAAqF;AACrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAqOnE,8FAA8F;AAC9F,MAAM,CAAN,IAAY,QASX;AATD,WAAY,QAAQ;IAClB,0BAA0B;IAC1B,uCAAI,CAAA;IACJ,qBAAqB;IACrB,iDAAS,CAAA;IACT,uDAAuD;IACvD,mDAAU,CAAA;IACV,uBAAuB;IACvB,iDAAS,CAAA;AACX,CAAC,EATW,QAAQ,KAAR,QAAQ,QASnB;AAED,4FAA4F;AAC5F,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,0BAA0B;IAC1B,iDAAI,CAAA;IACJ,uDAAuD;IACvD,6DAAU,CAAA;IACV,uBAAuB;IACvB,2DAAS,CAAA;AACX,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { consoleLogger, nullLogger } from './logging';
|
|
2
|
+
/** Updatable AlgoKit config */
|
|
3
|
+
export class UpdatableConfig {
|
|
4
|
+
config;
|
|
5
|
+
get logger() {
|
|
6
|
+
return this.config.logger;
|
|
7
|
+
}
|
|
8
|
+
get debug() {
|
|
9
|
+
return this.config.debug;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Returns the current logger, or the null logger if true is passed in to `returnNullLogger`
|
|
13
|
+
* @param returnNullLogger Whether or not to return the null logger
|
|
14
|
+
* @returns The requested logger
|
|
15
|
+
*/
|
|
16
|
+
getLogger(returnNullLogger) {
|
|
17
|
+
if (returnNullLogger) {
|
|
18
|
+
return nullLogger;
|
|
19
|
+
}
|
|
20
|
+
return this.logger;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Temporarily run with debug set to true.
|
|
24
|
+
* @param lambda A lambda expression with code to run with debug config set to true
|
|
25
|
+
*/
|
|
26
|
+
withDebug(lambda) {
|
|
27
|
+
const original = this.config.debug;
|
|
28
|
+
try {
|
|
29
|
+
this.config.debug = true;
|
|
30
|
+
lambda();
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
this.config.debug = original;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
constructor() {
|
|
37
|
+
this.config = {
|
|
38
|
+
logger: consoleLogger,
|
|
39
|
+
debug: false,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Update the AlgoKit configuration with your own configuration settings
|
|
44
|
+
* @param newConfig Partial or complete config to replace
|
|
45
|
+
*/
|
|
46
|
+
configure(newConfig) {
|
|
47
|
+
this.config = { ...this.config, ...newConfig };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,UAAU,EAAE,MAAM,WAAW,CAAA;AAU7D,+BAA+B;AAC/B,MAAM,OAAO,eAAe;IAClB,MAAM,CAAQ;IAEtB,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;IAC1B,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,gBAA0B;QAClC,IAAI,gBAAgB,EAAE;YACpB,OAAO,UAAU,CAAA;SAClB;QAED,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,MAAqB;QAC7B,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAA;QAClC,IAAI;YACF,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAA;YACxB,MAAM,EAAE,CAAA;SACT;gBAAS;YACR,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,QAAQ,CAAA;SAC7B;IACH,CAAC;IAED;QACE,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,aAAa;YACrB,KAAK,EAAE,KAAK;SACb,CAAA;IACH,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,SAA0B;QAClC,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,EAAE,CAAA;IAChD,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Defines the what additional actions occur with the transaction https://developer.algorand.org/docs/rest-apis/indexer/#oncompletion */
|
|
2
|
+
export var ApplicationOnComplete;
|
|
3
|
+
(function (ApplicationOnComplete) {
|
|
4
|
+
ApplicationOnComplete["noop"] = "noop";
|
|
5
|
+
ApplicationOnComplete["optin"] = "optin";
|
|
6
|
+
ApplicationOnComplete["closeout"] = "closeout";
|
|
7
|
+
ApplicationOnComplete["clear"] = "clear";
|
|
8
|
+
ApplicationOnComplete["update"] = "update";
|
|
9
|
+
ApplicationOnComplete["delete"] = "delete";
|
|
10
|
+
})(ApplicationOnComplete || (ApplicationOnComplete = {}));
|
|
11
|
+
/** Type of signature used by an account */
|
|
12
|
+
export var SignatureType;
|
|
13
|
+
(function (SignatureType) {
|
|
14
|
+
/** Normal signature */
|
|
15
|
+
SignatureType["sig"] = "sig";
|
|
16
|
+
/** Multisig */
|
|
17
|
+
SignatureType["msig"] = "msig";
|
|
18
|
+
/** Logic signature */
|
|
19
|
+
SignatureType["lsig"] = "lsig";
|
|
20
|
+
})(SignatureType || (SignatureType = {}));
|
|
21
|
+
/** Delegation status of the account */
|
|
22
|
+
export var AccountStatus;
|
|
23
|
+
(function (AccountStatus) {
|
|
24
|
+
/** Indicates that the associated account is delegated */
|
|
25
|
+
AccountStatus["Offline"] = "Offline";
|
|
26
|
+
/** Indicates that the associated account used as part of the delegation pool */
|
|
27
|
+
AccountStatus["Online"] = "Online";
|
|
28
|
+
/** Indicates that the associated account is neither a delegator nor a delegate */
|
|
29
|
+
AccountStatus["NotParticipating"] = "NotParticipating";
|
|
30
|
+
})(AccountStatus || (AccountStatus = {}));
|
|
31
|
+
//# sourceMappingURL=indexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../../src/types/indexer.ts"],"names":[],"mappings":"AAyeA,yIAAyI;AACzI,MAAM,CAAN,IAAY,qBAOX;AAPD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,wCAAe,CAAA;IACf,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,0CAAiB,CAAA;IACjB,0CAAiB,CAAA;AACnB,CAAC,EAPW,qBAAqB,KAArB,qBAAqB,QAOhC;AA6ED,2CAA2C;AAC3C,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,uBAAuB;IACvB,4BAAW,CAAA;IACX,eAAe;IACf,8BAAa,CAAA;IACb,sBAAsB;IACtB,8BAAa,CAAA;AACf,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED,uCAAuC;AACvC,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,yDAAyD;IACzD,oCAAmB,CAAA;IACnB,gFAAgF;IAChF,kCAAiB,CAAA;IACjB,kFAAkF;IAClF,sDAAqC,CAAA;AACvC,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
/* eslint-disable no-console */
|
|
3
|
+
/** A logger implementation that writes to console */
|
|
4
|
+
export const consoleLogger = {
|
|
5
|
+
error: console.error,
|
|
6
|
+
warn: console.warn,
|
|
7
|
+
info: console.info,
|
|
8
|
+
verbose: console.trace,
|
|
9
|
+
debug: console.debug,
|
|
10
|
+
};
|
|
11
|
+
/** A logger implementation that does nothing */
|
|
12
|
+
export const nullLogger = {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
14
|
+
error: function (message, ...optionalParams) { },
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
16
|
+
warn: function (message, ...optionalParams) { },
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
18
|
+
info: function (message, ...optionalParams) { },
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
20
|
+
verbose: function (message, ...optionalParams) { },
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
22
|
+
debug: function (message, ...optionalParams) { },
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../../../src/types/logging.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,+BAA+B;AAW/B,qDAAqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAAW;IACnC,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,OAAO,EAAE,OAAO,CAAC,KAAK;IACtB,KAAK,EAAE,OAAO,CAAC,KAAK;CACrB,CAAA;AAED,gDAAgD;AAChD,MAAM,CAAC,MAAM,UAAU,GAAW;IAChC,gEAAgE;IAChE,KAAK,EAAE,UAAU,OAAe,EAAE,GAAG,cAAyB,IAAS,CAAC;IACxE,gEAAgE;IAChE,IAAI,EAAE,UAAU,OAAe,EAAE,GAAG,cAAyB,IAAS,CAAC;IACvE,gEAAgE;IAChE,IAAI,EAAE,UAAU,OAAe,EAAE,GAAG,cAAyB,IAAS,CAAC;IACvE,gEAAgE;IAChE,OAAO,EAAE,UAAU,OAAe,EAAE,GAAG,cAAyB,IAAS,CAAC;IAC1E,gEAAgE;IAChE,KAAK,EAAE,UAAU,OAAe,EAAE,GAAG,cAAyB,IAAS,CAAC;CACzE,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const LOGIC_ERROR = /TransactionPool.Remember: transaction ([A-Z0-9]+): logic eval error: (.*). Details: pc=([0-9]+), opcodes=.*/;
|
|
2
|
+
/** Wraps key functionality around processing logic errors */
|
|
3
|
+
export class LogicError extends Error {
|
|
4
|
+
/** Takes an error message and parses out the details of any logic errors in there.
|
|
5
|
+
* @param errorMessage The error message to parse
|
|
6
|
+
* @returns The logic error details if any, or undefined
|
|
7
|
+
*/
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
static parseLogicError(error) {
|
|
10
|
+
const errorMessage = error.message;
|
|
11
|
+
const res = LOGIC_ERROR.exec(errorMessage);
|
|
12
|
+
if (res === null || res.length <= 3)
|
|
13
|
+
return undefined;
|
|
14
|
+
return {
|
|
15
|
+
txId: res[1],
|
|
16
|
+
msg: res[2],
|
|
17
|
+
desc: errorMessage,
|
|
18
|
+
pc: parseInt(res[3] ? res[3] : '0'),
|
|
19
|
+
traces: error.traces,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
led;
|
|
23
|
+
program;
|
|
24
|
+
lines = 5;
|
|
25
|
+
teal_line = 0;
|
|
26
|
+
stack;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new logic error object.
|
|
29
|
+
* @param errorDetails The details of the logic error
|
|
30
|
+
* @param program The TEAL source code, split by line
|
|
31
|
+
* @param map The source map of the TEAL source code
|
|
32
|
+
*/
|
|
33
|
+
constructor(errorDetails, program, map) {
|
|
34
|
+
super();
|
|
35
|
+
this.led = errorDetails;
|
|
36
|
+
this.program = program;
|
|
37
|
+
const line = map.getLineForPc(errorDetails.pc);
|
|
38
|
+
this.teal_line = line === undefined ? 0 : line;
|
|
39
|
+
this.message = `${this.led.msg}. at:${line}. ${this.led.desc}`;
|
|
40
|
+
if (this.teal_line > 0) {
|
|
41
|
+
const start = this.teal_line > this.lines ? this.teal_line - this.lines : 0;
|
|
42
|
+
const stop = program.length > this.teal_line + this.lines ? this.teal_line + this.lines : program.length;
|
|
43
|
+
const stack_lines = program.slice(start, stop);
|
|
44
|
+
stack_lines[stack_lines.length / 2] += ' <--- Error';
|
|
45
|
+
this.stack = stack_lines.join('\n');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=logic-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logic-error.js","sourceRoot":"","sources":["../../../src/types/logic-error.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,6GAA6G,CAAA;AAkBjI,6DAA6D;AAC7D,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC;;;OAGG;IACH,8DAA8D;IAC9D,MAAM,CAAC,eAAe,CAAC,KAAU;QAC/B,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAA;QAClC,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QAC1C,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO,SAAS,CAAA;QAErD,OAAO;YACL,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YACZ,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YACX,IAAI,EAAE,YAAY;YAClB,EAAE,EAAE,QAAQ,CAAC,GAAG,CAAC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AC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,aAAa,CAAA;YAEpD,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;SACpC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"network-client.js","sourceRoot":"","sources":["../../../src/types/network-client.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/types/testing.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/types/transaction.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer.js","sourceRoot":"","sources":["../../../src/types/transfer.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Buffer } from 'buffer';
|
|
2
|
+
import { fetch } from 'cross-fetch';
|
|
3
|
+
class URLTokenBaseHTTPError extends Error {
|
|
4
|
+
response;
|
|
5
|
+
constructor(message, response) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.response = response;
|
|
8
|
+
this.name = 'URLTokenBaseHTTPError';
|
|
9
|
+
this.response = response;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Implementation of BaseHTTPClient that uses a URL and a token
|
|
14
|
+
* and make the REST queries using fetch.
|
|
15
|
+
* This is the default implementation of BaseHTTPClient.
|
|
16
|
+
*/
|
|
17
|
+
export class URLTokenBaseHTTPClient {
|
|
18
|
+
defaultHeaders;
|
|
19
|
+
baseURL;
|
|
20
|
+
tokenHeader;
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
constructor(tokenHeader, baseServer, port, defaultHeaders = {}) {
|
|
23
|
+
this.defaultHeaders = defaultHeaders;
|
|
24
|
+
// Append a trailing slash so we can use relative paths. Without the trailing
|
|
25
|
+
// slash, the last path segment will be replaced by the relative path. See
|
|
26
|
+
// usage in `addressWithPath`.
|
|
27
|
+
const fixedBaseServer = baseServer.endsWith('/') ? baseServer : `${baseServer}/`;
|
|
28
|
+
const baseServerURL = new URL(fixedBaseServer);
|
|
29
|
+
if (typeof port !== 'undefined') {
|
|
30
|
+
baseServerURL.port = port.toString();
|
|
31
|
+
}
|
|
32
|
+
if (baseServerURL.protocol.length === 0) {
|
|
33
|
+
throw new Error('Invalid base server URL, protocol must be defined.');
|
|
34
|
+
}
|
|
35
|
+
this.baseURL = baseServerURL;
|
|
36
|
+
this.tokenHeader = tokenHeader;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Compute the URL for a path relative to the instance's address
|
|
40
|
+
* @param relativePath - A path string
|
|
41
|
+
* @param query - An optional key-value object of query parameters to add to the URL. If the
|
|
42
|
+
* relativePath already has query parameters on it, the additional parameters defined here will
|
|
43
|
+
* be added to the URL without modifying those (unless a key collision occurs).
|
|
44
|
+
* @returns A URL string
|
|
45
|
+
*/
|
|
46
|
+
getURL(relativePath, query) {
|
|
47
|
+
let fixedRelativePath;
|
|
48
|
+
if (relativePath.startsWith('./')) {
|
|
49
|
+
fixedRelativePath = relativePath;
|
|
50
|
+
}
|
|
51
|
+
else if (relativePath.startsWith('/')) {
|
|
52
|
+
fixedRelativePath = `.${relativePath}`;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
fixedRelativePath = `./${relativePath}`;
|
|
56
|
+
}
|
|
57
|
+
const address = new URL(fixedRelativePath, this.baseURL);
|
|
58
|
+
if (query) {
|
|
59
|
+
for (const [key, value] of Object.entries(query)) {
|
|
60
|
+
address.searchParams.set(key, value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return address.toString();
|
|
64
|
+
}
|
|
65
|
+
static formatFetchResponseHeaders(headers) {
|
|
66
|
+
const headersObj = {};
|
|
67
|
+
headers.forEach((key, value) => {
|
|
68
|
+
headersObj[key] = value;
|
|
69
|
+
});
|
|
70
|
+
return headersObj;
|
|
71
|
+
}
|
|
72
|
+
static async checkHttpError(res) {
|
|
73
|
+
if (res.ok) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
let body = null;
|
|
77
|
+
let bodyErrorMessage = null;
|
|
78
|
+
try {
|
|
79
|
+
body = new Uint8Array(await res.arrayBuffer());
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
const decoded = JSON.parse(Buffer.from(body).toString());
|
|
82
|
+
if (decoded.message) {
|
|
83
|
+
bodyErrorMessage = decoded.message;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (_) {
|
|
87
|
+
// ignore any error that happened while we are parsing the error response
|
|
88
|
+
}
|
|
89
|
+
let message = `Network request error. Received status ${res.status} (${res.statusText})`;
|
|
90
|
+
if (bodyErrorMessage) {
|
|
91
|
+
message += `: ${bodyErrorMessage}`;
|
|
92
|
+
}
|
|
93
|
+
throw new URLTokenBaseHTTPError(message, {
|
|
94
|
+
body: body !== null ? body : new Uint8Array(),
|
|
95
|
+
status: res.status,
|
|
96
|
+
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
static async formatFetchResponse(res) {
|
|
100
|
+
await this.checkHttpError(res);
|
|
101
|
+
return {
|
|
102
|
+
body: new Uint8Array(await res.arrayBuffer()),
|
|
103
|
+
status: res.status,
|
|
104
|
+
headers: URLTokenBaseHTTPClient.formatFetchResponseHeaders(res.headers),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async get(relativePath, query, requestHeaders = {}) {
|
|
108
|
+
// Expand headers for use in fetch
|
|
109
|
+
const headers = {
|
|
110
|
+
...this.tokenHeader,
|
|
111
|
+
...this.defaultHeaders,
|
|
112
|
+
...requestHeaders,
|
|
113
|
+
};
|
|
114
|
+
const res = await fetch(this.getURL(relativePath, query), {
|
|
115
|
+
mode: 'cors',
|
|
116
|
+
headers,
|
|
117
|
+
});
|
|
118
|
+
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
119
|
+
}
|
|
120
|
+
async post(relativePath, data, query, requestHeaders = {}) {
|
|
121
|
+
// Expand headers for use in fetch
|
|
122
|
+
const headers = {
|
|
123
|
+
...this.tokenHeader,
|
|
124
|
+
...this.defaultHeaders,
|
|
125
|
+
...requestHeaders,
|
|
126
|
+
};
|
|
127
|
+
const res = await fetch(this.getURL(relativePath, query), {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
mode: 'cors',
|
|
130
|
+
body: data,
|
|
131
|
+
headers,
|
|
132
|
+
});
|
|
133
|
+
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
134
|
+
}
|
|
135
|
+
async delete(relativePath, data, query, requestHeaders = {}) {
|
|
136
|
+
// Expand headers for use in fetch
|
|
137
|
+
const headers = {
|
|
138
|
+
...this.tokenHeader,
|
|
139
|
+
...this.defaultHeaders,
|
|
140
|
+
...requestHeaders,
|
|
141
|
+
};
|
|
142
|
+
const res = await fetch(this.getURL(relativePath, query), {
|
|
143
|
+
method: 'DELETE',
|
|
144
|
+
mode: 'cors',
|
|
145
|
+
body: data,
|
|
146
|
+
headers,
|
|
147
|
+
});
|
|
148
|
+
return URLTokenBaseHTTPClient.formatFetchResponse(res);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=urlTokenBaseHTTPClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlTokenBaseHTTPClient.js","sourceRoot":"","sources":["../../../src/types/urlTokenBaseHTTPClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAkBnC,MAAM,qBAAsB,SAAQ,KAAK;IACH;IAApC,YAAY,OAAe,EA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ClC,MAAM,OAAO,GAAG;YACd,GAAG,IAAI,CAAC,WAAW;YACnB,GAAG,IAAI,CAAC,cAAc;YACtB,GAAG,cAAc;SAClB,CAAA;QAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE;YACxD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,IAAI;YACV,OAAO;SACR,CAAC,CAAA;QAEF,OAAO,sBAAsB,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAA;IACxD,CAAC;IAED,KAAK,CAAC,MAAM,CACV,YAAoB,EACpB,IAAgB,EAChB,KAAqB,EACrB,iBAAyC,EAAE;QAE3C,kCAAkC;QAClC,MAAM,OAAO,GAAG;YACd,GAAG,IAAI,CAAC,WAAW;YACnB,GAAG,IAAI,CAAC,cAAc;YACtB,GAAG,cAAc;SAClB,CAAA;QAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,MAAM,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"}
|
package/esm/util.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a value which might be a number or a bigint into a number to be used with apis that don't support bigint.
|
|
3
|
+
*
|
|
4
|
+
* Throws an UnsafeConversionError if the conversion would result in an unsafe integer for the Number type
|
|
5
|
+
* @param value
|
|
6
|
+
*/
|
|
7
|
+
export const toNumber = (value) => {
|
|
8
|
+
if (typeof value === 'number')
|
|
9
|
+
return value;
|
|
10
|
+
if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
11
|
+
throw new UnsafeConversionError(`Cannot convert ${value} to a Number as it is larger than the maximum safe integer the Number type can hold.`);
|
|
12
|
+
}
|
|
13
|
+
else if (value < BigInt(Number.MIN_SAFE_INTEGER)) {
|
|
14
|
+
throw new UnsafeConversionError(`Cannot convert ${value} to a Number as it is smaller than the minimum safe integer the Number type can hold.`);
|
|
15
|
+
}
|
|
16
|
+
return Number(value);
|
|
17
|
+
};
|
|
18
|
+
export class UnsafeConversionError extends Error {
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=util.js.map
|
package/esm/util.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,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;AAED,MAAM,OAAO,qBAAsB,SAAQ,KAAK;CAAG"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"main": "index.js",
|
|
3
|
-
"types": "index.d.ts",
|
|
2
|
+
"main": "./cjs/index.js",
|
|
3
|
+
"types": "./types/index.d.ts",
|
|
4
4
|
"name": "@algorandfoundation/algokit-utils",
|
|
5
|
-
"version": "2.3.3-beta.
|
|
5
|
+
"version": "2.3.3-beta.5",
|
|
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",
|
|
@@ -10,14 +10,50 @@
|
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=16.0"
|
|
12
12
|
},
|
|
13
|
+
"module": "./esm/index.js",
|
|
14
|
+
"typesVersions": {
|
|
15
|
+
"*": {
|
|
16
|
+
".": [
|
|
17
|
+
"types/index.d.ts"
|
|
18
|
+
],
|
|
19
|
+
"types/app": [
|
|
20
|
+
"types/types/app.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"types/app-client": [
|
|
23
|
+
"types/types/app-client.d.ts"
|
|
24
|
+
],
|
|
25
|
+
"types/app-spec": [
|
|
26
|
+
"types/types/app-spec.d.ts"
|
|
27
|
+
],
|
|
28
|
+
"types/transaction": [
|
|
29
|
+
"types/types/transaction.d.ts"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
},
|
|
13
33
|
"files": [
|
|
14
34
|
"**/*"
|
|
15
35
|
],
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"import": "./esm/index.js",
|
|
39
|
+
"require": "./cjs/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./testing": {
|
|
42
|
+
"import": "./esm/testing/index.js",
|
|
43
|
+
"require": "./cjs/testing/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./index.d.ts": "./types/index.d.ts",
|
|
46
|
+
"./package.json": "./package.json"
|
|
47
|
+
},
|
|
16
48
|
"overrides": {
|
|
17
|
-
"semver": "7.5.2"
|
|
49
|
+
"semver": "7.5.2",
|
|
50
|
+
"eslint-plugin-prettier": "5.0.0"
|
|
18
51
|
},
|
|
19
52
|
"dependencies": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
53
|
+
"buffer": "^6.0.3",
|
|
54
|
+
"cross-fetch": "^4.0.0"
|
|
55
|
+
},
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"algosdk": "^2.5.0"
|
|
22
58
|
}
|
|
23
59
|
}
|