@hiero-ledger/sdk 2.80.0 → 2.81.0

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 (400) hide show
  1. package/README.md +107 -64
  2. package/dist/umd.js +444 -217
  3. package/dist/umd.js.map +1 -0
  4. package/dist/umd.min.js +8 -7
  5. package/dist/umd.min.js.map +1 -0
  6. package/lib/BadEntityIdError.js.map +1 -1
  7. package/lib/Cache.js.map +1 -1
  8. package/lib/Duration.js.map +1 -1
  9. package/lib/EntityIdHelper.js.map +1 -1
  10. package/lib/EthereumFlow.js.map +1 -1
  11. package/lib/EthereumTransaction.d.ts +4 -0
  12. package/lib/EthereumTransaction.js.map +1 -1
  13. package/lib/EthereumTransactionData.js.map +1 -1
  14. package/lib/EthereumTransactionDataEip1559.js.map +1 -1
  15. package/lib/EthereumTransactionDataEip2930.js.map +1 -1
  16. package/lib/EthereumTransactionDataEip7702.js.map +1 -1
  17. package/lib/EthereumTransactionDataLegacy.js.map +1 -1
  18. package/lib/EvmAddress.js.map +1 -1
  19. package/lib/ExchangeRate.js.map +1 -1
  20. package/lib/ExchangeRates.js.map +1 -1
  21. package/lib/Executable.cjs +8 -5
  22. package/lib/Executable.js +1 -1
  23. package/lib/Executable.js.map +1 -1
  24. package/lib/FeeComponents.js.map +1 -1
  25. package/lib/FeeData.js.map +1 -1
  26. package/lib/FeeDataType.js.map +1 -1
  27. package/lib/FeeSchedule.js.map +1 -1
  28. package/lib/FeeSchedules.js.map +1 -1
  29. package/lib/FreezeType.js.map +1 -1
  30. package/lib/Hbar.js.map +1 -1
  31. package/lib/HbarUnit.js.map +1 -1
  32. package/lib/Key.js.map +1 -1
  33. package/lib/KeyList.js.map +1 -1
  34. package/lib/LedgerId.js.map +1 -1
  35. package/lib/LocalProvider.js.map +1 -1
  36. package/lib/LocalProviderWeb.js.map +1 -1
  37. package/lib/ManagedNode.js.map +1 -1
  38. package/lib/ManagedNodeAddress.js.map +1 -1
  39. package/lib/MaxAttemptsOrTimeoutError.js.map +1 -1
  40. package/lib/MaxQueryPaymentExceeded.js.map +1 -1
  41. package/lib/MirrorNode.js.map +1 -1
  42. package/lib/Mnemonic.js.map +1 -1
  43. package/lib/Node.js.map +1 -1
  44. package/lib/ObjectMap.js.map +1 -1
  45. package/lib/PrecheckStatusError.js.map +1 -1
  46. package/lib/PrivateKey.js.map +1 -1
  47. package/lib/PrngTransaction.d.ts +4 -0
  48. package/lib/PrngTransaction.js.map +1 -1
  49. package/lib/Provider.js.map +1 -1
  50. package/lib/PublicKey.js.map +1 -1
  51. package/lib/ReceiptStatusError.js.map +1 -1
  52. package/lib/RecordStatusError.js.map +1 -1
  53. package/lib/RequestType.js.map +1 -1
  54. package/lib/Signer.js.map +1 -1
  55. package/lib/SignerSignature.js.map +1 -1
  56. package/lib/StakingInfo.js.map +1 -1
  57. package/lib/Status.js.map +1 -1
  58. package/lib/StatusError.js.map +1 -1
  59. package/lib/Timestamp.js.map +1 -1
  60. package/lib/TransactionFeeSchedule.js.map +1 -1
  61. package/lib/Transfer.js.map +1 -1
  62. package/lib/Wallet.js.map +1 -1
  63. package/lib/account/AccountAllowanceAdjustTransaction.cjs +2 -1
  64. package/lib/account/AccountAllowanceAdjustTransaction.d.ts +4 -2
  65. package/lib/account/AccountAllowanceAdjustTransaction.js.map +1 -1
  66. package/lib/account/AccountAllowanceApproveTransaction.cjs +2 -1
  67. package/lib/account/AccountAllowanceApproveTransaction.d.ts +4 -2
  68. package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -1
  69. package/lib/account/AccountAllowanceDeleteTransaction.cjs +2 -1
  70. package/lib/account/AccountAllowanceDeleteTransaction.d.ts +4 -2
  71. package/lib/account/AccountAllowanceDeleteTransaction.js.map +1 -1
  72. package/lib/account/AccountBalance.cjs +6 -15
  73. package/lib/account/AccountBalance.d.ts +2 -2
  74. package/lib/account/AccountBalance.js +1 -1
  75. package/lib/account/AccountBalance.js.map +1 -1
  76. package/lib/account/AccountBalanceQuery.cjs +5 -10
  77. package/lib/account/AccountBalanceQuery.d.ts +15 -2
  78. package/lib/account/AccountBalanceQuery.js +1 -1
  79. package/lib/account/AccountBalanceQuery.js.map +1 -1
  80. package/lib/account/AccountCreateTransaction.cjs +2 -1
  81. package/lib/account/AccountCreateTransaction.d.ts +4 -2
  82. package/lib/account/AccountCreateTransaction.js.map +1 -1
  83. package/lib/account/AccountDeleteTransaction.cjs +2 -1
  84. package/lib/account/AccountDeleteTransaction.d.ts +4 -2
  85. package/lib/account/AccountDeleteTransaction.js.map +1 -1
  86. package/lib/account/AccountId.js.map +1 -1
  87. package/lib/account/AccountInfo.js.map +1 -1
  88. package/lib/account/AccountInfoFlow.js.map +1 -1
  89. package/lib/account/AccountInfoQuery.cjs +2 -1
  90. package/lib/account/AccountInfoQuery.d.ts +8 -2
  91. package/lib/account/AccountInfoQuery.js.map +1 -1
  92. package/lib/account/AccountRecordsQuery.cjs +2 -1
  93. package/lib/account/AccountRecordsQuery.d.ts +8 -2
  94. package/lib/account/AccountRecordsQuery.js.map +1 -1
  95. package/lib/account/AccountUpdateTransaction.cjs +2 -1
  96. package/lib/account/AccountUpdateTransaction.d.ts +4 -2
  97. package/lib/account/AccountUpdateTransaction.js.map +1 -1
  98. package/lib/account/HbarAllowance.cjs +3 -1
  99. package/lib/account/HbarAllowance.d.ts +6 -2
  100. package/lib/account/HbarAllowance.js.map +1 -1
  101. package/lib/account/HbarTransferMap.js.map +1 -1
  102. package/lib/account/LiveHash.js.map +1 -1
  103. package/lib/account/LiveHashAddTransaction.cjs +2 -1
  104. package/lib/account/LiveHashAddTransaction.d.ts +4 -2
  105. package/lib/account/LiveHashAddTransaction.js.map +1 -1
  106. package/lib/account/LiveHashDeleteTransaction.cjs +2 -1
  107. package/lib/account/LiveHashDeleteTransaction.d.ts +4 -2
  108. package/lib/account/LiveHashDeleteTransaction.js.map +1 -1
  109. package/lib/account/LiveHashQuery.cjs +2 -1
  110. package/lib/account/LiveHashQuery.d.ts +8 -2
  111. package/lib/account/LiveHashQuery.js.map +1 -1
  112. package/lib/account/NullableTokenDecimalMap.js.map +1 -1
  113. package/lib/account/ProxyStaker.js.map +1 -1
  114. package/lib/account/TokenAllowance.cjs +3 -1
  115. package/lib/account/TokenAllowance.d.ts +6 -2
  116. package/lib/account/TokenAllowance.js.map +1 -1
  117. package/lib/account/TokenBalanceMap.js.map +1 -1
  118. package/lib/account/TokenDecimalMap.js.map +1 -1
  119. package/lib/account/TokenNftAllowance.cjs +3 -1
  120. package/lib/account/TokenNftAllowance.d.ts +6 -2
  121. package/lib/account/TokenNftAllowance.js.map +1 -1
  122. package/lib/account/TokenNftTransferMap.js.map +1 -1
  123. package/lib/account/TokenRelationship.js.map +1 -1
  124. package/lib/account/TokenRelationshipMap.js.map +1 -1
  125. package/lib/account/TokenTransferAccountMap.js.map +1 -1
  126. package/lib/account/TokenTransferMap.js.map +1 -1
  127. package/lib/account/TransferTransaction.cjs +6 -5
  128. package/lib/account/TransferTransaction.d.ts +6 -2
  129. package/lib/account/TransferTransaction.js +1 -1
  130. package/lib/account/TransferTransaction.js.map +1 -1
  131. package/lib/address_book/Endpoint.js.map +1 -1
  132. package/lib/address_book/IPv4Address.js.map +1 -1
  133. package/lib/address_book/IPv4AddressPart.js.map +1 -1
  134. package/lib/address_book/NodeAddress.js.map +1 -1
  135. package/lib/address_book/NodeAddressBook.js.map +1 -1
  136. package/lib/base32.js.map +1 -1
  137. package/lib/browser.js +1 -1
  138. package/lib/channel/Channel.js.map +1 -1
  139. package/lib/channel/MirrorChannel.js.map +1 -1
  140. package/lib/channel/NativeChannel.js.map +1 -1
  141. package/lib/channel/NodeChannel.js.map +1 -1
  142. package/lib/channel/NodeMirrorChannel.js.map +1 -1
  143. package/lib/channel/WebChannel.js.map +1 -1
  144. package/lib/client/Client.cjs +38 -0
  145. package/lib/client/Client.d.ts +30 -0
  146. package/lib/client/Client.js +1 -1
  147. package/lib/client/Client.js.map +1 -1
  148. package/lib/client/ManagedNetwork.js.map +1 -1
  149. package/lib/client/MirrorNetwork.js.map +1 -1
  150. package/lib/client/NativeClient.js.map +1 -1
  151. package/lib/client/Network.js.map +1 -1
  152. package/lib/client/NodeClient.js.map +1 -1
  153. package/lib/client/WebClient.js.map +1 -1
  154. package/lib/client/addressbooks/mainnet.cjs +1 -1
  155. package/lib/client/addressbooks/mainnet.d.ts +1 -1
  156. package/lib/client/addressbooks/mainnet.js +1 -1
  157. package/lib/client/addressbooks/mainnet.js.map +1 -1
  158. package/lib/client/addressbooks/previewnet.cjs +1 -1
  159. package/lib/client/addressbooks/previewnet.d.ts +1 -1
  160. package/lib/client/addressbooks/previewnet.js +1 -1
  161. package/lib/client/addressbooks/previewnet.js.map +1 -1
  162. package/lib/client/addressbooks/testnet.cjs +1 -1
  163. package/lib/client/addressbooks/testnet.d.ts +1 -1
  164. package/lib/client/addressbooks/testnet.js +1 -1
  165. package/lib/client/addressbooks/testnet.js.map +1 -1
  166. package/lib/constants/ClientConstants.js.map +1 -1
  167. package/lib/contract/ContractByteCodeQuery.js.map +1 -1
  168. package/lib/contract/ContractCallQuery.js.map +1 -1
  169. package/lib/contract/ContractCreateFlow.js.map +1 -1
  170. package/lib/contract/ContractCreateTransaction.cjs +2 -1
  171. package/lib/contract/ContractCreateTransaction.d.ts +4 -2
  172. package/lib/contract/ContractCreateTransaction.js.map +1 -1
  173. package/lib/contract/ContractDeleteTransaction.cjs +2 -1
  174. package/lib/contract/ContractDeleteTransaction.d.ts +4 -2
  175. package/lib/contract/ContractDeleteTransaction.js.map +1 -1
  176. package/lib/contract/ContractExecuteTransaction.d.ts +4 -0
  177. package/lib/contract/ContractExecuteTransaction.js.map +1 -1
  178. package/lib/contract/ContractFunctionParameters.js.map +1 -1
  179. package/lib/contract/ContractFunctionResult.js.map +1 -1
  180. package/lib/contract/ContractFunctionSelector.js.map +1 -1
  181. package/lib/contract/ContractId.js.map +1 -1
  182. package/lib/contract/ContractInfo.js.map +1 -1
  183. package/lib/contract/ContractInfoQuery.js.map +1 -1
  184. package/lib/contract/ContractLogInfo.js.map +1 -1
  185. package/lib/contract/ContractNonceInfo.js.map +1 -1
  186. package/lib/contract/ContractUpdateTransaction.cjs +2 -1
  187. package/lib/contract/ContractUpdateTransaction.d.ts +4 -2
  188. package/lib/contract/ContractUpdateTransaction.js.map +1 -1
  189. package/lib/contract/DelegateContractId.js.map +1 -1
  190. package/lib/cryptography/keccak.js.map +1 -1
  191. package/lib/encoding/hex.js.map +1 -1
  192. package/lib/file/FileAppendTransaction.cjs +5 -4
  193. package/lib/file/FileAppendTransaction.d.ts +10 -12
  194. package/lib/file/FileAppendTransaction.js.map +1 -1
  195. package/lib/file/FileContentsQuery.js.map +1 -1
  196. package/lib/file/FileCreateTransaction.js.map +1 -1
  197. package/lib/file/FileDeleteTransaction.d.ts +4 -0
  198. package/lib/file/FileDeleteTransaction.js.map +1 -1
  199. package/lib/file/FileId.js.map +1 -1
  200. package/lib/file/FileInfo.js.map +1 -1
  201. package/lib/file/FileInfoQuery.js.map +1 -1
  202. package/lib/file/FileUpdateTransaction.d.ts +4 -0
  203. package/lib/file/FileUpdateTransaction.js.map +1 -1
  204. package/lib/grpc/GrpcServiceError.js.map +1 -1
  205. package/lib/grpc/GrpcStatus.js.map +1 -1
  206. package/lib/http/HttpError.js.map +1 -1
  207. package/lib/http/HttpStatus.js.map +1 -1
  208. package/lib/index.js +1 -1
  209. package/lib/logger/LogLevel.js.map +1 -1
  210. package/lib/logger/Logger.js.map +1 -1
  211. package/lib/native.js +1 -1
  212. package/lib/network/AddressBookQuery.js.map +1 -1
  213. package/lib/network/AddressBookQueryWeb.js.map +1 -1
  214. package/lib/network/NetworkVersionInfo.js.map +1 -1
  215. package/lib/network/NetworkVersionInfoQuery.js.map +1 -1
  216. package/lib/network/SemanticVersion.js.map +1 -1
  217. package/lib/node/NodeCreateTransaction.js.map +1 -1
  218. package/lib/node/NodeDeleteTransaction.js.map +1 -1
  219. package/lib/node/NodeUpdateTransaction.js.map +1 -1
  220. package/lib/node/ServiceEndpoint.js.map +1 -1
  221. package/lib/query/CostQuery.js.map +1 -1
  222. package/lib/query/MirrorNodeContractCallQuery.js.map +1 -1
  223. package/lib/query/MirrorNodeContractEstimateQuery.js.map +1 -1
  224. package/lib/query/MirrorNodeContractQuery.js.map +1 -1
  225. package/lib/query/Query.js.map +1 -1
  226. package/lib/query/QueryBase.js.map +1 -1
  227. package/lib/schedule/ScheduleCreateTransaction.cjs +2 -1
  228. package/lib/schedule/ScheduleCreateTransaction.d.ts +4 -2
  229. package/lib/schedule/ScheduleCreateTransaction.js.map +1 -1
  230. package/lib/schedule/ScheduleDeleteTransaction.d.ts +4 -0
  231. package/lib/schedule/ScheduleDeleteTransaction.js.map +1 -1
  232. package/lib/schedule/ScheduleId.js.map +1 -1
  233. package/lib/schedule/ScheduleInfo.js.map +1 -1
  234. package/lib/schedule/ScheduleInfoQuery.js.map +1 -1
  235. package/lib/schedule/ScheduleSignTransaction.d.ts +4 -0
  236. package/lib/schedule/ScheduleSignTransaction.js.map +1 -1
  237. package/lib/system/FreezeTransaction.js.map +1 -1
  238. package/lib/system/SystemDeleteTransaction.js.map +1 -1
  239. package/lib/system/SystemUndeleteTransaction.js.map +1 -1
  240. package/lib/token/AbstractTokenTransferTransaction.js.map +1 -1
  241. package/lib/token/AirdropPendingTransaction.js.map +1 -1
  242. package/lib/token/AssessedCustomFee.js.map +1 -1
  243. package/lib/token/CustomFee.js.map +1 -1
  244. package/lib/token/CustomFixedFee.js.map +1 -1
  245. package/lib/token/CustomFractionalFee.js.map +1 -1
  246. package/lib/token/CustomRoyaltyFee.js.map +1 -1
  247. package/lib/token/FeeAssessmentMethod.js.map +1 -1
  248. package/lib/token/NftId.js.map +1 -1
  249. package/lib/token/PendingAirdropId.js.map +1 -1
  250. package/lib/token/PendingAirdropRecord.js.map +1 -1
  251. package/lib/token/TokenAirdropTransaction.js.map +1 -1
  252. package/lib/token/TokenAssociateTransaction.cjs +2 -1
  253. package/lib/token/TokenAssociateTransaction.d.ts +4 -2
  254. package/lib/token/TokenAssociateTransaction.js.map +1 -1
  255. package/lib/token/TokenAssociation.js.map +1 -1
  256. package/lib/token/TokenBurnTransaction.d.ts +4 -0
  257. package/lib/token/TokenBurnTransaction.js.map +1 -1
  258. package/lib/token/TokenCancelAirdropTransaction.js.map +1 -1
  259. package/lib/token/TokenClaimAirdropTransaction.js.map +1 -1
  260. package/lib/token/TokenCreateTransaction.cjs +2 -1
  261. package/lib/token/TokenCreateTransaction.d.ts +4 -2
  262. package/lib/token/TokenCreateTransaction.js.map +1 -1
  263. package/lib/token/TokenDeleteTransaction.d.ts +4 -0
  264. package/lib/token/TokenDeleteTransaction.js.map +1 -1
  265. package/lib/token/TokenDissociateTransaction.cjs +2 -1
  266. package/lib/token/TokenDissociateTransaction.d.ts +4 -2
  267. package/lib/token/TokenDissociateTransaction.js.map +1 -1
  268. package/lib/token/TokenFeeScheduleUpdateTransaction.js.map +1 -1
  269. package/lib/token/TokenFreezeTransaction.cjs +2 -1
  270. package/lib/token/TokenFreezeTransaction.d.ts +4 -2
  271. package/lib/token/TokenFreezeTransaction.js.map +1 -1
  272. package/lib/token/TokenGrantKycTransaction.cjs +2 -1
  273. package/lib/token/TokenGrantKycTransaction.d.ts +4 -2
  274. package/lib/token/TokenGrantKycTransaction.js.map +1 -1
  275. package/lib/token/TokenId.js.map +1 -1
  276. package/lib/token/TokenInfo.js.map +1 -1
  277. package/lib/token/TokenInfoQuery.js.map +1 -1
  278. package/lib/token/TokenKeyValidation.js.map +1 -1
  279. package/lib/token/TokenMintTransaction.d.ts +4 -0
  280. package/lib/token/TokenMintTransaction.js.map +1 -1
  281. package/lib/token/TokenNftInfo.js.map +1 -1
  282. package/lib/token/TokenNftInfoQuery.js.map +1 -1
  283. package/lib/token/TokenNftTransfer.js.map +1 -1
  284. package/lib/token/TokenNftsUpdateTransaction.d.ts +4 -0
  285. package/lib/token/TokenPauseTransaction.d.ts +4 -0
  286. package/lib/token/TokenPauseTransaction.js.map +1 -1
  287. package/lib/token/TokenReference.js.map +1 -1
  288. package/lib/token/TokenRejectFlow.cjs +3 -1
  289. package/lib/token/TokenRejectFlow.d.ts +6 -2
  290. package/lib/token/TokenRejectFlow.js.map +1 -1
  291. package/lib/token/TokenRejectTransaction.js.map +1 -1
  292. package/lib/token/TokenRevokeKycTransaction.cjs +2 -1
  293. package/lib/token/TokenRevokeKycTransaction.d.ts +4 -2
  294. package/lib/token/TokenRevokeKycTransaction.js.map +1 -1
  295. package/lib/token/TokenSupplyType.js.map +1 -1
  296. package/lib/token/TokenTransfer.js.map +1 -1
  297. package/lib/token/TokenType.js.map +1 -1
  298. package/lib/token/TokenUnfreezeTransaction.cjs +2 -1
  299. package/lib/token/TokenUnfreezeTransaction.d.ts +4 -2
  300. package/lib/token/TokenUnfreezeTransaction.js.map +1 -1
  301. package/lib/token/TokenUnpauseTransaction.d.ts +4 -0
  302. package/lib/token/TokenUnpauseTransaction.js.map +1 -1
  303. package/lib/token/TokenUpdateNftsTransaction.d.ts +4 -0
  304. package/lib/token/TokenUpdateNftsTransaction.js.map +1 -1
  305. package/lib/token/TokenUpdateTransaction.cjs +2 -1
  306. package/lib/token/TokenUpdateTransaction.d.ts +4 -2
  307. package/lib/token/TokenUpdateTransaction.js.map +1 -1
  308. package/lib/token/TokenWipeTransaction.cjs +2 -1
  309. package/lib/token/TokenWipeTransaction.d.ts +4 -2
  310. package/lib/token/TokenWipeTransaction.js.map +1 -1
  311. package/lib/topic/SubscriptionHandle.js.map +1 -1
  312. package/lib/topic/TopicCreateTransaction.cjs +2 -1
  313. package/lib/topic/TopicCreateTransaction.d.ts +4 -2
  314. package/lib/topic/TopicCreateTransaction.js.map +1 -1
  315. package/lib/topic/TopicDeleteTransaction.d.ts +4 -0
  316. package/lib/topic/TopicDeleteTransaction.js.map +1 -1
  317. package/lib/topic/TopicId.js.map +1 -1
  318. package/lib/topic/TopicInfo.js.map +1 -1
  319. package/lib/topic/TopicInfoQuery.js.map +1 -1
  320. package/lib/topic/TopicMessage.js.map +1 -1
  321. package/lib/topic/TopicMessageChunk.js.map +1 -1
  322. package/lib/topic/TopicMessageQuery.js.map +1 -1
  323. package/lib/topic/TopicMessageSubmitTransaction.js.map +1 -1
  324. package/lib/topic/TopicUpdateTransaction.cjs +2 -1
  325. package/lib/topic/TopicUpdateTransaction.d.ts +4 -2
  326. package/lib/topic/TopicUpdateTransaction.js.map +1 -1
  327. package/lib/transaction/BatchTransaction.js.map +1 -1
  328. package/lib/transaction/CustomFeeLimit.js.map +1 -1
  329. package/lib/transaction/List.js.map +1 -1
  330. package/lib/transaction/NodeAccountIdSignatureMap.js.map +1 -1
  331. package/lib/transaction/NodeAccountIdSignatureMapLegacy.js.map +1 -1
  332. package/lib/transaction/SignableNodeTransactionBodyBytes.js.map +1 -1
  333. package/lib/transaction/SignatureMap.js.map +1 -1
  334. package/lib/transaction/SignatureMapLegacy.js.map +1 -1
  335. package/lib/transaction/SignaturePairMap.js.map +1 -1
  336. package/lib/transaction/Transaction.cjs +83 -15
  337. package/lib/transaction/Transaction.d.ts +33 -4
  338. package/lib/transaction/Transaction.js +1 -1
  339. package/lib/transaction/Transaction.js.map +1 -1
  340. package/lib/transaction/TransactionHashMap.js.map +1 -1
  341. package/lib/transaction/TransactionId.js.map +1 -1
  342. package/lib/transaction/TransactionReceipt.js.map +1 -1
  343. package/lib/transaction/TransactionReceiptQuery.cjs +2 -1
  344. package/lib/transaction/TransactionReceiptQuery.d.ts +8 -2
  345. package/lib/transaction/TransactionReceiptQuery.js.map +1 -1
  346. package/lib/transaction/TransactionRecord.js.map +1 -1
  347. package/lib/transaction/TransactionRecordQuery.cjs +2 -1
  348. package/lib/transaction/TransactionRecordQuery.d.ts +8 -2
  349. package/lib/transaction/TransactionRecordQuery.js.map +1 -1
  350. package/lib/transaction/TransactionResponse.cjs +85 -10
  351. package/lib/transaction/TransactionResponse.d.ts +39 -4
  352. package/lib/transaction/TransactionResponse.js +1 -1
  353. package/lib/transaction/TransactionResponse.js.map +1 -1
  354. package/lib/util/ASN1-Decoder.js.map +1 -1
  355. package/lib/util.js.map +1 -1
  356. package/lib/version.js +1 -1
  357. package/package.json +21 -19
  358. package/src/Executable.js +13 -8
  359. package/src/account/AccountAllowanceAdjustTransaction.js +2 -1
  360. package/src/account/AccountAllowanceApproveTransaction.js +2 -1
  361. package/src/account/AccountAllowanceDeleteTransaction.js +2 -1
  362. package/src/account/AccountBalance.js +7 -15
  363. package/src/account/AccountBalanceQuery.js +5 -9
  364. package/src/account/AccountCreateTransaction.js +2 -1
  365. package/src/account/AccountDeleteTransaction.js +2 -1
  366. package/src/account/AccountInfoQuery.js +2 -1
  367. package/src/account/AccountRecordsQuery.js +2 -1
  368. package/src/account/AccountUpdateTransaction.js +2 -1
  369. package/src/account/HbarAllowance.js +3 -1
  370. package/src/account/LiveHashAddTransaction.js +2 -1
  371. package/src/account/LiveHashDeleteTransaction.js +2 -1
  372. package/src/account/LiveHashQuery.js +2 -1
  373. package/src/account/TokenAllowance.js +3 -1
  374. package/src/account/TokenNftAllowance.js +3 -1
  375. package/src/account/TransferTransaction.js +6 -4
  376. package/src/client/Client.js +38 -0
  377. package/src/client/addressbooks/mainnet.js +1 -1
  378. package/src/client/addressbooks/previewnet.js +1 -1
  379. package/src/client/addressbooks/testnet.js +1 -1
  380. package/src/contract/ContractCreateTransaction.js +2 -1
  381. package/src/contract/ContractDeleteTransaction.js +2 -1
  382. package/src/contract/ContractUpdateTransaction.js +2 -1
  383. package/src/file/FileAppendTransaction.js +5 -4
  384. package/src/schedule/ScheduleCreateTransaction.js +2 -1
  385. package/src/token/TokenAssociateTransaction.js +2 -1
  386. package/src/token/TokenCreateTransaction.js +2 -1
  387. package/src/token/TokenDissociateTransaction.js +2 -1
  388. package/src/token/TokenFreezeTransaction.js +2 -1
  389. package/src/token/TokenGrantKycTransaction.js +2 -1
  390. package/src/token/TokenRejectFlow.js +3 -1
  391. package/src/token/TokenRevokeKycTransaction.js +2 -1
  392. package/src/token/TokenUnfreezeTransaction.js +2 -1
  393. package/src/token/TokenUpdateTransaction.js +2 -1
  394. package/src/token/TokenWipeTransaction.js +2 -1
  395. package/src/topic/TopicCreateTransaction.js +2 -1
  396. package/src/topic/TopicUpdateTransaction.js +2 -1
  397. package/src/transaction/Transaction.js +139 -19
  398. package/src/transaction/TransactionReceiptQuery.js +2 -1
  399. package/src/transaction/TransactionRecordQuery.js +2 -1
  400. package/src/transaction/TransactionResponse.js +101 -14
@@ -1 +1 @@
1
- {"version":3,"file":"ServiceEndpoint.js","sources":["../../src/node/ServiceEndpoint.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IServiceEndpoint} IServiceEndpoint\n */\n\nexport default class ServiceEndpoint {\n /**\n * @param {object} [props]\n * @param {?Uint8Array} [props.ipAddressV4]\n * @param {?number} [props.port]\n * @param {?string} [props.domainName]\n */\n constructor(props) {\n /**\n * @type {?Uint8Array}\n * @description The 4-byte IPv4 address of the endpoint\n * encoded in left to right order\n * (e.g. 127.0.0.1 has bytes [127, 0, 0, 1]).\n */\n this._ipAddressV4 =\n props?.ipAddressV4 != null ? props.ipAddressV4 : null;\n\n /**\n * @type {?number}\n * @description The port of the service endpoint. It's required.\n */\n this._port = props?.port != null ? props.port : null;\n\n /**\n * @type {?string}\n * @description A node domain name. This MUST be the\n * fully qualified domain(DNS) name of the node. This\n * value MUST NOT be more than 253 characters.\n * domain_name and ipAddressV4 are mutually exclusive.\n * When the `domain_name` field is set, the `ipAddressV4`\n * field MUST NOT be set. When the `ipAddressV4` field\n * is set, the `domain_name` field MUST NOT be set.\n */\n this._domainName = props?.domainName != null ? props.domainName : null;\n }\n\n /**\n * @param {Uint8Array} ipAddressV4\n * @description Set 4-byte IPv4 address of the endpoint.\n * @returns {ServiceEndpoint}\n *\n */\n setIpAddressV4(ipAddressV4) {\n if (this._domainName != null) {\n throw new Error(\n \"Cannot set IP address when domain name is already set.\",\n );\n }\n this._ipAddressV4 = ipAddressV4;\n return this;\n }\n\n /**\n * @description Get 4-byte IPv4 address of the endpoint.\n * @returns {?Uint8Array}\n *\n */\n get getIpAddressV4() {\n return this._ipAddressV4;\n }\n\n /**\n * @param {number} port\n * @description Set port of the endpoint.\n * @returns {ServiceEndpoint}\n *\n */\n setPort(port) {\n this._port = port;\n return this;\n }\n\n /**\n * @description Get port of the endpoint.\n * @returns {?number}\n *\n */\n get getPort() {\n return this._port;\n }\n\n /**\n * @param {string} domainName\n * @description Set domain name of the endpoint.\n * @returns {ServiceEndpoint}\n *\n */\n setDomainName(domainName) {\n if (this._ipAddressV4 != null) {\n throw new Error(\n \"Cannot set domain name when IP address is already set.\",\n );\n }\n this._domainName = domainName;\n return this;\n }\n\n /**\n * @description Get domain name of the endpoint.\n * @returns {?string}\n *\n */\n get getDomainName() {\n return this._domainName;\n }\n\n /**\n * @internal\n * @param {IServiceEndpoint} serviceEndpoint\n * @returns {ServiceEndpoint}\n */\n static _fromProtobuf(serviceEndpoint) {\n return new ServiceEndpoint({\n ipAddressV4:\n serviceEndpoint.ipAddressV4 != null\n ? serviceEndpoint.ipAddressV4\n : undefined,\n port:\n serviceEndpoint.port != null ? serviceEndpoint.port : undefined,\n domainName:\n serviceEndpoint.domainName != null\n ? serviceEndpoint.domainName\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {IServiceEndpoint}\n */\n _toProtobuf() {\n return {\n ipAddressV4: this._ipAddressV4,\n port: this._port,\n domainName: this._domainName,\n };\n }\n}\n"],"names":["ServiceEndpoint","constructor","props","this","_ipAddressV4","ipAddressV4","_port","port","_domainName","domainName","setIpAddressV4","Error","getIpAddressV4","setPort","getPort","setDomainName","getDomainName","_fromProtobuf","serviceEndpoint","undefined","_toProtobuf"],"mappings":"AAOe,MAAMA,EAOjB,WAAAC,CAAYC,GAORC,KAAKC,aACqB,MAAtBF,GAAOG,YAAsBH,EAAMG,YAAc,KAMrDF,KAAKG,MAAuB,MAAfJ,GAAOK,KAAeL,EAAMK,KAAO,KAYhDJ,KAAKK,YAAmC,MAArBN,GAAOO,WAAqBP,EAAMO,WAAa,IAC1E,CAQI,cAAAC,CAAeL,GACX,GAAwB,MAApBF,KAAKK,YACL,MAAM,IAAIG,MACN,0DAIR,OADAR,KAAKC,aAAeC,EACbF,IACf,CAOI,kBAAIS,GACA,OAAOT,KAAKC,YACpB,CAQI,OAAAS,CAAQN,GAEJ,OADAJ,KAAKG,MAAQC,EACNJ,IACf,CAOI,WAAIW,GACA,OAAOX,KAAKG,KACpB,CAQI,aAAAS,CAAcN,GACV,GAAyB,MAArBN,KAAKC,aACL,MAAM,IAAIO,MACN,0DAIR,OADAR,KAAKK,YAAcC,EACZN,IACf,CAOI,iBAAIa,GACA,OAAOb,KAAKK,WACpB,CAOI,oBAAOS,CAAcC,GACjB,OAAO,IAAIlB,EAAgB,CACvBK,YACmC,MAA/Ba,EAAgBb,YACVa,EAAgBb,iBAChBc,EACVZ,KAC4B,MAAxBW,EAAgBX,KAAeW,EAAgBX,UAAOY,EAC1DV,WACkC,MAA9BS,EAAgBT,WACVS,EAAgBT,gBAChBU,GAEtB,CAMI,WAAAC,GACI,MAAO,CACHf,YAAaF,KAAKC,aAClBG,KAAMJ,KAAKG,MACXG,WAAYN,KAAKK,YAE7B"}
1
+ {"version":3,"file":"ServiceEndpoint.js","sources":["../../src/node/ServiceEndpoint.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IServiceEndpoint} IServiceEndpoint\n */\n\nexport default class ServiceEndpoint {\n /**\n * @param {object} [props]\n * @param {?Uint8Array} [props.ipAddressV4]\n * @param {?number} [props.port]\n * @param {?string} [props.domainName]\n */\n constructor(props) {\n /**\n * @type {?Uint8Array}\n * @description The 4-byte IPv4 address of the endpoint\n * encoded in left to right order\n * (e.g. 127.0.0.1 has bytes [127, 0, 0, 1]).\n */\n this._ipAddressV4 =\n props?.ipAddressV4 != null ? props.ipAddressV4 : null;\n\n /**\n * @type {?number}\n * @description The port of the service endpoint. It's required.\n */\n this._port = props?.port != null ? props.port : null;\n\n /**\n * @type {?string}\n * @description A node domain name. This MUST be the\n * fully qualified domain(DNS) name of the node. This\n * value MUST NOT be more than 253 characters.\n * domain_name and ipAddressV4 are mutually exclusive.\n * When the `domain_name` field is set, the `ipAddressV4`\n * field MUST NOT be set. When the `ipAddressV4` field\n * is set, the `domain_name` field MUST NOT be set.\n */\n this._domainName = props?.domainName != null ? props.domainName : null;\n }\n\n /**\n * @param {Uint8Array} ipAddressV4\n * @description Set 4-byte IPv4 address of the endpoint.\n * @returns {ServiceEndpoint}\n *\n */\n setIpAddressV4(ipAddressV4) {\n if (this._domainName != null) {\n throw new Error(\n \"Cannot set IP address when domain name is already set.\",\n );\n }\n this._ipAddressV4 = ipAddressV4;\n return this;\n }\n\n /**\n * @description Get 4-byte IPv4 address of the endpoint.\n * @returns {?Uint8Array}\n *\n */\n get getIpAddressV4() {\n return this._ipAddressV4;\n }\n\n /**\n * @param {number} port\n * @description Set port of the endpoint.\n * @returns {ServiceEndpoint}\n *\n */\n setPort(port) {\n this._port = port;\n return this;\n }\n\n /**\n * @description Get port of the endpoint.\n * @returns {?number}\n *\n */\n get getPort() {\n return this._port;\n }\n\n /**\n * @param {string} domainName\n * @description Set domain name of the endpoint.\n * @returns {ServiceEndpoint}\n *\n */\n setDomainName(domainName) {\n if (this._ipAddressV4 != null) {\n throw new Error(\n \"Cannot set domain name when IP address is already set.\",\n );\n }\n this._domainName = domainName;\n return this;\n }\n\n /**\n * @description Get domain name of the endpoint.\n * @returns {?string}\n *\n */\n get getDomainName() {\n return this._domainName;\n }\n\n /**\n * @internal\n * @param {IServiceEndpoint} serviceEndpoint\n * @returns {ServiceEndpoint}\n */\n static _fromProtobuf(serviceEndpoint) {\n return new ServiceEndpoint({\n ipAddressV4:\n serviceEndpoint.ipAddressV4 != null\n ? serviceEndpoint.ipAddressV4\n : undefined,\n port:\n serviceEndpoint.port != null ? serviceEndpoint.port : undefined,\n domainName:\n serviceEndpoint.domainName != null\n ? serviceEndpoint.domainName\n : undefined,\n });\n }\n\n /**\n * @internal\n * @returns {IServiceEndpoint}\n */\n _toProtobuf() {\n return {\n ipAddressV4: this._ipAddressV4,\n port: this._port,\n domainName: this._domainName,\n };\n }\n}\n"],"names":["ServiceEndpoint","constructor","props","this","_ipAddressV4","ipAddressV4","_port","port","_domainName","domainName","setIpAddressV4","Error","getIpAddressV4","setPort","getPort","setDomainName","getDomainName","_fromProtobuf","serviceEndpoint","undefined","_toProtobuf"],"mappings":"AAOe,MAAMA,EAOjB,WAAAC,CAAYC,GAORC,KAAKC,aACqB,MAAtBF,GAAOG,YAAsBH,EAAMG,YAAc,KAMrDF,KAAKG,MAAuB,MAAfJ,GAAOK,KAAeL,EAAMK,KAAO,KAYhDJ,KAAKK,YAAmC,MAArBN,GAAOO,WAAqBP,EAAMO,WAAa,IACtE,CAQA,cAAAC,CAAeL,GACX,GAAwB,MAApBF,KAAKK,YACL,MAAM,IAAIG,MACN,0DAIR,OADAR,KAAKC,aAAeC,EACbF,IACX,CAOA,kBAAIS,GACA,OAAOT,KAAKC,YAChB,CAQA,OAAAS,CAAQN,GAEJ,OADAJ,KAAKG,MAAQC,EACNJ,IACX,CAOA,WAAIW,GACA,OAAOX,KAAKG,KAChB,CAQA,aAAAS,CAAcN,GACV,GAAyB,MAArBN,KAAKC,aACL,MAAM,IAAIO,MACN,0DAIR,OADAR,KAAKK,YAAcC,EACZN,IACX,CAOA,iBAAIa,GACA,OAAOb,KAAKK,WAChB,CAOA,oBAAOS,CAAcC,GACjB,OAAO,IAAIlB,EAAgB,CACvBK,YACmC,MAA/Ba,EAAgBb,YACVa,EAAgBb,iBAChBc,EACVZ,KAC4B,MAAxBW,EAAgBX,KAAeW,EAAgBX,UAAOY,EAC1DV,WACkC,MAA9BS,EAAgBT,WACVS,EAAgBT,gBAChBU,GAElB,CAMA,WAAAC,GACI,MAAO,CACHf,YAAaF,KAAKC,aAClBG,KAAMJ,KAAKG,MACXG,WAAYN,KAAKK,YAEzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"CostQuery.js","sources":["../../src/query/CostQuery.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport Hbar from \"../Hbar.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\nimport QueryBase from \"./QueryBase.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../Status.js\").default} Status\n * @typedef {import(\"../Executable.js\").ExecutionState} ExecutionState\n */\n\n/**\n * @template OutputT\n * @augments {QueryBase<HieroProto.proto.IQuery, HieroProto.proto.IResponse, Hbar>}\n */\nexport default class CostQuery extends QueryBase {\n /**\n * @param {import(\"./Query.js\").default<OutputT>} query\n */\n constructor(query) {\n super();\n\n this._query = query;\n this._grpcDeadline = query._grpcDeadline;\n this._requestTimeout = query._requestTimeout;\n this._nodeAccountIds = query._nodeAccountIds.clone();\n this._operator = query._operator;\n\n /**\n * @type {HieroProto.proto.IQueryHeader | null}\n */\n this._header = null;\n }\n\n /**\n * @returns {TransactionId}\n */\n _getTransactionId() {\n return this._query._getTransactionId();\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n return `CostQuery:${this._query._getLogId()}`;\n }\n\n /**\n * @abstract\n * @protected\n * @param {import(\"../client/Client.js\").default<*, *>} client\n * @returns {Promise<void>}\n */\n async _beforeExecute(client) {\n if (client == null) {\n throw new Error(\"Cannot do CostQuery without Client\");\n }\n\n const operator =\n this._operator != null ? this._operator : client._operator;\n\n if (operator == null) {\n throw new Error(\n \"`client` must have an `operator` or an explicit payment transaction must be provided\",\n );\n }\n\n if (this._query._nodeAccountIds.isEmpty) {\n this._query._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute(),\n );\n }\n\n // operator.accountId\n const transactionId = TransactionId.generate(operator.accountId);\n if (this._query.paymentTransactionId == null) {\n this._query.setPaymentTransactionId(transactionId);\n }\n\n const logId = this._getLogId();\n const nodeId = new AccountId(0);\n const paymentTransactionId =\n /** @type {import(\"../transaction/TransactionId.js\").default} */\n (TransactionId.generate(new AccountId(0)));\n const paymentAmount = new Hbar(0);\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._header = {\n payment: await this._makePaymentTransaction(\n paymentTransactionId,\n new AccountId(0),\n operator,\n paymentAmount,\n ),\n responseType: HieroProto.proto.ResponseType.COST_ANSWER,\n };\n }\n\n /**\n * @abstract\n * @internal\n * @returns {Promise<HieroProto.proto.IQuery>}\n */\n _makeRequestAsync() {\n return Promise.resolve(\n this._query._onMakeRequest(\n /** @type {HieroProto.proto.IQueryHeader} */ (this._header),\n ),\n );\n }\n\n /**\n * @abstract\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 return this._query._shouldRetry(request, response);\n }\n\n /**\n * @abstract\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 return this._query._mapStatusError(request, response, nodeId);\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<Hbar>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const cost = this._query._mapResponseHeader(response).cost;\n return Promise.resolve(\n Hbar.fromTinybars(/** @type {Long | number} */ (cost)),\n );\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<HieroProto.proto.IResponse>}\n */\n _execute(channel, request) {\n return this._query._execute(channel, request);\n }\n\n /**\n * @param {HieroProto.proto.Query} request\n * @returns {Uint8Array}\n */\n _requestToBytes(request) {\n return this._query._requestToBytes(request);\n }\n\n /**\n * @param {HieroProto.proto.Response} response\n * @returns {Uint8Array}\n */\n _responseToBytes(response) {\n return this._query._responseToBytes(response);\n }\n}\n"],"names":["CostQuery","QueryBase","constructor","query","super","this","_query","_grpcDeadline","_requestTimeout","_nodeAccountIds","clone","_operator","_header","_getTransactionId","_getLogId","_beforeExecute","client","Error","operator","isEmpty","setList","_network","getNodeAccountIdsForExecute","transactionId","TransactionId","generate","accountId","paymentTransactionId","setPaymentTransactionId","logId","nodeId","AccountId","paymentAmount","Hbar","_logger","debug","toString","payment","_makePaymentTransaction","responseType","HieroProto","proto","ResponseType","COST_ANSWER","_makeRequestAsync","Promise","resolve","_onMakeRequest","_shouldRetry","request","response","_mapStatusError","_mapResponse","nodeAccountId","cost","_mapResponseHeader","fromTinybars","_execute","channel","_requestToBytes","_responseToBytes"],"mappings":"oLAkBe,MAAMA,UAAkBC,EAInC,WAAAC,CAAYC,GACRC,QAEAC,KAAKC,OAASH,EACdE,KAAKE,cAAgBJ,EAAMI,cAC3BF,KAAKG,gBAAkBL,EAAMK,gBAC7BH,KAAKI,gBAAkBN,EAAMM,gBAAgBC,QAC7CL,KAAKM,UAAYR,EAAMQ,UAKvBN,KAAKO,QAAU,IACvB,CAKI,iBAAAC,GACI,OAAOR,KAAKC,OAAOO,mBAC3B,CAKI,SAAAC,GACI,MAAO,aAAaT,KAAKC,OAAOQ,aACxC,CAQI,oBAAMC,CAAeC,GACjB,GAAc,MAAVA,EACA,MAAM,IAAIC,MAAM,sCAGpB,MAAMC,EACgB,MAAlBb,KAAKM,UAAoBN,KAAKM,UAAYK,EAAOL,UAErD,GAAgB,MAAZO,EACA,MAAM,IAAID,MACN,wFAIJZ,K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\n\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport Hbar from \"../Hbar.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\nimport QueryBase from \"./QueryBase.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../Status.js\").default} Status\n * @typedef {import(\"../Executable.js\").ExecutionState} ExecutionState\n */\n\n/**\n * @template OutputT\n * @augments {QueryBase<HieroProto.proto.IQuery, HieroProto.proto.IResponse, Hbar>}\n */\nexport default class CostQuery extends QueryBase {\n /**\n * @param {import(\"./Query.js\").default<OutputT>} query\n */\n constructor(query) {\n super();\n\n this._query = query;\n this._grpcDeadline = query._grpcDeadline;\n this._requestTimeout = query._requestTimeout;\n this._nodeAccountIds = query._nodeAccountIds.clone();\n this._operator = query._operator;\n\n /**\n * @type {HieroProto.proto.IQueryHeader | null}\n */\n this._header = null;\n }\n\n /**\n * @returns {TransactionId}\n */\n _getTransactionId() {\n return this._query._getTransactionId();\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n return `CostQuery:${this._query._getLogId()}`;\n }\n\n /**\n * @abstract\n * @protected\n * @param {import(\"../client/Client.js\").default<*, *>} client\n * @returns {Promise<void>}\n */\n async _beforeExecute(client) {\n if (client == null) {\n throw new Error(\"Cannot do CostQuery without Client\");\n }\n\n const operator =\n this._operator != null ? this._operator : client._operator;\n\n if (operator == null) {\n throw new Error(\n \"`client` must have an `operator` or an explicit payment transaction must be provided\",\n );\n }\n\n if (this._query._nodeAccountIds.isEmpty) {\n this._query._nodeAccountIds.setList(\n client._network.getNodeAccountIdsForExecute(),\n );\n }\n\n // operator.accountId\n const transactionId = TransactionId.generate(operator.accountId);\n if (this._query.paymentTransactionId == null) {\n this._query.setPaymentTransactionId(transactionId);\n }\n\n const logId = this._getLogId();\n const nodeId = new AccountId(0);\n const paymentTransactionId =\n /** @type {import(\"../transaction/TransactionId.js\").default} */\n (TransactionId.generate(new AccountId(0)));\n const paymentAmount = new Hbar(0);\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._header = {\n payment: await this._makePaymentTransaction(\n paymentTransactionId,\n new AccountId(0),\n operator,\n paymentAmount,\n ),\n responseType: HieroProto.proto.ResponseType.COST_ANSWER,\n };\n }\n\n /**\n * @abstract\n * @internal\n * @returns {Promise<HieroProto.proto.IQuery>}\n */\n _makeRequestAsync() {\n return Promise.resolve(\n this._query._onMakeRequest(\n /** @type {HieroProto.proto.IQueryHeader} */ (this._header),\n ),\n );\n }\n\n /**\n * @abstract\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 return this._query._shouldRetry(request, response);\n }\n\n /**\n * @abstract\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 return this._query._mapStatusError(request, response, nodeId);\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<Hbar>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const cost = this._query._mapResponseHeader(response).cost;\n return Promise.resolve(\n Hbar.fromTinybars(/** @type {Long | number} */ (cost)),\n );\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<HieroProto.proto.IResponse>}\n */\n _execute(channel, request) {\n return this._query._execute(channel, request);\n }\n\n /**\n * @param {HieroProto.proto.Query} request\n * @returns {Uint8Array}\n */\n _requestToBytes(request) {\n return this._query._requestToBytes(request);\n }\n\n /**\n * @param {HieroProto.proto.Response} response\n * @returns {Uint8Array}\n */\n _responseToBytes(response) {\n return this._query._responseToBytes(response);\n }\n}\n"],"names":["CostQuery","QueryBase","constructor","query","super","this","_query","_grpcDeadline","_requestTimeout","_nodeAccountIds","clone","_operator","_header","_getTransactionId","_getLogId","_beforeExecute","client","Error","operator","isEmpty","setList","_network","getNodeAccountIdsForExecute","transactionId","TransactionId","generate","accountId","paymentTransactionId","setPaymentTransactionId","logId","nodeId","AccountId","paymentAmount","Hbar","_logger","debug","toString","payment","_makePaymentTransaction","responseType","HieroProto","proto","ResponseType","COST_ANSWER","_makeRequestAsync","Promise","resolve","_onMakeRequest","_shouldRetry","request","response","_mapStatusError","_mapResponse","nodeAccountId","cost","_mapResponseHeader","fromTinybars","_execute","channel","_requestToBytes","_responseToBytes"],"mappings":"oLAkBe,MAAMA,UAAkBC,EAInC,WAAAC,CAAYC,GACRC,QAEAC,KAAKC,OAASH,EACdE,KAAKE,cAAgBJ,EAAMI,cAC3BF,KAAKG,gBAAkBL,EAAMK,gBAC7BH,KAAKI,gBAAkBN,EAAMM,gBAAgBC,QAC7CL,KAAKM,UAAYR,EAAMQ,UAKvBN,KAAKO,QAAU,IACnB,CAKA,iBAAAC,GACI,OAAOR,KAAKC,OAAOO,mBACvB,CAKA,SAAAC,GACI,MAAO,aAAaT,KAAKC,OAAOQ,aACpC,CAQA,oBAAMC,CAAeC,GACjB,GAAc,MAAVA,EACA,MAAM,IAAIC,MAAM,sCAGpB,MAAMC,EACgB,MAAlBb,KAAKM,UAAoBN,KAAKM,UAAYK,EAAOL,UAErD,GAAgB,MAAZO,EACA,MAAM,IAAID,MACN,wFAIJZ,KAAKC,OAAOG,gBAAgBU,SAC5Bd,KAAKC,OAAOG,gBAAgBW,QACxBJ,EAAOK,SAASC,+BAKxB,MAAMC,EAAgBC,EAAcC,SAASP,EAASQ,WACd,MAApCrB,KAAKC,OAAOqB,sBACZtB,KAAKC,OAAOsB,wBAAwBL,GAGxC,MAAMM,EAAQxB,KAAKS,YACbgB,EAAS,IAAIC,EAAU,GACvBJ,EAEDH,EAAcC,SAAS,IAAIM,EAAU,IACpCC,EAAgB,IAAIC,EAAK,GAC3B5B,KAAK6B,SACL7B,KAAK6B,QAAQC,MACT,IAAIN,4CAAgDC,EAAOM,iCAAiCT,EAAqBS,0BAA0BJ,EAAcI,cAIjK/B,KAAKO,QAAU,CACXyB,cAAehC,KAAKiC,wBAChBX,EACA,IAAII,EAAU,GACdb,EACAc,GAEJO,aAAcC,EAAWC,MAAMC,aAAaC,YAEpD,CAOA,iBAAAC,GACI,OAAOC,QAAQC,QACXzC,KAAKC,OAAOyC,eACsC1C,KAAY,SAGtE,CAUA,YAAA2C,CAAaC,EAASC,GAClB,OAAO7C,KAAKC,OAAO0C,aAAaC,EAASC,EAC7C,CAWA,eAAAC,CAAgBF,EAASC,EAAUpB,GAC/B,OAAOzB,KAAKC,OAAO6C,gBAAgBF,EAASC,EAAUpB,EAC1D,CAWA,YAAAsB,CAAaF,EAAUG,EAAeJ,GAClC,MAAMK,EAAOjD,KAAKC,OAAOiD,mBAAmBL,GAAUI,KACtD,OAAOT,QAAQC,QACXb,EAAKuB,aAAY,GAEzB,CASA,QAAAC,CAASC,EAAST,GACd,OAAO5C,KAAKC,OAAOmD,SAASC,EAAST,EACzC,CAMA,eAAAU,CAAgBV,GACZ,OAAO5C,KAAKC,OAAOqD,gBAAgBV,EACvC,CAMA,gBAAAW,CAAiBV,GACb,OAAO7C,KAAKC,OAAOsD,iBAAiBV,EACxC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MirrorNodeContractCallQuery.js","sources":["../../src/query/MirrorNodeContractCallQuery.js"],"sourcesContent":["import MirrorNodeContractQuery from \"./MirrorNodeContractQuery.js\";\nimport * as hex from \"../encoding/hex.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n A query that simulates a contract function call using the Hedera Mirror Node.\n * \n * This query allows you to execute a read-only smart contract call without submitting a transaction\n * to the main network. It's useful for querying contract state or executing view/pure functions.\n * The simulation is performed against the state of the contract at a specific block height.\n */\nexport default class MirrorNodeContractCallQuery extends MirrorNodeContractQuery {\n /**\n * @returns {object}\n */\n get JSONPayload() {\n if (this.callData == null) {\n throw new Error(\"Call data is required.\");\n }\n\n return {\n data: hex.encode(this.callData),\n from: this.senderEvmAddress,\n to: this.contractEvmAddress,\n estimate: false,\n gasPrice: this.gasPrice?.toString(),\n gas: this.gasLimit?.toString(),\n blockNumber: this.blockNumber?.toString(),\n value: this.value?.toString(),\n };\n }\n\n /**\n * @param {Client} client\n * @returns {Promise<string>}\n */\n async execute(client) {\n const mirrorNodeRequest = await this.performMirrorNodeRequest(\n client,\n this.JSONPayload,\n );\n\n return mirrorNodeRequest.result;\n }\n}\n"],"names":["MirrorNodeContractCallQuery","MirrorNodeContractQuery","JSONPayload","this","callData","Error","data","hex.encode","from","senderEvmAddress","to","contractEvmAddress","estimate","gasPrice","toString","gas","gasLimit","blockNumber","value","execute","client","performMirrorNodeRequest","result"],"mappings":"wFAee,MAAMA,UAAoCC,EAIrD,eAAIC,GACA,GAAqB,MAAjBC,KAAKC,SACL,MAAM,IAAIC,MAAM,0BAGpB,MAAO,CACHC,KAAMC,EAAWJ,KAAKC,UACtBI,KAAML,KAAKM,iBACXC,GAAIP,KAAKQ,mBACTC,UAAU,EACVC,SAAUV,KAAKU,UAAUC,WACzBC,IAAKZ,KAAKa,UAAUF,WACpBG,YAAad,KAAKc,aAAaH,WAC/BI,MAAOf,KAAKe,OAAOJ,WAE/B,CAMI,aAAMK,CAAQC,GAMV,aALgCjB,KAAKkB,yBACjCD,EACAjB,KAAKD,cAGgBoB,MACjC"}
1
+ {"version":3,"file":"MirrorNodeContractCallQuery.js","sources":["../../src/query/MirrorNodeContractCallQuery.js"],"sourcesContent":["import MirrorNodeContractQuery from \"./MirrorNodeContractQuery.js\";\nimport * as hex from \"../encoding/hex.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n A query that simulates a contract function call using the Hedera Mirror Node.\n * \n * This query allows you to execute a read-only smart contract call without submitting a transaction\n * to the main network. It's useful for querying contract state or executing view/pure functions.\n * The simulation is performed against the state of the contract at a specific block height.\n */\nexport default class MirrorNodeContractCallQuery extends MirrorNodeContractQuery {\n /**\n * @returns {object}\n */\n get JSONPayload() {\n if (this.callData == null) {\n throw new Error(\"Call data is required.\");\n }\n\n return {\n data: hex.encode(this.callData),\n from: this.senderEvmAddress,\n to: this.contractEvmAddress,\n estimate: false,\n gasPrice: this.gasPrice?.toString(),\n gas: this.gasLimit?.toString(),\n blockNumber: this.blockNumber?.toString(),\n value: this.value?.toString(),\n };\n }\n\n /**\n * @param {Client} client\n * @returns {Promise<string>}\n */\n async execute(client) {\n const mirrorNodeRequest = await this.performMirrorNodeRequest(\n client,\n this.JSONPayload,\n );\n\n return mirrorNodeRequest.result;\n }\n}\n"],"names":["MirrorNodeContractCallQuery","MirrorNodeContractQuery","JSONPayload","this","callData","Error","data","hex.encode","from","senderEvmAddress","to","contractEvmAddress","estimate","gasPrice","toString","gas","gasLimit","blockNumber","value","execute","client","performMirrorNodeRequest","result"],"mappings":"wFAee,MAAMA,UAAoCC,EAIrD,eAAIC,GACA,GAAqB,MAAjBC,KAAKC,SACL,MAAM,IAAIC,MAAM,0BAGpB,MAAO,CACHC,KAAMC,EAAWJ,KAAKC,UACtBI,KAAML,KAAKM,iBACXC,GAAIP,KAAKQ,mBACTC,UAAU,EACVC,SAAUV,KAAKU,UAAUC,WACzBC,IAAKZ,KAAKa,UAAUF,WACpBG,YAAad,KAAKc,aAAaH,WAC/BI,MAAOf,KAAKe,OAAOJ,WAE3B,CAMA,aAAMK,CAAQC,GAMV,aALgCjB,KAAKkB,yBACjCD,EACAjB,KAAKD,cAGgBoB,MAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"MirrorNodeContractEstimateQuery.js","sources":["../../src/query/MirrorNodeContractEstimateQuery.js"],"sourcesContent":["import MirrorNodeContractQuery from \"./MirrorNodeContractQuery.js\";\nimport * as hex from \"../encoding/hex.js\";\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * A query that estimates the gas required for a contract function call using the Hedera Mirror Node.\n *\n * This query simulates a contract call to estimate the amount of gas that would be required\n * to execute the same call on the main network. It's useful for determining the appropriate\n * gas limit before submitting an actual transaction.\n */\nexport default class MirrorNodeContractEstimateQuery extends MirrorNodeContractQuery {\n /**\n * @returns {object}\n */\n get JSONPayload() {\n if (this.callData == null) {\n throw new Error(\"Call data is required.\");\n }\n\n return {\n data: hex.encode(this.callData),\n from: this.senderEvmAddress,\n to: this.contractEvmAddress,\n estimate: true,\n gasPrice: this.gasPrice?.toString(),\n gas: this.gasLimit?.toString(),\n blockNumber: this.blockNumber?.toString(),\n value: this.value?.toString(),\n };\n }\n\n /**\n * @param {Client} client\n * @returns {Promise<number>}\n */\n async execute(client) {\n const mirrorNodeRequest = await this.performMirrorNodeRequest(\n client,\n this.JSONPayload,\n );\n\n return Number(mirrorNodeRequest.result);\n }\n}\n"],"names":["MirrorNodeContractEstimateQuery","MirrorNodeContractQuery","JSONPayload","this","callData","Error","data","hex.encode","from","senderEvmAddress","to","contractEvmAddress","estimate","gasPrice","toString","gas","gasLimit","blockNumber","value","execute","client","mirrorNodeRequest","performMirrorNodeRequest","Number","result"],"mappings":"wFAce,MAAMA,UAAwCC,EAIzD,eAAIC,GACA,GAAqB,MAAjBC,KAAKC,SACL,MAAM,IAAIC,MAAM,0BAGpB,MAAO,CACHC,KAAMC,EAAWJ,KAAKC,UACtBI,KAAML,KAAKM,iBACXC,GAAIP,KAAKQ,mBACTC,UAAU,EACVC,SAAUV,KAAKU,UAAUC,WACzBC,IAAKZ,KAAKa,UAAUF,WACpBG,YAAad,KAAKc,aAAaH,WAC/BI,MAAOf,KAAKe,OAAOJ,WAE/B,CAMI,aAAMK,CAAQC,GACV,MAAMC,QAA0BlB,KAAKmB,yBACjCF,EACAjB,KAAKD,aAGT,OAAOqB,OAAOF,EAAkBG,OACxC"}
1
+ {"version":3,"file":"MirrorNodeContractEstimateQuery.js","sources":["../../src/query/MirrorNodeContractEstimateQuery.js"],"sourcesContent":["import MirrorNodeContractQuery from \"./MirrorNodeContractQuery.js\";\nimport * as hex from \"../encoding/hex.js\";\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * A query that estimates the gas required for a contract function call using the Hedera Mirror Node.\n *\n * This query simulates a contract call to estimate the amount of gas that would be required\n * to execute the same call on the main network. It's useful for determining the appropriate\n * gas limit before submitting an actual transaction.\n */\nexport default class MirrorNodeContractEstimateQuery extends MirrorNodeContractQuery {\n /**\n * @returns {object}\n */\n get JSONPayload() {\n if (this.callData == null) {\n throw new Error(\"Call data is required.\");\n }\n\n return {\n data: hex.encode(this.callData),\n from: this.senderEvmAddress,\n to: this.contractEvmAddress,\n estimate: true,\n gasPrice: this.gasPrice?.toString(),\n gas: this.gasLimit?.toString(),\n blockNumber: this.blockNumber?.toString(),\n value: this.value?.toString(),\n };\n }\n\n /**\n * @param {Client} client\n * @returns {Promise<number>}\n */\n async execute(client) {\n const mirrorNodeRequest = await this.performMirrorNodeRequest(\n client,\n this.JSONPayload,\n );\n\n return Number(mirrorNodeRequest.result);\n }\n}\n"],"names":["MirrorNodeContractEstimateQuery","MirrorNodeContractQuery","JSONPayload","this","callData","Error","data","hex.encode","from","senderEvmAddress","to","contractEvmAddress","estimate","gasPrice","toString","gas","gasLimit","blockNumber","value","execute","client","mirrorNodeRequest","performMirrorNodeRequest","Number","result"],"mappings":"wFAce,MAAMA,UAAwCC,EAIzD,eAAIC,GACA,GAAqB,MAAjBC,KAAKC,SACL,MAAM,IAAIC,MAAM,0BAGpB,MAAO,CACHC,KAAMC,EAAWJ,KAAKC,UACtBI,KAAML,KAAKM,iBACXC,GAAIP,KAAKQ,mBACTC,UAAU,EACVC,SAAUV,KAAKU,UAAUC,WACzBC,IAAKZ,KAAKa,UAAUF,WACpBG,YAAad,KAAKc,aAAaH,WAC/BI,MAAOf,KAAKe,OAAOJ,WAE3B,CAMA,aAAMK,CAAQC,GACV,MAAMC,QAA0BlB,KAAKmB,yBACjCF,EACAjB,KAAKD,aAGT,OAAOqB,OAAOF,EAAkBG,OACpC"}
@@ -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 mirrorRestApiBaseUrl = client.mirrorRestApiBaseUrl;\n const contractCallEndpointPath = \"/contracts/call\";\n\n // Check if this is a local environment (localhost or 127.0.0.1)\n const mirrorNode = client._mirrorNetwork.getNextMirrorNode();\n const host = mirrorNode.address.address;\n const isLocalEnvironment = host === \"localhost\" || host === \"127.0.0.1\";\n\n if (isLocalEnvironment) {\n // For local environments, use HTTP scheme and port 8545 for contract calls\n // (different from general mirror node REST API port 5551)\n const url = new URL(mirrorRestApiBaseUrl);\n url.protocol = \"http:\";\n url.port = \"8545\";\n mirrorRestApiBaseUrl = url.toString();\n }\n\n const contractCallEndpointUrl = `${mirrorRestApiBaseUrl}${contractCallEndpointPath}`;\n\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n const response = await fetch(contractCallEndpointUrl, {\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","mirrorRestApiBaseUrl","host","_mirrorNetwork","getNextMirrorNode","address","url","URL","protocol","port","toString","contractCallEndpointUrl","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,GAM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AMC,KAAKC,UAAUnB,KAGzB,IAAKa,EAASO,GACV,MAAM,IAAIzB,MAAM,uBAAuBkB,EAASQ,UAKpD,aADsDR,EAASS,MAEvE,CAEI,eAAArB,GACiC,MAAzBtC,KAAKiC,kBAA2C,MAAfjC,KAAKc,SACtCd,KAAKI,kBAAoBJ,KAAKc,OAAOiB,eAEjD,CAKI,eAAI6B,GACA,MAAM,IAAI5B,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 mirrorRestApiBaseUrl = client.mirrorRestApiBaseUrl;\n const contractCallEndpointPath = \"/contracts/call\";\n\n // Check if this is a local environment (localhost or 127.0.0.1)\n const mirrorNode = client._mirrorNetwork.getNextMirrorNode();\n const host = mirrorNode.address.address;\n const isLocalEnvironment = host === \"localhost\" || host === \"127.0.0.1\";\n\n if (isLocalEnvironment) {\n // For local environments, use HTTP scheme and port 8545 for contract calls\n // (different from general mirror node REST API port 5551)\n const url = new URL(mirrorRestApiBaseUrl);\n url.protocol = \"http:\";\n url.port = \"8545\";\n mirrorRestApiBaseUrl = url.toString();\n }\n\n const contractCallEndpointUrl = `${mirrorRestApiBaseUrl}${contractCallEndpointPath}`;\n\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n const response = await fetch(contractCallEndpointUrl, {\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","mirrorRestApiBaseUrl","host","_mirrorNetwork","getNextMirrorNode","address","url","URL","protocol","port","toString","contractCallEndpointUrl","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,IACxB,CAQA,aAAAC,CAAcC,GAEV,OADAZ,KAAKC,YAAcW,EACZZ,IACX,CAOA,SAAAa,CAAUC,GAEN,OADAd,KAAKG,QAAUW,EACRd,IACX,CAUA,mBAAAe,CAAoBD,GAEhB,OADAd,KAAKI,kBAAoBU,EAClBd,IACX,CASA,WAAAgB,CAAYC,EAAMC,GAMd,OALAlB,KAAKM,oBACqB,MAAtBY,EACMA,EAAmBC,OAAOF,IAC1B,IAAIG,GAA6BD,OAAOF,GAE3CjB,I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DR,EAASS,MAEnE,CAEA,eAAArB,GACiC,MAAzBtC,KAAKiC,kBAA2C,MAAfjC,KAAKc,SACtCd,KAAKI,kBAAoBJ,KAAKc,OAAOiB,eAE7C,CAKA,eAAI6B,GACA,MAAM,IAAI5B,MACN,uFAER"}
@@ -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 \"@hiero-ledger/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":"sXA6B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AASZ,GAClB,MAAMa,4BAAEA,GACJzF,KAAK2E,mBAAmBC,GAEtBc,EAASC,EAAOC,UACa,MAA/BH,EACMA,EACA9E,EAAWC,MAAMiF,iBAAiBC,IAQ5C,OANI9F,KAAKiE,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 \"@hiero-ledger/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":"sXA6BY,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,KAC3B,CASA,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,EACxB,CASA,OAAAO,GACI,OAAON,EAAWC,MAAMhB,MAAMsB,OAAOlB,KAAKmB,gBAAgBC,QAC9D,CAWA,eAAAC,CAAgBC,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MAA/BH,EACMA,EACA9E,EAAWC,MAAMiF,iBAAiBC,IAG5C,OAAO,IAAIU,EAAoB,CAC3BnC,SACAqB,SACAe,cAAezG,KAAK0C,oBACpBgE,uBAAwB,MAEhC,CAMA,eAAAC,CAAgBnB,GACZ,OAAO7E,EAAWC,MAAMhB,MAAMsB,OAAOsE,GAASpE,QAClD,CAMA,gBAAAwF,CAAiBhC,GACb,OAAOjE,EAAWC,MAAMiG,SAAS3F,OAAO0D,GAAUxD,QACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"QueryBase.js","sources":["../../src/query/QueryBase.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Executable from \"../Executable.js\";\nimport Hbar from \"../Hbar.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\nimport Long from \"long\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../Status.js\").default} Status\n * @typedef {import(\"../Executable.js\").ExecutionState} ExecutionState\n * @typedef {import(\"../client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../logger/Logger.js\").default} Logger\n */\n\n/**\n * Base class for all query-related functionality that can be shared between Query and CostQuery.\n *\n * @abstract\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n * @augments {Executable<RequestT, ResponseT, OutputT>}\n */\nexport default class QueryBase extends Executable {\n constructor() {\n super();\n }\n\n /**\n * Create a payment transaction for a query\n *\n * @param {TransactionId} paymentTransactionId\n * @param {AccountId} nodeId\n * @param {?ClientOperator} operator\n * @param {Hbar} paymentAmount\n * @returns {Promise<HieroProto.proto.ITransaction>}\n */\n async _makePaymentTransaction(\n paymentTransactionId,\n nodeId,\n operator,\n paymentAmount,\n ) {\n const accountAmounts = [];\n\n // If an operator is provided then we should make sure we transfer\n // from the operator to the node.\n // If an operator is not provided we simply create an effectively\n // empty account amounts\n if (operator != null) {\n accountAmounts.push({\n accountID: operator.accountId._toProtobuf(),\n amount: paymentAmount.negated().toTinybars(),\n });\n accountAmounts.push({\n accountID: nodeId._toProtobuf(),\n amount: paymentAmount.toTinybars(),\n });\n } else {\n accountAmounts.push({\n accountID: new AccountId(0)._toProtobuf(),\n amount: paymentAmount.negated().toTinybars(),\n });\n accountAmounts.push({\n accountID: nodeId._toProtobuf(),\n amount: paymentAmount.toTinybars(),\n });\n }\n\n /**\n * @type {HieroProto.proto.ITransactionBody}\n */\n const body = {\n transactionID: paymentTransactionId._toProtobuf(),\n nodeAccountID: nodeId._toProtobuf(),\n transactionFee: new Hbar(1).toTinybars(),\n transactionValidDuration: {\n seconds: Long.fromNumber(120),\n },\n cryptoTransfer: {\n transfers: {\n accountAmounts,\n },\n },\n };\n\n /** @type {HieroProto.proto.ISignedTransaction} */\n const signedTransaction = {\n bodyBytes: HieroProto.proto.TransactionBody.encode(body).finish(),\n };\n\n // Sign the transaction if an operator is provided\n if (operator != null) {\n const signature = await operator.transactionSigner(\n /** @type {Uint8Array} */ (signedTransaction.bodyBytes),\n );\n\n signedTransaction.sigMap = {\n sigPair: [operator.publicKey._toProtobufSignature(signature)],\n };\n }\n\n // Create and return a `proto.Transaction`\n return {\n signedTransactionBytes:\n HieroProto.proto.SignedTransaction.encode(\n signedTransaction,\n ).finish(),\n };\n }\n}\n"],"names":["QueryBase","Executable","constructor","super","_makePaymentTransaction","paymentTransactionId","nodeId","operator","paymentAmount","accountAmounts","push","accountID","accountId","_toProtobuf","amount","negated","toTinybars","AccountId","body","transactionID","nodeAccountID","transactionFee","Hbar","transactionValidDuration","seconds","Long","fromNumber","cryptoTransfer","transfers","signedTransaction","bodyBytes","HieroProto","proto","TransactionBody","encode","finish","signature","transactionSigner","sigMap","sigPair","publicKey","_toProtobufSignature","signedTransactionBytes","SignedTransaction"],"mappings":"2JA4Be,MAAMA,UAAkBC,EACnC,WAAAC,GACIC,OACR,CAWI,6BAAMC,CACFC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAiB,GAMP,MAAZF,GACAE,EAAeC,KAAK,CAChBC,UAAWJ,EAASK,UAAUC,cAC9BC,OAAQN,EAAcO,UAAUC,eAEpCP,EAAeC,KAAK,CAChBC,UAAWL,EAAOO,cAClBC,OAAQN,EAAcQ,iBAG1BP,EAAeC,KAAK,CAChBC,UAAW,IAAIM,EAAU,GAAGJ,cAC5BC,OAAQN,EAAcO,UAAUC,eAEpCP,EAAeC,KAAK,CAChBC,UAAWL,EAAOO,cAClBC,OAAQN,EAAcQ,gBAO9B,MAAME,EAAO,CACTC,cAAed,EAAqBQ,cACpCO,cAAed,EAAOO,cACtBQ,eAAgB,IAAIC,EAAK,GAAGN,aAC5BO,yBAA0B,CACtBC,QAASC,EAAKC,WAAW,MAE7BC,eAAgB,CACZC,UAAW,CACPnB,oBAMNoB,EAAoB,CACtBC,UAAWC,EAAWC,MAAMC,gBAAgBC,OAAOhB,GAAMiB,UAI7D,GAAgB,MAAZ5B,EAAkB,CAClB,MAAM6B,QAAkB7B,EAAS8B,kBACFR,EAA2B,WAG1DA,EAAkBS,OAAS,CACvBC,QAAS,CAAChC,EAASiC,UAAUC,qBAAqBL,IAElE,CAGQ,MAAO,CACHM,uBACIX,EAAWC,MAAMW,kBAAkBT,OAC/BL,GACFM,SAElB"}
1
+ {"version":3,"file":"QueryBase.js","sources":["../../src/query/QueryBase.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Executable from \"../Executable.js\";\nimport Hbar from \"../Hbar.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\nimport Long from \"long\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../Status.js\").default} Status\n * @typedef {import(\"../Executable.js\").ExecutionState} ExecutionState\n * @typedef {import(\"../client/Client.js\").ClientOperator} ClientOperator\n * @typedef {import(\"../PublicKey.js\").default} PublicKey\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../logger/Logger.js\").default} Logger\n */\n\n/**\n * Base class for all query-related functionality that can be shared between Query and CostQuery.\n *\n * @abstract\n * @template RequestT\n * @template ResponseT\n * @template OutputT\n * @augments {Executable<RequestT, ResponseT, OutputT>}\n */\nexport default class QueryBase extends Executable {\n constructor() {\n super();\n }\n\n /**\n * Create a payment transaction for a query\n *\n * @param {TransactionId} paymentTransactionId\n * @param {AccountId} nodeId\n * @param {?ClientOperator} operator\n * @param {Hbar} paymentAmount\n * @returns {Promise<HieroProto.proto.ITransaction>}\n */\n async _makePaymentTransaction(\n paymentTransactionId,\n nodeId,\n operator,\n paymentAmount,\n ) {\n const accountAmounts = [];\n\n // If an operator is provided then we should make sure we transfer\n // from the operator to the node.\n // If an operator is not provided we simply create an effectively\n // empty account amounts\n if (operator != null) {\n accountAmounts.push({\n accountID: operator.accountId._toProtobuf(),\n amount: paymentAmount.negated().toTinybars(),\n });\n accountAmounts.push({\n accountID: nodeId._toProtobuf(),\n amount: paymentAmount.toTinybars(),\n });\n } else {\n accountAmounts.push({\n accountID: new AccountId(0)._toProtobuf(),\n amount: paymentAmount.negated().toTinybars(),\n });\n accountAmounts.push({\n accountID: nodeId._toProtobuf(),\n amount: paymentAmount.toTinybars(),\n });\n }\n\n /**\n * @type {HieroProto.proto.ITransactionBody}\n */\n const body = {\n transactionID: paymentTransactionId._toProtobuf(),\n nodeAccountID: nodeId._toProtobuf(),\n transactionFee: new Hbar(1).toTinybars(),\n transactionValidDuration: {\n seconds: Long.fromNumber(120),\n },\n cryptoTransfer: {\n transfers: {\n accountAmounts,\n },\n },\n };\n\n /** @type {HieroProto.proto.ISignedTransaction} */\n const signedTransaction = {\n bodyBytes: HieroProto.proto.TransactionBody.encode(body).finish(),\n };\n\n // Sign the transaction if an operator is provided\n if (operator != null) {\n const signature = await operator.transactionSigner(\n /** @type {Uint8Array} */ (signedTransaction.bodyBytes),\n );\n\n signedTransaction.sigMap = {\n sigPair: [operator.publicKey._toProtobufSignature(signature)],\n };\n }\n\n // Create and return a `proto.Transaction`\n return {\n signedTransactionBytes:\n HieroProto.proto.SignedTransaction.encode(\n signedTransaction,\n ).finish(),\n };\n }\n}\n"],"names":["QueryBase","Executable","constructor","super","_makePaymentTransaction","paymentTransactionId","nodeId","operator","paymentAmount","accountAmounts","push","accountID","accountId","_toProtobuf","amount","negated","toTinybars","AccountId","body","transactionID","nodeAccountID","transactionFee","Hbar","transactionValidDuration","seconds","Long","fromNumber","cryptoTransfer","transfers","signedTransaction","bodyBytes","HieroProto","proto","TransactionBody","encode","finish","signature","transactionSigner","sigMap","sigPair","publicKey","_toProtobufSignature","signedTransactionBytes","SignedTransaction"],"mappings":"2JA4Be,MAAMA,UAAkBC,EACnC,WAAAC,GACIC,OACJ,CAWA,6BAAMC,CACFC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAiB,GAMP,MAAZF,GACAE,EAAeC,KAAK,CAChBC,UAAWJ,EAASK,UAAUC,cAC9BC,OAAQN,EAAcO,UAAUC,eAEpCP,EAAeC,KAAK,CAChBC,UAAWL,EAAOO,cAClBC,OAAQN,EAAcQ,iBAG1BP,EAAeC,KAAK,CAChBC,UAAW,IAAIM,EAAU,GAAGJ,cAC5BC,OAAQN,EAAcO,UAAUC,eAEpCP,EAAeC,KAAK,CAChBC,UAAWL,EAAOO,cAClBC,OAAQN,EAAcQ,gBAO9B,MAAME,EAAO,CACTC,cAAed,EAAqBQ,cACpCO,cAAed,EAAOO,cACtBQ,eAAgB,IAAIC,EAAK,GAAGN,aAC5BO,yBAA0B,CACtBC,QAASC,EAAKC,WAAW,MAE7BC,eAAgB,CACZC,UAAW,CACPnB,oBAMNoB,EAAoB,CACtBC,UAAWC,EAAWC,MAAMC,gBAAgBC,OAAOhB,GAAMiB,UAI7D,GAAgB,MAAZ5B,EAAkB,CAClB,MAAM6B,QAAkB7B,EAAS8B,kBACFR,EAA2B,WAG1DA,EAAkBS,OAAS,CACvBC,QAAS,CAAChC,EAASiC,UAAUC,qBAAqBL,IAE1D,CAGA,MAAO,CACHM,uBACIX,EAAWC,MAAMW,kBAAkBT,OAC/BL,GACFM,SAEd"}
@@ -17,7 +17,8 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
17
17
  /**
18
18
  * @typedef {import("bignumber.js").default} BigNumber
19
19
  * @typedef {import("../channel/Channel.js").default} Channel
20
- * @typedef {import("../client/Client.js").default<*, *>} Client
20
+ * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel
21
+ * @typedef {import("../client/Client.js").default<Channel, MirrorChannel>} Client
21
22
  * @typedef {import("../transaction/TransactionId.js").default} TransactionId
22
23
  * @typedef {import("../PublicKey.js").default} PublicKey
23
24
  * @typedef {import("../PrivateKey.js").default} PrivateKey
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @typedef {import("bignumber.js").default} BigNumber
3
3
  * @typedef {import("../channel/Channel.js").default} Channel
4
- * @typedef {import("../client/Client.js").default<*, *>} Client
4
+ * @typedef {import("../channel/MirrorChannel.js").default} MirrorChannel
5
+ * @typedef {import("../client/Client.js").default<Channel, MirrorChannel>} Client
5
6
  * @typedef {import("../transaction/TransactionId.js").default} TransactionId
6
7
  * @typedef {import("../PublicKey.js").default} PublicKey
7
8
  * @typedef {import("../PrivateKey.js").default} PrivateKey
@@ -142,7 +143,8 @@ export default class ScheduleCreateTransaction extends Transaction {
142
143
  }
143
144
  export type BigNumber = import("bignumber.js").default;
144
145
  export type Channel = import("../channel/Channel.js").default;
145
- export type Client = import("../client/Client.js").default<any, any>;
146
+ export type MirrorChannel = import("../channel/MirrorChannel.js").default;
147
+ export type Client = import("../client/Client.js").default<Channel, MirrorChannel>;
146
148
  export type TransactionId = import("../transaction/TransactionId.js").default;
147
149
  export type PublicKey = import("../PublicKey.js").default;
148
150
  export type PrivateKey = import("../PrivateKey.js").default;
@@ -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 \"@hiero-ledger/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":"wQAwBe,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,MAA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D,EAAQL,SAASO,eAAeD,EAC/C,CAOI,uBAAAE,GACI,MAAO,gBACf,CAOI,oBAAAC,GACI,MAAO,CACH9D,SACsB,MAAlBT,KAAKC,UAAoBD,KAAKC,UAAUuE,iBAAmB,KAC/D7D,eAC4B,MAAxBX,KAAKG,gBACCH,KAAKG,gBAAgBsE,cACrB,KACVrC,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,KAAK,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 \"@hiero-ledger/proto\";\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../client/Client.js\").default<Channel, MirrorChannel>} 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","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,CAKA,SAAAE,GAII,MAAO,6BAFH3E,KAAK4E,gBAAgBC,QACjC,WACsDC,YAClD,CAMA,iBAAAC,CAAkB/C,GAEd,OADAhC,KAAKO,gBAAkByB,EAChBhC,IACX,CAKA,kBAAIgC,GAEA,OADAhC,KAAKwD,oBACExD,KAAKO,eAChB,CAMA,gBAAAyE,CAAiBjD,GAGb,OAFA/B,KAAKQ,eAAiBuB,EAEf/B,IACX,CAKA,iBAAI+B,GAEA,OADA/B,KAAKwD,oBACExD,KAAKQ,cAChB,EAGJyE,EAAqBC,IACjB,iBAEAvF,EAA0BsB,eAG9BkE,EAA4BC,KAAK,IAAM,IAAIzF"}
@@ -52,6 +52,10 @@ export default class ScheduleDeleteTransaction extends Transaction {
52
52
  * @returns {this}
53
53
  */
54
54
  setScheduleId(scheduleId: ScheduleId | string): this;
55
+ /**
56
+ * @param {Client} client
57
+ */
58
+ _validateChecksums(client: Client): void;
55
59
  /**
56
60
  * @override
57
61
  * @protected
@@ -1 +1 @@
1
- {"version":3,"file":"ScheduleDeleteTransaction.js","sources":["../../src/schedule/ScheduleDeleteTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport ScheduleId from \"./ScheduleId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Hbar from \"../Hbar.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hiero-ledger/proto\").proto.IScheduleDeleteTransactionBody} HieroProto.proto.IScheduleDeleteTransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.IScheduleID} HieroProto.proto.IScheduleID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"@hiero-ledger/cryptography\").Key} Key\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../Timestamp.js\").default} Timestamp\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nexport default class ScheduleDeleteTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {ScheduleId | string} [props.scheduleId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ScheduleId}\n */\n this._scheduleId = null;\n\n if (props.scheduleId != null) {\n this.setScheduleId(props.scheduleId);\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 {ScheduleDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const scheduleDelete =\n /** @type {HieroProto.proto.IScheduleDeleteTransactionBody} */ (\n body.scheduleDelete\n );\n\n return Transaction._fromProtobufTransactions(\n new ScheduleDeleteTransaction({\n scheduleId:\n scheduleDelete.scheduleID != null\n ? ScheduleId._fromProtobuf(\n /** @type {HieroProto.proto.IScheduleID} */ (\n scheduleDelete.scheduleID\n ),\n )\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?ScheduleId}\n */\n get scheduleId() {\n return this._scheduleId;\n }\n\n /**\n * @param {ScheduleId | string} scheduleId\n * @returns {this}\n */\n setScheduleId(scheduleId) {\n this._requireNotFrozen();\n this._scheduleId =\n typeof scheduleId === \"string\"\n ? ScheduleId.fromString(scheduleId)\n : scheduleId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._scheduleId != null) {\n this._scheduleId.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.deleteSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"scheduleDelete\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IScheduleDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n scheduleID:\n this._scheduleId != null\n ? this._scheduleId._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 `ScheduleDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"scheduleDelete\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ScheduleDeleteTransaction._fromProtobuf,\n);\n"],"names":["ScheduleDeleteTransaction","Transaction","constructor","props","super","this","_scheduleId","scheduleId","setScheduleId","_defaultMaxTransactionFee","Hbar","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","scheduleDelete","_fromProtobufTransactions","scheduleID","ScheduleId","undefined","_requireNotFrozen","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","schedule","deleteSchedule","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"iIAgCe,MAAMA,UAAkCC,EAKnD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,YAAc,KAEK,MAApBH,EAAMI,YACNF,KAAKG,cAAcL,EAAMI,YAG7BF,KAAKI,0BAA4B,IAAIC,EAAK,EAClD,CAWI,oBAAOC,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAIf,eAEL,OAAOf,EAAYiB,0BACf,IAAIlB,EAA0B,CAC1BO,WACiC,MAA7BU,EAAeE,WACTC,EAAWT,cAEHM,EAClC,iBAE0BI,IAEdT,EACAC,EACAC,EACAC,EACAC,EAEZ,CAKI,cAAIT,GACA,OAAOF,KAAKC,WACpB,CAMI,aAAAE,CAAcD,GAOV,OANAF,KAAKiB,oBACLjB,KAAKC,YACqB,iBAAfC,EACDa,EAAWG,WAAWhB,GACtBA,EAAWiB,QAEdnB,IACf,CAKI,kBAAAoB,CAAmBC,GACS,MAApBrB,KAAKC,aACLD,KAAKC,YAAYqB,iBAAiBD,EAE9C,CASI,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,SAASC,eAAeF,EAC/C,CAOI,uBAAAG,GACI,MAAO,gBACf,CAOI,oBAAAC,GACI,MAAO,CACHf,WACwB,MAApBd,KAAKC,YACCD,KAAKC,YAAY6B,cACjB,KAEtB,CAKI,SAAAC,GAII,MAAO,6BAFH/B,KAAKgC,gBAAgBC,QACxB,WAC6CC,YACtD,EAGAC,EAAqBC,IACjB,iBAEAzC,EAA0BW"}
1
+ {"version":3,"file":"ScheduleDeleteTransaction.js","sources":["../../src/schedule/ScheduleDeleteTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport ScheduleId from \"./ScheduleId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Hbar from \"../Hbar.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hiero-ledger/proto\").proto.IScheduleDeleteTransactionBody} HieroProto.proto.IScheduleDeleteTransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.IScheduleID} HieroProto.proto.IScheduleID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"@hiero-ledger/cryptography\").Key} Key\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../Timestamp.js\").default} Timestamp\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * Create a new Hedera™ crypto-currency account.\n */\nexport default class ScheduleDeleteTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {ScheduleId | string} [props.scheduleId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?ScheduleId}\n */\n this._scheduleId = null;\n\n if (props.scheduleId != null) {\n this.setScheduleId(props.scheduleId);\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 {ScheduleDeleteTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const scheduleDelete =\n /** @type {HieroProto.proto.IScheduleDeleteTransactionBody} */ (\n body.scheduleDelete\n );\n\n return Transaction._fromProtobufTransactions(\n new ScheduleDeleteTransaction({\n scheduleId:\n scheduleDelete.scheduleID != null\n ? ScheduleId._fromProtobuf(\n /** @type {HieroProto.proto.IScheduleID} */ (\n scheduleDelete.scheduleID\n ),\n )\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?ScheduleId}\n */\n get scheduleId() {\n return this._scheduleId;\n }\n\n /**\n * @param {ScheduleId | string} scheduleId\n * @returns {this}\n */\n setScheduleId(scheduleId) {\n this._requireNotFrozen();\n this._scheduleId =\n typeof scheduleId === \"string\"\n ? ScheduleId.fromString(scheduleId)\n : scheduleId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._scheduleId != null) {\n this._scheduleId.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.deleteSchedule(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"scheduleDelete\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IScheduleDeleteTransactionBody}\n */\n _makeTransactionData() {\n return {\n scheduleID:\n this._scheduleId != null\n ? this._scheduleId._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 `ScheduleDeleteTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"scheduleDelete\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n ScheduleDeleteTransaction._fromProtobuf,\n);\n"],"names":["ScheduleDeleteTransaction","Transaction","constructor","props","super","this","_scheduleId","scheduleId","setScheduleId","_defaultMaxTransactionFee","Hbar","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","scheduleDelete","_fromProtobufTransactions","scheduleID","ScheduleId","undefined","_requireNotFrozen","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","schedule","deleteSchedule","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"iIAgCe,MAAMA,UAAkCC,EAKnD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,YAAc,KAEK,MAApBH,EAAMI,YACNF,KAAKG,cAAcL,EAAMI,YAG7BF,KAAKI,0BAA4B,IAAIC,EAAK,EAC9C,CAWA,oBAAOC,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAI5B,eAEQ,OAAOf,EAAYiB,0BACf,IAAIlB,EAA0B,CAC1BO,WACiC,MAA7BU,EAAeE,WACTC,EAAWT,cAEHM,EAClC,iBAE0BI,IAEdT,EACAC,EACAC,EACAC,EACAC,EAER,CAKA,cAAIT,GACA,OAAOF,KAAKC,WAChB,CAMA,aAAAE,CAAcD,GAOV,OANAF,KAAKiB,oBACLjB,KAAKC,YACqB,iBAAfC,EACDa,EAAWG,WAAWhB,GACtBA,EAAWiB,QAEdnB,IACX,CAKA,kBAAAoB,CAAmBC,GACS,MAApBrB,KAAKC,aACLD,KAAKC,YAAYqB,iBAAiBD,EAE1C,CASA,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,SAASC,eAAeF,EAC3C,CAOA,uBAAAG,GACI,MAAO,gBACX,CAOA,oBAAAC,GACI,MAAO,CACHf,WACwB,MAApBd,KAAKC,YACCD,KAAKC,YAAY6B,cACjB,KAElB,CAKA,SAAAC,GAII,MAAO,6BAFH/B,KAAKgC,gBAAgBC,QACjC,WACsDC,YAClD,EAGJC,EAAqBC,IACjB,iBAEAzC,EAA0BW"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScheduleId.js","sources":["../../src/schedule/ScheduleId.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport * as entity_id from \"../EntityIdHelper.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\n\n/**\n * @typedef {import(\"long\")} Long\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Class representing a unique identifier for a scheduled transaction on the Hedera network.\n *\n * A ScheduleId consists of three components:\n * Shard ID: The shard number where the schedule exists\n * Realm ID: The realm number within the shard\n * Schedule Number: The unique number identifying the schedule\n * @augments {EntityId<HieroProto.proto.IScheduleID>}\n */\n\nexport default class ScheduleId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n */\n constructor(props, realm, num) {\n const result = entity_id.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @param {string} text\n * @returns {ScheduleId}\n */\n static fromString(text) {\n const result = entity_id.fromString(text);\n const id = new ScheduleId(result);\n id._checksum = result.checksum;\n return id;\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IScheduleID} id\n * @returns {ScheduleId}\n */\n static _fromProtobuf(id) {\n const scheduleId = new ScheduleId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.scheduleNum != null ? id.scheduleNum : 0,\n );\n\n return scheduleId;\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n entity_id.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client,\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ScheduleId}\n */\n static fromBytes(bytes) {\n return ScheduleId._fromProtobuf(\n HieroProto.proto.ScheduleID.decode(bytes),\n );\n }\n\n /**\n * @param {string} address\n * @returns {ScheduleId}\n */\n static fromSolidityAddress(address) {\n return new ScheduleId(...entity_id.fromSolidityAddress(address));\n }\n\n /**\n * @returns {string}\n */\n toSolidityAddress() {\n return entity_id.toSolidityAddress([this.shard, this.realm, this.num]);\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.ScheduleID}\n */\n _toProtobuf() {\n return {\n scheduleNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n return entity_id.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.ScheduleID.encode(this._toProtobuf()).finish();\n }\n\n /**\n * @returns {ScheduleId}\n */\n clone() {\n const id = new ScheduleId(this);\n id._checksum = this._checksum;\n return id;\n }\n\n /**\n * @param {ScheduleId} other\n * @returns {number}\n */\n compare(other) {\n return entity_id.compare(\n [this.shard, this.realm, this.num],\n [other.shard, other.realm, other.num],\n );\n }\n}\n"],"names":["ScheduleId","constructor","props","realm","num","result","entity_id.constructor","this","shard","_checksum","fromString","text","entity_id.fromString","id","checksum","_fromProtobuf","shardNum","realmNum","scheduleNum","validate","client","console","warn","validateChecksum","entity_id.validateChecksum","fromBytes","bytes","HieroProto","proto","ScheduleID","decode","fromSolidityAddress","address","entity_id.fromSolidityAddress","toSolidityAddress","entity_id.toSolidityAddress","_toProtobuf","toString","toStringWithChecksum","entity_id.toStringWithChecksum","toBytes","encode","finish","clone","compare","other","entity_id.compare"],"mappings":"sNAoBe,MAAMA,EAMjB,WAAAC,CAAYC,EAAOC,EAAOC,GACtB,MAAMC,EAASC,EAAsBJ,EAAOC,EAAOC,GAEn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,MAAM9B,EAAK,IAAIb,EAAWO,MAE1B,OADAM,EAAGJ,UAAYF,KAAKE,UACbI,CACf,CAMI,OAAA+B,CAAQC,GACJ,OAAOC,EACH,CAACvC,KAAKC,MAAOD,KAAKJ,MAAOI,KAAKH,KAC9B,CAACyC,EAAMrC,MAAOqC,EAAM1C,MAAO0C,EAAMzC,KAE7C"}
1
+ {"version":3,"file":"ScheduleId.js","sources":["../../src/schedule/ScheduleId.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport * as entity_id from \"../EntityIdHelper.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\n\n/**\n * @typedef {import(\"long\")} Long\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Class representing a unique identifier for a scheduled transaction on the Hedera network.\n *\n * A ScheduleId consists of three components:\n * Shard ID: The shard number where the schedule exists\n * Realm ID: The realm number within the shard\n * Schedule Number: The unique number identifying the schedule\n * @augments {EntityId<HieroProto.proto.IScheduleID>}\n */\n\nexport default class ScheduleId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n */\n constructor(props, realm, num) {\n const result = entity_id.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @param {string} text\n * @returns {ScheduleId}\n */\n static fromString(text) {\n const result = entity_id.fromString(text);\n const id = new ScheduleId(result);\n id._checksum = result.checksum;\n return id;\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IScheduleID} id\n * @returns {ScheduleId}\n */\n static _fromProtobuf(id) {\n const scheduleId = new ScheduleId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.scheduleNum != null ? id.scheduleNum : 0,\n );\n\n return scheduleId;\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n entity_id.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client,\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {ScheduleId}\n */\n static fromBytes(bytes) {\n return ScheduleId._fromProtobuf(\n HieroProto.proto.ScheduleID.decode(bytes),\n );\n }\n\n /**\n * @param {string} address\n * @returns {ScheduleId}\n */\n static fromSolidityAddress(address) {\n return new ScheduleId(...entity_id.fromSolidityAddress(address));\n }\n\n /**\n * @returns {string}\n */\n toSolidityAddress() {\n return entity_id.toSolidityAddress([this.shard, this.realm, this.num]);\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.ScheduleID}\n */\n _toProtobuf() {\n return {\n scheduleNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return `${this.shard.toString()}.${this.realm.toString()}.${this.num.toString()}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n return entity_id.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.ScheduleID.encode(this._toProtobuf()).finish();\n }\n\n /**\n * @returns {ScheduleId}\n */\n clone() {\n const id = new ScheduleId(this);\n id._checksum = this._checksum;\n return id;\n }\n\n /**\n * @param {ScheduleId} other\n * @returns {number}\n */\n compare(other) {\n return entity_id.compare(\n [this.shard, this.realm, this.num],\n [other.shard, other.realm, other.num],\n );\n }\n}\n"],"names":["ScheduleId","constructor","props","realm","num","result","entity_id.constructor","this","shard","_checksum","fromString","text","entity_id.fromString","id","checksum","_fromProtobuf","shardNum","realmNum","scheduleNum","validate","client","console","warn","validateChecksum","entity_id.validateChecksum","fromBytes","bytes","HieroProto","proto","ScheduleID","decode","fromSolidityAddress","address","entity_id.fromSolidityAddress","toSolidityAddress","entity_id.toSolidityAddress","_toProtobuf","toString","toStringWithChecksum","entity_id.toStringWithChecksum","toBytes","encode","finish","clone","compare","other","entity_id.compare"],"mappings":"sNAoBe,MAAMA,EAMjB,WAAAC,CAAYC,EAAOC,EAAOC,GACtB,MAAMC,EAASC,EAAsBJ,EAAOC,EAAOC,GAEnDG,KAAKC,MAAQH,EAAOG,MACpBD,KAAKJ,MAAQE,EAAOF,MACpBI,KAAKH,IAAMC,EAAOD,IAKlBG,KAAKE,UAAY,IACrB,CAMA,iBAAOC,CAAWC,GACd,MAAMN,EAASO,EAAqBD,GAC9BE,EAAK,IAAIb,EAAWK,GAE1B,OADAQ,EAAGJ,UAAYJ,EAAOS,SACfD,CACX,CAOA,oBAAOE,CAAcF,GAOjB,OANmB,IAAIb,EACJ,MAAfa,EAAGG,SAAmBH,EAAGG,SAAW,EACrB,MAAfH,EAAGI,SAAmBJ,EAAGI,SAAW,EAClB,MAAlBJ,EAAGK,YAAsBL,EAAGK,YAAc,EAIlD,CAKA,YAAIJ,GACA,OAAOP,KAAKE,SAChB,CAMA,QAAAU,CAASC,GACLC,QAAQC,KAAK,8CACbf,KAAKgB,iBAAiBH,EAC1B,CAKA,gBAAAG,CAAiBH,GACbI,EACIjB,KAAKC,MACLD,KAAKJ,MACLI,KAAKH,IACLG,KAAKE,UACLW,EAER,CAMA,gBAAOK,CAAUC,GACb,OAAO1B,EAAWe,cACdY,EAAWC,MAAMC,WAAWC,OAAOJ,GAE3C,CAMA,0BAAOK,CAAoBC,GACvB,OAAO,IAAIhC,KAAciC,EAA8BD,GAC3D,CAKA,iBAAAE,GACI,OAAOC,EAA4B,CAAC5B,KAAKC,MAAOD,KAAKJ,MAAOI,KAAKH,KACrE,CAMA,WAAAgC,GACI,MAAO,CACHlB,YAAaX,KAAKH,IAClBY,SAAUT,KAAKC,MACfS,SAAUV,KAAKJ,MAEvB,CAKA,QAAAkC,GACI,MAAO,GAAG9B,KAAKC,MAAM6B,cAAc9B,KAAKJ,MAAMkC,cAAc9B,KAAKH,IAAIiC,YACzE,CAMA,oBAAAC,CAAqBlB,GACjB,OAAOmB,EAA+BhC,KAAK8B,WAAYjB,EAC3D,CAKA,OAAAoB,GACI,OAAOb,EAAWC,MAAMC,WAAWY,OAAOlC,KAAK6B,eAAeM,QAClE,CAKA,KAAAC,GACI,MAAM9B,EAAK,IAAIb,EAAWO,MAE1B,OADAM,EAAGJ,UAAYF,KAAKE,UACbI,CACX,CAMA,OAAA+B,CAAQC,GACJ,OAAOC,EACH,CAACvC,KAAKC,MAAOD,KAAKJ,MAAOI,KAAKH,KAC9B,CAACyC,EAAMrC,MAAOqC,EAAM1C,MAAO0C,EAAMzC,KAEzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScheduleInfo.js","sources":["../../src/schedule/ScheduleInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport ScheduleId from \"./ScheduleId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Transaction from \"../transaction/Transaction.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport Key from \"../Key.js\";\nimport KeyList from \"../KeyList.js\";\n\nconst { proto } = HieroProto;\n\n/**\n * Response when the client sends the node ScheduleGetInfoQuery.\n */\nexport default class ScheduleInfo {\n /**\n * @private\n * @param {object} props\n * @param {ScheduleId} props.scheduleId;\n * @param {?AccountId} props.creatorAccountID;\n * @param {?AccountId} props.payerAccountID;\n * @param {?HieroProto.proto.ISchedulableTransactionBody} props.schedulableTransactionBody;\n * @param {?Key} props.adminKey\n * @param {?KeyList} props.signers;\n * @param {?string} props.scheduleMemo;\n * @param {?Timestamp} props.expirationTime;\n * @param {?Timestamp} props.executed;\n * @param {?Timestamp} props.deleted;\n * @param {?TransactionId} props.scheduledTransactionId;\n * @param {boolean} props.waitForExpiry;\n */\n constructor(props) {\n /**\n * @readonly\n */\n this.scheduleId = props.scheduleId;\n\n /**\n * @readonly\n */\n this.creatorAccountId = props.creatorAccountID;\n\n /**\n * @readonly\n */\n this.payerAccountId = props.payerAccountID;\n\n /**\n * @readonly\n */\n this.schedulableTransactionBody = props.schedulableTransactionBody;\n\n /**\n * @readonly\n */\n this.signers = props.signers;\n\n /**\n * @readonly\n */\n this.scheduleMemo = props.scheduleMemo;\n\n /**\n * @readonly\n */\n this.adminKey = props.adminKey != null ? props.adminKey : null;\n\n /**\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * @readonly\n */\n this.executed = props.executed;\n\n /**\n * @readonly\n */\n this.deleted = props.deleted;\n\n /**\n * @readonly\n */\n this.scheduledTransactionId = props.scheduledTransactionId;\n\n /**\n *\n * @readonly\n */\n this.waitForExpiry = props.waitForExpiry;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IScheduleInfo} info\n * @returns {ScheduleInfo}\n */\n static _fromProtobuf(info) {\n return new ScheduleInfo({\n scheduleId: ScheduleId._fromProtobuf(\n /** @type {HieroProto.proto.IScheduleID} */ (info.scheduleID),\n ),\n creatorAccountID:\n info.creatorAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n info.creatorAccountID\n ),\n )\n : null,\n payerAccountID:\n info.payerAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n info.payerAccountID\n ),\n )\n : null,\n schedulableTransactionBody:\n info.scheduledTransactionBody != null\n ? info.scheduledTransactionBody\n : null,\n adminKey:\n info.adminKey != null\n ? Key._fromProtobufKey(info.adminKey)\n : null,\n signers:\n info.signers != null\n ? KeyList.__fromProtobufKeyList(info.signers)\n : null,\n scheduleMemo: info.memo != null ? info.memo : null,\n expirationTime:\n info.expirationTime != null\n ? Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.expirationTime\n ),\n )\n : null,\n executed:\n info.executionTime != null\n ? Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.executionTime\n ),\n )\n : null,\n deleted:\n info.deletionTime != null\n ? Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.deletionTime\n ),\n )\n : null,\n scheduledTransactionId:\n info.scheduledTransactionID != null\n ? TransactionId._fromProtobuf(info.scheduledTransactionID)\n : null,\n waitForExpiry:\n info.waitForExpiry != null ? info.waitForExpiry : false,\n });\n }\n\n /**\n * @returns {HieroProto.proto.IScheduleInfo}\n */\n _toProtobuf() {\n return {\n scheduleID:\n this.scheduleId != null ? this.scheduleId._toProtobuf() : null,\n creatorAccountID:\n this.creatorAccountId != null\n ? this.creatorAccountId._toProtobuf()\n : null,\n payerAccountID:\n this.payerAccountId != null\n ? this.payerAccountId._toProtobuf()\n : null,\n scheduledTransactionBody:\n this.schedulableTransactionBody != null\n ? this.schedulableTransactionBody\n : null,\n adminKey:\n this.adminKey != null ? this.adminKey._toProtobufKey() : null,\n signers:\n this.signers != null\n ? this.signers._toProtobufKey().keyList\n : null,\n memo: this.scheduleMemo != null ? this.scheduleMemo : \"\",\n expirationTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : null,\n scheduledTransactionID:\n this.scheduledTransactionId != null\n ? this.scheduledTransactionId._toProtobuf()\n : null,\n waitForExpiry: this.waitForExpiry,\n };\n }\n\n /**\n * @returns {Transaction}\n */\n get scheduledTransaction() {\n if (this.schedulableTransactionBody == null) {\n throw new Error(\"Scheduled transaction body is empty\");\n }\n\n const scheduled = new proto.SchedulableTransactionBody(\n this.schedulableTransactionBody,\n );\n const data =\n /** @type {NonNullable<HieroProto.proto.SchedulableTransactionBody[\"data\"]>} */ (\n scheduled.data\n );\n\n return Transaction.fromBytes(\n proto.TransactionList.encode({\n transactionList: [\n {\n signedTransactionBytes: proto.SignedTransaction.encode({\n bodyBytes: proto.TransactionBody.encode({\n transactionFee:\n this.schedulableTransactionBody\n .transactionFee,\n memo: this.schedulableTransactionBody.memo,\n [data]: scheduled[data],\n }).finish(),\n }).finish(),\n },\n ],\n }).finish(),\n );\n }\n}\n"],"names":["proto","HieroProto","ScheduleInfo","constructor","props","this","scheduleId","creatorAccountId","creatorAccountID","payerAccountId","payerAccountID","schedulableTransactionBody","signers","scheduleMemo","adminKey","expirationTime","executed","deleted","scheduledTransactionId","waitForExpiry","Object","freeze","_fromProtobuf","info","ScheduleId","AccountId","scheduledTransactionBody","Key","_fromProtobufKey","KeyList","__fromProtobufKeyList","memo","Timestamp","executionTime","deletionTime","scheduledTransactionID","TransactionId","_toProtobuf","scheduleID","_toProtobufKey","keyList","scheduledTransaction","Error","scheduled","SchedulableTransactionBody","data","Transaction","fromBytes","TransactionList","encode","transactionList","signedTransactionBytes","SignedTransaction","bodyBytes","TransactionBody","transactionFee","finish"],"mappings":"6RAWA,MAAMA,MAAEA,GAAUC,EAKH,MAAMC,EAiBjB,WAAAC,CAAYC,GAIRC,KAAKC,WAAaF,EAAME,WAKxBD,KAAKE,iBAAmBH,EAAMI,iBAK9BH,KAAKI,eAAiBL,EAAMM,eAK5BL,KAAKM,2BAA6BP,EAAMO,2BAKxCN,KAAKO,QAAUR,EAAMQ,QAKrBP,KAAKQ,aAAeT,EAAMS,aAK1BR,KAAKS,SAA6B,MAAlBV,EAAMU,SAAmBV,EAAMU,SAAW,KAK1DT,KAAKU,eAAiBX,EAAMW,eAK5BV,KAAKW,SAAWZ,EAAMY,SAKtBX,KAAKY,QAAUb,EAAMa,QAKrBZ,KAAKa,uBAAyBd,EAAMc,uBAMpCb,KAAKc,cAAgBf,EAAMe,cAE3BC,OAAOC,OAAOhB,KACtB,CAOI,oBAAOiB,CAAcC,GACjB,OAAO,IAAIrB,EAAa,CACpBI,WAAYkB,EAAWF,cAC0BC,EAAe,YAEhEf,iBAC6B,MAAzBe,EAAKf,iBACCiB,EAAUH,cAEFC,EAC9B,kBAEsB,KACVb,eAC2B,MAAvBa,EAAKb,eACCe,EA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AM,uCAGpB,MAAMC,EAAY,IAAI3C,EAAM4C,2BACxBvC,KAAKM,4BAEHkC,EAEEF,EACH,KAEL,OAAOG,EAAYC,UACf/C,EAAMgD,gBAAgBC,OAAO,CACzBC,gBAAiB,CACb,CACIC,uBAAwBnD,EAAMoD,kBAAkBH,OAAO,CACnDI,UAAWrD,EAAMsD,gBAAgBL,OAAO,CACpCM,eACIlD,KAAKM,2BACA4C,eACTxB,KAAM1B,KAAKM,2BAA2BoB,KACtCc,CAACA,GAAOF,EAAUE,KACnBW,WACJA,aAGZA,SAEf"}
1
+ {"version":3,"file":"ScheduleInfo.js","sources":["../../src/schedule/ScheduleInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport ScheduleId from \"./ScheduleId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Transaction from \"../transaction/Transaction.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport Key from \"../Key.js\";\nimport KeyList from \"../KeyList.js\";\n\nconst { proto } = HieroProto;\n\n/**\n * Response when the client sends the node ScheduleGetInfoQuery.\n */\nexport default class ScheduleInfo {\n /**\n * @private\n * @param {object} props\n * @param {ScheduleId} props.scheduleId;\n * @param {?AccountId} props.creatorAccountID;\n * @param {?AccountId} props.payerAccountID;\n * @param {?HieroProto.proto.ISchedulableTransactionBody} props.schedulableTransactionBody;\n * @param {?Key} props.adminKey\n * @param {?KeyList} props.signers;\n * @param {?string} props.scheduleMemo;\n * @param {?Timestamp} props.expirationTime;\n * @param {?Timestamp} props.executed;\n * @param {?Timestamp} props.deleted;\n * @param {?TransactionId} props.scheduledTransactionId;\n * @param {boolean} props.waitForExpiry;\n */\n constructor(props) {\n /**\n * @readonly\n */\n this.scheduleId = props.scheduleId;\n\n /**\n * @readonly\n */\n this.creatorAccountId = props.creatorAccountID;\n\n /**\n * @readonly\n */\n this.payerAccountId = props.payerAccountID;\n\n /**\n * @readonly\n */\n this.schedulableTransactionBody = props.schedulableTransactionBody;\n\n /**\n * @readonly\n */\n this.signers = props.signers;\n\n /**\n * @readonly\n */\n this.scheduleMemo = props.scheduleMemo;\n\n /**\n * @readonly\n */\n this.adminKey = props.adminKey != null ? props.adminKey : null;\n\n /**\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * @readonly\n */\n this.executed = props.executed;\n\n /**\n * @readonly\n */\n this.deleted = props.deleted;\n\n /**\n * @readonly\n */\n this.scheduledTransactionId = props.scheduledTransactionId;\n\n /**\n *\n * @readonly\n */\n this.waitForExpiry = props.waitForExpiry;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IScheduleInfo} info\n * @returns {ScheduleInfo}\n */\n static _fromProtobuf(info) {\n return new ScheduleInfo({\n scheduleId: ScheduleId._fromProtobuf(\n /** @type {HieroProto.proto.IScheduleID} */ (info.scheduleID),\n ),\n creatorAccountID:\n info.creatorAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n info.creatorAccountID\n ),\n )\n : null,\n payerAccountID:\n info.payerAccountID != null\n ? AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (\n info.payerAccountID\n ),\n )\n : null,\n schedulableTransactionBody:\n info.scheduledTransactionBody != null\n ? info.scheduledTransactionBody\n : null,\n adminKey:\n info.adminKey != null\n ? Key._fromProtobufKey(info.adminKey)\n : null,\n signers:\n info.signers != null\n ? KeyList.__fromProtobufKeyList(info.signers)\n : null,\n scheduleMemo: info.memo != null ? info.memo : null,\n expirationTime:\n info.expirationTime != null\n ? Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.expirationTime\n ),\n )\n : null,\n executed:\n info.executionTime != null\n ? Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.executionTime\n ),\n )\n : null,\n deleted:\n info.deletionTime != null\n ? Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.deletionTime\n ),\n )\n : null,\n scheduledTransactionId:\n info.scheduledTransactionID != null\n ? TransactionId._fromProtobuf(info.scheduledTransactionID)\n : null,\n waitForExpiry:\n info.waitForExpiry != null ? info.waitForExpiry : false,\n });\n }\n\n /**\n * @returns {HieroProto.proto.IScheduleInfo}\n */\n _toProtobuf() {\n return {\n scheduleID:\n this.scheduleId != null ? this.scheduleId._toProtobuf() : null,\n creatorAccountID:\n this.creatorAccountId != null\n ? this.creatorAccountId._toProtobuf()\n : null,\n payerAccountID:\n this.payerAccountId != null\n ? this.payerAccountId._toProtobuf()\n : null,\n scheduledTransactionBody:\n this.schedulableTransactionBody != null\n ? this.schedulableTransactionBody\n : null,\n adminKey:\n this.adminKey != null ? this.adminKey._toProtobufKey() : null,\n signers:\n this.signers != null\n ? this.signers._toProtobufKey().keyList\n : null,\n memo: this.scheduleMemo != null ? this.scheduleMemo : \"\",\n expirationTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : null,\n scheduledTransactionID:\n this.scheduledTransactionId != null\n ? this.scheduledTransactionId._toProtobuf()\n : null,\n waitForExpiry: this.waitForExpiry,\n };\n }\n\n /**\n * @returns {Transaction}\n */\n get scheduledTransaction() {\n if (this.schedulableTransactionBody == null) {\n throw new Error(\"Scheduled transaction body is empty\");\n }\n\n const scheduled = new proto.SchedulableTransactionBody(\n this.schedulableTransactionBody,\n );\n const data =\n /** @type {NonNullable<HieroProto.proto.SchedulableTransactionBody[\"data\"]>} */ (\n scheduled.data\n );\n\n return Transaction.fromBytes(\n proto.TransactionList.encode({\n transactionList: [\n {\n signedTransactionBytes: proto.SignedTransaction.encode({\n bodyBytes: proto.TransactionBody.encode({\n transactionFee:\n this.schedulableTransactionBody\n .transactionFee,\n memo: this.schedulableTransactionBody.memo,\n [data]: scheduled[data],\n }).finish(),\n }).finish(),\n },\n ],\n }).finish(),\n );\n }\n}\n"],"names":["proto","HieroProto","ScheduleInfo","constructor","props","this","scheduleId","creatorAccountId","creatorAccountID","payerAccountId","payerAccountID","schedulableTransactionBody","signers","scheduleMemo","adminKey","expirationTime","executed","deleted","scheduledTransactionId","waitForExpiry","Object","freeze","_fromProtobuf","info","ScheduleId","AccountId","scheduledTransactionBody","Key","_fromProtobufKey","KeyList","__fromProtobufKeyList","memo","Timestamp","executionTime","deletionTime","scheduledTransactionID","TransactionId","_toProtobuf","scheduleID","_toProtobufKey","keyList","scheduledTransaction","Error","scheduled","SchedulableTransactionBody","data","Transaction","fromBytes","TransactionList","encode","transactionList","signedTransactionBytes","SignedTransaction","bodyBytes","TransactionBody","transactionFee","finish"],"mappings":"6RAWA,MAAMA,MAAEA,GAAUC,EAKH,MAAMC,EAiBjB,WAAAC,CAAYC,GAIRC,KAAKC,WAAaF,EAAME,WAKxBD,KAAKE,iBAAmBH,EAAMI,iBAK9BH,KAAKI,eAAiBL,EAAMM,eAK5BL,KAAKM,2BAA6BP,EAAMO,2BAKxCN,KAAKO,QAAUR,EAAMQ,QAKrBP,KAAKQ,aAAeT,EAAMS,aAK1BR,KAAKS,SAA6B,MAAlBV,EAAMU,SAAmBV,EAAMU,SAAW,KAK1DT,KAAKU,eAAiBX,EAAMW,eAK5BV,KAAKW,SAAWZ,EAAMY,SAKtBX,KAAKY,QAAUb,EAAMa,QAKrBZ,KAAKa,uBAAyBd,EAAMc,uBAMpCb,KAAKc,cAAgBf,EAAMe,cAE3BC,OAAOC,OAAOhB,KAClB,CAOA,oBAAOiB,CAAcC,GACjB,OAAO,IAAIrB,EAAa,CACpBI,WAAYkB,EAAWF,cAC0BC,EAAe,YAEhEf,iBAC6B,MAAzBe,EAAKf,iBACCiB,EAAUH,cAEFC,EAC9B,kBAEsB,KACVb,eAC2B,MAAvBa,EAAKb,eACCe,EAAUH,cAEFC,EAC9B,gBAEsB,KACVZ,2BACqC,MAAjCY,EAAKG,yBACCH,EAAKG,yBACL,KACVZ,SACqB,MAAjBS,EAAKT,SACCa,EAAIC,iBAAiBL,EA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