@hashgraphonline/standards-sdk 0.1.141-canary.9 → 0.1.141-feat-hcs-21-flora-adapter.canary.b569177.46

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 (261) hide show
  1. package/README.md +13 -1
  2. package/dist/cjs/hcs-16/base-client.d.ts.map +1 -1
  3. package/dist/cjs/hcs-17/types.d.ts.map +1 -1
  4. package/dist/cjs/hcs-20/sdk.d.ts.map +1 -1
  5. package/dist/cjs/hcs-20/types.d.ts +9 -8
  6. package/dist/cjs/hcs-20/types.d.ts.map +1 -1
  7. package/dist/cjs/hcs-21/base-client.d.ts +5 -3
  8. package/dist/cjs/hcs-21/base-client.d.ts.map +1 -1
  9. package/dist/cjs/hcs-21/browser.d.ts +17 -7
  10. package/dist/cjs/hcs-21/browser.d.ts.map +1 -1
  11. package/dist/cjs/hcs-21/index.d.ts +1 -0
  12. package/dist/cjs/hcs-21/index.d.ts.map +1 -1
  13. package/dist/cjs/hcs-21/sdk.d.ts +62 -0
  14. package/dist/cjs/hcs-21/sdk.d.ts.map +1 -1
  15. package/dist/cjs/hcs-21/tx.d.ts.map +1 -1
  16. package/dist/cjs/hcs-21/types.d.ts +146 -65
  17. package/dist/cjs/hcs-21/types.d.ts.map +1 -1
  18. package/dist/cjs/hcs-21/verify.d.ts +6 -0
  19. package/dist/cjs/hcs-21/verify.d.ts.map +1 -0
  20. package/dist/cjs/inscribe/inscriber.d.ts +1 -0
  21. package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
  22. package/dist/cjs/inscribe/quote-cache.d.ts.map +1 -1
  23. package/dist/cjs/services/registry-broker/client.d.ts +4 -3
  24. package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
  25. package/dist/cjs/services/registry-broker/private-key-signer.d.ts.map +1 -1
  26. package/dist/cjs/services/registry-broker/schemas.d.ts +16 -16
  27. package/dist/cjs/services/types.d.ts +1 -0
  28. package/dist/cjs/services/types.d.ts.map +1 -1
  29. package/dist/cjs/standards-sdk.cjs +2 -2
  30. package/dist/cjs/standards-sdk.cjs.map +1 -1
  31. package/dist/cjs/utils/dynamic-import.d.ts +1 -0
  32. package/dist/cjs/utils/dynamic-import.d.ts.map +1 -1
  33. package/dist/es/hcs-16/base-client.d.ts.map +1 -1
  34. package/dist/es/hcs-17/types.d.ts.map +1 -1
  35. package/dist/es/hcs-20/sdk.d.ts.map +1 -1
  36. package/dist/es/hcs-20/types.d.ts +9 -8
  37. package/dist/es/hcs-20/types.d.ts.map +1 -1
  38. package/dist/es/hcs-21/base-client.d.ts +5 -3
  39. package/dist/es/hcs-21/base-client.d.ts.map +1 -1
  40. package/dist/es/hcs-21/browser.d.ts +17 -7
  41. package/dist/es/hcs-21/browser.d.ts.map +1 -1
  42. package/dist/es/hcs-21/index.d.ts +1 -0
  43. package/dist/es/hcs-21/index.d.ts.map +1 -1
  44. package/dist/es/hcs-21/sdk.d.ts +62 -0
  45. package/dist/es/hcs-21/sdk.d.ts.map +1 -1
  46. package/dist/es/hcs-21/tx.d.ts.map +1 -1
  47. package/dist/es/hcs-21/types.d.ts +146 -65
  48. package/dist/es/hcs-21/types.d.ts.map +1 -1
  49. package/dist/es/hcs-21/verify.d.ts +6 -0
  50. package/dist/es/hcs-21/verify.d.ts.map +1 -0
  51. package/dist/es/inscribe/inscriber.d.ts +1 -0
  52. package/dist/es/inscribe/inscriber.d.ts.map +1 -1
  53. package/dist/es/inscribe/quote-cache.d.ts.map +1 -1
  54. package/dist/es/services/registry-broker/client.d.ts +4 -3
  55. package/dist/es/services/registry-broker/client.d.ts.map +1 -1
  56. package/dist/es/services/registry-broker/private-key-signer.d.ts.map +1 -1
  57. package/dist/es/services/registry-broker/schemas.d.ts +16 -16
  58. package/dist/es/services/types.d.ts +1 -0
  59. package/dist/es/services/types.d.ts.map +1 -1
  60. package/dist/es/standards-sdk.es.js +58 -50
  61. package/dist/es/standards-sdk.es.js.map +1 -1
  62. package/dist/es/standards-sdk.es10.js +2 -2
  63. package/dist/es/standards-sdk.es100.js +26 -229
  64. package/dist/es/standards-sdk.es100.js.map +1 -1
  65. package/dist/es/standards-sdk.es101.js +228 -109
  66. package/dist/es/standards-sdk.es101.js.map +1 -1
  67. package/dist/es/standards-sdk.es102.js +94 -15
  68. package/dist/es/standards-sdk.es102.js.map +1 -1
  69. package/dist/es/standards-sdk.es103.js +30 -80
  70. package/dist/es/standards-sdk.es103.js.map +1 -1
  71. package/dist/es/standards-sdk.es104.js +80 -27
  72. package/dist/es/standards-sdk.es104.js.map +1 -1
  73. package/dist/es/standards-sdk.es105.js +25 -136
  74. package/dist/es/standards-sdk.es105.js.map +1 -1
  75. package/dist/es/standards-sdk.es106.js +140 -27
  76. package/dist/es/standards-sdk.es106.js.map +1 -1
  77. package/dist/es/standards-sdk.es107.js +27 -20
  78. package/dist/es/standards-sdk.es107.js.map +1 -1
  79. package/dist/es/standards-sdk.es108.js +18 -156
  80. package/dist/es/standards-sdk.es108.js.map +1 -1
  81. package/dist/es/standards-sdk.es109.js +148 -196
  82. package/dist/es/standards-sdk.es109.js.map +1 -1
  83. package/dist/es/standards-sdk.es110.js +160 -747
  84. package/dist/es/standards-sdk.es110.js.map +1 -1
  85. package/dist/es/standards-sdk.es111.js +786 -9
  86. package/dist/es/standards-sdk.es111.js.map +1 -1
  87. package/dist/es/standards-sdk.es112.js +13 -567
  88. package/dist/es/standards-sdk.es112.js.map +1 -1
  89. package/dist/es/standards-sdk.es113.js +541 -576
  90. package/dist/es/standards-sdk.es113.js.map +1 -1
  91. package/dist/es/standards-sdk.es114.js +601 -12
  92. package/dist/es/standards-sdk.es114.js.map +1 -1
  93. package/dist/es/standards-sdk.es115.js +13 -2
  94. package/dist/es/standards-sdk.es115.js.map +1 -1
  95. package/dist/es/standards-sdk.es116.js +2 -83
  96. package/dist/es/standards-sdk.es116.js.map +1 -1
  97. package/dist/es/standards-sdk.es117.js +80 -36
  98. package/dist/es/standards-sdk.es117.js.map +1 -1
  99. package/dist/es/standards-sdk.es118.js +39 -2
  100. package/dist/es/standards-sdk.es118.js.map +1 -1
  101. package/dist/es/standards-sdk.es119.js +2 -223
  102. package/dist/es/standards-sdk.es119.js.map +1 -1
  103. package/dist/es/standards-sdk.es12.js +1 -1
  104. package/dist/es/standards-sdk.es120.js +193 -1110
  105. package/dist/es/standards-sdk.es120.js.map +1 -1
  106. package/dist/es/standards-sdk.es121.js +1059 -225
  107. package/dist/es/standards-sdk.es121.js.map +1 -1
  108. package/dist/es/standards-sdk.es122.js +303 -419
  109. package/dist/es/standards-sdk.es122.js.map +1 -1
  110. package/dist/es/standards-sdk.es123.js +418 -351
  111. package/dist/es/standards-sdk.es123.js.map +1 -1
  112. package/dist/es/standards-sdk.es124.js +348 -785
  113. package/dist/es/standards-sdk.es124.js.map +1 -1
  114. package/dist/es/standards-sdk.es125.js +767 -183
  115. package/dist/es/standards-sdk.es125.js.map +1 -1
  116. package/dist/es/standards-sdk.es126.js +153 -1512
  117. package/dist/es/standards-sdk.es126.js.map +1 -1
  118. package/dist/es/standards-sdk.es127.js +1373 -1987
  119. package/dist/es/standards-sdk.es127.js.map +1 -1
  120. package/dist/es/standards-sdk.es128.js +2208 -67
  121. package/dist/es/standards-sdk.es128.js.map +1 -1
  122. package/dist/es/standards-sdk.es129.js +59 -79
  123. package/dist/es/standards-sdk.es129.js.map +1 -1
  124. package/dist/es/standards-sdk.es13.js +1 -1
  125. package/dist/es/standards-sdk.es130.js +80 -152
  126. package/dist/es/standards-sdk.es130.js.map +1 -1
  127. package/dist/es/standards-sdk.es131.js +159 -7
  128. package/dist/es/standards-sdk.es131.js.map +1 -1
  129. package/dist/es/standards-sdk.es132.js +7 -86
  130. package/dist/es/standards-sdk.es132.js.map +1 -1
  131. package/dist/es/standards-sdk.es133.js +65 -44
  132. package/dist/es/standards-sdk.es133.js.map +1 -1
  133. package/dist/es/standards-sdk.es134.js +65 -28
  134. package/dist/es/standards-sdk.es134.js.map +1 -1
  135. package/dist/es/standards-sdk.es135.js +69 -125
  136. package/dist/es/standards-sdk.es135.js.map +1 -1
  137. package/dist/es/standards-sdk.es136.js +28 -42
  138. package/dist/es/standards-sdk.es136.js.map +1 -1
  139. package/dist/es/standards-sdk.es137.js +132 -50
  140. package/dist/es/standards-sdk.es137.js.map +1 -1
  141. package/dist/es/standards-sdk.es138.js +36 -58
  142. package/dist/es/standards-sdk.es138.js.map +1 -1
  143. package/dist/es/standards-sdk.es139.js +12254 -746
  144. package/dist/es/standards-sdk.es139.js.map +1 -1
  145. package/dist/es/standards-sdk.es14.js +1 -1
  146. package/dist/es/standards-sdk.es140.js +746 -12254
  147. package/dist/es/standards-sdk.es140.js.map +1 -1
  148. package/dist/es/standards-sdk.es141.js +13 -168
  149. package/dist/es/standards-sdk.es141.js.map +1 -1
  150. package/dist/es/standards-sdk.es142.js +139 -289
  151. package/dist/es/standards-sdk.es142.js.map +1 -1
  152. package/dist/es/standards-sdk.es143.js +274 -298
  153. package/dist/es/standards-sdk.es143.js.map +1 -1
  154. package/dist/es/standards-sdk.es144.js +262 -369
  155. package/dist/es/standards-sdk.es144.js.map +1 -1
  156. package/dist/es/standards-sdk.es145.js +316 -194
  157. package/dist/es/standards-sdk.es145.js.map +1 -1
  158. package/dist/es/standards-sdk.es146.js +319 -64
  159. package/dist/es/standards-sdk.es146.js.map +1 -1
  160. package/dist/es/standards-sdk.es147.js +74 -15
  161. package/dist/es/standards-sdk.es147.js.map +1 -1
  162. package/dist/es/standards-sdk.es148.js +59 -0
  163. package/dist/es/standards-sdk.es148.js.map +1 -0
  164. package/dist/es/standards-sdk.es15.js +1 -1
  165. package/dist/es/standards-sdk.es16.js +1 -1
  166. package/dist/es/standards-sdk.es17.js +5 -11
  167. package/dist/es/standards-sdk.es17.js.map +1 -1
  168. package/dist/es/standards-sdk.es19.js +12 -17
  169. package/dist/es/standards-sdk.es19.js.map +1 -1
  170. package/dist/es/standards-sdk.es2.js +26 -72
  171. package/dist/es/standards-sdk.es2.js.map +1 -1
  172. package/dist/es/standards-sdk.es20.js +9 -14
  173. package/dist/es/standards-sdk.es20.js.map +1 -1
  174. package/dist/es/standards-sdk.es21.js +1 -1
  175. package/dist/es/standards-sdk.es22.js +1 -1
  176. package/dist/es/standards-sdk.es23.js +1 -1
  177. package/dist/es/standards-sdk.es24.js +1 -1
  178. package/dist/es/standards-sdk.es25.js +1 -1
  179. package/dist/es/standards-sdk.es26.js +1 -1
  180. package/dist/es/standards-sdk.es27.js +1 -1
  181. package/dist/es/standards-sdk.es28.js +12 -17
  182. package/dist/es/standards-sdk.es28.js.map +1 -1
  183. package/dist/es/standards-sdk.es3.js +2 -2
  184. package/dist/es/standards-sdk.es31.js +2 -2
  185. package/dist/es/standards-sdk.es32.js +4 -4
  186. package/dist/es/standards-sdk.es33.js +1 -1
  187. package/dist/es/standards-sdk.es36.js +6 -12
  188. package/dist/es/standards-sdk.es36.js.map +1 -1
  189. package/dist/es/standards-sdk.es37.js +4 -4
  190. package/dist/es/standards-sdk.es38.js +2 -2
  191. package/dist/es/standards-sdk.es39.js +2 -2
  192. package/dist/es/standards-sdk.es40.js +1 -1
  193. package/dist/es/standards-sdk.es41.js +1 -1
  194. package/dist/es/standards-sdk.es42.js +2 -2
  195. package/dist/es/standards-sdk.es47.js +1 -1
  196. package/dist/es/standards-sdk.es5.js +2 -2
  197. package/dist/es/standards-sdk.es52.js +1 -1
  198. package/dist/es/standards-sdk.es54.js +1 -1
  199. package/dist/es/standards-sdk.es57.js +2 -2
  200. package/dist/es/standards-sdk.es59.js +1 -1
  201. package/dist/es/standards-sdk.es6.js +2 -2
  202. package/dist/es/standards-sdk.es60.js +1 -1
  203. package/dist/es/standards-sdk.es61.js +7 -12
  204. package/dist/es/standards-sdk.es61.js.map +1 -1
  205. package/dist/es/standards-sdk.es63.js +1 -1
  206. package/dist/es/standards-sdk.es65.js +2 -2
  207. package/dist/es/standards-sdk.es66.js +3 -3
  208. package/dist/es/standards-sdk.es69.js +2 -2
  209. package/dist/es/standards-sdk.es7.js +2 -2
  210. package/dist/es/standards-sdk.es70.js +3 -3
  211. package/dist/es/standards-sdk.es71.js +2 -2
  212. package/dist/es/standards-sdk.es72.js +1 -1
  213. package/dist/es/standards-sdk.es73.js.map +1 -1
  214. package/dist/es/standards-sdk.es75.js +2 -2
  215. package/dist/es/standards-sdk.es77.js +5 -3
  216. package/dist/es/standards-sdk.es77.js.map +1 -1
  217. package/dist/es/standards-sdk.es78.js +4 -10
  218. package/dist/es/standards-sdk.es78.js.map +1 -1
  219. package/dist/es/standards-sdk.es79.js +1 -1
  220. package/dist/es/standards-sdk.es8.js +1 -1
  221. package/dist/es/standards-sdk.es80.js +27 -15
  222. package/dist/es/standards-sdk.es80.js.map +1 -1
  223. package/dist/es/standards-sdk.es82.js +12 -4
  224. package/dist/es/standards-sdk.es82.js.map +1 -1
  225. package/dist/es/standards-sdk.es83.js +31 -6
  226. package/dist/es/standards-sdk.es83.js.map +1 -1
  227. package/dist/es/standards-sdk.es84.js +179 -6
  228. package/dist/es/standards-sdk.es84.js.map +1 -1
  229. package/dist/es/standards-sdk.es85.js +258 -9
  230. package/dist/es/standards-sdk.es85.js.map +1 -1
  231. package/dist/es/standards-sdk.es86.js +55 -21
  232. package/dist/es/standards-sdk.es86.js.map +1 -1
  233. package/dist/es/standards-sdk.es87.js +22 -75
  234. package/dist/es/standards-sdk.es87.js.map +1 -1
  235. package/dist/es/standards-sdk.es88.js +45 -30
  236. package/dist/es/standards-sdk.es88.js.map +1 -1
  237. package/dist/es/standards-sdk.es89.js +57 -22
  238. package/dist/es/standards-sdk.es89.js.map +1 -1
  239. package/dist/es/standards-sdk.es90.js +28 -23
  240. package/dist/es/standards-sdk.es90.js.map +1 -1
  241. package/dist/es/standards-sdk.es91.js +23 -167
  242. package/dist/es/standards-sdk.es91.js.map +1 -1
  243. package/dist/es/standards-sdk.es92.js +158 -119
  244. package/dist/es/standards-sdk.es92.js.map +1 -1
  245. package/dist/es/standards-sdk.es93.js +68 -95
  246. package/dist/es/standards-sdk.es93.js.map +1 -1
  247. package/dist/es/standards-sdk.es94.js +136 -119
  248. package/dist/es/standards-sdk.es94.js.map +1 -1
  249. package/dist/es/standards-sdk.es95.js +139 -39
  250. package/dist/es/standards-sdk.es95.js.map +1 -1
  251. package/dist/es/standards-sdk.es96.js +42 -257
  252. package/dist/es/standards-sdk.es96.js.map +1 -1
  253. package/dist/es/standards-sdk.es97.js +243 -80
  254. package/dist/es/standards-sdk.es97.js.map +1 -1
  255. package/dist/es/standards-sdk.es98.js +47 -48
  256. package/dist/es/standards-sdk.es98.js.map +1 -1
  257. package/dist/es/standards-sdk.es99.js +100 -28
  258. package/dist/es/standards-sdk.es99.js.map +1 -1
  259. package/dist/es/utils/dynamic-import.d.ts +1 -0
  260. package/dist/es/utils/dynamic-import.d.ts.map +1 -1
  261. package/package.json +63 -65
@@ -1,12 +1,13 @@
1
1
  import { proto } from "@hashgraph/proto";
2
- import { Long, FileId, ContractId } from "@hashgraph/sdk";
3
- import { hasTransactionType } from "./standards-sdk.es146.js";
4
- class UtilParser {
2
+ import { Long, Hbar, HbarUnit, ContractId, AccountId, FileId } from "@hashgraph/sdk";
3
+ import { Buffer } from "buffer";
4
+ import { hasTransactionType, parseKey } from "./standards-sdk.es147.js";
5
+ class SCSParser {
5
6
  /**
6
- * Parse Utility/System Service transaction using unified dual-branch approach
7
+ * Parse Smart Contract Service transaction using unified dual-branch approach
7
8
  * This handles both regular transactions and signed transaction variants
8
9
  */
9
- static parseUtilTransaction(transaction, originalBytes) {
10
+ static parseSCSTransaction(transaction, originalBytes) {
10
11
  try {
11
12
  if (originalBytes || transaction.toBytes) {
12
13
  try {
@@ -39,157 +40,179 @@ class UtilParser {
39
40
  } catch (error) {
40
41
  return {
41
42
  type: "UNKNOWN",
42
- humanReadableType: "Unknown Utility Transaction"
43
+ humanReadableType: "Unknown Contract Transaction"
43
44
  };
44
45
  }
45
46
  }
46
47
  /**
47
- * Parse utility transaction from protobuf TransactionBody
48
- * Handles all utility operations from decoded protobuf data
48
+ * Parse contract transaction from protobuf TransactionBody
49
+ * Handles all contract operations from decoded protobuf data
49
50
  */
50
51
  static parseFromProtobufTxBody(txBody) {
51
- if (txBody.utilPrng) {
52
- const utilPrng = this.parseUtilPrng(txBody.utilPrng);
53
- if (utilPrng) {
52
+ if (txBody.contractCall) {
53
+ const contractCall = this.parseContractCall(txBody.contractCall);
54
+ if (contractCall) {
54
55
  return {
55
- type: "PRNG",
56
- humanReadableType: "Pseudo Random Number",
57
- utilPrng
56
+ type: "CONTRACTCALL",
57
+ humanReadableType: "Contract Call",
58
+ contractCall
58
59
  };
59
60
  }
60
61
  }
61
- if (txBody.freeze) {
62
- const networkFreeze = this.parseNetworkFreezeFromProto(txBody.freeze);
63
- if (networkFreeze) {
64
- return {
65
- type: "FREEZE",
66
- humanReadableType: "Network Freeze",
67
- freeze: networkFreeze
68
- };
69
- }
70
- }
71
- if (txBody.systemDelete) {
72
- const systemDelete = this.parseSystemDeleteFromProto(txBody.systemDelete);
73
- if (systemDelete) {
74
- return {
75
- type: "SYSTEMDELETE",
76
- humanReadableType: "System Delete",
77
- systemDelete
78
- };
79
- }
80
- }
81
- if (txBody.systemUndelete) {
82
- const systemUndelete = this.parseSystemUndeleteFromProto(
83
- txBody.systemUndelete
62
+ if (txBody.contractCreateInstance) {
63
+ const contractCreate = this.parseContractCreate(
64
+ txBody.contractCreateInstance
84
65
  );
85
- if (systemUndelete) {
66
+ if (contractCreate) {
86
67
  return {
87
- type: "SYSTEMUNDELETE",
88
- humanReadableType: "System Undelete",
89
- systemUndelete
68
+ type: "CONTRACTCREATE",
69
+ humanReadableType: "Contract Create",
70
+ contractCreate
90
71
  };
91
72
  }
92
73
  }
93
- if (txBody.nodeCreate) {
94
- const nodeCreate = this.parseNodeCreateFromProto(txBody.nodeCreate);
95
- if (nodeCreate) {
74
+ if (txBody.contractUpdateInstance) {
75
+ const contractUpdate = this.parseContractUpdate(
76
+ txBody.contractUpdateInstance
77
+ );
78
+ if (contractUpdate) {
96
79
  return {
97
- type: "NODECREATE",
98
- humanReadableType: "Node Create",
99
- nodeCreate
80
+ type: "CONTRACTUPDATE",
81
+ humanReadableType: "Contract Update",
82
+ contractUpdate
100
83
  };
101
84
  }
102
85
  }
103
- if (txBody.nodeUpdate) {
104
- const nodeUpdate = this.parseNodeUpdateFromProto(txBody.nodeUpdate);
105
- if (nodeUpdate) {
86
+ if (txBody.contractDeleteInstance) {
87
+ const contractDelete = this.parseContractDelete(
88
+ txBody.contractDeleteInstance
89
+ );
90
+ if (contractDelete) {
106
91
  return {
107
- type: "NODEUPDATE",
108
- humanReadableType: "Node Update",
109
- nodeUpdate
92
+ type: "CONTRACTDELETE",
93
+ humanReadableType: "Contract Delete",
94
+ contractDelete
110
95
  };
111
96
  }
112
97
  }
113
- if (txBody.nodeDelete) {
114
- const nodeDelete = this.parseNodeDeleteFromProto(txBody.nodeDelete);
115
- if (nodeDelete) {
98
+ if (txBody.ethereumTransaction) {
99
+ const ethereumCall = this.parseEthereumTransaction(
100
+ txBody.ethereumTransaction
101
+ );
102
+ if (ethereumCall) {
116
103
  return {
117
- type: "NODEDELETE",
118
- humanReadableType: "Node Delete",
119
- nodeDelete
104
+ type: "ETHEREUMTRANSACTION",
105
+ humanReadableType: "Ethereum Transaction",
106
+ ethereumTransaction: ethereumCall
120
107
  };
121
108
  }
122
109
  }
123
110
  return {};
124
111
  }
125
112
  /**
126
- * Extract utility data from Transaction internal fields
113
+ * Extract contract data from Transaction internal fields
127
114
  * This handles cases where data is stored in Transaction object internals
128
115
  */
129
116
  static parseFromTransactionInternals(transaction) {
130
117
  try {
131
118
  const tx = transaction;
132
- if (hasTransactionType(transaction, "utilPrng")) {
133
- const utilPrng = {};
134
- if (tx._range && tx._range !== 0) {
135
- utilPrng.range = tx._range;
119
+ if (tx._contractId && tx._gas) {
120
+ const contractCall = {
121
+ contractId: tx._contractId.toString(),
122
+ gas: typeof tx._gas === "number" ? tx._gas : Long.fromValue(tx._gas).toNumber(),
123
+ amount: tx._amount ? parseFloat(tx._amount.toString()) : 0
124
+ };
125
+ if (tx._functionParameters) {
126
+ const funcParams = Buffer.from(tx._functionParameters).toString(
127
+ "hex"
128
+ );
129
+ contractCall.functionParameters = funcParams;
130
+ contractCall.functionName = this.extractFunctionName(funcParams);
136
131
  }
137
132
  return {
138
- type: "PRNG",
139
- humanReadableType: "Pseudo Random Number",
140
- utilPrng
133
+ type: "CONTRACTCALL",
134
+ humanReadableType: "Contract Call",
135
+ contractCall
141
136
  };
142
137
  }
143
- if (hasTransactionType(transaction, "freeze")) {
144
- const networkFreeze = {};
145
- if (tx._startTime) {
146
- networkFreeze.startTime = tx._startTime.toString();
147
- }
148
- if (tx._endTime) {
149
- networkFreeze.endTime = tx._endTime.toString();
138
+ if (hasTransactionType(transaction, "contractCreateInstance")) {
139
+ const contractCreate = {
140
+ gas: tx._gas.toString(),
141
+ initialBalance: tx._initialBalance?.toString() || "0"
142
+ };
143
+ if (tx._fileId) {
144
+ contractCreate.initcodeSource = "fileID";
145
+ contractCreate.initcode = tx._fileId.toString();
146
+ } else if (tx._bytecode) {
147
+ contractCreate.initcodeSource = "bytes";
148
+ contractCreate.initcode = Buffer.from(tx._bytecode).toString("hex");
150
149
  }
151
- if (tx._updateFile) {
152
- networkFreeze.updateFile = tx._updateFile.toString();
150
+ if (tx._constructorParameters) {
151
+ contractCreate.constructorParameters = Buffer.from(
152
+ tx._constructorParameters
153
+ ).toString("hex");
153
154
  }
154
- if (tx._fileHash) {
155
- networkFreeze.fileHash = Buffer.from(tx._fileHash).toString("hex");
155
+ if (tx._memo) contractCreate.memo = tx._memo;
156
+ if (tx._adminKey) contractCreate.adminKey = parseKey(tx._adminKey);
157
+ if (tx._maxAutomaticTokenAssociations !== void 0) {
158
+ contractCreate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
156
159
  }
157
- if (tx._freezeType) {
158
- networkFreeze.freezeType = tx._freezeType;
160
+ if (tx._stakedAccountId) {
161
+ contractCreate.stakedAccountId = tx._stakedAccountId.toString();
162
+ } else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
163
+ contractCreate.stakedNodeId = Long.fromValue(
164
+ tx._stakedNodeId
165
+ ).toString();
159
166
  }
167
+ if (tx._declineReward !== void 0)
168
+ contractCreate.declineReward = tx._declineReward;
169
+ if (tx._autoRenewPeriod)
170
+ contractCreate.autoRenewPeriod = tx._autoRenewPeriod.toString();
160
171
  return {
161
- type: "FREEZE",
162
- humanReadableType: "Network Freeze",
163
- freeze: networkFreeze
172
+ type: "CONTRACTCREATE",
173
+ humanReadableType: "Contract Create",
174
+ contractCreate
164
175
  };
165
176
  }
166
- if (hasTransactionType(transaction, "systemDelete")) {
167
- const systemDelete = {};
168
- if (tx._fileId) {
169
- systemDelete.fileId = tx._fileId.toString();
170
- } else if (tx._contractId) {
171
- systemDelete.contractId = tx._contractId.toString();
177
+ if (hasTransactionType(transaction, "contractUpdateInstance")) {
178
+ const contractUpdate = {
179
+ contractIdToUpdate: tx._contractId.toString()
180
+ };
181
+ if (tx._memo) contractUpdate.memo = tx._memo;
182
+ if (tx._adminKey) contractUpdate.adminKey = parseKey(tx._adminKey);
183
+ if (tx._maxAutomaticTokenAssociations !== void 0) {
184
+ contractUpdate.maxAutomaticTokenAssociations = tx._maxAutomaticTokenAssociations;
172
185
  }
173
- if (tx._expirationTime) {
174
- systemDelete.expirationTime = tx._expirationTime.toString();
186
+ if (tx._stakedAccountId) {
187
+ contractUpdate.stakedAccountId = tx._stakedAccountId.toString();
188
+ } else if (tx._stakedNodeId !== null && tx._stakedNodeId !== void 0) {
189
+ contractUpdate.stakedNodeId = Long.fromValue(
190
+ tx._stakedNodeId
191
+ ).toString();
175
192
  }
193
+ if (tx._declineReward !== void 0)
194
+ contractUpdate.declineReward = tx._declineReward;
195
+ if (tx._autoRenewPeriod)
196
+ contractUpdate.autoRenewPeriod = tx._autoRenewPeriod.toString();
176
197
  return {
177
- type: "SYSTEMDELETE",
178
- humanReadableType: "System Delete",
179
- systemDelete
198
+ type: "CONTRACTUPDATE",
199
+ humanReadableType: "Contract Update",
200
+ contractUpdate
180
201
  };
181
202
  }
182
- if (hasTransactionType(transaction, "systemUndelete")) {
183
- const systemUndelete = {};
184
- if (tx._fileId) {
185
- systemUndelete.fileId = tx._fileId.toString();
186
- } else if (tx._contractId) {
187
- systemUndelete.contractId = tx._contractId.toString();
203
+ if (hasTransactionType(transaction, "contractDeleteInstance")) {
204
+ const contractDelete = {
205
+ contractIdToDelete: tx._contractId.toString()
206
+ };
207
+ if (tx._transferAccountId) {
208
+ contractDelete.transferAccountId = tx._transferAccountId.toString();
209
+ } else if (tx._transferContractId) {
210
+ contractDelete.transferContractId = tx._transferContractId.toString();
188
211
  }
189
212
  return {
190
- type: "SYSTEMUNDELETE",
191
- humanReadableType: "System Undelete",
192
- systemUndelete
213
+ type: "CONTRACTDELETE",
214
+ humanReadableType: "Contract Delete",
215
+ contractDelete
193
216
  };
194
217
  }
195
218
  return {};
@@ -198,137 +221,236 @@ class UtilParser {
198
221
  }
199
222
  }
200
223
  /**
201
- * Parse Network Freeze from protobuf data
224
+ * Enhanced function name extraction from contract call parameters
225
+ * Attempts to decode function selector and map to known function names
202
226
  */
203
- static parseNetworkFreezeFromProto(body) {
227
+ static extractFunctionName(functionParameters) {
228
+ if (functionParameters.length < 8) return "unknown";
229
+ const selector = functionParameters.substring(0, 8);
230
+ const commonSelectors = {
231
+ a9059cbb: "transfer",
232
+ "095ea7b3": "approve",
233
+ "23b872dd": "transferFrom",
234
+ "70a08231": "balanceOf",
235
+ dd62ed3e: "allowance",
236
+ "18160ddd": "totalSupply",
237
+ "06fdde03": "name",
238
+ "95d89b41": "symbol",
239
+ "313ce567": "decimals",
240
+ "42842e0e": "safeTransferFrom",
241
+ b88d4fde: "safeTransferFrom",
242
+ e985e9c5: "isApprovedForAll",
243
+ a22cb465: "setApprovalForAll",
244
+ "6352211e": "ownerOf",
245
+ c87b56dd: "tokenURI",
246
+ "01ffc9a7": "supportsInterface",
247
+ "40c10f19": "mint",
248
+ "42966c68": "burn",
249
+ f2fde38b: "transferOwnership",
250
+ "715018a6": "renounceOwnership",
251
+ "8da5cb5b": "owner"
252
+ };
253
+ return commonSelectors[selector] || selector;
254
+ }
255
+ /**
256
+ * Parse Ethereum Transaction (was completely missing from original parser)
257
+ */
258
+ static parseEthereumTransaction(body) {
204
259
  if (!body) return void 0;
205
- const data = {};
206
- if (body.startTime?.seconds) {
207
- data.startTime = `${Long.fromValue(
208
- body.startTime.seconds
209
- ).toString()}.${body.startTime.nanos ?? 0}`;
210
- }
211
- if (body.updateFile) {
212
- data.updateFile = new FileId(
213
- body.updateFile.shardNum ?? 0,
214
- body.updateFile.realmNum ?? 0,
215
- body.updateFile.fileNum ?? 0
216
- ).toString();
217
- }
218
- if (body.fileHash && body.fileHash.length > 0) {
219
- data.fileHash = Buffer.from(body.fileHash).toString("hex");
220
- }
221
- if (body.freezeType !== void 0) {
222
- const freezeTypes = [
223
- "FREEZE_ONLY",
224
- "PREPARE_UPGRADE",
225
- "FREEZE_UPGRADE",
226
- "FREEZE_ABORT"
227
- ];
228
- data.freezeType = freezeTypes[body.freezeType] || "FREEZE_ONLY";
260
+ const data = {
261
+ contractId: "EVM",
262
+ gas: body.maxGasAllowance ? Long.fromValue(body.maxGasAllowance).toNumber() : 0,
263
+ amount: 0
264
+ };
265
+ if (body.ethereumData && body.ethereumData.length > 0) {
266
+ const ethData = Buffer.from(body.ethereumData).toString("hex");
267
+ data.functionParameters = ethData;
268
+ if (ethData.length >= 8) {
269
+ data.functionName = this.extractFunctionName(ethData);
270
+ }
229
271
  }
230
272
  return data;
231
273
  }
232
- /**
233
- * Parse System Delete from protobuf data
234
- */
235
- static parseSystemDeleteFromProto(body) {
274
+ static parseContractCall(body) {
236
275
  if (!body) return void 0;
237
- const data = {};
238
- if (body.fileID) {
239
- data.fileId = new FileId(
240
- body.fileID.shardNum ?? 0,
241
- body.fileID.realmNum ?? 0,
242
- body.fileID.fileNum ?? 0
243
- ).toString();
244
- } else if (body.contractID) {
245
- data.contractId = new ContractId(
276
+ const hbarAmount = Hbar.fromTinybars(Long.fromValue(body.amount ?? 0));
277
+ const data = {
278
+ contractId: new ContractId(
246
279
  body.contractID.shardNum ?? 0,
247
280
  body.contractID.realmNum ?? 0,
248
281
  body.contractID.contractNum ?? 0
249
- ).toString();
250
- }
251
- if (body.expirationTime?.seconds) {
252
- data.expirationTime = Long.fromValue(
253
- body.expirationTime.seconds
254
- ).toString();
282
+ ).toString(),
283
+ gas: Long.fromValue(body.gas ?? 0).toNumber(),
284
+ amount: parseFloat(hbarAmount.toString(HbarUnit.Hbar))
285
+ };
286
+ if (body.functionParameters) {
287
+ data.functionParameters = Buffer.from(body.functionParameters).toString(
288
+ "hex"
289
+ );
290
+ if (data.functionParameters.length >= 8) {
291
+ data.functionName = this.extractFunctionName(data.functionParameters);
292
+ }
255
293
  }
256
294
  return data;
257
295
  }
258
- /**
259
- * Parse System Undelete from protobuf data
260
- */
261
- static parseSystemUndeleteFromProto(body) {
296
+ static parseContractCreate(body) {
262
297
  if (!body) return void 0;
263
298
  const data = {};
299
+ if (body.initialBalance) {
300
+ data.initialBalance = Hbar.fromTinybars(
301
+ Long.fromValue(body.initialBalance)
302
+ ).toString(HbarUnit.Hbar);
303
+ }
304
+ if (body.gas) {
305
+ data.gas = Long.fromValue(body.gas).toString();
306
+ }
307
+ if (body.adminKey) {
308
+ data.adminKey = parseKey(body.adminKey);
309
+ }
310
+ if (body.constructorParameters) {
311
+ data.constructorParameters = Buffer.from(
312
+ body.constructorParameters
313
+ ).toString("hex");
314
+ }
315
+ if (body.memo) {
316
+ data.memo = body.memo;
317
+ }
318
+ if (body.autoRenewPeriod?.seconds) {
319
+ data.autoRenewPeriod = Long.fromValue(
320
+ body.autoRenewPeriod.seconds
321
+ ).toString();
322
+ }
323
+ if (body.stakedAccountId) {
324
+ data.stakedAccountId = new AccountId(
325
+ body.stakedAccountId.shardNum ?? 0,
326
+ body.stakedAccountId.realmNum ?? 0,
327
+ body.stakedAccountId.accountNum ?? 0
328
+ ).toString();
329
+ } else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0) {
330
+ data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
331
+ }
332
+ if (body.declineReward !== void 0) {
333
+ data.declineReward = body.declineReward;
334
+ }
335
+ if (body.maxAutomaticTokenAssociations !== void 0) {
336
+ data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations;
337
+ }
264
338
  if (body.fileID) {
265
- data.fileId = new FileId(
339
+ data.initcodeSource = "fileID";
340
+ data.initcode = new FileId(
266
341
  body.fileID.shardNum ?? 0,
267
342
  body.fileID.realmNum ?? 0,
268
343
  body.fileID.fileNum ?? 0
269
344
  ).toString();
270
- } else if (body.contractID) {
271
- data.contractId = new ContractId(
272
- body.contractID.shardNum ?? 0,
273
- body.contractID.realmNum ?? 0,
274
- body.contractID.contractNum ?? 0
275
- ).toString();
345
+ } else if (body.initcode && body.initcode.length > 0) {
346
+ data.initcodeSource = "bytes";
347
+ data.initcode = Buffer.from(body.initcode).toString("hex");
276
348
  }
277
349
  return data;
278
350
  }
279
- /**
280
- * Parse Node Create from protobuf data
281
- */
282
- static parseNodeCreateFromProto(body) {
351
+ static parseContractUpdate(body) {
283
352
  if (!body) return void 0;
284
353
  const data = {};
285
- if (body.nodeId !== void 0) {
286
- data.nodeId = Long.fromValue(body.nodeId).toNumber();
354
+ if (body.contractID) {
355
+ data.contractIdToUpdate = new ContractId(
356
+ body.contractID.shardNum ?? 0,
357
+ body.contractID.realmNum ?? 0,
358
+ body.contractID.contractNum ?? 0
359
+ ).toString();
287
360
  }
288
- return data;
289
- }
290
- /**
291
- * Parse Node Update from protobuf data
292
- */
293
- static parseNodeUpdateFromProto(body) {
294
- if (!body) return void 0;
295
- const data = {};
296
- if (body.nodeId !== void 0) {
297
- data.nodeId = Long.fromValue(body.nodeId).toNumber();
361
+ if (body.adminKey) {
362
+ data.adminKey = parseKey(body.adminKey);
298
363
  }
299
- return data;
300
- }
301
- /**
302
- * Parse Node Delete from protobuf data
303
- */
304
- static parseNodeDeleteFromProto(body) {
305
- if (!body) return void 0;
306
- const data = {};
307
- if (body.nodeId !== void 0) {
308
- data.nodeId = Long.fromValue(body.nodeId).toNumber();
364
+ if (body.expirationTime?.seconds) {
365
+ data.expirationTime = `${Long.fromValue(
366
+ body.expirationTime.seconds
367
+ ).toString()}.${body.expirationTime.nanos}`;
368
+ }
369
+ if (body.autoRenewPeriod?.seconds) {
370
+ data.autoRenewPeriod = Long.fromValue(
371
+ body.autoRenewPeriod.seconds
372
+ ).toString();
373
+ }
374
+ if (body.memo) {
375
+ const memoUnion = body.memo;
376
+ if (memoUnion && typeof memoUnion === "object" && Object.prototype.hasOwnProperty.call(memoUnion, "value")) {
377
+ const value = memoUnion.value;
378
+ if (value === null || value === void 0) {
379
+ data.memo = void 0;
380
+ } else {
381
+ data.memo = String(value);
382
+ }
383
+ } else if (typeof memoUnion === "string") {
384
+ data.memo = memoUnion;
385
+ } else {
386
+ data.memo = void 0;
387
+ }
388
+ } else {
389
+ data.memo = void 0;
390
+ }
391
+ if (body.stakedAccountId) {
392
+ data.stakedAccountId = new AccountId(
393
+ body.stakedAccountId.shardNum ?? 0,
394
+ body.stakedAccountId.realmNum ?? 0,
395
+ body.stakedAccountId.accountNum ?? 0
396
+ ).toString();
397
+ data.stakedNodeId = void 0;
398
+ } else if (body.stakedNodeId !== null && body.stakedNodeId !== void 0 && Long.fromValue(body.stakedNodeId).notEquals(-1)) {
399
+ data.stakedNodeId = Long.fromValue(body.stakedNodeId).toString();
400
+ data.stakedAccountId = void 0;
401
+ } else {
402
+ data.stakedNodeId = void 0;
403
+ data.stakedAccountId = void 0;
404
+ }
405
+ if (body.declineReward?.value !== void 0) {
406
+ data.declineReward = body.declineReward.value;
407
+ }
408
+ if (body.maxAutomaticTokenAssociations?.value !== void 0) {
409
+ data.maxAutomaticTokenAssociations = body.maxAutomaticTokenAssociations.value;
410
+ }
411
+ if (body.autoRenewAccountId) {
412
+ data.autoRenewAccountId = new AccountId(
413
+ body.autoRenewAccountId.shardNum ?? 0,
414
+ body.autoRenewAccountId.realmNum ?? 0,
415
+ body.autoRenewAccountId.accountNum ?? 0
416
+ ).toString();
309
417
  }
310
418
  return data;
311
419
  }
312
- static parseUtilPrng(body) {
420
+ static parseContractDelete(body) {
313
421
  if (!body) return void 0;
314
422
  const data = {};
315
- if (body.range && body.range !== 0) {
316
- data.range = body.range;
423
+ if (body.contractID) {
424
+ data.contractIdToDelete = new ContractId(
425
+ body.contractID.shardNum ?? 0,
426
+ body.contractID.realmNum ?? 0,
427
+ body.contractID.contractNum ?? 0
428
+ ).toString();
429
+ }
430
+ if (body.transferAccountID) {
431
+ data.transferAccountId = new AccountId(
432
+ body.transferAccountID.shardNum ?? 0,
433
+ body.transferAccountID.realmNum ?? 0,
434
+ body.transferAccountID.accountNum ?? 0
435
+ ).toString();
436
+ } else if (body.transferContractID) {
437
+ data.transferContractId = new ContractId(
438
+ body.transferContractID.shardNum ?? 0,
439
+ body.transferContractID.realmNum ?? 0,
440
+ body.transferContractID.contractNum ?? 0
441
+ ).toString();
317
442
  }
318
443
  return data;
319
444
  }
320
- static parseFreeze(body) {
321
- return this.parseNetworkFreezeFromProto(body);
322
- }
323
445
  /**
324
- * Parse Utility/System Service transaction from Transaction object
446
+ * Parse SCS (Smart Contract Service) transaction from Transaction object
325
447
  * This is the unified entry point that delegates to the comprehensive parsing logic
326
448
  */
327
449
  static parseFromTransactionObject(transaction) {
328
- return this.parseUtilTransaction(transaction);
450
+ return this.parseSCSTransaction(transaction);
329
451
  }
330
452
  }
331
453
  export {
332
- UtilParser
454
+ SCSParser
333
455
  };
334
456
  //# sourceMappingURL=standards-sdk.es145.js.map