@algorandfoundation/algokit-utils 6.0.5 → 6.1.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.
Files changed (117) hide show
  1. package/README.md +8 -0
  2. package/account/account.d.ts +24 -3
  3. package/account/account.d.ts.map +1 -1
  4. package/account/account.js +29 -53
  5. package/account/account.js.map +1 -1
  6. package/account/account.mjs +29 -53
  7. package/account/account.mjs.map +1 -1
  8. package/account/get-account.d.ts +2 -2
  9. package/account/get-account.d.ts.map +1 -1
  10. package/account/get-account.js +9 -29
  11. package/account/get-account.js.map +1 -1
  12. package/account/get-account.mjs +4 -24
  13. package/account/get-account.mjs.map +1 -1
  14. package/account/get-dispenser-account.d.ts +7 -2
  15. package/account/get-dispenser-account.d.ts.map +1 -1
  16. package/account/get-dispenser-account.js +7 -8
  17. package/account/get-dispenser-account.js.map +1 -1
  18. package/account/get-dispenser-account.mjs +7 -8
  19. package/account/get-dispenser-account.mjs.map +1 -1
  20. package/account/mnemonic-account.d.ts +4 -1
  21. package/account/mnemonic-account.d.ts.map +1 -1
  22. package/account/mnemonic-account.js +4 -1
  23. package/account/mnemonic-account.js.map +1 -1
  24. package/account/mnemonic-account.mjs +4 -1
  25. package/account/mnemonic-account.mjs.map +1 -1
  26. package/dispenser-client.d.ts +2 -0
  27. package/dispenser-client.d.ts.map +1 -1
  28. package/dispenser-client.js +2 -0
  29. package/dispenser-client.js.map +1 -1
  30. package/dispenser-client.mjs +2 -0
  31. package/dispenser-client.mjs.map +1 -1
  32. package/index.d.ts +7 -7
  33. package/index.d.ts.map +1 -1
  34. package/index.js +31 -31
  35. package/index.mjs +9 -9
  36. package/localnet/get-kmd-wallet-account.d.ts +2 -0
  37. package/localnet/get-kmd-wallet-account.d.ts.map +1 -1
  38. package/localnet/get-kmd-wallet-account.js +5 -30
  39. package/localnet/get-kmd-wallet-account.js.map +1 -1
  40. package/localnet/get-kmd-wallet-account.mjs +5 -30
  41. package/localnet/get-kmd-wallet-account.mjs.map +1 -1
  42. package/localnet/get-localnet-dispenser-account.d.ts +2 -0
  43. package/localnet/get-localnet-dispenser-account.d.ts.map +1 -1
  44. package/localnet/get-localnet-dispenser-account.js +5 -7
  45. package/localnet/get-localnet-dispenser-account.js.map +1 -1
  46. package/localnet/get-localnet-dispenser-account.mjs +5 -7
  47. package/localnet/get-localnet-dispenser-account.mjs.map +1 -1
  48. package/localnet/get-or-create-kmd-wallet-account.d.ts +2 -0
  49. package/localnet/get-or-create-kmd-wallet-account.d.ts.map +1 -1
  50. package/localnet/get-or-create-kmd-wallet-account.js +5 -27
  51. package/localnet/get-or-create-kmd-wallet-account.js.map +1 -1
  52. package/localnet/get-or-create-kmd-wallet-account.mjs +5 -27
  53. package/localnet/get-or-create-kmd-wallet-account.mjs.map +1 -1
  54. package/localnet/is-localnet.d.ts +4 -1
  55. package/localnet/is-localnet.d.ts.map +1 -1
  56. package/localnet/is-localnet.js +7 -3
  57. package/localnet/is-localnet.js.map +1 -1
  58. package/localnet/is-localnet.mjs +7 -3
  59. package/localnet/is-localnet.mjs.map +1 -1
  60. package/network-client.d.ts +36 -8
  61. package/network-client.d.ts.map +1 -1
  62. package/network-client.js +49 -88
  63. package/network-client.js.map +1 -1
  64. package/network-client.mjs +49 -88
  65. package/network-client.mjs.map +1 -1
  66. package/package.json +3 -2
  67. package/testing/account.d.ts +3 -5
  68. package/testing/account.d.ts.map +1 -1
  69. package/testing/account.js +6 -9
  70. package/testing/account.js.map +1 -1
  71. package/testing/account.mjs +6 -9
  72. package/testing/account.mjs.map +1 -1
  73. package/testing/fixtures/algorand-fixture.d.ts +20 -2
  74. package/testing/fixtures/algorand-fixture.d.ts.map +1 -1
  75. package/testing/fixtures/algorand-fixture.js +11 -30
  76. package/testing/fixtures/algorand-fixture.js.map +1 -1
  77. package/testing/fixtures/algorand-fixture.mjs +11 -30
  78. package/testing/fixtures/algorand-fixture.mjs.map +1 -1
  79. package/transaction/transaction.d.ts.map +1 -1
  80. package/transaction/transaction.js +22 -9
  81. package/transaction/transaction.js.map +1 -1
  82. package/transaction/transaction.mjs +22 -9
  83. package/transaction/transaction.mjs.map +1 -1
  84. package/transfer/transfer.js +4 -4
  85. package/transfer/transfer.js.map +1 -1
  86. package/transfer/transfer.mjs +4 -4
  87. package/transfer/transfer.mjs.map +1 -1
  88. package/types/account-manager.d.ts +108 -24
  89. package/types/account-manager.d.ts.map +1 -1
  90. package/types/account-manager.js +167 -34
  91. package/types/account-manager.js.map +1 -1
  92. package/types/account-manager.mjs +166 -34
  93. package/types/account-manager.mjs.map +1 -1
  94. package/types/account.d.ts +13 -11
  95. package/types/account.d.ts.map +1 -1
  96. package/types/algorand-client.d.ts +12 -6
  97. package/types/algorand-client.d.ts.map +1 -1
  98. package/types/algorand-client.js +20 -15
  99. package/types/algorand-client.js.map +1 -1
  100. package/types/algorand-client.mjs +20 -15
  101. package/types/algorand-client.mjs.map +1 -1
  102. package/types/client-manager.d.ts +197 -4
  103. package/types/client-manager.d.ts.map +1 -1
  104. package/types/client-manager.js +284 -7
  105. package/types/client-manager.js.map +1 -1
  106. package/types/client-manager.mjs +284 -7
  107. package/types/client-manager.mjs.map +1 -1
  108. package/types/kmd-account-manager.d.ts +70 -0
  109. package/types/kmd-account-manager.d.ts.map +1 -0
  110. package/types/kmd-account-manager.js +144 -0
  111. package/types/kmd-account-manager.js.map +1 -0
  112. package/types/kmd-account-manager.mjs +142 -0
  113. package/types/kmd-account-manager.mjs.map +1 -0
  114. package/types/network-client.d.ts +2 -2
  115. package/types/network-client.d.ts.map +1 -1
  116. package/types/testing.d.ts +9 -6
  117. package/types/testing.d.ts.map +1 -1
@@ -1,13 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var config = require('../config.js');
4
- var networkClient = require('../network-client.js');
5
- var transferAlgos = require('../transfer/transfer-algos.js');
6
- var types_amount = require('../types/amount.js');
7
- var getKmdWalletAccount = require('./get-kmd-wallet-account.js');
8
- var getLocalnetDispenserAccount = require('./get-localnet-dispenser-account.js');
3
+ var types_clientManager = require('../types/client-manager.js');
4
+ var types_kmdAccountManager = require('../types/kmd-account-manager.js');
9
5
 
10
6
  /**
7
+ * @deprecated use `algorandClient.account.kmd.getOrCreateWalletAccount(name, fundWith)` or `new KMDAccountManager(clientManager).getOrCreateWalletAccount(name, fundWith)` instead.
8
+ *
11
9
  * Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name.
12
10
  *
13
11
  * This is useful to get idempotent accounts from LocalNet without having to specify the private key (which will change when resetting the LocalNet).
@@ -25,27 +23,7 @@ var getLocalnetDispenserAccount = require('./get-localnet-dispenser-account.js')
25
23
  * @returns An Algorand account with private key loaded - either one that already existed in the given KMD wallet, or a new one that is funded for you
26
24
  */
27
25
  async function getOrCreateKmdWalletAccount(walletAccount, algod, kmdClient) {
28
- const kmd = kmdClient ?? networkClient.getAlgoKmdClient();
29
- // Get an existing account from the KMD wallet
30
- const existing = await getKmdWalletAccount.getKmdWalletAccount(walletAccount, algod, kmd);
31
- if (existing) {
32
- return existing;
33
- }
34
- // None existed: create the KMD wallet instead
35
- const walletId = (await kmd.createWallet(walletAccount.name, '')).wallet.id;
36
- const walletHandle = (await kmd.initWalletHandle(walletId, '')).wallet_handle_token;
37
- await kmd.generateKey(walletHandle);
38
- // Get the account from the new KMD wallet
39
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
40
- const account = (await getKmdWalletAccount.getKmdWalletAccount(walletAccount, algod, kmd));
41
- config.Config.logger.info(`LocalNet account '${walletAccount.name}' doesn't yet exist; created account ${account.addr} with keys stored in KMD and funding with ${walletAccount.fundWith?.algos ?? 1000} ALGOs`);
42
- // Fund the account from the dispenser
43
- await transferAlgos.transferAlgos({
44
- amount: walletAccount.fundWith ?? types_amount.AlgoAmount.Algos(1000),
45
- from: await getLocalnetDispenserAccount.getLocalNetDispenserAccount(algod, kmd),
46
- to: account.addr,
47
- }, algod);
48
- return account;
26
+ return (await new types_kmdAccountManager.KmdAccountManager(new types_clientManager.ClientManager({ algod, kmd: kmdClient })).getOrCreateWalletAccount(walletAccount.name, walletAccount.fundWith)).account;
49
27
  }
50
28
 
51
29
  exports.getOrCreateKmdWalletAccount = getOrCreateKmdWalletAccount;
@@ -1 +1 @@
1
- {"version":3,"file":"get-or-create-kmd-wallet-account.js","sources":["../../src/localnet/get-or-create-kmd-wallet-account.ts"],"sourcesContent":[null],"names":["getAlgoKmdClient","getKmdWalletAccount","Config","transferAlgos","AlgoAmount","getLocalNetDispenserAccount"],"mappings":";;;;;;;;;AAWA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,2BAA2B,CAC/C,aAAsD,EACtD,KAAc,EACd,SAAe,EAAA;AAEf,IAAA,MAAM,GAAG,GAAG,SAAS,IAAIA,8BAAgB,EAAE,CAAA;;IAG3C,MAAM,QAAQ,GAAG,MAAMC,uCAAmB,CAAC,aAAa,EAAE,KAAK,EAAE,GAAG,CAAC,CAAA;IACrE,IAAI,QAAQ,EAAE;AACZ,QAAA,OAAO,QAAQ,CAAA;KAChB;;AAGD,IAAA,MAAM,QAAQ,GAAG,CAAC,MAAM,GAAG,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,CAAA;AAC3E,IAAA,MAAM,YAAY,GAAG,CAAC,MAAM,GAAG,CAAC,gBAAgB,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,mBAAmB,CAAA;AACnF,IAAA,MAAM,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA;;;AAInC,IAAA,MAAM,OAAO,IAAI,MAAMA,uCAAmB,CAAC,aAAa,EAAE,KAAK,EAAE,GAAG,CAAC,CAAE,CAAA;IAEvEC,aAAM,CAAC,MAAM,CAAC,IAAI,CAChB,CAAqB,kBAAA,EAAA,aAAa,CAAC,IAAI,CAAwC,qCAAA,EAAA,OAAO,CAAC,IAAI,CAAA,0CAAA,EACzF,aAAa,CAAC,QAAQ,EAAE,KAAK,IAAI,IACnC,CAAQ,MAAA,CAAA,CACT,CAAA;;AAGD,IAAA,MAAMC,2BAAa,CACjB;QACE,MAAM,EAAE,aAAa,CAAC,QAAQ,IAAIC,uBAAU,CAAC,KAAK,CAAC,IAAI,CAAC;AACxD,QAAA,IAAI,EAAE,MAAMC,uDAA2B,CAAC,KAAK,EAAE,GAAG,CAAC;QACnD,EAAE,EAAE,OAAO,CAAC,IAAI;KACjB,EACD,KAAK,CACN,CAAA;AAED,IAAA,OAAO,OAAO,CAAA;AAChB;;;;"}
1
+ {"version":3,"file":"get-or-create-kmd-wallet-account.js","sources":["../../src/localnet/get-or-create-kmd-wallet-account.ts"],"sourcesContent":[null],"names":["KmdAccountManager","ClientManager"],"mappings":";;;;;AAQA;;;;;;;;;;;;;;;;;;AAkBG;AACI,eAAe,2BAA2B,CAC/C,aAAsD,EACtD,KAAc,EACd,SAAe,EAAA;AAEf,IAAA,OAAO,CACL,MAAM,IAAIA,yCAAiB,CAAC,IAAIC,iCAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAChG,aAAa,CAAC,IAAI,EAClB,aAAa,CAAC,QAAQ,CACvB,EACD,OAAO,CAAA;AACX;;;;"}
@@ -1,11 +1,9 @@
1
- import { Config } from '../config.mjs';
2
- import { getAlgoKmdClient } from '../network-client.mjs';
3
- import { transferAlgos } from '../transfer/transfer-algos.mjs';
4
- import { AlgoAmount } from '../types/amount.mjs';
5
- import { getKmdWalletAccount } from './get-kmd-wallet-account.mjs';
6
- import { getLocalNetDispenserAccount } from './get-localnet-dispenser-account.mjs';
1
+ import { ClientManager } from '../types/client-manager.mjs';
2
+ import { KmdAccountManager } from '../types/kmd-account-manager.mjs';
7
3
 
8
4
  /**
5
+ * @deprecated use `algorandClient.account.kmd.getOrCreateWalletAccount(name, fundWith)` or `new KMDAccountManager(clientManager).getOrCreateWalletAccount(name, fundWith)` instead.
6
+ *
9
7
  * Gets an account with private key loaded from a KMD wallet of the given name, or alternatively creates one with funds in it via a KMD wallet of the given name.
10
8
  *
11
9
  * This is useful to get idempotent accounts from LocalNet without having to specify the private key (which will change when resetting the LocalNet).
@@ -23,27 +21,7 @@ import { getLocalNetDispenserAccount } from './get-localnet-dispenser-account.mj
23
21
  * @returns An Algorand account with private key loaded - either one that already existed in the given KMD wallet, or a new one that is funded for you
24
22
  */
25
23
  async function getOrCreateKmdWalletAccount(walletAccount, algod, kmdClient) {
26
- const kmd = kmdClient ?? getAlgoKmdClient();
27
- // Get an existing account from the KMD wallet
28
- const existing = await getKmdWalletAccount(walletAccount, algod, kmd);
29
- if (existing) {
30
- return existing;
31
- }
32
- // None existed: create the KMD wallet instead
33
- const walletId = (await kmd.createWallet(walletAccount.name, '')).wallet.id;
34
- const walletHandle = (await kmd.initWalletHandle(walletId, '')).wallet_handle_token;
35
- await kmd.generateKey(walletHandle);
36
- // Get the account from the new KMD wallet
37
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
38
- const account = (await getKmdWalletAccount(walletAccount, algod, kmd));
39
- Config.logger.info(`LocalNet account '${walletAccount.name}' doesn't yet exist; created account ${account.addr} with keys stored in KMD and funding with ${walletAccount.fundWith?.algos ?? 1000} ALGOs`);
40
- // Fund the account from the dispenser
41
- await transferAlgos({
42
- amount: walletAccount.fundWith ?? AlgoAmount.Algos(1000),
43
- from: await getLocalNetDispenserAccount(algod, kmd),
44
- to: account.addr,
45
- }, algod);
46
- return account;
24
+ return (await new KmdAccountManager(new ClientManager({ algod, kmd: kmdClient })).getOrCreateWalletAccount(walletAccount.name, walletAccount.fundWith)).account;
47
25
  }
48
26
 
49
27
  export { getOrCreateKmdWalletAccount };
@@ -1 +1 @@
1
- {"version":3,"file":"get-or-create-kmd-wallet-account.mjs","sources":["../../src/localnet/get-or-create-kmd-wallet-account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAWA;;;;;;;;;;;;;;;;AAgBG;AACI,eAAe,2BAA2B,CAC/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et-account.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAQA;;;;;;;;;;;;;;;;;;AAkBG;AACI,eAAe,2BAA2B,CAC/C,aAAsD,EACtD,KAAc,EACd,SAAe,EAAA;AAEf,IAAA,OAAO,CACL,MAAM,IAAI,iBAAiB,CAAC,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAChG,aAAa,CAAC,IAAI,EAClB,aAAa,CAAC,QAAQ,CACvB,EACD,OAAO,CAAA;AACX;;;;"}
@@ -1,5 +1,8 @@
1
1
  import algosdk from 'algosdk';
2
2
  import Algodv2 = algosdk.Algodv2;
3
- /** Returns true if the algod client is pointing to a LocalNet Algorand network */
3
+ /** @deprecated Use `await algorandClient.client.isLocalNet()` or `await new ClientManager({ algod }).isLocalNet()` instead.
4
+ *
5
+ * Returns true if the algod client is pointing to a LocalNet Algorand network
6
+ */
4
7
  export declare function isLocalNet(algod: Algodv2): Promise<boolean>;
5
8
  //# sourceMappingURL=is-localnet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"is-localnet.d.ts","sourceRoot":"","sources":["../../src/localnet/is-localnet.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAEhC,kFAAkF;AAClF,wBAAsB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAIjE"}
1
+ {"version":3,"file":"is-localnet.d.ts","sourceRoot":"","sources":["../../src/localnet/is-localnet.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAEhC;;;GAGG;AACH,wBAAsB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEjE"}
@@ -1,9 +1,13 @@
1
1
  'use strict';
2
2
 
3
- /** Returns true if the algod client is pointing to a LocalNet Algorand network */
3
+ var types_clientManager = require('../types/client-manager.js');
4
+
5
+ /** @deprecated Use `await algorandClient.client.isLocalNet()` or `await new ClientManager({ algod }).isLocalNet()` instead.
6
+ *
7
+ * Returns true if the algod client is pointing to a LocalNet Algorand network
8
+ */
4
9
  async function isLocalNet(algod) {
5
- const params = await algod.getTransactionParams().do();
6
- return params.genesisID === 'devnet-v1' || params.genesisID === 'sandnet-v1' || params.genesisID === 'dockernet-v1';
10
+ return await new types_clientManager.ClientManager({ algod }).isLocalNet();
7
11
  }
8
12
 
9
13
  exports.isLocalNet = isLocalNet;
@@ -1 +1 @@
1
- {"version":3,"file":"is-localnet.js","sources":["../../src/localnet/is-localnet.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAGA;AACO,eAAe,UAAU,CAAC,KAAc,EAAA;IAC7C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAA;AAEtD,IAAA,OAAO,MAAM,CAAC,SAAS,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,KAAK,YAAY,IAAI,MAAM,CAAC,SAAS,KAAK,cAAc,CAAA;AACrH;;;;"}
1
+ {"version":3,"file":"is-localnet.js","sources":["../../src/localnet/is-localnet.ts"],"sourcesContent":[null],"names":["ClientManager"],"mappings":";;;;AAIA;;;AAGG;AACI,eAAe,UAAU,CAAC,KAAc,EAAA;IAC7C,OAAO,MAAM,IAAIA,iCAAa,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;AACxD;;;;"}
@@ -1,7 +1,11 @@
1
- /** Returns true if the algod client is pointing to a LocalNet Algorand network */
1
+ import { ClientManager } from '../types/client-manager.mjs';
2
+
3
+ /** @deprecated Use `await algorandClient.client.isLocalNet()` or `await new ClientManager({ algod }).isLocalNet()` instead.
4
+ *
5
+ * Returns true if the algod client is pointing to a LocalNet Algorand network
6
+ */
2
7
  async function isLocalNet(algod) {
3
- const params = await algod.getTransactionParams().do();
4
- return params.genesisID === 'devnet-v1' || params.genesisID === 'sandnet-v1' || params.genesisID === 'dockernet-v1';
8
+ return await new ClientManager({ algod }).isLocalNet();
5
9
  }
6
10
 
7
11
  export { isLocalNet };
@@ -1 +1 @@
1
- {"version":3,"file":"is-localnet.mjs","sources":["../../src/localnet/is-localnet.ts"],"sourcesContent":[null],"names":[],"mappings":"AAGA;AACO,eAAe,UAAU,CAAC,KAAc,EAAA;IAC7C,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,oBAAoB,EAAE,CAAC,EAAE,EAAE,CAAA;AAEtD,IAAA,OAAO,MAAM,CAAC,SAAS,KAAK,WAAW,IAAI,MAAM,CAAC,SAAS,KAAK,YAAY,IAAI,MAAM,CAAC,SAAS,KAAK,cAAc,CAAA;AACrH;;;;"}
1
+ {"version":3,"file":"is-localnet.mjs","sources":["../../src/localnet/is-localnet.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAIA;;;AAGG;AACI,eAAe,UAAU,CAAC,KAAc,EAAA;IAC7C,OAAO,MAAM,IAAI,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,CAAA;AACxD;;;;"}
@@ -4,24 +4,45 @@ import Algodv2 = algosdk.Algodv2;
4
4
  import Indexer = algosdk.Indexer;
5
5
  import Kmd = algosdk.Kmd;
6
6
  import IntDecoding = algosdk.IntDecoding;
7
- /** Retrieve configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment not algod-side) */
7
+ /**
8
+ * @deprecated Use `ClientManager.getConfigFromEnvironmentOrLocalNet()` instead.
9
+ *
10
+ * Retrieve configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment not algod-side)
11
+ */
8
12
  export declare function getConfigFromEnvOrDefaults(): AlgoConfig;
9
- /** Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment not algod-side) */
13
+ /**
14
+ * @deprecated Use `ClientManager.getAlgodConfigFromEnvironment()` instead.
15
+ *
16
+ * Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment not algod-side)
17
+ */
10
18
  export declare function getAlgodConfigFromEnvironment(): AlgoClientConfig;
11
- /** Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment not algod-side) */
19
+ /**
20
+ * @deprecated Use `ClientManager.getIndexerConfigFromEnvironment()` instead.
21
+ *
22
+ * Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment not algod-side)
23
+ */
12
24
  export declare function getIndexerConfigFromEnvironment(): AlgoClientConfig;
13
- /** Returns the Algorand configuration to point to the AlgoNode service
25
+ /**
26
+ * @deprecated Use `ClientManager.getAlgoNodeConfig(network, config)` instead.
27
+ *
28
+ * Returns the Algorand configuration to point to the AlgoNode service
14
29
  *
15
30
  * @param network Which network to connect to - TestNet or MainNet
16
31
  * @param config Which algod config to return - Algod or Indexer
17
32
  */
18
33
  export declare function getAlgoNodeConfig(network: 'testnet' | 'mainnet', config: 'algod' | 'indexer'): AlgoClientConfig;
19
- /** Returns the Algorand configuration to point to the default LocalNet
34
+ /**
35
+ * @deprecated Use `ClientManager.getDefaultLocalNetConfig(configOrPort)` instead.
36
+ *
37
+ * Returns the Algorand configuration to point to the default LocalNet
20
38
  *
21
39
  * @param configOrPort Which algod config to return - algod, kmd, or indexer OR a port number
22
40
  */
23
41
  export declare function getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexer' | 'kmd' | number): AlgoClientConfig;
24
- /** Returns an algod SDK client that automatically retries on idempotent calls
42
+ /**
43
+ * @deprecated Use `ClientManager.getAlgodClient(config)` or `ClientManager.getAlgodClientFromEnvironment()` instead.
44
+ *
45
+ * Returns an algod SDK client that automatically retries transient failures on idempotent calls
25
46
  *
26
47
  * @param config The config if you want to override the default (getting config from process.env)
27
48
  * @example Default (load from environment variables)
@@ -49,7 +70,10 @@ export declare function getDefaultLocalNetConfig(configOrPort: 'algod' | 'indexe
49
70
  * ```
50
71
  */
51
72
  export declare function getAlgoClient(config?: AlgoClientConfig): Algodv2;
52
- /** Returns an indexer SDK client that automatically retries on idempotent calls
73
+ /**
74
+ * @deprecated Use `ClientManager.getIndexerClient(config, overrideIntDecoding)` or `ClientManager.getIndexerClientFromEnvironment(overrideIntDecoding)` instead.
75
+ *
76
+ * Returns an indexer SDK client that automatically retries transient failures on idempotent calls
53
77
  *
54
78
  * @param config The config if you want to override the default (getting config from process.env)
55
79
  * @param overrideIntDecoding Override the default int decoding for responses, uses MIXED by default to avoid lost precision for big integers
@@ -82,7 +106,9 @@ export declare function getAlgoClient(config?: AlgoClientConfig): Algodv2;
82
106
  */
83
107
  export declare function getAlgoIndexerClient(config?: AlgoClientConfig, overrideIntDecoding?: IntDecoding): Indexer;
84
108
  /**
85
- * Returns a KMD SDK client that automatically retries on idempotent calls
109
+ * @deprecated Use `ClientManager.getKmdClient(config)` or `ClientManager.getKmdClientFromEnvironment()` instead.
110
+ *
111
+ * Returns a KMD SDK client that automatically retries transient failures on idempotent calls.
86
112
  *
87
113
  * KMD client allows you to export private keys, which is useful to get the default account in a LocalNet network.
88
114
  *
@@ -99,6 +125,8 @@ export declare function getAlgoIndexerClient(config?: AlgoClientConfig, override
99
125
  * ```
100
126
  */
101
127
  export declare function getAlgoKmdClient(config?: AlgoClientConfig): Kmd;
128
+ /** @deprecated Use `await algorandClient.client.isTestNet()` or `await new ClientManager({ algod }).isTestNet()` instead. */
102
129
  export declare function isTestNet(algod: Algodv2): Promise<boolean>;
130
+ /** @deprecated Use `await algorandClient.client.isMainNet()` or `await new ClientManager({ algod }).isMainNet()` instead. */
103
131
  export declare function isMainNet(algod: Algodv2): Promise<boolean>;
104
132
  //# sourceMappingURL=network-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"network-client.d.ts","sourceRoot":"","sources":["../src/network-client.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAA;AAG7B,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AACrE,OAAO,OAAO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,CAAC,OAAO,CAAC,CAEhE"}
package/network-client.js CHANGED
@@ -1,92 +1,56 @@
1
1
  'use strict';
2
2
 
3
- var algosdk = require('algosdk');
4
- var types_algoHttpClientWithRetry = require('./types/algo-http-client-with-retry.js');
3
+ var types_clientManager = require('./types/client-manager.js');
5
4
 
6
- var Indexer = algosdk.Indexer;
7
- var Kmd = algosdk.Kmd;
8
- var IntDecoding = algosdk.IntDecoding;
9
- /** Retrieve configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment not algod-side) */
5
+ /**
6
+ * @deprecated Use `ClientManager.getConfigFromEnvironmentOrLocalNet()` instead.
7
+ *
8
+ * Retrieve configurations from environment variables when defined or get defaults (expects to be called from a Node.js environment not algod-side)
9
+ */
10
10
  function getConfigFromEnvOrDefaults() {
11
- if (!process || !process.env) {
12
- throw new Error('Attempt to get default algod configuration from a non Node.js context; supply the config instead');
13
- }
14
- const algodConfig = !process.env.ALGOD_SERVER
15
- ? getDefaultLocalNetConfig('algod')
16
- : { server: process.env.ALGOD_SERVER, port: process.env.ALGOD_PORT, token: process.env.ALGOD_TOKEN };
17
- const indexerConfig = !process.env.INDEXER_SERVER
18
- ? getDefaultLocalNetConfig('indexer')
19
- : {
20
- server: process.env.INDEXER_SERVER,
21
- port: process.env.INDEXER_PORT,
22
- token: process.env.INDEXER_TOKEN,
23
- };
24
- return {
25
- algodConfig,
26
- indexerConfig,
27
- kmdConfig: process && process.env && process.env.ALGOD_SERVER
28
- ? { ...algodConfig, port: process?.env?.KMD_PORT ?? '4002' }
29
- : getDefaultLocalNetConfig('kmd'),
30
- };
11
+ return types_clientManager.ClientManager.getConfigFromEnvironmentOrLocalNet();
31
12
  }
32
- /** Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment not algod-side) */
13
+ /**
14
+ * @deprecated Use `ClientManager.getAlgodConfigFromEnvironment()` instead.
15
+ *
16
+ * Retrieve the algod configuration from environment variables (expects to be called from a Node.js environment not algod-side)
17
+ */
33
18
  function getAlgodConfigFromEnvironment() {
34
- if (!process || !process.env) {
35
- throw new Error('Attempt to get default algod configuration from a non Node.js context; supply the config instead');
36
- }
37
- if (!process.env.ALGOD_SERVER) {
38
- throw new Error('Attempt to get default algod configuration without specifying ALGOD_SERVER in the environment variables');
39
- }
40
- return {
41
- server: process.env.ALGOD_SERVER,
42
- port: process.env.ALGOD_PORT,
43
- token: process.env.ALGOD_TOKEN,
44
- };
19
+ return types_clientManager.ClientManager.getAlgodConfigFromEnvironment();
45
20
  }
46
- /** Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment not algod-side) */
21
+ /**
22
+ * @deprecated Use `ClientManager.getIndexerConfigFromEnvironment()` instead.
23
+ *
24
+ * Retrieve the indexer configuration from environment variables (expects to be called from a Node.js environment not algod-side)
25
+ */
47
26
  function getIndexerConfigFromEnvironment() {
48
- if (!process || !process.env) {
49
- throw new Error('Attempt to get default indexer configuration from a non Node.js context; supply the config instead');
50
- }
51
- if (!process.env.INDEXER_SERVER) {
52
- throw new Error('Attempt to get default indexer configuration without specifying INDEXER_SERVER in the environment variables');
53
- }
54
- return {
55
- server: process.env.INDEXER_SERVER,
56
- port: process.env.INDEXER_PORT,
57
- token: process.env.INDEXER_TOKEN,
58
- };
27
+ return types_clientManager.ClientManager.getIndexerConfigFromEnvironment();
59
28
  }
60
- /** Returns the Algorand configuration to point to the AlgoNode service
29
+ /**
30
+ * @deprecated Use `ClientManager.getAlgoNodeConfig(network, config)` instead.
31
+ *
32
+ * Returns the Algorand configuration to point to the AlgoNode service
61
33
  *
62
34
  * @param network Which network to connect to - TestNet or MainNet
63
35
  * @param config Which algod config to return - Algod or Indexer
64
36
  */
65
37
  function getAlgoNodeConfig(network, config) {
66
- return {
67
- server: `https://${network}-${config === 'algod' ? 'api' : 'idx'}.algonode.cloud/`,
68
- port: 443,
69
- };
38
+ return types_clientManager.ClientManager.getAlgoNodeConfig(network, config);
70
39
  }
71
- /** Returns the Algorand configuration to point to the default LocalNet
40
+ /**
41
+ * @deprecated Use `ClientManager.getDefaultLocalNetConfig(configOrPort)` instead.
42
+ *
43
+ * Returns the Algorand configuration to point to the default LocalNet
72
44
  *
73
45
  * @param configOrPort Which algod config to return - algod, kmd, or indexer OR a port number
74
46
  */
75
47
  function getDefaultLocalNetConfig(configOrPort) {
76
- return {
77
- server: `http://localhost`,
78
- port: configOrPort === 'algod' ? 4001 : configOrPort === 'indexer' ? 8980 : configOrPort === 'kmd' ? 4002 : configOrPort,
79
- token: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
80
- };
48
+ return types_clientManager.ClientManager.getDefaultLocalNetConfig(configOrPort);
81
49
  }
82
- function getAlgoTokenHeader(server, token, defaultHeader) {
83
- // Purestake uses a slightly different API key header than the default
84
- if (server.includes('purestake.io') && typeof token === 'string')
85
- return { 'X-API-Key': token };
86
- // Because we override the default HTTP Client construction (to get retries) we need to put a string token into the standard header ourselves
87
- return typeof token === 'string' ? { [defaultHeader ?? 'X-Algo-API-Token']: token } : token ?? {};
88
- }
89
- /** Returns an algod SDK client that automatically retries on idempotent calls
50
+ /**
51
+ * @deprecated Use `ClientManager.getAlgodClient(config)` or `ClientManager.getAlgodClientFromEnvironment()` instead.
52
+ *
53
+ * Returns an algod SDK client that automatically retries transient failures on idempotent calls
90
54
  *
91
55
  * @param config The config if you want to override the default (getting config from process.env)
92
56
  * @example Default (load from environment variables)
@@ -114,11 +78,12 @@ function getAlgoTokenHeader(server, token, defaultHeader) {
114
78
  * ```
115
79
  */
116
80
  function getAlgoClient(config) {
117
- const { token, server, port } = config ?? getAlgodConfigFromEnvironment();
118
- const httpClientWithRetry = new types_algoHttpClientWithRetry.AlgoHttpClientWithRetry(getAlgoTokenHeader(server, token), server, port);
119
- return new algosdk.Algodv2(httpClientWithRetry, server);
81
+ return config ? types_clientManager.ClientManager.getAlgodClient(config) : types_clientManager.ClientManager.getAlgodClientFromEnvironment();
120
82
  }
121
- /** Returns an indexer SDK client that automatically retries on idempotent calls
83
+ /**
84
+ * @deprecated Use `ClientManager.getIndexerClient(config, overrideIntDecoding)` or `ClientManager.getIndexerClientFromEnvironment(overrideIntDecoding)` instead.
85
+ *
86
+ * Returns an indexer SDK client that automatically retries transient failures on idempotent calls
122
87
  *
123
88
  * @param config The config if you want to override the default (getting config from process.env)
124
89
  * @param overrideIntDecoding Override the default int decoding for responses, uses MIXED by default to avoid lost precision for big integers
@@ -150,15 +115,14 @@ function getAlgoClient(config) {
150
115
  * ```
151
116
  */
152
117
  function getAlgoIndexerClient(config, overrideIntDecoding) {
153
- const { token, server, port } = config ?? getIndexerConfigFromEnvironment();
154
- const httpClientWithRetry = new types_algoHttpClientWithRetry.AlgoHttpClientWithRetry(getAlgoTokenHeader(server, token, 'X-Indexer-API-Token'), server, port);
155
- const indexer = new Indexer(httpClientWithRetry);
156
- // Use mixed int decoding by default so bigints don't have lost precision
157
- indexer.setIntEncoding(overrideIntDecoding ?? IntDecoding.MIXED);
158
- return indexer;
118
+ return config
119
+ ? types_clientManager.ClientManager.getIndexerClient(config, overrideIntDecoding)
120
+ : types_clientManager.ClientManager.getIndexerClientFromEnvironment(overrideIntDecoding);
159
121
  }
160
122
  /**
161
- * Returns a KMD SDK client that automatically retries on idempotent calls
123
+ * @deprecated Use `ClientManager.getKmdClient(config)` or `ClientManager.getKmdClientFromEnvironment()` instead.
124
+ *
125
+ * Returns a KMD SDK client that automatically retries transient failures on idempotent calls.
162
126
  *
163
127
  * KMD client allows you to export private keys, which is useful to get the default account in a LocalNet network.
164
128
  *
@@ -175,18 +139,15 @@ function getAlgoIndexerClient(config, overrideIntDecoding) {
175
139
  * ```
176
140
  */
177
141
  function getAlgoKmdClient(config) {
178
- const { token, server } = config ?? getAlgodConfigFromEnvironment();
179
- // We can only use Kmd on the LocalNet otherwise it's not exposed so this makes some assumptions
180
- // (e.g. same token and server as algod and port 4002 by default)
181
- return new Kmd(token, server, process?.env?.KMD_PORT ?? '4002');
142
+ return config ? types_clientManager.ClientManager.getKmdClient(config) : types_clientManager.ClientManager.getKmdClientFromEnvironment();
182
143
  }
144
+ /** @deprecated Use `await algorandClient.client.isTestNet()` or `await new ClientManager({ algod }).isTestNet()` instead. */
183
145
  async function isTestNet(algod) {
184
- const params = await algod.getTransactionParams().do();
185
- return ['testnet-v1.0', 'testnet-v1', 'testnet'].includes(params.genesisID);
146
+ return await new types_clientManager.ClientManager({ algod }).isTestNet();
186
147
  }
148
+ /** @deprecated Use `await algorandClient.client.isMainNet()` or `await new ClientManager({ algod }).isMainNet()` instead. */
187
149
  async function isMainNet(algod) {
188
- const params = await algod.getTransactionParams().do();
189
- return ['mainnet-v1.0', 'mainnet-v1', 'mainnet'].includes(params.genesisID);
150
+ return await new types_clientManager.ClientManager({ algod }).isMainNet();
190
151
  }
191
152
 
192
153
  exports.getAlgoClient = getAlgoClient;
@@ -1 +1 @@
1
- {"version":3,"file":"network-client.js","sources":["../src/network-client.ts"],"sourcesContent":[null],"names":["AlgoHttpClientWithRetry"],"mappings":";;;;;AAKA,IAAO,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAChC,IAAO,GAAG,GAAG,OAAO,CAAC,GAAG,CAAA;AACxB,IAAO,WAAW,GAAG,OAAO,CAAC,WAAW,CAAA;AAExC;SACgB,0BAA0B,GAAA;IACxC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;AAC5B,QAAA,MAAM,IAAI,KAAK,CAAC,kGAAkG,CAAC,CAAA;KACpH;AACD,IAAA,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY;AAC3C,UAAE,wBAAwB,CAAC,OAAO,CAAC;UACjC,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAA;AAEtG,IAAA,MAAM,aAAa,GAAG,CAAC,O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