@hiero-ledger/sdk 2.70.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 (1272) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +167 -0
  3. package/dist/umd.js +98781 -0
  4. package/dist/umd.min.js +122 -0
  5. package/lib/BadEntityIdError.cjs +27 -0
  6. package/lib/BadEntityIdError.d.ts +15 -0
  7. package/lib/BadEntityIdError.js +2 -0
  8. package/lib/BadEntityIdError.js.map +1 -0
  9. package/lib/Cache.cjs +376 -0
  10. package/lib/Cache.d.ts +228 -0
  11. package/lib/Cache.js +2 -0
  12. package/lib/Cache.js.map +1 -0
  13. package/lib/Duration.cjs +53 -0
  14. package/lib/Duration.d.ts +37 -0
  15. package/lib/Duration.js +2 -0
  16. package/lib/Duration.js.map +1 -0
  17. package/lib/EntityIdHelper.cjs +547 -0
  18. package/lib/EntityIdHelper.d.ts +203 -0
  19. package/lib/EntityIdHelper.js +2 -0
  20. package/lib/EntityIdHelper.js.map +1 -0
  21. package/lib/EthereumFlow.cjs +207 -0
  22. package/lib/EthereumFlow.d.ts +134 -0
  23. package/lib/EthereumFlow.js +2 -0
  24. package/lib/EthereumFlow.js.map +1 -0
  25. package/lib/EthereumTransaction.cjs +260 -0
  26. package/lib/EthereumTransaction.d.ts +161 -0
  27. package/lib/EthereumTransaction.js +2 -0
  28. package/lib/EthereumTransaction.js.map +1 -0
  29. package/lib/EthereumTransactionData.cjs +66 -0
  30. package/lib/EthereumTransactionData.d.ts +33 -0
  31. package/lib/EthereumTransactionData.js +2 -0
  32. package/lib/EthereumTransactionData.js.map +1 -0
  33. package/lib/EthereumTransactionDataEip1559.cjs +134 -0
  34. package/lib/EthereumTransactionDataEip1559.d.ts +64 -0
  35. package/lib/EthereumTransactionDataEip1559.js +2 -0
  36. package/lib/EthereumTransactionDataEip1559.js.map +1 -0
  37. package/lib/EthereumTransactionDataEip2930.cjs +129 -0
  38. package/lib/EthereumTransactionDataEip2930.d.ts +60 -0
  39. package/lib/EthereumTransactionDataEip2930.js +2 -0
  40. package/lib/EthereumTransactionDataEip2930.js.map +1 -0
  41. package/lib/EthereumTransactionDataLegacy.cjs +112 -0
  42. package/lib/EthereumTransactionDataLegacy.d.ts +52 -0
  43. package/lib/EthereumTransactionDataLegacy.js +2 -0
  44. package/lib/EthereumTransactionDataLegacy.js.map +1 -0
  45. package/lib/EvmAddress.cjs +84 -0
  46. package/lib/EvmAddress.d.ts +47 -0
  47. package/lib/EvmAddress.js +2 -0
  48. package/lib/EvmAddress.js.map +1 -0
  49. package/lib/ExchangeRate.cjs +113 -0
  50. package/lib/ExchangeRate.d.ts +75 -0
  51. package/lib/ExchangeRate.js +2 -0
  52. package/lib/ExchangeRate.js.map +1 -0
  53. package/lib/ExchangeRates.cjs +75 -0
  54. package/lib/ExchangeRates.d.ts +39 -0
  55. package/lib/ExchangeRates.js +2 -0
  56. package/lib/ExchangeRates.js.map +1 -0
  57. package/lib/Executable.cjs +760 -0
  58. package/lib/Executable.d.ts +365 -0
  59. package/lib/Executable.js +2 -0
  60. package/lib/Executable.js.map +1 -0
  61. package/lib/FeeComponents.cjs +170 -0
  62. package/lib/FeeComponents.d.ts +66 -0
  63. package/lib/FeeComponents.js +2 -0
  64. package/lib/FeeComponents.js.map +1 -0
  65. package/lib/FeeData.cjs +111 -0
  66. package/lib/FeeData.d.ts +58 -0
  67. package/lib/FeeData.js +2 -0
  68. package/lib/FeeData.js.map +1 -0
  69. package/lib/FeeDataType.cjs +128 -0
  70. package/lib/FeeDataType.d.ts +44 -0
  71. package/lib/FeeDataType.js +2 -0
  72. package/lib/FeeDataType.js.map +1 -0
  73. package/lib/FeeSchedule.cjs +79 -0
  74. package/lib/FeeSchedule.d.ts +40 -0
  75. package/lib/FeeSchedule.js +2 -0
  76. package/lib/FeeSchedule.js.map +1 -0
  77. package/lib/FeeSchedules.cjs +79 -0
  78. package/lib/FeeSchedules.d.ts +40 -0
  79. package/lib/FeeSchedules.js +2 -0
  80. package/lib/FeeSchedules.js.map +1 -0
  81. package/lib/FreezeType.cjs +117 -0
  82. package/lib/FreezeType.d.ts +42 -0
  83. package/lib/FreezeType.js +2 -0
  84. package/lib/FreezeType.js.map +1 -0
  85. package/lib/Hbar.cjs +139 -0
  86. package/lib/Hbar.d.ts +62 -0
  87. package/lib/Hbar.js +2 -0
  88. package/lib/Hbar.js.map +1 -0
  89. package/lib/HbarUnit.cjs +77 -0
  90. package/lib/HbarUnit.d.ts +46 -0
  91. package/lib/HbarUnit.js +2 -0
  92. package/lib/HbarUnit.js.map +1 -0
  93. package/lib/Key.cjs +62 -0
  94. package/lib/Key.d.ts +23 -0
  95. package/lib/Key.js +2 -0
  96. package/lib/Key.js.map +1 -0
  97. package/lib/KeyList.cjs +181 -0
  98. package/lib/KeyList.d.ts +87 -0
  99. package/lib/KeyList.js +2 -0
  100. package/lib/KeyList.js.map +1 -0
  101. package/lib/LedgerId.cjs +137 -0
  102. package/lib/LedgerId.d.ts +64 -0
  103. package/lib/LedgerId.js +2 -0
  104. package/lib/LedgerId.js.map +1 -0
  105. package/lib/LocalProvider.cjs +159 -0
  106. package/lib/LocalProvider.d.ts +120 -0
  107. package/lib/LocalProvider.js +2 -0
  108. package/lib/LocalProvider.js.map +1 -0
  109. package/lib/ManagedNode.cjs +245 -0
  110. package/lib/ManagedNode.d.ts +127 -0
  111. package/lib/ManagedNode.js +2 -0
  112. package/lib/ManagedNode.js.map +1 -0
  113. package/lib/ManagedNodeAddress.cjs +104 -0
  114. package/lib/ManagedNodeAddress.d.ts +51 -0
  115. package/lib/ManagedNodeAddress.js +2 -0
  116. package/lib/ManagedNodeAddress.js.map +1 -0
  117. package/lib/MaxAttemptsOrTimeoutError.cjs +48 -0
  118. package/lib/MaxAttemptsOrTimeoutError.d.ts +26 -0
  119. package/lib/MaxAttemptsOrTimeoutError.js +2 -0
  120. package/lib/MaxAttemptsOrTimeoutError.js.map +1 -0
  121. package/lib/MaxQueryPaymentExceeded.cjs +34 -0
  122. package/lib/MaxQueryPaymentExceeded.d.ts +21 -0
  123. package/lib/MaxQueryPaymentExceeded.js +2 -0
  124. package/lib/MaxQueryPaymentExceeded.js.map +1 -0
  125. package/lib/MirrorNode.cjs +48 -0
  126. package/lib/MirrorNode.d.ts +39 -0
  127. package/lib/MirrorNode.js +2 -0
  128. package/lib/MirrorNode.js.map +1 -0
  129. package/lib/Mnemonic.cjs +232 -0
  130. package/lib/Mnemonic.d.ts +145 -0
  131. package/lib/Mnemonic.js +2 -0
  132. package/lib/Mnemonic.js.map +1 -0
  133. package/lib/Node.cjs +114 -0
  134. package/lib/Node.d.ts +72 -0
  135. package/lib/Node.js +2 -0
  136. package/lib/Node.js.map +1 -0
  137. package/lib/ObjectMap.cjs +137 -0
  138. package/lib/ObjectMap.d.ts +88 -0
  139. package/lib/ObjectMap.js +2 -0
  140. package/lib/ObjectMap.js.map +1 -0
  141. package/lib/PrecheckStatusError.cjs +77 -0
  142. package/lib/PrecheckStatusError.d.ts +68 -0
  143. package/lib/PrecheckStatusError.js +2 -0
  144. package/lib/PrecheckStatusError.js.map +1 -0
  145. package/lib/PrivateKey.cjs +529 -0
  146. package/lib/PrivateKey.d.ts +312 -0
  147. package/lib/PrivateKey.js +2 -0
  148. package/lib/PrivateKey.js.map +1 -0
  149. package/lib/PrngTransaction.cjs +136 -0
  150. package/lib/PrngTransaction.d.ts +74 -0
  151. package/lib/PrngTransaction.js +2 -0
  152. package/lib/PrngTransaction.js.map +1 -0
  153. package/lib/Provider.cjs +41 -0
  154. package/lib/Provider.d.ts +32 -0
  155. package/lib/Provider.js +2 -0
  156. package/lib/Provider.js.map +1 -0
  157. package/lib/PublicKey.cjs +285 -0
  158. package/lib/PublicKey.d.ts +142 -0
  159. package/lib/PublicKey.js +2 -0
  160. package/lib/PublicKey.js.map +1 -0
  161. package/lib/ReceiptStatusError.cjs +45 -0
  162. package/lib/ReceiptStatusError.d.ts +38 -0
  163. package/lib/ReceiptStatusError.js +2 -0
  164. package/lib/ReceiptStatusError.js.map +1 -0
  165. package/lib/RecordStatusError.cjs +34 -0
  166. package/lib/RecordStatusError.d.ts +27 -0
  167. package/lib/RecordStatusError.js +2 -0
  168. package/lib/RecordStatusError.js.map +1 -0
  169. package/lib/RequestType.cjs +922 -0
  170. package/lib/RequestType.d.ts +131 -0
  171. package/lib/RequestType.js +2 -0
  172. package/lib/RequestType.js.map +1 -0
  173. package/lib/Signer.cjs +47 -0
  174. package/lib/Signer.d.ts +38 -0
  175. package/lib/Signer.js +2 -0
  176. package/lib/Signer.js.map +1 -0
  177. package/lib/SignerSignature.cjs +34 -0
  178. package/lib/SignerSignature.d.ts +29 -0
  179. package/lib/SignerSignature.js +2 -0
  180. package/lib/SignerSignature.js.map +1 -0
  181. package/lib/StakingInfo.cjs +160 -0
  182. package/lib/StakingInfo.d.ts +109 -0
  183. package/lib/StakingInfo.js +2 -0
  184. package/lib/StakingInfo.js.map +1 -0
  185. package/lib/Status.cjs +3353 -0
  186. package/lib/Status.d.ts +395 -0
  187. package/lib/Status.js +2 -0
  188. package/lib/Status.js.map +1 -0
  189. package/lib/StatusError.cjs +66 -0
  190. package/lib/StatusError.d.ts +41 -0
  191. package/lib/StatusError.js +2 -0
  192. package/lib/StatusError.js.map +1 -0
  193. package/lib/Timestamp.cjs +144 -0
  194. package/lib/Timestamp.d.ts +69 -0
  195. package/lib/Timestamp.js +2 -0
  196. package/lib/Timestamp.js.map +1 -0
  197. package/lib/TransactionFeeSchedule.cjs +85 -0
  198. package/lib/TransactionFeeSchedule.d.ts +39 -0
  199. package/lib/TransactionFeeSchedule.js +2 -0
  200. package/lib/TransactionFeeSchedule.js.map +1 -0
  201. package/lib/Transfer.cjs +104 -0
  202. package/lib/Transfer.d.ts +77 -0
  203. package/lib/Transfer.js +2 -0
  204. package/lib/Transfer.js.map +1 -0
  205. package/lib/Wallet.cjs +253 -0
  206. package/lib/Wallet.d.ts +147 -0
  207. package/lib/Wallet.js +2 -0
  208. package/lib/Wallet.js.map +1 -0
  209. package/lib/account/AccountAllowanceAdjustTransaction.cjs +366 -0
  210. package/lib/account/AccountAllowanceAdjustTransaction.d.ts +208 -0
  211. package/lib/account/AccountAllowanceAdjustTransaction.js +2 -0
  212. package/lib/account/AccountAllowanceAdjustTransaction.js.map +1 -0
  213. package/lib/account/AccountAllowanceApproveTransaction.cjs +353 -0
  214. package/lib/account/AccountAllowanceApproveTransaction.d.ts +194 -0
  215. package/lib/account/AccountAllowanceApproveTransaction.js +2 -0
  216. package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -0
  217. package/lib/account/AccountAllowanceDeleteTransaction.cjs +166 -0
  218. package/lib/account/AccountAllowanceDeleteTransaction.d.ts +90 -0
  219. package/lib/account/AccountAllowanceDeleteTransaction.js +2 -0
  220. package/lib/account/AccountAllowanceDeleteTransaction.js.map +1 -0
  221. package/lib/account/AccountBalance.cjs +145 -0
  222. package/lib/account/AccountBalance.d.ts +72 -0
  223. package/lib/account/AccountBalance.js +2 -0
  224. package/lib/account/AccountBalance.js.map +1 -0
  225. package/lib/account/AccountBalanceQuery.cjs +210 -0
  226. package/lib/account/AccountBalanceQuery.d.ts +92 -0
  227. package/lib/account/AccountBalanceQuery.js +2 -0
  228. package/lib/account/AccountBalanceQuery.js.map +1 -0
  229. package/lib/account/AccountCreateTransaction.cjs +566 -0
  230. package/lib/account/AccountCreateTransaction.d.ts +309 -0
  231. package/lib/account/AccountCreateTransaction.js +2 -0
  232. package/lib/account/AccountCreateTransaction.js.map +1 -0
  233. package/lib/account/AccountDeleteTransaction.cjs +181 -0
  234. package/lib/account/AccountDeleteTransaction.d.ts +97 -0
  235. package/lib/account/AccountDeleteTransaction.js +2 -0
  236. package/lib/account/AccountDeleteTransaction.js.map +1 -0
  237. package/lib/account/AccountId.cjs +400 -0
  238. package/lib/account/AccountId.d.ts +149 -0
  239. package/lib/account/AccountId.js +2 -0
  240. package/lib/account/AccountId.js.map +1 -0
  241. package/lib/account/AccountInfo.cjs +356 -0
  242. package/lib/account/AccountInfo.d.ts +234 -0
  243. package/lib/account/AccountInfo.js +2 -0
  244. package/lib/account/AccountInfo.js.map +1 -0
  245. package/lib/account/AccountInfoFlow.cjs +88 -0
  246. package/lib/account/AccountInfoFlow.d.ts +53 -0
  247. package/lib/account/AccountInfoFlow.js +2 -0
  248. package/lib/account/AccountInfoFlow.js.map +1 -0
  249. package/lib/account/AccountInfoQuery.cjs +170 -0
  250. package/lib/account/AccountInfoQuery.d.ts +67 -0
  251. package/lib/account/AccountInfoQuery.js +2 -0
  252. package/lib/account/AccountInfoQuery.js.map +1 -0
  253. package/lib/account/AccountRecordsQuery.cjs +163 -0
  254. package/lib/account/AccountRecordsQuery.d.ts +67 -0
  255. package/lib/account/AccountRecordsQuery.js +2 -0
  256. package/lib/account/AccountRecordsQuery.js.map +1 -0
  257. package/lib/account/AccountUpdateTransaction.cjs +503 -0
  258. package/lib/account/AccountUpdateTransaction.d.ts +271 -0
  259. package/lib/account/AccountUpdateTransaction.js +2 -0
  260. package/lib/account/AccountUpdateTransaction.js.map +1 -0
  261. package/lib/account/HbarAllowance.cjs +126 -0
  262. package/lib/account/HbarAllowance.d.ts +85 -0
  263. package/lib/account/HbarAllowance.js +2 -0
  264. package/lib/account/HbarAllowance.js.map +1 -0
  265. package/lib/account/HbarTransferMap.cjs +45 -0
  266. package/lib/account/HbarTransferMap.d.ts +31 -0
  267. package/lib/account/HbarTransferMap.js +2 -0
  268. package/lib/account/HbarTransferMap.js.map +1 -0
  269. package/lib/account/LiveHash.cjs +76 -0
  270. package/lib/account/LiveHash.d.ts +49 -0
  271. package/lib/account/LiveHash.js +2 -0
  272. package/lib/account/LiveHash.js.map +1 -0
  273. package/lib/account/LiveHashAddTransaction.cjs +238 -0
  274. package/lib/account/LiveHashAddTransaction.d.ts +125 -0
  275. package/lib/account/LiveHashAddTransaction.js +2 -0
  276. package/lib/account/LiveHashAddTransaction.js.map +1 -0
  277. package/lib/account/LiveHashDeleteTransaction.cjs +170 -0
  278. package/lib/account/LiveHashDeleteTransaction.d.ts +88 -0
  279. package/lib/account/LiveHashDeleteTransaction.js +2 -0
  280. package/lib/account/LiveHashDeleteTransaction.js.map +1 -0
  281. package/lib/account/LiveHashQuery.cjs +188 -0
  282. package/lib/account/LiveHashQuery.d.ts +91 -0
  283. package/lib/account/LiveHashQuery.js +2 -0
  284. package/lib/account/LiveHashQuery.js.map +1 -0
  285. package/lib/account/NullableTokenDecimalMap.cjs +26 -0
  286. package/lib/account/NullableTokenDecimalMap.d.ts +19 -0
  287. package/lib/account/NullableTokenDecimalMap.js +2 -0
  288. package/lib/account/NullableTokenDecimalMap.js.map +1 -0
  289. package/lib/account/ProxyStaker.cjs +73 -0
  290. package/lib/account/ProxyStaker.d.ts +53 -0
  291. package/lib/account/ProxyStaker.js +2 -0
  292. package/lib/account/ProxyStaker.js.map +1 -0
  293. package/lib/account/TokenAllowance.cjs +130 -0
  294. package/lib/account/TokenAllowance.d.ts +93 -0
  295. package/lib/account/TokenAllowance.js +2 -0
  296. package/lib/account/TokenAllowance.js.map +1 -0
  297. package/lib/account/TokenBalanceMap.cjs +30 -0
  298. package/lib/account/TokenBalanceMap.d.ts +23 -0
  299. package/lib/account/TokenBalanceMap.js +2 -0
  300. package/lib/account/TokenBalanceMap.js.map +1 -0
  301. package/lib/account/TokenDecimalMap.cjs +26 -0
  302. package/lib/account/TokenDecimalMap.d.ts +19 -0
  303. package/lib/account/TokenDecimalMap.js +2 -0
  304. package/lib/account/TokenDecimalMap.js.map +1 -0
  305. package/lib/account/TokenNftAllowance.cjs +168 -0
  306. package/lib/account/TokenNftAllowance.d.ts +110 -0
  307. package/lib/account/TokenNftAllowance.js +2 -0
  308. package/lib/account/TokenNftAllowance.js.map +1 -0
  309. package/lib/account/TokenNftTransferMap.cjs +116 -0
  310. package/lib/account/TokenNftTransferMap.d.ts +55 -0
  311. package/lib/account/TokenNftTransferMap.js +2 -0
  312. package/lib/account/TokenNftTransferMap.js.map +1 -0
  313. package/lib/account/TokenRelationship.cjs +113 -0
  314. package/lib/account/TokenRelationship.d.ts +87 -0
  315. package/lib/account/TokenRelationship.js +2 -0
  316. package/lib/account/TokenRelationship.js.map +1 -0
  317. package/lib/account/TokenRelationshipMap.cjs +57 -0
  318. package/lib/account/TokenRelationshipMap.d.ts +33 -0
  319. package/lib/account/TokenRelationshipMap.js +2 -0
  320. package/lib/account/TokenRelationshipMap.js.map +1 -0
  321. package/lib/account/TokenTransferAccountMap.cjs +28 -0
  322. package/lib/account/TokenTransferAccountMap.d.ts +8 -0
  323. package/lib/account/TokenTransferAccountMap.js +2 -0
  324. package/lib/account/TokenTransferAccountMap.js.map +1 -0
  325. package/lib/account/TokenTransferMap.cjs +86 -0
  326. package/lib/account/TokenTransferMap.d.ts +41 -0
  327. package/lib/account/TokenTransferMap.js +2 -0
  328. package/lib/account/TokenTransferMap.js.map +1 -0
  329. package/lib/account/TransferTransaction.cjs +303 -0
  330. package/lib/account/TransferTransaction.d.ts +173 -0
  331. package/lib/account/TransferTransaction.js +2 -0
  332. package/lib/account/TransferTransaction.js.map +1 -0
  333. package/lib/address_book/AddressBooks.cjs +17 -0
  334. package/lib/address_book/AddressBooks.d.ts +4 -0
  335. package/lib/address_book/AddressBooks.js +2 -0
  336. package/lib/address_book/AddressBooks.js.map +1 -0
  337. package/lib/address_book/Endpoint.cjs +140 -0
  338. package/lib/address_book/Endpoint.d.ts +79 -0
  339. package/lib/address_book/Endpoint.js +2 -0
  340. package/lib/address_book/Endpoint.js.map +1 -0
  341. package/lib/address_book/IPv4Address.cjs +116 -0
  342. package/lib/address_book/IPv4Address.d.ts +59 -0
  343. package/lib/address_book/IPv4Address.js +2 -0
  344. package/lib/address_book/IPv4Address.js.map +1 -0
  345. package/lib/address_book/IPv4AddressPart.cjs +76 -0
  346. package/lib/address_book/IPv4AddressPart.d.ts +41 -0
  347. package/lib/address_book/IPv4AddressPart.js +2 -0
  348. package/lib/address_book/IPv4AddressPart.js.map +1 -0
  349. package/lib/address_book/NodeAddress.cjs +287 -0
  350. package/lib/address_book/NodeAddress.d.ts +170 -0
  351. package/lib/address_book/NodeAddress.js +2 -0
  352. package/lib/address_book/NodeAddress.js.map +1 -0
  353. package/lib/address_book/NodeAddressBook.cjs +108 -0
  354. package/lib/address_book/NodeAddressBook.d.ts +66 -0
  355. package/lib/address_book/NodeAddressBook.js +2 -0
  356. package/lib/address_book/NodeAddressBook.js.map +1 -0
  357. package/lib/array.cjs +51 -0
  358. package/lib/array.d.ts +14 -0
  359. package/lib/array.js +2 -0
  360. package/lib/array.js.map +1 -0
  361. package/lib/base32.cjs +38 -0
  362. package/lib/base32.d.ts +18 -0
  363. package/lib/base32.js +2 -0
  364. package/lib/base32.js.map +1 -0
  365. package/lib/browser.cjs +36 -0
  366. package/lib/browser.d.ts +3 -0
  367. package/lib/browser.js +2 -0
  368. package/lib/browser.js.map +1 -0
  369. package/lib/channel/Channel.cjs +293 -0
  370. package/lib/channel/Channel.d.ts +121 -0
  371. package/lib/channel/Channel.js +2 -0
  372. package/lib/channel/Channel.js.map +1 -0
  373. package/lib/channel/MirrorChannel.cjs +55 -0
  374. package/lib/channel/MirrorChannel.d.ts +32 -0
  375. package/lib/channel/MirrorChannel.js +2 -0
  376. package/lib/channel/MirrorChannel.js.map +1 -0
  377. package/lib/channel/NativeChannel.cjs +97 -0
  378. package/lib/channel/NativeChannel.d.ts +12 -0
  379. package/lib/channel/NativeChannel.js +2 -0
  380. package/lib/channel/NativeChannel.js.map +1 -0
  381. package/lib/channel/NodeChannel.cjs +173 -0
  382. package/lib/channel/NodeChannel.d.ts +41 -0
  383. package/lib/channel/NodeChannel.js +2 -0
  384. package/lib/channel/NodeChannel.js.map +1 -0
  385. package/lib/channel/NodeMirrorChannel.cjs +78 -0
  386. package/lib/channel/NodeMirrorChannel.d.ts +22 -0
  387. package/lib/channel/NodeMirrorChannel.js +2 -0
  388. package/lib/channel/NodeMirrorChannel.js.map +1 -0
  389. package/lib/channel/WebChannel.cjs +90 -0
  390. package/lib/channel/WebChannel.d.ts +12 -0
  391. package/lib/channel/WebChannel.js +2 -0
  392. package/lib/channel/WebChannel.js.map +1 -0
  393. package/lib/client/Client.cjs +818 -0
  394. package/lib/client/Client.d.ts +487 -0
  395. package/lib/client/Client.js +2 -0
  396. package/lib/client/Client.js.map +1 -0
  397. package/lib/client/ManagedNetwork.cjs +427 -0
  398. package/lib/client/ManagedNetwork.d.ts +175 -0
  399. package/lib/client/ManagedNetwork.js +2 -0
  400. package/lib/client/ManagedNetwork.js.map +1 -0
  401. package/lib/client/MirrorNetwork.cjs +89 -0
  402. package/lib/client/MirrorNetwork.d.ts +27 -0
  403. package/lib/client/MirrorNetwork.js +2 -0
  404. package/lib/client/MirrorNetwork.js.map +1 -0
  405. package/lib/client/NativeClient.cjs +210 -0
  406. package/lib/client/NativeClient.d.ts +72 -0
  407. package/lib/client/NativeClient.js +2 -0
  408. package/lib/client/NativeClient.js.map +1 -0
  409. package/lib/client/Network.cjs +257 -0
  410. package/lib/client/Network.d.ts +90 -0
  411. package/lib/client/Network.js +2 -0
  412. package/lib/client/Network.js.map +1 -0
  413. package/lib/client/NodeClient.cjs +316 -0
  414. package/lib/client/NodeClient.d.ts +129 -0
  415. package/lib/client/NodeClient.js +2 -0
  416. package/lib/client/NodeClient.js.map +1 -0
  417. package/lib/client/WebClient.cjs +280 -0
  418. package/lib/client/WebClient.d.ts +90 -0
  419. package/lib/client/WebClient.js +2 -0
  420. package/lib/client/WebClient.js.map +1 -0
  421. package/lib/client/addressbooks/mainnet.cjs +7 -0
  422. package/lib/client/addressbooks/mainnet.d.ts +1 -0
  423. package/lib/client/addressbooks/mainnet.js +2 -0
  424. package/lib/client/addressbooks/mainnet.js.map +1 -0
  425. package/lib/client/addressbooks/previewnet.cjs +7 -0
  426. package/lib/client/addressbooks/previewnet.d.ts +1 -0
  427. package/lib/client/addressbooks/previewnet.js +2 -0
  428. package/lib/client/addressbooks/previewnet.js.map +1 -0
  429. package/lib/client/addressbooks/testnet.cjs +7 -0
  430. package/lib/client/addressbooks/testnet.d.ts +1 -0
  431. package/lib/client/addressbooks/testnet.js +2 -0
  432. package/lib/client/addressbooks/testnet.js.map +1 -0
  433. package/lib/constants/ClientConstants.cjs +201 -0
  434. package/lib/constants/ClientConstants.d.ts +74 -0
  435. package/lib/constants/ClientConstants.js +2 -0
  436. package/lib/constants/ClientConstants.js.map +1 -0
  437. package/lib/contract/ContractByteCodeQuery.cjs +158 -0
  438. package/lib/contract/ContractByteCodeQuery.d.ts +76 -0
  439. package/lib/contract/ContractByteCodeQuery.js +2 -0
  440. package/lib/contract/ContractByteCodeQuery.js.map +1 -0
  441. package/lib/contract/ContractCallQuery.cjs +338 -0
  442. package/lib/contract/ContractCallQuery.d.ts +141 -0
  443. package/lib/contract/ContractCallQuery.js +2 -0
  444. package/lib/contract/ContractCallQuery.js.map +1 -0
  445. package/lib/contract/ContractCreateFlow.cjs +452 -0
  446. package/lib/contract/ContractCreateFlow.d.ts +243 -0
  447. package/lib/contract/ContractCreateFlow.js +2 -0
  448. package/lib/contract/ContractCreateFlow.js.map +1 -0
  449. package/lib/contract/ContractCreateTransaction.cjs +556 -0
  450. package/lib/contract/ContractCreateTransaction.d.ts +315 -0
  451. package/lib/contract/ContractCreateTransaction.js +2 -0
  452. package/lib/contract/ContractCreateTransaction.js.map +1 -0
  453. package/lib/contract/ContractDeleteTransaction.cjs +235 -0
  454. package/lib/contract/ContractDeleteTransaction.d.ts +135 -0
  455. package/lib/contract/ContractDeleteTransaction.js +2 -0
  456. package/lib/contract/ContractDeleteTransaction.js.map +1 -0
  457. package/lib/contract/ContractExecuteTransaction.cjs +269 -0
  458. package/lib/contract/ContractExecuteTransaction.d.ts +164 -0
  459. package/lib/contract/ContractExecuteTransaction.js +2 -0
  460. package/lib/contract/ContractExecuteTransaction.js.map +1 -0
  461. package/lib/contract/ContractFunctionParameters.cjs +1703 -0
  462. package/lib/contract/ContractFunctionParameters.d.ts +725 -0
  463. package/lib/contract/ContractFunctionParameters.js +2 -0
  464. package/lib/contract/ContractFunctionParameters.js.map +1 -0
  465. package/lib/contract/ContractFunctionResult.cjs +846 -0
  466. package/lib/contract/ContractFunctionResult.d.ts +510 -0
  467. package/lib/contract/ContractFunctionResult.js +2 -0
  468. package/lib/contract/ContractFunctionResult.js.map +1 -0
  469. package/lib/contract/ContractFunctionSelector.cjs +1775 -0
  470. package/lib/contract/ContractFunctionSelector.d.ts +688 -0
  471. package/lib/contract/ContractFunctionSelector.js +2 -0
  472. package/lib/contract/ContractFunctionSelector.js.map +1 -0
  473. package/lib/contract/ContractId.cjs +267 -0
  474. package/lib/contract/ContractId.d.ts +123 -0
  475. package/lib/contract/ContractId.js +2 -0
  476. package/lib/contract/ContractId.js.map +1 -0
  477. package/lib/contract/ContractInfo.cjs +227 -0
  478. package/lib/contract/ContractInfo.d.ts +151 -0
  479. package/lib/contract/ContractInfo.js +2 -0
  480. package/lib/contract/ContractInfo.js.map +1 -0
  481. package/lib/contract/ContractInfoQuery.cjs +172 -0
  482. package/lib/contract/ContractInfoQuery.d.ts +70 -0
  483. package/lib/contract/ContractInfoQuery.js +2 -0
  484. package/lib/contract/ContractInfoQuery.js.map +1 -0
  485. package/lib/contract/ContractLogInfo.cjs +87 -0
  486. package/lib/contract/ContractLogInfo.d.ts +66 -0
  487. package/lib/contract/ContractLogInfo.js +2 -0
  488. package/lib/contract/ContractLogInfo.js.map +1 -0
  489. package/lib/contract/ContractNonceInfo.cjs +129 -0
  490. package/lib/contract/ContractNonceInfo.d.ts +90 -0
  491. package/lib/contract/ContractNonceInfo.js +2 -0
  492. package/lib/contract/ContractNonceInfo.js.map +1 -0
  493. package/lib/contract/ContractStateChange.cjs +75 -0
  494. package/lib/contract/ContractStateChange.d.ts +37 -0
  495. package/lib/contract/ContractUpdateTransaction.cjs +525 -0
  496. package/lib/contract/ContractUpdateTransaction.d.ts +280 -0
  497. package/lib/contract/ContractUpdateTransaction.js +2 -0
  498. package/lib/contract/ContractUpdateTransaction.js.map +1 -0
  499. package/lib/contract/DelegateContractId.cjs +100 -0
  500. package/lib/contract/DelegateContractId.d.ts +24 -0
  501. package/lib/contract/DelegateContractId.js +2 -0
  502. package/lib/contract/DelegateContractId.js.map +1 -0
  503. package/lib/contract/StorageChange.cjs +73 -0
  504. package/lib/contract/StorageChange.d.ts +37 -0
  505. package/lib/cryptography/keccak.cjs +335 -0
  506. package/lib/cryptography/keccak.d.ts +14 -0
  507. package/lib/cryptography/keccak.js +2 -0
  508. package/lib/cryptography/keccak.js.map +1 -0
  509. package/lib/cryptography/sha384.browser.cjs +19 -0
  510. package/lib/cryptography/sha384.browser.d.ts +5 -0
  511. package/lib/cryptography/sha384.browser.js +2 -0
  512. package/lib/cryptography/sha384.browser.js.map +1 -0
  513. package/lib/cryptography/sha384.cjs +27 -0
  514. package/lib/cryptography/sha384.d.ts +10 -0
  515. package/lib/cryptography/sha384.js +2 -0
  516. package/lib/cryptography/sha384.js.map +1 -0
  517. package/lib/cryptography/sha384.native.cjs +21 -0
  518. package/lib/cryptography/sha384.native.d.ts +5 -0
  519. package/lib/encoding/base64.native.cjs +25 -0
  520. package/lib/encoding/base64.native.d.ts +10 -0
  521. package/lib/encoding/base64.native.js +2 -0
  522. package/lib/encoding/base64.native.js.map +1 -0
  523. package/lib/encoding/hex.browser.cjs +95 -0
  524. package/lib/encoding/hex.browser.d.ts +26 -0
  525. package/lib/encoding/hex.browser.js +2 -0
  526. package/lib/encoding/hex.browser.js.map +1 -0
  527. package/lib/encoding/hex.cjs +82 -0
  528. package/lib/encoding/hex.d.ts +26 -0
  529. package/lib/encoding/hex.js +2 -0
  530. package/lib/encoding/hex.js.map +1 -0
  531. package/lib/encoding/hex.native.cjs +127 -0
  532. package/lib/encoding/hex.native.d.ts +36 -0
  533. package/lib/encoding/utf8.browser.cjs +26 -0
  534. package/lib/encoding/utf8.browser.d.ts +10 -0
  535. package/lib/encoding/utf8.browser.js +2 -0
  536. package/lib/encoding/utf8.browser.js.map +1 -0
  537. package/lib/encoding/utf8.cjs +24 -0
  538. package/lib/encoding/utf8.d.ts +10 -0
  539. package/lib/encoding/utf8.js +2 -0
  540. package/lib/encoding/utf8.js.map +1 -0
  541. package/lib/encoding/utf8.native.cjs +29 -0
  542. package/lib/encoding/utf8.native.d.ts +10 -0
  543. package/lib/exports.cjs +1264 -0
  544. package/lib/exports.d.ts +200 -0
  545. package/lib/exports.js +2 -0
  546. package/lib/exports.js.map +1 -0
  547. package/lib/file/FileAppendTransaction.cjs +482 -0
  548. package/lib/file/FileAppendTransaction.d.ts +196 -0
  549. package/lib/file/FileAppendTransaction.js +2 -0
  550. package/lib/file/FileAppendTransaction.js.map +1 -0
  551. package/lib/file/FileContentsQuery.cjs +159 -0
  552. package/lib/file/FileContentsQuery.d.ts +77 -0
  553. package/lib/file/FileContentsQuery.js +2 -0
  554. package/lib/file/FileContentsQuery.js.map +1 -0
  555. package/lib/file/FileCreateTransaction.cjs +259 -0
  556. package/lib/file/FileCreateTransaction.d.ts +153 -0
  557. package/lib/file/FileCreateTransaction.js +2 -0
  558. package/lib/file/FileCreateTransaction.js.map +1 -0
  559. package/lib/file/FileDeleteTransaction.cjs +149 -0
  560. package/lib/file/FileDeleteTransaction.d.ts +84 -0
  561. package/lib/file/FileDeleteTransaction.js +2 -0
  562. package/lib/file/FileDeleteTransaction.js.map +1 -0
  563. package/lib/file/FileId.cjs +240 -0
  564. package/lib/file/FileId.d.ts +126 -0
  565. package/lib/file/FileId.js +2 -0
  566. package/lib/file/FileId.js.map +1 -0
  567. package/lib/file/FileInfo.cjs +128 -0
  568. package/lib/file/FileInfo.d.ts +76 -0
  569. package/lib/file/FileInfo.js +2 -0
  570. package/lib/file/FileInfo.js.map +1 -0
  571. package/lib/file/FileInfoQuery.cjs +171 -0
  572. package/lib/file/FileInfoQuery.d.ts +68 -0
  573. package/lib/file/FileInfoQuery.js +2 -0
  574. package/lib/file/FileInfoQuery.js.map +1 -0
  575. package/lib/file/FileUpdateTransaction.cjs +319 -0
  576. package/lib/file/FileUpdateTransaction.d.ts +188 -0
  577. package/lib/file/FileUpdateTransaction.js +2 -0
  578. package/lib/file/FileUpdateTransaction.js.map +1 -0
  579. package/lib/grpc/GrpcServiceError.cjs +65 -0
  580. package/lib/grpc/GrpcServiceError.d.ts +32 -0
  581. package/lib/grpc/GrpcServiceError.js +2 -0
  582. package/lib/grpc/GrpcServiceError.js.map +1 -0
  583. package/lib/grpc/GrpcStatus.cjs +145 -0
  584. package/lib/grpc/GrpcStatus.d.ts +46 -0
  585. package/lib/grpc/GrpcStatus.js +2 -0
  586. package/lib/grpc/GrpcStatus.js.map +1 -0
  587. package/lib/http/HttpError.cjs +32 -0
  588. package/lib/http/HttpError.d.ts +14 -0
  589. package/lib/http/HttpError.js +2 -0
  590. package/lib/http/HttpError.js.map +1 -0
  591. package/lib/http/HttpStatus.cjs +44 -0
  592. package/lib/http/HttpStatus.d.ts +24 -0
  593. package/lib/http/HttpStatus.js +2 -0
  594. package/lib/http/HttpStatus.js.map +1 -0
  595. package/lib/index.cjs +44 -0
  596. package/lib/index.d.ts +4 -0
  597. package/lib/index.js +2 -0
  598. package/lib/index.js.map +1 -0
  599. package/lib/logger/LogLevel.cjs +77 -0
  600. package/lib/logger/LogLevel.d.ts +29 -0
  601. package/lib/logger/LogLevel.js +2 -0
  602. package/lib/logger/LogLevel.js.map +1 -0
  603. package/lib/logger/Logger.cjs +221 -0
  604. package/lib/logger/Logger.d.ts +132 -0
  605. package/lib/logger/Logger.js +2 -0
  606. package/lib/logger/Logger.js.map +1 -0
  607. package/lib/long.cjs +26 -0
  608. package/lib/long.d.ts +16 -0
  609. package/lib/long.js +2 -0
  610. package/lib/long.js.map +1 -0
  611. package/lib/native.cjs +36 -0
  612. package/lib/native.d.ts +3 -0
  613. package/lib/native.js +2 -0
  614. package/lib/native.js.map +1 -0
  615. package/lib/network/AddressBookQuery.cjs +218 -0
  616. package/lib/network/AddressBookQuery.d.ts +104 -0
  617. package/lib/network/AddressBookQuery.js +2 -0
  618. package/lib/network/AddressBookQuery.js.map +1 -0
  619. package/lib/network/AddressBookQueryWeb.cjs +326 -0
  620. package/lib/network/AddressBookQueryWeb.d.ts +165 -0
  621. package/lib/network/AddressBookQueryWeb.js +2 -0
  622. package/lib/network/AddressBookQueryWeb.js.map +1 -0
  623. package/lib/network/NetworkVersionInfo.cjs +81 -0
  624. package/lib/network/NetworkVersionInfo.d.ts +46 -0
  625. package/lib/network/NetworkVersionInfo.js +2 -0
  626. package/lib/network/NetworkVersionInfo.js.map +1 -0
  627. package/lib/network/NetworkVersionInfoQuery.cjs +112 -0
  628. package/lib/network/NetworkVersionInfoQuery.d.ts +50 -0
  629. package/lib/network/NetworkVersionInfoQuery.js +2 -0
  630. package/lib/network/NetworkVersionInfoQuery.js.map +1 -0
  631. package/lib/network/SemanticVersion.cjs +78 -0
  632. package/lib/network/SemanticVersion.d.ts +45 -0
  633. package/lib/network/SemanticVersion.js +2 -0
  634. package/lib/network/SemanticVersion.js.map +1 -0
  635. package/lib/node/NodeCreateTransaction.cjs +413 -0
  636. package/lib/node/NodeCreateTransaction.d.ts +239 -0
  637. package/lib/node/NodeCreateTransaction.js +2 -0
  638. package/lib/node/NodeCreateTransaction.js.map +1 -0
  639. package/lib/node/NodeDeleteTransaction.cjs +143 -0
  640. package/lib/node/NodeDeleteTransaction.d.ts +80 -0
  641. package/lib/node/NodeDeleteTransaction.js +2 -0
  642. package/lib/node/NodeDeleteTransaction.js.map +1 -0
  643. package/lib/node/NodeUpdateTransaction.cjs +481 -0
  644. package/lib/node/NodeUpdateTransaction.d.ts +274 -0
  645. package/lib/node/NodeUpdateTransaction.js +2 -0
  646. package/lib/node/NodeUpdateTransaction.js.map +1 -0
  647. package/lib/node/ServiceEndpoint.cjs +140 -0
  648. package/lib/node/ServiceEndpoint.d.ts +91 -0
  649. package/lib/node/ServiceEndpoint.js +2 -0
  650. package/lib/node/ServiceEndpoint.js.map +1 -0
  651. package/lib/query/CostQuery.cjs +171 -0
  652. package/lib/query/CostQuery.d.ts +43 -0
  653. package/lib/query/CostQuery.js +2 -0
  654. package/lib/query/CostQuery.js.map +1 -0
  655. package/lib/query/MirrorNodeContractCallQuery.cjs +53 -0
  656. package/lib/query/MirrorNodeContractCallQuery.d.ts +21 -0
  657. package/lib/query/MirrorNodeContractCallQuery.js +2 -0
  658. package/lib/query/MirrorNodeContractCallQuery.js.map +1 -0
  659. package/lib/query/MirrorNodeContractEstimateQuery.cjs +53 -0
  660. package/lib/query/MirrorNodeContractEstimateQuery.d.ts +21 -0
  661. package/lib/query/MirrorNodeContractEstimateQuery.js +2 -0
  662. package/lib/query/MirrorNodeContractEstimateQuery.js.map +1 -0
  663. package/lib/query/MirrorNodeContractQuery.cjs +260 -0
  664. package/lib/query/MirrorNodeContractQuery.d.ts +158 -0
  665. package/lib/query/MirrorNodeContractQuery.js +2 -0
  666. package/lib/query/MirrorNodeContractQuery.js.map +1 -0
  667. package/lib/query/Query.cjs +450 -0
  668. package/lib/query/Query.d.ts +173 -0
  669. package/lib/query/Query.js +2 -0
  670. package/lib/query/Query.js.map +1 -0
  671. package/lib/query/QueryBase.cjs +114 -0
  672. package/lib/query/QueryBase.d.ts +43 -0
  673. package/lib/query/QueryBase.js +2 -0
  674. package/lib/query/QueryBase.js.map +1 -0
  675. package/lib/schedule/ScheduleCreateTransaction.cjs +308 -0
  676. package/lib/schedule/ScheduleCreateTransaction.d.ts +153 -0
  677. package/lib/schedule/ScheduleCreateTransaction.js +2 -0
  678. package/lib/schedule/ScheduleCreateTransaction.js.map +1 -0
  679. package/lib/schedule/ScheduleDeleteTransaction.cjs +146 -0
  680. package/lib/schedule/ScheduleDeleteTransaction.d.ts +81 -0
  681. package/lib/schedule/ScheduleDeleteTransaction.js +2 -0
  682. package/lib/schedule/ScheduleDeleteTransaction.js.map +1 -0
  683. package/lib/schedule/ScheduleId.cjs +164 -0
  684. package/lib/schedule/ScheduleId.d.ts +96 -0
  685. package/lib/schedule/ScheduleId.js +2 -0
  686. package/lib/schedule/ScheduleId.js.map +1 -0
  687. package/lib/schedule/ScheduleInfo.cjs +176 -0
  688. package/lib/schedule/ScheduleInfo.d.ts +93 -0
  689. package/lib/schedule/ScheduleInfo.js +2 -0
  690. package/lib/schedule/ScheduleInfo.js.map +1 -0
  691. package/lib/schedule/ScheduleInfoQuery.cjs +170 -0
  692. package/lib/schedule/ScheduleInfoQuery.d.ts +66 -0
  693. package/lib/schedule/ScheduleInfoQuery.js +2 -0
  694. package/lib/schedule/ScheduleInfoQuery.js.map +1 -0
  695. package/lib/schedule/ScheduleSignTransaction.cjs +164 -0
  696. package/lib/schedule/ScheduleSignTransaction.d.ts +110 -0
  697. package/lib/schedule/ScheduleSignTransaction.js +2 -0
  698. package/lib/schedule/ScheduleSignTransaction.js.map +1 -0
  699. package/lib/system/FreezeTransaction.cjs +348 -0
  700. package/lib/system/FreezeTransaction.d.ts +188 -0
  701. package/lib/system/FreezeTransaction.js +2 -0
  702. package/lib/system/FreezeTransaction.js.map +1 -0
  703. package/lib/system/SystemDeleteTransaction.cjs +200 -0
  704. package/lib/system/SystemDeleteTransaction.d.ts +110 -0
  705. package/lib/system/SystemDeleteTransaction.js +2 -0
  706. package/lib/system/SystemDeleteTransaction.js.map +1 -0
  707. package/lib/system/SystemUndeleteTransaction.cjs +172 -0
  708. package/lib/system/SystemUndeleteTransaction.d.ts +97 -0
  709. package/lib/system/SystemUndeleteTransaction.js +2 -0
  710. package/lib/system/SystemUndeleteTransaction.js.map +1 -0
  711. package/lib/token/AbstractTokenTransferTransaction.cjs +406 -0
  712. package/lib/token/AbstractTokenTransferTransaction.d.ts +138 -0
  713. package/lib/token/AbstractTokenTransferTransaction.js +2 -0
  714. package/lib/token/AbstractTokenTransferTransaction.js.map +1 -0
  715. package/lib/token/AirdropPendingTransaction.cjs +65 -0
  716. package/lib/token/AirdropPendingTransaction.d.ts +35 -0
  717. package/lib/token/AirdropPendingTransaction.js +2 -0
  718. package/lib/token/AirdropPendingTransaction.js.map +1 -0
  719. package/lib/token/AssessedCustomFee.cjs +177 -0
  720. package/lib/token/AssessedCustomFee.d.ts +113 -0
  721. package/lib/token/AssessedCustomFee.js +2 -0
  722. package/lib/token/AssessedCustomFee.js.map +1 -0
  723. package/lib/token/CustomFee.cjs +88 -0
  724. package/lib/token/CustomFee.d.ts +57 -0
  725. package/lib/token/CustomFee.js +2 -0
  726. package/lib/token/CustomFee.js.map +1 -0
  727. package/lib/token/CustomFixedFee.cjs +155 -0
  728. package/lib/token/CustomFixedFee.d.ts +85 -0
  729. package/lib/token/CustomFixedFee.js +2 -0
  730. package/lib/token/CustomFixedFee.js.map +1 -0
  731. package/lib/token/CustomFractionalFee.cjs +200 -0
  732. package/lib/token/CustomFractionalFee.d.ts +103 -0
  733. package/lib/token/CustomFractionalFee.js +2 -0
  734. package/lib/token/CustomFractionalFee.js.map +1 -0
  735. package/lib/token/CustomRoyaltyFee.cjs +150 -0
  736. package/lib/token/CustomRoyaltyFee.d.ts +75 -0
  737. package/lib/token/CustomRoyaltyFee.js +2 -0
  738. package/lib/token/CustomRoyaltyFee.js.map +1 -0
  739. package/lib/token/FeeAssessmentMethod.cjs +58 -0
  740. package/lib/token/FeeAssessmentMethod.d.ts +29 -0
  741. package/lib/token/FeeAssessmentMethod.js +2 -0
  742. package/lib/token/FeeAssessmentMethod.js.map +1 -0
  743. package/lib/token/NftId.cjs +89 -0
  744. package/lib/token/NftId.d.ts +46 -0
  745. package/lib/token/NftId.js +2 -0
  746. package/lib/token/NftId.js.map +1 -0
  747. package/lib/token/PendingAirdropId.cjs +152 -0
  748. package/lib/token/PendingAirdropId.d.ts +81 -0
  749. package/lib/token/PendingAirdropId.js +2 -0
  750. package/lib/token/PendingAirdropId.js.map +1 -0
  751. package/lib/token/PendingAirdropRecord.cjs +55 -0
  752. package/lib/token/PendingAirdropRecord.d.ts +29 -0
  753. package/lib/token/PendingAirdropRecord.js +2 -0
  754. package/lib/token/PendingAirdropRecord.js.map +1 -0
  755. package/lib/token/TokenAirdropTransaction.cjs +179 -0
  756. package/lib/token/TokenAirdropTransaction.d.ts +119 -0
  757. package/lib/token/TokenAirdropTransaction.js +2 -0
  758. package/lib/token/TokenAirdropTransaction.js.map +1 -0
  759. package/lib/token/TokenAssociateTransaction.cjs +176 -0
  760. package/lib/token/TokenAssociateTransaction.d.ts +90 -0
  761. package/lib/token/TokenAssociateTransaction.js +2 -0
  762. package/lib/token/TokenAssociateTransaction.js.map +1 -0
  763. package/lib/token/TokenAssociation.cjs +117 -0
  764. package/lib/token/TokenAssociation.d.ts +76 -0
  765. package/lib/token/TokenAssociation.js +2 -0
  766. package/lib/token/TokenAssociation.js.map +1 -0
  767. package/lib/token/TokenBurnTransaction.cjs +199 -0
  768. package/lib/token/TokenBurnTransaction.d.ts +108 -0
  769. package/lib/token/TokenBurnTransaction.js +2 -0
  770. package/lib/token/TokenBurnTransaction.js.map +1 -0
  771. package/lib/token/TokenCancelAirdropTransaction.cjs +109 -0
  772. package/lib/token/TokenCancelAirdropTransaction.d.ts +50 -0
  773. package/lib/token/TokenCancelAirdropTransaction.js +2 -0
  774. package/lib/token/TokenCancelAirdropTransaction.js.map +1 -0
  775. package/lib/token/TokenClaimAirdropTransaction.cjs +109 -0
  776. package/lib/token/TokenClaimAirdropTransaction.d.ts +50 -0
  777. package/lib/token/TokenClaimAirdropTransaction.js +2 -0
  778. package/lib/token/TokenClaimAirdropTransaction.js.map +1 -0
  779. package/lib/token/TokenCreateTransaction.cjs +817 -0
  780. package/lib/token/TokenCreateTransaction.d.ts +446 -0
  781. package/lib/token/TokenCreateTransaction.js +2 -0
  782. package/lib/token/TokenCreateTransaction.js.map +1 -0
  783. package/lib/token/TokenDeleteTransaction.cjs +140 -0
  784. package/lib/token/TokenDeleteTransaction.d.ts +75 -0
  785. package/lib/token/TokenDeleteTransaction.js +2 -0
  786. package/lib/token/TokenDeleteTransaction.js.map +1 -0
  787. package/lib/token/TokenDissociateTransaction.cjs +176 -0
  788. package/lib/token/TokenDissociateTransaction.d.ts +90 -0
  789. package/lib/token/TokenDissociateTransaction.js +2 -0
  790. package/lib/token/TokenDissociateTransaction.js.map +1 -0
  791. package/lib/token/TokenFeeScheduleUpdateTransaction.cjs +172 -0
  792. package/lib/token/TokenFeeScheduleUpdateTransaction.d.ts +93 -0
  793. package/lib/token/TokenFeeScheduleUpdateTransaction.js +2 -0
  794. package/lib/token/TokenFeeScheduleUpdateTransaction.js.map +1 -0
  795. package/lib/token/TokenFreezeTransaction.cjs +172 -0
  796. package/lib/token/TokenFreezeTransaction.d.ts +90 -0
  797. package/lib/token/TokenFreezeTransaction.js +2 -0
  798. package/lib/token/TokenFreezeTransaction.js.map +1 -0
  799. package/lib/token/TokenGrantKycTransaction.cjs +172 -0
  800. package/lib/token/TokenGrantKycTransaction.d.ts +90 -0
  801. package/lib/token/TokenGrantKycTransaction.js +2 -0
  802. package/lib/token/TokenGrantKycTransaction.js.map +1 -0
  803. package/lib/token/TokenId.cjs +185 -0
  804. package/lib/token/TokenId.d.ts +103 -0
  805. package/lib/token/TokenId.js +2 -0
  806. package/lib/token/TokenId.js.map +1 -0
  807. package/lib/token/TokenInfo.cjs +349 -0
  808. package/lib/token/TokenInfo.d.ts +224 -0
  809. package/lib/token/TokenInfo.js +2 -0
  810. package/lib/token/TokenInfo.js.map +1 -0
  811. package/lib/token/TokenInfoQuery.cjs +170 -0
  812. package/lib/token/TokenInfoQuery.d.ts +67 -0
  813. package/lib/token/TokenInfoQuery.js +2 -0
  814. package/lib/token/TokenInfoQuery.js.map +1 -0
  815. package/lib/token/TokenKeyValidation.cjs +73 -0
  816. package/lib/token/TokenKeyValidation.d.ts +39 -0
  817. package/lib/token/TokenKeyValidation.js +2 -0
  818. package/lib/token/TokenKeyValidation.js.map +1 -0
  819. package/lib/token/TokenMintTransaction.cjs +219 -0
  820. package/lib/token/TokenMintTransaction.d.ts +113 -0
  821. package/lib/token/TokenMintTransaction.js +2 -0
  822. package/lib/token/TokenMintTransaction.js.map +1 -0
  823. package/lib/token/TokenNftInfo.cjs +127 -0
  824. package/lib/token/TokenNftInfo.d.ts +96 -0
  825. package/lib/token/TokenNftInfo.js +2 -0
  826. package/lib/token/TokenNftInfo.js.map +1 -0
  827. package/lib/token/TokenNftInfoQuery.cjs +312 -0
  828. package/lib/token/TokenNftInfoQuery.d.ts +149 -0
  829. package/lib/token/TokenNftInfoQuery.js +2 -0
  830. package/lib/token/TokenNftInfoQuery.js.map +1 -0
  831. package/lib/token/TokenNftTransfer.cjs +95 -0
  832. package/lib/token/TokenNftTransfer.d.ts +70 -0
  833. package/lib/token/TokenNftTransfer.js +2 -0
  834. package/lib/token/TokenNftTransfer.js.map +1 -0
  835. package/lib/token/TokenNftsUpdateTransaction.cjs +185 -0
  836. package/lib/token/TokenNftsUpdateTransaction.d.ts +97 -0
  837. package/lib/token/TokenPauseTransaction.cjs +140 -0
  838. package/lib/token/TokenPauseTransaction.d.ts +75 -0
  839. package/lib/token/TokenPauseTransaction.js +2 -0
  840. package/lib/token/TokenPauseTransaction.js.map +1 -0
  841. package/lib/token/TokenReference.cjs +41 -0
  842. package/lib/token/TokenReference.d.ts +29 -0
  843. package/lib/token/TokenReference.js +2 -0
  844. package/lib/token/TokenReference.js.map +1 -0
  845. package/lib/token/TokenRejectFlow.cjs +248 -0
  846. package/lib/token/TokenRejectFlow.d.ts +141 -0
  847. package/lib/token/TokenRejectFlow.js +2 -0
  848. package/lib/token/TokenRejectFlow.js.map +1 -0
  849. package/lib/token/TokenRejectTransaction.cjs +240 -0
  850. package/lib/token/TokenRejectTransaction.d.ts +120 -0
  851. package/lib/token/TokenRejectTransaction.js +2 -0
  852. package/lib/token/TokenRejectTransaction.js.map +1 -0
  853. package/lib/token/TokenRevokeKycTransaction.cjs +172 -0
  854. package/lib/token/TokenRevokeKycTransaction.d.ts +90 -0
  855. package/lib/token/TokenRevokeKycTransaction.js +2 -0
  856. package/lib/token/TokenRevokeKycTransaction.js.map +1 -0
  857. package/lib/token/TokenSupplyType.cjs +77 -0
  858. package/lib/token/TokenSupplyType.d.ts +38 -0
  859. package/lib/token/TokenSupplyType.js +2 -0
  860. package/lib/token/TokenSupplyType.js.map +1 -0
  861. package/lib/token/TokenTransfer.cjs +122 -0
  862. package/lib/token/TokenTransfer.d.ts +92 -0
  863. package/lib/token/TokenTransfer.js +2 -0
  864. package/lib/token/TokenTransfer.js.map +1 -0
  865. package/lib/token/TokenType.cjs +77 -0
  866. package/lib/token/TokenType.d.ts +38 -0
  867. package/lib/token/TokenType.js +2 -0
  868. package/lib/token/TokenType.js.map +1 -0
  869. package/lib/token/TokenUnfreezeTransaction.cjs +172 -0
  870. package/lib/token/TokenUnfreezeTransaction.d.ts +90 -0
  871. package/lib/token/TokenUnfreezeTransaction.js +2 -0
  872. package/lib/token/TokenUnfreezeTransaction.js.map +1 -0
  873. package/lib/token/TokenUnpauseTransaction.cjs +140 -0
  874. package/lib/token/TokenUnpauseTransaction.d.ts +75 -0
  875. package/lib/token/TokenUnpauseTransaction.js +2 -0
  876. package/lib/token/TokenUnpauseTransaction.js.map +1 -0
  877. package/lib/token/TokenUpdateNftsTransaction.cjs +189 -0
  878. package/lib/token/TokenUpdateNftsTransaction.d.ts +103 -0
  879. package/lib/token/TokenUpdateNftsTransaction.js +2 -0
  880. package/lib/token/TokenUpdateNftsTransaction.js.map +1 -0
  881. package/lib/token/TokenUpdateTransaction.cjs +672 -0
  882. package/lib/token/TokenUpdateTransaction.d.ts +366 -0
  883. package/lib/token/TokenUpdateTransaction.js +2 -0
  884. package/lib/token/TokenUpdateTransaction.js.map +1 -0
  885. package/lib/token/TokenWipeTransaction.cjs +231 -0
  886. package/lib/token/TokenWipeTransaction.d.ts +123 -0
  887. package/lib/token/TokenWipeTransaction.js +2 -0
  888. package/lib/token/TokenWipeTransaction.js.map +1 -0
  889. package/lib/topic/SubscriptionHandle.cjs +40 -0
  890. package/lib/topic/SubscriptionHandle.d.ts +22 -0
  891. package/lib/topic/SubscriptionHandle.js +2 -0
  892. package/lib/topic/SubscriptionHandle.js.map +1 -0
  893. package/lib/topic/TopicCreateTransaction.cjs +473 -0
  894. package/lib/topic/TopicCreateTransaction.d.ts +250 -0
  895. package/lib/topic/TopicCreateTransaction.js +2 -0
  896. package/lib/topic/TopicCreateTransaction.js.map +1 -0
  897. package/lib/topic/TopicDeleteTransaction.cjs +146 -0
  898. package/lib/topic/TopicDeleteTransaction.d.ts +80 -0
  899. package/lib/topic/TopicDeleteTransaction.js +2 -0
  900. package/lib/topic/TopicDeleteTransaction.js.map +1 -0
  901. package/lib/topic/TopicId.cjs +185 -0
  902. package/lib/topic/TopicId.d.ts +102 -0
  903. package/lib/topic/TopicId.js +2 -0
  904. package/lib/topic/TopicId.js.map +1 -0
  905. package/lib/topic/TopicInfo.cjs +187 -0
  906. package/lib/topic/TopicInfo.d.ts +119 -0
  907. package/lib/topic/TopicInfo.js +2 -0
  908. package/lib/topic/TopicInfo.js.map +1 -0
  909. package/lib/topic/TopicInfoQuery.cjs +174 -0
  910. package/lib/topic/TopicInfoQuery.d.ts +81 -0
  911. package/lib/topic/TopicInfoQuery.js +2 -0
  912. package/lib/topic/TopicInfoQuery.js.map +1 -0
  913. package/lib/topic/TopicMessage.cjs +116 -0
  914. package/lib/topic/TopicMessage.d.ts +65 -0
  915. package/lib/topic/TopicMessage.js +2 -0
  916. package/lib/topic/TopicMessage.js.map +1 -0
  917. package/lib/topic/TopicMessageChunk.cjs +71 -0
  918. package/lib/topic/TopicMessageChunk.d.ts +56 -0
  919. package/lib/topic/TopicMessageChunk.js +2 -0
  920. package/lib/topic/TopicMessageChunk.js.map +1 -0
  921. package/lib/topic/TopicMessageQuery.cjs +450 -0
  922. package/lib/topic/TopicMessageQuery.d.ts +220 -0
  923. package/lib/topic/TopicMessageQuery.js +2 -0
  924. package/lib/topic/TopicMessageQuery.js.map +1 -0
  925. package/lib/topic/TopicMessageSubmitTransaction.cjs +412 -0
  926. package/lib/topic/TopicMessageSubmitTransaction.d.ts +201 -0
  927. package/lib/topic/TopicMessageSubmitTransaction.js +2 -0
  928. package/lib/topic/TopicMessageSubmitTransaction.js.map +1 -0
  929. package/lib/topic/TopicUpdateTransaction.cjs +532 -0
  930. package/lib/topic/TopicUpdateTransaction.d.ts +284 -0
  931. package/lib/topic/TopicUpdateTransaction.js +2 -0
  932. package/lib/topic/TopicUpdateTransaction.js.map +1 -0
  933. package/lib/transaction/BatchTransaction.cjs +262 -0
  934. package/lib/transaction/BatchTransaction.d.ts +134 -0
  935. package/lib/transaction/BatchTransaction.js +2 -0
  936. package/lib/transaction/BatchTransaction.js.map +1 -0
  937. package/lib/transaction/CustomFeeLimit.cjs +116 -0
  938. package/lib/transaction/CustomFeeLimit.d.ts +64 -0
  939. package/lib/transaction/CustomFeeLimit.js +2 -0
  940. package/lib/transaction/CustomFeeLimit.js.map +1 -0
  941. package/lib/transaction/List.cjs +177 -0
  942. package/lib/transaction/List.d.ts +100 -0
  943. package/lib/transaction/List.js +2 -0
  944. package/lib/transaction/List.js.map +1 -0
  945. package/lib/transaction/NodeAccountIdSignatureMap.cjs +62 -0
  946. package/lib/transaction/NodeAccountIdSignatureMap.d.ts +23 -0
  947. package/lib/transaction/NodeAccountIdSignatureMap.js +2 -0
  948. package/lib/transaction/NodeAccountIdSignatureMap.js.map +1 -0
  949. package/lib/transaction/NodeAccountIdSignatureMapLegacy.cjs +39 -0
  950. package/lib/transaction/NodeAccountIdSignatureMapLegacy.d.ts +14 -0
  951. package/lib/transaction/NodeAccountIdSignatureMapLegacy.js +2 -0
  952. package/lib/transaction/NodeAccountIdSignatureMapLegacy.js.map +1 -0
  953. package/lib/transaction/SignableNodeTransactionBodyBytes.cjs +47 -0
  954. package/lib/transaction/SignableNodeTransactionBodyBytes.d.ts +38 -0
  955. package/lib/transaction/SignableNodeTransactionBodyBytes.js +2 -0
  956. package/lib/transaction/SignableNodeTransactionBodyBytes.js.map +1 -0
  957. package/lib/transaction/SignatureMap.cjs +95 -0
  958. package/lib/transaction/SignatureMap.d.ts +42 -0
  959. package/lib/transaction/SignatureMap.js +2 -0
  960. package/lib/transaction/SignatureMap.js.map +1 -0
  961. package/lib/transaction/SignatureMapLegacy.cjs +37 -0
  962. package/lib/transaction/SignatureMapLegacy.d.ts +15 -0
  963. package/lib/transaction/SignatureMapLegacy.js +2 -0
  964. package/lib/transaction/SignatureMapLegacy.js.map +1 -0
  965. package/lib/transaction/SignaturePairMap.cjs +50 -0
  966. package/lib/transaction/SignaturePairMap.d.ts +21 -0
  967. package/lib/transaction/SignaturePairMap.js +2 -0
  968. package/lib/transaction/SignaturePairMap.js.map +1 -0
  969. package/lib/transaction/TokenTransfer.cjs +2 -0
  970. package/lib/transaction/TokenTransfer.d.ts +0 -0
  971. package/lib/transaction/Transaction.cjs +1959 -0
  972. package/lib/transaction/Transaction.d.ts +698 -0
  973. package/lib/transaction/Transaction.js +2 -0
  974. package/lib/transaction/Transaction.js.map +1 -0
  975. package/lib/transaction/TransactionHashMap.cjs +44 -0
  976. package/lib/transaction/TransactionHashMap.d.ts +22 -0
  977. package/lib/transaction/TransactionHashMap.js +2 -0
  978. package/lib/transaction/TransactionHashMap.js.map +1 -0
  979. package/lib/transaction/TransactionId.cjs +224 -0
  980. package/lib/transaction/TransactionId.d.ts +122 -0
  981. package/lib/transaction/TransactionId.js +2 -0
  982. package/lib/transaction/TransactionId.js.map +1 -0
  983. package/lib/transaction/TransactionReceipt.cjs +303 -0
  984. package/lib/transaction/TransactionReceipt.d.ts +202 -0
  985. package/lib/transaction/TransactionReceipt.js +2 -0
  986. package/lib/transaction/TransactionReceipt.js.map +1 -0
  987. package/lib/transaction/TransactionReceiptQuery.cjs +347 -0
  988. package/lib/transaction/TransactionReceiptQuery.d.ts +96 -0
  989. package/lib/transaction/TransactionReceiptQuery.js +2 -0
  990. package/lib/transaction/TransactionReceiptQuery.js.map +1 -0
  991. package/lib/transaction/TransactionRecord.cjs +470 -0
  992. package/lib/transaction/TransactionRecord.d.ts +317 -0
  993. package/lib/transaction/TransactionRecord.js +2 -0
  994. package/lib/transaction/TransactionRecord.js.map +1 -0
  995. package/lib/transaction/TransactionRecordQuery.cjs +366 -0
  996. package/lib/transaction/TransactionRecordQuery.d.ts +99 -0
  997. package/lib/transaction/TransactionRecordQuery.js +2 -0
  998. package/lib/transaction/TransactionRecordQuery.js.map +1 -0
  999. package/lib/transaction/TransactionResponse.cjs +242 -0
  1000. package/lib/transaction/TransactionResponse.d.ts +119 -0
  1001. package/lib/transaction/TransactionResponse.js +2 -0
  1002. package/lib/transaction/TransactionResponse.js.map +1 -0
  1003. package/lib/util/ASN1-Decoder.cjs +276 -0
  1004. package/lib/util/ASN1-Decoder.d.ts +104 -0
  1005. package/lib/util/ASN1-Decoder.js +2 -0
  1006. package/lib/util/ASN1-Decoder.js.map +1 -0
  1007. package/lib/util.cjs +464 -0
  1008. package/lib/util.d.ts +210 -0
  1009. package/lib/util.js +2 -0
  1010. package/lib/util.js.map +1 -0
  1011. package/lib/version.cjs +8 -0
  1012. package/lib/version.d.ts +2 -0
  1013. package/lib/version.js +2 -0
  1014. package/lib/version.js.map +1 -0
  1015. package/package.json +139 -0
  1016. package/src/BadEntityIdError.js +24 -0
  1017. package/src/Cache.js +418 -0
  1018. package/src/Duration.js +48 -0
  1019. package/src/EntityIdHelper.js +620 -0
  1020. package/src/EthereumFlow.js +244 -0
  1021. package/src/EthereumTransaction.js +298 -0
  1022. package/src/EthereumTransactionData.js +60 -0
  1023. package/src/EthereumTransactionDataEip1559.js +146 -0
  1024. package/src/EthereumTransactionDataEip2930.js +140 -0
  1025. package/src/EthereumTransactionDataLegacy.js +121 -0
  1026. package/src/EvmAddress.js +78 -0
  1027. package/src/ExchangeRate.js +117 -0
  1028. package/src/ExchangeRates.js +71 -0
  1029. package/src/Executable.js +884 -0
  1030. package/src/FeeComponents.js +199 -0
  1031. package/src/FeeData.js +127 -0
  1032. package/src/FeeDataType.js +125 -0
  1033. package/src/FeeSchedule.js +88 -0
  1034. package/src/FeeSchedules.js +82 -0
  1035. package/src/FreezeType.js +113 -0
  1036. package/src/Hbar.js +147 -0
  1037. package/src/HbarUnit.js +90 -0
  1038. package/src/Key.js +60 -0
  1039. package/src/KeyList.js +179 -0
  1040. package/src/LedgerId.js +134 -0
  1041. package/src/LocalProvider.js +165 -0
  1042. package/src/ManagedNode.js +269 -0
  1043. package/src/ManagedNodeAddress.js +101 -0
  1044. package/src/MaxAttemptsOrTimeoutError.js +42 -0
  1045. package/src/MaxQueryPaymentExceeded.js +28 -0
  1046. package/src/MirrorNode.js +41 -0
  1047. package/src/Mnemonic.js +250 -0
  1048. package/src/Node.js +106 -0
  1049. package/src/ObjectMap.js +137 -0
  1050. package/src/PrecheckStatusError.js +73 -0
  1051. package/src/PrivateKey.js +547 -0
  1052. package/src/PrngTransaction.js +152 -0
  1053. package/src/Provider.js +40 -0
  1054. package/src/PublicKey.js +294 -0
  1055. package/src/ReceiptStatusError.js +41 -0
  1056. package/src/RecordStatusError.js +30 -0
  1057. package/src/RequestType.js +920 -0
  1058. package/src/Signer.js +46 -0
  1059. package/src/SignerSignature.js +27 -0
  1060. package/src/StakingInfo.js +187 -0
  1061. package/src/Status.js +3353 -0
  1062. package/src/StatusError.js +64 -0
  1063. package/src/Timestamp.js +160 -0
  1064. package/src/TransactionFeeSchedule.js +100 -0
  1065. package/src/Transfer.js +113 -0
  1066. package/src/Wallet.js +300 -0
  1067. package/src/account/AccountAllowanceAdjustTransaction.js +540 -0
  1068. package/src/account/AccountAllowanceApproveTransaction.js +569 -0
  1069. package/src/account/AccountAllowanceDeleteTransaction.js +199 -0
  1070. package/src/account/AccountBalance.js +160 -0
  1071. package/src/account/AccountBalanceQuery.js +238 -0
  1072. package/src/account/AccountCreateTransaction.js +674 -0
  1073. package/src/account/AccountDeleteTransaction.js +221 -0
  1074. package/src/account/AccountId.js +486 -0
  1075. package/src/account/AccountInfo.js +433 -0
  1076. package/src/account/AccountInfoFlow.js +106 -0
  1077. package/src/account/AccountInfoQuery.js +187 -0
  1078. package/src/account/AccountRecordsQuery.js +186 -0
  1079. package/src/account/AccountUpdateTransaction.js +634 -0
  1080. package/src/account/HbarAllowance.js +147 -0
  1081. package/src/account/HbarTransferMap.js +48 -0
  1082. package/src/account/LiveHash.js +79 -0
  1083. package/src/account/LiveHashAddTransaction.js +289 -0
  1084. package/src/account/LiveHashDeleteTransaction.js +196 -0
  1085. package/src/account/LiveHashQuery.js +209 -0
  1086. package/src/account/NullableTokenDecimalMap.js +19 -0
  1087. package/src/account/ProxyStaker.js +74 -0
  1088. package/src/account/TokenAllowance.js +152 -0
  1089. package/src/account/TokenBalanceMap.js +23 -0
  1090. package/src/account/TokenDecimalMap.js +19 -0
  1091. package/src/account/TokenNftAllowance.js +217 -0
  1092. package/src/account/TokenNftTransferMap.js +134 -0
  1093. package/src/account/TokenRelationship.js +125 -0
  1094. package/src/account/TokenRelationshipMap.js +59 -0
  1095. package/src/account/TokenTransferAccountMap.js +24 -0
  1096. package/src/account/TokenTransferMap.js +99 -0
  1097. package/src/account/TransferTransaction.js +372 -0
  1098. package/src/address_book/AddressBooks.js +27 -0
  1099. package/src/address_book/Endpoint.js +141 -0
  1100. package/src/address_book/IPv4Address.js +125 -0
  1101. package/src/address_book/IPv4AddressPart.js +71 -0
  1102. package/src/address_book/NodeAddress.js +319 -0
  1103. package/src/address_book/NodeAddressBook.js +114 -0
  1104. package/src/array.js +60 -0
  1105. package/src/base32.js +29 -0
  1106. package/src/browser.js +10 -0
  1107. package/src/channel/Channel.js +340 -0
  1108. package/src/channel/MirrorChannel.js +49 -0
  1109. package/src/channel/NativeChannel.js +120 -0
  1110. package/src/channel/NodeChannel.js +196 -0
  1111. package/src/channel/NodeMirrorChannel.js +91 -0
  1112. package/src/channel/WebChannel.js +100 -0
  1113. package/src/client/Client.js +871 -0
  1114. package/src/client/ManagedNetwork.js +473 -0
  1115. package/src/client/MirrorNetwork.js +87 -0
  1116. package/src/client/NativeClient.js +218 -0
  1117. package/src/client/Network.js +304 -0
  1118. package/src/client/NodeClient.js +321 -0
  1119. package/src/client/WebClient.js +302 -0
  1120. package/src/client/addressbooks/mainnet.js +2 -0
  1121. package/src/client/addressbooks/previewnet.js +2 -0
  1122. package/src/client/addressbooks/testnet.js +2 -0
  1123. package/src/constants/ClientConstants.js +204 -0
  1124. package/src/contract/ContractByteCodeQuery.js +178 -0
  1125. package/src/contract/ContractCallQuery.js +382 -0
  1126. package/src/contract/ContractCreateFlow.js +551 -0
  1127. package/src/contract/ContractCreateTransaction.js +677 -0
  1128. package/src/contract/ContractDeleteTransaction.js +291 -0
  1129. package/src/contract/ContractExecuteTransaction.js +313 -0
  1130. package/src/contract/ContractFunctionParameters.js +1759 -0
  1131. package/src/contract/ContractFunctionResult.js +1060 -0
  1132. package/src/contract/ContractFunctionSelector.js +1360 -0
  1133. package/src/contract/ContractId.js +316 -0
  1134. package/src/contract/ContractInfo.js +264 -0
  1135. package/src/contract/ContractInfoQuery.js +190 -0
  1136. package/src/contract/ContractLogInfo.js +83 -0
  1137. package/src/contract/ContractNonceInfo.js +129 -0
  1138. package/src/contract/ContractStateChange.js +77 -0
  1139. package/src/contract/ContractUpdateTransaction.js +665 -0
  1140. package/src/contract/DelegateContractId.js +94 -0
  1141. package/src/contract/StorageChange.js +71 -0
  1142. package/src/cryptography/keccak.js +419 -0
  1143. package/src/cryptography/sha384.browser.js +13 -0
  1144. package/src/cryptography/sha384.js +20 -0
  1145. package/src/cryptography/sha384.native.js +19 -0
  1146. package/src/encoding/base64.native.js +19 -0
  1147. package/src/encoding/hex.browser.js +95 -0
  1148. package/src/encoding/hex.js +76 -0
  1149. package/src/encoding/hex.native.js +386 -0
  1150. package/src/encoding/utf8.browser.js +19 -0
  1151. package/src/encoding/utf8.js +17 -0
  1152. package/src/encoding/utf8.native.js +20 -0
  1153. package/src/exports.js +213 -0
  1154. package/src/file/FileAppendTransaction.js +586 -0
  1155. package/src/file/FileContentsQuery.js +174 -0
  1156. package/src/file/FileCreateTransaction.js +301 -0
  1157. package/src/file/FileDeleteTransaction.js +167 -0
  1158. package/src/file/FileId.js +247 -0
  1159. package/src/file/FileInfo.js +136 -0
  1160. package/src/file/FileInfoQuery.js +186 -0
  1161. package/src/file/FileUpdateTransaction.js +375 -0
  1162. package/src/grpc/GrpcServiceError.js +64 -0
  1163. package/src/grpc/GrpcStatus.js +142 -0
  1164. package/src/http/HttpError.js +26 -0
  1165. package/src/http/HttpStatus.js +38 -0
  1166. package/src/index.js +11 -0
  1167. package/src/logger/LogLevel.js +72 -0
  1168. package/src/logger/Logger.js +225 -0
  1169. package/src/long.js +20 -0
  1170. package/src/native.js +10 -0
  1171. package/src/network/AddressBookQuery.js +272 -0
  1172. package/src/network/AddressBookQueryWeb.js +388 -0
  1173. package/src/network/NetworkVersionInfo.js +81 -0
  1174. package/src/network/NetworkVersionInfoQuery.js +117 -0
  1175. package/src/network/SemanticVersion.js +74 -0
  1176. package/src/node/NodeCreateTransaction.js +513 -0
  1177. package/src/node/NodeDeleteTransaction.js +161 -0
  1178. package/src/node/NodeUpdateTransaction.js +592 -0
  1179. package/src/node/ServiceEndpoint.js +145 -0
  1180. package/src/query/CostQuery.js +187 -0
  1181. package/src/query/MirrorNodeContractCallQuery.js +49 -0
  1182. package/src/query/MirrorNodeContractEstimateQuery.js +48 -0
  1183. package/src/query/MirrorNodeContractQuery.js +266 -0
  1184. package/src/query/Query.js +527 -0
  1185. package/src/query/QueryBase.js +116 -0
  1186. package/src/schedule/ScheduleCreateTransaction.js +371 -0
  1187. package/src/schedule/ScheduleDeleteTransaction.js +174 -0
  1188. package/src/schedule/ScheduleId.js +173 -0
  1189. package/src/schedule/ScheduleInfo.js +243 -0
  1190. package/src/schedule/ScheduleInfoQuery.js +189 -0
  1191. package/src/schedule/ScheduleSignTransaction.js +189 -0
  1192. package/src/system/FreezeTransaction.js +390 -0
  1193. package/src/system/SystemDeleteTransaction.js +239 -0
  1194. package/src/system/SystemUndeleteTransaction.js +207 -0
  1195. package/src/token/AbstractTokenTransferTransaction.js +589 -0
  1196. package/src/token/AirdropPendingTransaction.js +58 -0
  1197. package/src/token/AssessedCustomFee.js +198 -0
  1198. package/src/token/CustomFee.js +87 -0
  1199. package/src/token/CustomFixedFee.js +178 -0
  1200. package/src/token/CustomFractionalFee.js +226 -0
  1201. package/src/token/CustomRoyaltyFee.js +173 -0
  1202. package/src/token/FeeAssessmentMethod.js +53 -0
  1203. package/src/token/NftId.js +95 -0
  1204. package/src/token/PendingAirdropId.js +157 -0
  1205. package/src/token/PendingAirdropRecord.js +50 -0
  1206. package/src/token/TokenAirdropTransaction.js +220 -0
  1207. package/src/token/TokenAssociateTransaction.js +214 -0
  1208. package/src/token/TokenAssociation.js +127 -0
  1209. package/src/token/TokenBurnTransaction.js +229 -0
  1210. package/src/token/TokenCancelAirdropTransaction.js +120 -0
  1211. package/src/token/TokenClaimAirdropTransaction.js +121 -0
  1212. package/src/token/TokenCreateTransaction.js +978 -0
  1213. package/src/token/TokenDeleteTransaction.js +161 -0
  1214. package/src/token/TokenDissociateTransaction.js +214 -0
  1215. package/src/token/TokenFeeScheduleUpdateTransaction.js +198 -0
  1216. package/src/token/TokenFreezeTransaction.js +203 -0
  1217. package/src/token/TokenGrantKycTransaction.js +203 -0
  1218. package/src/token/TokenId.js +203 -0
  1219. package/src/token/TokenInfo.js +454 -0
  1220. package/src/token/TokenInfoQuery.js +185 -0
  1221. package/src/token/TokenKeyValidation.js +70 -0
  1222. package/src/token/TokenMintTransaction.js +258 -0
  1223. package/src/token/TokenNftInfo.js +135 -0
  1224. package/src/token/TokenNftInfoQuery.js +369 -0
  1225. package/src/token/TokenNftTransfer.js +115 -0
  1226. package/src/token/TokenNftsUpdateTransaction.js +220 -0
  1227. package/src/token/TokenPauseTransaction.js +161 -0
  1228. package/src/token/TokenReference.js +40 -0
  1229. package/src/token/TokenRejectFlow.js +261 -0
  1230. package/src/token/TokenRejectTransaction.js +262 -0
  1231. package/src/token/TokenRevokeKycTransaction.js +203 -0
  1232. package/src/token/TokenSupplyType.js +74 -0
  1233. package/src/token/TokenTransfer.js +142 -0
  1234. package/src/token/TokenType.js +74 -0
  1235. package/src/token/TokenUnfreezeTransaction.js +203 -0
  1236. package/src/token/TokenUnpauseTransaction.js +161 -0
  1237. package/src/token/TokenUpdateNftsTransaction.js +225 -0
  1238. package/src/token/TokenUpdateTransaction.js +827 -0
  1239. package/src/token/TokenWipeTransaction.js +271 -0
  1240. package/src/topic/SubscriptionHandle.js +34 -0
  1241. package/src/topic/TopicCreateTransaction.js +557 -0
  1242. package/src/topic/TopicDeleteTransaction.js +167 -0
  1243. package/src/topic/TopicId.js +204 -0
  1244. package/src/topic/TopicInfo.js +254 -0
  1245. package/src/topic/TopicInfoQuery.js +190 -0
  1246. package/src/topic/TopicMessage.js +170 -0
  1247. package/src/topic/TopicMessageChunk.js +76 -0
  1248. package/src/topic/TopicMessageQuery.js +523 -0
  1249. package/src/topic/TopicMessageSubmitTransaction.js +488 -0
  1250. package/src/topic/TopicUpdateTransaction.js +659 -0
  1251. package/src/transaction/BatchTransaction.js +293 -0
  1252. package/src/transaction/CustomFeeLimit.js +121 -0
  1253. package/src/transaction/List.js +175 -0
  1254. package/src/transaction/NodeAccountIdSignatureMap.js +62 -0
  1255. package/src/transaction/NodeAccountIdSignatureMapLegacy.js +41 -0
  1256. package/src/transaction/SignableNodeTransactionBodyBytes.js +40 -0
  1257. package/src/transaction/SignatureMap.js +104 -0
  1258. package/src/transaction/SignatureMapLegacy.js +37 -0
  1259. package/src/transaction/SignaturePairMap.js +53 -0
  1260. package/src/transaction/TokenTransfer.js +1 -0
  1261. package/src/transaction/Transaction.js +2295 -0
  1262. package/src/transaction/TransactionHashMap.js +41 -0
  1263. package/src/transaction/TransactionId.js +262 -0
  1264. package/src/transaction/TransactionReceipt.js +414 -0
  1265. package/src/transaction/TransactionReceiptQuery.js +418 -0
  1266. package/src/transaction/TransactionRecord.js +638 -0
  1267. package/src/transaction/TransactionRecordQuery.js +440 -0
  1268. package/src/transaction/TransactionResponse.js +283 -0
  1269. package/src/types.d.ts +5 -0
  1270. package/src/util/ASN1-Decoder.js +256 -0
  1271. package/src/util.js +479 -0
  1272. package/src/version.js +3 -0
@@ -0,0 +1,2295 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+
3
+ import Hbar from "../Hbar.js";
4
+ import TransactionResponse from "./TransactionResponse.js";
5
+ import TransactionId from "./TransactionId.js";
6
+ import TransactionHashMap from "./TransactionHashMap.js";
7
+ import SignatureMap from "./SignatureMap.js";
8
+ import SignatureMapLegacy from "./SignatureMapLegacy.js";
9
+ import Executable, { ExecutionState } from "../Executable.js";
10
+ import Status from "../Status.js";
11
+ import Long from "long";
12
+ import * as sha384 from "../cryptography/sha384.js";
13
+ import * as hex from "../encoding/hex.js";
14
+ import * as HieroProto from "@hashgraph/proto";
15
+ import PrecheckStatusError from "../PrecheckStatusError.js";
16
+ import AccountId from "../account/AccountId.js";
17
+ import PublicKey from "../PublicKey.js";
18
+ import List from "./List.js";
19
+ import Timestamp from "../Timestamp.js";
20
+ import * as util from "../util.js";
21
+ import CustomFeeLimit from "./CustomFeeLimit.js";
22
+ import Key from "../Key.js";
23
+ import SignableNodeTransactionBodyBytes from "./SignableNodeTransactionBodyBytes.js";
24
+
25
+ /**
26
+ * @typedef {import("bignumber.js").default} BigNumber
27
+ */
28
+
29
+ /**
30
+ * @typedef {import("../schedule/ScheduleCreateTransaction.js").default} ScheduleCreateTransaction
31
+ * @typedef {import("../PrivateKey.js").default} PrivateKey
32
+ * @typedef {import("../channel/Channel.js").default} Channel
33
+ * @typedef {import("../client/Client.js").default<*, *>} Client
34
+ * @typedef {import("../Signer.js").Signer} Signer
35
+ */
36
+
37
+ // 90 days (in seconds)
38
+ export const DEFAULT_AUTO_RENEW_PERIOD = Long.fromValue(7776000);
39
+
40
+ // maximum value of i64 (so there is never a record generated)
41
+ export const DEFAULT_RECORD_THRESHOLD = Hbar.fromTinybars(
42
+ Long.fromString("9223372036854775807"),
43
+ );
44
+
45
+ /**
46
+ * Node account ID used for batch transactions
47
+ * @type {AccountId}
48
+ */
49
+ // @ts-ignore
50
+ const NODE_ACCOUNT_BATCH_ID = new AccountId(0, 0, 0);
51
+
52
+ // 120 seconds
53
+ const DEFAULT_TRANSACTION_VALID_DURATION = 120;
54
+
55
+ // The default message chunk size in bytes when splitting a given message.
56
+ // This value can be overriden using `setChunkSize` when preparing to submit a messsage via `TopicMessageSubmitTransaction`.
57
+ export const CHUNK_SIZE = 1024;
58
+
59
+ /**
60
+ * @type {Map<NonNullable<HieroProto.proto.TransactionBody["data"]>, (transactions: HieroProto.proto.ITransaction[], signedTransactions: HieroProto.proto.ISignedTransaction[], transactionIds: TransactionId[], nodeIds: AccountId[], bodies: HieroProto.proto.TransactionBody[]) => Transaction>}
61
+ */
62
+ export const TRANSACTION_REGISTRY = new Map();
63
+
64
+ /**
65
+ * Base class for all transactions that may be submitted to Hedera.
66
+ *
67
+ * @abstract
68
+ * @augments {Executable<HieroProto.proto.ITransaction, HieroProto.proto.ITransactionResponse, TransactionResponse>}
69
+ */
70
+ export default class Transaction extends Executable {
71
+ // A SDK transaction is composed of multiple, raw protobuf transactions.
72
+ // These should be functionally identical, with the exception of pointing to
73
+ // different nodes.
74
+
75
+ // When retrying a transaction after a network error or retry-able
76
+ // status response, we try a different transaction and thus a different node.
77
+
78
+ constructor() {
79
+ super();
80
+
81
+ /**
82
+ * List of proto transactions that have been built from this SDK
83
+ * transaction.
84
+ *
85
+ * This is a 2-D array built into one, meaning to
86
+ * get to the next row you'd index into this array `row * rowLength + column`
87
+ * where `rowLength` is `nodeAccountIds.length`
88
+ *
89
+ * @internal
90
+ * @type {List<HieroProto.proto.ITransaction | null>}
91
+ */
92
+ this._transactions = new List();
93
+
94
+ /**
95
+ * List of proto transactions that have been built from this SDK
96
+ * transaction.
97
+ *
98
+ * This is a 2-D array built into one, meaning to
99
+ * get to the next row you'd index into this array `row * rowLength + column`
100
+ * where `rowLength` is `nodeAccountIds.length`
101
+ *
102
+ * @internal
103
+ * @type {List<HieroProto.proto.ISignedTransaction>}
104
+ */
105
+ this._signedTransactions = new List();
106
+
107
+ /**
108
+ * Set of public keys (as string) who have signed this transaction so
109
+ * we do not allow them to sign it again.
110
+ *
111
+ * @internal
112
+ * @type {Set<string>}
113
+ */
114
+ this._signerPublicKeys = new Set();
115
+
116
+ /**
117
+ * The transaction valid duration
118
+ *
119
+ * @private
120
+ * @type {number}
121
+ */
122
+ this._transactionValidDuration = DEFAULT_TRANSACTION_VALID_DURATION;
123
+
124
+ /**
125
+ * The default max transaction fee for this particular transaction type.
126
+ * Most transactions use the default of 2 Hbars, but some requests such
127
+ * as `TokenCreateTransaction` need to use a different default value.
128
+ *
129
+ * @protected
130
+ * @type {Hbar}
131
+ */
132
+ this._defaultMaxTransactionFee = new Hbar(2);
133
+
134
+ /**
135
+ * The maximum custom fee that the user is willing to pay for the message. If left empty, the user is willing to pay any custom fee.
136
+ * If used with a transaction type that does not support custom fee limits, the transaction will fail.
137
+ * @type {CustomFeeLimit[]}
138
+ */
139
+ this._customFeeLimits = [];
140
+
141
+ /**
142
+ * The max transaction fee on the request. This field is what users are able
143
+ * to set, not the `defaultMaxTransactionFee`. The purpose of this field is
144
+ * to allow us to determine if the user set the field explicitly, or if we're
145
+ * using the default max transation fee for the request.
146
+ *
147
+ * @private
148
+ * @type {Hbar | null}
149
+ */
150
+ this._maxTransactionFee = null;
151
+
152
+ /**
153
+ * The transaction's memo
154
+ *
155
+ * @private
156
+ * @type {string}
157
+ */
158
+ this._transactionMemo = "";
159
+
160
+ /**
161
+ * The list of transaction IDs. This list will almost always be of length 1.
162
+ * The only time this list will be a different length is for chunked transactions.
163
+ * The only two chunked transactions supported right now are `FileAppendTransaction`
164
+ * and `TopicMessageSubmitTransaction`
165
+ *
166
+ * @protected
167
+ * @type {List<TransactionId>}
168
+ */
169
+ this._transactionIds = new List();
170
+
171
+ /**
172
+ * A list of public keys that will be added to the requests signatures
173
+ *
174
+ * @private
175
+ * @type {PublicKey[]}
176
+ */
177
+ this._publicKeys = [];
178
+
179
+ /**
180
+ * The list of signing function 1-1 with `_publicKeys` which sign the request.
181
+ * The reason this list allows `null` is because if we go from bytes into
182
+ * a transaction, then we know the public key, but we don't have the signing function.
183
+ *
184
+ * @private
185
+ * @type {(((message: Uint8Array) => Promise<Uint8Array>) | null)[]}
186
+ */
187
+ this._transactionSigners = [];
188
+
189
+ /**
190
+ * Determine if we should regenerate transaction IDs when we receive `TRANSACITON_EXPIRED`
191
+ *
192
+ * @private
193
+ * @type {?boolean}
194
+ */
195
+ this._regenerateTransactionId = null;
196
+
197
+ /**
198
+ * The key used to sign the batch transaction
199
+ *
200
+ * @private
201
+ * @type {Key | null}
202
+ */
203
+ this._batchKey = null;
204
+
205
+ /**
206
+ * Whether the transaction is throttled
207
+ *
208
+ * @private
209
+ * @type {boolean}
210
+ */
211
+ this._isThrottled = false;
212
+ }
213
+
214
+ /**
215
+ * Deserialize a transaction from bytes. The bytes can either be a `proto.Transaction` or
216
+ * `proto.TransactionList`.
217
+ *
218
+ * @param {Uint8Array} bytes
219
+ * @returns {Transaction}
220
+ */
221
+ static fromBytes(bytes) {
222
+ /** @type {HieroProto.proto.ISignedTransaction[]} */
223
+ const signedTransactions = [];
224
+
225
+ /** @type {TransactionId[]} */
226
+ const transactionIds = [];
227
+
228
+ /** @type {AccountId[]} */
229
+ const nodeIds = [];
230
+
231
+ /** @type {string[]} */
232
+ const transactionIdStrings = [];
233
+
234
+ /** @type {string[]} */
235
+ const nodeIdStrings = [];
236
+
237
+ /** @type {HieroProto.proto.TransactionBody[]} */
238
+ const bodies = [];
239
+
240
+ const list =
241
+ HieroProto.proto.TransactionList.decode(bytes).transactionList;
242
+
243
+ // If the list is of length 0, then teh bytes provided were not a
244
+ // `proto.TransactionList`
245
+ //
246
+ // FIXME: We should also check to make sure the bytes length is greater than
247
+ // 0 otherwise this check is wrong?
248
+ if (list.length === 0) {
249
+ const transaction = HieroProto.proto.Transaction.decode(bytes);
250
+
251
+ // We support `Transaction.signedTransactionBytes` and
252
+ // `Transaction.bodyBytes` + `Transaction.sigMap`. If the bytes represent the
253
+ // latter, convert them into `signedTransactionBytes`
254
+ if (transaction.signedTransactionBytes.length !== 0) {
255
+ list.push(transaction);
256
+ } else {
257
+ list.push({
258
+ signedTransactionBytes:
259
+ HieroProto.proto.SignedTransaction.encode({
260
+ sigMap: transaction.sigMap,
261
+ bodyBytes: transaction.bodyBytes,
262
+ }).finish(),
263
+ });
264
+ }
265
+ }
266
+
267
+ // This loop is responsible for fill out the `signedTransactions`, `transactionIds`,
268
+ // `nodeIds`, and `bodies` variables.
269
+ for (const transaction of list) {
270
+ // The `bodyBytes` or `signedTransactionBytes` should not be null
271
+ if (
272
+ transaction.bodyBytes == null &&
273
+ transaction.signedTransactionBytes == null
274
+ ) {
275
+ throw new Error(
276
+ "bodyBytes and signedTransactionBytes are null",
277
+ );
278
+ }
279
+
280
+ if (transaction.bodyBytes && transaction.bodyBytes.length != 0) {
281
+ // Decode a transaction
282
+ const body = HieroProto.proto.TransactionBody.decode(
283
+ transaction.bodyBytes,
284
+ );
285
+
286
+ // Make sure the transaction ID within the body is set
287
+ if (body.transactionID != null) {
288
+ const transactionId = TransactionId._fromProtobuf(
289
+ /** @type {HieroProto.proto.ITransactionID} */ (
290
+ body.transactionID
291
+ ),
292
+ );
293
+
294
+ // If we haven't already seen this transaction ID in the list, add it
295
+ if (
296
+ !transactionIdStrings.includes(transactionId.toString())
297
+ ) {
298
+ transactionIds.push(transactionId);
299
+ transactionIdStrings.push(transactionId.toString());
300
+ }
301
+ }
302
+
303
+ // Make sure the node account ID within the body is set
304
+ if (body.nodeAccountID != null) {
305
+ const nodeAccountId = AccountId._fromProtobuf(
306
+ /** @type {HieroProto.proto.IAccountID} */ (
307
+ body.nodeAccountID
308
+ ),
309
+ );
310
+
311
+ // If we haven't already seen this node account ID in the list, add it
312
+ if (!nodeIdStrings.includes(nodeAccountId.toString())) {
313
+ nodeIds.push(nodeAccountId);
314
+ nodeIdStrings.push(nodeAccountId.toString());
315
+ }
316
+ }
317
+
318
+ // Make sure the body is set
319
+ if (body.data == null) {
320
+ throw new Error(
321
+ "(BUG) body.data was not set in the protobuf",
322
+ );
323
+ }
324
+
325
+ bodies.push(body);
326
+ }
327
+
328
+ if (
329
+ transaction.signedTransactionBytes &&
330
+ transaction.signedTransactionBytes.length != 0
331
+ ) {
332
+ // Decode a signed transaction
333
+ const signedTransaction =
334
+ HieroProto.proto.SignedTransaction.decode(
335
+ transaction.signedTransactionBytes,
336
+ );
337
+
338
+ signedTransactions.push(signedTransaction);
339
+
340
+ // Decode a transaction body
341
+ const body = HieroProto.proto.TransactionBody.decode(
342
+ signedTransaction.bodyBytes,
343
+ );
344
+
345
+ // Make sure the transaction ID within the body is set
346
+ if (body.transactionID != null) {
347
+ const transactionId = TransactionId._fromProtobuf(
348
+ /** @type {HieroProto.proto.ITransactionID} */ (
349
+ body.transactionID
350
+ ),
351
+ );
352
+
353
+ // If we haven't already seen this transaction ID in the list, add it
354
+ if (
355
+ !transactionIdStrings.includes(transactionId.toString())
356
+ ) {
357
+ transactionIds.push(transactionId);
358
+ transactionIdStrings.push(transactionId.toString());
359
+ }
360
+ }
361
+
362
+ // Make sure the node account ID within the body is set
363
+ if (body.nodeAccountID != null) {
364
+ const nodeAccountId = AccountId._fromProtobuf(
365
+ /** @type {HieroProto.proto.IAccountID} */ (
366
+ body.nodeAccountID
367
+ ),
368
+ );
369
+
370
+ // If we haven't already seen this node account ID in the list, add it
371
+ if (!nodeIdStrings.includes(nodeAccountId.toString())) {
372
+ nodeIds.push(nodeAccountId);
373
+ nodeIdStrings.push(nodeAccountId.toString());
374
+ }
375
+ }
376
+
377
+ // Make sure the body is set
378
+ if (body.data == null) {
379
+ throw new Error(
380
+ "(BUG) body.data was not set in the protobuf",
381
+ );
382
+ }
383
+
384
+ bodies.push(body);
385
+ }
386
+ }
387
+
388
+ // FIXME: We should have a length check before we access `0` since that would error
389
+ const body = bodies[0];
390
+
391
+ // We should have at least more than one body
392
+ if (body == null || body.data == null) {
393
+ throw new Error(
394
+ "No transaction found in bytes or failed to decode TransactionBody",
395
+ );
396
+ }
397
+
398
+ // Use the registry to call the right transaction's `fromProtobuf` method based
399
+ // on the `body.data` string
400
+ const fromProtobuf = TRANSACTION_REGISTRY.get(body.data); //NOSONAR
401
+
402
+ // If we forgot to update the registry we should error
403
+ if (fromProtobuf == null) {
404
+ throw new Error(
405
+ `(BUG) Transaction.fromBytes() not implemented for type ${body.data}`,
406
+ );
407
+ }
408
+
409
+ // That the specific transaction type from protobuf implementation and pass in all the
410
+ // information we've gathered.
411
+ return fromProtobuf(
412
+ list,
413
+ signedTransactions,
414
+ transactionIds,
415
+ nodeIds,
416
+ bodies,
417
+ );
418
+ }
419
+
420
+ /**
421
+ * Convert this transaction a `ScheduleCreateTransaction`
422
+ *
423
+ * @returns {ScheduleCreateTransaction}
424
+ */
425
+ schedule() {
426
+ this._requireNotFrozen();
427
+
428
+ if (SCHEDULE_CREATE_TRANSACTION.length != 1) {
429
+ throw new Error(
430
+ "ScheduleCreateTransaction has not been loaded yet",
431
+ );
432
+ }
433
+
434
+ return SCHEDULE_CREATE_TRANSACTION[0]()._setScheduledTransaction(this);
435
+ }
436
+
437
+ /**
438
+ * @description Batchify method is used to mark a transaction as part of a batch transaction or make it so-called inner transaction.
439
+ * The Transaction will be frozen and signed by the operator of the client.
440
+ *
441
+ * @param {import("../client/Client.js").default<Channel, *>} client
442
+ * @param {Key} batchKey
443
+ * @returns {Promise<this>}
444
+ */
445
+ async batchify(client, batchKey) {
446
+ this._requireNotFrozen();
447
+ this.setBatchKey(batchKey);
448
+ return await this.signWithOperator(client);
449
+ }
450
+
451
+ /**
452
+ * This method is called by each `*Transaction._fromProtobuf()` method. It does
453
+ * all the finalization before the user gets hold of a complete `Transaction`
454
+ *
455
+ * @template {Transaction} TransactionT
456
+ * @param {TransactionT} transaction
457
+ * @param {HieroProto.proto.ITransaction[]} transactions
458
+ * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions
459
+ * @param {TransactionId[]} transactionIds
460
+ * @param {AccountId[]} nodeIds
461
+ * @param {HieroProto.proto.ITransactionBody[]} bodies
462
+ * @returns {TransactionT}
463
+ */
464
+ static _fromProtobufTransactions(
465
+ transaction,
466
+ transactions,
467
+ signedTransactions,
468
+ transactionIds,
469
+ nodeIds,
470
+ bodies,
471
+ ) {
472
+ const body = bodies[0];
473
+
474
+ // "row" of the 2-D `bodies` array has all the same contents except for `nodeAccountID`
475
+ for (let i = 0; i < transactionIds.length; i++) {
476
+ for (let j = 0; j < nodeIds.length - 1; j++) {
477
+ if (
478
+ !util.compare(
479
+ bodies[i * nodeIds.length + j],
480
+ bodies[i * nodeIds.length + j + 1],
481
+ // eslint-disable-next-line ie11/no-collection-args
482
+ new Set(["nodeAccountID"]),
483
+ )
484
+ ) {
485
+ throw new Error("failed to validate transaction bodies");
486
+ }
487
+ }
488
+ }
489
+
490
+ // Remove node account IDs of 0
491
+ // _IIRC_ this was initial due to some funny behavior with `ScheduleCreateTransaction`
492
+ // We may be able to remove this.
493
+ const zero = new AccountId(0);
494
+ for (let i = 0; i < nodeIds.length; i++) {
495
+ if (nodeIds[i].equals(zero)) {
496
+ nodeIds.splice(i--, 1);
497
+ }
498
+ }
499
+
500
+ // Set the transactions accordingly, but don't lock the list because transactions can
501
+ // be regenerated if more signatures are added
502
+ transaction._transactions.setList(transactions);
503
+
504
+ // Set the signed transactions accordingly. Although, they
505
+ // can be manipulated if for instance more signatures are added
506
+ transaction._signedTransactions.setList(signedTransactions);
507
+
508
+ // Set the transaction IDs accordingly
509
+ transaction._transactionIds.setList(transactionIds);
510
+
511
+ // Set the node account IDs accordingly
512
+ transaction._nodeAccountIds.setList(nodeIds);
513
+
514
+ // Make sure to update the rest of the fields
515
+ transaction._transactionValidDuration =
516
+ body.transactionValidDuration != null &&
517
+ body.transactionValidDuration.seconds != null
518
+ ? Long.fromValue(body.transactionValidDuration.seconds).toInt()
519
+ : DEFAULT_TRANSACTION_VALID_DURATION;
520
+ transaction._maxTransactionFee =
521
+ body.transactionFee != null &&
522
+ body.transactionFee > new Long(0, 0, true)
523
+ ? Hbar.fromTinybars(body.transactionFee)
524
+ : null;
525
+ transaction._customFeeLimits =
526
+ body.maxCustomFees != null
527
+ ? body.maxCustomFees?.map((fee) =>
528
+ CustomFeeLimit._fromProtobuf(fee),
529
+ )
530
+ : [];
531
+ transaction._batchKey =
532
+ body.batchKey != null ? Key._fromProtobufKey(body?.batchKey) : null;
533
+
534
+ transaction._transactionMemo = body.memo != null ? body.memo : "";
535
+
536
+ // Loop over a single row of `signedTransactions` and add all the public
537
+ // keys to the `signerPublicKeys` set, and `publicKeys` list with
538
+ // `null` in the `transactionSigners` at the same index.
539
+ for (let i = 0; i < nodeIds.length; i++) {
540
+ const tx = signedTransactions[i] || transactions[i];
541
+ if (tx.sigMap != null && tx.sigMap.sigPair != null) {
542
+ for (const sigPair of tx.sigMap.sigPair) {
543
+ transaction._signerPublicKeys.add(
544
+ hex.encode(
545
+ /** @type {Uint8Array} */ (sigPair.pubKeyPrefix),
546
+ ),
547
+ );
548
+
549
+ transaction._publicKeys.push(
550
+ PublicKey.fromBytes(
551
+ /** @type {Uint8Array} */ (sigPair.pubKeyPrefix),
552
+ ),
553
+ );
554
+ transaction._transactionSigners.push(null);
555
+ }
556
+ }
557
+ }
558
+
559
+ return transaction;
560
+ }
561
+
562
+ /**
563
+ * Set the node account IDs
564
+ *
565
+ * @override
566
+ * @param {AccountId[]} nodeIds
567
+ * @returns {this}
568
+ */
569
+ setNodeAccountIds(nodeIds) {
570
+ // The reason we overwrite this method is simply because we need to call `requireNotFrozen()`
571
+ // Now that I think of it, we could just add an abstract method `setterPrerequiest()` which
572
+ // by default does nothing, and `Executable` can call. Then we'd only need to overwrite that
573
+ // method once.
574
+ this._requireNotFrozen();
575
+ super.setNodeAccountIds(nodeIds);
576
+ return this;
577
+ }
578
+
579
+ /**
580
+ * Get the transaction valid duration
581
+ *
582
+ * @returns {number}
583
+ */
584
+ get transactionValidDuration() {
585
+ return this._transactionValidDuration;
586
+ }
587
+
588
+ /**
589
+ * Protobuf encoding has specific rules about how data is serialized
590
+ * Different fields take different amounts of space depending on their values
591
+ * The actual wire format size can only be determined after encoding
592
+ *
593
+ * @returns {Promise<number>}
594
+ */
595
+ get size() {
596
+ this._requireFrozen();
597
+ return this._makeRequestAsync().then(
598
+ (request) =>
599
+ HieroProto.proto.Transaction.encode(request).finish().length,
600
+ );
601
+ }
602
+
603
+ /**
604
+ * Get the transaction body size
605
+ * Protobuf encoding has specific rules about how data is serialized
606
+ * Different fields take different amounts of space depending on their values
607
+ * The actual wire format size can only be determined after encoding
608
+ *
609
+ * @returns {number}
610
+ */
611
+ get bodySize() {
612
+ const body = this._makeTransactionBody(AccountId.fromString("0.0.0"));
613
+
614
+ return HieroProto.proto.TransactionBody.encode(body).finish().length;
615
+ }
616
+
617
+ /**
618
+ * Sets the duration (in seconds) that this transaction is valid for.
619
+ *
620
+ * This is defaulted to 120 seconds (from the time its executed).
621
+ *
622
+ * @param {number} validDuration
623
+ * @returns {this}
624
+ */
625
+ setTransactionValidDuration(validDuration) {
626
+ this._requireNotFrozen();
627
+ this._transactionValidDuration = validDuration;
628
+
629
+ return this;
630
+ }
631
+
632
+ /**
633
+ * Get the max transaction fee
634
+ *
635
+ * @returns {?Hbar}
636
+ */
637
+ get maxTransactionFee() {
638
+ return this._maxTransactionFee;
639
+ }
640
+
641
+ /**
642
+ * Set the maximum transaction fee the operator (paying account)
643
+ * is willing to pay.
644
+ *
645
+ * @param {number | string | Long | BigNumber | Hbar} maxTransactionFee
646
+ * @returns {this}
647
+ */
648
+ setMaxTransactionFee(maxTransactionFee) {
649
+ this._requireNotFrozen();
650
+ this._maxTransactionFee =
651
+ maxTransactionFee instanceof Hbar
652
+ ? maxTransactionFee
653
+ : new Hbar(maxTransactionFee);
654
+
655
+ return this;
656
+ }
657
+
658
+ /**
659
+ * Is transaction ID regeneration enabled
660
+ *
661
+ * @returns {?boolean}
662
+ */
663
+ get regenerateTransactionId() {
664
+ return this._regenerateTransactionId;
665
+ }
666
+
667
+ /**
668
+ * Set the maximum transaction fee the operator (paying account)
669
+ * is willing to pay.
670
+ *
671
+ * @param {boolean} regenerateTransactionId
672
+ * @returns {this}
673
+ */
674
+ setRegenerateTransactionId(regenerateTransactionId) {
675
+ this._requireNotFrozen();
676
+ this._regenerateTransactionId = regenerateTransactionId;
677
+
678
+ return this;
679
+ }
680
+
681
+ /**
682
+ * Get the transaction memo
683
+ *
684
+ * @returns {string}
685
+ */
686
+ get transactionMemo() {
687
+ return this._transactionMemo;
688
+ }
689
+
690
+ /**
691
+ * Set a note or description to be recorded in the transaction
692
+ * record (maximum length of 100 bytes).
693
+ *
694
+ * @param {string} transactionMemo
695
+ * @returns {this}
696
+ */
697
+ setTransactionMemo(transactionMemo) {
698
+ this._requireNotFrozen();
699
+ this._transactionMemo = transactionMemo;
700
+
701
+ return this;
702
+ }
703
+
704
+ /**
705
+ * Get the curent transaction ID
706
+ *
707
+ * @returns {?TransactionId}
708
+ */
709
+ get transactionId() {
710
+ if (this._transactionIds.isEmpty) {
711
+ return null;
712
+ }
713
+
714
+ // If a user calls `.transactionId` that means we need to use that transaction ID
715
+ // and **not** regenerate it. To do this, we simply lock the transaction ID list.
716
+ //
717
+ // This may be a little conffusing since a user can enable transaction ID regenration
718
+ // explicity, but if they call `.transactionId` then we will not regenerate transaction
719
+ // IDs.
720
+ this._transactionIds.setLocked();
721
+
722
+ return this._transactionIds.current;
723
+ }
724
+
725
+ /**
726
+ * Set the ID for this transaction.
727
+ *
728
+ * The transaction ID includes the operator's account ( the account paying the transaction
729
+ * fee). If two transactions have the same transaction ID, they won't both have an effect. One
730
+ * will complete normally and the other will fail with a duplicate transaction status.
731
+ *
732
+ * Normally, you should not use this method. Just before a transaction is executed, a
733
+ * transaction ID will be generated from the operator on the client.
734
+ *
735
+ * @param {TransactionId} transactionId
736
+ * @returns {this}
737
+ */
738
+ setTransactionId(transactionId) {
739
+ this._requireNotFrozen();
740
+ this._transactionIds.setList([transactionId]).setLocked();
741
+
742
+ return this;
743
+ }
744
+
745
+ /**
746
+ * How many chunk sizes are expected
747
+ * @abstract
748
+ * @internal
749
+ * @returns {number}
750
+ */
751
+ getRequiredChunks() {
752
+ return 1;
753
+ }
754
+
755
+ /**
756
+ * Get the body sizes for all chunks in a Chunked transaction.
757
+ * For transactions with multiple chunks (like large topic message submissions),
758
+ * this returns an array containing the size of each chunk's transaction body.
759
+ * The size is calculated by encoding the transaction body to protobuf format.
760
+ *
761
+ * @returns {number[]} An array of body sizes, where each element represents
762
+ * the size in bytes of a chunk's transaction body
763
+ *
764
+ */
765
+ get bodySizeAllChunks() {
766
+ const bodySizes = [];
767
+
768
+ // Store sizes for each chunk
769
+ for (let i = 0; i < this.getRequiredChunks(); i++) {
770
+ // Set index directly
771
+ this._transactionIds.index = i;
772
+ // Use super.bodySize to access the base class implementation
773
+ bodySizes.push(this.bodySize);
774
+ }
775
+ // Restore to initial index
776
+ this._transactionIds.index = 0;
777
+ return bodySizes;
778
+ }
779
+
780
+ /**
781
+ * Sign the transaction with the private key
782
+ * **NOTE**: This is a thin wrapper around `.signWith()`
783
+ *
784
+ * @param {PrivateKey} privateKey
785
+ * @returns {Promise<this>}
786
+ */
787
+ sign(privateKey) {
788
+ return this.signWith(privateKey.publicKey, (message) =>
789
+ Promise.resolve(privateKey.sign(message)),
790
+ );
791
+ }
792
+
793
+ /**
794
+ * Sign the transaction with the public key and signer function
795
+ *
796
+ * If sign on demand is enabled no signing will be done immediately, instead
797
+ * the private key signing function and public key are saved to be used when
798
+ * a user calls an exit condition method (not sure what a better name for this is)
799
+ * such as `toBytes[Async]()`, `getTransactionHash[PerNode]()` or `execute()`.
800
+ *
801
+ * @param {PublicKey} publicKey
802
+ * @param {(message: Uint8Array) => Promise<Uint8Array>} transactionSigner
803
+ * @returns {Promise<this>}
804
+ */
805
+ async signWith(publicKey, transactionSigner) {
806
+ // If signing on demand is disabled, we need to make sure
807
+ // the request is frozen
808
+ if (!this._signOnDemand) {
809
+ this._requireFrozen();
810
+ }
811
+ const publicKeyData = publicKey.toBytesRaw();
812
+
813
+ // note: this omits the DER prefix on purpose because Hedera doesn't
814
+ // support that in the protobuf. this means that we would fail
815
+ // to re-inflate [this._signerPublicKeys] during [fromBytes] if we used DER
816
+ // prefixes here
817
+ const publicKeyHex = hex.encode(publicKeyData);
818
+
819
+ if (this._signerPublicKeys.has(publicKeyHex)) {
820
+ // this public key has already signed this transaction
821
+ return this;
822
+ }
823
+
824
+ // If we add a new signer, then we need to re-create all transactions
825
+ this._transactions.clear();
826
+
827
+ // Save the current public key so we don't attempt to sign twice
828
+ this._signerPublicKeys.add(publicKeyHex);
829
+
830
+ this._publicKeys.push(publicKey);
831
+ this._transactionSigners.push(transactionSigner);
832
+ if (this._signOnDemand) {
833
+ return this;
834
+ }
835
+
836
+ // If we get here, signing on demand is disabled, this means the transaction
837
+ // is frozen and we need to sign all the transactions immediately. If we're
838
+ // signing all the transactions immediately, we need to lock the node account IDs
839
+ // and transaction IDs.
840
+ // Now that I think of it, this code should likely exist in `freezeWith()`?
841
+ this._transactionIds.setLocked();
842
+ this._nodeAccountIds.setLocked();
843
+
844
+ // Sign each signed transatcion
845
+ for (const signedTransaction of this._signedTransactions.list) {
846
+ const bodyBytes = /** @type {Uint8Array} */ (
847
+ signedTransaction.bodyBytes
848
+ );
849
+ const signature = await transactionSigner(bodyBytes);
850
+
851
+ if (signedTransaction.sigMap == null) {
852
+ signedTransaction.sigMap = {};
853
+ }
854
+
855
+ if (signedTransaction.sigMap.sigPair == null) {
856
+ signedTransaction.sigMap.sigPair = [];
857
+ }
858
+
859
+ signedTransaction.sigMap.sigPair.push(
860
+ publicKey._toProtobufSignature(signature),
861
+ );
862
+ }
863
+
864
+ return this;
865
+ }
866
+
867
+ /**
868
+ * Sign the transaction with the client operator. This is a thin wrapper
869
+ * around `.signWith()`
870
+ *
871
+ * **NOTE**: If client does not have an operator set, this method will throw
872
+ *
873
+ * @param {import("../client/Client.js").default<Channel, *>} client
874
+ * @returns {Promise<this>}
875
+ */
876
+ signWithOperator(client) {
877
+ const operator = client._operator;
878
+
879
+ if (operator == null) {
880
+ throw new Error(
881
+ "`client` must have an operator to sign with the operator",
882
+ );
883
+ }
884
+
885
+ if (!this._isFrozen()) {
886
+ this.freezeWith(client);
887
+ }
888
+
889
+ return this.signWith(operator.publicKey, operator.transactionSigner);
890
+ }
891
+
892
+ /**
893
+ * Resets the transaction to its initial state
894
+ * @param {Client} client
895
+ */
896
+ _resetTransaction(client) {
897
+ if (!client.operatorAccountId) {
898
+ throw new Error("Client must have an operator account ID");
899
+ }
900
+
901
+ this.logger?.info("Resetting transaction id and resigning");
902
+ const newTxId = TransactionId.generate(client.operatorAccountId);
903
+ this._transactionIds.clear();
904
+ this._signedTransactions.clear();
905
+ this._transactionIds.setList([newTxId]);
906
+ this._isThrottled = true;
907
+ }
908
+ /**
909
+ * @deprecated - Using uint8array and uint8array[] as signaturemap is deprecated,
910
+ * use SignatureMap insted.
911
+ * @overload
912
+ * @param { PublicKey } publicKey
913
+ * @param { Uint8Array | Uint8Array[] } signatureMap
914
+ * @returns {this}
915
+ */
916
+
917
+ /**
918
+ * @overload
919
+ * @param {PublicKey} publicKey
920
+ * @param { SignatureMap } signatureMap
921
+ * @returns {this}
922
+ */
923
+
924
+ /**
925
+ * Add a signature explicitly
926
+ *
927
+ * @param {PublicKey} publicKey
928
+ * @param {SignatureMap | Uint8Array |Uint8Array[]} signatureMap
929
+ * @returns {this}
930
+ */
931
+ addSignature(publicKey, signatureMap) {
932
+ if (!(signatureMap instanceof SignatureMap)) {
933
+ return this._addSignatureLegacy(publicKey, signatureMap);
934
+ }
935
+
936
+ // If the transaction isn't frozen, freeze it.
937
+ if (!this.isFrozen()) {
938
+ this.freeze();
939
+ }
940
+
941
+ const publicKeyData = publicKey.toBytesRaw();
942
+ const publicKeyHex = hex.encode(publicKeyData);
943
+
944
+ if (this._signerPublicKeys.has(publicKeyHex)) {
945
+ // this public key has already signed this transaction
946
+ return this;
947
+ }
948
+
949
+ // If we add a new signer, then we need to re-create all transactions
950
+ this._transactions.clear();
951
+
952
+ // Locking the transaction IDs and node account IDs is necessary for consistency
953
+ // between before and after execution
954
+ this._transactionIds.setLocked();
955
+ this._nodeAccountIds.setLocked();
956
+ this._signedTransactions.setLocked();
957
+
958
+ // Add the signature to the signed transaction list
959
+ for (let index = 0; index < this._signedTransactions.length; index++) {
960
+ const signedTransaction = this._signedTransactions.get(index);
961
+ if (signedTransaction.sigMap == null) {
962
+ signedTransaction.sigMap = {};
963
+ }
964
+
965
+ if (signedTransaction.sigMap.sigPair == null) {
966
+ signedTransaction.sigMap.sigPair = [];
967
+ }
968
+
969
+ if (signedTransaction.bodyBytes) {
970
+ const { transactionID, nodeAccountID } =
971
+ HieroProto.proto.TransactionBody.decode(
972
+ signedTransaction.bodyBytes,
973
+ );
974
+
975
+ if (!transactionID || !nodeAccountID) {
976
+ throw new Error(
977
+ "Transaction ID or Node Account ID not found in the signed transaction",
978
+ );
979
+ }
980
+
981
+ const transactionId =
982
+ TransactionId._fromProtobuf(transactionID);
983
+ const nodeAccountId = AccountId._fromProtobuf(nodeAccountID);
984
+
985
+ const nodeSignatures = signatureMap.get(nodeAccountId);
986
+ const transactionSignatures =
987
+ nodeSignatures?.get(transactionId);
988
+ const signature = transactionSignatures?.get(publicKey);
989
+
990
+ if (!signature) {
991
+ throw new Error(
992
+ "Signature not found for the transaction and public key",
993
+ );
994
+ }
995
+ const sigPair = publicKey._toProtobufSignature(signature);
996
+ signedTransaction.sigMap?.sigPair?.push(sigPair);
997
+ }
998
+ }
999
+
1000
+ this._signerPublicKeys.add(publicKeyHex);
1001
+ this._publicKeys.push(publicKey);
1002
+ this._transactionSigners.push(null);
1003
+
1004
+ return this;
1005
+ }
1006
+
1007
+ /**
1008
+ * Add a signature explicitly
1009
+ * This method supports both single and multiple signatures. A single signature will be applied to all transactions,
1010
+ *
1011
+ * While an array of signatures must correspond to each transaction individually.
1012
+ *
1013
+ * @param {PublicKey} publicKey
1014
+ * @param {Uint8Array | Uint8Array[]} signature
1015
+ * @returns {this}
1016
+ */
1017
+ _addSignatureLegacy(publicKey, signature) {
1018
+ const isSingleSignature = signature instanceof Uint8Array;
1019
+
1020
+ const isArraySignature = Array.isArray(signature);
1021
+
1022
+ if (this.getRequiredChunks() > 1) {
1023
+ throw new Error(
1024
+ "Add signature is not supported for chunked transactions",
1025
+ );
1026
+ }
1027
+
1028
+ // Check if it is a single signature with NOT exactly one transaction
1029
+
1030
+ if (isSingleSignature && this._signedTransactions.length !== 1) {
1031
+ throw new Error(
1032
+ "Signature array must match the number of transactions",
1033
+ );
1034
+ }
1035
+
1036
+ // Check if it's an array but the array length doesn't match the number of transactions
1037
+
1038
+ if (
1039
+ isArraySignature &&
1040
+ signature.length !== this._signedTransactions.length
1041
+ ) {
1042
+ throw new Error(
1043
+ "Signature array must match the number of transactions",
1044
+ );
1045
+ }
1046
+
1047
+ // If the transaction isn't frozen, freeze it.
1048
+ if (!this.isFrozen()) {
1049
+ this.freeze();
1050
+ }
1051
+
1052
+ const publicKeyData = publicKey.toBytesRaw();
1053
+ const publicKeyHex = hex.encode(publicKeyData);
1054
+
1055
+ if (this._signerPublicKeys.has(publicKeyHex)) {
1056
+ // this public key has already signed this transaction
1057
+ return this;
1058
+ }
1059
+
1060
+ // If we add a new signer, then we need to re-create all transactions
1061
+ this._transactions.clear();
1062
+
1063
+ // Locking the transaction IDs and node account IDs is necessary for consistency
1064
+ // between before and after execution
1065
+ this._transactionIds.setLocked();
1066
+ this._nodeAccountIds.setLocked();
1067
+ this._signedTransactions.setLocked();
1068
+ const signatureArray = isSingleSignature ? [signature] : signature;
1069
+
1070
+ // Add the signature to the signed transaction list
1071
+ for (let index = 0; index < this._signedTransactions.length; index++) {
1072
+ const signedTransaction = this._signedTransactions.get(index);
1073
+ if (signedTransaction.sigMap == null) {
1074
+ signedTransaction.sigMap = {};
1075
+ }
1076
+
1077
+ if (signedTransaction.sigMap.sigPair == null) {
1078
+ signedTransaction.sigMap.sigPair = [];
1079
+ }
1080
+
1081
+ signedTransaction.sigMap.sigPair.push(
1082
+ publicKey._toProtobufSignature(signatureArray[index]),
1083
+ );
1084
+ }
1085
+
1086
+ this._signerPublicKeys.add(publicKeyHex);
1087
+ this._publicKeys.push(publicKey);
1088
+ this._transactionSigners.push(null);
1089
+
1090
+ return this;
1091
+ }
1092
+
1093
+ /**
1094
+ * Get the current signatures on the request
1095
+ * **NOTE**: Does NOT support sign on demand
1096
+ * @returns {SignatureMapLegacy}
1097
+ */
1098
+ getSignaturesLegacy() {
1099
+ // If a user is attempting to get signatures for a transaction, then the
1100
+ // transaction must be frozen.
1101
+ this._requireFrozen();
1102
+ // Sign on demand must be disabled because this is the non-async version and
1103
+ // signing requires awaiting callbacks.
1104
+ this._requireNotSignOnDemand();
1105
+ // Build all the transactions
1106
+ this._buildAllTransactions();
1107
+ // Lock transaction IDs, and node account IDs
1108
+ this._transactionIds.setLocked();
1109
+ this._nodeAccountIds.setLocked();
1110
+ // Construct a signature map from this transaction
1111
+ // eslint-disable-next-line deprecation/deprecation
1112
+ return SignatureMapLegacy._fromTransaction(this);
1113
+ }
1114
+
1115
+ /**
1116
+ * This method removes all signatures from the transaction based on the public key provided.
1117
+ *
1118
+ * @param {PublicKey} publicKey - The public key associated with the signature to remove.
1119
+ * @returns {Uint8Array[]} The removed signatures.
1120
+ */
1121
+ removeSignature(publicKey) {
1122
+ if (!this.isFrozen()) {
1123
+ this.freeze();
1124
+ }
1125
+
1126
+ const publicKeyData = publicKey.toBytesRaw();
1127
+ const publicKeyHex = hex.encode(publicKeyData);
1128
+
1129
+ if (!this._signerPublicKeys.has(publicKeyHex)) {
1130
+ throw new Error("The public key has not signed this transaction");
1131
+ }
1132
+
1133
+ /** @type {Uint8Array[]} */
1134
+ const removedSignatures = [];
1135
+
1136
+ // Iterate over the signed transactions and remove matching signatures
1137
+ for (const transaction of this._signedTransactions.list) {
1138
+ const removedSignaturesFromTransaction =
1139
+ this._removeSignaturesFromTransaction(
1140
+ transaction,
1141
+ publicKeyHex,
1142
+ );
1143
+
1144
+ removedSignatures.push(...removedSignaturesFromTransaction);
1145
+ }
1146
+
1147
+ // Remove the public key from internal tracking if no signatures remain
1148
+ this._signerPublicKeys.delete(publicKeyHex);
1149
+ this._publicKeys = this._publicKeys.filter(
1150
+ (key) => !key.equals(publicKey),
1151
+ );
1152
+
1153
+ // Update transaction signers array
1154
+ this._transactionSigners.pop();
1155
+
1156
+ return removedSignatures;
1157
+ }
1158
+
1159
+ /**
1160
+ * This method clears all signatures from the transaction and returns them in a specific format.
1161
+ *
1162
+ * It will call collectSignatures to get the removed signatures, then clear all signatures
1163
+ * from the internal tracking.
1164
+ *
1165
+ * @returns { Map<PublicKey, Uint8Array[] | Uint8Array> } The removed signatures in the specified format.
1166
+ */
1167
+ removeAllSignatures() {
1168
+ if (!this.isFrozen()) {
1169
+ this.freeze();
1170
+ }
1171
+
1172
+ const removedSignatures = this._collectSignaturesByPublicKey();
1173
+
1174
+ // Iterate over the signed transactions and clear all signatures
1175
+ for (const transaction of this._signedTransactions.list) {
1176
+ if (transaction.sigMap && transaction.sigMap.sigPair) {
1177
+ // Clear all signature pairs from the transaction's signature map
1178
+ transaction.sigMap.sigPair = [];
1179
+ }
1180
+ }
1181
+
1182
+ // Clear the internal tracking of signer public keys and other relevant arrays
1183
+ this._signerPublicKeys.clear();
1184
+ this._publicKeys = [];
1185
+ this._transactionSigners = [];
1186
+
1187
+ return removedSignatures;
1188
+ }
1189
+
1190
+ /**
1191
+ * @deprecated - Use the legacy=flag instead to use the modern approach
1192
+ * @overload
1193
+ * @param {true} legacy
1194
+ * @returns {SignatureMapLegacy}
1195
+ */
1196
+
1197
+ /**
1198
+ * @overload
1199
+ * @param {false} [legacy]
1200
+ * @returns {SignatureMap}
1201
+ */
1202
+
1203
+ /**
1204
+ * Get the current signatures on the request
1205
+ *
1206
+ * **NOTE**: Does NOT support sign on demand
1207
+ * @param {boolean} [legacy]
1208
+ * @returns {SignatureMap | SignatureMapLegacy}
1209
+ */
1210
+ getSignatures(legacy) {
1211
+ if (legacy) {
1212
+ return this.getSignaturesLegacy();
1213
+ }
1214
+ // If a user is attempting to get signatures for a transaction, then the
1215
+ // transaction must be frozen.
1216
+ this._requireFrozen();
1217
+
1218
+ // Sign on demand must be disabled because this is the non-async version and
1219
+ // signing requires awaiting callbacks.
1220
+ this._requireNotSignOnDemand();
1221
+
1222
+ // Build all the transactions
1223
+ this._buildAllTransactions();
1224
+
1225
+ // Lock transaction IDs, and node account IDs
1226
+ this._transactionIds.setLocked();
1227
+ this._nodeAccountIds.setLocked();
1228
+
1229
+ // Construct a signature map from this transaction
1230
+ return SignatureMap._fromTransaction(this);
1231
+ }
1232
+
1233
+ /**
1234
+ * Get the current signatures on the request
1235
+ *
1236
+ * **NOTE**: Supports sign on demand
1237
+ *
1238
+ * @returns {Promise<SignatureMap>}
1239
+ */
1240
+ async getSignaturesAsync() {
1241
+ // If sign on demand is enabled, we don't need to care about being frozen
1242
+ // since we can just regenerate and resign later if some field of the transaction
1243
+ // changes.
1244
+
1245
+ // Locking the transaction IDs and node account IDs is necessary for consistency
1246
+ // between before and after execution
1247
+ this._transactionIds.setLocked();
1248
+ this._nodeAccountIds.setLocked();
1249
+
1250
+ // Build all transactions, and sign them
1251
+ await this._buildAllTransactionsAsync();
1252
+
1253
+ // Lock transaction IDs, and node account IDs
1254
+ this._transactions.setLocked();
1255
+ this._signedTransactions.setLocked();
1256
+
1257
+ // Construct a signature map from this transaction
1258
+ return SignatureMap._fromTransaction(this);
1259
+ }
1260
+
1261
+ /**
1262
+ * Not sure why this is called `setTransactionId()` when it doesn't set anything...
1263
+ * FIXME: Remove this?
1264
+ */
1265
+ _setTransactionId() {
1266
+ if (this._operatorAccountId == null && this._transactionIds.isEmpty) {
1267
+ throw new Error(
1268
+ "`transactionId` must be set or `client` must be provided with `freezeWith`",
1269
+ );
1270
+ }
1271
+ }
1272
+
1273
+ /**
1274
+ * Set the node account IDs using the client
1275
+ *
1276
+ * @param {?import("../client/Client.js").default<Channel, *>} client
1277
+ */
1278
+ _setNodeAccountIds(client) {
1279
+ if (!this._nodeAccountIds.isEmpty) {
1280
+ return;
1281
+ }
1282
+
1283
+ if (client == null) {
1284
+ throw new Error(
1285
+ "`nodeAccountId` must be set or `client` must be provided with `freezeWith`",
1286
+ );
1287
+ }
1288
+
1289
+ this._nodeAccountIds.setList(
1290
+ client._network.getNodeAccountIdsForExecute(),
1291
+ );
1292
+ }
1293
+
1294
+ /**
1295
+ * @description Set the key that will sign the batch of which this Transaction is a part of.
1296
+ * @param {Key} batchKey
1297
+ * @returns {this}
1298
+ */
1299
+ setBatchKey(batchKey) {
1300
+ this._requireNotFrozen();
1301
+ this._batchKey = batchKey;
1302
+ return this;
1303
+ }
1304
+
1305
+ /**
1306
+ * @description Get the key that will sign the batch of which this Transaction is a part of.
1307
+ * @returns {Key | null | undefined}
1308
+ */
1309
+ get batchKey() {
1310
+ return this._batchKey;
1311
+ }
1312
+
1313
+ /**
1314
+ * Returns a List of SignableNodeTransactionBodyBytes for each node the transaction is intended for.
1315
+ * These are the canonical bytes that must be signed externally (e.g., via HSM).
1316
+ *
1317
+ * @returns {SignableNodeTransactionBodyBytes[]}
1318
+ */
1319
+ get signableNodeBodyBytesList() {
1320
+ this._requireFrozen();
1321
+
1322
+ return this._signedTransactions.list.map((signedTransaction) => {
1323
+ if (!signedTransaction.bodyBytes) {
1324
+ throw new Error("Missing bodyBytes in signed transaction.");
1325
+ }
1326
+
1327
+ const body = HieroProto.proto.TransactionBody.decode(
1328
+ signedTransaction.bodyBytes,
1329
+ );
1330
+
1331
+ if (!body.nodeAccountID) {
1332
+ throw new Error("Missing nodeAccountID in transaction body.");
1333
+ }
1334
+
1335
+ const nodeAccountId = AccountId._fromProtobuf(body.nodeAccountID);
1336
+ if (!body.transactionID) {
1337
+ throw new Error("Missing transactionID in transaction body.");
1338
+ }
1339
+
1340
+ const transactionId = TransactionId._fromProtobuf(
1341
+ body.transactionID,
1342
+ );
1343
+
1344
+ return new SignableNodeTransactionBodyBytes(
1345
+ nodeAccountId,
1346
+ transactionId,
1347
+ signedTransaction.bodyBytes,
1348
+ );
1349
+ });
1350
+ }
1351
+
1352
+ /**
1353
+ * Build all the signed transactions from the node account IDs
1354
+ *
1355
+ * @private
1356
+ */
1357
+ _buildSignedTransactions() {
1358
+ if (this._signedTransactions.locked) {
1359
+ return;
1360
+ }
1361
+
1362
+ this._signedTransactions.setList(
1363
+ this._nodeAccountIds.list.map((nodeId) =>
1364
+ this._makeSignedTransaction(nodeId),
1365
+ ),
1366
+ );
1367
+ }
1368
+
1369
+ /**
1370
+ * Build all the signed transactions from the node account IDs
1371
+ *
1372
+ * @internal
1373
+ */
1374
+ _buildIncompleteTransactions() {
1375
+ if (this._nodeAccountIds.length == 0) {
1376
+ this._transactions.setList([this._makeSignedTransaction(null)]);
1377
+ } else {
1378
+ // In case the node account ids are set
1379
+ this._transactions.setList(
1380
+ this._nodeAccountIds.list.map((nodeId) =>
1381
+ this._makeSignedTransaction(nodeId),
1382
+ ),
1383
+ );
1384
+ }
1385
+ }
1386
+
1387
+ /**
1388
+ * Freeze this transaction from future modification to prepare for
1389
+ * signing or serialization.
1390
+ *
1391
+ * @returns {this}
1392
+ */
1393
+ freeze() {
1394
+ return this.freezeWith(null);
1395
+ }
1396
+
1397
+ /**
1398
+ * @param {?AccountId} accountId
1399
+ */
1400
+ _freezeWithAccountId(accountId) {
1401
+ if (this._operatorAccountId == null) {
1402
+ this._operatorAccountId = accountId;
1403
+ }
1404
+ }
1405
+
1406
+ /**
1407
+ * Freeze this transaction from further modification to prepare for
1408
+ * signing or serialization.
1409
+ *
1410
+ * Will use the `Client`, if available, to generate a default Transaction ID and select 1/3
1411
+ * nodes to prepare this transaction for.
1412
+ *
1413
+ * @param {?import("../client/Client.js").default<Channel, *>} client
1414
+ * @returns {this}
1415
+ */
1416
+ freezeWith(client) {
1417
+ // Set sign on demand based on client
1418
+ this._signOnDemand = client != null ? client.signOnDemand : false;
1419
+
1420
+ // Save the operator
1421
+ this._operator = client != null ? client._operator : null;
1422
+ this._freezeWithAccountId(
1423
+ client != null ? client.operatorAccountId : null,
1424
+ );
1425
+
1426
+ // Set max transaction fee to either `this._maxTransactionFee`,
1427
+ // `client._defaultMaxTransactionFee`, or `this._defaultMaxTransactionFee`
1428
+ // in that priority order depending on if `this._maxTransactionFee` has
1429
+ // been set or if `client._defaultMaxTransactionFee` has been set.
1430
+ this._maxTransactionFee =
1431
+ this._maxTransactionFee == null
1432
+ ? client != null && client.defaultMaxTransactionFee != null
1433
+ ? client.defaultMaxTransactionFee
1434
+ : this._defaultMaxTransactionFee
1435
+ : this._maxTransactionFee;
1436
+
1437
+ // Determine if transaction ID generation should be enabled.
1438
+ this._regenerateTransactionId =
1439
+ client != null && this._regenerateTransactionId == null
1440
+ ? client.defaultRegenerateTransactionId
1441
+ : this._regenerateTransactionId;
1442
+
1443
+ // Set the node account IDs via client
1444
+ if (this.batchKey) {
1445
+ this._nodeAccountIds.setList([NODE_ACCOUNT_BATCH_ID]);
1446
+ } else {
1447
+ this._setNodeAccountIds(client);
1448
+ }
1449
+
1450
+ // Make sure a transaction ID or operator is set.
1451
+ this._setTransactionId();
1452
+
1453
+ // If a client was not provided, we need to make sure the transaction ID already set
1454
+ // validates aginst the client.
1455
+ if (client != null) {
1456
+ for (const transactionId of this._transactionIds.list) {
1457
+ if (transactionId.accountId != null) {
1458
+ transactionId.accountId.validateChecksum(client);
1459
+ }
1460
+ }
1461
+ }
1462
+
1463
+ // Build a list of transaction IDs so that if a user calls `.transactionId` they'll
1464
+ // get a value, but if they dont' we'll just regenerate transaction IDs during execution
1465
+ this._buildNewTransactionIdList();
1466
+
1467
+ // If sign on demand is disabled we need to build out all the signed transactions
1468
+ if (!this._signOnDemand) {
1469
+ this._buildSignedTransactions();
1470
+ }
1471
+
1472
+ return this;
1473
+ }
1474
+
1475
+ /**
1476
+ * Sign the transaction using a signer
1477
+ *
1478
+ * This is part of the signature provider feature
1479
+ *
1480
+ * @param {Signer} signer
1481
+ * @returns {Promise<this>}
1482
+ */
1483
+ async signWithSigner(signer) {
1484
+ await signer.signTransaction(this);
1485
+ return this;
1486
+ }
1487
+
1488
+ /**
1489
+ * Freeze the transaction using a signer
1490
+ *
1491
+ * This is part of the signature provider feature.
1492
+ *
1493
+ * @param {Signer} signer
1494
+ * @returns {Promise<this>}
1495
+ */
1496
+ async freezeWithSigner(signer) {
1497
+ await signer.populateTransaction(this);
1498
+ this.freeze();
1499
+ return this;
1500
+ }
1501
+
1502
+ /**
1503
+ * Serialize the request into bytes. This will encode all the transactions
1504
+ * into a `proto.TransactionList` and return the encoded protobuf.
1505
+ *
1506
+ * **NOTE**: Does not support sign on demand
1507
+ *
1508
+ * @returns {Uint8Array}
1509
+ */
1510
+ toBytes() {
1511
+ // Sign on demand must be disabled because this is the non-async version and
1512
+ // signing requires awaiting callbacks.
1513
+ this._requireNotSignOnDemand();
1514
+
1515
+ if (this._isFrozen()) {
1516
+ // Locking the transaction IDs and node account IDs is necessary for consistency
1517
+ // between before and after execution
1518
+ this._transactionIds.setLocked();
1519
+ this._nodeAccountIds.setLocked();
1520
+
1521
+ // Build all the transactions without signing
1522
+ this._buildAllTransactions();
1523
+ } else {
1524
+ this._buildIncompleteTransactions();
1525
+ }
1526
+
1527
+ // Construct and encode the transaction list
1528
+ return HieroProto.proto.TransactionList.encode({
1529
+ transactionList: /** @type {HieroProto.proto.ITransaction[]} */ (
1530
+ this._transactions.list
1531
+ ),
1532
+ }).finish();
1533
+ }
1534
+
1535
+ /**
1536
+ * Serialize the transaction into bytes
1537
+ *
1538
+ * **NOTE**: Supports sign on demand
1539
+ *
1540
+ * @returns {Promise<Uint8Array>}
1541
+ */
1542
+ async toBytesAsync() {
1543
+ // If sign on demand is enabled, we don't need to care about being frozen
1544
+ // since we can just regenerate and resign later if some field of the transaction
1545
+ // changes.
1546
+
1547
+ // Locking the transaction IDs and node account IDs is necessary for consistency
1548
+ // between before and after execution
1549
+ this._transactionIds.setLocked();
1550
+ this._nodeAccountIds.setLocked();
1551
+
1552
+ // Build all transactions, and sign them
1553
+ await this._buildAllTransactionsAsync();
1554
+
1555
+ // Lock transaction IDs, and node account IDs
1556
+ this._transactions.setLocked();
1557
+ this._signedTransactions.setLocked();
1558
+
1559
+ // Construct and encode the transaction list
1560
+ return HieroProto.proto.TransactionList.encode({
1561
+ transactionList: /** @type {HieroProto.proto.ITransaction[]} */ (
1562
+ this._transactions.list
1563
+ ),
1564
+ }).finish();
1565
+ }
1566
+
1567
+ /**
1568
+ * Get the transaction hash
1569
+ *
1570
+ * @returns {Promise<Uint8Array>}
1571
+ */
1572
+ async getTransactionHash() {
1573
+ this._requireFrozen();
1574
+
1575
+ // Locking the transaction IDs and node account IDs is necessary for consistency
1576
+ // between before and after execution
1577
+ this._transactionIds.setLocked();
1578
+ this._nodeAccountIds.setLocked();
1579
+
1580
+ await this._buildAllTransactionsAsync();
1581
+
1582
+ this._transactions.setLocked();
1583
+ this._signedTransactions.setLocked();
1584
+
1585
+ return sha384.digest(
1586
+ /** @type {Uint8Array} */ (
1587
+ /** @type {HieroProto.proto.ITransaction} */ (
1588
+ this._transactions.get(0)
1589
+ ).signedTransactionBytes
1590
+ ),
1591
+ );
1592
+ }
1593
+
1594
+ /**
1595
+ * Get all the transaction hashes
1596
+ *
1597
+ * @returns {Promise<TransactionHashMap>}
1598
+ */
1599
+ async getTransactionHashPerNode() {
1600
+ this._requireFrozen();
1601
+
1602
+ // Locking the transaction IDs and node account IDs is necessary for consistency
1603
+ // between before and after execution
1604
+ this._transactionIds.setLocked();
1605
+ this._nodeAccountIds.setLocked();
1606
+
1607
+ await this._buildAllTransactionsAsync();
1608
+
1609
+ return await TransactionHashMap._fromTransaction(this);
1610
+ }
1611
+
1612
+ /**
1613
+ * Is transaction frozen
1614
+ *
1615
+ * @returns {boolean}
1616
+ */
1617
+ isFrozen() {
1618
+ return this._signedTransactions.length > 0;
1619
+ }
1620
+
1621
+ /**
1622
+ * Get the current transaction ID, and make sure it's not null
1623
+ *
1624
+ * @protected
1625
+ * @returns {TransactionId}
1626
+ */
1627
+ _getTransactionId() {
1628
+ const transactionId = this.transactionId;
1629
+ if (transactionId == null) {
1630
+ throw new Error(
1631
+ "transaction must have been frozen before getting the transaction ID, try calling `freeze`",
1632
+ );
1633
+ }
1634
+ return transactionId;
1635
+ }
1636
+
1637
+ /**
1638
+ * @param {Client} client
1639
+ */
1640
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-function
1641
+ _validateChecksums(client) {
1642
+ // Do nothing
1643
+ }
1644
+
1645
+ /**
1646
+ * Before we proceed execution, we need to do a couple checks
1647
+ *
1648
+ * @override
1649
+ * @protected
1650
+ * @param {import("../client/Client.js").default<Channel, *>} client
1651
+ * @returns {Promise<void>}
1652
+ */
1653
+ async _beforeExecute(client) {
1654
+ // Assign the account IDs to which the transaction should be sent.
1655
+ this.transactionNodeIds = Object.values(client.network).map(
1656
+ (accountNodeId) => accountNodeId.toString(),
1657
+ );
1658
+
1659
+ if (this._logger) {
1660
+ this._logger.info(
1661
+ `Network used: ${client._network.networkName}`, // eslint-disable-line @typescript-eslint/restrict-template-expressions
1662
+ );
1663
+ }
1664
+
1665
+ // Make sure we're frozen
1666
+ if (!this._isFrozen()) {
1667
+ this.freezeWith(client);
1668
+ }
1669
+
1670
+ // Valid checksums if the option is enabled
1671
+ if (client.isAutoValidateChecksumsEnabled()) {
1672
+ this._validateChecksums(client);
1673
+ }
1674
+
1675
+ // Set the operator if the client has one and the current operator is nullish
1676
+ if (this._operator == null || this._operator == undefined) {
1677
+ this._operator = client != null ? client._operator : null;
1678
+ }
1679
+
1680
+ if (
1681
+ this._operatorAccountId == null ||
1682
+ this._operatorAccountId == undefined
1683
+ ) {
1684
+ this._operatorAccountId =
1685
+ client != null && client._operator != null
1686
+ ? client._operator.accountId
1687
+ : null;
1688
+ }
1689
+
1690
+ // If the client has an operator, sign this request with the operator
1691
+ if (this._operator != null) {
1692
+ await this.signWith(
1693
+ this._operator.publicKey,
1694
+ this._operator.transactionSigner,
1695
+ );
1696
+ }
1697
+ }
1698
+
1699
+ /**
1700
+ * Construct a protobuf transaction
1701
+ *
1702
+ * @override
1703
+ * @internal
1704
+ * @returns {Promise<HieroProto.proto.ITransaction>}
1705
+ */
1706
+ async _makeRequestAsync() {
1707
+ // The index for the transaction
1708
+ const index =
1709
+ this._transactionIds.index * this._nodeAccountIds.length +
1710
+ this._nodeAccountIds.index;
1711
+
1712
+ // If sign on demand is disabled we need to simply build that transaction
1713
+ // and return the result, without signing
1714
+ if (!this._signOnDemand && !this._isThrottled) {
1715
+ this._buildTransaction(index);
1716
+ return /** @type {HieroProto.proto.ITransaction} */ (
1717
+ this._transactions.get(index)
1718
+ );
1719
+ }
1720
+
1721
+ // Build and sign a transaction
1722
+ return await this._buildTransactionAsync();
1723
+ }
1724
+
1725
+ /**
1726
+ * Sign a `proto.SignedTransaction` with all the keys
1727
+ *
1728
+ * @private
1729
+ * @returns {Promise<HieroProto.proto.ISignedTransaction>}
1730
+ */
1731
+ async _signTransaction() {
1732
+ const signedTransaction = this._makeSignedTransaction(
1733
+ this._nodeAccountIds.next,
1734
+ );
1735
+
1736
+ const bodyBytes = /** @type {Uint8Array} */ (
1737
+ signedTransaction.bodyBytes
1738
+ );
1739
+
1740
+ for (let j = 0; j < this._publicKeys.length; j++) {
1741
+ const publicKey = this._publicKeys[j];
1742
+ const transactionSigner = this._transactionSigners[j];
1743
+
1744
+ if (transactionSigner == null) {
1745
+ continue;
1746
+ }
1747
+
1748
+ const signature = await transactionSigner(bodyBytes);
1749
+
1750
+ if (signedTransaction.sigMap == null) {
1751
+ signedTransaction.sigMap = {};
1752
+ }
1753
+
1754
+ if (signedTransaction.sigMap.sigPair == null) {
1755
+ signedTransaction.sigMap.sigPair = [];
1756
+ }
1757
+
1758
+ signedTransaction.sigMap.sigPair.push(
1759
+ publicKey._toProtobufSignature(signature),
1760
+ );
1761
+ }
1762
+
1763
+ return signedTransaction;
1764
+ }
1765
+
1766
+ /**
1767
+ * Construct a new transaction ID at the current index
1768
+ *
1769
+ * @private
1770
+ */
1771
+ _buildNewTransactionIdList() {
1772
+ if (this._transactionIds.locked || this._operatorAccountId == null) {
1773
+ return;
1774
+ }
1775
+
1776
+ const transactionId = TransactionId.withValidStart(
1777
+ this._operatorAccountId,
1778
+ Timestamp.generate(),
1779
+ );
1780
+
1781
+ this._transactionIds.set(this._transactionIds.index, transactionId);
1782
+ }
1783
+
1784
+ /**
1785
+ * Build each signed transaction in a loop
1786
+ *
1787
+ * @internal
1788
+ */
1789
+ _buildAllTransactions() {
1790
+ for (let i = 0; i < this._signedTransactions.length; i++) {
1791
+ this._buildTransaction(i);
1792
+ }
1793
+ }
1794
+
1795
+ /**
1796
+ * Build and and sign each transaction in a loop
1797
+ *
1798
+ * This method is primary used in the exist condition methods
1799
+ * which are not `execute()`, e.g. `toBytesAsync()` and `getSignaturesAsync()`
1800
+ *
1801
+ * @private
1802
+ */
1803
+ async _buildAllTransactionsAsync() {
1804
+ if (!this._signOnDemand) {
1805
+ this._buildAllTransactions();
1806
+ return;
1807
+ }
1808
+
1809
+ this._buildSignedTransactions();
1810
+
1811
+ if (this._transactions.locked) {
1812
+ return;
1813
+ }
1814
+
1815
+ for (let i = 0; i < this._signedTransactions.length; i++) {
1816
+ this._transactions.push(await this._buildTransactionAsync());
1817
+ }
1818
+ }
1819
+
1820
+ /**
1821
+ * Build a transaction at a particular index
1822
+ *
1823
+ * @internal
1824
+ * @param {number} index
1825
+ */
1826
+ _buildTransaction(index) {
1827
+ if (this._transactions.length < index) {
1828
+ for (let i = this._transactions.length; i < index; i++) {
1829
+ this._transactions.push(null);
1830
+ }
1831
+ }
1832
+
1833
+ // In case when an incomplete transaction is created, serialized and
1834
+ // deserialized,and then the transaction being frozen, the copy of the
1835
+ // incomplete transaction must be updated in order to be prepared for execution
1836
+ if (this._transactions.list[index] != null) {
1837
+ this._transactions.set(index, {
1838
+ signedTransactionBytes:
1839
+ HieroProto.proto.SignedTransaction.encode(
1840
+ this._signedTransactions.get(index),
1841
+ ).finish(),
1842
+ });
1843
+ }
1844
+
1845
+ this._transactions.setIfAbsent(index, () => {
1846
+ return {
1847
+ signedTransactionBytes:
1848
+ HieroProto.proto.SignedTransaction.encode(
1849
+ this._signedTransactions.get(index),
1850
+ ).finish(),
1851
+ };
1852
+ });
1853
+ }
1854
+
1855
+ /**
1856
+ * Build a trransaction using the current index, where the current
1857
+ * index is determined by `this._nodeAccountIds.index` and
1858
+ * `this._transactionIds.index`
1859
+ *
1860
+ * @private
1861
+ * @returns {Promise<HieroProto.proto.ITransaction>}
1862
+ */
1863
+ async _buildTransactionAsync() {
1864
+ return {
1865
+ signedTransactionBytes: HieroProto.proto.SignedTransaction.encode(
1866
+ await this._signTransaction(),
1867
+ ).finish(),
1868
+ };
1869
+ }
1870
+
1871
+ /**
1872
+ * Determine what execution state we're in.
1873
+ *
1874
+ * @override
1875
+ * @internal
1876
+ * @param {HieroProto.proto.ITransaction} request
1877
+ * @param {HieroProto.proto.ITransactionResponse} response
1878
+ * @returns {[Status, ExecutionState]}
1879
+ */
1880
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1881
+ _shouldRetry(request, response) {
1882
+ const { nodeTransactionPrecheckCode } = response;
1883
+
1884
+ // Get the node precheck code, and convert it into an SDK `Status`
1885
+ const status = Status._fromCode(
1886
+ nodeTransactionPrecheckCode != null
1887
+ ? nodeTransactionPrecheckCode
1888
+ : HieroProto.proto.ResponseCodeEnum.OK,
1889
+ );
1890
+
1891
+ if (this._logger) {
1892
+ this._logger.debug(
1893
+ `[${this._getLogId()}] received status ${status.toString()}`,
1894
+ );
1895
+ this._logger.info(
1896
+ `SDK Transaction Status Response: ${status.toString()}`,
1897
+ );
1898
+ }
1899
+
1900
+ // Based on the status what execution state are we in
1901
+ switch (status) {
1902
+ case Status.Busy:
1903
+ case Status.Unknown:
1904
+ case Status.PlatformTransactionNotCreated:
1905
+ case Status.PlatformNotActive:
1906
+ return [status, ExecutionState.Retry];
1907
+ case Status.Ok:
1908
+ return [status, ExecutionState.Finished];
1909
+ case Status.TransactionExpired:
1910
+ if (
1911
+ this._transactionIds.locked ||
1912
+ (this._regenerateTransactionId != null &&
1913
+ !this._regenerateTransactionId)
1914
+ ) {
1915
+ return [status, ExecutionState.Error];
1916
+ } else {
1917
+ this._buildNewTransactionIdList();
1918
+ return [status, ExecutionState.Retry];
1919
+ }
1920
+ default:
1921
+ return [status, ExecutionState.Error];
1922
+ }
1923
+ }
1924
+
1925
+ /**
1926
+ * Map the request and response into a precheck status error
1927
+ *
1928
+ * @override
1929
+ * @internal
1930
+ * @param {HieroProto.proto.ITransaction} request
1931
+ * @param {HieroProto.proto.ITransactionResponse} response
1932
+ * @param {AccountId} nodeId
1933
+ * @returns {Error}
1934
+ */
1935
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
1936
+ _mapStatusError(request, response, nodeId) {
1937
+ const { nodeTransactionPrecheckCode } = response;
1938
+
1939
+ const status = Status._fromCode(
1940
+ nodeTransactionPrecheckCode != null
1941
+ ? nodeTransactionPrecheckCode
1942
+ : HieroProto.proto.ResponseCodeEnum.OK,
1943
+ );
1944
+ if (this._logger) {
1945
+ this._logger.info(
1946
+ // @ts-ignore
1947
+ `Transaction Error Info: ${status.toString()}, ${this.transactionId.toString()}`, // eslint-disable-line @typescript-eslint/restrict-template-expressions
1948
+ );
1949
+ }
1950
+
1951
+ return new PrecheckStatusError({
1952
+ nodeId,
1953
+ status,
1954
+ transactionId: this._getTransactionId(),
1955
+ contractFunctionResult: null,
1956
+ });
1957
+ }
1958
+
1959
+ /**
1960
+ * Map the request, response, and node account ID into a `TransactionResponse`
1961
+ *
1962
+ * @override
1963
+ * @protected
1964
+ * @param {HieroProto.proto.ITransactionResponse} response
1965
+ * @param {AccountId} nodeId
1966
+ * @param {HieroProto.proto.ITransaction} request
1967
+ * @returns {Promise<TransactionResponse>}
1968
+ */
1969
+ async _mapResponse(response, nodeId, request) {
1970
+ const transactionHash = await sha384.digest(
1971
+ /** @type {Uint8Array} */ (request.signedTransactionBytes),
1972
+ );
1973
+ const transactionId = this._getTransactionId();
1974
+
1975
+ this._transactionIds.advance();
1976
+ if (this._logger) {
1977
+ this._logger.info(
1978
+ `Transaction Info: ${JSON.stringify(
1979
+ new TransactionResponse({
1980
+ nodeId,
1981
+ transactionHash,
1982
+ transactionId,
1983
+ logger: this._logger,
1984
+ }).toJSON(),
1985
+ )}`,
1986
+ );
1987
+ }
1988
+
1989
+ return new TransactionResponse({
1990
+ nodeId,
1991
+ transactionHash,
1992
+ transactionId,
1993
+ transaction: this,
1994
+ logger: this._logger,
1995
+ });
1996
+ }
1997
+
1998
+ /**
1999
+ * Make a signed transaction given a node account ID
2000
+ *
2001
+ * @internal
2002
+ * @param {?AccountId} nodeId
2003
+ * @returns {HieroProto.proto.ISignedTransaction}
2004
+ */
2005
+ _makeSignedTransaction(nodeId) {
2006
+ const body = this._makeTransactionBody(nodeId);
2007
+ if (this._logger) {
2008
+ this._logger.info(`Transaction Body: ${JSON.stringify(body)}`);
2009
+ }
2010
+ const bodyBytes =
2011
+ HieroProto.proto.TransactionBody.encode(body).finish();
2012
+
2013
+ return {
2014
+ sigMap: {
2015
+ sigPair: [],
2016
+ },
2017
+ bodyBytes,
2018
+ };
2019
+ }
2020
+
2021
+ /**
2022
+ * @override
2023
+ * @returns {boolean}
2024
+ */
2025
+ isBatchedAndNotBatchTransaction() {
2026
+ return (
2027
+ this.batchKey != null &&
2028
+ this._getTransactionDataCase() != "atomicBatch"
2029
+ );
2030
+ }
2031
+
2032
+ /**
2033
+ * Make a protobuf transaction body
2034
+ *
2035
+ * @private
2036
+ * @param {?AccountId} nodeId
2037
+ * @returns {HieroProto.proto.ITransactionBody}
2038
+ */
2039
+ _makeTransactionBody(nodeId) {
2040
+ return {
2041
+ [this._getTransactionDataCase()]: this._makeTransactionData(),
2042
+ transactionFee:
2043
+ this._maxTransactionFee != null
2044
+ ? this._maxTransactionFee.toTinybars()
2045
+ : null,
2046
+ memo: this._transactionMemo,
2047
+ transactionID:
2048
+ this._transactionIds.current != null
2049
+ ? this._transactionIds.current._toProtobuf()
2050
+ : null,
2051
+ nodeAccountID: nodeId != null ? nodeId._toProtobuf() : null,
2052
+ transactionValidDuration: {
2053
+ seconds: Long.fromNumber(this._transactionValidDuration),
2054
+ },
2055
+ maxCustomFees:
2056
+ this._customFeeLimits != null
2057
+ ? this._customFeeLimits.map((maxCustomFee) =>
2058
+ maxCustomFee._toProtobuf(),
2059
+ )
2060
+ : null,
2061
+ batchKey: this.batchKey?._toProtobufKey(),
2062
+ };
2063
+ }
2064
+
2065
+ /**
2066
+ * This method returns a key for the `data` field in a transaction body.
2067
+ * Each transaction overwrite this to make sure when we build the transaction body
2068
+ * we set the right data field.
2069
+ *
2070
+ * @abstract
2071
+ * @protected
2072
+ * @returns {NonNullable<HieroProto.proto.TransactionBody["data"]>}
2073
+ */
2074
+ _getTransactionDataCase() {
2075
+ throw new Error("not implemented");
2076
+ }
2077
+
2078
+ /**
2079
+ * Make a scheduled transaction body
2080
+ * FIXME: Should really call this `makeScheduledTransactionBody` to be consistent
2081
+ *
2082
+ * @internal
2083
+ * @returns {HieroProto.proto.ISchedulableTransactionBody}
2084
+ */
2085
+ _getScheduledTransactionBody() {
2086
+ return {
2087
+ memo: this.transactionMemo,
2088
+ transactionFee:
2089
+ this._maxTransactionFee == null
2090
+ ? this._defaultMaxTransactionFee.toTinybars()
2091
+ : this._maxTransactionFee.toTinybars(),
2092
+ [this._getTransactionDataCase()]: this._makeTransactionData(),
2093
+ };
2094
+ }
2095
+
2096
+ /**
2097
+ * Make the transaction body data.
2098
+ *
2099
+ * @abstract
2100
+ * @protected
2101
+ * @returns {object}
2102
+ */
2103
+ _makeTransactionData() {
2104
+ throw new Error("not implemented");
2105
+ }
2106
+
2107
+ /**
2108
+ * FIXME: Why do we have `isFrozen` and `_isFrozen()`?
2109
+ *
2110
+ * @protected
2111
+ * @returns {boolean}
2112
+ */
2113
+ _isFrozen() {
2114
+ return this._signOnDemand || this._signedTransactions.length > 0;
2115
+ }
2116
+
2117
+ /**
2118
+ * Require the transaction to NOT be frozen
2119
+ *
2120
+ * @internal
2121
+ */
2122
+ _requireNotFrozen() {
2123
+ if (this._isFrozen()) {
2124
+ throw new Error(
2125
+ "transaction is immutable; it has at least one signature or has been explicitly frozen",
2126
+ );
2127
+ }
2128
+ }
2129
+
2130
+ /**
2131
+ * Require the transaction to have sign on demand disabled
2132
+ *
2133
+ * @internal
2134
+ */
2135
+ _requireNotSignOnDemand() {
2136
+ if (this._signOnDemand) {
2137
+ throw new Error(
2138
+ "Please use `toBytesAsync()` if `signOnDemand` is enabled",
2139
+ );
2140
+ }
2141
+ }
2142
+
2143
+ /**
2144
+ * Require the transaction to be frozen
2145
+ *
2146
+ * @internal
2147
+ */
2148
+ _requireFrozen() {
2149
+ if (!this._isFrozen()) {
2150
+ throw new Error(
2151
+ "transaction must have been frozen before calculating the hash will be stable, try calling `freeze`",
2152
+ );
2153
+ }
2154
+ }
2155
+
2156
+ /**
2157
+ * Require the transaction to have a single node account ID set
2158
+ *
2159
+ * @internal
2160
+ * @protected
2161
+ */
2162
+ _requireOneNodeAccountId() {
2163
+ if (this._nodeAccountIds.length != 1) {
2164
+ throw "transaction did not have exactly one node ID set";
2165
+ }
2166
+ }
2167
+
2168
+ /**
2169
+ * @param {HieroProto.proto.Transaction} request
2170
+ * @returns {Uint8Array}
2171
+ */
2172
+ _requestToBytes(request) {
2173
+ return HieroProto.proto.Transaction.encode(request).finish();
2174
+ }
2175
+
2176
+ /**
2177
+ * @param {HieroProto.proto.TransactionResponse} response
2178
+ * @returns {Uint8Array}
2179
+ */
2180
+ _responseToBytes(response) {
2181
+ return HieroProto.proto.TransactionResponse.encode(response).finish();
2182
+ }
2183
+
2184
+ /**
2185
+ * Removes all signatures from a transaction and collects the removed signatures.
2186
+ *
2187
+ * @param {HieroProto.proto.ISignedTransaction} transaction - The transaction object to process.
2188
+ * @param {string} publicKeyHex - The hexadecimal representation of the public key.
2189
+ * @returns {Uint8Array[]} An array of removed signatures.
2190
+ */
2191
+ _removeSignaturesFromTransaction(transaction, publicKeyHex) {
2192
+ /** @type {Uint8Array[]} */
2193
+ const removedSignatures = [];
2194
+
2195
+ if (!transaction.sigMap || !transaction.sigMap.sigPair) {
2196
+ return [];
2197
+ }
2198
+
2199
+ transaction.sigMap.sigPair = transaction.sigMap.sigPair.filter(
2200
+ (sigPair) => {
2201
+ const shouldRemove = this._shouldRemoveSignature(
2202
+ sigPair,
2203
+ publicKeyHex,
2204
+ );
2205
+ const signature = sigPair.ed25519 ?? sigPair.ECDSASecp256k1;
2206
+
2207
+ if (shouldRemove && signature) {
2208
+ removedSignatures.push(signature);
2209
+ }
2210
+
2211
+ return !shouldRemove;
2212
+ },
2213
+ );
2214
+
2215
+ return removedSignatures;
2216
+ }
2217
+
2218
+ /**
2219
+ * Determines whether a signature should be removed based on the provided public key.
2220
+ *
2221
+ * @param {HieroProto.proto.ISignaturePair} sigPair - The signature pair object that contains
2222
+ * the public key prefix and signature to be evaluated.
2223
+ * @param {string} publicKeyHex - The hexadecimal representation of the public key to compare against.
2224
+ * @returns {boolean} `true` if the public key prefix in the signature pair matches the provided public key,
2225
+ * indicating that the signature should be removed; otherwise, `false`.
2226
+ */
2227
+ _shouldRemoveSignature = (sigPair, publicKeyHex) => {
2228
+ const sigPairPublicKeyHex = hex.encode(
2229
+ sigPair?.pubKeyPrefix || new Uint8Array(),
2230
+ );
2231
+
2232
+ const matchesPublicKey = sigPairPublicKeyHex === publicKeyHex;
2233
+
2234
+ return matchesPublicKey;
2235
+ };
2236
+
2237
+ /**
2238
+ * Collects all signatures from signed transactions and returns them in a format keyed by PublicKey.
2239
+ *
2240
+ * @returns { Map<PublicKey, Uint8Array[]> } The collected signatures keyed by PublicKey.
2241
+ */
2242
+ _collectSignaturesByPublicKey() {
2243
+ /** @type { Map<PublicKey, Uint8Array[]>} */
2244
+ const collectedSignatures = new Map();
2245
+ /** @type { Record<string, PublicKey> } */
2246
+ const publicKeyMap = {}; // Map to hold string representation of the PublicKey object
2247
+
2248
+ // Iterate over the signed transactions and collect signatures
2249
+ for (const transaction of this._signedTransactions.list) {
2250
+ if (!(transaction.sigMap && transaction.sigMap.sigPair)) {
2251
+ return new Map();
2252
+ }
2253
+
2254
+ // Collect the signatures
2255
+ for (const sigPair of transaction.sigMap.sigPair) {
2256
+ const signature = sigPair.ed25519 ?? sigPair.ECDSASecp256k1;
2257
+
2258
+ if (!signature || !sigPair.pubKeyPrefix) {
2259
+ return new Map();
2260
+ }
2261
+
2262
+ const publicKeyStr = hex.encode(sigPair.pubKeyPrefix);
2263
+ let publicKeyObj = publicKeyMap[publicKeyStr];
2264
+
2265
+ // If the PublicKey instance for this string representation doesn't exist, create and store it
2266
+ if (!publicKeyObj) {
2267
+ publicKeyObj = PublicKey.fromString(publicKeyStr);
2268
+ publicKeyMap[publicKeyStr] = publicKeyObj;
2269
+ }
2270
+
2271
+ // Initialize the structure for this publicKey if it doesn't exist
2272
+ if (!collectedSignatures.has(publicKeyObj)) {
2273
+ collectedSignatures.set(publicKeyObj, []);
2274
+ }
2275
+
2276
+ const existingSignatures =
2277
+ collectedSignatures.get(publicKeyObj);
2278
+
2279
+ // Add the signature to the corresponding public key
2280
+ if (existingSignatures) {
2281
+ existingSignatures.push(signature);
2282
+ }
2283
+ }
2284
+ }
2285
+
2286
+ return collectedSignatures;
2287
+ }
2288
+ }
2289
+
2290
+ /**
2291
+ * This is essentially a registry/cache for a callback that creates a `ScheduleCreateTransaction`
2292
+ *
2293
+ * @type {(() => ScheduleCreateTransaction)[]}
2294
+ */
2295
+ export const SCHEDULE_CREATE_TRANSACTION = [];