@hiero-ledger/sdk 2.72.0 → 2.73.1

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 (377) hide show
  1. package/dist/umd.js +648 -338
  2. package/dist/umd.min.js +16 -15
  3. package/lib/EntityIdHelper.cjs +1 -2
  4. package/lib/EntityIdHelper.js +1 -1
  5. package/lib/EntityIdHelper.js.map +1 -1
  6. package/lib/EthereumFlow.cjs +1 -2
  7. package/lib/EthereumTransaction.cjs +1 -2
  8. package/lib/EthereumTransactionDataEip1559.cjs +1 -2
  9. package/lib/EthereumTransactionDataEip1559.js +1 -1
  10. package/lib/EthereumTransactionDataEip1559.js.map +1 -1
  11. package/lib/EthereumTransactionDataEip2930.cjs +1 -2
  12. package/lib/EthereumTransactionDataEip2930.js +1 -1
  13. package/lib/EthereumTransactionDataEip2930.js.map +1 -1
  14. package/lib/EthereumTransactionDataLegacy.cjs +1 -2
  15. package/lib/EthereumTransactionDataLegacy.js +1 -1
  16. package/lib/EthereumTransactionDataLegacy.js.map +1 -1
  17. package/lib/EvmAddress.cjs +1 -2
  18. package/lib/ExchangeRates.cjs +1 -2
  19. package/lib/Executable.cjs +1 -2
  20. package/lib/Executable.js +1 -1
  21. package/lib/Executable.js.map +1 -1
  22. package/lib/FeeComponents.cjs +1 -2
  23. package/lib/FeeData.cjs +1 -2
  24. package/lib/FeeSchedule.cjs +1 -2
  25. package/lib/FeeSchedule.js +1 -1
  26. package/lib/FeeSchedule.js.map +1 -1
  27. package/lib/FeeSchedules.cjs +1 -2
  28. package/lib/KeyList.js +1 -1
  29. package/lib/KeyList.js.map +1 -1
  30. package/lib/LedgerId.cjs +1 -2
  31. package/lib/LocalProviderWeb.cjs +165 -0
  32. package/lib/LocalProviderWeb.d.ts +127 -0
  33. package/lib/LocalProviderWeb.js +2 -0
  34. package/lib/LocalProviderWeb.js.map +1 -0
  35. package/lib/ManagedNode.js +1 -1
  36. package/lib/ManagedNode.js.map +1 -1
  37. package/lib/ObjectMap.js +1 -1
  38. package/lib/ObjectMap.js.map +1 -1
  39. package/lib/PrivateKey.js +1 -1
  40. package/lib/PrivateKey.js.map +1 -1
  41. package/lib/PrngTransaction.cjs +1 -2
  42. package/lib/PublicKey.js +1 -1
  43. package/lib/PublicKey.js.map +1 -1
  44. package/lib/StakingInfo.cjs +1 -2
  45. package/lib/Timestamp.js.map +1 -1
  46. package/lib/TransactionFeeSchedule.cjs +1 -2
  47. package/lib/TransactionFeeSchedule.js +1 -1
  48. package/lib/TransactionFeeSchedule.js.map +1 -1
  49. package/lib/Wallet.cjs +1 -2
  50. package/lib/Wallet.js +1 -1
  51. package/lib/Wallet.js.map +1 -1
  52. package/lib/account/AccountAllowanceAdjustTransaction.cjs +1 -2
  53. package/lib/account/AccountAllowanceAdjustTransaction.js +1 -1
  54. package/lib/account/AccountAllowanceAdjustTransaction.js.map +1 -1
  55. package/lib/account/AccountAllowanceApproveTransaction.cjs +1 -2
  56. package/lib/account/AccountAllowanceApproveTransaction.js +1 -1
  57. package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -1
  58. package/lib/account/AccountAllowanceDeleteTransaction.cjs +1 -2
  59. package/lib/account/AccountAllowanceDeleteTransaction.js +1 -1
  60. package/lib/account/AccountAllowanceDeleteTransaction.js.map +1 -1
  61. package/lib/account/AccountBalance.cjs +1 -2
  62. package/lib/account/AccountBalanceQuery.cjs +1 -2
  63. package/lib/account/AccountCreateTransaction.cjs +1 -2
  64. package/lib/account/AccountDeleteTransaction.cjs +1 -2
  65. package/lib/account/AccountId.cjs +1 -2
  66. package/lib/account/AccountId.js +1 -1
  67. package/lib/account/AccountId.js.map +1 -1
  68. package/lib/account/AccountInfo.cjs +1 -2
  69. package/lib/account/AccountInfo.js +1 -1
  70. package/lib/account/AccountInfo.js.map +1 -1
  71. package/lib/account/AccountInfoQuery.cjs +1 -2
  72. package/lib/account/AccountRecordsQuery.cjs +1 -2
  73. package/lib/account/AccountRecordsQuery.js +1 -1
  74. package/lib/account/AccountRecordsQuery.js.map +1 -1
  75. package/lib/account/AccountUpdateTransaction.cjs +1 -2
  76. package/lib/account/HbarTransferMap.js +1 -1
  77. package/lib/account/HbarTransferMap.js.map +1 -1
  78. package/lib/account/LiveHashAddTransaction.cjs +1 -2
  79. package/lib/account/LiveHashAddTransaction.js +1 -1
  80. package/lib/account/LiveHashAddTransaction.js.map +1 -1
  81. package/lib/account/LiveHashDeleteTransaction.cjs +1 -2
  82. package/lib/account/LiveHashQuery.cjs +1 -2
  83. package/lib/account/NullableTokenDecimalMap.js +1 -1
  84. package/lib/account/NullableTokenDecimalMap.js.map +1 -1
  85. package/lib/account/TokenBalanceMap.js +1 -1
  86. package/lib/account/TokenBalanceMap.js.map +1 -1
  87. package/lib/account/TokenDecimalMap.js +1 -1
  88. package/lib/account/TokenDecimalMap.js.map +1 -1
  89. package/lib/account/TokenNftAllowance.js +1 -1
  90. package/lib/account/TokenNftAllowance.js.map +1 -1
  91. package/lib/account/TokenNftTransferMap.js +1 -1
  92. package/lib/account/TokenNftTransferMap.js.map +1 -1
  93. package/lib/account/TokenRelationshipMap.js +1 -1
  94. package/lib/account/TokenRelationshipMap.js.map +1 -1
  95. package/lib/account/TokenTransferAccountMap.js +1 -1
  96. package/lib/account/TokenTransferAccountMap.js.map +1 -1
  97. package/lib/account/TokenTransferMap.js +1 -1
  98. package/lib/account/TokenTransferMap.js.map +1 -1
  99. package/lib/account/TransferTransaction.cjs +1 -2
  100. package/lib/account/TransferTransaction.js +1 -1
  101. package/lib/account/TransferTransaction.js.map +1 -1
  102. package/lib/address_book/AddressBooks.cjs +1 -2
  103. package/lib/address_book/NodeAddress.cjs +1 -2
  104. package/lib/address_book/NodeAddress.js +1 -1
  105. package/lib/address_book/NodeAddress.js.map +1 -1
  106. package/lib/address_book/NodeAddressBook.cjs +1 -2
  107. package/lib/address_book/NodeAddressBook.js +1 -1
  108. package/lib/address_book/NodeAddressBook.js.map +1 -1
  109. package/lib/browser.cjs +8 -0
  110. package/lib/browser.d.ts +1 -0
  111. package/lib/browser.js +1 -1
  112. package/lib/channel/Channel.cjs +1 -2
  113. package/lib/channel/NativeChannel.cjs +1 -2
  114. package/lib/channel/NativeChannel.js +1 -1
  115. package/lib/channel/NativeChannel.js.map +1 -1
  116. package/lib/channel/NodeChannel.js +1 -1
  117. package/lib/channel/NodeChannel.js.map +1 -1
  118. package/lib/channel/NodeMirrorChannel.cjs +1 -2
  119. package/lib/channel/NodeMirrorChannel.js +1 -1
  120. package/lib/channel/NodeMirrorChannel.js.map +1 -1
  121. package/lib/channel/WebChannel.cjs +1 -2
  122. package/lib/client/Client.js +1 -1
  123. package/lib/client/Client.js.map +1 -1
  124. package/lib/client/ManagedNetwork.cjs +1 -2
  125. package/lib/client/ManagedNetwork.js +1 -1
  126. package/lib/client/ManagedNetwork.js.map +1 -1
  127. package/lib/client/MirrorNetwork.js +1 -1
  128. package/lib/client/MirrorNetwork.js.map +1 -1
  129. package/lib/client/NativeClient.js.map +1 -1
  130. package/lib/client/Network.js +1 -1
  131. package/lib/client/Network.js.map +1 -1
  132. package/lib/client/NodeClient.cjs +4 -11
  133. package/lib/client/NodeClient.d.ts +5 -6
  134. package/lib/client/NodeClient.js +1 -1
  135. package/lib/client/NodeClient.js.map +1 -1
  136. package/lib/client/WebClient.cjs +32 -7
  137. package/lib/client/WebClient.d.ts +10 -0
  138. package/lib/client/WebClient.js +1 -1
  139. package/lib/client/WebClient.js.map +1 -1
  140. package/lib/client/addressbooks/mainnet.cjs +1 -1
  141. package/lib/client/addressbooks/mainnet.d.ts +1 -1
  142. package/lib/client/addressbooks/mainnet.js +1 -1
  143. package/lib/client/addressbooks/mainnet.js.map +1 -1
  144. package/lib/client/addressbooks/previewnet.cjs +1 -1
  145. package/lib/client/addressbooks/previewnet.d.ts +1 -1
  146. package/lib/client/addressbooks/previewnet.js +1 -1
  147. package/lib/client/addressbooks/previewnet.js.map +1 -1
  148. package/lib/client/addressbooks/testnet.cjs +1 -1
  149. package/lib/client/addressbooks/testnet.d.ts +1 -1
  150. package/lib/client/addressbooks/testnet.js +1 -1
  151. package/lib/client/addressbooks/testnet.js.map +1 -1
  152. package/lib/constants/ClientConstants.cjs +21 -2
  153. package/lib/constants/ClientConstants.d.ts +17 -0
  154. package/lib/constants/ClientConstants.js +1 -1
  155. package/lib/constants/ClientConstants.js.map +1 -1
  156. package/lib/contract/ContractByteCodeQuery.cjs +1 -2
  157. package/lib/contract/ContractCallQuery.cjs +1 -2
  158. package/lib/contract/ContractCreateFlow.cjs +1 -2
  159. package/lib/contract/ContractCreateFlow.js +1 -1
  160. package/lib/contract/ContractCreateFlow.js.map +1 -1
  161. package/lib/contract/ContractCreateTransaction.cjs +1 -2
  162. package/lib/contract/ContractDeleteTransaction.cjs +1 -2
  163. package/lib/contract/ContractExecuteTransaction.cjs +1 -2
  164. package/lib/contract/ContractFunctionParameters.cjs +1 -2
  165. package/lib/contract/ContractFunctionParameters.js +1 -1
  166. package/lib/contract/ContractFunctionParameters.js.map +1 -1
  167. package/lib/contract/ContractFunctionResult.cjs +1 -2
  168. package/lib/contract/ContractFunctionResult.js +1 -1
  169. package/lib/contract/ContractFunctionResult.js.map +1 -1
  170. package/lib/contract/ContractFunctionSelector.cjs +1 -2
  171. package/lib/contract/ContractId.cjs +1 -2
  172. package/lib/contract/ContractId.js +1 -1
  173. package/lib/contract/ContractId.js.map +1 -1
  174. package/lib/contract/ContractInfo.cjs +1 -2
  175. package/lib/contract/ContractInfoQuery.cjs +1 -2
  176. package/lib/contract/ContractNonceInfo.cjs +1 -2
  177. package/lib/contract/ContractStateChange.cjs +1 -2
  178. package/lib/contract/ContractUpdateTransaction.cjs +1 -2
  179. package/lib/contract/DelegateContractId.js +1 -1
  180. package/lib/contract/DelegateContractId.js.map +1 -1
  181. package/lib/contract/StorageChange.cjs +1 -2
  182. package/lib/cryptography/keccak.js +1 -1
  183. package/lib/cryptography/keccak.js.map +1 -1
  184. package/lib/cryptography/sha384.native.cjs +1 -2
  185. package/lib/encoding/base64.native.js +1 -1
  186. package/lib/encoding/base64.native.js.map +1 -1
  187. package/lib/encoding/hex.browser.js +1 -1
  188. package/lib/encoding/hex.browser.js.map +1 -1
  189. package/lib/encoding/utf8.native.cjs +1 -2
  190. package/lib/exports.cjs +1 -2
  191. package/lib/file/FileAppendTransaction.cjs +1 -2
  192. package/lib/file/FileContentsQuery.cjs +1 -2
  193. package/lib/file/FileCreateTransaction.cjs +1 -2
  194. package/lib/file/FileCreateTransaction.js +1 -1
  195. package/lib/file/FileCreateTransaction.js.map +1 -1
  196. package/lib/file/FileDeleteTransaction.cjs +1 -2
  197. package/lib/file/FileId.cjs +1 -2
  198. package/lib/file/FileInfo.cjs +1 -2
  199. package/lib/file/FileInfoQuery.cjs +1 -2
  200. package/lib/file/FileUpdateTransaction.cjs +1 -2
  201. package/lib/file/FileUpdateTransaction.js +1 -1
  202. package/lib/file/FileUpdateTransaction.js.map +1 -1
  203. package/lib/network/AddressBookQuery.cjs +1 -2
  204. package/lib/network/AddressBookQuery.js +1 -1
  205. package/lib/network/AddressBookQuery.js.map +1 -1
  206. package/lib/network/AddressBookQueryWeb.js +1 -1
  207. package/lib/network/AddressBookQueryWeb.js.map +1 -1
  208. package/lib/network/NetworkVersionInfo.cjs +1 -2
  209. package/lib/network/NetworkVersionInfoQuery.cjs +1 -2
  210. package/lib/network/SemanticVersion.cjs +1 -2
  211. package/lib/node/NodeCreateTransaction.cjs +1 -2
  212. package/lib/node/NodeCreateTransaction.js +1 -1
  213. package/lib/node/NodeCreateTransaction.js.map +1 -1
  214. package/lib/node/NodeDeleteTransaction.cjs +15 -3
  215. package/lib/node/NodeDeleteTransaction.d.ts +2 -1
  216. package/lib/node/NodeDeleteTransaction.js +1 -1
  217. package/lib/node/NodeDeleteTransaction.js.map +1 -1
  218. package/lib/node/NodeUpdateTransaction.cjs +13 -3
  219. package/lib/node/NodeUpdateTransaction.d.ts +2 -1
  220. package/lib/node/NodeUpdateTransaction.js +1 -1
  221. package/lib/node/NodeUpdateTransaction.js.map +1 -1
  222. package/lib/query/CostQuery.cjs +1 -2
  223. package/lib/query/MirrorNodeContractCallQuery.cjs +1 -2
  224. package/lib/query/MirrorNodeContractEstimateQuery.cjs +1 -2
  225. package/lib/query/MirrorNodeContractQuery.cjs +2 -1
  226. package/lib/query/MirrorNodeContractQuery.js +1 -1
  227. package/lib/query/MirrorNodeContractQuery.js.map +1 -1
  228. package/lib/query/Query.cjs +1 -2
  229. package/lib/query/Query.js +1 -1
  230. package/lib/query/Query.js.map +1 -1
  231. package/lib/query/QueryBase.cjs +1 -2
  232. package/lib/schedule/ScheduleCreateTransaction.cjs +1 -2
  233. package/lib/schedule/ScheduleCreateTransaction.js +1 -1
  234. package/lib/schedule/ScheduleCreateTransaction.js.map +1 -1
  235. package/lib/schedule/ScheduleDeleteTransaction.cjs +1 -2
  236. package/lib/schedule/ScheduleId.cjs +1 -2
  237. package/lib/schedule/ScheduleInfo.cjs +1 -2
  238. package/lib/schedule/ScheduleInfoQuery.cjs +1 -2
  239. package/lib/schedule/ScheduleSignTransaction.cjs +1 -2
  240. package/lib/system/FreezeTransaction.cjs +1 -2
  241. package/lib/system/SystemDeleteTransaction.cjs +1 -2
  242. package/lib/system/SystemUndeleteTransaction.cjs +1 -2
  243. package/lib/token/AbstractTokenTransferTransaction.js +1 -1
  244. package/lib/token/AbstractTokenTransferTransaction.js.map +1 -1
  245. package/lib/token/AssessedCustomFee.js +1 -1
  246. package/lib/token/AssessedCustomFee.js.map +1 -1
  247. package/lib/token/NftId.cjs +1 -2
  248. package/lib/token/TokenAirdropTransaction.cjs +1 -2
  249. package/lib/token/TokenAssociateTransaction.cjs +1 -2
  250. package/lib/token/TokenAssociateTransaction.js +1 -1
  251. package/lib/token/TokenAssociateTransaction.js.map +1 -1
  252. package/lib/token/TokenBurnTransaction.cjs +1 -2
  253. package/lib/token/TokenBurnTransaction.js +1 -1
  254. package/lib/token/TokenBurnTransaction.js.map +1 -1
  255. package/lib/token/TokenCancelAirdropTransaction.cjs +1 -2
  256. package/lib/token/TokenCancelAirdropTransaction.js +1 -1
  257. package/lib/token/TokenCancelAirdropTransaction.js.map +1 -1
  258. package/lib/token/TokenClaimAirdropTransaction.cjs +1 -2
  259. package/lib/token/TokenClaimAirdropTransaction.js +1 -1
  260. package/lib/token/TokenClaimAirdropTransaction.js.map +1 -1
  261. package/lib/token/TokenCreateTransaction.cjs +1 -2
  262. package/lib/token/TokenCreateTransaction.js +1 -1
  263. package/lib/token/TokenCreateTransaction.js.map +1 -1
  264. package/lib/token/TokenDeleteTransaction.cjs +1 -2
  265. package/lib/token/TokenDissociateTransaction.cjs +1 -2
  266. package/lib/token/TokenDissociateTransaction.js +1 -1
  267. package/lib/token/TokenDissociateTransaction.js.map +1 -1
  268. package/lib/token/TokenFeeScheduleUpdateTransaction.cjs +1 -2
  269. package/lib/token/TokenFeeScheduleUpdateTransaction.js +1 -1
  270. package/lib/token/TokenFeeScheduleUpdateTransaction.js.map +1 -1
  271. package/lib/token/TokenFreezeTransaction.cjs +1 -2
  272. package/lib/token/TokenGrantKycTransaction.cjs +1 -2
  273. package/lib/token/TokenId.cjs +1 -2
  274. package/lib/token/TokenInfo.cjs +1 -2
  275. package/lib/token/TokenInfo.js +1 -1
  276. package/lib/token/TokenInfo.js.map +1 -1
  277. package/lib/token/TokenInfoQuery.cjs +1 -2
  278. package/lib/token/TokenMintTransaction.cjs +1 -2
  279. package/lib/token/TokenMintTransaction.js +1 -1
  280. package/lib/token/TokenMintTransaction.js.map +1 -1
  281. package/lib/token/TokenNftInfo.cjs +1 -2
  282. package/lib/token/TokenNftInfoQuery.cjs +1 -2
  283. package/lib/token/TokenNftInfoQuery.js +1 -1
  284. package/lib/token/TokenNftInfoQuery.js.map +1 -1
  285. package/lib/token/TokenNftsUpdateTransaction.cjs +1 -2
  286. package/lib/token/TokenPauseTransaction.cjs +1 -2
  287. package/lib/token/TokenRejectFlow.js +1 -1
  288. package/lib/token/TokenRejectFlow.js.map +1 -1
  289. package/lib/token/TokenRejectTransaction.cjs +1 -2
  290. package/lib/token/TokenRejectTransaction.js +1 -1
  291. package/lib/token/TokenRejectTransaction.js.map +1 -1
  292. package/lib/token/TokenRevokeKycTransaction.cjs +1 -2
  293. package/lib/token/TokenUnfreezeTransaction.cjs +1 -2
  294. package/lib/token/TokenUnpauseTransaction.cjs +1 -2
  295. package/lib/token/TokenUpdateNftsTransaction.cjs +1 -2
  296. package/lib/token/TokenUpdateTransaction.cjs +1 -2
  297. package/lib/token/TokenWipeTransaction.cjs +1 -2
  298. package/lib/token/TokenWipeTransaction.js +1 -1
  299. package/lib/token/TokenWipeTransaction.js.map +1 -1
  300. package/lib/topic/TopicCreateTransaction.cjs +1 -2
  301. package/lib/topic/TopicCreateTransaction.js +1 -1
  302. package/lib/topic/TopicCreateTransaction.js.map +1 -1
  303. package/lib/topic/TopicDeleteTransaction.cjs +1 -2
  304. package/lib/topic/TopicId.cjs +1 -2
  305. package/lib/topic/TopicInfo.cjs +1 -2
  306. package/lib/topic/TopicInfo.js +1 -1
  307. package/lib/topic/TopicInfo.js.map +1 -1
  308. package/lib/topic/TopicInfoQuery.cjs +1 -2
  309. package/lib/topic/TopicMessage.js +1 -1
  310. package/lib/topic/TopicMessage.js.map +1 -1
  311. package/lib/topic/TopicMessageQuery.cjs +1 -2
  312. package/lib/topic/TopicMessageQuery.js +1 -1
  313. package/lib/topic/TopicMessageQuery.js.map +1 -1
  314. package/lib/topic/TopicMessageSubmitTransaction.cjs +1 -2
  315. package/lib/topic/TopicUpdateTransaction.cjs +1 -2
  316. package/lib/topic/TopicUpdateTransaction.js +1 -1
  317. package/lib/topic/TopicUpdateTransaction.js.map +1 -1
  318. package/lib/transaction/BatchTransaction.cjs +1 -2
  319. package/lib/transaction/BatchTransaction.js +1 -1
  320. package/lib/transaction/BatchTransaction.js.map +1 -1
  321. package/lib/transaction/CustomFeeLimit.js +1 -1
  322. package/lib/transaction/CustomFeeLimit.js.map +1 -1
  323. package/lib/transaction/NodeAccountIdSignatureMap.cjs +1 -2
  324. package/lib/transaction/NodeAccountIdSignatureMap.js +1 -1
  325. package/lib/transaction/NodeAccountIdSignatureMap.js.map +1 -1
  326. package/lib/transaction/NodeAccountIdSignatureMapLegacy.js +1 -1
  327. package/lib/transaction/NodeAccountIdSignatureMapLegacy.js.map +1 -1
  328. package/lib/transaction/SignatureMap.js +1 -1
  329. package/lib/transaction/SignatureMap.js.map +1 -1
  330. package/lib/transaction/SignatureMapLegacy.js +1 -1
  331. package/lib/transaction/SignatureMapLegacy.js.map +1 -1
  332. package/lib/transaction/SignaturePairMap.js +1 -1
  333. package/lib/transaction/SignaturePairMap.js.map +1 -1
  334. package/lib/transaction/Transaction.cjs +1 -2
  335. package/lib/transaction/Transaction.js +1 -1
  336. package/lib/transaction/Transaction.js.map +1 -1
  337. package/lib/transaction/TransactionHashMap.cjs +1 -2
  338. package/lib/transaction/TransactionHashMap.js +1 -1
  339. package/lib/transaction/TransactionHashMap.js.map +1 -1
  340. package/lib/transaction/TransactionId.cjs +1 -2
  341. package/lib/transaction/TransactionReceipt.cjs +1 -2
  342. package/lib/transaction/TransactionReceipt.js +1 -1
  343. package/lib/transaction/TransactionReceipt.js.map +1 -1
  344. package/lib/transaction/TransactionReceiptQuery.cjs +1 -2
  345. package/lib/transaction/TransactionRecord.cjs +1 -2
  346. package/lib/transaction/TransactionRecord.js +1 -1
  347. package/lib/transaction/TransactionRecord.js.map +1 -1
  348. package/lib/transaction/TransactionRecordQuery.cjs +1 -2
  349. package/lib/transaction/TransactionResponse.cjs +1 -2
  350. package/lib/transaction/TransactionResponse.js.map +1 -1
  351. package/lib/util/ASN1-Decoder.js +1 -1
  352. package/lib/util/ASN1-Decoder.js.map +1 -1
  353. package/lib/util.js +1 -1
  354. package/lib/util.js.map +1 -1
  355. package/lib/version.js +1 -1
  356. package/package.json +75 -71
  357. package/src/Executable.js +10 -4
  358. package/src/LocalProviderWeb.js +165 -0
  359. package/src/Timestamp.js +2 -2
  360. package/src/account/AccountAllowanceAdjustTransaction.js +48 -48
  361. package/src/account/AccountAllowanceApproveTransaction.js +48 -48
  362. package/src/account/TokenNftAllowance.js +4 -4
  363. package/src/browser.js +1 -0
  364. package/src/client/NodeClient.js +6 -9
  365. package/src/client/WebClient.js +33 -8
  366. package/src/client/addressbooks/mainnet.js +1 -1
  367. package/src/client/addressbooks/previewnet.js +1 -1
  368. package/src/client/addressbooks/testnet.js +1 -1
  369. package/src/constants/ClientConstants.js +25 -0
  370. package/src/network/AddressBookQueryWeb.js +8 -2
  371. package/src/node/NodeDeleteTransaction.js +20 -1
  372. package/src/node/NodeUpdateTransaction.js +19 -1
  373. package/src/query/MirrorNodeContractQuery.js +8 -1
  374. package/src/token/TokenInfo.js +4 -4
  375. package/src/topic/TopicMessageQuery.js +7 -5
  376. package/src/transaction/TransactionRecord.js +5 -5
  377. package/src/transaction/TransactionResponse.js +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Executable.js","sources":["../src/Executable.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport GrpcServiceError from \"./grpc/GrpcServiceError.js\";\nimport GrpcStatus from \"./grpc/GrpcStatus.js\";\nimport List from \"./transaction/List.js\";\nimport * as hex from \"./encoding/hex.js\";\nimport HttpError from \"./http/HttpError.js\";\nimport Status from \"./Status.js\";\nimport MaxAttemptsOrTimeoutError from \"./MaxAttemptsOrTimeoutError.js\";\n\n/**\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"./Signer.js\").Signer} Signer\n * @typedef {import(\"./PublicKey.js\").default} PublicKey\n * @typedef {import(\"./logger/Logger.js\").default} Logger\n */\n\n/**\n * @enum {string}\n */\nexport const ExecutionState = {\n Finished: \"Finished\",\n Retry: \"Retry\",\n Error: \"Error\",\n};\n\nexport const RST_STREAM = /\\brst[^0-9a-zA-Z]stream\\b/i;\nexport const DEFAULT_MAX_ATTEMPTS = 10;\n\n/**\n * @abstract\n * @internal\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n */\nexport default class Executable {\n constructor() {\n /**\n * The number of times we can retry the grpc call\n *\n * @internal\n * @type {number}\n */\n this._maxAttempts = DEFAULT_MAX_ATTEMPTS;\n\n /**\n * List of node account IDs for each transaction that has been\n * built.\n *\n * @internal\n * @type {List<AccountId>}\n */\n this._nodeAccountIds = new List();\n\n /**\n * List of the transaction node account IDs to check if\n * the node account ID of the request is in the list\n *\n * @protected\n * @type {Array<string>}\n */\n this.transactionNodeIds = [];\n\n /**\n * @internal\n */\n this._signOnDemand = false;\n\n /**\n * This is the request's min backoff\n *\n * @internal\n * @type {number | null}\n */\n this._minBackoff = null;\n\n /**\n * This is the request's max backoff\n *\n * @internal\n * @type {number}\n */\n this._maxBackoff = 8000;\n\n /**\n * The operator that was used to execute this request.\n * The reason we save the operator in the request is because of the signing on\n * demand feature. This feature requires us to sign new request on each attempt\n * meaning if a client with an operator was used we'd need to sign with the operator\n * on each attempt.\n *\n * @internal\n * @type {ClientOperator | null}\n */\n this._operator = null;\n\n /**\n * The complete timeout for running the `execute()` method\n *\n * @internal\n * @type {number | null}\n */\n this._requestTimeout = null;\n\n /**\n * The grpc request timeout aka deadline.\n *\n * The reason we have this is because there were times that consensus nodes held the grpc\n * connection, but didn't return anything; not error nor regular response. This resulted\n * in some weird behavior in the SDKs. To fix this we've added a grpc deadline to prevent\n * nodes from stalling the executing of a request.\n *\n * @internal\n * @type {number | null}\n */\n this._grpcDeadline = null;\n\n /**\n * Logger\n *\n * @protected\n * @type {Logger | null}\n */\n this._logger = null;\n }\n\n /**\n * Get the list of node account IDs on the request. If no nodes are set, then null is returned.\n * The reasoning for this is simply \"legacy behavior\".\n *\n * @returns {?AccountId[]}\n */\n get nodeAccountIds() {\n if (this._nodeAccountIds.isEmpty) {\n return null;\n } else {\n this._nodeAccountIds.setLocked();\n return this._nodeAccountIds.list;\n }\n }\n\n /**\n * Set the node account IDs on the request\n *\n * @param {AccountId[]} nodeIds\n * @returns {this}\n */\n setNodeAccountIds(nodeIds) {\n // Set the node account IDs, and lock the list. This will require `execute`\n // to use these nodes instead of random nodes from the network.\n this._nodeAccountIds.setList(nodeIds).setLocked();\n return this;\n }\n\n /**\n * @deprecated\n * @returns {number}\n */\n get maxRetries() {\n console.warn(\"Deprecated: use maxAttempts instead\");\n return this.maxAttempts;\n }\n\n /**\n * @param {number} maxRetries\n * @returns {this}\n */\n setMaxRetries(maxRetries) {\n console.warn(\"Deprecated: use setMaxAttempts() instead\");\n return this.setMaxAttempts(maxRetries);\n }\n\n /**\n * Get the max attempts on the request\n *\n * @returns {number}\n */\n get maxAttempts() {\n return this._maxAttempts;\n }\n\n /**\n * Set the max attempts on the request\n *\n * @param {number} maxAttempts\n * @returns {this}\n */\n setMaxAttempts(maxAttempts) {\n this._maxAttempts = maxAttempts;\n\n return this;\n }\n\n /**\n * Get the grpc deadline\n *\n * @returns {?number}\n */\n get grpcDeadline() {\n return this._grpcDeadline;\n }\n\n /**\n * Set the grpc deadline\n *\n * @param {number} grpcDeadline\n * @returns {this}\n */\n setGrpcDeadline(grpcDeadline) {\n this._grpcDeadline = grpcDeadline;\n\n return this;\n }\n\n /**\n * Set the min backoff for the request\n *\n * @param {number} minBackoff\n * @returns {this}\n */\n setMinBackoff(minBackoff) {\n // Honestly we shouldn't be checking for null since that should be TypeScript's job.\n // Also verify that min backoff is not greater than max backoff.\n if (minBackoff == null) {\n throw new Error(\"minBackoff cannot be null.\");\n } else if (this._maxBackoff != null && minBackoff > this._maxBackoff) {\n throw new Error(\"minBackoff cannot be larger than maxBackoff.\");\n }\n this._minBackoff = minBackoff;\n return this;\n }\n\n /**\n * Get the min backoff\n *\n * @returns {number | null}\n */\n get minBackoff() {\n return this._minBackoff;\n }\n\n /**\n * Set the max backoff for the request\n *\n * @param {?number} maxBackoff\n * @returns {this}\n */\n setMaxBackoff(maxBackoff) {\n // Honestly we shouldn't be checking for null since that should be TypeScript's job.\n // Also verify that max backoff is not less than min backoff.\n if (maxBackoff == null) {\n throw new Error(\"maxBackoff cannot be null.\");\n } else if (this._minBackoff != null && maxBackoff < this._minBackoff) {\n throw new Error(\"maxBackoff cannot be smaller than minBackoff.\");\n }\n this._maxBackoff = maxBackoff;\n return this;\n }\n\n /**\n * Get the max backoff\n *\n * @returns {number}\n */\n get maxBackoff() {\n return this._maxBackoff;\n }\n\n /**\n * This method is responsible for doing any work before the executing process begins.\n * For paid queries this will result in executing a cost query, for transactions this\n * will make sure we save the operator and sign any requests that need to be signed\n * in case signing on demand is disabled.\n *\n * @abstract\n * @protected\n * @param {import(\"./client/Client.js\").default<Channel, *>} client\n * @returns {Promise<void>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _beforeExecute(client) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Create a protobuf request which will be passed into the `_execute()` method\n *\n * @abstract\n * @protected\n * @returns {Promise<RequestT>}\n */\n _makeRequestAsync() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * This name is a bit wrong now, but the purpose of this method is to map the\n * request and response into an error. This method will only be called when\n * `_shouldRetry` returned `ExecutionState.Error`\n *\n * @abstract\n * @internal\n * @param {RequestT} request\n * @param {ResponseT} response\n * @param {AccountId} nodeId\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response, nodeId) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Map the request, response, and the node account ID used for this attempt into a response.\n * This method will only be called when `_shouldRetry` returned `ExecutionState.Finished`\n *\n * @abstract\n * @protected\n * @param {ResponseT} response\n * @param {AccountId} nodeAccountId\n * @param {RequestT} request\n * @returns {Promise<OutputT>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Perform a single grpc call with the given request. Each request has it's own\n * required service so we just pass in channel, and it'$ the request's responsiblity\n * to use the right service and call the right grpc method.\n *\n * @abstract\n * @internal\n * @param {Channel} channel\n * @param {RequestT} request\n * @returns {Promise<ResponseT>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _execute(channel, request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Return the current transaction ID for the request. All requests which are\n * use the same transaction ID for each node, but the catch is that `Transaction`\n * implicitly supports chunked transactions. Meaning there could be multiple\n * transaction IDs stored in the request, and a different transaction ID will be used\n * on subsequent calls to `execute()`\n *\n * FIXME: This method can most likely be removed, although some further inspection\n * is required.\n *\n * @abstract\n * @protected\n * @returns {TransactionId}\n */\n _getTransactionId() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Return the log ID for this particular request\n *\n * Log IDs are simply a string constructed to make it easy to track each request's\n * execution even when mulitple requests are executing in parallel. Typically, this\n * method returns the format of `[<request type>.<timestamp of the transaction ID>]`\n *\n * Maybe we should deduplicate this using ${this.consturtor.name}\n *\n * @abstract\n * @internal\n * @returns {string}\n */\n _getLogId() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Serialize the request into bytes\n *\n * @abstract\n * @param {RequestT} request\n * @returns {Uint8Array}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _requestToBytes(request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Serialize the response into bytes\n *\n * @abstract\n * @param {ResponseT} response\n * @returns {Uint8Array}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _responseToBytes(response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Determine if we should continue the execution process, error, or finish.\n *\n * FIXME: This method should really be called something else. Initially it returned\n * a boolean so `shouldRetry` made sense, but now it returns an enum, so the name\n * no longer makes sense.\n *\n * @abstract\n * @protected\n * @param {RequestT} request\n * @param {ResponseT} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Determine if we should error based on the gRPC status\n *\n * Unlike `shouldRetry` this method does in fact still return a boolean\n *\n * @protected\n * @param {Error} error\n * @returns {boolean}\n */\n _shouldRetryExceptionally(error) {\n if (error instanceof GrpcServiceError) {\n return (\n error.status._code === GrpcStatus.Timeout._code ||\n error.status._code === GrpcStatus.Unavailable._code ||\n error.status._code === GrpcStatus.ResourceExhausted._code ||\n error.status._code === GrpcStatus.GrpcWeb._code ||\n (error.status._code === GrpcStatus.Internal._code &&\n RST_STREAM.test(error.message))\n );\n } else {\n // if we get to the 'else' statement, the 'error' is instanceof 'HttpError'\n // and in this case, we have to retry always\n return true;\n }\n }\n\n /**\n * A helper method for setting the operator on the request\n *\n * @internal\n * @param {AccountId} accountId\n * @param {PublicKey} publicKey\n * @param {(message: Uint8Array) => Promise<Uint8Array>} transactionSigner\n * @returns {this}\n */\n _setOperatorWith(accountId, publicKey, transactionSigner) {\n this._operator = {\n transactionSigner,\n accountId,\n publicKey,\n };\n return this;\n }\n\n /**\n * Execute this request using the signer\n *\n * This method is part of the signature providers feature\n * https://hips.hedera.com/hip/hip-338\n *\n * @param {Signer} signer\n * @returns {Promise<OutputT>}\n */\n async executeWithSigner(signer) {\n return signer.call(this);\n }\n\n /**\n * @returns {boolean}\n * @abstract\n * @protected\n */\n isBatchedAndNotBatchTransaction() {\n return false;\n }\n\n /**\n * Execute the request using a client and an optional request timeout\n *\n * @template {Channel} ChannelT\n * @template {MirrorChannel} MirrorChannelT\n * @param {import(\"./client/Client.js\").default<ChannelT, MirrorChannelT>} client\n * @param {number=} requestTimeout\n * @returns {Promise<OutputT>}\n */\n async execute(client, requestTimeout) {\n // we check if its local node then backoff mechanism should be disabled\n // and we increase the retry attempts\n const isLocalNode = client.network[\"127.0.0.1:50211\"] != null;\n\n if (this.isBatchedAndNotBatchTransaction()) {\n throw new Error(\n \"Cannot execute batchified transaction outside of BatchTransaction\",\n );\n }\n\n // If the logger on the request is not set, use the logger in client\n // (if set, otherwise do not use logger)\n this._logger =\n this._logger == null\n ? client._logger != null\n ? client._logger\n : null\n : this._logger;\n\n // If the request timeout is set on the request we'll prioritize that instead\n // of the parameter provided, and if the parameter isn't provided we'll\n // use the default request timeout on client\n if (this._requestTimeout == null) {\n this._requestTimeout =\n requestTimeout != null ? requestTimeout : client.requestTimeout;\n }\n\n // Some request need to perform additional requests before the executing\n // such as paid queries need to fetch the cost of the query before\n // finally executing the actual query.\n await this._beforeExecute(client);\n\n // If the max backoff on the request is not set, use the default value in client\n if (this._maxBackoff == null) {\n this._maxBackoff = client.maxBackoff;\n }\n\n // If the min backoff on the request is not set, use the default value in client\n if (this._minBackoff == null) {\n this._minBackoff = client.minBackoff;\n }\n\n // Save the start time to be used later with request timeout\n const startTime = Date.now();\n\n // Saves each error we get so when we err due to max attempts exceeded we'll have\n // the last error that was returned by the consensus node\n let persistentError = null;\n\n // If the max attempts on the request is not set, use the default value in client\n // If the default value in client is not set, use a default of 10.\n //\n // FIXME: current implementation is wrong, update to follow comment above.\n // ... existing code ...\n const LOCAL_NODE_ATTEMPTS = 1000;\n const maxAttempts = isLocalNode\n ? LOCAL_NODE_ATTEMPTS\n : (client._maxAttempts ?? this._maxAttempts);\n\n // Checks if has a valid nodes to which the TX can be sent\n if (this.transactionNodeIds.length) {\n const nodeAccountIds = this._nodeAccountIds.list.map((nodeId) =>\n nodeId.toString(),\n );\n\n const hasValidNodes = this.transactionNodeIds.some((nodeId) =>\n nodeAccountIds.includes(nodeId),\n );\n\n if (!hasValidNodes) {\n const displayNodeAccountIds =\n nodeAccountIds.length > 2\n ? `${nodeAccountIds.slice(0, 2).join(\", \")} ...`\n : nodeAccountIds.join(\", \");\n const isSingleNode = nodeAccountIds.length === 1;\n\n throw new Error(\n `Attempting to execute a transaction against node${isSingleNode ? \"\" : \"s\"} ${displayNodeAccountIds}, ` +\n `which ${isSingleNode ? \"is\" : \"are\"} not included in the Client's node list. Please review your Client configuration.`,\n );\n }\n }\n\n // The retry loop\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n // Determine if we've exceeded request timeout\n if (\n this._requestTimeout != null &&\n startTime + this._requestTimeout <= Date.now()\n ) {\n throw new MaxAttemptsOrTimeoutError(\n `timeout exceeded`,\n this._nodeAccountIds.isEmpty\n ? \"No node account ID set\"\n : this._nodeAccountIds.current.toString(),\n );\n }\n\n let nodeAccountId;\n let node;\n\n if (this._nodeAccountIds.isEmpty) {\n node = client._network.getNode();\n nodeAccountId = node.accountId;\n this._nodeAccountIds.setList([nodeAccountId]);\n } else {\n nodeAccountId = this._nodeAccountIds.current;\n node = client._network.getNode(nodeAccountId);\n }\n\n if (node == null) {\n throw new Error(\n `NodeAccountId not recognized: ${nodeAccountId.toString()}`,\n );\n }\n\n if (this.transactionNodeIds.length) {\n const isNodeAccountIdValid = this.transactionNodeIds.includes(\n nodeAccountId.toString(),\n );\n\n if (!isNodeAccountIdValid) {\n console.error(\n `Attempting to execute a transaction against node ${nodeAccountId.toString()}, which is not included in the Client's node list. Please review your Client configuration.`,\n );\n\n this._nodeAccountIds.advance();\n continue;\n }\n }\n\n // Get the log ID for the request.\n const logId = this._getLogId();\n if (this._logger) {\n this._logger.debug(\n `[${logId}] Node AccountID: ${node.accountId.toString()}, IP: ${node.address.toString()}`,\n );\n }\n\n const channel = node.getChannel();\n const request = await this._makeRequestAsync();\n\n let response;\n\n if (!node.isHealthy()) {\n const isLastNode =\n this._nodeAccountIds.index ===\n this._nodeAccountIds.list.length - 1;\n\n // Check if the request is a transaction receipt or record\n // request to retry 10 times, because getReceiptQuery/getRecordQuery\n // are single node requests\n if (\n isTransactionReceiptOrRecordRequest(request) ||\n isLocalNode\n ) {\n await delayForAttempt(\n isLocalNode,\n attempt,\n this._minBackoff,\n this._maxBackoff,\n );\n continue;\n }\n\n if (isLastNode || this._nodeAccountIds.length <= 1) {\n throw new Error(\n `Network connectivity issue: All nodes are unhealthy. Original node list: ${this._nodeAccountIds.list.join(\", \")}`,\n );\n }\n\n if (this._logger) {\n this._logger.debug(\n `[${logId}] Node is not healthy, trying the next node.`,\n );\n }\n\n this._nodeAccountIds.advance();\n continue;\n }\n\n this._nodeAccountIds.advance();\n\n try {\n // Race the execution promise against the grpc timeout to prevent grpc connections\n // from blocking this request\n const promises = [];\n\n // If a grpc deadline is est, we should race it, otherwise the only thing in the\n // list of promises will be the execution promise.\n if (this._grpcDeadline != null) {\n promises.push(\n // eslint-disable-next-line ie11/no-loop-func\n new Promise((_, reject) =>\n setTimeout(\n // eslint-disable-next-line ie11/no-loop-func\n () =>\n reject(new Error(\"grpc deadline exceeded\")),\n /** @type {number=} */ (this._grpcDeadline),\n ),\n ),\n );\n }\n if (this._logger) {\n this._logger.trace(\n `[${this._getLogId()}] sending protobuf ${hex.encode(\n this._requestToBytes(request),\n )}`,\n );\n }\n\n promises.push(this._execute(channel, request));\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n response = /** @type {ResponseT} */ (\n await Promise.race(promises)\n );\n } catch (err) {\n // If we received a grpc status error we need to determine if\n // we should retry on this error, or err from the request entirely.\n const error = GrpcServiceError._fromResponse(\n /** @type {Error} */ (err),\n );\n\n // Save the error in case we retry\n persistentError = error;\n if (this._logger) {\n this._logger.debug(\n `[${logId}] received error ${JSON.stringify(error)}`,\n );\n }\n\n if (\n (error instanceof GrpcServiceError ||\n error instanceof HttpError) &&\n this._shouldRetryExceptionally(error) &&\n attempt <= maxAttempts\n ) {\n // Increase the backoff for the particular node and remove it from\n // the healthy node list\n if (this._logger) {\n this._logger.debug(\n `[${this._getLogId()}] node with accountId: ${node.accountId.toString()} and proxy IP: ${node.address.toString()} is unhealthy`,\n );\n }\n\n client._network.increaseBackoff(node);\n continue;\n }\n\n throw err;\n }\n if (this._logger) {\n this._logger.trace(\n `[${this._getLogId()}] sending protobuf ${hex.encode(\n this._responseToBytes(response),\n )}`,\n );\n }\n\n // If we didn't receive an error we should decrease the current nodes backoff\n // in case it is a recovering node\n client._network.decreaseBackoff(node);\n\n // Determine what execution state we're in by the response\n // For transactions this would be as simple as checking the response status is `OK`\n // while for _most_ queries it would check if the response status is `SUCCESS`\n // The only odd balls are `TransactionReceiptQuery` and `TransactionRecordQuery`\n const [status, shouldRetry] = this._shouldRetry(request, response);\n if (\n status.toString() !== Status.Ok.toString() &&\n status.toString() !== Status.Success.toString()\n ) {\n persistentError = status;\n }\n\n // Determine by the executing state what we should do\n switch (shouldRetry) {\n case ExecutionState.Retry:\n await delayForAttempt(\n isLocalNode,\n attempt,\n this._minBackoff,\n this._maxBackoff,\n );\n continue;\n case ExecutionState.Finished:\n return this._mapResponse(response, nodeAccountId, request);\n case ExecutionState.Error:\n throw this._mapStatusError(\n request,\n response,\n nodeAccountId,\n );\n default:\n throw new Error(\n \"(BUG) non-exhaustive switch statement for `ExecutionState`\",\n );\n }\n }\n\n // We'll only get here if we've run out of attempts, so we return an error wrapping the\n // persistent error we saved before.\n\n throw new MaxAttemptsOrTimeoutError(\n `max attempts of ${maxAttempts.toString()} was reached for request with last error being: ${\n persistentError != null ? persistentError.toString() : \"\"\n }`,\n this._nodeAccountIds.current.toString(),\n );\n }\n\n /**\n * The current purpose of this method is to easily support signature providers since\n * signature providers need to serialize _any_ request into bytes. `Query` and `Transaction`\n * already implement `toBytes()` so it only made sense to make it available here too.\n *\n * @abstract\n * @returns {Uint8Array}\n */\n toBytes() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Set logger\n *\n * @param {Logger} logger\n * @returns {this}\n */\n setLogger(logger) {\n this._logger = logger;\n return this;\n }\n\n /**\n * Get logger if set\n *\n * @returns {?Logger}\n */\n get logger() {\n return this._logger;\n }\n}\n\n/**\n * Checks if the request is a transaction receipt or record request\n *\n * @template T\n * @param {T} request - The request to check\n * @returns {boolean} - True if the request is a transaction receipt or record\n */\nfunction isTransactionReceiptOrRecordRequest(request) {\n if (typeof request !== \"object\" || request === null) {\n return false;\n }\n\n return (\n \"transactionGetReceipt\" in request || \"transactionGetRecord\" in request\n );\n}\n\n/**\n * A simple function that returns a promise timeout for a specific period of time\n *\n * @param {boolean} isLocalNode\n * @param {number} attempt\n * @param {number} minBackoff\n * @param {number} maxBackoff\n * @returns {Promise<void>}\n */\nfunction delayForAttempt(isLocalNode, attempt, minBackoff, maxBackoff) {\n if (isLocalNode) {\n return new Promise((resolve) => setTimeout(resolve, minBackoff));\n }\n\n // 0.1s, 0.2s, 0.4s, 0.8s, ...\n const ms = Math.min(\n Math.floor(minBackoff * Math.pow(2, attempt)),\n maxBackoff,\n );\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"names":["ExecutionState","Finished","Retry","Error","RST_STREAM","DEFAULT_MAX_ATTEMPTS","Executable","constructor","this","_maxAttempts","_nodeAccountIds","List","transactionNodeIds","_signOnDemand","_minBackoff","_maxBackoff","_operator","_requestTimeout","_grpcDeadline","_logger","nodeAccountIds","isEmpty","setLocked","list","setNodeAccountIds","nodeIds","setList","maxRetries","console","warn","maxAttempts","setMaxRetries","setMaxAttempts","grpcDeadline","setGrpcDeadline","setMinBackoff","minBackoff","setMaxBackoff","maxBackoff","_beforeExecute","client","_makeRequestAsync","_mapStatusError","request","response","nodeId","_mapResponse","nodeAccountId","_execute","channel","_getTransactionId","_getLogId","_requestToBytes","_responseToBytes","_shouldRetry","_shouldRetryExceptionally","error","GrpcServiceError","status","_code","GrpcStatus","Timeout","Unavailable","ResourceExhausted","GrpcWeb","Internal","test","message","_setOperatorWith","accountId","publicKey","transactionSigner","executeWithSigner","signer","call","isBatchedAndNotBatchTransaction","execute","requestTimeout","isLocalNode","network","startTime","Date","now","persistentError","length","map","toString","some","includes","displayNodeAccountIds","slice","join","isSingleNode","attempt","MaxAttemptsOrTimeoutError","current","node","_network","getNode","advance","logId","debug","address","getChannel","isHealthy","isLastNode","index","isTransactionReceiptOrRecordRequest","delayForAttempt","promises","push","Promise","_","reject","setTimeout","trace","hex.encode","race","err","_fromResponse","JSON","stringify","HttpError","increaseBackoff","decreaseBackoff","sh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EzC,CAUI,OAAA2C,GACI,MAAM,IAAI9H,MAAM,kBACxB,CAQI,SAAA+H,CAAUC,GAEN,OADA3H,KAAKW,QAAUgH,EACR3H,IACf,CAOI,UAAI2H,GACA,OAAO3H,KAAKW,OACpB,EAUA,SAASwF,EAAoChE,GACzC,MAAuB,iBAAZA,GAAoC,OAAZA,IAK/B,0BAA2BA,GAAW,yBAA0BA,EAExE,CAWA,SAASiE,EAAgB9B,EAAae,EAASzD,EAAYE,GACvD,GAAIwC,EACA,OAAO,IAAIiC,SAASqB,GAAYlB,WAAWkB,EAAShG,KAIxD,MAAMiG,EAAKC,KAAKC,IACZD,KAAKE,MAAMpG,EAAakG,KAAKG,IAAI,EAAG5C,IACpCvD,GAEJ,OAAO,IAAIyE,SAASqB,GAAYlB,WAAWkB,EAASC,IACxD"}
1
+ {"version":3,"file":"Executable.js","sources":["../src/Executable.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport GrpcServiceError from \"./grpc/GrpcServiceError.js\";\nimport GrpcStatus from \"./grpc/GrpcStatus.js\";\nimport List from \"./transaction/List.js\";\nimport * as hex from \"./encoding/hex.js\";\nimport HttpError from \"./http/HttpError.js\";\nimport Status from \"./Status.js\";\nimport MaxAttemptsOrTimeoutError from \"./MaxAttemptsOrTimeoutError.js\";\n\n/**\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"./Signer.js\").Signer} Signer\n * @typedef {import(\"./PublicKey.js\").default} PublicKey\n * @typedef {import(\"./logger/Logger.js\").default} Logger\n */\n\n/**\n * @enum {string}\n */\nexport const ExecutionState = {\n Finished: \"Finished\",\n Retry: \"Retry\",\n Error: \"Error\",\n};\n\nexport const RST_STREAM = /\\brst[^0-9a-zA-Z]stream\\b/i;\nexport const DEFAULT_MAX_ATTEMPTS = 10;\n\n/**\n * @abstract\n * @internal\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n */\nexport default class Executable {\n constructor() {\n /**\n * The number of times we can retry the grpc call\n *\n * @internal\n * @type {number}\n */\n this._maxAttempts = DEFAULT_MAX_ATTEMPTS;\n\n /**\n * List of node account IDs for each transaction that has been\n * built.\n *\n * @internal\n * @type {List<AccountId>}\n */\n this._nodeAccountIds = new List();\n\n /**\n * List of the transaction node account IDs to check if\n * the node account ID of the request is in the list\n *\n * @protected\n * @type {Array<string>}\n */\n this.transactionNodeIds = [];\n\n /**\n * @internal\n */\n this._signOnDemand = false;\n\n /**\n * This is the request's min backoff\n *\n * @internal\n * @type {number | null}\n */\n this._minBackoff = null;\n\n /**\n * This is the request's max backoff\n *\n * @internal\n * @type {number}\n */\n this._maxBackoff = 8000;\n\n /**\n * The operator that was used to execute this request.\n * The reason we save the operator in the request is because of the signing on\n * demand feature. This feature requires us to sign new request on each attempt\n * meaning if a client with an operator was used we'd need to sign with the operator\n * on each attempt.\n *\n * @internal\n * @type {ClientOperator | null}\n */\n this._operator = null;\n\n /**\n * The complete timeout for running the `execute()` method\n *\n * @internal\n * @type {number | null}\n */\n this._requestTimeout = null;\n\n /**\n * The grpc request timeout aka deadline.\n *\n * The reason we have this is because there were times that consensus nodes held the grpc\n * connection, but didn't return anything; not error nor regular response. This resulted\n * in some weird behavior in the SDKs. To fix this we've added a grpc deadline to prevent\n * nodes from stalling the executing of a request.\n *\n * @internal\n * @type {number | null}\n */\n this._grpcDeadline = null;\n\n /**\n * Logger\n *\n * @protected\n * @type {Logger | null}\n */\n this._logger = null;\n }\n\n /**\n * Get the list of node account IDs on the request. If no nodes are set, then null is returned.\n * The reasoning for this is simply \"legacy behavior\".\n *\n * @returns {?AccountId[]}\n */\n get nodeAccountIds() {\n if (this._nodeAccountIds.isEmpty) {\n return null;\n } else {\n this._nodeAccountIds.setLocked();\n return this._nodeAccountIds.list;\n }\n }\n\n /**\n * Set the node account IDs on the request\n *\n * @param {AccountId[]} nodeIds\n * @returns {this}\n */\n setNodeAccountIds(nodeIds) {\n // Set the node account IDs, and lock the list. This will require `execute`\n // to use these nodes instead of random nodes from the network.\n this._nodeAccountIds.setList(nodeIds).setLocked();\n return this;\n }\n\n /**\n * @deprecated\n * @returns {number}\n */\n get maxRetries() {\n console.warn(\"Deprecated: use maxAttempts instead\");\n return this.maxAttempts;\n }\n\n /**\n * @param {number} maxRetries\n * @returns {this}\n */\n setMaxRetries(maxRetries) {\n console.warn(\"Deprecated: use setMaxAttempts() instead\");\n return this.setMaxAttempts(maxRetries);\n }\n\n /**\n * Get the max attempts on the request\n *\n * @returns {number}\n */\n get maxAttempts() {\n return this._maxAttempts;\n }\n\n /**\n * Set the max attempts on the request\n *\n * @param {number} maxAttempts\n * @returns {this}\n */\n setMaxAttempts(maxAttempts) {\n this._maxAttempts = maxAttempts;\n\n return this;\n }\n\n /**\n * Get the grpc deadline\n *\n * @returns {?number}\n */\n get grpcDeadline() {\n return this._grpcDeadline;\n }\n\n /**\n * Set the grpc deadline\n *\n * @param {number} grpcDeadline\n * @returns {this}\n */\n setGrpcDeadline(grpcDeadline) {\n this._grpcDeadline = grpcDeadline;\n\n return this;\n }\n\n /**\n * Set the min backoff for the request\n *\n * @param {number} minBackoff\n * @returns {this}\n */\n setMinBackoff(minBackoff) {\n // Honestly we shouldn't be checking for null since that should be TypeScript's job.\n // Also verify that min backoff is not greater than max backoff.\n if (minBackoff == null) {\n throw new Error(\"minBackoff cannot be null.\");\n } else if (this._maxBackoff != null && minBackoff > this._maxBackoff) {\n throw new Error(\"minBackoff cannot be larger than maxBackoff.\");\n }\n this._minBackoff = minBackoff;\n return this;\n }\n\n /**\n * Get the min backoff\n *\n * @returns {number | null}\n */\n get minBackoff() {\n return this._minBackoff;\n }\n\n /**\n * Set the max backoff for the request\n *\n * @param {?number} maxBackoff\n * @returns {this}\n */\n setMaxBackoff(maxBackoff) {\n // Honestly we shouldn't be checking for null since that should be TypeScript's job.\n // Also verify that max backoff is not less than min backoff.\n if (maxBackoff == null) {\n throw new Error(\"maxBackoff cannot be null.\");\n } else if (this._minBackoff != null && maxBackoff < this._minBackoff) {\n throw new Error(\"maxBackoff cannot be smaller than minBackoff.\");\n }\n this._maxBackoff = maxBackoff;\n return this;\n }\n\n /**\n * Get the max backoff\n *\n * @returns {number}\n */\n get maxBackoff() {\n return this._maxBackoff;\n }\n\n /**\n * This method is responsible for doing any work before the executing process begins.\n * For paid queries this will result in executing a cost query, for transactions this\n * will make sure we save the operator and sign any requests that need to be signed\n * in case signing on demand is disabled.\n *\n * @abstract\n * @protected\n * @param {import(\"./client/Client.js\").default<Channel, *>} client\n * @returns {Promise<void>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _beforeExecute(client) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Create a protobuf request which will be passed into the `_execute()` method\n *\n * @abstract\n * @protected\n * @returns {Promise<RequestT>}\n */\n _makeRequestAsync() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * This name is a bit wrong now, but the purpose of this method is to map the\n * request and response into an error. This method will only be called when\n * `_shouldRetry` returned `ExecutionState.Error`\n *\n * @abstract\n * @internal\n * @param {RequestT} request\n * @param {ResponseT} response\n * @param {AccountId} nodeId\n * @returns {Error}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapStatusError(request, response, nodeId) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Map the request, response, and the node account ID used for this attempt into a response.\n * This method will only be called when `_shouldRetry` returned `ExecutionState.Finished`\n *\n * @abstract\n * @protected\n * @param {ResponseT} response\n * @param {AccountId} nodeAccountId\n * @param {RequestT} request\n * @returns {Promise<OutputT>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Perform a single grpc call with the given request. Each request has it's own\n * required service so we just pass in channel, and it'$ the request's responsiblity\n * to use the right service and call the right grpc method.\n *\n * @abstract\n * @internal\n * @param {Channel} channel\n * @param {RequestT} request\n * @returns {Promise<ResponseT>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _execute(channel, request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Return the current transaction ID for the request. All requests which are\n * use the same transaction ID for each node, but the catch is that `Transaction`\n * implicitly supports chunked transactions. Meaning there could be multiple\n * transaction IDs stored in the request, and a different transaction ID will be used\n * on subsequent calls to `execute()`\n *\n * FIXME: This method can most likely be removed, although some further inspection\n * is required.\n *\n * @abstract\n * @protected\n * @returns {TransactionId}\n */\n _getTransactionId() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Return the log ID for this particular request\n *\n * Log IDs are simply a string constructed to make it easy to track each request's\n * execution even when mulitple requests are executing in parallel. Typically, this\n * method returns the format of `[<request type>.<timestamp of the transaction ID>]`\n *\n * Maybe we should deduplicate this using ${this.consturtor.name}\n *\n * @abstract\n * @internal\n * @returns {string}\n */\n _getLogId() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Serialize the request into bytes\n *\n * @abstract\n * @param {RequestT} request\n * @returns {Uint8Array}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _requestToBytes(request) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Serialize the response into bytes\n *\n * @abstract\n * @param {ResponseT} response\n * @returns {Uint8Array}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _responseToBytes(response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Determine if we should continue the execution process, error, or finish.\n *\n * FIXME: This method should really be called something else. Initially it returned\n * a boolean so `shouldRetry` made sense, but now it returns an enum, so the name\n * no longer makes sense.\n *\n * @abstract\n * @protected\n * @param {RequestT} request\n * @param {ResponseT} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Determine if we should error based on the gRPC status\n *\n * Unlike `shouldRetry` this method does in fact still return a boolean\n *\n * @protected\n * @param {Error} error\n * @returns {boolean}\n */\n _shouldRetryExceptionally(error) {\n if (error instanceof GrpcServiceError) {\n return (\n error.status._code === GrpcStatus.Timeout._code ||\n error.status._code === GrpcStatus.Unavailable._code ||\n error.status._code === GrpcStatus.ResourceExhausted._code ||\n error.status._code === GrpcStatus.GrpcWeb._code ||\n (error.status._code === GrpcStatus.Internal._code &&\n RST_STREAM.test(error.message))\n );\n } else {\n // if we get to the 'else' statement, the 'error' is instanceof 'HttpError'\n // and in this case, we have to retry always\n return true;\n }\n }\n\n /**\n * A helper method for setting the operator on the request\n *\n * @internal\n * @param {AccountId} accountId\n * @param {PublicKey} publicKey\n * @param {(message: Uint8Array) => Promise<Uint8Array>} transactionSigner\n * @returns {this}\n */\n _setOperatorWith(accountId, publicKey, transactionSigner) {\n this._operator = {\n transactionSigner,\n accountId,\n publicKey,\n };\n return this;\n }\n\n /**\n * Execute this request using the signer\n *\n * This method is part of the signature providers feature\n * https://hips.hedera.com/hip/hip-338\n *\n * @param {Signer} signer\n * @returns {Promise<OutputT>}\n */\n async executeWithSigner(signer) {\n return signer.call(this);\n }\n\n /**\n * @returns {boolean}\n * @abstract\n * @protected\n */\n isBatchedAndNotBatchTransaction() {\n return false;\n }\n\n /**\n * Execute the request using a client and an optional request timeout\n *\n * @template {Channel} ChannelT\n * @template {MirrorChannel} MirrorChannelT\n * @param {import(\"./client/Client.js\").default<ChannelT, MirrorChannelT>} client\n * @param {number=} requestTimeout\n * @returns {Promise<OutputT>}\n */\n async execute(client, requestTimeout) {\n // we check if its local node then backoff mechanism should be disabled\n // and we increase the retry attempts\n const isLocalNode = client.network[\"127.0.0.1:50211\"] != null;\n\n if (this.isBatchedAndNotBatchTransaction()) {\n throw new Error(\n \"Cannot execute batchified transaction outside of BatchTransaction\",\n );\n }\n\n // If the logger on the request is not set, use the logger in client\n // (if set, otherwise do not use logger)\n this._logger =\n this._logger == null\n ? client._logger != null\n ? client._logger\n : null\n : this._logger;\n\n // If the request timeout is set on the request we'll prioritize that instead\n // of the parameter provided, and if the parameter isn't provided we'll\n // use the default request timeout on client\n if (this._requestTimeout == null) {\n this._requestTimeout =\n requestTimeout != null ? requestTimeout : client.requestTimeout;\n }\n\n // Some request need to perform additional requests before the executing\n // such as paid queries need to fetch the cost of the query before\n // finally executing the actual query.\n await this._beforeExecute(client);\n\n // If the max backoff on the request is not set, use the default value in client\n if (this._maxBackoff == null) {\n this._maxBackoff = client.maxBackoff;\n }\n\n // If the min backoff on the request is not set, use the default value in client\n if (this._minBackoff == null) {\n this._minBackoff = client.minBackoff;\n }\n\n // Save the start time to be used later with request timeout\n const startTime = Date.now();\n\n // Saves each error we get so when we err due to max attempts exceeded we'll have\n // the last error that was returned by the consensus node\n let persistentError = null;\n\n // If the max attempts on the request is not set, use the default value in client\n // If the default value in client is not set, use a default of 10.\n //\n // FIXME: current implementation is wrong, update to follow comment above.\n // ... existing code ...\n const LOCAL_NODE_ATTEMPTS = 1000;\n const maxAttempts = isLocalNode\n ? LOCAL_NODE_ATTEMPTS\n : client._maxAttempts ?? this._maxAttempts;\n\n // Checks if has a valid nodes to which the TX can be sent\n if (this.transactionNodeIds.length) {\n const nodeAccountIds = this._nodeAccountIds.list.map((nodeId) =>\n nodeId.toString(),\n );\n\n const hasValidNodes = this.transactionNodeIds.some((nodeId) =>\n nodeAccountIds.includes(nodeId),\n );\n\n if (!hasValidNodes) {\n const displayNodeAccountIds =\n nodeAccountIds.length > 2\n ? `${nodeAccountIds.slice(0, 2).join(\", \")} ...`\n : nodeAccountIds.join(\", \");\n const isSingleNode = nodeAccountIds.length === 1;\n\n throw new Error(\n `Attempting to execute a transaction against node${\n isSingleNode ? \"\" : \"s\"\n } ${displayNodeAccountIds}, ` +\n `which ${\n isSingleNode ? \"is\" : \"are\"\n } not included in the Client's node list. Please review your Client configuration.`,\n );\n }\n }\n\n // The retry loop\n for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {\n // Determine if we've exceeded request timeout\n if (\n this._requestTimeout != null &&\n startTime + this._requestTimeout <= Date.now()\n ) {\n throw new MaxAttemptsOrTimeoutError(\n `timeout exceeded`,\n this._nodeAccountIds.isEmpty\n ? \"No node account ID set\"\n : this._nodeAccountIds.current.toString(),\n );\n }\n\n let nodeAccountId;\n let node;\n\n if (this._nodeAccountIds.isEmpty) {\n node = client._network.getNode();\n nodeAccountId = node.accountId;\n this._nodeAccountIds.setList([nodeAccountId]);\n } else {\n nodeAccountId = this._nodeAccountIds.current;\n node = client._network.getNode(nodeAccountId);\n }\n\n if (node == null) {\n throw new Error(\n `NodeAccountId not recognized: ${nodeAccountId.toString()}`,\n );\n }\n\n if (this.transactionNodeIds.length) {\n const isNodeAccountIdValid = this.transactionNodeIds.includes(\n nodeAccountId.toString(),\n );\n\n if (!isNodeAccountIdValid) {\n console.error(\n `Attempting to execute a transaction against node ${nodeAccountId.toString()}, which is not included in the Client's node list. Please review your Client configuration.`,\n );\n\n this._nodeAccountIds.advance();\n continue;\n }\n }\n\n // Get the log ID for the request.\n const logId = this._getLogId();\n if (this._logger) {\n this._logger.debug(\n `[${logId}] Node AccountID: ${node.accountId.toString()}, IP: ${node.address.toString()}`,\n );\n }\n\n const channel = node.getChannel();\n const request = await this._makeRequestAsync();\n\n let response;\n\n if (!node.isHealthy()) {\n const isLastNode =\n this._nodeAccountIds.index ===\n this._nodeAccountIds.list.length - 1;\n\n // Check if the request is a transaction receipt or record\n // request to retry 10 times, because getReceiptQuery/getRecordQuery\n // are single node requests\n if (\n isTransactionReceiptOrRecordRequest(request) ||\n isLocalNode\n ) {\n await delayForAttempt(\n isLocalNode,\n attempt,\n this._minBackoff,\n this._maxBackoff,\n );\n continue;\n }\n\n if (isLastNode || this._nodeAccountIds.length <= 1) {\n throw new Error(\n `Network connectivity issue: All nodes are unhealthy. Original node list: ${this._nodeAccountIds.list.join(\n \", \",\n )}`,\n );\n }\n\n if (this._logger) {\n this._logger.debug(\n `[${logId}] Node is not healthy, trying the next node.`,\n );\n }\n\n this._nodeAccountIds.advance();\n continue;\n }\n\n this._nodeAccountIds.advance();\n\n try {\n // Race the execution promise against the grpc timeout to prevent grpc connections\n // from blocking this request\n const promises = [];\n\n // If a grpc deadline is est, we should race it, otherwise the only thing in the\n // list of promises will be the execution promise.\n if (this._grpcDeadline != null) {\n promises.push(\n // eslint-disable-next-line ie11/no-loop-func\n new Promise((_, reject) =>\n setTimeout(\n // eslint-disable-next-line ie11/no-loop-func\n () =>\n reject(new Error(\"grpc deadline exceeded\")),\n /** @type {number=} */ (this._grpcDeadline),\n ),\n ),\n );\n }\n if (this._logger) {\n this._logger.trace(\n `[${this._getLogId()}] sending protobuf ${hex.encode(\n this._requestToBytes(request),\n )}`,\n );\n }\n\n promises.push(this._execute(channel, request));\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n response = /** @type {ResponseT} */ (\n await Promise.race(promises)\n );\n } catch (err) {\n // If we received a grpc status error we need to determine if\n // we should retry on this error, or err from the request entirely.\n const error = GrpcServiceError._fromResponse(\n /** @type {Error} */ (err),\n );\n\n // Save the error in case we retry\n persistentError = error;\n if (this._logger) {\n this._logger.debug(\n `[${logId}] received error ${JSON.stringify(error)}`,\n );\n }\n\n if (\n (error instanceof GrpcServiceError ||\n error instanceof HttpError) &&\n this._shouldRetryExceptionally(error) &&\n attempt <= maxAttempts\n ) {\n // Increase the backoff for the particular node and remove it from\n // the healthy node list\n if (this._logger) {\n this._logger.debug(\n `[${this._getLogId()}] node with accountId: ${node.accountId.toString()} and proxy IP: ${node.address.toString()} is unhealthy`,\n );\n }\n\n client._network.increaseBackoff(node);\n continue;\n }\n\n throw err;\n }\n if (this._logger) {\n this._logger.trace(\n `[${this._getLogId()}] sending protobuf ${hex.encode(\n this._responseToBytes(response),\n )}`,\n );\n }\n\n // If we didn't receive an error we should decrease the current nodes backoff\n // in case it is a recovering node\n client._network.decreaseBackoff(node);\n\n // Determine what execution state we're in by the response\n // For transactions this would be as simple as checking the response status is `OK`\n // while for _most_ queries it would check if the response status is `SUCCESS`\n // The only odd balls are `TransactionReceiptQuery` and `TransactionRecordQuery`\n const [status, shouldRetry] = this._shouldRetry(request, response);\n if (\n status.toString() !== Status.Ok.toString() &&\n status.toString() !== Status.Success.toString()\n ) {\n persistentError = status;\n }\n\n // Determine by the executing state what we should do\n switch (shouldRetry) {\n case ExecutionState.Retry:\n await delayForAttempt(\n isLocalNode,\n attempt,\n this._minBackoff,\n this._maxBackoff,\n );\n continue;\n case ExecutionState.Finished:\n return this._mapResponse(response, nodeAccountId, request);\n case ExecutionState.Error:\n throw this._mapStatusError(\n request,\n response,\n nodeAccountId,\n );\n default:\n throw new Error(\n \"(BUG) non-exhaustive switch statement for `ExecutionState`\",\n );\n }\n }\n\n // We'll only get here if we've run out of attempts, so we return an error wrapping the\n // persistent error we saved before.\n\n throw new MaxAttemptsOrTimeoutError(\n `max attempts of ${maxAttempts.toString()} was reached for request with last error being: ${\n persistentError != null ? persistentError.toString() : \"\"\n }`,\n this._nodeAccountIds.current.toString(),\n );\n }\n\n /**\n * The current purpose of this method is to easily support signature providers since\n * signature providers need to serialize _any_ request into bytes. `Query` and `Transaction`\n * already implement `toBytes()` so it only made sense to make it available here too.\n *\n * @abstract\n * @returns {Uint8Array}\n */\n toBytes() {\n throw new Error(\"not implemented\");\n }\n\n /**\n * Set logger\n *\n * @param {Logger} logger\n * @returns {this}\n */\n setLogger(logger) {\n this._logger = logger;\n return this;\n }\n\n /**\n * Get logger if set\n *\n * @returns {?Logger}\n */\n get logger() {\n return this._logger;\n }\n}\n\n/**\n * Checks if the request is a transaction receipt or record request\n *\n * @template T\n * @param {T} request - The request to check\n * @returns {boolean} - True if the request is a transaction receipt or record\n */\nfunction isTransactionReceiptOrRecordRequest(request) {\n if (typeof request !== \"object\" || request === null) {\n return false;\n }\n\n return (\n \"transactionGetReceipt\" in request || \"transactionGetRecord\" in request\n );\n}\n\n/**\n * A simple function that returns a promise timeout for a specific period of time\n *\n * @param {boolean} isLocalNode\n * @param {number} attempt\n * @param {number} minBackoff\n * @param {number} maxBackoff\n * @returns {Promise<void>}\n */\nfunction delayForAttempt(isLocalNode, attempt, minBackoff, maxBackoff) {\n if (isLocalNode) {\n return new Promise((resolve) => setTimeout(resolve, minBackoff));\n }\n\n // 0.1s, 0.2s, 0.4s, 0.8s, ...\n const ms = Math.min(\n Math.floor(minBackoff * Math.pow(2, attempt)),\n maxBackoff,\n );\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n"],"names":["ExecutionState","Finished","Retry","Error","RST_STREAM","DEFAULT_MAX_ATTEMPTS","Executable","constructor","this","_maxAttempts","_nodeAccountIds","List","transactionNodeIds","_signOnDemand","_minBackoff","_maxBackoff","_operator","_requestTimeout","_grpcDeadline","_logger","nodeAccountIds","isEmpty","setLocked","list","setNodeAccountIds","nodeIds","setList","maxRetries","console","warn","maxAttempts","setMaxRetries","setMaxAttempts","grpcDeadline","setGrpcDeadline","setMinBackoff","minBackoff","setMaxBackoff","maxBackoff","_beforeExecute","client","_makeRequestAsync","_mapStatusError","request","response","nodeId","_mapResponse","nodeAccountId","_execute","channel","_getTransactionId","_getLogId","_requestToBytes","_responseToBytes","_shouldRetry","_shouldRetryExceptionally","error","GrpcServiceError","status","_code","GrpcStatus","Timeout","Unavailable","ResourceExhausted","GrpcWeb","Internal","test","message","_setOperatorWith","accountId","publicKey","transactionSigner","executeWithSigner","signer","call","isBatchedAndNotBatchTransaction","execute","requestTimeout","isLocalNode","network","startTime","Date","now","persistentError","length","map","toString","some","includes","displayNodeAccountIds","slice","join","isSingleNode","attempt","MaxAttemptsOrTimeoutError","current","node","_network","getNode","advance","logId","debug","address","getChannel","isHealthy","isLastNode","index","isTransactionReceiptOrRecordRequest","delayForAttempt","promises","push","Promise","_","reject","setTimeout","trace","hex.encode","race","err","_fromResponse","JSON","stringify","HttpError","increaseBackoff","decreaseBackoff","shouldRetry","Status","Ok","Success","toBytes","setLogger","logger","resolve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M,kBACxB,CAQI,SAAA+H,CAAUC,GAEN,OADA3H,KAAKW,QAAUgH,EACR3H,IACf,CAOI,UAAI2H,GACA,OAAO3H,KAAKW,OACpB,EAUA,SAASwF,EAAoChE,GACzC,MAAuB,iBAAZA,GAAoC,OAAZA,IAK/B,0BAA2BA,GAAW,yBAA0BA,EAExE,CAWA,SAASiE,EAAgB9B,EAAae,EAASzD,EAAYE,GACvD,GAAIwC,EACA,OAAO,IAAIiC,QAASqB,GAAYlB,WAAWkB,EAAShG,IAIxD,MAAMiG,EAAKC,KAAKC,IACZD,KAAKE,MAAMpG,EAAakG,KAAKG,IAAI,EAAG5C,IACpCvD,GAEJ,OAAO,IAAIyE,QAASqB,GAAYlB,WAAWkB,EAASC,GACxD"}
@@ -7,8 +7,7 @@ exports.default = void 0;
7
7
  var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
8
8
  var _long = _interopRequireDefault(require("long"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
11
  // SPDX-License-Identifier: Apache-2.0
13
12
 
14
13
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
package/lib/FeeData.cjs CHANGED
@@ -8,8 +8,7 @@ var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
8
8
  var _FeeComponents = _interopRequireDefault(require("./FeeComponents.cjs"));
9
9
  var _FeeDataType = _interopRequireDefault(require("./FeeDataType.cjs"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
12
  // SPDX-License-Identifier: Apache-2.0
14
13
 
15
14
  /**
@@ -8,8 +8,7 @@ var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
8
8
  var _TransactionFeeSchedule = _interopRequireDefault(require("./TransactionFeeSchedule.cjs"));
9
9
  var _Timestamp = _interopRequireDefault(require("./Timestamp.cjs"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
12
  // SPDX-License-Identifier: Apache-2.0
14
13
 
15
14
  /**
@@ -1,2 +1,2 @@
1
- import*as e from"@hashgraph/proto";import t from"./TransactionFeeSchedule.js";import o from"./Timestamp.js";class r{constructor(e={}){this.transactionFeeSchedule=e.transactionFeeSchedule,this.expirationTime=e.expirationTime}static fromBytes(t){return r._fromProtobuf(e.proto.FeeSchedule.decode(t))}static _fromProtobuf(e){return new r({transactionFeeSchedule:null!=e.transactionFeeSchedule?e.transactionFeeSchedule.map((e=>t._fromProtobuf(e))):void 0,expirationTime:null!=e.expiryTime?o._fromProtobuf(e.expiryTime):void 0})}_toProtobuf(){return{transactionFeeSchedule:null!=this.transactionFeeSchedule?this.transactionFeeSchedule.map((e=>e._toProtobuf())):void 0,expiryTime:null!=this.expirationTime?this.expirationTime._toProtobuf():void 0}}toBytes(){return e.proto.FeeSchedule.encode(this._toProtobuf()).finish()}}export{r as default};
1
+ import*as e from"@hashgraph/proto";import t from"./TransactionFeeSchedule.js";import o from"./Timestamp.js";class r{constructor(e={}){this.transactionFeeSchedule=e.transactionFeeSchedule,this.expirationTime=e.expirationTime}static fromBytes(t){return r._fromProtobuf(e.proto.FeeSchedule.decode(t))}static _fromProtobuf(e){return new r({transactionFeeSchedule:null!=e.transactionFeeSchedule?e.transactionFeeSchedule.map(e=>t._fromProtobuf(e)):void 0,expirationTime:null!=e.expiryTime?o._fromProtobuf(e.expiryTime):void 0})}_toProtobuf(){return{transactionFeeSchedule:null!=this.transactionFeeSchedule?this.transactionFeeSchedule.map(e=>e._toProtobuf()):void 0,expiryTime:null!=this.expirationTime?this.expirationTime._toProtobuf():void 0}}toBytes(){return e.proto.FeeSchedule.encode(this._toProtobuf()).finish()}}export{r as default};
2
2
  //# sourceMappingURL=FeeSchedule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FeeSchedule.js","sources":["../src/FeeSchedule.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport * as HieroProto from \"@hashgraph/proto\";\nimport TransactionFeeSchedule from \"./TransactionFeeSchedule.js\";\nimport Timestamp from \"./Timestamp.js\";\n\n/**\n * A set of fee schedules covering all transaction types and query types, along\n * with a specific time at which this fee schedule will expire.\n */\nexport default class FeeSchedule {\n /**\n * @param {object} [props]\n * @param {TransactionFeeSchedule[]} [props.transactionFeeSchedule]\n * @param {Timestamp} [props.expirationTime]\n */\n constructor(props = {}) {\n /*\n * List of price coefficients for network resources\n *\n * @type {TransactionFeeSchedule}\n */\n this.transactionFeeSchedule = props.transactionFeeSchedule;\n\n /*\n * FeeSchedule expiry time\n *\n * @type {Timestamp}\n */\n this.expirationTime = props.expirationTime;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FeeSchedule}\n */\n static fromBytes(bytes) {\n return FeeSchedule._fromProtobuf(\n HieroProto.proto.FeeSchedule.decode(bytes),\n );\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IFeeSchedule} feeSchedule\n * @returns {FeeSchedule}\n */\n static _fromProtobuf(feeSchedule) {\n return new FeeSchedule({\n transactionFeeSchedule:\n feeSchedule.transactionFeeSchedule != null\n ? feeSchedule.transactionFeeSchedule.map((schedule) =>\n TransactionFeeSchedule._fromProtobuf(schedule),\n )\n : undefined,\n expirationTime:\n feeSchedule.expiryTime != null\n ? Timestamp._fromProtobuf(feeSchedule.expiryTime)\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.IFeeSchedule}\n */\n _toProtobuf() {\n return {\n transactionFeeSchedule:\n this.transactionFeeSchedule != null\n ? this.transactionFeeSchedule.map((transaction) =>\n transaction._toProtobuf(),\n )\n : undefined,\n expiryTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : undefined,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.FeeSchedule.encode(this._toProtobuf()).finish();\n }\n}\n"],"names":["FeeSchedule","constructor","props","this","transactionFeeSchedule","expirationTime","fromBytes","bytes","_fromProtobuf","HieroProto","proto","decode","feeSchedule","map","schedule","TransactionFeeSchedule","undefined","expiryTime","Timestamp","_toProtobuf","transaction","toBytes","encode","finish"],"mappings":"4GAUe,MAAMA,EAMjB,WAAAC,CAAYC,EAAQ,IAMhBC,KAAKC,uBAAyBF,EAAME,uBAOpCD,KAAKE,eAAiBH,EAAMG,cACpC,CAMI,gBAAOC,CAAUC,GACb,OAAOP,EAAYQ,cACfC,EAAWC,MAAMV,YAAYW,OAAOJ,GAEhD,CAOI,oBAAOC,CAAcI,GACjB,OAAO,IAAIZ,EAAY,CACnBI,uBAC0C,MAAtCQ,EAAYR,uBACNQ,EAAYR,uBAAuBS,KAAKC,GACpCC,EAAuBP,cAAcM,UAEzCE,EACVX,eAC8B,MAA1BO,EAAYK,WACNC,EAAUV,cAAcI,EAAYK,iBACpCD,GAEtB,CAMI,WAAAG,GACI,MAAO,CACHf,uBACmC,MAA/BD,KAAKC,uBACCD,KAAKC,uBAAuBS,KAAKO,GAC7BA,EAAYD,qBAEhBH,EACVC,WAC2B,MAAvBd,KAAKE,eACCF,KAAKE,eAAec,mBACpBH,EAEtB,CAKI,OAAAK,GACI,OAAOZ,EAAWC,MAAMV,YAAYsB,OAAOnB,KAAKgB,eAAeI,QACvE"}
1
+ {"version":3,"file":"FeeSchedule.js","sources":["../src/FeeSchedule.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport * as HieroProto from \"@hashgraph/proto\";\nimport TransactionFeeSchedule from \"./TransactionFeeSchedule.js\";\nimport Timestamp from \"./Timestamp.js\";\n\n/**\n * A set of fee schedules covering all transaction types and query types, along\n * with a specific time at which this fee schedule will expire.\n */\nexport default class FeeSchedule {\n /**\n * @param {object} [props]\n * @param {TransactionFeeSchedule[]} [props.transactionFeeSchedule]\n * @param {Timestamp} [props.expirationTime]\n */\n constructor(props = {}) {\n /*\n * List of price coefficients for network resources\n *\n * @type {TransactionFeeSchedule}\n */\n this.transactionFeeSchedule = props.transactionFeeSchedule;\n\n /*\n * FeeSchedule expiry time\n *\n * @type {Timestamp}\n */\n this.expirationTime = props.expirationTime;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {FeeSchedule}\n */\n static fromBytes(bytes) {\n return FeeSchedule._fromProtobuf(\n HieroProto.proto.FeeSchedule.decode(bytes),\n );\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IFeeSchedule} feeSchedule\n * @returns {FeeSchedule}\n */\n static _fromProtobuf(feeSchedule) {\n return new FeeSchedule({\n transactionFeeSchedule:\n feeSchedule.transactionFeeSchedule != null\n ? feeSchedule.transactionFeeSchedule.map((schedule) =>\n TransactionFeeSchedule._fromProtobuf(schedule),\n )\n : undefined,\n expirationTime:\n feeSchedule.expiryTime != null\n ? Timestamp._fromProtobuf(feeSchedule.expiryTime)\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.IFeeSchedule}\n */\n _toProtobuf() {\n return {\n transactionFeeSchedule:\n this.transactionFeeSchedule != null\n ? this.transactionFeeSchedule.map((transaction) =>\n transaction._toProtobuf(),\n )\n : undefined,\n expiryTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : undefined,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.FeeSchedule.encode(this._toProtobuf()).finish();\n }\n}\n"],"names":["FeeSchedule","constructor","props","this","transactionFeeSchedule","expirationTime","fromBytes","bytes","_fromProtobuf","HieroProto","proto","decode","feeSchedule","map","schedule","TransactionFeeSchedule","undefined","expiryTime","Timestamp","_toProtobuf","transaction","toBytes","encode","finish"],"mappings":"4GAUe,MAAMA,EAMjB,WAAAC,CAAYC,EAAQ,IAMhBC,KAAKC,uBAAyBF,EAAME,uBAOpCD,KAAKE,eAAiBH,EAAMG,cACpC,CAMI,gBAAOC,CAAUC,GACb,OAAOP,EAAYQ,cACfC,EAAWC,MAAMV,YAAYW,OAAOJ,GAEhD,CAOI,oBAAOC,CAAcI,GACjB,OAAO,IAAIZ,EAAY,CACnBI,uBAC0C,MAAtCQ,EAAYR,uBACNQ,EAAYR,uBAAuBS,IAAKC,GACpCC,EAAuBP,cAAcM,SAEzCE,EACVX,eAC8B,MAA1BO,EAAYK,WACNC,EAAUV,cAAcI,EAAYK,iBACpCD,GAEtB,CAMI,WAAAG,GACI,MAAO,CACHf,uBACmC,MAA/BD,KAAKC,uBACCD,KAAKC,uBAAuBS,IAAKO,GAC7BA,EAAYD,oBAEhBH,EACVC,WAC2B,MAAvBd,KAAKE,eACCF,KAAKE,eAAec,mBACpBH,EAEtB,CAKI,OAAAK,GACI,OAAOZ,EAAWC,MAAMV,YAAYsB,OAAOnB,KAAKgB,eAAeI,QACvE"}
@@ -7,8 +7,7 @@ exports.default = void 0;
7
7
  var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
8
8
  var _FeeSchedule = _interopRequireDefault(require("./FeeSchedule.cjs"));
9
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
11
  // SPDX-License-Identifier: Apache-2.0
13
12
 
14
13
  /**
package/lib/KeyList.js CHANGED
@@ -1,2 +1,2 @@
1
- import t from"./Key.js";import e from"./Cache.js";class s extends t{constructor(e,s){super(),this._keys=null==e?[]:e instanceof t?[e]:e,this._threshold=null==s?null:s}static of(...t){return new s(t,null)}static from(t,e,r){return new s(null==e?Array.from(t):Array.from(t,e,r))}get threshold(){return this._threshold}setThreshold(t){return this._threshold=t,this}push(...t){return this._keys.push(...t)}splice(t,e,...r){return new s(this._keys.splice(t,e,...r),this.threshold)}slice(t,e){return new s(this._keys.slice(t,e),this.threshold)}[Symbol.iterator](){return this._keys[Symbol.iterator]()}toArray(){return this._keys.slice()}toString(){return JSON.stringify({threshold:this._threshold,keys:this._keys.toString()})}_toProtobufKey(){const t=this._keys.map((t=>t._toProtobufKey()));return null==this.threshold?{keyList:{keys:t}}:{thresholdKey:{threshold:this.threshold,keys:{keys:t}}}}static __fromProtobufKeyList(e){const r=(null!=e.keys?e.keys:[]).map((e=>t._fromProtobufKey(e)));return new s(r)}static __fromProtobufThresoldKey(t){const e=s.__fromProtobufKeyList(null!=t.keys?t.keys:{});return e.setThreshold(null!=t.threshold?t.threshold:0),e}}e.setKeyList((t=>s.__fromProtobufKeyList(t))),e.setThresholdKey((t=>s.__fromProtobufThresoldKey(t)));export{s as default};
1
+ import t from"./Key.js";import e from"./Cache.js";class s extends t{constructor(e,s){super(),this._keys=null==e?[]:e instanceof t?[e]:e,this._threshold=null==s?null:s}static of(...t){return new s(t,null)}static from(t,e,r){return new s(null==e?Array.from(t):Array.from(t,e,r))}get threshold(){return this._threshold}setThreshold(t){return this._threshold=t,this}push(...t){return this._keys.push(...t)}splice(t,e,...r){return new s(this._keys.splice(t,e,...r),this.threshold)}slice(t,e){return new s(this._keys.slice(t,e),this.threshold)}[Symbol.iterator](){return this._keys[Symbol.iterator]()}toArray(){return this._keys.slice()}toString(){return JSON.stringify({threshold:this._threshold,keys:this._keys.toString()})}_toProtobufKey(){const t=this._keys.map(t=>t._toProtobufKey());return null==this.threshold?{keyList:{keys:t}}:{thresholdKey:{threshold:this.threshold,keys:{keys:t}}}}static __fromProtobufKeyList(e){const r=(null!=e.keys?e.keys:[]).map(e=>t._fromProtobufKey(e));return new s(r)}static __fromProtobufThresoldKey(t){const e=s.__fromProtobufKeyList(null!=t.keys?t.keys:{});return e.setThreshold(null!=t.threshold?t.threshold:0),e}}e.setKeyList(t=>s.__fromProtobufKeyList(t)),e.setThresholdKey(t=>s.__fromProtobufThresoldKey(t));export{s as default};
2
2
  //# sourceMappingURL=KeyList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KeyList.js","sources":["../src/KeyList.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Key from \"./Key.js\";\nimport CACHE from \"./Cache.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HieroProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.IKeyList} HieroProto.proto.IKeyList\n * @typedef {import(\"@hashgraph/proto\").proto.IThresholdKey} HieroProto.proto.IThresholdKey\n */\n\n/**\n * A list of Keys (`Key`) with an optional threshold.\n */\nexport default class KeyList extends Key {\n /**\n * @param {?Key[]} [keys]\n * @param {?number} [threshold]\n */\n constructor(keys, threshold) {\n super();\n\n /**\n * @private\n * @type {Key[]}\n */\n // @ts-ignore\n if (keys == null) this._keys = [];\n //checks if the value for `keys` is passed as a single key\n //rather than a list that contains just one key\n else if (keys instanceof Key) this._keys = [keys];\n else this._keys = keys;\n\n /**\n * @type {?number}\n */\n this._threshold = threshold == null ? null : threshold;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {KeyList}\n */\n static of(...keys) {\n return new KeyList(keys, null);\n }\n\n /**\n * @template T\n * @param {ArrayLike<Key>} arrayLike\n * @param {((key: Key) => Key)} [mapFn]\n * @param {T} [thisArg]\n * @returns {KeyList}\n */\n static from(arrayLike, mapFn, thisArg) {\n if (mapFn == null) {\n return new KeyList(Array.from(arrayLike));\n }\n\n return new KeyList(Array.from(arrayLike, mapFn, thisArg));\n }\n\n /**\n * @returns {?number}\n */\n get threshold() {\n return this._threshold;\n }\n\n /**\n * @param {number} threshold\n * @returns {this}\n */\n setThreshold(threshold) {\n this._threshold = threshold;\n return this;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {number}\n */\n push(...keys) {\n return this._keys.push(...keys);\n }\n\n /**\n * @param {number} start\n * @param {number} deleteCount\n * @param {Key[]} items\n * @returns {KeyList}\n */\n splice(start, deleteCount, ...items) {\n return new KeyList(\n this._keys.splice(start, deleteCount, ...items),\n this.threshold,\n );\n }\n\n /**\n * @param {number=} start\n * @param {number=} end\n * @returns {KeyList}\n */\n slice(start, end) {\n return new KeyList(this._keys.slice(start, end), this.threshold);\n }\n\n /**\n * @returns {Iterator<Key>}\n */\n [Symbol.iterator]() {\n return this._keys[Symbol.iterator]();\n }\n\n /**\n * @returns {Key[]}\n */\n toArray() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this._keys.slice();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify({\n threshold: this._threshold,\n keys: this._keys.toString(),\n });\n }\n\n /**\n * @returns {HieroProto.proto.IKey}\n */\n _toProtobufKey() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return\n const keys = this._keys.map((key) => key._toProtobufKey());\n\n if (this.threshold == null) {\n return { keyList: { keys } };\n } else {\n return {\n thresholdKey: {\n threshold: this.threshold,\n keys: { keys },\n },\n };\n }\n }\n\n /**\n * @param {HieroProto.proto.IKeyList} key\n * @returns {KeyList}\n */\n static __fromProtobufKeyList(key) {\n const keys = (key.keys != null ? key.keys : []).map((key) =>\n Key._fromProtobufKey(key),\n );\n return new KeyList(keys);\n }\n\n /**\n * @param {HieroProto.proto.IThresholdKey} key\n * @returns {KeyList}\n */\n static __fromProtobufThresoldKey(key) {\n const list = KeyList.__fromProtobufKeyList(\n key.keys != null ? key.keys : {},\n );\n list.setThreshold(key.threshold != null ? key.threshold : 0);\n return list;\n }\n}\n\nCACHE.setKeyList((key) => KeyList.__fromProtobufKeyList(key));\nCACHE.setThresholdKey((key) => KeyList.__fromProtobufThresoldKey(key));\n"],"names":["KeyList","Key","constructor","keys","threshold","super","this","_keys","_threshold","of","from","arrayLike","mapFn","thisArg","Array","setThreshold","push","splice","start","deleteCount","items","slice","end","Symbol","iterator","toArray","toString","JSON","stringify","_toProtobufKey","map","key","keyList","thresholdKey","__fromProtobufKeyList","_fromProtobufKey","__fromProtobufThresoldKey","list","CACHE","setKeyList","setThresholdKey"],"mappings":"kDAee,MAAMA,UAAgBC,EAKjC,WAAAC,CAAYC,EAAMC,GACdC,QAOkBC,KAAKC,MAAX,MAARJ,EAA2B,GAGtBA,aAAgBF,EAAkB,CAACE,GAC1BA,EAKlBG,KAAKE,WAA0B,MAAbJ,EAAoB,KAAOA,CACrD,CAMI,SAAOK,IAAMN,GACT,OAAO,IAAIH,EAAQG,EAAM,KACjC,CASI,WAAOO,CAAKC,EAAWC,EAAOC,GAC1B,OACW,IAAIb,EADF,MAATY,EACmBE,MAAMJ,KAAKC,GAGfG,MAAMJ,KAAKC,EAAWC,EAAOC,GACxD,CAKI,aAAIT,GACA,OAAOE,KAAKE,UACpB,CAMI,YAAAO,CAAaX,GAET,OADAE,KAAKE,WAAaJ,EACXE,IACf,CAMI,IAAAU,IAAQb,GACJ,OAAOG,KAAKC,MAAMS,QAAQb,EAClC,CAQI,MAAAc,CAAOC,EAAOC,KAAgBC,GAC1B,OAAO,IAAIpB,EACPM,KAAKC,MAAMU,OAAOC,EAAOC,KAAgBC,GACzCd,KAAKF,UAEjB,CAOI,KAAAiB,CAAMH,EAAOI,GACT,OAAO,IAAItB,EAAQM,KAAKC,MAAMc,MAAMH,EAAOI,GAAMhB,KAAKF,UAC9D,CAKI,CAACmB,OAAOC,YACJ,OAAOlB,KAAKC,MAAMgB,OAAOC,WACjC,CAKI,OAAAC,GAEI,OAAOnB,KAAKC,MAAMc,OAC1B,CAKI,QAAAK,GACI,OAAOC,KAAKC,UAAU,CAClBxB,UAAWE,KAAKE,WAChBL,KAAMG,KAAKC,MAAMmB,YAE7B,CAKI,cAAAG,GAEI,MAAM1B,EAAOG,KAAKC,MAAMuB,KAAKC,GAAQA,EAAIF,mBAEzC,OAAsB,MAAlBvB,KAAKF,UACE,CAAE4B,QAAS,CAAE7B,SAEb,CACH8B,aAAc,CACV7B,UAAWE,KAAKF,UAChBD,KAAM,CAAEA,SAI5B,CAMI,4BAAO+B,CAAsBH,GACzB,MAAM5B,GAAoB,MAAZ4B,EAAI5B,KAAe4B,EAAI5B,KAAO,IAAI2B,KAAKC,GACjD9B,EAAIkC,iBAAiBJ,KAEzB,OAAO,IAAI/B,EAAQG,EAC3B,CAMI,gCAAOiC,CAA0BL,GAC7B,MAAMM,EAAOrC,EAAQkC,sBACL,MAAZH,EAAI5B,KAAe4B,EAAI5B,KAAO,CAAE,GAGpC,OADAkC,EAAKtB,aAA8B,MAAjBgB,EAAI3B,UAAoB2B,EAAI3B,UAAY,GACnDiC,CACf,EAGAC,EAAMC,YAAYR,GAAQ/B,EAAQkC,sBAAsBH,KACxDO,EAAME,iBAAiBT,GAAQ/B,EAAQoC,0BAA0BL"}
1
+ {"version":3,"file":"KeyList.js","sources":["../src/KeyList.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Key from \"./Key.js\";\nimport CACHE from \"./Cache.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HieroProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.IKeyList} HieroProto.proto.IKeyList\n * @typedef {import(\"@hashgraph/proto\").proto.IThresholdKey} HieroProto.proto.IThresholdKey\n */\n\n/**\n * A list of Keys (`Key`) with an optional threshold.\n */\nexport default class KeyList extends Key {\n /**\n * @param {?Key[]} [keys]\n * @param {?number} [threshold]\n */\n constructor(keys, threshold) {\n super();\n\n /**\n * @private\n * @type {Key[]}\n */\n // @ts-ignore\n if (keys == null) this._keys = [];\n //checks if the value for `keys` is passed as a single key\n //rather than a list that contains just one key\n else if (keys instanceof Key) this._keys = [keys];\n else this._keys = keys;\n\n /**\n * @type {?number}\n */\n this._threshold = threshold == null ? null : threshold;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {KeyList}\n */\n static of(...keys) {\n return new KeyList(keys, null);\n }\n\n /**\n * @template T\n * @param {ArrayLike<Key>} arrayLike\n * @param {((key: Key) => Key)} [mapFn]\n * @param {T} [thisArg]\n * @returns {KeyList}\n */\n static from(arrayLike, mapFn, thisArg) {\n if (mapFn == null) {\n return new KeyList(Array.from(arrayLike));\n }\n\n return new KeyList(Array.from(arrayLike, mapFn, thisArg));\n }\n\n /**\n * @returns {?number}\n */\n get threshold() {\n return this._threshold;\n }\n\n /**\n * @param {number} threshold\n * @returns {this}\n */\n setThreshold(threshold) {\n this._threshold = threshold;\n return this;\n }\n\n /**\n * @param {Key[]} keys\n * @returns {number}\n */\n push(...keys) {\n return this._keys.push(...keys);\n }\n\n /**\n * @param {number} start\n * @param {number} deleteCount\n * @param {Key[]} items\n * @returns {KeyList}\n */\n splice(start, deleteCount, ...items) {\n return new KeyList(\n this._keys.splice(start, deleteCount, ...items),\n this.threshold,\n );\n }\n\n /**\n * @param {number=} start\n * @param {number=} end\n * @returns {KeyList}\n */\n slice(start, end) {\n return new KeyList(this._keys.slice(start, end), this.threshold);\n }\n\n /**\n * @returns {Iterator<Key>}\n */\n [Symbol.iterator]() {\n return this._keys[Symbol.iterator]();\n }\n\n /**\n * @returns {Key[]}\n */\n toArray() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n return this._keys.slice();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify({\n threshold: this._threshold,\n keys: this._keys.toString(),\n });\n }\n\n /**\n * @returns {HieroProto.proto.IKey}\n */\n _toProtobufKey() {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return\n const keys = this._keys.map((key) => key._toProtobufKey());\n\n if (this.threshold == null) {\n return { keyList: { keys } };\n } else {\n return {\n thresholdKey: {\n threshold: this.threshold,\n keys: { keys },\n },\n };\n }\n }\n\n /**\n * @param {HieroProto.proto.IKeyList} key\n * @returns {KeyList}\n */\n static __fromProtobufKeyList(key) {\n const keys = (key.keys != null ? key.keys : []).map((key) =>\n Key._fromProtobufKey(key),\n );\n return new KeyList(keys);\n }\n\n /**\n * @param {HieroProto.proto.IThresholdKey} key\n * @returns {KeyList}\n */\n static __fromProtobufThresoldKey(key) {\n const list = KeyList.__fromProtobufKeyList(\n key.keys != null ? key.keys : {},\n );\n list.setThreshold(key.threshold != null ? key.threshold : 0);\n return list;\n }\n}\n\nCACHE.setKeyList((key) => KeyList.__fromProtobufKeyList(key));\nCACHE.setThresholdKey((key) => KeyList.__fromProtobufThresoldKey(key));\n"],"names":["KeyList","Key","constructor","keys","threshold","super","this","_keys","_threshold","of","from","arrayLike","mapFn","thisArg","Array","setThreshold","push","splice","start","deleteCount","items","slice","end","Symbol","iterator","toArray","toString","JSON","stringify","_toProtobufKey","map","key","keyList","thresholdKey","__fromProtobufKeyList","_fromProtobufKey","__fromProtobufThresoldKey","list","CACHE","setKeyList","setThresholdKey"],"mappings":"kDAee,MAAMA,UAAgBC,EAKjC,WAAAC,CAAYC,EAAMC,GACdC,QAOkBC,KAAKC,MAAX,MAARJ,EAA2B,GAGtBA,aAAgBF,EAAkB,CAACE,GAC1BA,EAKlBG,KAAKE,WAA0B,MAAbJ,EAAoB,KAAOA,CACrD,CAMI,SAAOK,IAAMN,GACT,OAAO,IAAIH,EAAQG,EAAM,KACjC,CASI,WAAOO,CAAKC,EAAWC,EAAOC,GAC1B,OACW,IAAIb,EADF,MAATY,EACmBE,MAAMJ,KAAKC,GAGfG,MAAMJ,KAAKC,EAAWC,EAAOC,GACxD,CAKI,aAAIT,GACA,OAAOE,KAAKE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/LedgerId.cjs CHANGED
@@ -5,8 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var hex = _interopRequireWildcard(require("./encoding/hex.cjs"));
8
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
9
  // SPDX-License-Identifier: Apache-2.0
11
10
 
12
11
  /**
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _WebClient = _interopRequireDefault(require("./client/WebClient.cjs"));
8
+ var _AccountBalanceQuery = _interopRequireDefault(require("./account/AccountBalanceQuery.cjs"));
9
+ var _AccountInfoQuery = _interopRequireDefault(require("./account/AccountInfoQuery.cjs"));
10
+ var _AccountRecordsQuery = _interopRequireDefault(require("./account/AccountRecordsQuery.cjs"));
11
+ var _TransactionReceiptQuery = _interopRequireDefault(require("./transaction/TransactionReceiptQuery.cjs"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ // SPDX-License-Identifier: Apache-2.0
14
+
15
+ /**
16
+ * @typedef {import("./Provider.js").Provider} Provider
17
+ * @typedef {import("./LedgerId.js").default} LedgerId
18
+ * @typedef {import("./Key.js").default} Key
19
+ * @typedef {import("./transaction/Transaction.js").default} Transaction
20
+ * @typedef {import("./transaction/TransactionId.js").default} TransactionId
21
+ * @typedef {import("./transaction/TransactionResponse.js").default} TransactionResponse
22
+ * @typedef {import("./transaction/TransactionReceipt.js").default} TransactionReceipt
23
+ * @typedef {import("./transaction/TransactionRecord.js").default} TransactionRecord
24
+ * @typedef {import("./account/AccountId.js").default} AccountId
25
+ * @typedef {import("./account/AccountBalance.js").default} AccountBalance
26
+ * @typedef {import("./account/AccountInfo.js").default} AccountInfo
27
+ * @typedef {import("./logger/Logger.js").default} Logger
28
+ */
29
+
30
+ /**
31
+ * @template {any} O
32
+ * @typedef {import("./query/Query.js").default<O>} Query<O>
33
+ */
34
+
35
+ /**
36
+ * @template RequestT
37
+ * @template ResponseT
38
+ * @template OutputT
39
+ * @typedef {import("./Executable.js").default<RequestT, ResponseT, OutputT>} Executable<RequestT, ResponseT, OutputT>
40
+ */
41
+
42
+ /**
43
+ * @implements {Provider}
44
+ */
45
+ class LocalProviderWeb {
46
+ /**
47
+ * @param {object} props
48
+ * @param {Client} [props.client]
49
+ * @param {"mainnet" | "testnet" | "previewnet" | "local-node"} [props.networkName]
50
+ */
51
+ constructor(props = {}) {
52
+ if (props != null && props.client != null) {
53
+ this._client = props.client;
54
+ return;
55
+ }
56
+ this._client = _WebClient.default.forName(props.networkName || "local-node");
57
+ }
58
+
59
+ /**
60
+ * @param {Client} client
61
+ * @returns {LocalProviderWeb}
62
+ */
63
+ static fromClient(client) {
64
+ return new LocalProviderWeb({
65
+ client
66
+ });
67
+ }
68
+
69
+ /**
70
+ * @returns {LedgerId?}
71
+ */
72
+ getLedgerId() {
73
+ return this._client.ledgerId;
74
+ }
75
+
76
+ /**
77
+ * @returns {{[key: string]: (string | AccountId)}}
78
+ */
79
+ getNetwork() {
80
+ return this._client.network;
81
+ }
82
+
83
+ /**
84
+ * @returns {string[]}
85
+ */
86
+ getMirrorNetwork() {
87
+ return this._client.mirrorNetwork;
88
+ }
89
+
90
+ /**
91
+ * @param {AccountId | string} accountId
92
+ * @returns {Promise<AccountBalance>}
93
+ */
94
+ getAccountBalance(accountId) {
95
+ return new _AccountBalanceQuery.default().setAccountId(accountId).execute(this._client);
96
+ }
97
+
98
+ /**
99
+ * @param {AccountId | string} accountId
100
+ * @returns {Promise<AccountInfo>}
101
+ */
102
+ getAccountInfo(accountId) {
103
+ return new _AccountInfoQuery.default().setAccountId(accountId).execute(this._client);
104
+ }
105
+
106
+ /**
107
+ * @param {AccountId | string} accountId
108
+ * @returns {Promise<TransactionRecord[]>}
109
+ */
110
+ getAccountRecords(accountId) {
111
+ return new _AccountRecordsQuery.default().setAccountId(accountId).execute(this._client);
112
+ }
113
+
114
+ /**
115
+ * @param {TransactionId | string} transactionId
116
+ * @returns {Promise<TransactionReceipt>}
117
+ */
118
+ getTransactionReceipt(transactionId) {
119
+ return new _TransactionReceiptQuery.default().setTransactionId(transactionId).execute(this._client);
120
+ }
121
+
122
+ /**
123
+ * @param {Transaction} transaction
124
+ * @returns {Promise<TransactionResponse>}
125
+ */
126
+ async sendTransaction(transaction) {
127
+ return await transaction.execute(this._client);
128
+ }
129
+
130
+ /**
131
+ * @template O
132
+ * @param {Query<O>} query
133
+ * @returns {Promise<O>}
134
+ */
135
+ async sendQuery(query) {
136
+ return await query.execute(this._client);
137
+ }
138
+
139
+ /**
140
+ * @param {TransactionResponse} response
141
+ * @returns {Promise<TransactionReceipt>}
142
+ */
143
+ async waitForReceipt(response) {
144
+ return await response.getReceipt(this._client);
145
+ }
146
+
147
+ /**
148
+ * @template RequestT
149
+ * @template ResponseT
150
+ * @template OutputT
151
+ * @param {Executable<RequestT, ResponseT, OutputT>} request
152
+ * @returns {Promise<OutputT>}
153
+ */
154
+ async call(request) {
155
+ return await request.execute(this._client);
156
+ }
157
+
158
+ /**
159
+ * @returns {void}
160
+ */
161
+ close() {
162
+ this._client.close();
163
+ }
164
+ }
165
+ exports.default = LocalProviderWeb;
@@ -0,0 +1,127 @@
1
+ /**
2
+ * @typedef {import("./Provider.js").Provider} Provider
3
+ * @typedef {import("./LedgerId.js").default} LedgerId
4
+ * @typedef {import("./Key.js").default} Key
5
+ * @typedef {import("./transaction/Transaction.js").default} Transaction
6
+ * @typedef {import("./transaction/TransactionId.js").default} TransactionId
7
+ * @typedef {import("./transaction/TransactionResponse.js").default} TransactionResponse
8
+ * @typedef {import("./transaction/TransactionReceipt.js").default} TransactionReceipt
9
+ * @typedef {import("./transaction/TransactionRecord.js").default} TransactionRecord
10
+ * @typedef {import("./account/AccountId.js").default} AccountId
11
+ * @typedef {import("./account/AccountBalance.js").default} AccountBalance
12
+ * @typedef {import("./account/AccountInfo.js").default} AccountInfo
13
+ * @typedef {import("./logger/Logger.js").default} Logger
14
+ */
15
+ /**
16
+ * @template {any} O
17
+ * @typedef {import("./query/Query.js").default<O>} Query<O>
18
+ */
19
+ /**
20
+ * @template RequestT
21
+ * @template ResponseT
22
+ * @template OutputT
23
+ * @typedef {import("./Executable.js").default<RequestT, ResponseT, OutputT>} Executable<RequestT, ResponseT, OutputT>
24
+ */
25
+ /**
26
+ * @implements {Provider}
27
+ */
28
+ export default class LocalProviderWeb implements Provider {
29
+ /**
30
+ * @param {Client} client
31
+ * @returns {LocalProviderWeb}
32
+ */
33
+ static fromClient(client: Client): LocalProviderWeb;
34
+ /**
35
+ * @param {object} props
36
+ * @param {Client} [props.client]
37
+ * @param {"mainnet" | "testnet" | "previewnet" | "local-node"} [props.networkName]
38
+ */
39
+ constructor(props?: {
40
+ client?: Client | undefined;
41
+ networkName?: "mainnet" | "testnet" | "previewnet" | "local-node" | undefined;
42
+ });
43
+ _client: Client;
44
+ /**
45
+ * @returns {LedgerId?}
46
+ */
47
+ getLedgerId(): LedgerId | null;
48
+ /**
49
+ * @returns {{[key: string]: (string | AccountId)}}
50
+ */
51
+ getNetwork(): {
52
+ [key: string]: (string | AccountId);
53
+ };
54
+ /**
55
+ * @returns {string[]}
56
+ */
57
+ getMirrorNetwork(): string[];
58
+ /**
59
+ * @param {AccountId | string} accountId
60
+ * @returns {Promise<AccountBalance>}
61
+ */
62
+ getAccountBalance(accountId: AccountId | string): Promise<AccountBalance>;
63
+ /**
64
+ * @param {AccountId | string} accountId
65
+ * @returns {Promise<AccountInfo>}
66
+ */
67
+ getAccountInfo(accountId: AccountId | string): Promise<AccountInfo>;
68
+ /**
69
+ * @param {AccountId | string} accountId
70
+ * @returns {Promise<TransactionRecord[]>}
71
+ */
72
+ getAccountRecords(accountId: AccountId | string): Promise<TransactionRecord[]>;
73
+ /**
74
+ * @param {TransactionId | string} transactionId
75
+ * @returns {Promise<TransactionReceipt>}
76
+ */
77
+ getTransactionReceipt(transactionId: TransactionId | string): Promise<TransactionReceipt>;
78
+ /**
79
+ * @param {Transaction} transaction
80
+ * @returns {Promise<TransactionResponse>}
81
+ */
82
+ sendTransaction(transaction: Transaction): Promise<TransactionResponse>;
83
+ /**
84
+ * @template O
85
+ * @param {Query<O>} query
86
+ * @returns {Promise<O>}
87
+ */
88
+ sendQuery<O>(query: Query<O>): Promise<O>;
89
+ /**
90
+ * @param {TransactionResponse} response
91
+ * @returns {Promise<TransactionReceipt>}
92
+ */
93
+ waitForReceipt(response: TransactionResponse): Promise<TransactionReceipt>;
94
+ /**
95
+ * @template RequestT
96
+ * @template ResponseT
97
+ * @template OutputT
98
+ * @param {Executable<RequestT, ResponseT, OutputT>} request
99
+ * @returns {Promise<OutputT>}
100
+ */
101
+ call<RequestT, ResponseT, OutputT>(request: Executable<RequestT, ResponseT, OutputT>): Promise<OutputT>;
102
+ /**
103
+ * @returns {void}
104
+ */
105
+ close(): void;
106
+ }
107
+ export type Provider = import("./Provider.js").Provider;
108
+ export type LedgerId = import("./LedgerId.js").default;
109
+ export type Key = import("./Key.js").default;
110
+ export type Transaction = import("./transaction/Transaction.js").default;
111
+ export type TransactionId = import("./transaction/TransactionId.js").default;
112
+ export type TransactionResponse = import("./transaction/TransactionResponse.js").default;
113
+ export type TransactionReceipt = import("./transaction/TransactionReceipt.js").default;
114
+ export type TransactionRecord = import("./transaction/TransactionRecord.js").default;
115
+ export type AccountId = import("./account/AccountId.js").default;
116
+ export type AccountBalance = import("./account/AccountBalance.js").default;
117
+ export type AccountInfo = import("./account/AccountInfo.js").default;
118
+ export type Logger = import("./logger/Logger.js").default;
119
+ /**
120
+ * <O>
121
+ */
122
+ export type Query<O extends unknown> = import("./query/Query.js").default<O>;
123
+ /**
124
+ * <RequestT, ResponseT, OutputT>
125
+ */
126
+ export type Executable<RequestT, ResponseT, OutputT> = import("./Executable.js").default<RequestT, ResponseT, OutputT>;
127
+ import Client from "./client/WebClient.js";