@hashgraphonline/standards-sdk 0.0.95 → 0.0.96

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 (264) hide show
  1. package/dist/es/hcs-10/base-client.d.ts +14 -3
  2. package/dist/es/hcs-10/base-client.d.ts.map +1 -1
  3. package/dist/es/hcs-10/connections-manager.d.ts +51 -0
  4. package/dist/es/hcs-10/connections-manager.d.ts.map +1 -1
  5. package/dist/es/hcs-10/sdk.d.ts +38 -1
  6. package/dist/es/hcs-10/sdk.d.ts.map +1 -1
  7. package/dist/es/hcs-10/types.d.ts +9 -0
  8. package/dist/es/hcs-10/types.d.ts.map +1 -1
  9. package/dist/es/services/mirror-node.d.ts +17 -1
  10. package/dist/es/services/mirror-node.d.ts.map +1 -1
  11. package/dist/es/services/types.d.ts +24 -0
  12. package/dist/es/services/types.d.ts.map +1 -1
  13. package/dist/es/standards-sdk.es.js +6 -4
  14. package/dist/es/standards-sdk.es.js.map +1 -1
  15. package/dist/es/standards-sdk.es10.js +66 -0
  16. package/dist/es/standards-sdk.es10.js.map +1 -1
  17. package/dist/es/standards-sdk.es100.js +22 -12
  18. package/dist/es/standards-sdk.es100.js.map +1 -1
  19. package/dist/es/standards-sdk.es101.js +793 -13
  20. package/dist/es/standards-sdk.es101.js.map +1 -1
  21. package/dist/es/standards-sdk.es102.js +172 -30
  22. package/dist/es/standards-sdk.es102.js.map +1 -1
  23. package/dist/es/standards-sdk.es103.js +142 -14
  24. package/dist/es/standards-sdk.es103.js.map +1 -1
  25. package/dist/es/standards-sdk.es104.js +13 -4
  26. package/dist/es/standards-sdk.es104.js.map +1 -1
  27. package/dist/es/standards-sdk.es105.js +13 -4
  28. package/dist/es/standards-sdk.es105.js.map +1 -1
  29. package/dist/es/standards-sdk.es106.js +31 -15
  30. package/dist/es/standards-sdk.es106.js.map +1 -1
  31. package/dist/es/standards-sdk.es107.js +14 -4
  32. package/dist/es/standards-sdk.es107.js.map +1 -1
  33. package/dist/es/standards-sdk.es108.js +4 -39
  34. package/dist/es/standards-sdk.es108.js.map +1 -1
  35. package/dist/es/standards-sdk.es109.js +4 -40
  36. package/dist/es/standards-sdk.es109.js.map +1 -1
  37. package/dist/es/standards-sdk.es110.js +15 -36
  38. package/dist/es/standards-sdk.es110.js.map +1 -1
  39. package/dist/es/standards-sdk.es111.js +5 -78
  40. package/dist/es/standards-sdk.es111.js.map +1 -1
  41. package/dist/es/standards-sdk.es112.js +39 -3
  42. package/dist/es/standards-sdk.es112.js.map +1 -1
  43. package/dist/es/standards-sdk.es113.js +40 -2
  44. package/dist/es/standards-sdk.es113.js.map +1 -1
  45. package/dist/es/standards-sdk.es114.js +37 -2
  46. package/dist/es/standards-sdk.es114.js.map +1 -1
  47. package/dist/es/standards-sdk.es115.js +75 -31
  48. package/dist/es/standards-sdk.es115.js.map +1 -1
  49. package/dist/es/standards-sdk.es116.js +20 -32
  50. package/dist/es/standards-sdk.es116.js.map +1 -1
  51. package/dist/es/standards-sdk.es117.js +27 -9
  52. package/dist/es/standards-sdk.es117.js.map +1 -1
  53. package/dist/es/standards-sdk.es118.js +25 -33
  54. package/dist/es/standards-sdk.es118.js.map +1 -1
  55. package/dist/es/standards-sdk.es119.js +41 -0
  56. package/dist/es/standards-sdk.es119.js.map +1 -0
  57. package/dist/es/standards-sdk.es120.js +6 -0
  58. package/dist/es/standards-sdk.es120.js.map +1 -0
  59. package/dist/es/standards-sdk.es121.js +5 -0
  60. package/dist/es/standards-sdk.es121.js.map +1 -0
  61. package/dist/es/standards-sdk.es122.js +5 -0
  62. package/dist/es/standards-sdk.es122.js.map +1 -0
  63. package/dist/es/standards-sdk.es123.js +37 -0
  64. package/dist/es/standards-sdk.es123.js.map +1 -0
  65. package/dist/es/standards-sdk.es124.js +36 -0
  66. package/dist/es/standards-sdk.es124.js.map +1 -0
  67. package/dist/es/standards-sdk.es125.js +12 -0
  68. package/dist/es/standards-sdk.es125.js.map +1 -0
  69. package/dist/es/standards-sdk.es126.js +37 -0
  70. package/dist/es/standards-sdk.es126.js.map +1 -0
  71. package/dist/es/standards-sdk.es13.js +3 -3
  72. package/dist/es/standards-sdk.es15.js +1 -1
  73. package/dist/es/standards-sdk.es16.js +1 -1
  74. package/dist/es/standards-sdk.es18.js +2 -2
  75. package/dist/es/standards-sdk.es19.js +393 -387
  76. package/dist/es/standards-sdk.es19.js.map +1 -1
  77. package/dist/es/standards-sdk.es20.js +385 -314
  78. package/dist/es/standards-sdk.es20.js.map +1 -1
  79. package/dist/es/standards-sdk.es21.js +357 -128
  80. package/dist/es/standards-sdk.es21.js.map +1 -1
  81. package/dist/es/standards-sdk.es22.js +155 -7
  82. package/dist/es/standards-sdk.es22.js.map +1 -1
  83. package/dist/es/standards-sdk.es23.js +7 -1041
  84. package/dist/es/standards-sdk.es23.js.map +1 -1
  85. package/dist/es/standards-sdk.es24.js +2 -0
  86. package/dist/es/standards-sdk.es24.js.map +1 -1
  87. package/dist/es/standards-sdk.es25.js +1 -1
  88. package/dist/es/standards-sdk.es26.js +1 -1
  89. package/dist/es/standards-sdk.es27.js +9 -2
  90. package/dist/es/standards-sdk.es27.js.map +1 -1
  91. package/dist/es/standards-sdk.es28.js +2 -4167
  92. package/dist/es/standards-sdk.es28.js.map +1 -1
  93. package/dist/es/standards-sdk.es29.js +1041 -36
  94. package/dist/es/standards-sdk.es29.js.map +1 -1
  95. package/dist/es/standards-sdk.es30.js +5 -48
  96. package/dist/es/standards-sdk.es30.js.map +1 -1
  97. package/dist/es/standards-sdk.es31.js +36 -5
  98. package/dist/es/standards-sdk.es31.js.map +1 -1
  99. package/dist/es/standards-sdk.es32.js +48 -2
  100. package/dist/es/standards-sdk.es32.js.map +1 -1
  101. package/dist/es/standards-sdk.es33.js +9 -100
  102. package/dist/es/standards-sdk.es33.js.map +1 -1
  103. package/dist/es/standards-sdk.es34.js +4167 -2
  104. package/dist/es/standards-sdk.es34.js.map +1 -1
  105. package/dist/es/standards-sdk.es35.js +96 -11
  106. package/dist/es/standards-sdk.es35.js.map +1 -1
  107. package/dist/es/standards-sdk.es36.js +2 -409
  108. package/dist/es/standards-sdk.es36.js.map +1 -1
  109. package/dist/es/standards-sdk.es37.js +15 -194
  110. package/dist/es/standards-sdk.es37.js.map +1 -1
  111. package/dist/es/standards-sdk.es38.js +389 -418
  112. package/dist/es/standards-sdk.es38.js.map +1 -1
  113. package/dist/es/standards-sdk.es39.js +2282 -25
  114. package/dist/es/standards-sdk.es39.js.map +1 -1
  115. package/dist/es/standards-sdk.es4.js +1 -1
  116. package/dist/es/standards-sdk.es40.js +150 -125
  117. package/dist/es/standards-sdk.es40.js.map +1 -1
  118. package/dist/es/standards-sdk.es41.js +7130 -12
  119. package/dist/es/standards-sdk.es41.js.map +1 -1
  120. package/dist/es/standards-sdk.es42.js +9 -28
  121. package/dist/es/standards-sdk.es42.js.map +1 -1
  122. package/dist/es/standards-sdk.es43.js +8 -26
  123. package/dist/es/standards-sdk.es43.js.map +1 -1
  124. package/dist/es/standards-sdk.es44.js +15 -18
  125. package/dist/es/standards-sdk.es44.js.map +1 -1
  126. package/dist/es/standards-sdk.es45.js +4 -42
  127. package/dist/es/standards-sdk.es45.js.map +1 -1
  128. package/dist/es/standards-sdk.es46.js +8 -17
  129. package/dist/es/standards-sdk.es46.js.map +1 -1
  130. package/dist/es/standards-sdk.es47.js +3 -61
  131. package/dist/es/standards-sdk.es47.js.map +1 -1
  132. package/dist/es/standards-sdk.es48.js +384 -1254
  133. package/dist/es/standards-sdk.es48.js.map +1 -1
  134. package/dist/es/standards-sdk.es49.js +2 -148
  135. package/dist/es/standards-sdk.es49.js.map +1 -1
  136. package/dist/es/standards-sdk.es5.js +31 -8
  137. package/dist/es/standards-sdk.es5.js.map +1 -1
  138. package/dist/es/standards-sdk.es50.js +115 -86
  139. package/dist/es/standards-sdk.es50.js.map +1 -1
  140. package/dist/es/standards-sdk.es51.js +3 -83
  141. package/dist/es/standards-sdk.es51.js.map +1 -1
  142. package/dist/es/standards-sdk.es52.js +360 -28
  143. package/dist/es/standards-sdk.es52.js.map +1 -1
  144. package/dist/es/standards-sdk.es53.js +5 -5
  145. package/dist/es/standards-sdk.es53.js.map +1 -1
  146. package/dist/es/standards-sdk.es54.js +167 -147
  147. package/dist/es/standards-sdk.es54.js.map +1 -1
  148. package/dist/es/standards-sdk.es55.js +80 -22
  149. package/dist/es/standards-sdk.es55.js.map +1 -1
  150. package/dist/es/standards-sdk.es56.js +102 -781
  151. package/dist/es/standards-sdk.es56.js.map +1 -1
  152. package/dist/es/standards-sdk.es57.js +44 -166
  153. package/dist/es/standards-sdk.es57.js.map +1 -1
  154. package/dist/es/standards-sdk.es58.js +10 -2282
  155. package/dist/es/standards-sdk.es58.js.map +1 -1
  156. package/dist/es/standards-sdk.es59.js +85 -152
  157. package/dist/es/standards-sdk.es59.js.map +1 -1
  158. package/dist/es/standards-sdk.es60.js +3 -142
  159. package/dist/es/standards-sdk.es60.js.map +1 -1
  160. package/dist/es/standards-sdk.es61.js +2 -7136
  161. package/dist/es/standards-sdk.es61.js.map +1 -1
  162. package/dist/es/standards-sdk.es62.js +108 -16
  163. package/dist/es/standards-sdk.es62.js.map +1 -1
  164. package/dist/es/standards-sdk.es63.js +72 -25
  165. package/dist/es/standards-sdk.es63.js.map +1 -1
  166. package/dist/es/standards-sdk.es64.js +5 -25
  167. package/dist/es/standards-sdk.es64.js.map +1 -1
  168. package/dist/es/standards-sdk.es65.js +4 -37
  169. package/dist/es/standards-sdk.es65.js.map +1 -1
  170. package/dist/es/standards-sdk.es66.js +187 -385
  171. package/dist/es/standards-sdk.es66.js.map +1 -1
  172. package/dist/es/standards-sdk.es67.js +58 -2
  173. package/dist/es/standards-sdk.es67.js.map +1 -1
  174. package/dist/es/standards-sdk.es68.js +69 -120
  175. package/dist/es/standards-sdk.es68.js.map +1 -1
  176. package/dist/es/standards-sdk.es69.js +2 -3
  177. package/dist/es/standards-sdk.es69.js.map +1 -1
  178. package/dist/es/standards-sdk.es7.js +103 -2
  179. package/dist/es/standards-sdk.es7.js.map +1 -1
  180. package/dist/es/standards-sdk.es70.js +31 -3
  181. package/dist/es/standards-sdk.es70.js.map +1 -1
  182. package/dist/es/standards-sdk.es71.js +54 -355
  183. package/dist/es/standards-sdk.es71.js.map +1 -1
  184. package/dist/es/standards-sdk.es72.js +49 -5
  185. package/dist/es/standards-sdk.es72.js.map +1 -1
  186. package/dist/es/standards-sdk.es73.js +9 -178
  187. package/dist/es/standards-sdk.es73.js.map +1 -1
  188. package/dist/es/standards-sdk.es74.js +57 -73
  189. package/dist/es/standards-sdk.es74.js.map +1 -1
  190. package/dist/es/standards-sdk.es75.js +5 -113
  191. package/dist/es/standards-sdk.es75.js.map +1 -1
  192. package/dist/es/standards-sdk.es76.js +12 -49
  193. package/dist/es/standards-sdk.es76.js.map +1 -1
  194. package/dist/es/standards-sdk.es77.js +7 -10
  195. package/dist/es/standards-sdk.es77.js.map +1 -1
  196. package/dist/es/standards-sdk.es78.js +41 -93
  197. package/dist/es/standards-sdk.es78.js.map +1 -1
  198. package/dist/es/standards-sdk.es79.js +2 -4
  199. package/dist/es/standards-sdk.es79.js.map +1 -1
  200. package/dist/es/standards-sdk.es8.js +1 -1
  201. package/dist/es/standards-sdk.es80.js +136 -2
  202. package/dist/es/standards-sdk.es80.js.map +1 -1
  203. package/dist/es/standards-sdk.es81.js +162 -103
  204. package/dist/es/standards-sdk.es81.js.map +1 -1
  205. package/dist/es/standards-sdk.es82.js +190 -69
  206. package/dist/es/standards-sdk.es82.js.map +1 -1
  207. package/dist/es/standards-sdk.es83.js +437 -5
  208. package/dist/es/standards-sdk.es83.js.map +1 -1
  209. package/dist/es/standards-sdk.es84.js +24 -4
  210. package/dist/es/standards-sdk.es84.js.map +1 -1
  211. package/dist/es/standards-sdk.es85.js +122 -204
  212. package/dist/es/standards-sdk.es85.js.map +1 -1
  213. package/dist/es/standards-sdk.es86.js +17 -57
  214. package/dist/es/standards-sdk.es86.js.map +1 -1
  215. package/dist/es/standards-sdk.es87.js +29 -69
  216. package/dist/es/standards-sdk.es87.js.map +1 -1
  217. package/dist/es/standards-sdk.es88.js +24 -27
  218. package/dist/es/standards-sdk.es88.js.map +1 -1
  219. package/dist/es/standards-sdk.es89.js +15 -57
  220. package/dist/es/standards-sdk.es89.js.map +1 -1
  221. package/dist/es/standards-sdk.es9.js +1 -1
  222. package/dist/es/standards-sdk.es90.js +39 -45
  223. package/dist/es/standards-sdk.es90.js.map +1 -1
  224. package/dist/es/standards-sdk.es91.js +17 -9
  225. package/dist/es/standards-sdk.es91.js.map +1 -1
  226. package/dist/es/standards-sdk.es92.js +57 -61
  227. package/dist/es/standards-sdk.es92.js.map +1 -1
  228. package/dist/es/standards-sdk.es93.js +1288 -5
  229. package/dist/es/standards-sdk.es93.js.map +1 -1
  230. package/dist/es/standards-sdk.es94.js +145 -12
  231. package/dist/es/standards-sdk.es94.js.map +1 -1
  232. package/dist/es/standards-sdk.es95.js +91 -7
  233. package/dist/es/standards-sdk.es95.js.map +1 -1
  234. package/dist/es/standards-sdk.es96.js +82 -43
  235. package/dist/es/standards-sdk.es96.js.map +1 -1
  236. package/dist/es/standards-sdk.es97.js +32 -2
  237. package/dist/es/standards-sdk.es97.js.map +1 -1
  238. package/dist/es/standards-sdk.es98.js +6 -136
  239. package/dist/es/standards-sdk.es98.js.map +1 -1
  240. package/dist/es/standards-sdk.es99.js +148 -161
  241. package/dist/es/standards-sdk.es99.js.map +1 -1
  242. package/dist/es/utils/index.d.ts +1 -0
  243. package/dist/es/utils/index.d.ts.map +1 -1
  244. package/dist/es/utils/transaction-parser.d.ts +103 -0
  245. package/dist/es/utils/transaction-parser.d.ts.map +1 -0
  246. package/dist/umd/hcs-10/base-client.d.ts +14 -3
  247. package/dist/umd/hcs-10/base-client.d.ts.map +1 -1
  248. package/dist/umd/hcs-10/connections-manager.d.ts +51 -0
  249. package/dist/umd/hcs-10/connections-manager.d.ts.map +1 -1
  250. package/dist/umd/hcs-10/sdk.d.ts +38 -1
  251. package/dist/umd/hcs-10/sdk.d.ts.map +1 -1
  252. package/dist/umd/hcs-10/types.d.ts +9 -0
  253. package/dist/umd/hcs-10/types.d.ts.map +1 -1
  254. package/dist/umd/services/mirror-node.d.ts +17 -1
  255. package/dist/umd/services/mirror-node.d.ts.map +1 -1
  256. package/dist/umd/services/types.d.ts +24 -0
  257. package/dist/umd/services/types.d.ts.map +1 -1
  258. package/dist/umd/standards-sdk.umd.js +8 -8
  259. package/dist/umd/standards-sdk.umd.js.map +1 -1
  260. package/dist/umd/utils/index.d.ts +1 -0
  261. package/dist/umd/utils/index.d.ts.map +1 -1
  262. package/dist/umd/utils/transaction-parser.d.ts +103 -0
  263. package/dist/umd/utils/transaction-parser.d.ts.map +1 -0
  264. package/package.json +6 -2
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es5.js","sources":["../../src/hcs-10/base-client.ts"],"sourcesContent":["import { Logger, LogLevel } from '../utils/logger';\nimport { Registration } from './registrations';\nimport { HCS11Client } from '../hcs-11/client';\nimport { AccountResponse, TopicResponse } from '../services/types';\nimport { TopicInfo } from '../services/types';\nimport { TransactionReceipt, PrivateKey, PublicKey } from '@hashgraph/sdk';\nimport axios from 'axios';\nimport { NetworkType } from '../utils/types';\nimport { HederaMirrorNode } from '../services';\nimport { WaitForConnectionConfirmationResponse } from './types';\nimport { HRLResolver } from '../utils/hrl-resolver';\n\nexport enum Hcs10MemoType {\n INBOUND = 'inbound',\n OUTBOUND = 'outbound',\n CONNECTION = 'connection',\n}\n\nexport interface HCS10Config {\n network: 'mainnet' | 'testnet';\n logLevel?: LogLevel;\n prettyPrint?: boolean;\n feeAmount?: number;\n}\n\nexport interface HCSMessage {\n p: 'hcs-10';\n op:\n | 'connection_request'\n | 'connection_created'\n | 'message'\n | 'close_connection';\n data: string;\n created?: Date;\n consensus_timestamp?: string;\n m?: string;\n payer: string;\n outbound_topic_id?: string;\n connection_request_id?: number;\n confirmed_request_id?: number;\n connection_topic_id?: string;\n connected_account_id?: string;\n requesting_account_id?: string;\n connection_id?: number;\n sequence_number: number;\n operator_id?: string;\n reason?: string;\n close_method?: string;\n}\n\nexport interface ProfileResponse {\n profile: any;\n topicInfo?: TopicInfo;\n success: boolean;\n error?: string;\n}\n\nexport abstract class HCS10BaseClient extends Registration {\n protected network: string;\n protected logger: Logger;\n protected mirrorNode: HederaMirrorNode;\n protected feeAmount: number;\n\n protected operatorId: string;\n\n constructor(config: HCS10Config) {\n super();\n this.network = config.network;\n this.logger = Logger.getInstance({\n level: config.logLevel || 'info',\n module: 'HCS10-BaseClient',\n prettyPrint: config.prettyPrint,\n });\n this.mirrorNode = new HederaMirrorNode(\n config.network as NetworkType,\n this.logger\n );\n this.feeAmount = config.feeAmount || 0.001;\n }\n\n abstract submitPayload(\n topicId: string,\n payload: object | string,\n submitKey?: PrivateKey,\n requiresFee?: boolean\n ): Promise<TransactionReceipt>;\n\n abstract getAccountAndSigner(): { accountId: string; signer: any };\n\n public extractTopicFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 0) {\n return parts[0];\n }\n return '';\n }\n\n public extractAccountFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 1) {\n return parts[1];\n }\n return '';\n }\n\n /**\n * Get a stream of messages from a connection topic\n * @param topicId The connection topic ID to get messages from\n * @returns A stream of filtered messages valid for connection topics\n */\n public async getMessageStream(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n const validOps = ['message', 'close_connection'];\n\n const filteredMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10' || !validOps.includes(msg.op)) {\n return false;\n }\n\n if (msg.op === 'message') {\n if (!msg.data) {\n return false;\n }\n\n if (!msg.operator_id) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n\n if (msg.op === 'close_connection') {\n if (!msg.operator_id) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n\n return true;\n });\n\n return {\n messages: filteredMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n /**\n * Public method to retrieve topic information using the internal mirror node client.\n *\n * @param topicId The ID of the topic to query.\n * @returns Topic information or null if not found or an error occurs.\n */\n async getPublicTopicInfo(topicId: string): Promise<TopicResponse | null> {\n try {\n return await this.mirrorNode.getTopicInfo(topicId);\n } catch (error) {\n this.logger.error(\n `Error getting public topic info for ${topicId}:`,\n error\n );\n return null;\n }\n }\n\n /**\n * Checks if a user can submit to a topic and determines if a fee is required\n * @param topicId The topic ID to check\n * @param userAccountId The account ID of the user attempting to submit\n * @returns Object with canSubmit, requiresFee, and optional reason\n */\n public async canSubmitToTopic(\n topicId: string,\n userAccountId: string\n ): Promise<{ canSubmit: boolean; requiresFee: boolean; reason?: string }> {\n try {\n const topicInfo = await this.mirrorNode.getTopicInfo(topicId);\n\n if (!topicInfo) {\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'Topic does not exist',\n };\n }\n\n if (!topicInfo.submit_key?.key) {\n return { canSubmit: true, requiresFee: false };\n }\n\n try {\n const userPublicKey = await this.mirrorNode.getPublicKey(userAccountId);\n\n if (topicInfo.submit_key._type === 'ProtobufEncoded') {\n const keyBytes = Buffer.from(topicInfo.submit_key.key, 'hex');\n const hasAccess = await this.mirrorNode.checkKeyListAccess(\n keyBytes,\n userPublicKey\n );\n\n if (hasAccess) {\n return { canSubmit: true, requiresFee: false };\n }\n } else {\n const topicSubmitKey = PublicKey.fromString(topicInfo.submit_key.key);\n if (userPublicKey.toString() === topicSubmitKey.toString()) {\n return { canSubmit: true, requiresFee: false };\n }\n }\n } catch (error) {\n this.logger.error(\n `Key validation error: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n\n if (\n topicInfo.fee_schedule_key?.key &&\n topicInfo.custom_fees?.fixed_fees?.length > 0\n ) {\n return {\n canSubmit: true,\n requiresFee: true,\n reason: 'Requires fee payment via HIP-991',\n };\n }\n\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'User does not have submit permission for this topic',\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this.logger.error(`Topic submission validation error: ${errorMessage}`);\n return {\n canSubmit: false,\n requiresFee: false,\n reason: `Error: ${errorMessage}`,\n };\n }\n }\n\n /**\n * Get all messages from a topic\n * @param topicId The topic ID to get messages from\n * @returns All messages from the topic\n */\n public async getMessages(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n\n const validatedMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10') {\n return false;\n }\n\n if (msg.op === 'message') {\n if (!msg.data) {\n return false;\n }\n\n if (msg.operator_id) {\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n }\n\n return true;\n });\n\n return {\n messages: validatedMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n /**\n * Requests an account from the mirror node\n * @param account The account ID to request\n * @returns The account response\n */\n public async requestAccount(account: string): Promise<AccountResponse> {\n try {\n return await this.mirrorNode.requestAccount(account);\n } catch (e) {\n this.logger.error('Failed to fetch account', e);\n throw e;\n }\n }\n\n /**\n * Retrieves the memo for an account\n * @param accountId The account ID to retrieve the memo for\n * @returns The memo\n */\n public async getAccountMemo(accountId: string): Promise<string | null> {\n return await this.mirrorNode.getAccountMemo(accountId);\n }\n\n /**\n * Retrieves the profile for an account\n * @param accountId The account ID to retrieve the profile for\n * @param disableCache Whether to disable caching of the result\n * @returns The profile\n */\n public async retrieveProfile(\n accountId: string,\n disableCache?: boolean\n ): Promise<ProfileResponse> {\n this.logger.debug(`Retrieving profile for account: ${accountId}`);\n\n const cacheKey = `${accountId}-${this.network}`;\n\n if (!disableCache) {\n const cachedProfileResponse = HCS10Cache.getInstance().get(cacheKey);\n if (cachedProfileResponse) {\n this.logger.debug(`Cache hit for profile: ${accountId}`);\n return cachedProfileResponse;\n }\n }\n try {\n const hcs11Client = new HCS11Client({\n network: this.network as 'mainnet' | 'testnet',\n auth: {\n operatorId: '0.0.0', // Read-only operations only\n },\n logLevel: 'info',\n });\n\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n this.network\n );\n\n if (!profileResult?.success) {\n this.logger.error(\n `Failed to retrieve profile for account ID: ${accountId}`,\n profileResult?.error\n );\n return {\n profile: null,\n success: false,\n error:\n profileResult?.error ||\n `Failed to retrieve profile for account ID: ${accountId}`,\n };\n }\n\n const profile = profileResult.profile;\n let topicInfo: TopicInfo | null = null;\n\n if (\n profileResult.topicInfo?.inboundTopic &&\n profileResult.topicInfo?.outboundTopic &&\n profileResult.topicInfo?.profileTopicId\n ) {\n topicInfo = {\n inboundTopic: profileResult.topicInfo.inboundTopic,\n outboundTopic: profileResult.topicInfo.outboundTopic,\n profileTopicId: profileResult.topicInfo.profileTopicId,\n };\n }\n\n const responseToCache: ProfileResponse = {\n profile,\n topicInfo,\n success: true,\n };\n HCS10Cache.getInstance().set(cacheKey, responseToCache);\n return responseToCache;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to retrieve profile: ${error.message}`;\n this.logger.error(logMessage);\n return {\n profile: null,\n success: false,\n error: logMessage,\n };\n }\n }\n\n /**\n * @deprecated Use retrieveCommunicationTopics instead\n * @param accountId The account ID to retrieve the outbound connect topic for\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveOutboundConnectTopic(\n accountId: string\n ): Promise<TopicInfo> {\n return await this.retrieveCommunicationTopics(accountId, true);\n }\n\n /**\n * Retrieves the communication topics for an account\n * @param accountId The account ID to retrieve the communication topics for\n * @param disableCache Whether to disable caching of the result\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveCommunicationTopics(\n accountId: string,\n disableCache?: boolean\n ): Promise<TopicInfo> {\n try {\n const profileResponse = await this.retrieveProfile(\n accountId,\n disableCache\n );\n\n if (!profileResponse?.success) {\n throw new Error(profileResponse.error || 'Failed to retrieve profile');\n }\n\n const profile = profileResponse.profile;\n\n if (!profile.inboundTopicId || !profile.outboundTopicId) {\n throw new Error(\n `Invalid HCS-11 profile for HCS-10 agent: missing inboundTopicId or outboundTopicId`\n );\n }\n\n if (!profileResponse.topicInfo) {\n throw new Error(\n `TopicInfo is missing in the profile for account ${accountId}`\n );\n }\n\n return profileResponse.topicInfo;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to retrieve topic info: ${error.message}`;\n this.logger.error(logMessage);\n throw error;\n }\n }\n\n /**\n * Retrieves outbound messages for an agent\n * @param agentAccountId The account ID of the agent\n * @returns The outbound messages\n */\n public async retrieveOutboundMessages(\n agentAccountId: string\n ): Promise<HCSMessage[]> {\n try {\n const topicInfo = await this.retrieveCommunicationTopics(agentAccountId);\n if (!topicInfo) {\n this.logger.warn(\n `No outbound connect topic found for agentAccountId: ${agentAccountId}`\n );\n return [];\n }\n const response = await this.getMessages(topicInfo.outboundTopic);\n return response.messages.filter(\n (msg) =>\n msg.p === 'hcs-10' &&\n (msg.op === 'connection_request' ||\n msg.op === 'connection_created' ||\n msg.op === 'message')\n );\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to retrieve outbound messages: ${error.message}`;\n this.logger.error(logMessage);\n return [];\n }\n }\n\n /**\n * Checks if a connection has been created for an agent\n * @param agentAccountId The account ID of the agent\n * @param connectionId The ID of the connection\n * @returns True if the connection has been created, false otherwise\n */\n public async hasConnectionCreated(\n agentAccountId: string,\n connectionId: number\n ): Promise<boolean> {\n try {\n const outBoundTopic = await this.retrieveCommunicationTopics(\n agentAccountId\n );\n const messages = await this.retrieveOutboundMessages(\n outBoundTopic.outboundTopic\n );\n return messages.some(\n (msg) =>\n msg.op === 'connection_created' && msg.connection_id === connectionId\n );\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to check connection created: ${error.message}`;\n this.logger.error(logMessage);\n return false;\n }\n }\n\n /**\n * Gets message content, resolving any HRL references if needed\n * @param data The data string that may contain an HRL reference\n * @param forceRaw Whether to force returning raw binary data\n * @returns The resolved content\n */\n async getMessageContent(\n data: string,\n forceRaw = false\n ): Promise<string | ArrayBuffer> {\n if (!data.match(/^hcs:\\/\\/(\\d+)\\/([0-9]+\\.[0-9]+\\.[0-9]+)$/)) {\n return data;\n }\n\n try {\n const resolver = new HRLResolver(this.logger.getLevel());\n\n if (!resolver.isValidHRL(data)) {\n return data;\n }\n\n const result = await resolver.resolveHRL(data, {\n network: this.network as 'mainnet' | 'testnet',\n returnRaw: forceRaw,\n });\n\n return result.content;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error resolving HRL reference: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Gets message content with its content type, resolving any HRL references if needed\n * @param data The data string that may contain an HRL reference\n * @param forceRaw Whether to force returning raw binary data\n * @returns The resolved content along with content type information\n */\n async getMessageContentWithType(\n data: string,\n forceRaw = false\n ): Promise<{\n content: string | ArrayBuffer;\n contentType: string;\n isBinary: boolean;\n }> {\n if (!data.match(/^hcs:\\/\\/(\\d+)\\/([0-9]+\\.[0-9]+\\.[0-9]+)$/)) {\n return {\n content: data,\n contentType: 'text/plain',\n isBinary: false,\n };\n }\n\n try {\n const resolver = new HRLResolver(this.logger.getLevel());\n\n return await resolver.getContentWithType(data, {\n network: this.network as 'mainnet' | 'testnet',\n returnRaw: forceRaw,\n });\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error resolving HRL reference with type: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Submits a connection request to an inbound topic\n * @param inboundTopicId The ID of the inbound topic\n * @param memo An optional memo for the message\n * @returns The transaction receipt\n */\n async submitConnectionRequest(\n inboundTopicId: string,\n memo: string\n ): Promise<TransactionReceipt> {\n const accountResponse = this.getAccountAndSigner();\n if (!accountResponse?.accountId) {\n throw new Error('Operator account ID is not set');\n }\n const operatorId = await this.getOperatorId();\n const accountId = accountResponse.accountId;\n\n const submissionCheck = await this.canSubmitToTopic(\n inboundTopicId,\n accountId\n );\n\n if (!submissionCheck?.canSubmit) {\n throw new Error(`Cannot submit to topic: ${submissionCheck.reason}`);\n }\n\n const inboundAccountOwner = await this.retrieveInboundAccountId(\n inboundTopicId\n );\n\n if (!inboundAccountOwner) {\n throw new Error('Failed to retrieve topic info account ID');\n }\n\n const connectionRequestMessage = {\n p: 'hcs-10',\n op: 'connection_request',\n operator_id: operatorId,\n m: memo,\n };\n\n const requiresFee = submissionCheck.requiresFee;\n const response = await this.submitPayload(\n inboundTopicId,\n connectionRequestMessage,\n undefined,\n requiresFee\n );\n\n this.logger.info(\n `Submitted connection request to topic ID: ${inboundTopicId}`\n );\n\n const outboundTopic = await this.retrieveCommunicationTopics(accountId);\n\n if (!outboundTopic) {\n throw new Error('Failed to retrieve outbound topic');\n }\n\n const responseSequenceNumber = response.topicSequenceNumber?.toNumber();\n\n if (!responseSequenceNumber) {\n throw new Error('Failed to get response sequence number');\n }\n\n const requestorOperatorId = `${inboundTopicId}@${inboundAccountOwner}`;\n\n await this.submitPayload(outboundTopic.outboundTopic, {\n ...connectionRequestMessage,\n outbound_topic_id: outboundTopic.outboundTopic,\n connection_request_id: responseSequenceNumber,\n operator_id: requestorOperatorId,\n });\n\n return response;\n }\n\n /**\n * Records an outbound connection confirmation\n * @param outboundTopicId The ID of the outbound topic\n * @param connectionRequestId The ID of the connection request\n * @param confirmedRequestId The ID of the confirmed request\n * @param connectionTopicId The ID of the connection topic\n * @param operatorId The operator ID of the original message sender.\n * @param memo An optional memo for the message\n */\n public async recordOutboundConnectionConfirmation({\n outboundTopicId,\n requestorOutboundTopicId,\n connectionRequestId,\n confirmedRequestId,\n connectionTopicId,\n operatorId,\n memo,\n }: {\n outboundTopicId: string;\n requestorOutboundTopicId: string;\n connectionRequestId: number;\n confirmedRequestId: number;\n connectionTopicId: string;\n operatorId: string;\n memo: string;\n }): Promise<TransactionReceipt> {\n const payload = {\n p: 'hcs-10',\n op: 'connection_created',\n connection_topic_id: connectionTopicId,\n outbound_topic_id: outboundTopicId,\n requestor_outbound_topic_id: requestorOutboundTopicId,\n confirmed_request_id: confirmedRequestId,\n connection_request_id: connectionRequestId,\n operator_id: operatorId,\n m: memo,\n };\n return await this.submitPayload(outboundTopicId, payload);\n }\n\n /**\n * Waits for confirmation of a connection request\n * @param inboundTopicId Inbound topic ID\n * @param connectionRequestId Connection request ID\n * @param maxAttempts Maximum number of attempts\n * @param delayMs Delay between attempts in milliseconds\n * @returns Connection confirmation details\n */\n async waitForConnectionConfirmation(\n inboundTopicId: string,\n connectionRequestId: number,\n maxAttempts = 60,\n delayMs = 2000,\n recordConfirmation = true\n ): Promise<WaitForConnectionConfirmationResponse> {\n this.logger.info(\n `Waiting for connection confirmation on inbound topic ${inboundTopicId} for request ID ${connectionRequestId}`\n );\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n this.logger.info(\n `Attempt ${attempt + 1}/${maxAttempts} to find connection confirmation`\n );\n const messages = await this.mirrorNode.getTopicMessages(inboundTopicId);\n\n const connectionCreatedMessages = messages.filter(\n (m) => m.op === 'connection_created'\n );\n\n this.logger.info(\n `Found ${connectionCreatedMessages.length} connection_created messages`\n );\n\n if (connectionCreatedMessages.length > 0) {\n for (const message of connectionCreatedMessages) {\n if (Number(message.connection_id) === Number(connectionRequestId)) {\n const confirmationResult = {\n connectionTopicId: message.connection_topic_id,\n sequence_number: Number(message.sequence_number),\n confirmedBy: message.operator_id,\n memo: message.m,\n };\n\n const confirmedByAccountId = this.extractAccountFromOperatorId(\n confirmationResult.confirmedBy\n );\n\n const account = this.getAccountAndSigner();\n const confirmedByConnectionTopics =\n await this.retrieveCommunicationTopics(confirmedByAccountId);\n\n const agentConnectionTopics =\n await this.retrieveCommunicationTopics(account.accountId);\n\n this.logger.info(\n 'Connection confirmation found',\n confirmationResult\n );\n\n if (recordConfirmation) {\n /**\n * Record's the confirmation of the connection request from the\n * confirmedBy account to the agent account.\n */\n await this.recordOutboundConnectionConfirmation({\n requestorOutboundTopicId:\n confirmedByConnectionTopics.outboundTopic,\n outboundTopicId: agentConnectionTopics.outboundTopic,\n connectionRequestId,\n confirmedRequestId: confirmationResult.sequence_number,\n connectionTopicId: confirmationResult.connectionTopicId,\n operatorId: confirmationResult.confirmedBy,\n memo: confirmationResult.memo || 'Connection confirmed',\n });\n }\n\n return confirmationResult;\n }\n }\n }\n\n if (attempt < maxAttempts - 1) {\n this.logger.info(\n `No matching confirmation found, waiting ${delayMs}ms before retrying...`\n );\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n }\n }\n\n throw new Error(\n `Connection confirmation not found after ${maxAttempts} attempts for request ID ${connectionRequestId}`\n );\n }\n\n /**\n * Retrieves the operator ID for the current agent\n * @param disableCache Whether to disable caching of the result\n * @returns The operator ID\n */\n public async getOperatorId(disableCache?: boolean): Promise<string> {\n if (this.operatorId && !disableCache) {\n return this.operatorId;\n }\n\n const accountResponse = this.getAccountAndSigner();\n\n if (!accountResponse.accountId) {\n throw new Error('Operator ID not found');\n }\n\n const profile = await this.retrieveProfile(accountResponse.accountId);\n\n if (!profile.success) {\n throw new Error('Failed to retrieve profile');\n }\n\n const operatorId = `${profile.topicInfo?.inboundTopic}@${accountResponse.accountId}`;\n this.operatorId = operatorId;\n return operatorId;\n }\n\n /**\n * Retrieves the account ID of the owner of an inbound topic\n * @param inboundTopicId The ID of the inbound topic\n * @returns The account ID of the owner of the inbound topic\n */\n public async retrieveInboundAccountId(\n inboundTopicId: string\n ): Promise<string> {\n const topicInfo = await this.mirrorNode.getTopicInfo(inboundTopicId);\n\n if (!topicInfo?.memo) {\n throw new Error('Failed to retrieve topic info');\n }\n\n const topicInfoMemo = topicInfo.memo.toString();\n const topicInfoParts = topicInfoMemo.split(':');\n const inboundAccountOwner = topicInfoParts?.[4];\n\n if (!inboundAccountOwner) {\n throw new Error('Failed to retrieve topic info account ID');\n }\n\n return inboundAccountOwner;\n }\n\n public clearCache(): void {\n HCS10Cache.getInstance().clear();\n }\n\n /**\n * Generates a standard HCS-10 memo string.\n * @param type The type of topic memo ('inbound', 'outbound', 'connection').\n * @param options Configuration options for the memo.\n * @returns The formatted memo string.\n * @protected\n */\n protected _generateHcs10Memo(\n type: Hcs10MemoType,\n options: {\n ttl?: number;\n accountId?: string;\n inboundTopicId?: string;\n connectionId?: number;\n }\n ): string {\n const ttl = options.ttl ?? 60; // Default TTL to 60 if not provided\n\n switch (type) {\n case Hcs10MemoType.INBOUND:\n if (!options.accountId) {\n throw new Error('accountId is required for inbound memo');\n }\n return `hcs-10:0:${ttl}:0:${options.accountId}`;\n case Hcs10MemoType.OUTBOUND:\n return `hcs-10:0:${ttl}:1`;\n case Hcs10MemoType.CONNECTION:\n if (!options.inboundTopicId || options.connectionId === undefined) {\n throw new Error(\n 'inboundTopicId and connectionId are required for connection memo'\n );\n }\n return `hcs-10:1:${ttl}:2:${options.inboundTopicId}:${options.connectionId}`;\n default:\n throw new Error(`Invalid HCS-10 memo type: ${type}`);\n }\n }\n\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string\n ): Promise<{ status: 'pending' | 'success' | 'failed' }> {\n try {\n const response = await fetch(`${baseUrl}/api/request-confirm`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Network': network,\n },\n body: JSON.stringify({ transaction_id: transactionId }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to confirm registration: ${response.statusText}`\n );\n }\n\n return await response.json();\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error checking registration status: ${error.message}`;\n this.logger.error(logMessage);\n throw error;\n }\n }\n\n /**\n * Validates if an operator_id follows the correct format (agentTopicId@accountId)\n * @param operatorId The operator ID to validate\n * @returns True if the format is valid, false otherwise\n */\n protected isValidOperatorId(operatorId: string): boolean {\n if (!operatorId) {\n return false;\n }\n\n const parts = operatorId.split('@');\n\n if (parts.length !== 2) {\n return false;\n }\n\n const agentTopicId = parts[0];\n const accountId = parts[1];\n\n if (!agentTopicId) {\n return false;\n }\n\n if (!accountId) {\n return false;\n }\n\n const hederaIdPattern = /^[0-9]+\\.[0-9]+\\.[0-9]+$/;\n\n if (!hederaIdPattern.test(accountId)) {\n return false;\n }\n\n if (!hederaIdPattern.test(agentTopicId)) {\n return false;\n }\n\n return true;\n }\n}\n\nexport class HCS10Cache {\n private static instance: HCS10Cache;\n private cache: Map<string, ProfileResponse>;\n private cacheExpiry: Map<string, number>;\n private readonly CACHE_TTL = 3600000;\n\n private constructor() {\n this.cache = new Map();\n this.cacheExpiry = new Map();\n }\n\n static getInstance(): HCS10Cache {\n if (!HCS10Cache.instance) {\n HCS10Cache.instance = new HCS10Cache();\n }\n return HCS10Cache.instance;\n }\n\n set(key: string, value: ProfileResponse): void {\n this.cache.set(key, value);\n this.cacheExpiry.set(key, Date.now() + this.CACHE_TTL);\n }\n\n get(key: string): ProfileResponse | undefined {\n const expiry = this.cacheExpiry.get(key);\n if (expiry && expiry > Date.now()) {\n return this.cache.get(key);\n }\n if (expiry) {\n this.cache.delete(key);\n this.cacheExpiry.delete(key);\n }\n return undefined;\n }\n\n clear(): void {\n this.cache.clear();\n this.cacheExpiry.clear();\n }\n}\n"],"names":["Hcs10MemoType"],"mappings":";;;;;;;AAYY,IAAA,kCAAAA,mBAAL;AACLA,iBAAA,SAAU,IAAA;AACVA,iBAAA,UAAW,IAAA;AACXA,iBAAA,YAAa,IAAA;AAHHA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AA6CL,MAAe,wBAAwB,aAAa;AAAA,EAQzD,YAAY,QAAqB;AACzB,UAAA;AACN,SAAK,UAAU,OAAO;AACjB,SAAA,SAAS,OAAO,YAAY;AAAA,MAC/B,OAAO,OAAO,YAAY;AAAA,MAC1B,QAAQ;AAAA,MACR,aAAa,OAAO;AAAA,IAAA,CACrB;AACD,S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,SAAK,YAAY,MAAM;AAAA,EAAA;AAE3B;"}
1
+ {"version":3,"file":"standards-sdk.es5.js","sources":["../../src/hcs-10/base-client.ts"],"sourcesContent":["import { Logger, LogLevel } from '../utils/logger';\nimport { Registration } from './registrations';\nimport { HCS11Client } from '../hcs-11/client';\nimport {\n AccountResponse,\n TopicResponse,\n ScheduleInfo,\n} from '../services/types';\nimport { TopicInfo } from '../services/types';\nimport { TransactionReceipt, PrivateKey, PublicKey } from '@hashgraph/sdk';\nimport axios from 'axios';\nimport { NetworkType } from '../utils/types';\nimport { HederaMirrorNode } from '../services';\nimport {\n WaitForConnectionConfirmationResponse,\n TransactMessage,\n} from './types';\nimport { HRLResolver } from '../utils/hrl-resolver';\n\nexport enum Hcs10MemoType {\n INBOUND = 'inbound',\n OUTBOUND = 'outbound',\n CONNECTION = 'connection',\n}\n\nexport interface HCS10Config {\n network: 'mainnet' | 'testnet';\n logLevel?: LogLevel;\n prettyPrint?: boolean;\n feeAmount?: number;\n}\n\nexport interface HCSMessage {\n p: 'hcs-10';\n op:\n | 'connection_request'\n | 'connection_created'\n | 'message'\n | 'close_connection'\n | 'transact';\n data: string;\n created?: Date;\n consensus_timestamp?: string;\n m?: string;\n payer: string;\n outbound_topic_id?: string;\n connection_request_id?: number;\n confirmed_request_id?: number;\n connection_topic_id?: string;\n connected_account_id?: string;\n requesting_account_id?: string;\n connection_id?: number;\n sequence_number: number;\n operator_id?: string;\n reason?: string;\n close_method?: string;\n schedule_id?: string;\n tx_id?: string;\n description?: string;\n timestamp?: number;\n}\n\nexport interface ProfileResponse {\n profile: any;\n topicInfo?: TopicInfo;\n success: boolean;\n error?: string;\n}\n\nexport abstract class HCS10BaseClient extends Registration {\n protected network: string;\n protected logger: Logger;\n protected feeAmount: number;\n public mirrorNode: HederaMirrorNode;\n\n protected operatorId: string;\n\n constructor(config: HCS10Config) {\n super();\n this.network = config.network;\n this.logger = Logger.getInstance({\n level: config.logLevel || 'info',\n module: 'HCS10-BaseClient',\n prettyPrint: config.prettyPrint,\n });\n this.mirrorNode = new HederaMirrorNode(\n config.network as NetworkType,\n this.logger\n );\n this.feeAmount = config.feeAmount || 0.001;\n }\n\n abstract submitPayload(\n topicId: string,\n payload: object | string,\n submitKey?: PrivateKey,\n requiresFee?: boolean\n ): Promise<TransactionReceipt>;\n\n abstract getAccountAndSigner(): { accountId: string; signer: any };\n\n public extractTopicFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 0) {\n return parts[0];\n }\n return '';\n }\n\n public extractAccountFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 1) {\n return parts[1];\n }\n return '';\n }\n\n /**\n * Get a stream of messages from a connection topic\n * @param topicId The connection topic ID to get messages from\n * @returns A stream of filtered messages valid for connection topics\n */\n public async getMessageStream(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n const validOps = ['message', 'close_connection', 'transact'];\n\n const filteredMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10' || !validOps.includes(msg.op)) {\n return false;\n }\n\n if (msg.op === 'message' || msg.op === 'close_connection') {\n if (!msg.operator_id) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n\n if (msg.op === 'message' && !msg.data) {\n return false;\n }\n }\n\n if (msg.op === 'transact') {\n if (\n !msg.operator_id ||\n !msg.schedule_id ||\n !msg.tx_id ||\n !msg.description\n ) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n\n return true;\n });\n\n return {\n messages: filteredMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n /**\n * Public method to retrieve topic information using the internal mirror node client.\n *\n * @param topicId The ID of the topic to query.\n * @returns Topic information or null if not found or an error occurs.\n */\n async getPublicTopicInfo(topicId: string): Promise<TopicResponse | null> {\n try {\n return await this.mirrorNode.getTopicInfo(topicId);\n } catch (error) {\n this.logger.error(\n `Error getting public topic info for ${topicId}:`,\n error\n );\n return null;\n }\n }\n\n /**\n * Checks if a user can submit to a topic and determines if a fee is required\n * @param topicId The topic ID to check\n * @param userAccountId The account ID of the user attempting to submit\n * @returns Object with canSubmit, requiresFee, and optional reason\n */\n public async canSubmitToTopic(\n topicId: string,\n userAccountId: string\n ): Promise<{ canSubmit: boolean; requiresFee: boolean; reason?: string }> {\n try {\n const topicInfo = await this.mirrorNode.getTopicInfo(topicId);\n\n if (!topicInfo) {\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'Topic does not exist',\n };\n }\n\n if (!topicInfo.submit_key?.key) {\n return { canSubmit: true, requiresFee: false };\n }\n\n try {\n const userPublicKey = await this.mirrorNode.getPublicKey(userAccountId);\n\n if (topicInfo.submit_key._type === 'ProtobufEncoded') {\n const keyBytes = Buffer.from(topicInfo.submit_key.key, 'hex');\n const hasAccess = await this.mirrorNode.checkKeyListAccess(\n keyBytes,\n userPublicKey\n );\n\n if (hasAccess) {\n return { canSubmit: true, requiresFee: false };\n }\n } else {\n const topicSubmitKey = PublicKey.fromString(topicInfo.submit_key.key);\n if (userPublicKey.toString() === topicSubmitKey.toString()) {\n return { canSubmit: true, requiresFee: false };\n }\n }\n } catch (error) {\n this.logger.error(\n `Key validation error: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n\n if (\n topicInfo.fee_schedule_key?.key &&\n topicInfo.custom_fees?.fixed_fees?.length > 0\n ) {\n return {\n canSubmit: true,\n requiresFee: true,\n reason: 'Requires fee payment via HIP-991',\n };\n }\n\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'User does not have submit permission for this topic',\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this.logger.error(`Topic submission validation error: ${errorMessage}`);\n return {\n canSubmit: false,\n requiresFee: false,\n reason: `Error: ${errorMessage}`,\n };\n }\n }\n\n /**\n * Get all messages from a topic\n * @param topicId The topic ID to get messages from\n * @returns All messages from the topic\n */\n public async getMessages(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n\n const validatedMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10') {\n return false;\n }\n\n if (msg.op === 'message') {\n if (!msg.data) {\n return false;\n }\n\n if (msg.operator_id) {\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n }\n\n return true;\n });\n\n return {\n messages: validatedMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n /**\n * Requests an account from the mirror node\n * @param account The account ID to request\n * @returns The account response\n */\n public async requestAccount(account: string): Promise<AccountResponse> {\n try {\n return await this.mirrorNode.requestAccount(account);\n } catch (e) {\n this.logger.error('Failed to fetch account', e);\n throw e;\n }\n }\n\n /**\n * Retrieves the memo for an account\n * @param accountId The account ID to retrieve the memo for\n * @returns The memo\n */\n public async getAccountMemo(accountId: string): Promise<string | null> {\n return await this.mirrorNode.getAccountMemo(accountId);\n }\n\n /**\n * Retrieves the profile for an account\n * @param accountId The account ID to retrieve the profile for\n * @param disableCache Whether to disable caching of the result\n * @returns The profile\n */\n public async retrieveProfile(\n accountId: string,\n disableCache?: boolean\n ): Promise<ProfileResponse> {\n this.logger.debug(`Retrieving profile for account: ${accountId}`);\n\n const cacheKey = `${accountId}-${this.network}`;\n\n if (!disableCache) {\n const cachedProfileResponse = HCS10Cache.getInstance().get(cacheKey);\n if (cachedProfileResponse) {\n this.logger.debug(`Cache hit for profile: ${accountId}`);\n return cachedProfileResponse;\n }\n }\n try {\n const hcs11Client = new HCS11Client({\n network: this.network as 'mainnet' | 'testnet',\n auth: {\n operatorId: '0.0.0', // Read-only operations only\n },\n logLevel: 'info',\n });\n\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n this.network\n );\n\n if (!profileResult?.success) {\n this.logger.error(\n `Failed to retrieve profile for account ID: ${accountId}`,\n profileResult?.error\n );\n return {\n profile: null,\n success: false,\n error:\n profileResult?.error ||\n `Failed to retrieve profile for account ID: ${accountId}`,\n };\n }\n\n const profile = profileResult.profile;\n let topicInfo: TopicInfo | null = null;\n\n if (\n profileResult.topicInfo?.inboundTopic &&\n profileResult.topicInfo?.outboundTopic &&\n profileResult.topicInfo?.profileTopicId\n ) {\n topicInfo = {\n inboundTopic: profileResult.topicInfo.inboundTopic,\n outboundTopic: profileResult.topicInfo.outboundTopic,\n profileTopicId: profileResult.topicInfo.profileTopicId,\n };\n }\n\n const responseToCache: ProfileResponse = {\n profile,\n topicInfo,\n success: true,\n };\n HCS10Cache.getInstance().set(cacheKey, responseToCache);\n return responseToCache;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to retrieve profile: ${error.message}`;\n this.logger.error(logMessage);\n return {\n profile: null,\n success: false,\n error: logMessage,\n };\n }\n }\n\n /**\n * @deprecated Use retrieveCommunicationTopics instead\n * @param accountId The account ID to retrieve the outbound connect topic for\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveOutboundConnectTopic(\n accountId: string\n ): Promise<TopicInfo> {\n return await this.retrieveCommunicationTopics(accountId, true);\n }\n\n /**\n * Retrieves the communication topics for an account\n * @param accountId The account ID to retrieve the communication topics for\n * @param disableCache Whether to disable caching of the result\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveCommunicationTopics(\n accountId: string,\n disableCache?: boolean\n ): Promise<TopicInfo> {\n try {\n const profileResponse = await this.retrieveProfile(\n accountId,\n disableCache\n );\n\n if (!profileResponse?.success) {\n throw new Error(profileResponse.error || 'Failed to retrieve profile');\n }\n\n const profile = profileResponse.profile;\n\n if (!profile.inboundTopicId || !profile.outboundTopicId) {\n throw new Error(\n `Invalid HCS-11 profile for HCS-10 agent: missing inboundTopicId or outboundTopicId`\n );\n }\n\n if (!profileResponse.topicInfo) {\n throw new Error(\n `TopicInfo is missing in the profile for account ${accountId}`\n );\n }\n\n return profileResponse.topicInfo;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to retrieve topic info: ${error.message}`;\n this.logger.error(logMessage);\n throw error;\n }\n }\n\n /**\n * Retrieves outbound messages for an agent\n * @param agentAccountId The account ID of the agent\n * @returns The outbound messages\n */\n public async retrieveOutboundMessages(\n agentAccountId: string\n ): Promise<HCSMessage[]> {\n try {\n const topicInfo = await this.retrieveCommunicationTopics(agentAccountId);\n if (!topicInfo) {\n this.logger.warn(\n `No outbound connect topic found for agentAccountId: ${agentAccountId}`\n );\n return [];\n }\n const response = await this.getMessages(topicInfo.outboundTopic);\n return response.messages.filter(\n (msg) =>\n msg.p === 'hcs-10' &&\n (msg.op === 'connection_request' ||\n msg.op === 'connection_created' ||\n msg.op === 'message')\n );\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to retrieve outbound messages: ${error.message}`;\n this.logger.error(logMessage);\n return [];\n }\n }\n\n /**\n * Checks if a connection has been created for an agent\n * @param agentAccountId The account ID of the agent\n * @param connectionId The ID of the connection\n * @returns True if the connection has been created, false otherwise\n */\n public async hasConnectionCreated(\n agentAccountId: string,\n connectionId: number\n ): Promise<boolean> {\n try {\n const outBoundTopic = await this.retrieveCommunicationTopics(\n agentAccountId\n );\n const messages = await this.retrieveOutboundMessages(\n outBoundTopic.outboundTopic\n );\n return messages.some(\n (msg) =>\n msg.op === 'connection_created' && msg.connection_id === connectionId\n );\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Failed to check connection created: ${error.message}`;\n this.logger.error(logMessage);\n return false;\n }\n }\n\n /**\n * Gets message content, resolving any HRL references if needed\n * @param data The data string that may contain an HRL reference\n * @param forceRaw Whether to force returning raw binary data\n * @returns The resolved content\n */\n async getMessageContent(\n data: string,\n forceRaw = false\n ): Promise<string | ArrayBuffer> {\n if (!data.match(/^hcs:\\/\\/(\\d+)\\/([0-9]+\\.[0-9]+\\.[0-9]+)$/)) {\n return data;\n }\n\n try {\n const resolver = new HRLResolver(this.logger.getLevel());\n\n if (!resolver.isValidHRL(data)) {\n return data;\n }\n\n const result = await resolver.resolveHRL(data, {\n network: this.network as 'mainnet' | 'testnet',\n returnRaw: forceRaw,\n });\n\n return result.content;\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error resolving HRL reference: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Gets message content with its content type, resolving any HRL references if needed\n * @param data The data string that may contain an HRL reference\n * @param forceRaw Whether to force returning raw binary data\n * @returns The resolved content along with content type information\n */\n async getMessageContentWithType(\n data: string,\n forceRaw = false\n ): Promise<{\n content: string | ArrayBuffer;\n contentType: string;\n isBinary: boolean;\n }> {\n if (!data.match(/^hcs:\\/\\/(\\d+)\\/([0-9]+\\.[0-9]+\\.[0-9]+)$/)) {\n return {\n content: data,\n contentType: 'text/plain',\n isBinary: false,\n };\n }\n\n try {\n const resolver = new HRLResolver(this.logger.getLevel());\n\n return await resolver.getContentWithType(data, {\n network: this.network as 'mainnet' | 'testnet',\n returnRaw: forceRaw,\n });\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error resolving HRL reference with type: ${error.message}`;\n this.logger.error(logMessage);\n throw new Error(logMessage);\n }\n }\n\n /**\n * Submits a connection request to an inbound topic\n * @param inboundTopicId The ID of the inbound topic\n * @param memo An optional memo for the message\n * @returns The transaction receipt\n */\n async submitConnectionRequest(\n inboundTopicId: string,\n memo: string\n ): Promise<TransactionReceipt> {\n const accountResponse = this.getAccountAndSigner();\n if (!accountResponse?.accountId) {\n throw new Error('Operator account ID is not set');\n }\n const operatorId = await this.getOperatorId();\n const accountId = accountResponse.accountId;\n\n const submissionCheck = await this.canSubmitToTopic(\n inboundTopicId,\n accountId\n );\n\n if (!submissionCheck?.canSubmit) {\n throw new Error(`Cannot submit to topic: ${submissionCheck.reason}`);\n }\n\n const inboundAccountOwner = await this.retrieveInboundAccountId(\n inboundTopicId\n );\n\n if (!inboundAccountOwner) {\n throw new Error('Failed to retrieve topic info account ID');\n }\n\n const connectionRequestMessage = {\n p: 'hcs-10',\n op: 'connection_request',\n operator_id: operatorId,\n m: memo,\n };\n\n const requiresFee = submissionCheck.requiresFee;\n const response = await this.submitPayload(\n inboundTopicId,\n connectionRequestMessage,\n undefined,\n requiresFee\n );\n\n this.logger.info(\n `Submitted connection request to topic ID: ${inboundTopicId}`\n );\n\n const outboundTopic = await this.retrieveCommunicationTopics(accountId);\n\n if (!outboundTopic) {\n throw new Error('Failed to retrieve outbound topic');\n }\n\n const responseSequenceNumber = response.topicSequenceNumber?.toNumber();\n\n if (!responseSequenceNumber) {\n throw new Error('Failed to get response sequence number');\n }\n\n const requestorOperatorId = `${inboundTopicId}@${inboundAccountOwner}`;\n\n await this.submitPayload(outboundTopic.outboundTopic, {\n ...connectionRequestMessage,\n outbound_topic_id: outboundTopic.outboundTopic,\n connection_request_id: responseSequenceNumber,\n operator_id: requestorOperatorId,\n });\n\n return response;\n }\n\n /**\n * Records an outbound connection confirmation\n * @param outboundTopicId The ID of the outbound topic\n * @param connectionRequestId The ID of the connection request\n * @param confirmedRequestId The ID of the confirmed request\n * @param connectionTopicId The ID of the connection topic\n * @param operatorId The operator ID of the original message sender.\n * @param memo An optional memo for the message\n */\n public async recordOutboundConnectionConfirmation({\n outboundTopicId,\n requestorOutboundTopicId,\n connectionRequestId,\n confirmedRequestId,\n connectionTopicId,\n operatorId,\n memo,\n }: {\n outboundTopicId: string;\n requestorOutboundTopicId: string;\n connectionRequestId: number;\n confirmedRequestId: number;\n connectionTopicId: string;\n operatorId: string;\n memo: string;\n }): Promise<TransactionReceipt> {\n const payload = {\n p: 'hcs-10',\n op: 'connection_created',\n connection_topic_id: connectionTopicId,\n outbound_topic_id: outboundTopicId,\n requestor_outbound_topic_id: requestorOutboundTopicId,\n confirmed_request_id: confirmedRequestId,\n connection_request_id: connectionRequestId,\n operator_id: operatorId,\n m: memo,\n };\n return await this.submitPayload(outboundTopicId, payload);\n }\n\n /**\n * Waits for confirmation of a connection request\n * @param inboundTopicId Inbound topic ID\n * @param connectionRequestId Connection request ID\n * @param maxAttempts Maximum number of attempts\n * @param delayMs Delay between attempts in milliseconds\n * @returns Connection confirmation details\n */\n async waitForConnectionConfirmation(\n inboundTopicId: string,\n connectionRequestId: number,\n maxAttempts = 60,\n delayMs = 2000,\n recordConfirmation = true\n ): Promise<WaitForConnectionConfirmationResponse> {\n this.logger.info(\n `Waiting for connection confirmation on inbound topic ${inboundTopicId} for request ID ${connectionRequestId}`\n );\n\n for (let attempt = 0; attempt < maxAttempts; attempt++) {\n this.logger.info(\n `Attempt ${attempt + 1}/${maxAttempts} to find connection confirmation`\n );\n const messages = await this.mirrorNode.getTopicMessages(inboundTopicId);\n\n const connectionCreatedMessages = messages.filter(\n (m) => m.op === 'connection_created'\n );\n\n this.logger.info(\n `Found ${connectionCreatedMessages.length} connection_created messages`\n );\n\n if (connectionCreatedMessages.length > 0) {\n for (const message of connectionCreatedMessages) {\n if (Number(message.connection_id) === Number(connectionRequestId)) {\n const confirmationResult = {\n connectionTopicId: message.connection_topic_id,\n sequence_number: Number(message.sequence_number),\n confirmedBy: message.operator_id,\n memo: message.m,\n };\n\n const confirmedByAccountId = this.extractAccountFromOperatorId(\n confirmationResult.confirmedBy\n );\n\n const account = this.getAccountAndSigner();\n const confirmedByConnectionTopics =\n await this.retrieveCommunicationTopics(confirmedByAccountId);\n\n const agentConnectionTopics =\n await this.retrieveCommunicationTopics(account.accountId);\n\n this.logger.info(\n 'Connection confirmation found',\n confirmationResult\n );\n\n if (recordConfirmation) {\n /**\n * Record's the confirmation of the connection request from the\n * confirmedBy account to the agent account.\n */\n await this.recordOutboundConnectionConfirmation({\n requestorOutboundTopicId:\n confirmedByConnectionTopics.outboundTopic,\n outboundTopicId: agentConnectionTopics.outboundTopic,\n connectionRequestId,\n confirmedRequestId: confirmationResult.sequence_number,\n connectionTopicId: confirmationResult.connectionTopicId,\n operatorId: confirmationResult.confirmedBy,\n memo: confirmationResult.memo || 'Connection confirmed',\n });\n }\n\n return confirmationResult;\n }\n }\n }\n\n if (attempt < maxAttempts - 1) {\n this.logger.info(\n `No matching confirmation found, waiting ${delayMs}ms before retrying...`\n );\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n }\n }\n\n throw new Error(\n `Connection confirmation not found after ${maxAttempts} attempts for request ID ${connectionRequestId}`\n );\n }\n\n /**\n * Retrieves the operator ID for the current agent\n * @param disableCache Whether to disable caching of the result\n * @returns The operator ID\n */\n public async getOperatorId(disableCache?: boolean): Promise<string> {\n if (this.operatorId && !disableCache) {\n return this.operatorId;\n }\n\n const accountResponse = this.getAccountAndSigner();\n\n if (!accountResponse.accountId) {\n throw new Error('Operator ID not found');\n }\n\n const profile = await this.retrieveProfile(accountResponse.accountId);\n\n if (!profile.success) {\n throw new Error('Failed to retrieve profile');\n }\n\n const operatorId = `${profile.topicInfo?.inboundTopic}@${accountResponse.accountId}`;\n this.operatorId = operatorId;\n return operatorId;\n }\n\n /**\n * Retrieves the account ID of the owner of an inbound topic\n * @param inboundTopicId The ID of the inbound topic\n * @returns The account ID of the owner of the inbound topic\n */\n public async retrieveInboundAccountId(\n inboundTopicId: string\n ): Promise<string> {\n const topicInfo = await this.mirrorNode.getTopicInfo(inboundTopicId);\n\n if (!topicInfo?.memo) {\n throw new Error('Failed to retrieve topic info');\n }\n\n const topicInfoMemo = topicInfo.memo.toString();\n const topicInfoParts = topicInfoMemo.split(':');\n const inboundAccountOwner = topicInfoParts?.[4];\n\n if (!inboundAccountOwner) {\n throw new Error('Failed to retrieve topic info account ID');\n }\n\n return inboundAccountOwner;\n }\n\n public clearCache(): void {\n HCS10Cache.getInstance().clear();\n }\n\n /**\n * Generates a standard HCS-10 memo string.\n * @param type The type of topic memo ('inbound', 'outbound', 'connection').\n * @param options Configuration options for the memo.\n * @returns The formatted memo string.\n * @protected\n */\n protected _generateHcs10Memo(\n type: Hcs10MemoType,\n options: {\n ttl?: number;\n accountId?: string;\n inboundTopicId?: string;\n connectionId?: number;\n }\n ): string {\n const ttl = options.ttl ?? 60;\n\n switch (type) {\n case Hcs10MemoType.INBOUND:\n if (!options.accountId) {\n throw new Error('accountId is required for inbound memo');\n }\n return `hcs-10:0:${ttl}:0:${options.accountId}`;\n case Hcs10MemoType.OUTBOUND:\n return `hcs-10:0:${ttl}:1`;\n case Hcs10MemoType.CONNECTION:\n if (!options.inboundTopicId || options.connectionId === undefined) {\n throw new Error(\n 'inboundTopicId and connectionId are required for connection memo'\n );\n }\n return `hcs-10:1:${ttl}:2:${options.inboundTopicId}:${options.connectionId}`;\n default:\n throw new Error(`Invalid HCS-10 memo type: ${type}`);\n }\n }\n\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string\n ): Promise<{ status: 'pending' | 'success' | 'failed' }> {\n try {\n const response = await fetch(`${baseUrl}/api/request-confirm`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Network': network,\n },\n body: JSON.stringify({ transaction_id: transactionId }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to confirm registration: ${response.statusText}`\n );\n }\n\n return await response.json();\n } catch (e: any) {\n const error = e as Error;\n const logMessage = `Error checking registration status: ${error.message}`;\n this.logger.error(logMessage);\n throw error;\n }\n }\n\n /**\n * Validates if an operator_id follows the correct format (agentTopicId@accountId)\n * @param operatorId The operator ID to validate\n * @returns True if the format is valid, false otherwise\n */\n protected isValidOperatorId(operatorId: string): boolean {\n if (!operatorId) {\n return false;\n }\n\n const parts = operatorId.split('@');\n\n if (parts.length !== 2) {\n return false;\n }\n\n const agentTopicId = parts[0];\n const accountId = parts[1];\n\n if (!agentTopicId) {\n return false;\n }\n\n if (!accountId) {\n return false;\n }\n\n const hederaIdPattern = /^[0-9]+\\.[0-9]+\\.[0-9]+$/;\n\n if (!hederaIdPattern.test(accountId)) {\n return false;\n }\n\n if (!hederaIdPattern.test(agentTopicId)) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Retrieves all transaction requests from a topic\n * @param topicId The topic ID to retrieve transactions from\n * @param limit Optional maximum number of messages to retrieve\n * @returns Array of transaction requests sorted by timestamp (newest first)\n */\n public async getTransactionRequests(\n topicId: string,\n limit?: number\n ): Promise<TransactMessage[]> {\n this.logger.debug(`Retrieving transaction requests from topic ${topicId}`);\n\n const { messages } = await this.getMessageStream(topicId);\n\n const transactOperations = (\n messages\n .filter(\n (m) =>\n m.op === 'transact' && m.schedule_id && m.tx_id && m.description\n )\n .map((m) => ({\n operator_id: m.operator_id || '',\n schedule_id: m.schedule_id || '',\n tx_id: m.tx_id || '',\n description: m.description || '',\n timestamp: Number(m.created?.getTime()),\n memo: m.m,\n sequence_number: Number(m.sequence_number),\n })) as TransactMessage[]\n ).sort((a, b) => b.timestamp - a.timestamp);\n\n const result = limit\n ? transactOperations.slice(0, limit)\n : transactOperations;\n\n return result;\n }\n}\n\nexport class HCS10Cache {\n private static instance: HCS10Cache;\n private cache: Map<string, ProfileResponse>;\n private cacheExpiry: Map<string, number>;\n private readonly CACHE_TTL = 3600000;\n\n private constructor() {\n this.cache = new Map();\n this.cacheExpiry = new Map();\n }\n\n static getInstance(): HCS10Cache {\n if (!HCS10Cache.instance) {\n HCS10Cache.instance = new HCS10Cache();\n }\n return HCS10Cache.instance;\n }\n\n set(key: string, value: ProfileResponse): void {\n this.cache.set(key, value);\n this.cacheExpiry.set(key, Date.now() + this.CACHE_TTL);\n }\n\n get(key: string): ProfileResponse | undefined {\n const expiry = this.cacheExpiry.get(key);\n if (expiry && expiry > Date.now()) {\n return this.cache.get(key);\n }\n if (expiry) {\n this.cache.delete(key);\n this.cacheExpiry.delete(key);\n }\n return undefined;\n }\n\n clear(): void {\n this.cache.clear();\n this.cacheExpiry.clear();\n }\n}\n"],"names":["Hcs10MemoType"],"mappings":";;;;;;;AAmBY,IAAA,kCAAAA,mBAAL;AACLA,iBAAA,SAAU,IAAA;AACVA,iBAAA,UAAW,IAAA;AACX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B,aAAa,EAAE,eAAe;AAAA,MAC9B,OAAO,EAAE,SAAS;AAAA,MAClB,aAAa,EAAE,eAAe;AAAA,MAC9B,WAAW,OAAO,EAAE,SAAS,SAAS;AAAA,MACtC,MAAM,EAAE;AAAA,MACR,iBAAiB,OAAO,EAAE,eAAe;AAAA,IAAA,EACzC,EACJ,KAAK,CAAC,GAAG,MAAM,EAAE,YAAY,EAAE,SAAS;AAE1C,UAAM,SAAS,QACX,mBAAmB,MAAM,GAAG,KAAK,IACjC;AAEG,WAAA;AAAA,EAAA;AAEX;AAEO,MAAM,WAAW;AAAA,EAMd,cAAc;AAFtB,SAAiB,YAAY;AAGtB,SAAA,4BAAY,IAAI;AAChB,SAAA,kCAAkB,IAAI;AAAA,EAAA;AAAA,EAG7B,OAAO,cAA0B;AAC3B,QAAA,CAAC,WAAW,UAAU;AACb,iBAAA,WAAW,IAAI,WAAW;AAAA,IAAA;AAEvC,WAAO,WAAW;AAAA,EAAA;AAAA,EAGpB,IAAI,KAAa,OAA8B;AACxC,SAAA,MAAM,IAAI,KAAK,KAAK;AACzB,SAAK,YAAY,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,SAAS;AAAA,EAAA;AAAA,EAGvD,IAAI,KAA0C;AAC5C,UAAM,SAAS,KAAK,YAAY,IAAI,GAAG;AACvC,QAAI,UAAU,SAAS,KAAK,IAAA,GAAO;AAC1B,aAAA,KAAK,MAAM,IAAI,GAAG;AAAA,IAAA;AAE3B,QAAI,QAAQ;AACL,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,YAAY,OAAO,GAAG;AAAA,IAAA;AAEtB,WAAA;AAAA,EAAA;AAAA,EAGT,QAAc;AACZ,SAAK,MAAM,MAAM;AACjB,SAAK,YAAY,MAAM;AAAA,EAAA;AAE3B;"}
@@ -1,94 +1,123 @@
1
- import { assert, assertArgument } from "./standards-sdk.es49.js";
2
- function _getBytes(value, name, copy) {
3
- if (value instanceof Uint8Array) {
4
- if (copy) {
5
- return new Uint8Array(value);
1
+ var quickFormatUnescaped;
2
+ var hasRequiredQuickFormatUnescaped;
3
+ function requireQuickFormatUnescaped() {
4
+ if (hasRequiredQuickFormatUnescaped) return quickFormatUnescaped;
5
+ hasRequiredQuickFormatUnescaped = 1;
6
+ function tryStringify(o) {
7
+ try {
8
+ return JSON.stringify(o);
9
+ } catch (e) {
10
+ return '"[Circular]"';
6
11
  }
7
- return value;
8
12
  }
9
- if (typeof value === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {
10
- const result = new Uint8Array((value.length - 2) / 2);
11
- let offset = 2;
12
- for (let i = 0; i < result.length; i++) {
13
- result[i] = parseInt(value.substring(offset, offset + 2), 16);
14
- offset += 2;
13
+ quickFormatUnescaped = format;
14
+ function format(f, args, opts) {
15
+ var ss = opts && opts.stringify || tryStringify;
16
+ var offset = 1;
17
+ if (typeof f === "object" && f !== null) {
18
+ var len = args.length + offset;
19
+ if (len === 1) return f;
20
+ var objects = new Array(len);
21
+ objects[0] = ss(f);
22
+ for (var index = 1; index < len; index++) {
23
+ objects[index] = ss(args[index]);
24
+ }
25
+ return objects.join(" ");
15
26
  }
16
- return result;
17
- }
18
- assertArgument(false, "invalid BytesLike value", name || "value", value);
19
- }
20
- function getBytes(value, name) {
21
- return _getBytes(value, name, false);
22
- }
23
- function getBytesCopy(value, name) {
24
- return _getBytes(value, name, true);
25
- }
26
- function isHexString(value, length) {
27
- if (typeof value !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) {
28
- return false;
29
- }
30
- if (typeof length === "number" && value.length !== 2 + 2 * length) {
31
- return false;
32
- }
33
- if (length === true && value.length % 2 !== 0) {
34
- return false;
35
- }
36
- return true;
37
- }
38
- const HexCharacters = "0123456789abcdef";
39
- function hexlify(data) {
40
- const bytes = getBytes(data);
41
- let result = "0x";
42
- for (let i = 0; i < bytes.length; i++) {
43
- const v = bytes[i];
44
- result += HexCharacters[(v & 240) >> 4] + HexCharacters[v & 15];
45
- }
46
- return result;
47
- }
48
- function concat(datas) {
49
- return "0x" + datas.map((d) => hexlify(d).substring(2)).join("");
50
- }
51
- function dataSlice(data, start, end) {
52
- const bytes = getBytes(data);
53
- if (end != null && end > bytes.length) {
54
- assert(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", {
55
- buffer: bytes,
56
- length: bytes.length,
57
- offset: end
58
- });
59
- }
60
- return hexlify(bytes.slice(start == null ? 0 : start, end == null ? bytes.length : end));
61
- }
62
- function zeroPad(data, length, left) {
63
- const bytes = getBytes(data);
64
- assert(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", {
65
- buffer: new Uint8Array(bytes),
66
- length,
67
- offset: length + 1
68
- });
69
- const result = new Uint8Array(length);
70
- result.fill(0);
71
- if (left) {
72
- result.set(bytes, length - bytes.length);
73
- } else {
74
- result.set(bytes, 0);
27
+ if (typeof f !== "string") {
28
+ return f;
29
+ }
30
+ var argLen = args.length;
31
+ if (argLen === 0) return f;
32
+ var str = "";
33
+ var a = 1 - offset;
34
+ var lastPos = -1;
35
+ var flen = f && f.length || 0;
36
+ for (var i = 0; i < flen; ) {
37
+ if (f.charCodeAt(i) === 37 && i + 1 < flen) {
38
+ lastPos = lastPos > -1 ? lastPos : 0;
39
+ switch (f.charCodeAt(i + 1)) {
40
+ case 100:
41
+ // 'd'
42
+ case 102:
43
+ if (a >= argLen)
44
+ break;
45
+ if (args[a] == null) break;
46
+ if (lastPos < i)
47
+ str += f.slice(lastPos, i);
48
+ str += Number(args[a]);
49
+ lastPos = i + 2;
50
+ i++;
51
+ break;
52
+ case 105:
53
+ if (a >= argLen)
54
+ break;
55
+ if (args[a] == null) break;
56
+ if (lastPos < i)
57
+ str += f.slice(lastPos, i);
58
+ str += Math.floor(Number(args[a]));
59
+ lastPos = i + 2;
60
+ i++;
61
+ break;
62
+ case 79:
63
+ // 'O'
64
+ case 111:
65
+ // 'o'
66
+ case 106:
67
+ if (a >= argLen)
68
+ break;
69
+ if (args[a] === void 0) break;
70
+ if (lastPos < i)
71
+ str += f.slice(lastPos, i);
72
+ var type = typeof args[a];
73
+ if (type === "string") {
74
+ str += "'" + args[a] + "'";
75
+ lastPos = i + 2;
76
+ i++;
77
+ break;
78
+ }
79
+ if (type === "function") {
80
+ str += args[a].name || "<anonymous>";
81
+ lastPos = i + 2;
82
+ i++;
83
+ break;
84
+ }
85
+ str += ss(args[a]);
86
+ lastPos = i + 2;
87
+ i++;
88
+ break;
89
+ case 115:
90
+ if (a >= argLen)
91
+ break;
92
+ if (lastPos < i)
93
+ str += f.slice(lastPos, i);
94
+ str += String(args[a]);
95
+ lastPos = i + 2;
96
+ i++;
97
+ break;
98
+ case 37:
99
+ if (lastPos < i)
100
+ str += f.slice(lastPos, i);
101
+ str += "%";
102
+ lastPos = i + 2;
103
+ i++;
104
+ a--;
105
+ break;
106
+ }
107
+ ++a;
108
+ }
109
+ ++i;
110
+ }
111
+ if (lastPos === -1)
112
+ return f;
113
+ else if (lastPos < flen) {
114
+ str += f.slice(lastPos);
115
+ }
116
+ return str;
75
117
  }
76
- return hexlify(result);
77
- }
78
- function zeroPadValue(data, length) {
79
- return zeroPad(data, length, true);
80
- }
81
- function zeroPadBytes(data, length) {
82
- return zeroPad(data, length, false);
118
+ return quickFormatUnescaped;
83
119
  }
84
120
  export {
85
- concat,
86
- dataSlice,
87
- getBytes,
88
- getBytesCopy,
89
- hexlify,
90
- isHexString,
91
- zeroPadBytes,
92
- zeroPadValue
121
+ requireQuickFormatUnescaped as __require
93
122
  };
94
123
  //# sourceMappingURL=standards-sdk.es50.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es50.js","sources":["../../node_modules/ethers/lib.esm/utils/data.js"],"sourcesContent":["/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { assert, assertArgument } from \"./errors.js\";\nfunction _getBytes(value, name, copy) {\n if (value instanceof Uint8Array) {\n if (copy) {\n return new Uint8Array(value);\n }\n return value;\n }\n if (typeof (value) === \"string\" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value, name) {\n return _getBytes(value, name, false);\n}\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value, name) {\n return _getBytes(value, name, true);\n}\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value, length) {\n if (typeof (value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false;\n }\n if (typeof (length) === \"number\" && value.length !== 2 + 2 * length) {\n return false;\n }\n if (length === true && (value.length % 2) !== 0) {\n return false;\n }\n return true;\n}\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value) {\n return (isHexString(value, true) || (value instanceof Uint8Array));\n}\nconst HexCharacters = \"0123456789abcdef\";\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(data) {\n const bytes = getBytes(data);\n let result = \"0x\";\n for (let i = 0; i < bytes.length; i++) {\n const v = bytes[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n}\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(datas) {\n return \"0x\" + datas.map((d) => hexlify(d).substring(2)).join(\"\");\n}\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data) {\n if (isHexString(data, true)) {\n return (data.length - 2) / 2;\n }\n return getBytes(data).length;\n}\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data, start, end) {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes, length: bytes.length, offset: end\n });\n }\n return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end));\n}\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data) {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) {\n bytes = bytes.substring(2);\n }\n return \"0x\" + bytes;\n}\nfunction zeroPad(data, length, left) {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1\n });\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n }\n else {\n result.set(bytes, 0);\n }\n return hexlify(result);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data, length) {\n return zeroPad(data, length, true);\n}\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data, length) {\n return zeroPad(data, length, false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;AACX;AAKO,SAAS,OAAO,OAAO;AAC1B,SAAO,OAAO,MAAM,IAAI,CAAC,MAAM,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE;AACnE;AAgBO,SAAS,UAAU,MAAM,OAAO,KAAK;AACxC,QAAM,QAAQ,SAAS,IAAI;AAC3B,MAAI,OAAO,QAAQ,MAAM,MAAM,QAAQ;AACnC,WAAO,OAAO,mCAAmC,kBAAkB;AAAA,MAC/D,QAAQ;AAAA,MAAO,QAAQ,MAAM;AAAA,MAAQ,QAAQ;AAAA,IACzD,CAAS;AAAA,EACT;AACI,SAAO,QAAQ,MAAM,MAAO,SAAS,OAAQ,IAAI,OAAQ,OAAO,OAAQ,MAAM,SAAS,GAAG,CAAC;AAC/F;AAYA,SAAS,QAAQ,MAAM,QAAQ,MAAM;AACjC,QAAM,QAAQ,SAAS,IAAI;AAC3B,SAAO,UAAU,MAAM,QAAQ,+BAA+B,kBAAkB;AAAA,IAC5E,QAAQ,IAAI,WAAW,KAAK;AAAA,IAC5B;AAAA,IACA,QAAQ,SAAS;AAAA,EACzB,CAAK;AACD,QAAM,SAAS,IAAI,WAAW,MAAM;AACpC,SAAO,KAAK,CAAC;AACb,MAAI,MAAM;AACN,WAAO,IAAI,OAAO,SAAS,MAAM,MAAM;AAAA,EAC/C,OACS;AACD,WAAO,IAAI,OAAO,CAAC;AAAA,EAC3B;AACI,SAAO,QAAQ,MAAM;AACzB;AAWO,SAAS,aAAa,MAAM,QAAQ;AACvC,SAAO,QAAQ,MAAM,QAAQ,IAAI;AACrC;AAWO,SAAS,aAAa,MAAM,QAAQ;AACvC,SAAO,QAAQ,MAAM,QAAQ,KAAK;AACtC;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"standards-sdk.es50.js","sources":["../../node_modules/quick-format-unescaped/index.js"],"sourcesContent":["'use strict'\nfunction tryStringify (o) {\n try { return JSON.stringify(o) } catch(e) { return '\"[Circular]\"' }\n}\n\nmodule.exports = format\n\nfunction format(f, args, opts) {\n var ss = (opts && opts.stringify) || tryStringify\n var offset = 1\n if (typeof f === 'object' && f !== null) {\n var len = args.length + offset\n if (len === 1) return f\n var objects = new Array(len)\n objects[0] = ss(f)\n for (var index = 1; index < len; index++) {\n objects[index] = ss(args[index])\n }\n return objects.join(' ')\n }\n if (typeof f !== 'string') {\n return f\n }\n var argLen = args.length\n if (argLen === 0) return f\n var str = ''\n var a = 1 - offset\n var lastPos = -1\n var flen = (f && f.length) || 0\n for (var i = 0; i < flen;) {\n if (f.charCodeAt(i) === 37 && i + 1 < flen) {\n lastPos = lastPos > -1 ? lastPos : 0\n switch (f.charCodeAt(i + 1)) {\n case 100: // 'd'\n case 102: // 'f'\n if (a >= argLen)\n break\n if (args[a] == null) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += Number(args[a])\n lastPos = i + 2\n i++\n break\n case 105: // 'i'\n if (a >= argLen)\n break\n if (args[a] == null) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += Math.floor(Number(args[a]))\n lastPos = i + 2\n i++\n break\n case 79: // 'O'\n case 111: // 'o'\n case 106: // 'j'\n if (a >= argLen)\n break\n if (args[a] === undefined) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n var type = typeof args[a]\n if (type === 'string') {\n str += '\\'' + args[a] + '\\''\n lastPos = i + 2\n i++\n break\n }\n if (type === 'function') {\n str += args[a].name || '<anonymous>'\n lastPos = i + 2\n i++\n break\n }\n str += ss(args[a])\n lastPos = i + 2\n i++\n break\n case 115: // 's'\n if (a >= argLen)\n break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += String(args[a])\n lastPos = i + 2\n i++\n break\n case 37: // '%'\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += '%'\n lastPos = i + 2\n i++\n a--\n break\n }\n ++a\n }\n ++i\n }\n if (lastPos === -1)\n return f\n else if (lastPos < flen) {\n str += f.slice(lastPos)\n }\n\n return str\n}\n"],"names":[],"mappings":";;;;;AACA,WAAS,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AAI,UAAU;AACZ,qBAAO,EAAE,MAAM,SAAS,CAAC;AAC3B,mBAAO,KAAK,MAAM,OAAO,KAAK,CAAC,CAAC,CAAC;AACjC,sBAAU,IAAI;AACd;AACA;AAAA,UACF,KAAK;AAAA;AAAA,UACL,KAAK;AAAA;AAAA,UACL,KAAK;AACH,gBAAI,KAAK;AACP;AACF,gBAAI,KAAK,CAAC,MAAM,OAAW;AAC3B,gBAAI,UAAU;AACZ,qBAAO,EAAE,MAAM,SAAS,CAAC;AAC3B,gBAAI,OAAO,OAAO,KAAK,CAAC;AACxB,gBAAI,SAAS,UAAU;AACrB,qBAAO,MAAO,KAAK,CAAC,IAAI;AACxB,wBAAU,IAAI;AACd;AACA;AAAA,YACZ;AACU,gBAAI,SAAS,YAAY;AACvB,qBAAO,KAAK,CAAC,EAAE,QAAQ;AACvB,wBAAU,IAAI;AACd;AACA;AAAA,YACZ;AACU,mBAAO,GAAG,KAAK,CAAC,CAAC;AACjB,sBAAU,IAAI;AACd;AACA;AAAA,UACF,KAAK;AACH,gBAAI,KAAK;AACP;AACF,gBAAI,UAAU;AACZ,qBAAO,EAAE,MAAM,SAAS,CAAC;AAC3B,mBAAO,OAAO,KAAK,CAAC,CAAC;AACrB,sBAAU,IAAI;AACd;AACA;AAAA,UACF,KAAK;AACH,gBAAI,UAAU;AACZ,qBAAO,EAAE,MAAM,SAAS,CAAC;AAC3B,mBAAO;AACP,sBAAU,IAAI;AACd;AACA;AACA;AAAA,QACV;AACM,UAAE;AAAA,MACR;AACI,QAAE;AAAA,IACN;AACE,QAAI,YAAY;AACd,aAAO;AAAA,aACA,UAAU,MAAM;AACvB,aAAO,EAAE,MAAM,OAAO;AAAA,IAC1B;AAEE,WAAO;AAAA,EACT;;;","x_google_ignoreList":[0]}
@@ -1,87 +1,7 @@
1
- import { keccak256 } from "./standards-sdk.es55.js";
2
- import { assertArgument } from "./standards-sdk.es49.js";
3
- import { getBytes } from "./standards-sdk.es50.js";
4
- const BN_0 = BigInt(0);
5
- const BN_36 = BigInt(36);
6
- function getChecksumAddress(address) {
7
- address = address.toLowerCase();
8
- const chars = address.substring(2).split("");
9
- const expanded = new Uint8Array(40);
10
- for (let i = 0; i < 40; i++) {
11
- expanded[i] = chars[i].charCodeAt(0);
12
- }
13
- const hashed = getBytes(keccak256(expanded));
14
- for (let i = 0; i < 40; i += 2) {
15
- if (hashed[i >> 1] >> 4 >= 8) {
16
- chars[i] = chars[i].toUpperCase();
17
- }
18
- if ((hashed[i >> 1] & 15) >= 8) {
19
- chars[i + 1] = chars[i + 1].toUpperCase();
20
- }
21
- }
22
- return "0x" + chars.join("");
23
- }
24
- const ibanLookup = {};
25
- for (let i = 0; i < 10; i++) {
26
- ibanLookup[String(i)] = String(i);
27
- }
28
- for (let i = 0; i < 26; i++) {
29
- ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
30
- }
31
- const safeDigits = 15;
32
- function ibanChecksum(address) {
33
- address = address.toUpperCase();
34
- address = address.substring(4) + address.substring(0, 2) + "00";
35
- let expanded = address.split("").map((c) => {
36
- return ibanLookup[c];
37
- }).join("");
38
- while (expanded.length >= safeDigits) {
39
- let block = expanded.substring(0, safeDigits);
40
- expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);
41
- }
42
- let checksum = String(98 - parseInt(expanded, 10) % 97);
43
- while (checksum.length < 2) {
44
- checksum = "0" + checksum;
45
- }
46
- return checksum;
47
- }
48
- const Base36 = function() {
49
- const result = {};
50
- for (let i = 0; i < 36; i++) {
51
- const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i];
52
- result[key] = BigInt(i);
53
- }
54
- return result;
55
- }();
56
- function fromBase36(value) {
57
- value = value.toLowerCase();
58
- let result = BN_0;
59
- for (let i = 0; i < value.length; i++) {
60
- result = result * BN_36 + Base36[value[i]];
61
- }
62
- return result;
63
- }
64
- function getAddress(address) {
65
- assertArgument(typeof address === "string", "invalid address", "address", address);
66
- if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
67
- if (!address.startsWith("0x")) {
68
- address = "0x" + address;
69
- }
70
- const result = getChecksumAddress(address);
71
- assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address);
72
- return result;
73
- }
74
- if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
75
- assertArgument(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address);
76
- let result = fromBase36(address.substring(4)).toString(16);
77
- while (result.length < 40) {
78
- result = "0" + result;
79
- }
80
- return getChecksumAddress("0x" + result);
81
- }
82
- assertArgument(false, "invalid address", "address", address);
1
+ function getDefaultExportFromCjs(x) {
2
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
83
3
  }
84
4
  export {
85
- getAddress
5
+ getDefaultExportFromCjs
86
6
  };
87
7
  //# sourceMappingURL=standards-sdk.es51.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"standards-sdk.es51.js","sources":["../../node_modules/ethers/lib.esm/address/address.js"],"sourcesContent":["import { keccak256 } from \"../crypto/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\nconst BN_0 = BigInt(0);\nconst BN_36 = BigInt(36);\nfunction getChecksumAddress(address) {\n // if (!isHexString(address, 20)) {\n // logger.throwArgumentError(\"invalid address\", \"address\", address);\n // }\n address = address.toLowerCase();\n const chars = address.substring(2).split(\"\");\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n const hashed = getBytes(keccak256(expanded));\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n return \"0x\" + chars.join(\"\");\n}\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n// Create lookup table\nconst ibanLookup = {};\nfor (let i = 0; i < 10; i++) {\n ibanLookup[String(i)] = String(i);\n}\nfor (let i = 0; i < 26; i++) {\n ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);\n}\n// How many decimal digits can we process? (for 64-bit float, this is 15)\n// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));\nconst safeDigits = 15;\nfunction ibanChecksum(address) {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits) {\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) {\n checksum = \"0\" + checksum;\n }\n return checksum;\n}\n;\nconst Base36 = (function () {\n ;\n const result = {};\n for (let i = 0; i < 36; i++) {\n const key = \"0123456789abcdefghijklmnopqrstuvwxyz\"[i];\n result[key] = BigInt(i);\n }\n return result;\n})();\nfunction fromBase36(value) {\n value = value.toLowerCase();\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result = result * BN_36 + Base36[value[i]];\n }\n return result;\n}\n/**\n * Returns a normalized and checksumed address for %%address%%.\n * This accepts non-checksum addresses, checksum addresses and\n * [[getIcapAddress]] formats.\n *\n * The checksum in Ethereum uses the capitalization (upper-case\n * vs lower-case) of the characters within an address to encode\n * its checksum, which offers, on average, a checksum of 15-bits.\n *\n * If %%address%% contains both upper-case and lower-case, it is\n * assumed to already be a checksum address and its checksum is\n * validated, and if the address fails its expected checksum an\n * error is thrown.\n *\n * If you wish the checksum of %%address%% to be ignore, it should\n * be converted to lower-case (i.e. ``.toLowercase()``) before\n * being passed in. This should be a very rare situation though,\n * that you wish to bypass the safegaurds in place to protect\n * against an address that has been incorrectly copied from another\n * source.\n *\n * @example:\n * // Adds the checksum (via upper-casing specific letters)\n * getAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\")\n * //_result:\n *\n * // Converts ICAP address and adds checksum\n * getAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if an address contains mixed case,\n * // but the checksum fails\n * getAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_error:\n */\nexport function getAddress(address) {\n assertArgument(typeof (address) === \"string\", \"invalid address\", \"address\", address);\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n // Missing the 0x prefix\n if (!address.startsWith(\"0x\")) {\n address = \"0x\" + address;\n }\n const result = getChecksumAddress(address);\n // It is a checksummed address with a bad checksum\n assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, \"bad address checksum\", \"address\", address);\n return result;\n }\n // Maybe ICAP? (we only support direct mode)\n if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n assertArgument(address.substring(2, 4) === ibanChecksum(address), \"bad icap checksum\", \"address\", address);\n let result = fromBase36(address.substring(4)).toString(16);\n while (result.length < 40) {\n result = \"0\" + result;\n }\n return getChecksumAddress(\"0x\" + result);\n }\n assertArgument(false, \"invalid address\", \"address\", address);\n}\n/**\n * The [ICAP Address format](link-icap) format is an early checksum\n * format which attempts to be compatible with the banking\n * industry [IBAN format](link-wiki-iban) for bank accounts.\n *\n * It is no longer common or a recommended format.\n *\n * @example:\n * getIcapAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\");\n * //_result:\n *\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if the ICAP checksum is wrong\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37\");\n * //_error:\n */\nexport function getIcapAddress(address) {\n //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();\n let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();\n while (base36.length < 30) {\n base36 = \"0\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