@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":"NodeUpdateTransaction.js","sources":["../../src/node/NodeUpdateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"../account/AccountId.js\";\nimport Key from \"../Key.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport ServiceEndpoint from \"./ServiceEndpoint.js\";\n\nconst DESCRIPTION_MAX_LENGTH = 100;\nconst GOSSIP_ENDPOINTS_MAX_LENGTH = 10;\nconst SERVICE_ENDPOINTS_MAX_LENGTH = 8;\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} ITransactionResponse\n */\n\n/**\n * @namespace com.hedera.hapi.node.addressbook\n * @typedef {import(\"@hashgraph/proto\").com.hedera.hapi.node.addressbook.INodeUpdateTransactionBody} INodeUpdateTransactionBody\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @description A transaction to update a consensus node in the network.\n */\nexport default class NodeUpdateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {Long} [props.nodeId]\n * @param {AccountId} [props.accountId]\n * @param {?string} [props.description]\n * @param {Array<ServiceEndpoint>} [props.gossipEndpoints]\n * @param {?Array<ServiceEndpoint>} [props.serviceEndpoints]\n * @param {?Uint8Array} [props.gossipCaCertificate]\n * @param {?Uint8Array} [props.grpcCertificateHash]\n * @param {ServiceEndpoint} [props.grpcWebProxyEndpoint]\n * @param {Key} [props.adminKey]\n * @param {boolean} [props.declineReward]\n */\n constructor(props) {\n super();\n\n /**\n * @private\n * @type {?Long}\n * @description A consensus node identifier in the network state. It's required.\n */\n this._nodeId = props?.nodeId != null ? props.nodeId : null;\n\n /**\n * @private\n * @type {?AccountId}\n * @description Desired new account identifier of the node.\n */\n this._accountId = props?.accountId != null ? props.accountId : null;\n\n /**\n * @private\n * @type {?string}\n * @description Short description of the node. If set, this value SHALL replace the previous value.\n */\n this._description =\n props?.description != null ? props.description : null;\n\n /**\n * @private\n * @type {?Array<ServiceEndpoint>}\n * @description List of service endpoints for gossip.\n */\n this._gossipEndpoints =\n props?.gossipEndpoints != null ? props.gossipEndpoints : null;\n\n /**\n * @private\n * @type {?Array<ServiceEndpoint>}\n * @description List of service endpoints for gRPC calls.\n */\n this._serviceEndpoints =\n props?.serviceEndpoints != null ? props.serviceEndpoints : null;\n\n /**\n * @private\n * @type {?Uint8Array}\n * @description Certificate used to sign gossip events.\n */\n this._gossipCaCertificate =\n props?.gossipCaCertificate != null\n ? props.gossipCaCertificate\n : null;\n\n /**\n * @private\n * @type {?Uint8Array}\n * @description Hash of the node gRPC TLS certificate.\n */\n this._grpcCertificateHash =\n props?.grpcCertificateHash != null\n ? props.grpcCertificateHash\n : null;\n\n /**\n * @private\n * @type {?ServiceEndpoint}\n * @description Proxy endpoint for gRPC web calls.\n */\n this._grpcWebProxyEndpoint = props?.grpcWebProxyEndpoint || null;\n\n /**\n * @private\n * @type {?Key}\n * @description Administrative key controlled by the node operator.\n */\n this._adminKey = props?.adminKey != null ? props.adminKey : null;\n\n /**\n * @private\n * @type {?boolean}\n * @description Whether the node declines rewards.\n */\n this._declineReward =\n props?.declineReward != null ? props.declineReward : null;\n }\n\n /**\n * @internal\n * @param {ITransaction[]} transactions\n * @param {ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {ITransactionBody[]} bodies\n * @returns {NodeUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const nodeUpdate = /** @type {INodeUpdateTransactionBody} */ (\n body.nodeUpdate\n );\n\n return Transaction._fromProtobufTransactions(\n new NodeUpdateTransaction({\n nodeId:\n nodeUpdate.nodeId != null ? nodeUpdate.nodeId : undefined,\n accountId:\n nodeUpdate.accountId != null\n ? AccountId._fromProtobuf(nodeUpdate.accountId)\n : undefined,\n description:\n nodeUpdate.description != null\n ? Object.hasOwn(nodeUpdate.description, \"value\")\n ? nodeUpdate.description.value\n : undefined\n : undefined,\n gossipEndpoints:\n nodeUpdate.gossipEndpoint != null\n ? nodeUpdate.gossipEndpoint.map((endpoint) =>\n ServiceEndpoint._fromProtobuf(endpoint),\n )\n : undefined,\n serviceEndpoints:\n nodeUpdate.serviceEndpoint != null\n ? nodeUpdate.serviceEndpoint.map((endpoint) =>\n ServiceEndpoint._fromProtobuf(endpoint),\n )\n : undefined,\n gossipCaCertificate:\n nodeUpdate.gossipCaCertificate != null\n ? Object.hasOwn(nodeUpdate.gossipCaCertificate, \"value\")\n ? nodeUpdate.gossipCaCertificate.value\n : undefined\n : undefined,\n grpcCertificateHash:\n nodeUpdate.grpcCertificateHash != null\n ? Object.hasOwn(nodeUpdate.grpcCertificateHash, \"value\")\n ? nodeUpdate.grpcCertificateHash.value\n : undefined\n : undefined,\n grpcWebProxyEndpoint:\n nodeUpdate.grpcProxyEndpoint != null\n ? ServiceEndpoint._fromProtobuf(\n nodeUpdate.grpcProxyEndpoint,\n )\n : undefined,\n adminKey:\n nodeUpdate.adminKey != null\n ? Key._fromProtobufKey(nodeUpdate.adminKey)\n : undefined,\n declineReward:\n nodeUpdate.declineReward?.value != null\n ? nodeUpdate.declineReward.value\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @param {Long} nodeId\n * @description Set consensus node identifier in the network state.\n * @returns {NodeUpdateTransaction}\n */\n setNodeId(nodeId) {\n this._requireNotFrozen();\n this._nodeId = nodeId;\n\n return this;\n }\n\n /**\n * @description Get consensus node identifier in the network state.\n * @returns {?Long}\n */\n get nodeId() {\n return this._nodeId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @description Set desired new account identifier of the node.\n * @returns {NodeUpdateTransaction}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n accountId instanceof AccountId\n ? accountId\n : AccountId.fromString(accountId);\n\n return this;\n }\n\n /**\n * @description Get desired new account identifier of the node.\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {string} description\n * @description Set description of the node.\n * @returns {NodeUpdateTransaction}\n */\n setDescription(description) {\n this._requireNotFrozen();\n if (description.length > DESCRIPTION_MAX_LENGTH) {\n throw new Error(\n `Description must be at most ${DESCRIPTION_MAX_LENGTH} characters.`,\n );\n }\n this._description = description;\n\n return this;\n }\n\n /**\n * @description Clear description of the node.\n * @returns {void}\n */\n clearDescription() {\n this._description = \"\";\n }\n\n /**\n * @description Get description of the node.\n * @returns {?string}\n */\n get description() {\n return this._description;\n }\n\n /**\n * @param {ServiceEndpoint[]} gossipEndpoints\n * @description Set list of service endpoints for gossip.\n * @returns {NodeUpdateTransaction}\n */\n setGossipEndpoints(gossipEndpoints) {\n this._requireNotFrozen();\n if (gossipEndpoints.length == 0) {\n throw new Error(\"GossipEndpoints list must not be empty.\");\n }\n\n if (gossipEndpoints.length > GOSSIP_ENDPOINTS_MAX_LENGTH) {\n throw new Error(\n `GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`,\n );\n }\n\n this._gossipEndpoints = [...gossipEndpoints];\n\n return this;\n }\n\n /**\n * @description Get list of service endpoints for gossip.\n * @returns {?Array<ServiceEndpoint>}\n */\n get gossipEndpoints() {\n return this._gossipEndpoints;\n }\n\n /**\n * @param {ServiceEndpoint} endpoint\n * @description Add an endpoint to the list of service endpoints for gossip.\n * @returns {NodeUpdateTransaction}\n */\n addGossipEndpoint(endpoint) {\n this._requireNotFrozen();\n if (this._gossipEndpoints != null) {\n this._gossipEndpoints.push(endpoint);\n }\n return this;\n }\n\n /**\n * @param {ServiceEndpoint[]} serviceEndpoints\n * @description Set list of service endpoints for gRPC calls.\n * @returns {NodeUpdateTransaction}\n */\n setServiceEndpoints(serviceEndpoints) {\n this._requireNotFrozen();\n if (serviceEndpoints.length == 0) {\n throw new Error(\"ServiceEndpoints list must not be empty.\");\n }\n\n if (serviceEndpoints.length > SERVICE_ENDPOINTS_MAX_LENGTH) {\n throw new Error(\n `ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH} entries.`,\n );\n }\n\n this._serviceEndpoints = [...serviceEndpoints];\n\n return this;\n }\n\n /**\n * @description Get list of service endpoints for gRPC calls.\n * @returns {?Array<ServiceEndpoint>}\n */\n get serviceEndpoints() {\n return this._serviceEndpoints;\n }\n\n /**\n * @param {ServiceEndpoint} endpoint\n * @description Add an endpoint to the list of service endpoints for gRPC calls.\n * @returns {NodeUpdateTransaction}\n */\n addServiceEndpoint(endpoint) {\n this._requireNotFrozen();\n if (this._serviceEndpoints != null) {\n this._serviceEndpoints.push(endpoint);\n }\n return this;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @description Set certificate used to sign gossip events.\n * @returns {NodeUpdateTransaction}\n */\n setGossipCaCertificate(bytes) {\n this._requireNotFrozen();\n if (bytes.length == 0) {\n throw new Error(\"GossipCaCertificate must not be empty.\");\n }\n\n this._gossipCaCertificate = bytes;\n\n return this;\n }\n\n /**\n * @description Get certificate used to sign gossip events.\n * @returns {?Uint8Array}\n */\n get gossipCaCertificate() {\n return this._gossipCaCertificate;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @description Set hash of the node gRPC TLS certificate.\n * @returns {NodeUpdateTransaction}\n */\n setCertificateHash(bytes) {\n this._requireNotFrozen();\n this._grpcCertificateHash = bytes;\n\n return this;\n }\n\n /**\n * @description Get hash of the node gRPC TLS certificate.\n * @returns {?Uint8Array}\n */\n get certificateHash() {\n return this._grpcCertificateHash;\n }\n\n /**\n * @param {ServiceEndpoint} endpoint\n * @description Set proxy endpoint for gRPC web calls.\n * @returns {NodeUpdateTransaction}\n */\n setGrpcWebProxyEndpoint(endpoint) {\n this._requireNotFrozen();\n this._grpcWebProxyEndpoint = endpoint;\n return this;\n }\n\n /**\n * @description Get proxy endpoint for gRPC web calls.\n * @returns {?ServiceEndpoint}\n */\n get grpcWebProxyEndpoint() {\n return this._grpcWebProxyEndpoint;\n }\n\n /**\n * @param {Key} adminKey\n * @description Set administrative key controlled by the node operator.\n * @returns {NodeUpdateTransaction}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @description Get administrative key controlled by the node operator.\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {boolean} declineReward\n * @description Set whether the node declines rewards.\n * @returns {NodeUpdateTransaction}\n */\n setDeclineReward(declineReward) {\n this._requireNotFrozen();\n this._declineReward = declineReward;\n return this;\n }\n\n /**\n * @description Get whether the node declines rewards.\n * @returns {?boolean}\n */\n get declineReward() {\n return this._declineReward;\n }\n\n /**\n * @description Deletes the gRPC proxy endpoint and sets it to null in the mirror node, effectively removing it from the network state.\n * @returns {NodeUpdateTransaction}\n */\n deleteGrpcWebProxyEndpoint() {\n this._grpcWebProxyEndpoint = new ServiceEndpoint();\n return this;\n }\n\n /**\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n freezeWith(client) {\n if (this.nodeId == null) {\n throw new Error(\n \"NodeUpdateTransaction: 'nodeId' must be explicitly set before calling freeze().\",\n );\n }\n\n return super.freezeWith(client);\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {ITransaction} request\n * @returns {Promise<ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.addressBook.updateNode(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"nodeUpdate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {INodeUpdateTransactionBody}\n */\n _makeTransactionData() {\n return {\n accountId:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n description: {\n value: this._description != null ? this._description : null,\n },\n gossipEndpoint:\n this._gossipEndpoints != null\n ? this._gossipEndpoints.map(\n (/** @type {ServiceEndpoint} */ endpoint) =>\n endpoint._toProtobuf(),\n )\n : null,\n serviceEndpoint:\n this._serviceEndpoints != null\n ? this._serviceEndpoints.map(\n (/** @type {ServiceEndpoint} */ endpoint) =>\n endpoint._toProtobuf(),\n )\n : null,\n gossipCaCertificate:\n this._gossipCaCertificate != null\n ? {\n value: this._gossipCaCertificate,\n }\n : null,\n grpcCertificateHash:\n this._grpcCertificateHash != null\n ? {\n value: this._grpcCertificateHash,\n }\n : null,\n grpcProxyEndpoint:\n this._grpcWebProxyEndpoint != null\n ? this._grpcWebProxyEndpoint._toProtobuf()\n : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n nodeId: this._nodeId != null ? this._nodeId : null,\n declineReward:\n this._declineReward != null\n ? { value: this._declineReward }\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `NodeUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"nodeUpdate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n NodeUpdateTransaction._fromProtobuf,\n);\n"],"names":["NodeUpdateTransaction","Transaction","constructor","props","super","this","_nodeId","nodeId","_accountId","accountId","_description","description","_gossipEndpoints","gossipEndpoints","_serviceEndpoints","serviceEndpoints","_gossipCaCertificate","gossipCaCertificate","_grpcCertificateHash","grpcCertificateHash","_grpcWebProxyEndpoint","grpcWebProxyEndpoint","_adminKey","adminKey","_declineReward","declineReward","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","nodeUpdate","_fromProtobufTransactions","undefined","AccountId","Object","hasOwn","value","gossipEndpoint","map","endpoint","ServiceEndpoint","serviceEndpoint","grpcProxyEndpoint","Key","_fromProtobufKey","setNodeId","_requireNotFrozen","setAccountId","fromString","setDescription","length","Error","clearDescription","setGossipEndpoints","addGossipEndpoint","push","setServiceEndpoints","addServiceEndpoint","setGossipCaCertificate","bytes","setCertificateHash","certificateHash","setGrpcWebProxyEndpoint","setAdminKey","setDeclineReward","deleteGrpcWebProxyEndpoint","freezeWith","client","_execute","channel","request","addressBook","updateNode","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_toProtobufKey","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"4KAoCe,MAAMA,UAA8BC,EAc/C,WAAAC,CAAYC,GACRC,QAOAC,KAAKC,QAA2B,MAAjBH,GAAOI,OAAiBJ,EAAMI,OAAS,KAOtDF,KAAKG,WAAiC,MAApBL,GAAOM,UAAoBN,EAAMM,UAAY,KAO/DJ,KAAKK,aACqB,MAAtBP,GAAOQ,YAAsBR,EA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AKG,WAAWqE,cAAgB,KAC9DlE,YAAa,CACT2B,MAA4B,MAArBjC,KAAKK,aAAuBL,KAAKK,aAAe,MAE3D6B,eAC6B,MAAzBlC,KAAKO,iBACCP,KAAKO,iBAAiB4B,KACcC,GAC5BA,EAASoC,gBAEjB,KACVlC,gBAC8B,MAA1BtC,KAAKS,kBACCT,KAAKS,kBAAkB0B,KACaC,GAC5BA,EAASoC,gBAEjB,KACV5D,oBACiC,MAA7BZ,KAAKW,qBACC,CACIsB,MAAOjC,KAAKW,sBAEhB,KACVG,oBACiC,MAA7Bd,KAAKa,qBACC,CACIoB,MAAOjC,KAAKa,sBAEhB,KACV0B,kBACkC,MAA9BvC,KAAKe,sBACCf,KAAKe,sBAAsByD,cAC3B,KACVtD,SACsB,MAAlBlB,KAAKiB,UAAoBjB,KAAKiB,UAAUwD,iBAAmB,KAC/DvE,OAAwB,MAAhBF,KAAKC,QAAkBD,KAAKC,QAAU,KAC9CmB,cAC2B,MAAvBpB,KAAKmB,eACC,CAAEc,MAAOjC,KAAKmB,gBACd,KAEtB,CAKI,SAAAuD,GAII,MAAO,yBAFH1E,KAAK2E,gBAAgBC,QACxB,WACyCC,YAClD,EAGAC,EAAqBC,IACjB,aAEApF,EAAsB0B"}
1
+ {"version":3,"file":"NodeUpdateTransaction.js","sources":["../../src/node/NodeUpdateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"../account/AccountId.js\";\nimport Key from \"../Key.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport ServiceEndpoint from \"./ServiceEndpoint.js\";\nimport Long from \"long\";\n\nconst DESCRIPTION_MAX_LENGTH = 100;\nconst GOSSIP_ENDPOINTS_MAX_LENGTH = 10;\nconst SERVICE_ENDPOINTS_MAX_LENGTH = 8;\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} ITransactionResponse\n */\n\n/**\n * @namespace com.hedera.hapi.node.addressbook\n * @typedef {import(\"@hashgraph/proto\").com.hedera.hapi.node.addressbook.INodeUpdateTransactionBody} INodeUpdateTransactionBody\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @description A transaction to update a consensus node in the network.\n */\nexport default class NodeUpdateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {Long} [props.nodeId]\n * @param {AccountId} [props.accountId]\n * @param {?string} [props.description]\n * @param {Array<ServiceEndpoint>} [props.gossipEndpoints]\n * @param {?Array<ServiceEndpoint>} [props.serviceEndpoints]\n * @param {?Uint8Array} [props.gossipCaCertificate]\n * @param {?Uint8Array} [props.grpcCertificateHash]\n * @param {ServiceEndpoint} [props.grpcWebProxyEndpoint]\n * @param {Key} [props.adminKey]\n * @param {boolean} [props.declineReward]\n */\n constructor(props) {\n super();\n\n /**\n * @private\n * @type {?Long}\n * @description A consensus node identifier in the network state. It's required.\n */\n this._nodeId = props?.nodeId != null ? props.nodeId : null;\n\n /**\n * @private\n * @type {?AccountId}\n * @description Desired new account identifier of the node.\n */\n this._accountId = props?.accountId != null ? props.accountId : null;\n\n /**\n * @private\n * @type {?string}\n * @description Short description of the node. If set, this value SHALL replace the previous value.\n */\n this._description =\n props?.description != null ? props.description : null;\n\n /**\n * @private\n * @type {?Array<ServiceEndpoint>}\n * @description List of service endpoints for gossip.\n */\n this._gossipEndpoints =\n props?.gossipEndpoints != null ? props.gossipEndpoints : null;\n\n /**\n * @private\n * @type {?Array<ServiceEndpoint>}\n * @description List of service endpoints for gRPC calls.\n */\n this._serviceEndpoints =\n props?.serviceEndpoints != null ? props.serviceEndpoints : null;\n\n /**\n * @private\n * @type {?Uint8Array}\n * @description Certificate used to sign gossip events.\n */\n this._gossipCaCertificate =\n props?.gossipCaCertificate != null\n ? props.gossipCaCertificate\n : null;\n\n /**\n * @private\n * @type {?Uint8Array}\n * @description Hash of the node gRPC TLS certificate.\n */\n this._grpcCertificateHash =\n props?.grpcCertificateHash != null\n ? props.grpcCertificateHash\n : null;\n\n /**\n * @private\n * @type {?ServiceEndpoint}\n * @description Proxy endpoint for gRPC web calls.\n */\n this._grpcWebProxyEndpoint = props?.grpcWebProxyEndpoint || null;\n\n /**\n * @private\n * @type {?Key}\n * @description Administrative key controlled by the node operator.\n */\n this._adminKey = props?.adminKey != null ? props.adminKey : null;\n\n /**\n * @private\n * @type {?boolean}\n * @description Whether the node declines rewards.\n */\n this._declineReward =\n props?.declineReward != null ? props.declineReward : null;\n }\n\n /**\n * @internal\n * @param {ITransaction[]} transactions\n * @param {ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {ITransactionBody[]} bodies\n * @returns {NodeUpdateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const nodeUpdate = /** @type {INodeUpdateTransactionBody} */ (\n body.nodeUpdate\n );\n\n return Transaction._fromProtobufTransactions(\n new NodeUpdateTransaction({\n nodeId:\n nodeUpdate.nodeId != null ? nodeUpdate.nodeId : undefined,\n accountId:\n nodeUpdate.accountId != null\n ? AccountId._fromProtobuf(nodeUpdate.accountId)\n : undefined,\n description:\n nodeUpdate.description != null\n ? Object.hasOwn(nodeUpdate.description, \"value\")\n ? nodeUpdate.description.value\n : undefined\n : undefined,\n gossipEndpoints:\n nodeUpdate.gossipEndpoint != null\n ? nodeUpdate.gossipEndpoint.map((endpoint) =>\n ServiceEndpoint._fromProtobuf(endpoint),\n )\n : undefined,\n serviceEndpoints:\n nodeUpdate.serviceEndpoint != null\n ? nodeUpdate.serviceEndpoint.map((endpoint) =>\n ServiceEndpoint._fromProtobuf(endpoint),\n )\n : undefined,\n gossipCaCertificate:\n nodeUpdate.gossipCaCertificate != null\n ? Object.hasOwn(nodeUpdate.gossipCaCertificate, \"value\")\n ? nodeUpdate.gossipCaCertificate.value\n : undefined\n : undefined,\n grpcCertificateHash:\n nodeUpdate.grpcCertificateHash != null\n ? Object.hasOwn(nodeUpdate.grpcCertificateHash, \"value\")\n ? nodeUpdate.grpcCertificateHash.value\n : undefined\n : undefined,\n grpcWebProxyEndpoint:\n nodeUpdate.grpcProxyEndpoint != null\n ? ServiceEndpoint._fromProtobuf(\n nodeUpdate.grpcProxyEndpoint,\n )\n : undefined,\n adminKey:\n nodeUpdate.adminKey != null\n ? Key._fromProtobufKey(nodeUpdate.adminKey)\n : undefined,\n declineReward:\n nodeUpdate.declineReward?.value != null\n ? nodeUpdate.declineReward.value\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @param {Long} nodeId\n * @description Set consensus node identifier in the network state.\n * @returns {NodeUpdateTransaction}\n */\n setNodeId(nodeId) {\n this._requireNotFrozen();\n\n if (nodeId == null) {\n this._nodeId = null;\n return this;\n }\n\n // Convert to Long if it's a plain number\n const longNodeId = Long.isLong(nodeId)\n ? nodeId\n : Long.fromValue(nodeId);\n\n if (longNodeId.toNumber() < 0) {\n throw new Error(\n \"NodeUpdateTransaction: 'nodeId' must be positive.\",\n );\n }\n\n this._nodeId = longNodeId;\n\n return this;\n }\n\n /**\n * @description Get consensus node identifier in the network state.\n * @returns {?Long}\n */\n get nodeId() {\n return this._nodeId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @description Set desired new account identifier of the node.\n * @returns {NodeUpdateTransaction}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n accountId instanceof AccountId\n ? accountId\n : AccountId.fromString(accountId);\n\n return this;\n }\n\n /**\n * @description Get desired new account identifier of the node.\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {string} description\n * @description Set description of the node.\n * @returns {NodeUpdateTransaction}\n */\n setDescription(description) {\n this._requireNotFrozen();\n if (description.length > DESCRIPTION_MAX_LENGTH) {\n throw new Error(\n `Description must be at most ${DESCRIPTION_MAX_LENGTH} characters.`,\n );\n }\n this._description = description;\n\n return this;\n }\n\n /**\n * @description Clear description of the node.\n * @returns {void}\n */\n clearDescription() {\n this._description = \"\";\n }\n\n /**\n * @description Get description of the node.\n * @returns {?string}\n */\n get description() {\n return this._description;\n }\n\n /**\n * @param {ServiceEndpoint[]} gossipEndpoints\n * @description Set list of service endpoints for gossip.\n * @returns {NodeUpdateTransaction}\n */\n setGossipEndpoints(gossipEndpoints) {\n this._requireNotFrozen();\n if (gossipEndpoints.length == 0) {\n throw new Error(\"GossipEndpoints list must not be empty.\");\n }\n\n if (gossipEndpoints.length > GOSSIP_ENDPOINTS_MAX_LENGTH) {\n throw new Error(\n `GossipEndpoints list must not contain more than ${GOSSIP_ENDPOINTS_MAX_LENGTH} entries.`,\n );\n }\n\n this._gossipEndpoints = [...gossipEndpoints];\n\n return this;\n }\n\n /**\n * @description Get list of service endpoints for gossip.\n * @returns {?Array<ServiceEndpoint>}\n */\n get gossipEndpoints() {\n return this._gossipEndpoints;\n }\n\n /**\n * @param {ServiceEndpoint} endpoint\n * @description Add an endpoint to the list of service endpoints for gossip.\n * @returns {NodeUpdateTransaction}\n */\n addGossipEndpoint(endpoint) {\n this._requireNotFrozen();\n if (this._gossipEndpoints != null) {\n this._gossipEndpoints.push(endpoint);\n }\n return this;\n }\n\n /**\n * @param {ServiceEndpoint[]} serviceEndpoints\n * @description Set list of service endpoints for gRPC calls.\n * @returns {NodeUpdateTransaction}\n */\n setServiceEndpoints(serviceEndpoints) {\n this._requireNotFrozen();\n if (serviceEndpoints.length == 0) {\n throw new Error(\"ServiceEndpoints list must not be empty.\");\n }\n\n if (serviceEndpoints.length > SERVICE_ENDPOINTS_MAX_LENGTH) {\n throw new Error(\n `ServiceEndpoints list must not contain more than ${SERVICE_ENDPOINTS_MAX_LENGTH} entries.`,\n );\n }\n\n this._serviceEndpoints = [...serviceEndpoints];\n\n return this;\n }\n\n /**\n * @description Get list of service endpoints for gRPC calls.\n * @returns {?Array<ServiceEndpoint>}\n */\n get serviceEndpoints() {\n return this._serviceEndpoints;\n }\n\n /**\n * @param {ServiceEndpoint} endpoint\n * @description Add an endpoint to the list of service endpoints for gRPC calls.\n * @returns {NodeUpdateTransaction}\n */\n addServiceEndpoint(endpoint) {\n this._requireNotFrozen();\n if (this._serviceEndpoints != null) {\n this._serviceEndpoints.push(endpoint);\n }\n return this;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @description Set certificate used to sign gossip events.\n * @returns {NodeUpdateTransaction}\n */\n setGossipCaCertificate(bytes) {\n this._requireNotFrozen();\n if (bytes.length == 0) {\n throw new Error(\"GossipCaCertificate must not be empty.\");\n }\n\n this._gossipCaCertificate = bytes;\n\n return this;\n }\n\n /**\n * @description Get certificate used to sign gossip events.\n * @returns {?Uint8Array}\n */\n get gossipCaCertificate() {\n return this._gossipCaCertificate;\n }\n\n /**\n * @param {Uint8Array} bytes\n * @description Set hash of the node gRPC TLS certificate.\n * @returns {NodeUpdateTransaction}\n */\n setCertificateHash(bytes) {\n this._requireNotFrozen();\n this._grpcCertificateHash = bytes;\n\n return this;\n }\n\n /**\n * @description Get hash of the node gRPC TLS certificate.\n * @returns {?Uint8Array}\n */\n get certificateHash() {\n return this._grpcCertificateHash;\n }\n\n /**\n * @param {ServiceEndpoint} endpoint\n * @description Set proxy endpoint for gRPC web calls.\n * @returns {NodeUpdateTransaction}\n */\n setGrpcWebProxyEndpoint(endpoint) {\n this._requireNotFrozen();\n this._grpcWebProxyEndpoint = endpoint;\n return this;\n }\n\n /**\n * @description Get proxy endpoint for gRPC web calls.\n * @returns {?ServiceEndpoint}\n */\n get grpcWebProxyEndpoint() {\n return this._grpcWebProxyEndpoint;\n }\n\n /**\n * @param {Key} adminKey\n * @description Set administrative key controlled by the node operator.\n * @returns {NodeUpdateTransaction}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @description Get administrative key controlled by the node operator.\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {boolean} declineReward\n * @description Set whether the node declines rewards.\n * @returns {NodeUpdateTransaction}\n */\n setDeclineReward(declineReward) {\n this._requireNotFrozen();\n this._declineReward = declineReward;\n return this;\n }\n\n /**\n * @description Get whether the node declines rewards.\n * @returns {?boolean}\n */\n get declineReward() {\n return this._declineReward;\n }\n\n /**\n * @description Deletes the gRPC proxy endpoint and sets it to null in the mirror node, effectively removing it from the network state.\n * @returns {NodeUpdateTransaction}\n */\n deleteGrpcWebProxyEndpoint() {\n this._grpcWebProxyEndpoint = new ServiceEndpoint();\n return this;\n }\n\n /**\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n freezeWith(client) {\n if (this.nodeId == null) {\n throw new Error(\n \"NodeUpdateTransaction: 'nodeId' must be explicitly set before calling freeze().\",\n );\n }\n\n return super.freezeWith(client);\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {ITransaction} request\n * @returns {Promise<ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.addressBook.updateNode(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"nodeUpdate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {INodeUpdateTransactionBody}\n */\n _makeTransactionData() {\n return {\n accountId:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n description: {\n value: this._description != null ? this._description : null,\n },\n gossipEndpoint:\n this._gossipEndpoints != null\n ? this._gossipEndpoints.map(\n (/** @type {ServiceEndpoint} */ endpoint) =>\n endpoint._toProtobuf(),\n )\n : null,\n serviceEndpoint:\n this._serviceEndpoints != null\n ? this._serviceEndpoints.map(\n (/** @type {ServiceEndpoint} */ endpoint) =>\n endpoint._toProtobuf(),\n )\n : null,\n gossipCaCertificate:\n this._gossipCaCertificate != null\n ? {\n value: this._gossipCaCertificate,\n }\n : null,\n grpcCertificateHash:\n this._grpcCertificateHash != null\n ? {\n value: this._grpcCertificateHash,\n }\n : null,\n grpcProxyEndpoint:\n this._grpcWebProxyEndpoint != null\n ? this._grpcWebProxyEndpoint._toProtobuf()\n : null,\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n nodeId: this._nodeId != null ? this._nodeId : null,\n declineReward:\n this._declineReward != null\n ? { value: this._declineReward }\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `NodeUpdateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"nodeUpdate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n NodeUpdateTransaction._fromProtobuf,\n);\n"],"names":["NodeUpdateTransaction","Transaction","constructor","props","super","this","_nodeId","nodeId","_accountId","accountId","_description","description","_gossipEndpoints","gossipEndpoints","_serviceEndpoints","serviceEndpoints","_gossipCaCertificate","gossipCaCertificate","_grpcCertificateHash","grpcCertificateHash","_grpcWebProxyEndpoint","grpcWebProxyEndpoint","_adminKey","adminKey","_declineReward","declineReward","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","nodeUpdate","_fromProtobufTransactions","undefined","AccountId","Object","hasOwn","value","gossipEndpoint","map","endpoint","ServiceEndpoint","serviceEndpoint","grpcProxyEndpoint","Key","_fromProtobufKey","setNodeId","_requireNotFrozen","longNodeId","Long","isLong","fromValue","toNumber","Error","setAccountId","fromString","setDescription","length","clearDescription","setGossipEndpoints","addGossipEndpoint","push","setServiceEndpoints","addServiceEndpoint","setGossipCaCertificate","bytes","setCertificateHash","certificateHash","setGrpcWebProxyEndpoint","setAdminKey","setDeclineReward","deleteGrpcWebProxyEndpoint","freezeWith","client","_execute","channel","request","addressBook","updateNode","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_toProtobufKey","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"gMAqCe,MAAMA,UAA8BC,EAc/C,WAAAC,CAAYC,GACRC,QAOAC,KAAKC,QAA2B,MAAjBH,GAAOI,OAAiBJ,EAAMI,OAAS,KAOtDF,KAAKG,WAAiC,MAApBL,GAAOM,UAAoBN,EAAMM,UAAY,KAO/DJ,KAAKK,aACqB,MAAtBP,GAAOQ,YAAsBR,EAAMQ,YAAc,KAOrDN,KAAKO,iBACyB,MAA1BT,GAAOU,gBAA0BV,EAAMU,gBAAkB,KAO7DR,KAAKS,kBAC0B,MAA3BX,GAAOY,iBAA2BZ,EAAMY,iBAAmB,KAO/DV,KAAKW,qBAC6B,MAA9Bb,GAAOc,oBACDd,EAAMc,oBACN,KAOVZ,KAAKa,qBAC6B,MAA9Bf,GAAOgB,oBACDhB,EAAMgB,oBACN,KAOVd,KAAKe,sBAAwBjB,GAAOkB,sBAAwB,KAO5DhB,KAAKiB,UAA+B,MAAnBnB,GAAOoB,SAAmBpB,EAAMoB,SAAW,KAO5DlB,KAAKmB,eACuB,MAAxBrB,GAAOsB,cAAwBtB,EAAMsB,cAAgB,IACjE,CAWI,oBAAOC,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAGnB,WAED,OAAO9B,EAAYgC,0BACf,IAAIjC,EAAsB,CACtBO,OACyB,MAArByB,EAAWzB,OAAiByB,EAAWzB,YAAS2B,EACpDzB,UAC4B,MAAxBuB,EAAWvB,UACL0B,EAAUT,cAAcM,EAAWvB,gBACnCyB,EACVvB,YAC8B,MAA1BqB,EAAWrB,aACLyB,OAAOC,OAAOL,EAAWrB,YAAa,SAClCqB,EAAW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cAC2B,MAAvBpB,KAAKmB,eACC,CAAEc,MAAOjC,KAAKmB,gBACd,KAEtB,CAKI,SAAA4D,GAII,MAAO,yBAFH/E,KAAKgF,gBAAgBC,QACxB,WACyCC,YAClD,EAGAC,EAAqBC,IACjB,aAEAzF,EAAsB0B"}
@@ -9,8 +9,7 @@ var _Hbar = _interopRequireDefault(require("../Hbar.cjs"));
9
9
  var _AccountId = _interopRequireDefault(require("../account/AccountId.cjs"));
10
10
  var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
11
11
  var _QueryBase = _interopRequireDefault(require("./QueryBase.cjs"));
12
- 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); }
13
- 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; }
12
+ 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); }
14
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
14
  // SPDX-License-Identifier: Apache-2.0
16
15
 
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _MirrorNodeContractQuery = _interopRequireDefault(require("./MirrorNodeContractQuery.cjs"));
8
8
  var hex = _interopRequireWildcard(require("../encoding/hex.cjs"));
9
- 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); }
10
- 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; }
9
+ 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); }
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  /**
13
12
  * @typedef {import("../channel/Channel.js").default} Channel
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _MirrorNodeContractQuery = _interopRequireDefault(require("./MirrorNodeContractQuery.cjs"));
8
8
  var hex = _interopRequireWildcard(require("../encoding/hex.cjs"));
9
- 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); }
10
- 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; }
9
+ 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); }
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
11
  /**
13
12
  * @typedef {import("../channel/Channel.js").default} Channel
@@ -222,7 +222,8 @@ class MirrorNodeContractQuery {
222
222
  let mirrorNetworkAddress = client.mirrorNetwork[0];
223
223
  const contractCallEndpoint = "/api/v1/contracts/call";
224
224
  if (!client.ledgerId || client.ledgerId?.isLocalNode()) {
225
- mirrorNetworkAddress = "http://".concat(client.mirrorNetwork[0].replace("5600", "8545")).concat(contractCallEndpoint);
225
+ const currentMirrorNetworkPort = client.mirrorNetwork[0].split(":")[1];
226
+ mirrorNetworkAddress = "http://".concat(client.mirrorNetwork[0].replace(currentMirrorNetworkPort, "8545")).concat(contractCallEndpoint);
226
227
  } else {
227
228
  let trimmed = client.mirrorNetwork[0].split(":");
228
229
  mirrorNetworkAddress = "https://".concat(trimmed[0]).concat(contractCallEndpoint);
@@ -1,2 +1,2 @@
1
- import t from"../contract/ContractFunctionParameters.js";class e{constructor(){this._contractId=null,this._contractEvmAddress=null,this._sender=null,this._senderEvmAddress=null,this._functionName=null,this._functionParameters=null,this._value=null,this._gasLimit=null,this._gasPrice=null,this._blockNumber=null}setContractId(t){return this._contractId=t,this}setSender(t){return this._sender=t,this}setSenderEvmAddress(t){return this._senderEvmAddress=t,this}setFunction(e,r){return this._functionParameters=null!=r?r._build(e):(new t)._build(e),this}setValue(t){return this._value=t,this}setGasLimit(t){return this._gasLimit=t,this}setGasPrice(t){return this._gasPrice=t,this}setBlockNumber(t){return this._blockNumber=t,this}get contractId(){return this._contractId}get contractEvmAddress(){const t=this._contractId?.toEvmAddress();if(null==t)throw new Error("Contract ID is not set");return t}get sender(){return this._sender}get senderEvmAddress(){return this._senderEvmAddress}get callData(){return this._functionParameters}get value(){return this._value}get gasLimit(){return this._gasLimit}get gasPrice(){return this._gasPrice}get blockNumber(){return this._blockNumber}async performMirrorNodeRequest(t,e){if(null==this.contractId)throw new Error("Contract ID is not set");this._fillEvmAddress();let r=t.mirrorNetwork[0];const s="/api/v1/contracts/call";if(!t.ledgerId||t.ledgerId?.isLocalNode())r="http://".concat(t.mirrorNetwork[0].replace("5600","8545")).concat(s);else{let e=t.mirrorNetwork[0].split(":");r="https://".concat(e[0]).concat(s)}const n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}_fillEvmAddress(){null==this.senderEvmAddress&&null!=this.sender&&(this._senderEvmAddress=this.sender.toEvmAddress())}get JSONPayload(){throw new Error("JSONPayload getter is not implemented. Please implement this method in the subclass.")}}export{e as default};
1
+ import t from"../contract/ContractFunctionParameters.js";class e{constructor(){this._contractId=null,this._contractEvmAddress=null,this._sender=null,this._senderEvmAddress=null,this._functionName=null,this._functionParameters=null,this._value=null,this._gasLimit=null,this._gasPrice=null,this._blockNumber=null}setContractId(t){return this._contractId=t,this}setSender(t){return this._sender=t,this}setSenderEvmAddress(t){return this._senderEvmAddress=t,this}setFunction(e,r){return this._functionParameters=null!=r?r._build(e):(new t)._build(e),this}setValue(t){return this._value=t,this}setGasLimit(t){return this._gasLimit=t,this}setGasPrice(t){return this._gasPrice=t,this}setBlockNumber(t){return this._blockNumber=t,this}get contractId(){return this._contractId}get contractEvmAddress(){const t=this._contractId?.toEvmAddress();if(null==t)throw new Error("Contract ID is not set");return t}get sender(){return this._sender}get senderEvmAddress(){return this._senderEvmAddress}get callData(){return this._functionParameters}get value(){return this._value}get gasLimit(){return this._gasLimit}get gasPrice(){return this._gasPrice}get blockNumber(){return this._blockNumber}async performMirrorNodeRequest(t,e){if(null==this.contractId)throw new Error("Contract ID is not set");this._fillEvmAddress();let r=t.mirrorNetwork[0];const s="/api/v1/contracts/call";if(!t.ledgerId||t.ledgerId?.isLocalNode()){const e=t.mirrorNetwork[0].split(":")[1];r="http://".concat(t.mirrorNetwork[0].replace(e,"8545")).concat(s)}else{let e=t.mirrorNetwork[0].split(":");r="https://".concat(e[0]).concat(s)}const n=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return await n.json()}_fillEvmAddress(){null==this.senderEvmAddress&&null!=this.sender&&(this._senderEvmAddress=this.sender.toEvmAddress())}get JSONPayload(){throw new Error("JSONPayload getter is not implemented. Please implement this method in the subclass.")}}export{e as default};
2
2
  //# sourceMappingURL=MirrorNodeContractQuery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MirrorNodeContractQuery.js","sources":["../../src/query/MirrorNodeContractQuery.js"],"sourcesContent":["import ContractFunctionParameters from \"../contract/ContractFunctionParameters.js\";\n\n/**\n * @typedef {import(\"../contract/ContractId\").default} ContractId\n * @typedef {import(\"../account/AccountId\").default} AccountId\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n *\n */\n\n/**\n * @typedef {object} MirrorNodeResponse\n * @property {string} result\n * @property {string} [error]\n * @property {string} [gasUsed]\n * @property {string} [contractAddress]\n * @property {string} [status]\n */\n\n/**\n * MirrorNodeContractQuery returns a result from EVM execution such as cost-free execution of read-only smart contract\n * queries, gas estimation, and transient simulation of read-write operations.\n * When working with sender that has ECDSA key with alias, you MUST:\n * 1. Retrieve the account's EVM address from the Mirror Node API first\n * 2. Use setSenderEvmAddress() instead of setSender()\n *\n * This is because EVM addresses for accounts with ECDSA keys and aliases cannot be automatically\n * derived and must be fetched from the Mirror Node. Example:\n *\n * ```javascript\n * // For accounts with ECDSA keys and aliases:\n * const evmAddress = // ... fetch from Mirror Node API ...\n * query.setSenderEvmAddress(evmAddress);\n * ```\n */\nexport default class MirrorNodeContractQuery {\n constructor() {\n this._contractId = null;\n this._contractEvmAddress = null;\n this._sender = null;\n this._senderEvmAddress = null;\n this._functionName = null;\n this._functionParameters = null;\n this._value = null;\n this._gasLimit = null;\n this._gasPrice = null;\n this._blockNumber = null;\n }\n\n /**\n *\n * @param {ContractId} contractId\n * @description Sets the contract instance to call.\n * @returns {this}\n */\n setContractId(contractId) {\n this._contractId = contractId;\n return this;\n }\n\n /**\n * @param {AccountId} sender\n * @description Sets the sender of the transaction simulation.\n * @returns {this}\n */\n setSender(sender) {\n this._sender = sender;\n return this;\n }\n\n /**\n * @param {string} sender\n * @description Set the 20-byte EVM address of the sender.\n * This method must be used explicitly when working with accounts that have ECDSA keys with aliases,\n * as their EVM addresses cannot be automatically derived and must be retrieved from the Mirror Node API.\n * The EVM address can be filled using `accountId.populateAccountEvmAddress(client)`\n * @returns {this}\n */\n setSenderEvmAddress(sender) {\n this._senderEvmAddress = sender;\n return this;\n }\n\n /**\n *\n * @param {string} name\n * @param {ContractFunctionParameters} functionParameters\n * @description Sets the function to call, and the parameters to pass to the function\n * @returns {this}\n */\n setFunction(name, functionParameters) {\n this._functionParameters =\n functionParameters != null\n ? functionParameters._build(name)\n : new ContractFunctionParameters()._build(name);\n\n return this;\n }\n\n /**\n * @param {Long} value\n * @description Sets the amount of value (in tinybars or wei) to be sent to the contract in the transaction.\n * Use this to specify an amount for a payable function call.\n * @returns {this}\n */\n setValue(value) {\n this._value = value;\n return this;\n }\n\n /**\n * @param {Long} gasLimit\n * @description Sets the gas limit for the contract call.\n * This specifies the maximum amount of gas that the transaction can consume.\n * @returns {this}\n */\n setGasLimit(gasLimit) {\n this._gasLimit = gasLimit;\n return this;\n }\n\n /**\n * @param {Long} gasPrice\n * @description Sets the gas price to be used for the contract call. This specifies the price of each unit of gas used in the transaction.\n * @returns {this}\n */\n setGasPrice(gasPrice) {\n this._gasPrice = gasPrice;\n return this;\n }\n\n /**\n * @param {Long} blockNumber\n * @description Sets the block number for the simulation of the contract call.\n * The block number determines the context of the contract call simulation within the blockchain.\n * @returns {this}\n */\n setBlockNumber(blockNumber) {\n this._blockNumber = blockNumber;\n return this;\n }\n\n /**\n * @returns {ContractId?}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * @returns {string}\n */\n get contractEvmAddress() {\n const solidityAddress = this._contractId?.toEvmAddress();\n if (solidityAddress == null) {\n throw new Error(\"Contract ID is not set\");\n }\n return solidityAddress;\n }\n\n /**\n * @returns {AccountId?}\n */\n get sender() {\n return this._sender;\n }\n\n /**\n * @returns {string | null }\n */\n get senderEvmAddress() {\n return this._senderEvmAddress;\n }\n\n /**\n * @returns {Uint8Array | null | undefined}\n */\n get callData() {\n return this._functionParameters;\n }\n\n /**\n * @returns {Long?}\n */\n get value() {\n return this._value;\n }\n\n /**\n * @returns {Long?}\n */\n get gasLimit() {\n return this._gasLimit;\n }\n\n /**\n * @returns {Long?}\n */\n get gasPrice() {\n return this._gasPrice;\n }\n\n /**\n * @returns {Long?}\n */\n get blockNumber() {\n return this._blockNumber;\n }\n\n /**\n *\n * @param {Client} client\n * @param {object} jsonPayload\n * @returns {Promise<MirrorNodeResponse>}\n */\n async performMirrorNodeRequest(client, jsonPayload) {\n if (this.contractId == null) {\n throw new Error(\"Contract ID is not set\");\n }\n this._fillEvmAddress();\n let mirrorNetworkAddress = client.mirrorNetwork[0];\n const contractCallEndpoint = \"/api/v1/contracts/call\";\n\n if (!client.ledgerId || client.ledgerId?.isLocalNode()) {\n mirrorNetworkAddress = \"http://\"\n .concat(client.mirrorNetwork[0].replace(\"5600\", \"8545\"))\n .concat(contractCallEndpoint);\n } else {\n let trimmed = client.mirrorNetwork[0].split(\":\");\n mirrorNetworkAddress = \"https://\"\n .concat(trimmed[0])\n .concat(contractCallEndpoint);\n }\n\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n const response = await fetch(mirrorNetworkAddress, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(jsonPayload),\n });\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const data = /** @type {MirrorNodeResponse} */ (await response.json());\n return data;\n }\n\n _fillEvmAddress() {\n if (this.senderEvmAddress == null && this.sender != null) {\n this._senderEvmAddress = this.sender.toEvmAddress();\n }\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * @returns {object}\n */\n get JSONPayload() {\n throw new Error(\n \"JSONPayload getter is not implemented. Please implement this method in the subclass.\",\n );\n }\n}\n"],"names":["MirrorNodeContractQuery","constructor","this","_contractId","_contractEvmAddress","_sender","_senderEvmAddress","_functionName","_functionParameters","_value","_gasLimit","_gasPrice","_blockNumber","setContractId","contractId","setSender","sender","setSenderEvmAddress","setFunction","name","functionParameters","_build","ContractFunctionParameters","setValue","value","setGasLimit","gasLimit","setGasPrice","gasPrice","setBlockNumber","blockNumber","contractEvmAddress","solidityAddress","toEvmAddress","Error","senderEvmAddress","callData","performMirrorNodeRequest","client","jsonPayload","_fillEvmAddress","mirrorNetworkAddress","mirrorNetwork","contractCallEndpoint","ledgerId","isLocalNode","concat","replace","trimmed","split","response","fetch","method","headers","body","JSON","stringify","ok","status","json","JSONPayload"],"mappings":"yDAkCe,MAAMA,EACjB,WAAAC,GACIC,KAAKC,YAAc,KACnBD,KAAKE,oBAAsB,KAC3BF,KAAKG,QAAU,KACfH,KAAKI,kBAAoB,KACzBJ,KAAKK,cAAgB,KACrBL,KAAKM,oBAAsB,KAC3BN,KAAKO,OAAS,KACdP,KAAKQ,UAAY,KACjBR,KAAKS,UAAY,KACjBT,KAAKU,aAAe,IAC5B,CAQI,aAAAC,CAAcC,GAEV,OADAZ,KAAKC,YAAcW,EACZZ,IACf,CAOI,SAAAa,CAAUC,GAEN,OADAd,KAAKG,QAAUW,EACRd,IACf,CAUI,mBAAAe,CAAoBD,GAEhB,OADAd,KAAKI,kBAAoBU,EAClBd,IACf,CASI,WAAAgB,CAAYC,EAAMC,GAMd,OALAlB,KAAKM,oBACqB,MAAtBY,EACMA,EAAmBC,OAAOF,IAC1B,IAAIG,GAA6BD,OAAOF,GAE3CjB,IACf,CAQI,QAAAqB,CAASC,GAEL,OADAtB,KAAKO,OAASe,EACPtB,IACf,CAQI,WAAAuB,CAAYC,GAER,OADAxB,KAAKQ,UAAYgB,EACVxB,IACf,CAOI,WAAAyB,CAAYC,GAER,OADA1B,KAAKS,UAAYiB,EACV1B,IACf,CAQI,cAAA2B,CAAeC,GAEX,OADA5B,KAAKU,aAAekB,EACb5B,IACf,CAKI,cAAIY,GACA,OAAOZ,KAAKC,WACpB,CAKI,sBAAI4B,GACA,MAAMC,EAAkB9B,KAAKC,aAAa8B,eAC1C,GAAuB,MAAnBD,EACA,MAAM,IAAIE,MAAM,0BAEpB,OAAOF,CACf,CAKI,UAAIhB,GACA,OAAOd,KAAKG,OACpB,CAKI,oBAAI8B,GACA,OAAOjC,KAAKI,iBACpB,CAKI,YAAI8B,GACA,OAAOlC,KAAKM,mBACpB,CAKI,SAAIgB,GACA,OAAOtB,KAAKO,MACpB,CAKI,YAAIiB,GACA,OAAOxB,KAAKQ,SACpB,CAKI,YAAIkB,GACA,OAAO1B,KAAKS,SACpB,CAKI,eAAImB,GACA,OAAO5B,KAAKU,YACpB,CAQI,8BAAMyB,CAAyBC,EAAQC,GACnC,GAAuB,MAAnBrC,KAAKY,WACL,MAAM,IAAIoB,MAAM,0BAEpBhC,KAAKsC,kBACL,IAAIC,EAAuBH,EAAOI,cAAc,GAChD,MAAMC,EAAuB,yBAE7B,IAAKL,EAAOM,UAAYN,EAAOM,UAAUC,cACrCJ,EAAuB,UAClBK,OAAOR,EAAOI,cAAc,GAAGK,QAAQ,OAAQ,SAC/CD,OAAOH,OACT,CACH,IAAIK,EAAUV,EAAOI,cAAc,GAAGO,MAAM,KAC5CR,EAAuB,WAClBK,OAAOE,EAAQ,IACfF,OAAOH,EACxB,CAGQ,MAAMO,QAAiBC,MAAMV,EAAsB,CAC/CW,OAAQ,OACRC,QAAS,CACL,eAAgB,oBAEpBC,KAAMC,KAAKC,UAAUjB,KAGzB,IAAKW,EAASO,GACV,MAAM,IAAIvB,MAAM,uBAAuBgB,EAASQ,UAKpD,aADsDR,EAASS,MAEvE,CAEI,eAAAnB,GACiC,MAAzBtC,KAAKiC,kBAA2C,MAAfjC,KAAKc,SACtCd,KAAKI,kBAAoBJ,KAAKc,OAAOiB,eAEjD,CAKI,eAAI2B,GACA,MAAM,IAAI1B,MACN,uFAEZ"}
1
+ {"version":3,"file":"MirrorNodeContractQuery.js","sources":["../../src/query/MirrorNodeContractQuery.js"],"sourcesContent":["import ContractFunctionParameters from \"../contract/ContractFunctionParameters.js\";\n\n/**\n * @typedef {import(\"../contract/ContractId\").default} ContractId\n * @typedef {import(\"../account/AccountId\").default} AccountId\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n *\n */\n\n/**\n * @typedef {object} MirrorNodeResponse\n * @property {string} result\n * @property {string} [error]\n * @property {string} [gasUsed]\n * @property {string} [contractAddress]\n * @property {string} [status]\n */\n\n/**\n * MirrorNodeContractQuery returns a result from EVM execution such as cost-free execution of read-only smart contract\n * queries, gas estimation, and transient simulation of read-write operations.\n * When working with sender that has ECDSA key with alias, you MUST:\n * 1. Retrieve the account's EVM address from the Mirror Node API first\n * 2. Use setSenderEvmAddress() instead of setSender()\n *\n * This is because EVM addresses for accounts with ECDSA keys and aliases cannot be automatically\n * derived and must be fetched from the Mirror Node. Example:\n *\n * ```javascript\n * // For accounts with ECDSA keys and aliases:\n * const evmAddress = // ... fetch from Mirror Node API ...\n * query.setSenderEvmAddress(evmAddress);\n * ```\n */\nexport default class MirrorNodeContractQuery {\n constructor() {\n this._contractId = null;\n this._contractEvmAddress = null;\n this._sender = null;\n this._senderEvmAddress = null;\n this._functionName = null;\n this._functionParameters = null;\n this._value = null;\n this._gasLimit = null;\n this._gasPrice = null;\n this._blockNumber = null;\n }\n\n /**\n *\n * @param {ContractId} contractId\n * @description Sets the contract instance to call.\n * @returns {this}\n */\n setContractId(contractId) {\n this._contractId = contractId;\n return this;\n }\n\n /**\n * @param {AccountId} sender\n * @description Sets the sender of the transaction simulation.\n * @returns {this}\n */\n setSender(sender) {\n this._sender = sender;\n return this;\n }\n\n /**\n * @param {string} sender\n * @description Set the 20-byte EVM address of the sender.\n * This method must be used explicitly when working with accounts that have ECDSA keys with aliases,\n * as their EVM addresses cannot be automatically derived and must be retrieved from the Mirror Node API.\n * The EVM address can be filled using `accountId.populateAccountEvmAddress(client)`\n * @returns {this}\n */\n setSenderEvmAddress(sender) {\n this._senderEvmAddress = sender;\n return this;\n }\n\n /**\n *\n * @param {string} name\n * @param {ContractFunctionParameters} functionParameters\n * @description Sets the function to call, and the parameters to pass to the function\n * @returns {this}\n */\n setFunction(name, functionParameters) {\n this._functionParameters =\n functionParameters != null\n ? functionParameters._build(name)\n : new ContractFunctionParameters()._build(name);\n\n return this;\n }\n\n /**\n * @param {Long} value\n * @description Sets the amount of value (in tinybars or wei) to be sent to the contract in the transaction.\n * Use this to specify an amount for a payable function call.\n * @returns {this}\n */\n setValue(value) {\n this._value = value;\n return this;\n }\n\n /**\n * @param {Long} gasLimit\n * @description Sets the gas limit for the contract call.\n * This specifies the maximum amount of gas that the transaction can consume.\n * @returns {this}\n */\n setGasLimit(gasLimit) {\n this._gasLimit = gasLimit;\n return this;\n }\n\n /**\n * @param {Long} gasPrice\n * @description Sets the gas price to be used for the contract call. This specifies the price of each unit of gas used in the transaction.\n * @returns {this}\n */\n setGasPrice(gasPrice) {\n this._gasPrice = gasPrice;\n return this;\n }\n\n /**\n * @param {Long} blockNumber\n * @description Sets the block number for the simulation of the contract call.\n * The block number determines the context of the contract call simulation within the blockchain.\n * @returns {this}\n */\n setBlockNumber(blockNumber) {\n this._blockNumber = blockNumber;\n return this;\n }\n\n /**\n * @returns {ContractId?}\n */\n get contractId() {\n return this._contractId;\n }\n\n /**\n * @returns {string}\n */\n get contractEvmAddress() {\n const solidityAddress = this._contractId?.toEvmAddress();\n if (solidityAddress == null) {\n throw new Error(\"Contract ID is not set\");\n }\n return solidityAddress;\n }\n\n /**\n * @returns {AccountId?}\n */\n get sender() {\n return this._sender;\n }\n\n /**\n * @returns {string | null }\n */\n get senderEvmAddress() {\n return this._senderEvmAddress;\n }\n\n /**\n * @returns {Uint8Array | null | undefined}\n */\n get callData() {\n return this._functionParameters;\n }\n\n /**\n * @returns {Long?}\n */\n get value() {\n return this._value;\n }\n\n /**\n * @returns {Long?}\n */\n get gasLimit() {\n return this._gasLimit;\n }\n\n /**\n * @returns {Long?}\n */\n get gasPrice() {\n return this._gasPrice;\n }\n\n /**\n * @returns {Long?}\n */\n get blockNumber() {\n return this._blockNumber;\n }\n\n /**\n *\n * @param {Client} client\n * @param {object} jsonPayload\n * @returns {Promise<MirrorNodeResponse>}\n */\n async performMirrorNodeRequest(client, jsonPayload) {\n if (this.contractId == null) {\n throw new Error(\"Contract ID is not set\");\n }\n this._fillEvmAddress();\n let mirrorNetworkAddress = client.mirrorNetwork[0];\n const contractCallEndpoint = \"/api/v1/contracts/call\";\n\n if (!client.ledgerId || client.ledgerId?.isLocalNode()) {\n const currentMirrorNetworkPort =\n client.mirrorNetwork[0].split(\":\")[1];\n mirrorNetworkAddress = \"http://\"\n .concat(\n client.mirrorNetwork[0].replace(\n currentMirrorNetworkPort,\n \"8545\",\n ),\n )\n .concat(contractCallEndpoint);\n } else {\n let trimmed = client.mirrorNetwork[0].split(\":\");\n mirrorNetworkAddress = \"https://\"\n .concat(trimmed[0])\n .concat(contractCallEndpoint);\n }\n\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n const response = await fetch(mirrorNetworkAddress, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(jsonPayload),\n });\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const data = /** @type {MirrorNodeResponse} */ (await response.json());\n return data;\n }\n\n _fillEvmAddress() {\n if (this.senderEvmAddress == null && this.sender != null) {\n this._senderEvmAddress = this.sender.toEvmAddress();\n }\n }\n // eslint-disable-next-line jsdoc/require-returns-check\n /**\n * @returns {object}\n */\n get JSONPayload() {\n throw new Error(\n \"JSONPayload getter is not implemented. Please implement this method in the subclass.\",\n );\n }\n}\n"],"names":["MirrorNodeContractQuery","constructor","this","_contractId","_contractEvmAddress","_sender","_senderEvmAddress","_functionName","_functionParameters","_value","_gasLimit","_gasPrice","_blockNumber","setContractId","contractId","setSender","sender","setSenderEvmAddress","setFunction","name","functionParameters","_build","ContractFunctionParameters","setValue","value","setGasLimit","gasLimit","setGasPrice","gasPrice","setBlockNumber","blockNumber","contractEvmAddress","solidityAddress","toEvmAddress","Error","senderEvmAddress","callData","performMirrorNodeRequest","client","jsonPayload","_fillEvmAddress","mirrorNetworkAddress","mirrorNetwork","contractCallEndpoint","ledgerId","isLocalNode","currentMirrorNetworkPort","split","concat","replace","trimmed","response","fetch","method","headers","body","JSON","stringify","ok","status","json","JSONPayload"],"mappings":"yDAkCe,MAAMA,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U,YACpB,CAQI,8BAAMyB,CAAyBC,EAAQC,GACnC,GAAuB,MAAnBrC,KAAKY,WACL,MAAM,IAAIoB,MAAM,0BAEpBhC,KAAKsC,kBACL,IAAIC,EAAuBH,EAAOI,cAAc,GAChD,MAAMC,EAAuB,yBAE7B,IAAKL,EAAOM,UAAYN,EAAOM,UAAUC,cAAe,CACpD,MAAMC,EACFR,EAAOI,cAAc,GAAGK,MAAM,KAAK,GACvCN,EAAuB,UAClBO,OACGV,EAAOI,cAAc,GAAGO,QACpBH,EACA,SAGPE,OAAOL,EACxB,KAAe,CACH,IAAIO,EAAUZ,EAAOI,cAAc,GAAGK,MAAM,KAC5CN,EAAuB,WAClBO,OAAOE,EAAQ,IACfF,OAAOL,EACxB,CAGQ,MAAMQ,QAAiBC,MAAMX,EAAsB,CAC/CY,OAAQ,OACRC,QAAS,CACL,eAAgB,oBAEpBC,KAAMC,KAAKC,UAAUlB,KAGzB,IAAKY,EAASO,GACV,MAAM,IAAIxB,MAAM,uBAAuBiB,EAASQ,UAKpD,aADsDR,EAASS,MAEvE,CAEI,eAAApB,GACiC,MAAzBtC,KAAKiC,kBAA2C,MAAfjC,KAAKc,SACtCd,KAAKI,kBAAoBJ,KAAKc,OAAOiB,eAEjD,CAKI,eAAI4B,GACA,MAAM,IAAI3B,MACN,uFAEZ"}
@@ -14,8 +14,7 @@ var _PrecheckStatusError = _interopRequireDefault(require("../PrecheckStatusErro
14
14
  var _MaxQueryPaymentExceeded = _interopRequireDefault(require("../MaxQueryPaymentExceeded.cjs"));
15
15
  var _QueryBase = _interopRequireDefault(require("./QueryBase.cjs"));
16
16
  var _CostQuery = _interopRequireDefault(require("./CostQuery.cjs"));
17
- 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); }
18
- 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; }
17
+ 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); }
19
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
20
19
  // SPDX-License-Identifier: Apache-2.0
21
20
 
@@ -1,2 +1,2 @@
1
- import t from"../Status.js";import e from"../account/AccountId.js";import n from"../Hbar.js";import{ExecutionState as s}from"../Executable.js";import r from"../transaction/TransactionId.js";import*as o from"@hashgraph/proto";import a from"../PrecheckStatusError.js";import i from"../MaxQueryPaymentExceeded.js";import u from"./QueryBase.js";import c from"./CostQuery.js";const m=new Map;class h extends u{constructor(){super(),this._paymentTransactionId=null,this._paymentTransactions=[],this._queryPayment=null,this._maxQueryPayment=null,this._timestamp=Date.now()}static fromBytes(t){const e=o.proto.Query.decode(t);if(null==e.query)throw new Error("(BUG) query.query was not set in the protobuf");const n=m.get(e.query);if(null==n)throw new Error(`(BUG) Query.fromBytes() not implemented for type ${e.query}`);return n(e)}toBytes(){return o.proto.Query.encode(this._makeRequest()).finish()}setQueryPayment(t){return this._queryPayment=t,this}setMaxQueryPayment(t){return this._maxQueryPayment=t,this}async getCost(t){this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(t._network.getNodeAccountIdsForExecute()),this._timestamp=Date.now();const e=await new c(this).execute(t);return n.fromTinybars(e._valueInTinybar.multipliedBy(1.1).toFixed(0))}setPaymentTransactionId(t){return this._paymentTransactionId=t,this}get paymentTransactionId(){return this._paymentTransactionId}_getTransactionId(){if(null==this._paymentTransactionId)throw new Error("Query.PaymentTransactionId was not set duration execution");return this._paymentTransactionId}_isPaymentRequired(){return!0}_validateChecksums(t){}async _beforeExecute(t){if(this._paymentTransactions.length>0)return;if(t.isAutoValidateChecksumsEnabled()&&this._validateChecksums(t),this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(t._network.getNodeAccountIdsForExecute()),this._operator=null!=this._operator?this._operator:t._operator,this._isPaymentRequired()){if(this.transactionNodeIds=Object.values(t.network).map((t=>t.toString())),null==this._operator)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._paymentTransactionId=r.generate(this._operator.accountId)}else this._paymentTransactionId=r.generate(new e(0));let s=new n(0);const o=null!=this._maxQueryPayment?this._maxQueryPayment:t.defaultMaxQueryPayment;if(null!=this._queryPayment)s=this._queryPayment;else if(0===this._paymentTransactions.length&&this._isPaymentRequired()){const e=await this.getCost(t);if(o.toTinybars().toInt()<e.toTinybars().toInt())throw new i(e,o);s=e,this._logger&&this._logger.debug(`[${this._getLogId()}] received cost for query ${s.toString()}`)}this._queryPayment=s,this._timestamp=Date.now(),this._nodeAccountIds.setLocked();for(const t of this._nodeAccountIds.list){const e=this._getLogId(),n=this._paymentTransactionId,s=this._queryPayment;this._logger&&this._logger.debug(`[${e}] making a payment transaction for node ${t.toString()} and transaction ID ${n.toString()} with amount ${s.toString()}`),this._paymentTransactions.push(await this._makePaymentTransaction(n,t,this._isPaymentRequired()?this._operator:null,s))}}_mapResponseHeader(t){throw new Error("not implemented")}_makeRequestHeader(){let t={};return this._isPaymentRequired()&&this._paymentTransactions.length>0&&(t={responseType:o.proto.ResponseType.ANSWER_ONLY,payment:this._paymentTransactions[this._nodeAccountIds.index]}),t}_onMakeRequest(t){throw new Error("not implemented")}_makeRequest(){let t={};return this._isPaymentRequired()&&null!=this._paymentTransactions&&(t={payment:this._paymentTransactions[this._nodeAccountIds.index],responseType:o.proto.ResponseType.ANSWER_ONLY}),this._onMakeRequest(t)}async _makeRequestAsync(){let t={responseType:o.proto.ResponseType.ANSWER_ONLY};const n=this._getLogId(),s=this._nodeAccountIds.current,a=r.generate(this._operator?this._operator.accountId:new e(0)),i=this._queryPayment;return this._logger&&this._logger.debug(`[${n}] making a payment transaction for node ${s.toString()} and transaction ID ${a.toString()} with amount ${i.toString()}`),t.payment=await this._makePaymentTransaction(a,s,this._isPaymentRequired()?this._operator:null,i),this._onMakeRequest(t)}_shouldRetry(e,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(n),a=t._fromCode(null!=r?r:o.proto.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received status ${a.toString()}`),a){case t.Busy:case t.Unknown:case t.PlatformTransactionNotCreated:case t.PlatformNotActive:return[a,s.Retry];case t.Ok:return[a,s.Finished];default:return[a,s.Error]}}_mapStatusError(e,n,s){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(n),i=t._fromCode(null!=r?r:o.proto.ResponseCodeEnum.OK);return new a({nodeId:s,status:i,transactionId:this._getTransactionId(),contractFunctionResult:null})}_requestToBytes(t){return o.proto.Query.encode(t).finish()}_responseToBytes(t){return o.proto.Response.encode(t).finish()}}export{m as QUERY_REGISTRY,h as default};
1
+ import t from"../Status.js";import e from"../account/AccountId.js";import n from"../Hbar.js";import{ExecutionState as s}from"../Executable.js";import r from"../transaction/TransactionId.js";import*as o from"@hashgraph/proto";import a from"../PrecheckStatusError.js";import i from"../MaxQueryPaymentExceeded.js";import u from"./QueryBase.js";import c from"./CostQuery.js";const m=new Map;class h extends u{constructor(){super(),this._paymentTransactionId=null,this._paymentTransactions=[],this._queryPayment=null,this._maxQueryPayment=null,this._timestamp=Date.now()}static fromBytes(t){const e=o.proto.Query.decode(t);if(null==e.query)throw new Error("(BUG) query.query was not set in the protobuf");const n=m.get(e.query);if(null==n)throw new Error(`(BUG) Query.fromBytes() not implemented for type ${e.query}`);return n(e)}toBytes(){return o.proto.Query.encode(this._makeRequest()).finish()}setQueryPayment(t){return this._queryPayment=t,this}setMaxQueryPayment(t){return this._maxQueryPayment=t,this}async getCost(t){this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(t._network.getNodeAccountIdsForExecute()),this._timestamp=Date.now();const e=await new c(this).execute(t);return n.fromTinybars(e._valueInTinybar.multipliedBy(1.1).toFixed(0))}setPaymentTransactionId(t){return this._paymentTransactionId=t,this}get paymentTransactionId(){return this._paymentTransactionId}_getTransactionId(){if(null==this._paymentTransactionId)throw new Error("Query.PaymentTransactionId was not set duration execution");return this._paymentTransactionId}_isPaymentRequired(){return!0}_validateChecksums(t){}async _beforeExecute(t){if(this._paymentTransactions.length>0)return;if(t.isAutoValidateChecksumsEnabled()&&this._validateChecksums(t),this._nodeAccountIds.isEmpty&&this._nodeAccountIds.setList(t._network.getNodeAccountIdsForExecute()),this._operator=null!=this._operator?this._operator:t._operator,this._isPaymentRequired()){if(this.transactionNodeIds=Object.values(t.network).map(t=>t.toString()),null==this._operator)throw new Error("`client` must have an `operator` or an explicit payment transaction must be provided");this._paymentTransactionId=r.generate(this._operator.accountId)}else this._paymentTransactionId=r.generate(new e(0));let s=new n(0);const o=null!=this._maxQueryPayment?this._maxQueryPayment:t.defaultMaxQueryPayment;if(null!=this._queryPayment)s=this._queryPayment;else if(0===this._paymentTransactions.length&&this._isPaymentRequired()){const e=await this.getCost(t);if(o.toTinybars().toInt()<e.toTinybars().toInt())throw new i(e,o);s=e,this._logger&&this._logger.debug(`[${this._getLogId()}] received cost for query ${s.toString()}`)}this._queryPayment=s,this._timestamp=Date.now(),this._nodeAccountIds.setLocked();for(const t of this._nodeAccountIds.list){const e=this._getLogId(),n=this._paymentTransactionId,s=this._queryPayment;this._logger&&this._logger.debug(`[${e}] making a payment transaction for node ${t.toString()} and transaction ID ${n.toString()} with amount ${s.toString()}`),this._paymentTransactions.push(await this._makePaymentTransaction(n,t,this._isPaymentRequired()?this._operator:null,s))}}_mapResponseHeader(t){throw new Error("not implemented")}_makeRequestHeader(){let t={};return this._isPaymentRequired()&&this._paymentTransactions.length>0&&(t={responseType:o.proto.ResponseType.ANSWER_ONLY,payment:this._paymentTransactions[this._nodeAccountIds.index]}),t}_onMakeRequest(t){throw new Error("not implemented")}_makeRequest(){let t={};return this._isPaymentRequired()&&null!=this._paymentTransactions&&(t={payment:this._paymentTransactions[this._nodeAccountIds.index],responseType:o.proto.ResponseType.ANSWER_ONLY}),this._onMakeRequest(t)}async _makeRequestAsync(){let t={responseType:o.proto.ResponseType.ANSWER_ONLY};const n=this._getLogId(),s=this._nodeAccountIds.current,a=r.generate(this._operator?this._operator.accountId:new e(0)),i=this._queryPayment;return this._logger&&this._logger.debug(`[${n}] making a payment transaction for node ${s.toString()} and transaction ID ${a.toString()} with amount ${i.toString()}`),t.payment=await this._makePaymentTransaction(a,s,this._isPaymentRequired()?this._operator:null,i),this._onMakeRequest(t)}_shouldRetry(e,n){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(n),a=t._fromCode(null!=r?r:o.proto.ResponseCodeEnum.OK);switch(this._logger&&this._logger.debug(`[${this._getLogId()}] received status ${a.toString()}`),a){case t.Busy:case t.Unknown:case t.PlatformTransactionNotCreated:case t.PlatformNotActive:return[a,s.Retry];case t.Ok:return[a,s.Finished];default:return[a,s.Error]}}_mapStatusError(e,n,s){const{nodeTransactionPrecheckCode:r}=this._mapResponseHeader(n),i=t._fromCode(null!=r?r:o.proto.ResponseCodeEnum.OK);return new a({nodeId:s,status:i,transactionId:this._getTransactionId(),contractFunctionResult:null})}_requestToBytes(t){return o.proto.Query.encode(t).finish()}_responseToBytes(t){return o.proto.Response.encode(t).finish()}}export{m as QUERY_REGISTRY,h as default};
2
2
  //# sourceMappingURL=Query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Query.js","sources":["../../src/query/Query.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Status from \"../Status.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Hbar from \"../Hbar.js\";\nimport { ExecutionState } from \"../Executable.js\";\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport PrecheckStatusError from \"../PrecheckStatusError.js\";\nimport MaxQueryPaymentExceeded from \"../MaxQueryPaymentExceeded.js\";\nimport QueryBase from \"./QueryBase.js\";\nimport CostQuery from \"./CostQuery.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../logger/Logger.js\").default} Logger\n */\n\n/**\n * This registry holds a bunch of callbacks for `fromProtobuf()` implementations\n * Since this is essentially aa cache, perhaps we should move this variable into the `Cache`\n * type for consistency?\n *\n * @type {Map<HieroProto.proto.Query[\"query\"], (query: HieroProto.proto.IQuery) => Query<*>>}\n */\nexport const QUERY_REGISTRY = new Map();\n\n/**\n * Base class for all queries that can be submitted to Hedera.\n *\n * @abstract\n * @template OutputT\n * @augments {QueryBase<HieroProto.proto.IQuery, HieroProto.proto.IResponse, OutputT>}\n */\nexport default class Query extends QueryBase {\n constructor() {\n super();\n\n /**\n * The payment transaction ID\n *\n * @type {?TransactionId}\n */\n this._paymentTransactionId = null;\n\n /**\n * The payment transactions list where each index points to a different node\n *\n * @type {HieroProto.proto.ITransaction[]}\n */\n this._paymentTransactions = [];\n\n /**\n * The amount being paid to the node for this query.\n * A user can set this field explicitly, or we'll query the value during execution.\n *\n * @type {?Hbar}\n */\n this._queryPayment = null;\n\n /**\n * The maximum query payment a user is willing to pay. Unlike `Transaction.maxTransactionFee`\n * this field only exists in the SDK; there is no protobuf field equivalent. If and when\n * we query the actual cost of the query and the cost is greater than the max query payment\n * we'll throw a `MaxQueryPaymentExceeded` error.\n *\n * @type {?Hbar}\n */\n this._maxQueryPayment = null;\n\n /**\n * This is strictly used for `_getLogId()` which requires a timestamp. The timestamp it typically\n * uses comes from the payment transaction ID, but that field is not set if this query is free.\n * For those occasions we use this timestamp field generated at query construction instead.\n *\n * @type {number}\n */\n this._timestamp = Date.now();\n }\n\n /**\n * Deserialize a query from bytes. The bytes should be a `proto.Query`.\n *\n * @template T\n * @param {Uint8Array} bytes\n * @returns {Query<T>}\n */\n static fromBytes(bytes) {\n const query = HieroProto.proto.Query.decode(bytes);\n\n if (query.query == null) {\n throw new Error(\"(BUG) query.query was not set in the protobuf\");\n }\n\n const fromProtobuf =\n /** @type {(query: HieroProto.proto.IQuery) => Query<T>} */ (\n QUERY_REGISTRY.get(query.query)\n );\n\n if (fromProtobuf == null) {\n throw new Error(\n `(BUG) Query.fromBytes() not implemented for type ${query.query}`,\n );\n }\n\n return fromProtobuf(query);\n }\n\n /**\n * Serialize the query into bytes.\n *\n * **NOTE**: Does not preserve payment transactions\n *\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.Query.encode(this._makeRequest()).finish();\n }\n\n /**\n * Set an explicit payment amount for this query.\n *\n * The client will submit exactly this amount for the payment of this query. Hedera\n * will not return any remainder.\n *\n * @param {Hbar} queryPayment\n * @returns {this}\n */\n setQueryPayment(queryPayment) {\n this._queryPayment = queryPayment;\n\n return this;\n }\n\n /**\n * Set the maximum payment allowable for this query.\n *\n * @param {Hbar} maxQueryPayment\n * @returns {this}\n */\n setMaxQueryPayment(maxQueryPayment) {\n this._maxQueryPayment = maxQueryPayment;\n\n return this;\n }\n\n /**\n * Fetch the cost of this query from a consensus node\n *\n * @param {import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {Promise<Hbar>}\n */\n async getCost(client) {\n // The node account IDs must be set to execute a cost query\n if (this._nodeAccountIds.isEmpty) {\n this._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute(),\n );\n }\n\n // Change the timestamp. Should we be doing this?\n this._timestamp = Date.now();\n const cost = await new CostQuery(this).execute(client);\n return Hbar.fromTinybars(\n cost._valueInTinybar.multipliedBy(1.1).toFixed(0),\n );\n }\n\n /**\n * Set he payment transaction explicitly\n *\n * @param {TransactionId} paymentTransactionId\n * @returns {this}\n */\n setPaymentTransactionId(paymentTransactionId) {\n this._paymentTransactionId = paymentTransactionId;\n return this;\n }\n\n /**\n * Get the payment transaction ID\n *\n * @returns {?TransactionId}\n */\n get paymentTransactionId() {\n return this._paymentTransactionId;\n }\n\n /**\n * Get the current transaction ID, and make sure it's not null\n *\n * @returns {TransactionId}\n */\n _getTransactionId() {\n if (this._paymentTransactionId == null) {\n throw new Error(\n \"Query.PaymentTransactionId was not set duration execution\",\n );\n }\n\n return this._paymentTransactionId;\n }\n\n /**\n * Is payment required for this query. By default most queries require payment\n * so the default implementation returns true.\n *\n * @protected\n * @returns {boolean}\n */\n _isPaymentRequired() {\n return true;\n }\n\n /**\n * Validate checksums of the query.\n *\n * @param {Client} client\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function\n _validateChecksums(client) {\n // Shouldn't we be checking `paymentTransactionId` here sine it contains an `accountId`?\n // Do nothing\n }\n\n /**\n * Before we proceed exeuction, we need to do a couple checks\n *\n * @template {MirrorChannel} MirrorChannelT\n * @param {import(\"../client/Client.js\").default<Channel, MirrorChannelT>} client\n * @returns {Promise<void>}\n */\n async _beforeExecute(client) {\n // If we're executing this query multiple times the the payment transaction ID list\n // will already be set\n if (this._paymentTransactions.length > 0) {\n return;\n }\n\n // Check checksums if enabled\n if (client.isAutoValidateChecksumsEnabled()) {\n this._validateChecksums(client);\n }\n\n // If the nodes aren't set, set them.\n if (this._nodeAccountIds.isEmpty) {\n this._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute(),\n );\n }\n\n // Save the operator\n this._operator =\n this._operator != null ? this._operator : client._operator;\n\n // And payment is required\n if (this._isPaymentRequired()) {\n // Assign the account IDs to which the transaction should be sent.\n this.transactionNodeIds = Object.values(client.network).map(\n (accountNodeId) => accountNodeId.toString(),\n );\n\n // And the client has an operator\n if (this._operator != null) {\n // Generate the payment transaction ID\n this._paymentTransactionId = TransactionId.generate(\n this._operator.accountId,\n );\n } else {\n // If payment is required, but an operator did not exist, throw an error\n throw new Error(\n \"`client` must have an `operator` or an explicit payment transaction must be provided\",\n );\n }\n } else {\n // If the payment transaction ID is not set, but this query doesn't require a payment\n // set the payment transaction ID to an empty transaction ID.\n // FIXME: Should use `TransactionId.withValidStart()` instead\n this._paymentTransactionId = TransactionId.generate(\n new AccountId(0),\n );\n }\n\n let cost = new Hbar(0);\n\n const maxQueryPayment =\n this._maxQueryPayment != null\n ? this._maxQueryPayment\n : client.defaultMaxQueryPayment;\n\n if (this._queryPayment != null) {\n cost = this._queryPayment;\n } else if (\n this._paymentTransactions.length === 0 &&\n this._isPaymentRequired()\n ) {\n // If the query payment was not explictly set, fetch the actual cost.\n const actualCost = await this.getCost(client);\n\n // Confirm it's less than max query payment\n if (\n maxQueryPayment.toTinybars().toInt() <\n actualCost.toTinybars().toInt()\n ) {\n throw new MaxQueryPaymentExceeded(actualCost, maxQueryPayment);\n }\n\n cost = actualCost;\n if (this._logger) {\n this._logger.debug(\n `[${this._getLogId()}] received cost for query ${cost.toString()}`,\n );\n }\n }\n\n // Set the either queried cost, or the original value back into `queryPayment`\n // in case a user executes same query multiple times. However, users should\n // really not be executing the same query multiple times meaning this is\n // typically not needed.\n this._queryPayment = cost;\n\n // Not sure if we should be overwritting this field tbh.\n this._timestamp = Date.now();\n\n this._nodeAccountIds.setLocked();\n\n // Generate the payment transactions\n for (const nodeId of this._nodeAccountIds.list) {\n const logId = this._getLogId();\n const paymentTransactionId =\n /** @type {import(\"../transaction/TransactionId.js\").default} */ (\n this._paymentTransactionId\n );\n const paymentAmount = /** @type {Hbar} */ (this._queryPayment);\n\n if (this._logger) {\n this._logger.debug(\n `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`,\n );\n }\n\n this._paymentTransactions.push(\n await this._makePaymentTransaction(\n paymentTransactionId,\n nodeId,\n this._isPaymentRequired() ? this._operator : null,\n paymentAmount,\n ),\n );\n }\n }\n\n /**\n * @abstract\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @returns {HieroProto.proto.IResponseHeader}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponseHeader(response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @protected\n * @returns {HieroProto.proto.IQueryHeader}\n */\n _makeRequestHeader() {\n /** @type {HieroProto.proto.IQueryHeader} */\n let header = {};\n\n if (this._isPaymentRequired() && this._paymentTransactions.length > 0) {\n header = {\n responseType: HieroProto.proto.ResponseType.ANSWER_ONLY,\n payment: this._paymentTransactions[this._nodeAccountIds.index],\n };\n }\n\n return header;\n }\n\n /**\n * @abstract\n * @internal\n * @param {HieroProto.proto.IQueryHeader} header\n * @returns {HieroProto.proto.IQuery}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _onMakeRequest(header) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.IQuery}\n */\n _makeRequest() {\n /** @type {HieroProto.proto.IQueryHeader} */\n let header = {};\n\n if (this._isPaymentRequired() && this._paymentTransactions != null) {\n header = {\n payment: this._paymentTransactions[this._nodeAccountIds.index],\n responseType: HieroProto.proto.ResponseType.ANSWER_ONLY,\n };\n }\n\n return this._onMakeRequest(header);\n }\n\n /**\n * @override\n * @internal\n * @returns {Promise<HieroProto.proto.IQuery>}\n */\n async _makeRequestAsync() {\n /** @type {HieroProto.proto.IQueryHeader} */\n let header = {\n responseType: HieroProto.proto.ResponseType.ANSWER_ONLY,\n };\n\n const logId = this._getLogId();\n const nodeId = this._nodeAccountIds.current;\n const paymentTransactionId = TransactionId.generate(\n this._operator ? this._operator.accountId : new AccountId(0),\n );\n const paymentAmount = /** @type {Hbar} */ (this._queryPayment);\n\n if (this._logger) {\n this._logger.debug(\n `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`,\n );\n }\n\n header.payment = await this._makePaymentTransaction(\n paymentTransactionId,\n nodeId,\n this._isPaymentRequired() ? this._operator : null,\n paymentAmount,\n );\n\n return this._onMakeRequest(header);\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IQuery} request\n * @param {HieroProto.proto.IResponse} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n const status = Status._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : HieroProto.proto.ResponseCodeEnum.OK,\n );\n if (this._logger) {\n this._logger.debug(\n `[${this._getLogId()}] received status ${status.toString()}`,\n );\n }\n\n switch (status) {\n case Status.Busy:\n case Status.Unknown:\n case Status.PlatformTransactionNotCreated:\n case Status.PlatformNotActive:\n return [status, ExecutionState.Retry];\n case Status.Ok:\n return [status, ExecutionState.Finished];\n default:\n return [status, ExecutionState.Error];\n }\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IQuery} request\n * @param {HieroProto.proto.IResponse} 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 const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n const status = Status._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : HieroProto.proto.ResponseCodeEnum.OK,\n );\n\n return new PrecheckStatusError({\n nodeId,\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult: null,\n });\n }\n\n /**\n * @param {HieroProto.proto.Query} request\n * @returns {Uint8Array}\n */\n _requestToBytes(request) {\n return HieroProto.proto.Query.encode(request).finish();\n }\n\n /**\n * @param {HieroProto.proto.Response} response\n * @returns {Uint8Array}\n */\n _responseToBytes(response) {\n return HieroProto.proto.Response.encode(response).finish();\n }\n}\n"],"names":["QUERY_REGISTRY","Map","Query","QueryBase","constructor","super","this","_paymentTransactionId","_paymentTransactions","_queryPayment","_maxQueryPayment","_timestamp","Date","now","fromBytes","bytes","query","HieroProto","proto","decode","Error","fromProtobuf","get","toBytes","encode","_makeRequest","finish","setQueryPayment","queryPayment","setMaxQueryPayment","maxQueryPayment","getCost","client","_nodeAccountIds","isEmpty","setList","_network","getNodeAccountIdsForExecute","cost","CostQuery","execute","Hbar","fromTinybars","_valueInTinybar","multipliedBy","toFixed","setPaymentTransactionId","paymentTransactionId","_getTransactionId","_isPaymentRequired","_validateChecksums","_beforeExecute","length","isAutoValidateChecksumsEnabled","_operator","transactionNodeIds","Object","values","network","map","accountNodeId","toString","TransactionId","generate","accountId","AccountId","defaultMaxQueryPayment","actualCost","toTinybars","toInt","MaxQueryPaymentExceeded","_logger","debug","_getLogId","setLocked","nodeId","list","logId","paymentAmount","push","_makePaymentTransaction","_mapResponseHeader","response","_makeRequestHeader","header","responseType","ResponseType","ANSWER_ONLY","payment","index","_onMakeRequest","_makeRequestAsync","current","_shouldRetry","request","nodeTransactionPrecheckCode","status","Status","_fromCode","ResponseCodeEnum","OK","Busy","Unknown","PlatformTransactionNotCreated","PlatformNotActive","ExecutionState","Retry","Ok","Finished","_mapStatusError","PrecheckStatusError","transactionId","contractFunctionResult","_requestToBytes","_responseToBytes","Response"],"mappings":"mXA6BY,MAACA,EAAiB,IAAIC,IASnB,MAAMC,UAAcC,EAC/B,WAAAC,GACIC,QAOAC,KAAKC,sBAAwB,KAO7BD,KAAKE,qBAAuB,GAQ5BF,KAAKG,cAAgB,KAUrBH,KA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KiE,SACLjE,KAAKiE,QAAQC,MACT,IAAIlE,KAAKmE,gCAAgCuB,EAAOnC,cAIhDmC,GACJ,KAAKC,EAAOI,KACZ,KAAKJ,EAAOK,QACZ,KAAKL,EAAOM,8BACZ,KAAKN,EAAOO,kBACR,MAAO,CAACR,EAAQS,EAAeC,OACnC,KAAKT,EAAOU,GACR,MAAO,CAACX,EAAQS,EAAeG,UACnC,QACI,MAAO,CAACZ,EAAQS,EAAerF,OAE/C,CAWI,eAAAyF,CAAgBf,EAASZ,EAAUP,GAC/B,MAAMoB,4BAAEA,GACJzF,KAAK2E,mBAAmBC,GAEtBc,EAASC,EAAOC,UACa,MAA/BH,EACMA,EACA9E,EAAWC,MAAMiF,iBAAiBC,IAG5C,OAAO,IAAIU,EAAoB,CAC3BnC,SACAqB,SACAe,cAAezG,KAAK0C,oBACpBgE,uBAAwB,MAEpC,CAMI,eAAAC,CAAgBnB,GACZ,OAAO7E,EAAWC,MAAMhB,MAAMsB,OAAOsE,GAASpE,QACtD,CAMI,gBAAAwF,CAAiBhC,GACb,OAAOjE,EAAWC,MAAMiG,SAAS3F,OAAO0D,GAAUxD,QAC1D"}
1
+ {"version":3,"file":"Query.js","sources":["../../src/query/Query.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Status from \"../Status.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Hbar from \"../Hbar.js\";\nimport { ExecutionState } from \"../Executable.js\";\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport PrecheckStatusError from \"../PrecheckStatusError.js\";\nimport MaxQueryPaymentExceeded from \"../MaxQueryPaymentExceeded.js\";\nimport QueryBase from \"./QueryBase.js\";\nimport CostQuery from \"./CostQuery.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../logger/Logger.js\").default} Logger\n */\n\n/**\n * This registry holds a bunch of callbacks for `fromProtobuf()` implementations\n * Since this is essentially aa cache, perhaps we should move this variable into the `Cache`\n * type for consistency?\n *\n * @type {Map<HieroProto.proto.Query[\"query\"], (query: HieroProto.proto.IQuery) => Query<*>>}\n */\nexport const QUERY_REGISTRY = new Map();\n\n/**\n * Base class for all queries that can be submitted to Hedera.\n *\n * @abstract\n * @template OutputT\n * @augments {QueryBase<HieroProto.proto.IQuery, HieroProto.proto.IResponse, OutputT>}\n */\nexport default class Query extends QueryBase {\n constructor() {\n super();\n\n /**\n * The payment transaction ID\n *\n * @type {?TransactionId}\n */\n this._paymentTransactionId = null;\n\n /**\n * The payment transactions list where each index points to a different node\n *\n * @type {HieroProto.proto.ITransaction[]}\n */\n this._paymentTransactions = [];\n\n /**\n * The amount being paid to the node for this query.\n * A user can set this field explicitly, or we'll query the value during execution.\n *\n * @type {?Hbar}\n */\n this._queryPayment = null;\n\n /**\n * The maximum query payment a user is willing to pay. Unlike `Transaction.maxTransactionFee`\n * this field only exists in the SDK; there is no protobuf field equivalent. If and when\n * we query the actual cost of the query and the cost is greater than the max query payment\n * we'll throw a `MaxQueryPaymentExceeded` error.\n *\n * @type {?Hbar}\n */\n this._maxQueryPayment = null;\n\n /**\n * This is strictly used for `_getLogId()` which requires a timestamp. The timestamp it typically\n * uses comes from the payment transaction ID, but that field is not set if this query is free.\n * For those occasions we use this timestamp field generated at query construction instead.\n *\n * @type {number}\n */\n this._timestamp = Date.now();\n }\n\n /**\n * Deserialize a query from bytes. The bytes should be a `proto.Query`.\n *\n * @template T\n * @param {Uint8Array} bytes\n * @returns {Query<T>}\n */\n static fromBytes(bytes) {\n const query = HieroProto.proto.Query.decode(bytes);\n\n if (query.query == null) {\n throw new Error(\"(BUG) query.query was not set in the protobuf\");\n }\n\n const fromProtobuf =\n /** @type {(query: HieroProto.proto.IQuery) => Query<T>} */ (\n QUERY_REGISTRY.get(query.query)\n );\n\n if (fromProtobuf == null) {\n throw new Error(\n `(BUG) Query.fromBytes() not implemented for type ${query.query}`,\n );\n }\n\n return fromProtobuf(query);\n }\n\n /**\n * Serialize the query into bytes.\n *\n * **NOTE**: Does not preserve payment transactions\n *\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.Query.encode(this._makeRequest()).finish();\n }\n\n /**\n * Set an explicit payment amount for this query.\n *\n * The client will submit exactly this amount for the payment of this query. Hedera\n * will not return any remainder.\n *\n * @param {Hbar} queryPayment\n * @returns {this}\n */\n setQueryPayment(queryPayment) {\n this._queryPayment = queryPayment;\n\n return this;\n }\n\n /**\n * Set the maximum payment allowable for this query.\n *\n * @param {Hbar} maxQueryPayment\n * @returns {this}\n */\n setMaxQueryPayment(maxQueryPayment) {\n this._maxQueryPayment = maxQueryPayment;\n\n return this;\n }\n\n /**\n * Fetch the cost of this query from a consensus node\n *\n * @param {import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {Promise<Hbar>}\n */\n async getCost(client) {\n // The node account IDs must be set to execute a cost query\n if (this._nodeAccountIds.isEmpty) {\n this._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute(),\n );\n }\n\n // Change the timestamp. Should we be doing this?\n this._timestamp = Date.now();\n const cost = await new CostQuery(this).execute(client);\n return Hbar.fromTinybars(\n cost._valueInTinybar.multipliedBy(1.1).toFixed(0),\n );\n }\n\n /**\n * Set he payment transaction explicitly\n *\n * @param {TransactionId} paymentTransactionId\n * @returns {this}\n */\n setPaymentTransactionId(paymentTransactionId) {\n this._paymentTransactionId = paymentTransactionId;\n return this;\n }\n\n /**\n * Get the payment transaction ID\n *\n * @returns {?TransactionId}\n */\n get paymentTransactionId() {\n return this._paymentTransactionId;\n }\n\n /**\n * Get the current transaction ID, and make sure it's not null\n *\n * @returns {TransactionId}\n */\n _getTransactionId() {\n if (this._paymentTransactionId == null) {\n throw new Error(\n \"Query.PaymentTransactionId was not set duration execution\",\n );\n }\n\n return this._paymentTransactionId;\n }\n\n /**\n * Is payment required for this query. By default most queries require payment\n * so the default implementation returns true.\n *\n * @protected\n * @returns {boolean}\n */\n _isPaymentRequired() {\n return true;\n }\n\n /**\n * Validate checksums of the query.\n *\n * @param {Client} client\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function\n _validateChecksums(client) {\n // Shouldn't we be checking `paymentTransactionId` here sine it contains an `accountId`?\n // Do nothing\n }\n\n /**\n * Before we proceed exeuction, we need to do a couple checks\n *\n * @template {MirrorChannel} MirrorChannelT\n * @param {import(\"../client/Client.js\").default<Channel, MirrorChannelT>} client\n * @returns {Promise<void>}\n */\n async _beforeExecute(client) {\n // If we're executing this query multiple times the the payment transaction ID list\n // will already be set\n if (this._paymentTransactions.length > 0) {\n return;\n }\n\n // Check checksums if enabled\n if (client.isAutoValidateChecksumsEnabled()) {\n this._validateChecksums(client);\n }\n\n // If the nodes aren't set, set them.\n if (this._nodeAccountIds.isEmpty) {\n this._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute(),\n );\n }\n\n // Save the operator\n this._operator =\n this._operator != null ? this._operator : client._operator;\n\n // And payment is required\n if (this._isPaymentRequired()) {\n // Assign the account IDs to which the transaction should be sent.\n this.transactionNodeIds = Object.values(client.network).map(\n (accountNodeId) => accountNodeId.toString(),\n );\n\n // And the client has an operator\n if (this._operator != null) {\n // Generate the payment transaction ID\n this._paymentTransactionId = TransactionId.generate(\n this._operator.accountId,\n );\n } else {\n // If payment is required, but an operator did not exist, throw an error\n throw new Error(\n \"`client` must have an `operator` or an explicit payment transaction must be provided\",\n );\n }\n } else {\n // If the payment transaction ID is not set, but this query doesn't require a payment\n // set the payment transaction ID to an empty transaction ID.\n // FIXME: Should use `TransactionId.withValidStart()` instead\n this._paymentTransactionId = TransactionId.generate(\n new AccountId(0),\n );\n }\n\n let cost = new Hbar(0);\n\n const maxQueryPayment =\n this._maxQueryPayment != null\n ? this._maxQueryPayment\n : client.defaultMaxQueryPayment;\n\n if (this._queryPayment != null) {\n cost = this._queryPayment;\n } else if (\n this._paymentTransactions.length === 0 &&\n this._isPaymentRequired()\n ) {\n // If the query payment was not explictly set, fetch the actual cost.\n const actualCost = await this.getCost(client);\n\n // Confirm it's less than max query payment\n if (\n maxQueryPayment.toTinybars().toInt() <\n actualCost.toTinybars().toInt()\n ) {\n throw new MaxQueryPaymentExceeded(actualCost, maxQueryPayment);\n }\n\n cost = actualCost;\n if (this._logger) {\n this._logger.debug(\n `[${this._getLogId()}] received cost for query ${cost.toString()}`,\n );\n }\n }\n\n // Set the either queried cost, or the original value back into `queryPayment`\n // in case a user executes same query multiple times. However, users should\n // really not be executing the same query multiple times meaning this is\n // typically not needed.\n this._queryPayment = cost;\n\n // Not sure if we should be overwritting this field tbh.\n this._timestamp = Date.now();\n\n this._nodeAccountIds.setLocked();\n\n // Generate the payment transactions\n for (const nodeId of this._nodeAccountIds.list) {\n const logId = this._getLogId();\n const paymentTransactionId =\n /** @type {import(\"../transaction/TransactionId.js\").default} */ (\n this._paymentTransactionId\n );\n const paymentAmount = /** @type {Hbar} */ (this._queryPayment);\n\n if (this._logger) {\n this._logger.debug(\n `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`,\n );\n }\n\n this._paymentTransactions.push(\n await this._makePaymentTransaction(\n paymentTransactionId,\n nodeId,\n this._isPaymentRequired() ? this._operator : null,\n paymentAmount,\n ),\n );\n }\n }\n\n /**\n * @abstract\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @returns {HieroProto.proto.IResponseHeader}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponseHeader(response) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @protected\n * @returns {HieroProto.proto.IQueryHeader}\n */\n _makeRequestHeader() {\n /** @type {HieroProto.proto.IQueryHeader} */\n let header = {};\n\n if (this._isPaymentRequired() && this._paymentTransactions.length > 0) {\n header = {\n responseType: HieroProto.proto.ResponseType.ANSWER_ONLY,\n payment: this._paymentTransactions[this._nodeAccountIds.index],\n };\n }\n\n return header;\n }\n\n /**\n * @abstract\n * @internal\n * @param {HieroProto.proto.IQueryHeader} header\n * @returns {HieroProto.proto.IQuery}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _onMakeRequest(header) {\n throw new Error(\"not implemented\");\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.IQuery}\n */\n _makeRequest() {\n /** @type {HieroProto.proto.IQueryHeader} */\n let header = {};\n\n if (this._isPaymentRequired() && this._paymentTransactions != null) {\n header = {\n payment: this._paymentTransactions[this._nodeAccountIds.index],\n responseType: HieroProto.proto.ResponseType.ANSWER_ONLY,\n };\n }\n\n return this._onMakeRequest(header);\n }\n\n /**\n * @override\n * @internal\n * @returns {Promise<HieroProto.proto.IQuery>}\n */\n async _makeRequestAsync() {\n /** @type {HieroProto.proto.IQueryHeader} */\n let header = {\n responseType: HieroProto.proto.ResponseType.ANSWER_ONLY,\n };\n\n const logId = this._getLogId();\n const nodeId = this._nodeAccountIds.current;\n const paymentTransactionId = TransactionId.generate(\n this._operator ? this._operator.accountId : new AccountId(0),\n );\n const paymentAmount = /** @type {Hbar} */ (this._queryPayment);\n\n if (this._logger) {\n this._logger.debug(\n `[${logId}] making a payment transaction for node ${nodeId.toString()} and transaction ID ${paymentTransactionId.toString()} with amount ${paymentAmount.toString()}`,\n );\n }\n\n header.payment = await this._makePaymentTransaction(\n paymentTransactionId,\n nodeId,\n this._isPaymentRequired() ? this._operator : null,\n paymentAmount,\n );\n\n return this._onMakeRequest(header);\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IQuery} request\n * @param {HieroProto.proto.IResponse} response\n * @returns {[Status, ExecutionState]}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _shouldRetry(request, response) {\n const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n const status = Status._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : HieroProto.proto.ResponseCodeEnum.OK,\n );\n if (this._logger) {\n this._logger.debug(\n `[${this._getLogId()}] received status ${status.toString()}`,\n );\n }\n\n switch (status) {\n case Status.Busy:\n case Status.Unknown:\n case Status.PlatformTransactionNotCreated:\n case Status.PlatformNotActive:\n return [status, ExecutionState.Retry];\n case Status.Ok:\n return [status, ExecutionState.Finished];\n default:\n return [status, ExecutionState.Error];\n }\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IQuery} request\n * @param {HieroProto.proto.IResponse} 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 const { nodeTransactionPrecheckCode } =\n this._mapResponseHeader(response);\n\n const status = Status._fromCode(\n nodeTransactionPrecheckCode != null\n ? nodeTransactionPrecheckCode\n : HieroProto.proto.ResponseCodeEnum.OK,\n );\n\n return new PrecheckStatusError({\n nodeId,\n status,\n transactionId: this._getTransactionId(),\n contractFunctionResult: null,\n });\n }\n\n /**\n * @param {HieroProto.proto.Query} request\n * @returns {Uint8Array}\n */\n _requestToBytes(request) {\n return HieroProto.proto.Query.encode(request).finish();\n }\n\n /**\n * @param {HieroProto.proto.Response} response\n * @returns {Uint8Array}\n */\n _responseToBytes(response) {\n return HieroProto.proto.Response.encode(response).finish();\n }\n}\n"],"names":["QUERY_REGISTRY","Map","Query","QueryBase","constructor","super","this","_paymentTransactionId","_paymentTransactions","_queryPayment","_maxQueryPayment","_timestamp","Date","now","fromBytes","bytes","query","HieroProto","proto","decode","Error","fromProtobuf","get","toBytes","encode","_makeRequest","finish","setQueryPayment","queryPayment","setMaxQueryPayment","maxQueryPayment","getCost","client","_nodeAccountIds","isEmpty","setList","_network","getNodeAccountIdsForExecute","cost","CostQuery","execute","Hbar","fromTinybars","_valueInTinybar","multipliedBy","toFixed","setPaymentTransactionId","paymentTransactionId","_getTransactionId","_isPaymentRequired","_validateChecksums","_beforeExecute","length","isAutoValidateChecksumsEnabled","_operator","transactionNodeIds","Object","values","network","map","accountNodeId","toString","TransactionId","generate","accountId","AccountId","defaultMaxQueryPayment","actualCost","toTinybars","toInt","MaxQueryPaymentExceeded","_logger","debug","_getLogId","setLocked","nodeId","list","logId","paymentAmount","push","_makePaymentTransaction","_mapResponseHeader","response","_makeRequestHeader","header","responseType","ResponseType","ANSWER_ONLY","payment","index","_onMakeRequest","_makeRequestAsync","current","_shouldRetry","request","nodeTransactionPrecheckCode","status","Status","_fromCode","ResponseCodeEnum","OK","Busy","Unknown","PlatformTransactionNotCreated","PlatformNotActive","ExecutionState","Retry","Ok","Finished","_mapStatusError","PrecheckStatusError","transactionId","contractFunctionResult","_requestToBytes","_responseToBytes","Response"],"mappings":"mXA6BY,MAACA,EAAiB,IAAIC,IASnB,MAAMC,UAAcC,EAC/B,WAAAC,GACIC,QAOAC,KAAKC,sBAAwB,KAO7BD,KAAKE,qBAAuB,GAQ5BF,KAAKG,cAAgB,KAUrBH,KAAKI,iBAAmB,KASxBJ,KAAKK,WAAaC,KAAKC,KAC/B,CASI,gBAAOC,CAAUC,GACb,MAAMC,EAAQC,EAAWC,MAAMhB,MAAMiB,OAAOJ,GAE5C,GAAmB,MAAfC,EAAMA,MACN,MAAM,IAAII,MAAM,iDAGpB,MAAMC,EAEErB,EAAesB,IAAIN,EAAMA,OAGjC,GAAoB,MAAhBK,EACA,MAAM,IAAID,MACN,oDAAoDJ,EAAMA,SAIlE,OAAOK,EAAaL,EAC5B,CASI,OAAAO,GACI,OAAON,EAAWC,MAAMhB,MAAMsB,OAAOlB,KAAKmB,gBAAgBC,QAClE,CAWI,eAAAC,CAAgBC,GAGZ,OAFAtB,KAAKG,cAAgBmB,EAEdtB,IACf,CAQI,kBAAAuB,CAAmBC,GAGf,OAFAxB,KAAKI,iBAAmBoB,EAEjBxB,IACf,CAQI,aAAMyB,CAAQC,GAEN1B,K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AgBnB,GACZ,OAAO7E,EAAWC,MAAMhB,MAAMsB,OAAOsE,GAASpE,QACtD,CAMI,gBAAAwF,CAAiBhC,GACb,OAAOjE,EAAWC,MAAMiG,SAAS3F,OAAO0D,GAAUxD,QAC1D"}
@@ -9,8 +9,7 @@ var _Hbar = _interopRequireDefault(require("../Hbar.cjs"));
9
9
  var _AccountId = _interopRequireDefault(require("../account/AccountId.cjs"));
10
10
  var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
11
11
  var _long = _interopRequireDefault(require("long"));
12
- 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); }
13
- 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; }
12
+ 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); }
14
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
14
  // SPDX-License-Identifier: Apache-2.0
16
15
 
@@ -10,8 +10,7 @@ var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.c
10
10
  var _Key = _interopRequireDefault(require("../Key.cjs"));
11
11
  var _Hbar = _interopRequireDefault(require("../Hbar.cjs"));
12
12
  var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
13
- 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); }
14
- 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; }
13
+ 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); }
15
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
15
  // SPDX-License-Identifier: Apache-2.0
17
16
 
@@ -1,2 +1,2 @@
1
- import e from"../Timestamp.js";import t from"../account/AccountId.js";import i,{TRANSACTION_REGISTRY as r,SCHEDULE_CREATE_TRANSACTION as n}from"../transaction/Transaction.js";import o from"../Key.js";import s from"../Hbar.js";import*as a from"@hashgraph/proto";class u extends i{constructor(e={}){super(),this._adminKey=null,this._scheduledTransaction=null,this._payerAccountId=null,this._scheduleMemo=null,this._scheduledSignerPublicKeys=new Set,this._expirationTime=null,this._waitForExpiry=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.payerAccountID&&this.setPayerAccountId(e.payerAccountID),null!=e.scheduleMemo&&this.setScheduleMemo(e.scheduleMemo),this._defaultMaxTransactionFee=new s(5)}static _fromProtobuf(r,n,s,c,d){const h=d[0],l=h.scheduleCreate,m=new u({adminKey:null!=l.adminKey?o._fromProtobufKey(l.adminKey):void 0,payerAccountID:null!=l.payerAccountID?t._fromProtobuf(l.payerAccountID):void 0,scheduleMemo:null!=l.memo?l.memo:void 0,waitForExpiry:null!=l.waitForExpiry?l.waitForExpiry:void 0,expirationTime:null!=l.expirationTime?e._fromProtobuf(l.expirationTime):void 0});if(null!=h.scheduleCreate){const e=h.scheduleCreate.scheduledTransactionBody,t=a.proto.TransactionBody.encode(e).finish(),r={signedTransactionBytes:a.proto.SignedTransaction.encode({bodyBytes:t}).finish()},n=a.proto.TransactionList.encode({transactionList:[r]}).finish(),o=i.fromBytes(n);m._setScheduledTransaction(o)}return i._fromProtobufTransactions(m,r,n,s,c,d)}_setScheduledTransaction(e){return this._scheduledTransaction=e,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get payerAccountId(){return this._payerAccountId}setPayerAccountId(e){return this._requireNotFrozen(),this._payerAccountId=e,this}setScheduleMemo(e){return this._requireNotFrozen(),this._scheduleMemo=e,this}get getScheduleMemo(){return this._requireNotFrozen(),this._scheduleMemo}setScheduledTransaction(e){return this._requireNotFrozen(),e._requireNotFrozen(),this._scheduledTransaction=e.schedule()._scheduledTransaction,this}_validateChecksums(e){null!=this._payerAccountId&&this._payerAccountId.validateChecksum(e)}_execute(e,t){return e.schedule.createSchedule(t)}_getTransactionDataCase(){return"scheduleCreate"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,payerAccountID:null!=this._payerAccountId?this._payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this._scheduledTransaction?this._scheduledTransaction._getScheduledTransactionBody():null,memo:this._scheduleMemo,waitForExpiry:this._waitForExpiry,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`ScheduleCreateTransaction:${this._transactionIds.current.validStart.toString()}`}setExpirationTime(e){return this._expirationTime=e,this}get expirationTime(){return this._requireNotFrozen(),this._expirationTime}setWaitForExpiry(e){return this._waitForExpiry=e,this}get waitForExpiry(){return this._requireNotFrozen(),this._waitForExpiry}}r.set("scheduleCreate",u._fromProtobuf),n.push((()=>new u));export{u as default};
1
+ import e from"../Timestamp.js";import t from"../account/AccountId.js";import i,{TRANSACTION_REGISTRY as r,SCHEDULE_CREATE_TRANSACTION as n}from"../transaction/Transaction.js";import o from"../Key.js";import s from"../Hbar.js";import*as a from"@hashgraph/proto";class u extends i{constructor(e={}){super(),this._adminKey=null,this._scheduledTransaction=null,this._payerAccountId=null,this._scheduleMemo=null,this._scheduledSignerPublicKeys=new Set,this._expirationTime=null,this._waitForExpiry=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.payerAccountID&&this.setPayerAccountId(e.payerAccountID),null!=e.scheduleMemo&&this.setScheduleMemo(e.scheduleMemo),this._defaultMaxTransactionFee=new s(5)}static _fromProtobuf(r,n,s,c,d){const h=d[0],l=h.scheduleCreate,m=new u({adminKey:null!=l.adminKey?o._fromProtobufKey(l.adminKey):void 0,payerAccountID:null!=l.payerAccountID?t._fromProtobuf(l.payerAccountID):void 0,scheduleMemo:null!=l.memo?l.memo:void 0,waitForExpiry:null!=l.waitForExpiry?l.waitForExpiry:void 0,expirationTime:null!=l.expirationTime?e._fromProtobuf(l.expirationTime):void 0});if(null!=h.scheduleCreate){const e=h.scheduleCreate.scheduledTransactionBody,t=a.proto.TransactionBody.encode(e).finish(),r={signedTransactionBytes:a.proto.SignedTransaction.encode({bodyBytes:t}).finish()},n=a.proto.TransactionList.encode({transactionList:[r]}).finish(),o=i.fromBytes(n);m._setScheduledTransaction(o)}return i._fromProtobufTransactions(m,r,n,s,c,d)}_setScheduledTransaction(e){return this._scheduledTransaction=e,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get payerAccountId(){return this._payerAccountId}setPayerAccountId(e){return this._requireNotFrozen(),this._payerAccountId=e,this}setScheduleMemo(e){return this._requireNotFrozen(),this._scheduleMemo=e,this}get getScheduleMemo(){return this._requireNotFrozen(),this._scheduleMemo}setScheduledTransaction(e){return this._requireNotFrozen(),e._requireNotFrozen(),this._scheduledTransaction=e.schedule()._scheduledTransaction,this}_validateChecksums(e){null!=this._payerAccountId&&this._payerAccountId.validateChecksum(e)}_execute(e,t){return e.schedule.createSchedule(t)}_getTransactionDataCase(){return"scheduleCreate"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,payerAccountID:null!=this._payerAccountId?this._payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this._scheduledTransaction?this._scheduledTransaction._getScheduledTransactionBody():null,memo:this._scheduleMemo,waitForExpiry:this._waitForExpiry,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`ScheduleCreateTransaction:${this._transactionIds.current.validStart.toString()}`}setExpirationTime(e){return this._expirationTime=e,this}get expirationTime(){return this._requireNotFrozen(),this._expirationTime}setWaitForExpiry(e){return this._waitForExpiry=e,this}get waitForExpiry(){return this._requireNotFrozen(),this._waitForExpiry}}r.set("scheduleCreate",u._fromProtobuf),n.push(()=>new u);export{u as default};
2
2
  //# sourceMappingURL=ScheduleCreateTransaction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScheduleCreateTransaction.js","sources":["../../src/schedule/ScheduleCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Timestamp from \"../Timestamp.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n SCHEDULE_CREATE_TRANSACTION,\n} from \"../transaction/Transaction.js\";\nimport Key from \"../Key.js\";\nimport Hbar from \"../Hbar.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../PrivateKey.js\").default} PrivateKey\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nexport default class ScheduleCreateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {Key} [props.adminKey]\n * @param {AccountId} [props.payerAccountID]\n * @param {string} [props.scheduleMemo]\n * @param {Timestamp} [props.expirationTime]\n * @param {boolean} [props.waitForExpiry]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Transaction}\n */\n this._scheduledTransaction = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._payerAccountId = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._scheduleMemo = null;\n\n /**\n * @private\n * @type {Set<string>}\n */\n this._scheduledSignerPublicKeys = new Set();\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._waitForExpiry = null;\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.payerAccountID != null) {\n this.setPayerAccountId(props.payerAccountID);\n }\n\n if (props.scheduleMemo != null) {\n this.setScheduleMemo(props.scheduleMemo);\n }\n\n this._defaultMaxTransactionFee = new Hbar(5);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {ScheduleCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const create =\n /** @type {HieroProto.proto.IScheduleCreateTransactionBody} */ (\n body.scheduleCreate\n );\n\n const scheduledTransaction = new ScheduleCreateTransaction({\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n payerAccountID:\n create.payerAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n create.payerAccountID\n ),\n )\n : undefined,\n scheduleMemo: create.memo != null ? create.memo : undefined,\n waitForExpiry:\n create.waitForExpiry != null ? create.waitForExpiry : undefined,\n expirationTime:\n create.expirationTime != null\n ? Timestamp._fromProtobuf(create.expirationTime)\n : undefined,\n });\n if (body.scheduleCreate != null) {\n const scheduleCreateBody =\n body.scheduleCreate.scheduledTransactionBody;\n\n const scheduleCreateBodyBytes =\n HieroProto.proto.TransactionBody.encode(\n // @ts-ignore\n scheduleCreateBody,\n ).finish();\n\n const signedScheduledCreateTransaction =\n HieroProto.proto.SignedTransaction.encode({\n bodyBytes: scheduleCreateBodyBytes,\n }).finish();\n\n const scheduleCreatetransaction = {\n signedTransactionBytes: signedScheduledCreateTransaction,\n };\n\n const txlist = HieroProto.proto.TransactionList.encode({\n transactionList: [scheduleCreatetransaction],\n }).finish();\n\n const finalScheduledDecodedTx = Transaction.fromBytes(txlist);\n\n scheduledTransaction._setScheduledTransaction(\n finalScheduledDecodedTx,\n );\n }\n\n return Transaction._fromProtobufTransactions(\n scheduledTransaction,\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @internal\n * @param {Transaction} tx\n * @returns {this}\n */\n _setScheduledTransaction(tx) {\n this._scheduledTransaction = tx;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * Set the key for this account.\n *\n * This is the key that must sign each transfer out of the account.\n *\n * If `receiverSignatureRequired` is true, then the key must also sign\n * any transfer into the account.\n *\n * @param {Key} key\n * @returns {this}\n */\n setAdminKey(key) {\n this._requireNotFrozen();\n this._adminKey = key;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get payerAccountId() {\n return this._payerAccountId;\n }\n\n /**\n * @param {AccountId} account\n * @returns {this}\n */\n setPayerAccountId(account) {\n this._requireNotFrozen();\n this._payerAccountId = account;\n\n return this;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setScheduleMemo(memo) {\n this._requireNotFrozen();\n this._scheduleMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get getScheduleMemo() {\n this._requireNotFrozen();\n return this._scheduleMemo;\n }\n\n /**\n * @param {Transaction} transaction\n * @returns {this}\n */\n setScheduledTransaction(transaction) {\n this._requireNotFrozen();\n transaction._requireNotFrozen();\n\n this._scheduledTransaction =\n transaction.schedule()._scheduledTransaction;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._payerAccountId != null) {\n this._payerAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.schedule.createSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"scheduleCreate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IScheduleCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n payerAccountID:\n this._payerAccountId != null\n ? this._payerAccountId._toProtobuf()\n : null,\n scheduledTransactionBody:\n this._scheduledTransaction != null\n ? this._scheduledTransaction._getScheduledTransactionBody()\n : null,\n memo: this._scheduleMemo,\n waitForExpiry: this._waitForExpiry,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ScheduleCreateTransaction:${timestamp.toString()}`;\n }\n\n /**\n * @param {?Timestamp} expirationTime\n * @returns {this}\n */\n setExpirationTime(expirationTime) {\n this._expirationTime = expirationTime;\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n this._requireNotFrozen();\n return this._expirationTime;\n }\n\n /**\n * @param {boolean} waitForExpiry\n * @returns {this}\n */\n setWaitForExpiry(waitForExpiry) {\n this._waitForExpiry = waitForExpiry;\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get waitForExpiry() {\n this._requireNotFrozen();\n return this._waitForExpiry;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"scheduleCreate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ScheduleCreateTransaction._fromProtobuf,\n);\n\nSCHEDULE_CREATE_TRANSACTION.push(() => new ScheduleCreateTransaction());\n"],"names":["ScheduleCreateTransaction","Transaction","constructor","props","super","this","_adminKey","_scheduledTransaction","_payerAccountId","_scheduleMemo","_scheduledSignerPublicKeys","Set","_expirationTime","_waitForExpiry","adminKey","setAdminKey","payerAccountID","setPayerAccountId","scheduleMemo","setScheduleMemo","_defaultMaxTransactionFee","Hbar","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","body","create","scheduledTransaction","Key","_fromProtobufKey","undefined","AccountId","memo","waitForExpiry","expirationTime","Timestamp","scheduleCreate","scheduleCreateBody","scheduledTransactionBody","scheduleCreateBodyBytes","HieroProto","proto","TransactionBody","encode","finish","scheduleCreatetransaction","signedTransactionBytes","SignedTransaction","bodyBytes","txlist","TransactionList","transactionList","finalScheduledDecodedTx","fromBytes","_setScheduledTransaction","_fromProtobufTransactions","tx","key","_requireNotFrozen","payerAccountId","account","getScheduleMemo","setScheduledTransaction","transaction","schedule","_validateChecksums","client","validateChecksum","_execute","channel","request","createSchedule","_getTransactionDataCase","_makeTransactionData","_toProtobufKey","_toProtobuf","_getScheduledTransactionBody","_getLogId","_transactionIds","current","toString","setExpirationTime","setWaitForExpiry","TRANSACTION_REGISTRY","set","SCHEDULE_CREATE_TRANSACTION","push"],"mappings":"qQAwBe,MAAMA,UAAkCC,EASnD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,UAAY,KAMjBD,KAAKE,sBAAwB,KAM7BF,KAAKG,gBAAkB,KAMvBH,KAAKI,cAAgB,KAMrBJ,KAAKK,2BAA6B,IAAIC,IAMtCN,KAAKO,gBAAkB,KAMvBP,KAAKQ,eAAiB,KAEA,MAAlBV,EAAMW,UACNT,KAAKU,YAAYZ,EAAMW,UAGC,MAAxBX,EAAMa,gBACNX,KAAKY,kBAAkBd,EAAMa,gBAGP,MAAtBb,EAAMe,cACNb,KAAKc,gBAAgBhB,EAAMe,cAG/Bb,KAAKe,0BAA4B,IAAIC,EAAK,EAClD,CAWI,oBAAOC,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAOD,EAAO,GACdE,EAEED,EACH,eAECE,EAAuB,IAAI9B,EAA0B,CACvDc,SACuB,MAAnBe,EAAOf,SACDiB,EAAIC,iBAAiBH,EAAOf,eAC5BmB,EACVjB,eAC6B,MAAzBa,EAAOb,eACDkB,EAAUZ,cAEFO,EAC9B,qBAEsBI,EACVf,aAA6B,MAAfW,EAAOM,KAAeN,EAAOM,UAAOF,EAClDG,cAC4B,MAAxBP,EAAOO,cAAwBP,EAAOO,mBAAgBH,EAC1DI,eAC6B,MAAzBR,EAAOQ,eACDC,EAAUhB,cAAcO,EAAOQ,qBAC/BJ,IAEd,GAA2B,MAAvBL,EAAKW,eAAwB,CAC7B,MAAMC,EACFZ,EAAKW,eAAeE,yBAElBC,EACFC,EAAWC,MAAMC,gBA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rC,yBACkC,MAA9BpC,KAAKE,sBACCF,KAAKE,sBAAsBwE,+BAC3B,KACV5C,KAAM9B,KAAKI,cACX2B,cAAe/B,KAAKQ,eACpBwB,eAC4B,MAAxBhC,KAAKO,gBACCP,KAAKO,gBAAgBkE,cACrB,KAEtB,CAKI,SAAAE,GAII,MAAO,6BAFH3E,KAAK4E,gBAAgBC,QACxB,WAC6CC,YACtD,CAMI,iBAAAC,CAAkB/C,GAEd,OADAhC,KAAKO,gBAAkByB,EAChBhC,IACf,CAKI,kBAAIgC,GAEA,OADAhC,KAAKwD,oBACExD,KAAKO,eACpB,CAMI,gBAAAyE,CAAiBjD,GAGb,OAFA/B,KAAKQ,eAAiBuB,EAEf/B,IACf,CAKI,iBAAI+B,GAEA,OADA/B,KAAKwD,oBACExD,KAAKQ,cACpB,EAGAyE,EAAqBC,IACjB,iBAEAvF,EAA0BsB,eAG9BkE,EAA4BC,MAAK,IAAM,IAAIzF"}
1
+ {"version":3,"file":"ScheduleCreateTransaction.js","sources":["../../src/schedule/ScheduleCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Timestamp from \"../Timestamp.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n SCHEDULE_CREATE_TRANSACTION,\n} from \"../transaction/Transaction.js\";\nimport Key from \"../Key.js\";\nimport Hbar from \"../Hbar.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../PrivateKey.js\").default} PrivateKey\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nexport default class ScheduleCreateTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {Key} [props.adminKey]\n * @param {AccountId} [props.payerAccountID]\n * @param {string} [props.scheduleMemo]\n * @param {Timestamp} [props.expirationTime]\n * @param {boolean} [props.waitForExpiry]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Transaction}\n */\n this._scheduledTransaction = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._payerAccountId = null;\n\n /**\n * @private\n * @type {?string}\n */\n this._scheduleMemo = null;\n\n /**\n * @private\n * @type {Set<string>}\n */\n this._scheduledSignerPublicKeys = new Set();\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._expirationTime = null;\n\n /**\n * @private\n * @type {?boolean}\n */\n this._waitForExpiry = null;\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.payerAccountID != null) {\n this.setPayerAccountId(props.payerAccountID);\n }\n\n if (props.scheduleMemo != null) {\n this.setScheduleMemo(props.scheduleMemo);\n }\n\n this._defaultMaxTransactionFee = new Hbar(5);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {ScheduleCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const create =\n /** @type {HieroProto.proto.IScheduleCreateTransactionBody} */ (\n body.scheduleCreate\n );\n\n const scheduledTransaction = new ScheduleCreateTransaction({\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n payerAccountID:\n create.payerAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n create.payerAccountID\n ),\n )\n : undefined,\n scheduleMemo: create.memo != null ? create.memo : undefined,\n waitForExpiry:\n create.waitForExpiry != null ? create.waitForExpiry : undefined,\n expirationTime:\n create.expirationTime != null\n ? Timestamp._fromProtobuf(create.expirationTime)\n : undefined,\n });\n if (body.scheduleCreate != null) {\n const scheduleCreateBody =\n body.scheduleCreate.scheduledTransactionBody;\n\n const scheduleCreateBodyBytes =\n HieroProto.proto.TransactionBody.encode(\n // @ts-ignore\n scheduleCreateBody,\n ).finish();\n\n const signedScheduledCreateTransaction =\n HieroProto.proto.SignedTransaction.encode({\n bodyBytes: scheduleCreateBodyBytes,\n }).finish();\n\n const scheduleCreatetransaction = {\n signedTransactionBytes: signedScheduledCreateTransaction,\n };\n\n const txlist = HieroProto.proto.TransactionList.encode({\n transactionList: [scheduleCreatetransaction],\n }).finish();\n\n const finalScheduledDecodedTx = Transaction.fromBytes(txlist);\n\n scheduledTransaction._setScheduledTransaction(\n finalScheduledDecodedTx,\n );\n }\n\n return Transaction._fromProtobufTransactions(\n scheduledTransaction,\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @internal\n * @param {Transaction} tx\n * @returns {this}\n */\n _setScheduledTransaction(tx) {\n this._scheduledTransaction = tx;\n\n return this;\n }\n\n /**\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * Set the key for this account.\n *\n * This is the key that must sign each transfer out of the account.\n *\n * If `receiverSignatureRequired` is true, then the key must also sign\n * any transfer into the account.\n *\n * @param {Key} key\n * @returns {this}\n */\n setAdminKey(key) {\n this._requireNotFrozen();\n this._adminKey = key;\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get payerAccountId() {\n return this._payerAccountId;\n }\n\n /**\n * @param {AccountId} account\n * @returns {this}\n */\n setPayerAccountId(account) {\n this._requireNotFrozen();\n this._payerAccountId = account;\n\n return this;\n }\n\n /**\n * @param {string} memo\n * @returns {this}\n */\n setScheduleMemo(memo) {\n this._requireNotFrozen();\n this._scheduleMemo = memo;\n\n return this;\n }\n\n /**\n * @returns {?string}\n */\n get getScheduleMemo() {\n this._requireNotFrozen();\n return this._scheduleMemo;\n }\n\n /**\n * @param {Transaction} transaction\n * @returns {this}\n */\n setScheduledTransaction(transaction) {\n this._requireNotFrozen();\n transaction._requireNotFrozen();\n\n this._scheduledTransaction =\n transaction.schedule()._scheduledTransaction;\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._payerAccountId != null) {\n this._payerAccountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.schedule.createSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"scheduleCreate\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IScheduleCreateTransactionBody}\n */\n _makeTransactionData() {\n return {\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n payerAccountID:\n this._payerAccountId != null\n ? this._payerAccountId._toProtobuf()\n : null,\n scheduledTransactionBody:\n this._scheduledTransaction != null\n ? this._scheduledTransaction._getScheduledTransactionBody()\n : null,\n memo: this._scheduleMemo,\n waitForExpiry: this._waitForExpiry,\n expirationTime:\n this._expirationTime != null\n ? this._expirationTime._toProtobuf()\n : null,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `ScheduleCreateTransaction:${timestamp.toString()}`;\n }\n\n /**\n * @param {?Timestamp} expirationTime\n * @returns {this}\n */\n setExpirationTime(expirationTime) {\n this._expirationTime = expirationTime;\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get expirationTime() {\n this._requireNotFrozen();\n return this._expirationTime;\n }\n\n /**\n * @param {boolean} waitForExpiry\n * @returns {this}\n */\n setWaitForExpiry(waitForExpiry) {\n this._waitForExpiry = waitForExpiry;\n\n return this;\n }\n\n /**\n * @returns {?boolean}\n */\n get waitForExpiry() {\n this._requireNotFrozen();\n return this._waitForExpiry;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"scheduleCreate\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ScheduleCreateTransaction._fromProtobuf,\n);\n\nSCHEDULE_CREATE_TRANSACTION.push(() => new ScheduleCreateTransaction());\n"],"names":["ScheduleCreateTransaction","Transaction","constructor","props","super","this","_adminKey","_scheduledTransaction","_payerAccountId","_scheduleMemo","_scheduledSignerPublicKeys","Set","_expirationTime","_waitForExpiry","adminKey","setAdminKey","payerAccountID","setPayerAccountId","scheduleMemo","setScheduleMemo","_defaultMaxTransactionFee","Hbar","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","body","create","scheduledTransaction","Key","_fromProtobufKey","undefined","AccountId","memo","waitForExpiry","expirationTime","Timestamp","scheduleCreate","scheduleCreateBody","scheduledTransactionBody","scheduleCreateBodyBytes","HieroProto","proto","TransactionBody","encode","finish","scheduleCreatetransaction","signedTransactionBytes","SignedTransaction","bodyBytes","txlist","TransactionList","transactionList","finalScheduledDecodedTx","fromBytes","_setScheduledTransaction","_fromProtobufTransactions","tx","key","_requireNotFrozen","payerAccountId","account","getScheduleMemo","setScheduledTransaction","transaction","schedule","_validateChecksums","client","validateChecksum","_execute","channel","request","createSchedule","_getTransactionDataCase","_makeTransactionData","_toProtobufKey","_toProtobuf","_getScheduledTransactionBody","_getLogId","_transactionIds","current","toString","setExpirationTime","setWaitForExpiry","TRANSACTION_REGISTRY","set","SCHEDULE_CREATE_TRANSACTION","push"],"mappings":"qQAwBe,MAAMA,UAAkCC,EASnD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,UAAY,KAMjBD,KAAKE,sBAAwB,KAM7BF,KAAKG,gBAAkB,KAMvBH,KAAKI,cAAgB,KAMrBJ,KAAKK,2BAA6B,IAAIC,IAM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,CAKI,iBAAI+B,GAEA,OADA/B,KAAKwD,oBACExD,KAAKQ,cACpB,EAGAyE,EAAqBC,IACjB,iBAEAvF,EAA0BsB,eAG9BkE,EAA4BC,KAAK,IAAM,IAAIzF"}
@@ -7,8 +7,7 @@ exports.default = void 0;
7
7
  var _ScheduleId = _interopRequireDefault(require("./ScheduleId.cjs"));
8
8
  var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.cjs"));
9
9
  var _Hbar = _interopRequireDefault(require("../Hbar.cjs"));
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
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
12
  // SPDX-License-Identifier: Apache-2.0
14
13
 
@@ -6,8 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var entity_id = _interopRequireWildcard(require("../EntityIdHelper.cjs"));
8
8
  var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
9
- 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); }
10
- 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; }
9
+ 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); }
11
10
  // SPDX-License-Identifier: Apache-2.0
12
11
 
13
12
  /**
@@ -12,8 +12,7 @@ var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
12
12
  var _TransactionId = _interopRequireDefault(require("../transaction/TransactionId.cjs"));
13
13
  var _Key = _interopRequireDefault(require("../Key.cjs"));
14
14
  var _KeyList = _interopRequireDefault(require("../KeyList.cjs"));
15
- 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); }
16
- 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; }
15
+ 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); }
17
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
17
  // SPDX-License-Identifier: Apache-2.0
19
18