@hashgraphonline/standards-agent-kit 0.2.137 → 0.2.139

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 (195) hide show
  1. package/dist/cjs/builders/hcs10/hcs10-builder.d.ts +1 -0
  2. package/dist/cjs/builders/hcs2/hcs2-builder.d.ts +8 -7
  3. package/dist/cjs/builders/hcs6/hcs6-builder.d.ts +5 -4
  4. package/dist/cjs/index.d.ts +4 -0
  5. package/dist/cjs/signing/bytes-registry.d.ts +17 -0
  6. package/dist/cjs/signing/signer-provider.d.ts +45 -0
  7. package/dist/cjs/standards-agent-kit.cjs +1 -1
  8. package/dist/cjs/standards-agent-kit.cjs.map +1 -1
  9. package/dist/cjs/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  10. package/dist/cjs/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  11. package/dist/cjs/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  12. package/dist/cjs/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  13. package/dist/cjs/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  14. package/dist/cjs/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  15. package/dist/cjs/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  16. package/dist/cjs/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  17. package/dist/cjs/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  18. package/dist/cjs/tools/inscriber/InscribeHashinalTool.d.ts +4 -4
  19. package/dist/cjs/types/tx-results.d.ts +15 -0
  20. package/dist/cjs/utils/CodedError.d.ts +4 -0
  21. package/dist/cjs/validation/hip412-schemas.d.ts +2 -2
  22. package/dist/es/builders/hcs10/hcs10-builder.d.ts +1 -0
  23. package/dist/es/builders/hcs2/hcs2-builder.d.ts +8 -7
  24. package/dist/es/builders/hcs6/hcs6-builder.d.ts +5 -4
  25. package/dist/es/index.d.ts +4 -0
  26. package/dist/es/signing/bytes-registry.d.ts +17 -0
  27. package/dist/es/signing/signer-provider.d.ts +45 -0
  28. package/dist/es/standards-agent-kit.es.js +46 -42
  29. package/dist/es/standards-agent-kit.es.js.map +1 -1
  30. package/dist/es/standards-agent-kit.es10.js +24 -83
  31. package/dist/es/standards-agent-kit.es10.js.map +1 -1
  32. package/dist/es/standards-agent-kit.es11.js +224 -20
  33. package/dist/es/standards-agent-kit.es11.js.map +1 -1
  34. package/dist/es/standards-agent-kit.es12.js +78 -27
  35. package/dist/es/standards-agent-kit.es12.js.map +1 -1
  36. package/dist/es/standards-agent-kit.es13.js +26 -36
  37. package/dist/es/standards-agent-kit.es13.js.map +1 -1
  38. package/dist/es/standards-agent-kit.es14.js +17 -39
  39. package/dist/es/standards-agent-kit.es14.js.map +1 -1
  40. package/dist/es/standards-agent-kit.es15.js +36 -58
  41. package/dist/es/standards-agent-kit.es15.js.map +1 -1
  42. package/dist/es/standards-agent-kit.es16.js +45 -18
  43. package/dist/es/standards-agent-kit.es16.js.map +1 -1
  44. package/dist/es/standards-agent-kit.es17.js +53 -16
  45. package/dist/es/standards-agent-kit.es17.js.map +1 -1
  46. package/dist/es/standards-agent-kit.es18.js +18 -28
  47. package/dist/es/standards-agent-kit.es18.js.map +1 -1
  48. package/dist/es/standards-agent-kit.es19.js +26 -12
  49. package/dist/es/standards-agent-kit.es19.js.map +1 -1
  50. package/dist/es/standards-agent-kit.es20.js +38 -136
  51. package/dist/es/standards-agent-kit.es20.js.map +1 -1
  52. package/dist/es/standards-agent-kit.es21.js +13 -24
  53. package/dist/es/standards-agent-kit.es21.js.map +1 -1
  54. package/dist/es/standards-agent-kit.es22.js +136 -39
  55. package/dist/es/standards-agent-kit.es22.js.map +1 -1
  56. package/dist/es/standards-agent-kit.es23.js +25 -41
  57. package/dist/es/standards-agent-kit.es23.js.map +1 -1
  58. package/dist/es/standards-agent-kit.es24.js +49 -31
  59. package/dist/es/standards-agent-kit.es24.js.map +1 -1
  60. package/dist/es/standards-agent-kit.es25.js +34 -18
  61. package/dist/es/standards-agent-kit.es25.js.map +1 -1
  62. package/dist/es/standards-agent-kit.es26.js +35 -19
  63. package/dist/es/standards-agent-kit.es26.js.map +1 -1
  64. package/dist/es/standards-agent-kit.es27.js +45 -32
  65. package/dist/es/standards-agent-kit.es27.js.map +1 -1
  66. package/dist/es/standards-agent-kit.es28.js +54 -25
  67. package/dist/es/standards-agent-kit.es28.js.map +1 -1
  68. package/dist/es/standards-agent-kit.es29.js +35 -23
  69. package/dist/es/standards-agent-kit.es29.js.map +1 -1
  70. package/dist/es/standards-agent-kit.es3.js +41 -1549
  71. package/dist/es/standards-agent-kit.es3.js.map +1 -1
  72. package/dist/es/standards-agent-kit.es30.js +23 -39
  73. package/dist/es/standards-agent-kit.es30.js.map +1 -1
  74. package/dist/es/standards-agent-kit.es31.js +30 -28
  75. package/dist/es/standards-agent-kit.es31.js.map +1 -1
  76. package/dist/es/standards-agent-kit.es32.js +45 -32
  77. package/dist/es/standards-agent-kit.es32.js.map +1 -1
  78. package/dist/es/standards-agent-kit.es33.js +50 -89
  79. package/dist/es/standards-agent-kit.es33.js.map +1 -1
  80. package/dist/es/standards-agent-kit.es34.js +35 -234
  81. package/dist/es/standards-agent-kit.es34.js.map +1 -1
  82. package/dist/es/standards-agent-kit.es35.js +87 -213
  83. package/dist/es/standards-agent-kit.es35.js.map +1 -1
  84. package/dist/es/standards-agent-kit.es36.js +185 -129
  85. package/dist/es/standards-agent-kit.es36.js.map +1 -1
  86. package/dist/es/standards-agent-kit.es37.js +167 -563
  87. package/dist/es/standards-agent-kit.es37.js.map +1 -1
  88. package/dist/es/standards-agent-kit.es38.js +244 -30
  89. package/dist/es/standards-agent-kit.es38.js.map +1 -1
  90. package/dist/es/standards-agent-kit.es39.js +483 -206
  91. package/dist/es/standards-agent-kit.es39.js.map +1 -1
  92. package/dist/es/standards-agent-kit.es4.js +359 -81
  93. package/dist/es/standards-agent-kit.es4.js.map +1 -1
  94. package/dist/es/standards-agent-kit.es40.js +39 -135
  95. package/dist/es/standards-agent-kit.es40.js.map +1 -1
  96. package/dist/es/standards-agent-kit.es41.js +244 -28
  97. package/dist/es/standards-agent-kit.es41.js.map +1 -1
  98. package/dist/es/standards-agent-kit.es42.js +132 -418
  99. package/dist/es/standards-agent-kit.es42.js.map +1 -1
  100. package/dist/es/standards-agent-kit.es43.js +28 -184
  101. package/dist/es/standards-agent-kit.es43.js.map +1 -1
  102. package/dist/es/standards-agent-kit.es44.js +423 -3
  103. package/dist/es/standards-agent-kit.es44.js.map +1 -1
  104. package/dist/es/standards-agent-kit.es45.js +185 -24
  105. package/dist/es/standards-agent-kit.es45.js.map +1 -1
  106. package/dist/es/standards-agent-kit.es46.js +3 -3
  107. package/dist/es/standards-agent-kit.es46.js.map +1 -1
  108. package/dist/es/standards-agent-kit.es47.js +24 -20
  109. package/dist/es/standards-agent-kit.es47.js.map +1 -1
  110. package/dist/es/standards-agent-kit.es48.js +6 -52
  111. package/dist/es/standards-agent-kit.es48.js.map +1 -1
  112. package/dist/es/standards-agent-kit.es49.js +4 -3
  113. package/dist/es/standards-agent-kit.es49.js.map +1 -1
  114. package/dist/es/standards-agent-kit.es5.js +1747 -73
  115. package/dist/es/standards-agent-kit.es5.js.map +1 -1
  116. package/dist/es/standards-agent-kit.es50.js +3 -39
  117. package/dist/es/standards-agent-kit.es50.js.map +1 -1
  118. package/dist/es/standards-agent-kit.es51.js +18 -16
  119. package/dist/es/standards-agent-kit.es51.js.map +1 -1
  120. package/dist/es/standards-agent-kit.es52.js +48 -68
  121. package/dist/es/standards-agent-kit.es52.js.map +1 -1
  122. package/dist/es/standards-agent-kit.es53.js +6 -0
  123. package/dist/es/standards-agent-kit.es53.js.map +1 -0
  124. package/dist/es/standards-agent-kit.es54.js +43 -0
  125. package/dist/es/standards-agent-kit.es54.js.map +1 -0
  126. package/dist/es/standards-agent-kit.es55.js +22 -0
  127. package/dist/es/standards-agent-kit.es55.js.map +1 -0
  128. package/dist/es/standards-agent-kit.es56.js +77 -0
  129. package/dist/es/standards-agent-kit.es56.js.map +1 -0
  130. package/dist/es/standards-agent-kit.es6.js +332 -173
  131. package/dist/es/standards-agent-kit.es6.js.map +1 -1
  132. package/dist/es/standards-agent-kit.es7.js +142 -293
  133. package/dist/es/standards-agent-kit.es7.js.map +1 -1
  134. package/dist/es/standards-agent-kit.es8.js +201 -21
  135. package/dist/es/standards-agent-kit.es8.js.map +1 -1
  136. package/dist/es/standards-agent-kit.es9.js +301 -213
  137. package/dist/es/standards-agent-kit.es9.js.map +1 -1
  138. package/dist/es/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  139. package/dist/es/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  140. package/dist/es/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  141. package/dist/es/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  142. package/dist/es/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  143. package/dist/es/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  144. package/dist/es/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  145. package/dist/es/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  146. package/dist/es/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  147. package/dist/es/tools/inscriber/InscribeHashinalTool.d.ts +4 -4
  148. package/dist/es/types/tx-results.d.ts +15 -0
  149. package/dist/es/utils/CodedError.d.ts +4 -0
  150. package/dist/es/validation/hip412-schemas.d.ts +2 -2
  151. package/dist/umd/builders/hcs10/hcs10-builder.d.ts +1 -0
  152. package/dist/umd/builders/hcs2/hcs2-builder.d.ts +8 -7
  153. package/dist/umd/builders/hcs6/hcs6-builder.d.ts +5 -4
  154. package/dist/umd/index.d.ts +4 -0
  155. package/dist/umd/signing/bytes-registry.d.ts +17 -0
  156. package/dist/umd/signing/signer-provider.d.ts +45 -0
  157. package/dist/umd/standards-agent-kit.umd.js +1 -1
  158. package/dist/umd/standards-agent-kit.umd.js.map +1 -1
  159. package/dist/umd/tools/hcs10/InitiateConnectionTool.d.ts +4 -4
  160. package/dist/umd/tools/hcs2/CreateRegistryTool.d.ts +2 -2
  161. package/dist/umd/tools/hcs2/DeleteEntryTool.d.ts +2 -2
  162. package/dist/umd/tools/hcs2/UpdateEntryTool.d.ts +2 -2
  163. package/dist/umd/tools/hcs6/RegisterDynamicHashinalTool.d.ts +10 -10
  164. package/dist/umd/tools/hcs6/UpdateDynamicHashinalTool.d.ts +8 -8
  165. package/dist/umd/tools/inscriber/InscribeFromBufferTool.d.ts +5 -4
  166. package/dist/umd/tools/inscriber/InscribeFromFileTool.d.ts +2 -2
  167. package/dist/umd/tools/inscriber/InscribeFromUrlTool.d.ts +4 -4
  168. package/dist/umd/tools/inscriber/InscribeHashinalTool.d.ts +4 -4
  169. package/dist/umd/types/tx-results.d.ts +15 -0
  170. package/dist/umd/utils/CodedError.d.ts +4 -0
  171. package/dist/umd/validation/hip412-schemas.d.ts +2 -2
  172. package/package.json +3 -3
  173. package/src/builders/hcs10/hcs10-builder.ts +239 -10
  174. package/src/builders/hcs2/hcs2-builder.ts +302 -9
  175. package/src/builders/hcs6/hcs6-builder.ts +79 -4
  176. package/src/hcs10/HCS10Client.ts +1 -1
  177. package/src/index.ts +5 -1
  178. package/src/lib/zod-render/schema-extension.ts +0 -1
  179. package/src/signing/bytes-registry.ts +501 -0
  180. package/src/signing/signer-provider.ts +120 -0
  181. package/src/tools/hcs2/CreateRegistryTool.ts +30 -5
  182. package/src/tools/hcs2/DeleteEntryTool.ts +16 -2
  183. package/src/tools/hcs2/MigrateRegistryTool.ts +16 -2
  184. package/src/tools/hcs2/QueryRegistryTool.ts +11 -2
  185. package/src/tools/hcs2/RegisterEntryTool.ts +17 -3
  186. package/src/tools/hcs2/UpdateEntryTool.ts +16 -2
  187. package/src/tools/hcs6/CreateDynamicRegistryTool.ts +17 -3
  188. package/src/tools/hcs6/RegisterDynamicHashinalTool.ts +17 -3
  189. package/src/tools/hcs6/UpdateDynamicHashinalTool.ts +17 -3
  190. package/src/tools/inscriber/InscribeFromBufferTool.ts +90 -2
  191. package/src/tools/inscriber/InscribeHashinalTool.ts +25 -134
  192. package/src/types/tx-results.ts +18 -0
  193. package/src/utils/CodedError.ts +8 -0
  194. package/src/utils/Encryption.ts +0 -2
  195. package/src/utils/ensure-agent-has-hbar.ts +4 -5
@@ -1,1572 +1,64 @@
1
- import { BaseServiceBuilder } from "hedera-agent-kit";
2
- import { Logger, HCS10Client as HCS10Client$1, AgentBuilder, AIAgentCapability, InboundTopicType, FeeConfigBuilder } from "@hashgraphonline/standards-sdk";
3
- import fs from "fs";
4
- import path__default from "path";
5
- import axios from "axios";
6
- const NOT_INITIALIZED_ERROR = "ConnectionsManager not initialized";
7
- class HCS10Builder extends BaseServiceBuilder {
8
- constructor(hederaKit, stateManager, options) {
9
- super(hederaKit);
10
- const isBytesMode = String(this.hederaKit.operationalMode || "returnBytes") === "returnBytes";
11
- if (isBytesMode) {
12
- throw new Error("HCS10Builder is not available in returnBytes mode (no local operator key). Use BrowserHCSClient with a wallet signer in the renderer.");
13
- }
14
- this.stateManager = stateManager;
15
- const network = this.hederaKit.client.network;
16
- this.network = network.toString().includes("mainnet") ? "mainnet" : "testnet";
17
- const operatorId = this.hederaKit.signer.getAccountId().toString();
18
- const operatorPrivateKey = this.hederaKit.signer?.getOperatorPrivateKey() ? this.hederaKit.signer.getOperatorPrivateKey().toStringRaw() : "";
19
- this.sdkLogger = new Logger({
20
- module: "HCS10Builder",
21
- level: options?.logLevel || "info"
22
- });
23
- this.standardClient = new HCS10Client$1({
24
- network: this.network,
25
- operatorId,
26
- operatorPrivateKey,
27
- logLevel: options?.logLevel || "info"
28
- });
29
- if (this.stateManager) {
30
- this.stateManager.initializeConnectionsManager(this.standardClient);
31
- }
32
- }
33
- /**
34
- * Get the operator account ID
35
- */
36
- getOperatorId() {
37
- const operator = this.standardClient.getClient().operatorAccountId;
38
- if (!operator) {
39
- throw new Error("Operator Account ID not configured in standard client.");
40
- }
41
- return operator.toString();
42
- }
43
- /**
44
- * Get the network type
45
- */
46
- getNetwork() {
47
- return this.network;
1
+ const _SignerProviderRegistry = class _SignerProviderRegistry {
2
+ static setSignerProvider(provider) {
3
+ this._signerProvider = provider;
48
4
  }
49
- /**
50
- * Get state manager instance
51
- */
52
- getStateManager() {
53
- return this.stateManager;
54
- }
55
- /**
56
- * Get account and signer information
57
- */
58
- getAccountAndSigner() {
59
- const result = this.standardClient.getAccountAndSigner();
60
- return {
61
- accountId: result.accountId,
62
- signer: result.signer
63
- };
64
- }
65
- /**
66
- * Get the inbound topic ID for the current operator
67
- */
68
- async getInboundTopicId() {
5
+ static async getSigner() {
6
+ const p = this._signerProvider;
7
+ if (!p) return null;
69
8
  try {
70
- const operatorId = this.getOperatorId();
71
- this.logger.info(
72
- `[HCS10Builder] Retrieving profile for operator ${operatorId} to find inbound topic...`
73
- );
74
- const profileResponse = await this.getAgentProfile(operatorId);
75
- if (profileResponse.success && profileResponse.topicInfo?.inboundTopic) {
76
- this.logger.info(
77
- `[HCS10Builder] Found inbound topic for operator ${operatorId}: ${profileResponse.topicInfo.inboundTopic}`
78
- );
79
- return profileResponse.topicInfo.inboundTopic;
80
- } else {
81
- throw new Error(
82
- `Could not retrieve inbound topic from profile for ${operatorId}. Profile success: ${profileResponse.success}, Error: ${profileResponse.error}`
83
- );
84
- }
85
- } catch (error) {
86
- this.logger.error(
87
- `[HCS10Builder] Error fetching operator's inbound topic ID (${this.getOperatorId()}):`,
88
- error
89
- );
90
- const operatorId = this.getOperatorId();
91
- let detailedMessage = `Failed to get inbound topic ID for operator ${operatorId}.`;
92
- if (error instanceof Error && error.message.includes("does not have a valid HCS-11 memo")) {
93
- detailedMessage += ` The account profile may not exist or is invalid. Please ensure this operator account (${operatorId}) is registered as an HCS-10 agent. You might need to register it first (e.g., using the 'register_agent' tool or SDK function).`;
94
- } else if (error instanceof Error) {
95
- detailedMessage += ` Reason: ${error.message}`;
96
- } else {
97
- detailedMessage += ` Unexpected error: ${String(error)}`;
98
- }
99
- throw new Error(detailedMessage);
100
- }
101
- }
102
- /**
103
- * Get agent profile
104
- */
105
- async getAgentProfile(accountId) {
106
- try {
107
- return await this.standardClient.retrieveProfile(accountId);
108
- } catch (error) {
109
- this.logger.error(
110
- `[HCS10Builder] Error retrieving agent profile for account ${accountId}:`,
111
- error
112
- );
113
- throw error;
114
- }
115
- }
116
- /**
117
- * Submit connection request
118
- */
119
- async submitConnectionRequest(inboundTopicId, memo) {
120
- return this.standardClient.submitConnectionRequest(
121
- inboundTopicId,
122
- memo
123
- );
124
- }
125
- /**
126
- * Handle connection request
127
- */
128
- async handleConnectionRequest(inboundTopicId, requestingAccountId, connectionRequestId, feeConfig) {
129
- try {
130
- const result = await this.standardClient.handleConnectionRequest(
131
- inboundTopicId,
132
- requestingAccountId,
133
- connectionRequestId,
134
- feeConfig
135
- );
136
- if (result && result.connectionTopicId && typeof result.connectionTopicId === "object" && "toString" in result.connectionTopicId) {
137
- result.connectionTopicId = result.connectionTopicId.toString();
138
- }
139
- return result;
140
- } catch (error) {
141
- this.logger.error(
142
- `Error handling connection request #${connectionRequestId} for topic ${inboundTopicId}:`,
143
- error
144
- );
145
- throw new Error(
146
- `Failed to handle connection request: ${error instanceof Error ? error.message : String(error)}`
147
- );
148
- }
149
- }
150
- /**
151
- * Send message to a topic
152
- */
153
- async sendMessage(topicId, data, memo) {
154
- if (topicId && typeof topicId === "object" && "toString" in topicId) {
155
- topicId = topicId?.toString();
156
- }
157
- if (!topicId || typeof topicId !== "string") {
158
- throw new Error(
159
- `Invalid topic ID provided to sendMessage: ${JSON.stringify(topicId)}`
160
- );
161
- }
162
- try {
163
- const messageResponse = await this.standardClient.sendMessage(
164
- topicId,
165
- data,
166
- memo,
167
- void 0
168
- );
169
- return {
170
- sequenceNumber: messageResponse.topicSequenceNumber?.toNumber(),
171
- receipt: messageResponse,
172
- transactionId: "transactionId" in messageResponse ? messageResponse.transactionId?.toString() : void 0
173
- };
174
- } catch (error) {
175
- this.logger.error(`Error sending message to topic ${topicId}:`, error);
176
- throw new Error(
177
- `Failed to send message: ${error instanceof Error ? error.message : String(error)}`
178
- );
179
- }
180
- }
181
- /**
182
- * Get messages from a topic
183
- */
184
- async getMessages(topicId) {
185
- if (topicId && typeof topicId === "object" && "toString" in topicId) {
186
- topicId = topicId?.toString();
187
- }
188
- if (!topicId || typeof topicId !== "string") {
189
- throw new Error(
190
- `Invalid topic ID provided to getMessages: ${JSON.stringify(topicId)}`
191
- );
192
- }
193
- try {
194
- const result = await this.standardClient.getMessages(topicId);
195
- const mappedMessages = result.messages.map(
196
- (sdkMessage) => {
197
- const timestamp = sdkMessage?.created?.getTime() || 0;
198
- return {
199
- ...sdkMessage,
200
- timestamp,
201
- data: sdkMessage.data || "",
202
- sequence_number: sdkMessage.sequence_number,
203
- p: "hcs-10"
204
- };
205
- }
206
- );
207
- mappedMessages.sort(
208
- (a, b) => a.timestamp - b.timestamp
209
- );
210
- return { messages: mappedMessages };
211
- } catch (error) {
212
- this.logger.error(`Error getting messages from topic ${topicId}:`, error);
213
- return { messages: [] };
214
- }
215
- }
216
- /**
217
- * Get message stream from a topic
218
- */
219
- async getMessageStream(topicId) {
220
- if (topicId && typeof topicId === "object" && "toString" in topicId) {
221
- topicId = topicId?.toString();
222
- }
223
- if (!topicId || typeof topicId !== "string") {
224
- throw new Error(
225
- `Invalid topic ID provided to getMessageStream: ${JSON.stringify(
226
- topicId
227
- )}`
228
- );
229
- }
230
- return this.standardClient.getMessageStream(topicId);
231
- }
232
- /**
233
- * Get message content
234
- */
235
- async getMessageContent(inscriptionIdOrData) {
236
- try {
237
- const content = await this.standardClient.getMessageContent(
238
- inscriptionIdOrData
239
- );
240
- return content;
241
- } catch (error) {
242
- this.logger.error(
243
- `Error retrieving message content for: ${inscriptionIdOrData}`,
244
- error
245
- );
246
- throw new Error(
247
- `Failed to retrieve message content: ${error instanceof Error ? error.message : String(error)}`
248
- );
249
- }
250
- }
251
- /**
252
- * Get the standard client instance (for compatibility)
253
- */
254
- getStandardClient() {
255
- return this.standardClient;
256
- }
257
- /**
258
- * Load profile picture from URL or file path
259
- */
260
- async loadProfilePicture(profilePicture) {
261
- try {
262
- if (!profilePicture) {
263
- return null;
264
- }
265
- if (typeof profilePicture === "string") {
266
- const isUrl = profilePicture.startsWith("http://") || profilePicture.startsWith("https://");
267
- if (isUrl) {
268
- this.logger.info(
269
- `Loading profile picture from URL: ${profilePicture}`
270
- );
271
- const response = await axios.get(profilePicture, {
272
- responseType: "arraybuffer"
273
- });
274
- const buffer = Buffer.from(response.data);
275
- const urlPathname = new URL(profilePicture).pathname;
276
- const filename = path__default.basename(urlPathname) || "profile.png";
277
- return { buffer, filename };
278
- } else {
279
- if (!fs.existsSync(profilePicture)) {
280
- this.logger.warn(
281
- `Profile picture file not found: ${profilePicture}`
282
- );
283
- return null;
284
- }
285
- this.logger.info(
286
- `Loading profile picture from file: ${profilePicture}`
287
- );
288
- const buffer = fs.readFileSync(profilePicture);
289
- const filename = path__default.basename(profilePicture);
290
- return { buffer, filename };
291
- }
292
- } else if (profilePicture.url) {
293
- this.logger.info(
294
- `Loading profile picture from URL: ${profilePicture.url}`
295
- );
296
- const response = await axios.get(profilePicture.url, {
297
- responseType: "arraybuffer"
298
- });
299
- const buffer = Buffer.from(response.data);
300
- const filename = profilePicture.filename || "profile.png";
301
- return { buffer, filename };
302
- } else if (profilePicture.path) {
303
- if (!fs.existsSync(profilePicture.path)) {
304
- this.logger.warn(
305
- `Profile picture file not found: ${profilePicture.path}`
306
- );
307
- return null;
308
- }
309
- this.logger.info(
310
- `Loading profile picture from file: ${profilePicture.path}`
311
- );
312
- const buffer = fs.readFileSync(profilePicture.path);
313
- const filename = profilePicture.filename || path__default.basename(profilePicture.path);
314
- return { buffer, filename };
9
+ if (typeof p === "function") {
10
+ const val = p();
11
+ return val && typeof val.then === "function" ? await val : val;
315
12
  }
13
+ return p;
14
+ } catch {
316
15
  return null;
317
- } catch (error) {
318
- this.logger.error("Failed to load profile picture:", error);
319
- return null;
320
- }
321
- }
322
- /**
323
- * Create and register an agent
324
- */
325
- async createAndRegisterAgent(data) {
326
- const builder = new AgentBuilder().setName(data.name).setBio(data.bio || "").setCapabilities(
327
- data.capabilities || [AIAgentCapability.TEXT_GENERATION]
328
- ).setType(data.type || "autonomous").setModel(data.model || "agent-model-2024").setNetwork(this.getNetwork()).setInboundTopicType(InboundTopicType.PUBLIC);
329
- if (data.alias) {
330
- builder.setAlias(data.alias);
331
- }
332
- if (data.creator) {
333
- builder.setCreator(data.creator);
334
- }
335
- if (data?.feeConfig) {
336
- builder.setInboundTopicType(InboundTopicType.FEE_BASED);
337
- builder.setFeeConfig(data.feeConfig);
338
- }
339
- if (data.existingProfilePictureTopicId) {
340
- builder.setExistingProfilePicture(data.existingProfilePictureTopicId);
341
- } else if (data.pfpBuffer && data.pfpFileName) {
342
- if (data.pfpBuffer.byteLength === 0) {
343
- this.logger.warn(
344
- "Provided PFP buffer is empty. Skipping profile picture."
345
- );
346
- } else {
347
- this.logger.info(
348
- `Setting profile picture: ${data.pfpFileName} (${data.pfpBuffer.byteLength} bytes)`
349
- );
350
- builder.setProfilePicture(data.pfpBuffer, data.pfpFileName);
351
- }
352
- } else {
353
- this.logger.warn(
354
- "Profile picture not provided. Agent creation might fail if required by the underlying SDK builder."
355
- );
356
- }
357
- if (data.socials) {
358
- Object.entries(data.socials).forEach(([platform, handle]) => {
359
- builder.addSocial(platform, handle);
360
- });
361
- }
362
- if (data.properties) {
363
- Object.entries(data.properties).forEach(([key, value]) => {
364
- builder.addProperty(key, value);
365
- });
366
- }
367
- try {
368
- const hasFees = Boolean(data?.feeConfig);
369
- const result = await this.standardClient.createAndRegisterAgent(builder, {
370
- initialBalance: hasFees ? 50 : 10
371
- });
372
- return result;
373
- } catch (error) {
374
- this.logger.error("Error during agent creation/registration:", error);
375
- throw new Error(
376
- `Failed to create/register agent: ${error instanceof Error ? error.message : String(error)}`
377
- );
378
- }
379
- }
380
- /**
381
- * Register a new HCS-10 agent
382
- * Note: This performs multiple transactions and requires directExecution mode
383
- */
384
- async registerAgent(params) {
385
- this.clearNotes();
386
- if (this.hederaKit.operationalMode === "returnBytes") {
387
- throw new Error(
388
- "Agent registration requires multiple transactions and cannot be performed in returnBytes mode. Please use autonomous mode."
389
- );
390
- }
391
- try {
392
- let profilePictureData = null;
393
- if (params.profilePicture) {
394
- profilePictureData = await this.loadProfilePicture(
395
- params.profilePicture
396
- );
397
- }
398
- const registrationData = {
399
- name: params.name,
400
- ...params.bio !== void 0 && { bio: params.bio },
401
- ...params.alias !== void 0 && { alias: params.alias },
402
- ...params.type !== void 0 && { type: params.type },
403
- ...params.model !== void 0 && { model: params.model },
404
- ...params.capabilities !== void 0 && {
405
- capabilities: params.capabilities
406
- },
407
- ...params.creator !== void 0 && { creator: params.creator },
408
- ...params.socials !== void 0 && { socials: params.socials },
409
- ...params.properties !== void 0 && {
410
- properties: params.properties
411
- },
412
- ...params.existingProfilePictureTopicId !== void 0 && {
413
- existingProfilePictureTopicId: params.existingProfilePictureTopicId
414
- },
415
- ...profilePictureData?.buffer !== void 0 && {
416
- pfpBuffer: profilePictureData.buffer
417
- },
418
- ...profilePictureData?.filename !== void 0 && {
419
- pfpFileName: profilePictureData.filename
420
- }
421
- };
422
- if (params.hbarFee && params.hbarFee > 0) {
423
- const feeConfigBuilder = new FeeConfigBuilder({
424
- network: this.network,
425
- logger: this.sdkLogger
426
- });
427
- const { accountId: collectorAccountId } = this.getAccountAndSigner();
428
- if (!collectorAccountId) {
429
- throw new Error("Could not determine account ID for fee collection.");
430
- }
431
- this.addNote(
432
- `Setting the operator account (${collectorAccountId}) as the fee collector since no specific collector was provided.`
433
- );
434
- const effectiveExemptIds = params.exemptAccountIds?.filter(
435
- (id) => id !== collectorAccountId && id.startsWith("0.0")
436
- ) || [];
437
- registrationData.feeConfig = feeConfigBuilder.addHbarFee(
438
- params.hbarFee,
439
- collectorAccountId,
440
- effectiveExemptIds
441
- );
442
- }
443
- const result = await this.createAndRegisterAgent(registrationData);
444
- this.executeResult = {
445
- success: true,
446
- transactionId: result.transactionId,
447
- receipt: void 0,
448
- scheduleId: void 0,
449
- rawResult: {
450
- ...result,
451
- name: params.name,
452
- accountId: result?.metadata?.accountId || result.state?.agentMetadata?.accountId
453
- }
454
- };
455
- } catch (error) {
456
- this.logger.error("Failed to register agent:", error);
457
- throw error;
458
- }
459
- return this;
460
- }
461
- /**
462
- * Initiate a connection to another agent
463
- */
464
- async initiateConnection(params) {
465
- this.clearNotes();
466
- try {
467
- const targetProfile = await this.getAgentProfile(params.targetAccountId);
468
- if (!targetProfile.success || !targetProfile.topicInfo?.inboundTopic) {
469
- throw new Error(
470
- `Could not retrieve inbound topic for target account ${params.targetAccountId}`
471
- );
472
- }
473
- const targetInboundTopicId = targetProfile.topicInfo.inboundTopic;
474
- let memo;
475
- if (params.memo !== void 0) {
476
- memo = params.memo;
477
- } else {
478
- memo = params.disableMonitor ? "false" : "true";
479
- this.addNote(
480
- `No custom memo was provided. Using default memo '${memo}' based on monitoring preference.`
481
- );
482
- }
483
- if (!params.disableMonitor) {
484
- this.addNote(
485
- `Monitoring will be enabled for this connection request as disableMonitor was not specified.`
486
- );
487
- }
488
- const result = await this.submitConnectionRequest(
489
- targetInboundTopicId,
490
- memo
491
- );
492
- this.executeResult = {
493
- success: true,
494
- transactionId: "transactionId" in result ? result.transactionId?.toString() : void 0,
495
- receipt: result,
496
- scheduleId: void 0,
497
- rawResult: {
498
- targetAccountId: params.targetAccountId,
499
- targetInboundTopicId,
500
- connectionRequestSent: true,
501
- monitoringEnabled: !params.disableMonitor,
502
- ...result
503
- }
504
- };
505
- } catch (error) {
506
- this.logger.error("Failed to initiate connection:", error);
507
- throw error;
508
- }
509
- return this;
510
- }
511
- /**
512
- * Accept a connection request
513
- * Note: This performs multiple transactions and requires directExecution mode
514
- */
515
- async acceptConnection(params) {
516
- this.clearNotes();
517
- if (this.hederaKit.operationalMode === "returnBytes") {
518
- throw new Error(
519
- "Accepting connections requires multiple transactions and cannot be performed in returnBytes mode. Please use autonomous mode."
520
- );
521
- }
522
- try {
523
- const currentAgent = this.stateManager?.getCurrentAgent();
524
- if (!currentAgent) {
525
- throw new Error(
526
- "Cannot accept connection request. No agent is currently active. Please register or select an agent first."
527
- );
528
- }
529
- const connectionsManager = this.stateManager?.getConnectionsManager();
530
- if (!connectionsManager) {
531
- throw new Error(NOT_INITIALIZED_ERROR);
532
- }
533
- await connectionsManager.fetchConnectionData(currentAgent.accountId);
534
- const allRequests = [
535
- ...connectionsManager.getPendingRequests(),
536
- ...connectionsManager.getConnectionsNeedingConfirmation()
537
- ];
538
- const request = allRequests.find(
539
- (r) => r.uniqueRequestKey === params.requestKey || r.connectionRequestId?.toString() === params.requestKey || r.inboundRequestId?.toString() === params.requestKey
540
- );
541
- if (!request) {
542
- throw new Error(
543
- `Request with key ${params.requestKey} not found or no longer pending.`
544
- );
545
- }
546
- if (!request.needsConfirmation || !request.inboundRequestId) {
547
- throw new Error(
548
- `Request with key ${params.requestKey} is not an inbound request that can be accepted.`
549
- );
550
- }
551
- const targetAccountId = request.targetAccountId;
552
- const inboundRequestId = request.inboundRequestId;
553
- let feeConfig;
554
- if (params.hbarFee && params.hbarFee > 0) {
555
- const feeConfigBuilder = new FeeConfigBuilder({
556
- network: this.network,
557
- logger: this.sdkLogger
558
- });
559
- const { accountId: collectorAccountId } = this.getAccountAndSigner();
560
- if (!collectorAccountId) {
561
- throw new Error("Could not determine account ID for fee collection.");
562
- }
563
- this.addNote(
564
- `Setting the operator account (${collectorAccountId}) as the fee collector since no specific collector was provided.`
565
- );
566
- const effectiveExemptIds = params.exemptAccountIds?.filter(
567
- (id) => id !== collectorAccountId && id.startsWith("0.0")
568
- ) || [];
569
- feeConfig = feeConfigBuilder.addHbarFee(
570
- params.hbarFee,
571
- collectorAccountId,
572
- effectiveExemptIds
573
- );
574
- }
575
- const inboundTopicId = await this.getInboundTopicId();
576
- const confirmationResult = await this.handleConnectionRequest(
577
- inboundTopicId,
578
- targetAccountId,
579
- inboundRequestId,
580
- feeConfig
581
- );
582
- let connectionTopicId = confirmationResult?.connectionTopicId;
583
- if (connectionTopicId && typeof connectionTopicId === "object" && "toString" in connectionTopicId) {
584
- connectionTopicId = connectionTopicId?.toString();
585
- }
586
- if (!connectionTopicId || typeof connectionTopicId !== "string") {
587
- throw new Error(
588
- `Failed to create connection topic. Got: ${JSON.stringify(
589
- connectionTopicId
590
- )}`
591
- );
592
- }
593
- if (this.stateManager) {
594
- const targetAgentName = request.targetAgentName || `Agent ${targetAccountId}`;
595
- if (!request.targetAgentName) {
596
- this.addNote(
597
- `No agent name was provided in the connection request, using default name 'Agent ${targetAccountId}'.`
598
- );
599
- }
600
- let targetInboundTopicId = request.targetInboundTopicId || "";
601
- if (!targetInboundTopicId) {
602
- try {
603
- const targetProfile = await this.getAgentProfile(targetAccountId);
604
- if (targetProfile.success && targetProfile.topicInfo?.inboundTopic) {
605
- targetInboundTopicId = targetProfile.topicInfo.inboundTopic;
606
- }
607
- } catch (profileError) {
608
- this.logger.warn(
609
- `Could not fetch profile for ${targetAccountId}:`,
610
- profileError
611
- );
612
- }
613
- }
614
- const newConnection = {
615
- connectionId: `conn-${Date.now()}`,
616
- targetAccountId,
617
- targetAgentName,
618
- targetInboundTopicId,
619
- connectionTopicId,
620
- status: "established",
621
- created: /* @__PURE__ */ new Date()
622
- };
623
- this.stateManager.addActiveConnection(newConnection);
624
- connectionsManager.markConnectionRequestProcessed(
625
- request.targetInboundTopicId || "",
626
- inboundRequestId
627
- );
628
- }
629
- this.executeResult = {
630
- success: true,
631
- transactionId: void 0,
632
- receipt: void 0,
633
- scheduleId: void 0,
634
- rawResult: {
635
- targetAccountId,
636
- connectionTopicId,
637
- feeConfigured: !!params.hbarFee,
638
- hbarFee: params.hbarFee || 0,
639
- confirmationResult
640
- }
641
- };
642
- } catch (error) {
643
- this.logger.error("Failed to accept connection:", error);
644
- throw error;
645
16
  }
646
- return this;
647
17
  }
648
- /**
649
- * Send a message using HCS (for operations that need direct topic access)
650
- */
651
- async sendHCS10Message(params) {
652
- this.clearNotes();
653
- try {
654
- const result = await this.sendMessage(params.topicId, params.message);
655
- this.executeResult = {
656
- success: true,
657
- transactionId: result.transactionId,
658
- receipt: result.receipt,
659
- scheduleId: void 0,
660
- rawResult: result
661
- };
662
- this.addNote(`Message sent to topic ${params.topicId}.`);
663
- } catch (error) {
664
- this.logger.error("Failed to send message:", error);
665
- throw error;
666
- }
667
- return this;
18
+ static setWalletInfoResolver(resolver) {
19
+ this._walletInfoResolver = resolver || null;
668
20
  }
669
- /**
670
- * Send a message to a connected account with optional response monitoring
671
- */
672
- async sendMessageToConnection(params) {
673
- this.clearNotes();
674
- if (!this.stateManager) {
675
- throw new Error(
676
- "StateManager is required to send messages to connections"
677
- );
678
- }
21
+ static async getWalletInfo() {
22
+ const r = this._walletInfoResolver;
23
+ if (!r) return null;
679
24
  try {
680
- const currentAgent = this.stateManager.getCurrentAgent();
681
- if (!currentAgent) {
682
- throw new Error(
683
- "Cannot send message. No agent is currently active. Please register or select an agent first."
684
- );
685
- }
686
- let connection;
687
- const identifier = params.targetIdentifier;
688
- if (identifier.includes("@")) {
689
- const parts = identifier.split("@");
690
- if (parts.length === 2) {
691
- const accountId = parts[1];
692
- connection = this.stateManager.getConnectionByIdentifier(accountId);
693
- if (!connection) {
694
- this.addNote(
695
- `Could not find connection using request key '${identifier}', extracted account ID '${accountId}'.`
696
- );
697
- }
698
- }
699
- }
700
- if (!connection) {
701
- connection = this.stateManager.getConnectionByIdentifier(identifier);
702
- }
703
- if (!connection && !identifier.startsWith("0.0.") && /^\d+$/.test(identifier)) {
704
- const accountIdWithPrefix = `0.0.${identifier}`;
705
- connection = this.stateManager.getConnectionByIdentifier(accountIdWithPrefix);
706
- if (connection) {
707
- this.addNote(
708
- `Found connection using account ID with prefix: ${accountIdWithPrefix}`
709
- );
710
- }
711
- }
712
- if (!connection && /^[1-9]\d*$/.test(identifier)) {
713
- const connections = this.stateManager.listConnections();
714
- const index = parseInt(identifier) - 1;
715
- if (index >= 0 && index < connections.length) {
716
- connection = connections[index];
717
- if (connection) {
718
- this.addNote(
719
- `Found connection by index ${identifier}: ${connection.targetAccountId}`
720
- );
721
- }
722
- }
723
- }
724
- if (!connection) {
725
- const connections = this.stateManager.listConnections();
726
- const availableIds = connections.map(
727
- (c, i) => `${i + 1}. ${c.targetAccountId} (Topic: ${c.connectionTopicId})`
728
- );
729
- let errorMsg = `Connection not found for identifier: "${identifier}"
730
- `;
731
- errorMsg += `Available connections:
732
- ${availableIds.join("\n") || "No active connections"}`;
733
- errorMsg += `
734
-
735
- You can use:
736
- `;
737
- errorMsg += `- Connection number (e.g., "1", "2")
738
- `;
739
- errorMsg += `- Account ID (e.g., "0.0.6412936")
740
- `;
741
- errorMsg += `- Connection topic ID
742
- `;
743
- errorMsg += `Use 'list_connections' to see all active connections.`;
744
- throw new Error(errorMsg);
745
- }
746
- let connectionTopicId = connection.connectionTopicId;
747
- if (connectionTopicId && typeof connectionTopicId === "object" && "toString" in connectionTopicId) {
748
- connectionTopicId = connectionTopicId?.toString();
749
- }
750
- if (!connectionTopicId || typeof connectionTopicId !== "string") {
751
- throw new Error(
752
- `Invalid connection topic ID for ${connection.targetAccountId}: ${JSON.stringify(
753
- connectionTopicId
754
- )} (type: ${typeof connectionTopicId})`
755
- );
756
- }
757
- const targetAgentName = connection.targetAgentName;
758
- const operatorId = `${currentAgent.inboundTopicId}@${currentAgent.accountId}`;
759
- const messageResult = await this.sendMessage(
760
- connectionTopicId,
761
- params.message,
762
- `Agent message from ${currentAgent.name}`
763
- );
764
- if (!messageResult.sequenceNumber) {
765
- throw new Error("Failed to send message");
766
- }
767
- let reply = null;
768
- if (!params.disableMonitoring) {
769
- reply = await this.monitorResponses(
770
- connectionTopicId,
771
- operatorId,
772
- messageResult.sequenceNumber
773
- );
774
- } else {
775
- this.addNote(
776
- `Message sent successfully. Response monitoring was disabled.`
777
- );
778
- }
779
- this.executeResult = {
780
- success: true,
781
- transactionId: messageResult.transactionId,
782
- receipt: messageResult.receipt,
783
- scheduleId: void 0,
784
- rawResult: {
785
- targetAgentName,
786
- targetAccountId: connection.targetAccountId,
787
- connectionTopicId,
788
- sequenceNumber: messageResult.sequenceNumber,
789
- reply,
790
- monitoringEnabled: !params.disableMonitoring,
791
- message: params.message,
792
- messageResult
793
- }
794
- };
795
- } catch (error) {
796
- this.logger.error("Failed to send message to connection:", error);
797
- throw error;
25
+ const val = r();
26
+ return val && typeof val.then === "function" ? await val : val;
27
+ } catch {
28
+ return null;
798
29
  }
799
- return this;
800
30
  }
801
- /**
802
- * Monitor responses on a topic after sending a message
803
- */
804
- async monitorResponses(topicId, operatorId, sequenceNumber) {
805
- const maxAttempts = 30;
806
- let attempts = 0;
807
- while (attempts < maxAttempts) {
808
- try {
809
- const messages = await this.getMessageStream(topicId);
810
- for (const message of messages.messages) {
811
- if (message.sequence_number < sequenceNumber || message.operator_id === operatorId) {
812
- continue;
813
- }
814
- const content = await this.getMessageContent(message.data || "");
815
- return content;
816
- }
817
- } catch (error) {
818
- this.logger.error(`Error monitoring responses: ${error}`);
819
- }
820
- await new Promise((resolve) => setTimeout(resolve, 4e3));
821
- attempts++;
822
- }
823
- return null;
31
+ static setWalletExecutor(executor) {
32
+ this._walletExecutor = executor || null;
824
33
  }
825
- /**
826
- * Start passive monitoring for incoming connection requests
827
- * This method monitors continuously in the background
828
- */
829
- async startPassiveConnectionMonitoring() {
830
- this.clearNotes();
831
- if (!this.stateManager) {
832
- throw new Error("StateManager is required for passive monitoring");
833
- }
834
- const inboundTopicId = await this.getInboundTopicId();
835
- this.logger.info(
836
- `Starting passive connection monitoring on topic ${inboundTopicId}...`
837
- );
838
- this.executeResult = {
839
- success: true,
840
- transactionId: void 0,
841
- receipt: void 0,
842
- scheduleId: void 0,
843
- rawResult: {
844
- inboundTopicId,
845
- message: `Started monitoring inbound topic ${inboundTopicId} for connection requests in the background.`
846
- }
847
- };
848
- return this;
34
+ static get walletExecutor() {
35
+ return this._walletExecutor || null;
849
36
  }
850
- /**
851
- * Monitor for incoming connection requests
852
- */
853
- async monitorConnections(params) {
854
- this.clearNotes();
855
- const {
856
- acceptAll = false,
857
- targetAccountId,
858
- monitorDurationSeconds = 120,
859
- hbarFees = [],
860
- tokenFees = [],
861
- exemptAccountIds = [],
862
- defaultCollectorAccount
863
- } = params;
864
- if (!this.stateManager) {
865
- throw new Error("StateManager is required for connection monitoring");
866
- }
867
- const currentAgent = this.stateManager.getCurrentAgent();
868
- if (!currentAgent) {
869
- throw new Error(
870
- "Cannot monitor for connections. No agent is currently active."
871
- );
872
- }
873
- const inboundTopicId = await this.getInboundTopicId();
874
- const endTime = Date.now() + monitorDurationSeconds * 1e3;
875
- const pollIntervalMs = 3e3;
876
- let connectionRequestsFound = 0;
877
- let acceptedConnections = 0;
878
- const processedRequestIds = /* @__PURE__ */ new Set();
879
- while (Date.now() < endTime) {
880
- try {
881
- const messagesResult = await this.getMessages(inboundTopicId);
882
- const connectionRequests = messagesResult.messages.filter(
883
- (msg) => msg.op === "connection_request" && typeof msg.sequence_number === "number"
884
- );
885
- for (const request of connectionRequests) {
886
- const connectionRequestId = request.sequence_number;
887
- if (!connectionRequestId || processedRequestIds.has(connectionRequestId)) {
888
- continue;
889
- }
890
- const requestingAccountId = request.operator_id?.split("@")[1];
891
- if (!requestingAccountId) {
892
- continue;
893
- }
894
- connectionRequestsFound++;
895
- if (targetAccountId && requestingAccountId !== targetAccountId) {
896
- this.logger.info(
897
- `Skipping request from ${requestingAccountId} (not target account)`
898
- );
899
- continue;
900
- }
901
- if (acceptAll || targetAccountId === requestingAccountId) {
902
- this.logger.info(
903
- `Accepting connection request from ${requestingAccountId}`
904
- );
905
- let feeConfig;
906
- if (hbarFees.length > 0 || tokenFees.length > 0) {
907
- const builder = new FeeConfigBuilder({
908
- network: this.network,
909
- logger: this.sdkLogger
910
- });
911
- for (const fee of hbarFees) {
912
- const collectorAccount = fee.collectorAccount || defaultCollectorAccount || this.getOperatorId();
913
- builder.addHbarFee(
914
- fee.amount,
915
- collectorAccount,
916
- exemptAccountIds
917
- );
918
- }
919
- for (const fee of tokenFees) {
920
- const collectorAccount = fee.collectorAccount || defaultCollectorAccount || this.getOperatorId();
921
- builder.addTokenFee(
922
- fee.amount,
923
- fee.tokenId,
924
- collectorAccount,
925
- void 0,
926
- exemptAccountIds
927
- );
928
- }
929
- feeConfig = builder;
930
- }
931
- await this.handleConnectionRequest(
932
- inboundTopicId,
933
- requestingAccountId,
934
- connectionRequestId,
935
- feeConfig
936
- );
937
- processedRequestIds.add(connectionRequestId);
938
- acceptedConnections++;
939
- }
940
- }
941
- } catch (error) {
942
- this.logger.error("Error during connection monitoring:", error);
943
- }
944
- await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
945
- }
946
- this.executeResult = {
947
- success: true,
948
- transactionId: void 0,
949
- receipt: void 0,
950
- scheduleId: void 0,
951
- rawResult: {
952
- connectionRequestsFound,
953
- acceptedConnections,
954
- monitorDurationSeconds,
955
- processedRequestIds: Array.from(processedRequestIds)
956
- }
957
- };
958
- this.addNote(
959
- `Monitoring completed. Found ${connectionRequestsFound} requests, accepted ${acceptedConnections}.`
960
- );
961
- return this;
37
+ static setStartHCSDelegate(delegate) {
38
+ this._startHCSDelegate = delegate || null;
962
39
  }
963
- /**
964
- * Manage connection requests (list, view, or reject)
965
- */
966
- async manageConnectionRequests(params) {
967
- this.clearNotes();
968
- if (!this.stateManager) {
969
- throw new Error(
970
- "StateManager is required for managing connection requests"
971
- );
972
- }
973
- const currentAgent = this.stateManager.getCurrentAgent();
974
- if (!currentAgent) {
975
- throw new Error(
976
- "Cannot manage connection requests. No agent is currently active."
977
- );
978
- }
979
- const connectionsManager = this.stateManager.getConnectionsManager();
980
- if (!connectionsManager) {
981
- throw new Error(NOT_INITIALIZED_ERROR);
982
- }
983
- try {
984
- const { accountId } = this.getAccountAndSigner();
985
- await connectionsManager.fetchConnectionData(accountId);
986
- const pendingRequests = connectionsManager.getPendingRequests();
987
- const needsConfirmation = connectionsManager.getConnectionsNeedingConfirmation();
988
- const allRequests = [...pendingRequests, ...needsConfirmation];
989
- switch (params.action) {
990
- case "list":
991
- this.executeResult = {
992
- success: true,
993
- transactionId: void 0,
994
- receipt: void 0,
995
- scheduleId: void 0,
996
- rawResult: {
997
- requests: allRequests.map((request, index) => ({
998
- index: index + 1,
999
- type: request.needsConfirmation ? "incoming" : "outgoing",
1000
- requestKey: request.uniqueRequestKey || `${request.connectionRequestId || request.inboundRequestId || "unknown"}`,
1001
- targetAccountId: request.targetAccountId,
1002
- targetAgentName: request.targetAgentName || `Agent ${request.targetAccountId}`,
1003
- created: request.created.toISOString(),
1004
- memo: request.memo,
1005
- bio: request.profileInfo?.bio
1006
- }))
1007
- }
1008
- };
1009
- break;
1010
- case "view": {
1011
- if (!params.requestKey) {
1012
- throw new Error("Request key is required for viewing a request");
1013
- }
1014
- const viewRequest = allRequests.find(
1015
- (r) => r.uniqueRequestKey === params.requestKey || r.connectionRequestId?.toString() === params.requestKey || r.inboundRequestId?.toString() === params.requestKey
1016
- );
1017
- if (!viewRequest) {
1018
- throw new Error(`Request with key ${params.requestKey} not found`);
1019
- }
1020
- this.executeResult = {
1021
- success: true,
1022
- transactionId: void 0,
1023
- receipt: void 0,
1024
- scheduleId: void 0,
1025
- rawResult: {
1026
- request: {
1027
- type: viewRequest.needsConfirmation ? "incoming" : "outgoing",
1028
- requestKey: viewRequest.uniqueRequestKey || `${viewRequest.connectionRequestId || viewRequest.inboundRequestId || "unknown"}`,
1029
- targetAccountId: viewRequest.targetAccountId,
1030
- targetAgentName: viewRequest.targetAgentName || `Agent ${viewRequest.targetAccountId}`,
1031
- created: viewRequest.created.toISOString(),
1032
- memo: viewRequest.memo,
1033
- profileInfo: viewRequest.profileInfo
1034
- }
1035
- }
1036
- };
1037
- break;
1038
- }
1039
- case "reject": {
1040
- if (!params.requestKey) {
1041
- throw new Error("Request key is required for rejecting a request");
1042
- }
1043
- const rejectRequest = allRequests.find(
1044
- (r) => r.uniqueRequestKey === params.requestKey || r.connectionRequestId?.toString() === params.requestKey || r.inboundRequestId?.toString() === params.requestKey
1045
- );
1046
- if (!rejectRequest) {
1047
- throw new Error(`Request with key ${params.requestKey} not found`);
1048
- }
1049
- if (rejectRequest.inboundRequestId) {
1050
- connectionsManager.markConnectionRequestProcessed(
1051
- rejectRequest.targetInboundTopicId || "",
1052
- rejectRequest.inboundRequestId
1053
- );
1054
- } else if (rejectRequest.connectionRequestId) {
1055
- connectionsManager.markConnectionRequestProcessed(
1056
- rejectRequest.originTopicId || "",
1057
- rejectRequest.connectionRequestId
1058
- );
1059
- }
1060
- this.executeResult = {
1061
- success: true,
1062
- transactionId: void 0,
1063
- receipt: void 0,
1064
- scheduleId: void 0,
1065
- rawResult: {
1066
- rejectedRequest: {
1067
- requestKey: params.requestKey,
1068
- targetAccountId: rejectRequest.targetAccountId,
1069
- targetAgentName: rejectRequest.targetAgentName || `Agent ${rejectRequest.targetAccountId}`
1070
- }
1071
- }
1072
- };
1073
- break;
1074
- }
1075
- }
1076
- } catch (error) {
1077
- this.logger.error("Failed to manage connection requests:", error);
1078
- throw error;
1079
- }
1080
- return this;
40
+ static get startHCSDelegate() {
41
+ return this._startHCSDelegate || null;
1081
42
  }
1082
- /**
1083
- * List unapproved connection requests
1084
- */
1085
- async listUnapprovedConnectionRequests() {
1086
- this.clearNotes();
1087
- if (!this.stateManager) {
1088
- throw new Error(
1089
- "StateManager is required for listing connection requests"
1090
- );
1091
- }
1092
- const currentAgent = this.stateManager.getCurrentAgent();
1093
- if (!currentAgent) {
1094
- throw new Error(
1095
- "Cannot list connection requests. No agent is currently active."
1096
- );
1097
- }
1098
- try {
1099
- const inboundTopicId = await this.getInboundTopicId();
1100
- const messages = await this.getMessages(inboundTopicId);
1101
- const unapprovedRequests = messages.messages.filter(
1102
- (msg) => msg.op === "connection_request"
1103
- ).map((msg) => ({
1104
- requestId: msg.sequence_number,
1105
- fromAccountId: msg.operator_id?.split("@")[1] || "unknown",
1106
- timestamp: msg.timestamp || new Date(msg?.created || "").getTime(),
1107
- memo: msg.m || "",
1108
- data: msg.data
1109
- })).filter(
1110
- (req) => req.fromAccountId !== "unknown"
1111
- );
1112
- this.executeResult = {
1113
- success: true,
1114
- transactionId: void 0,
1115
- receipt: void 0,
1116
- scheduleId: void 0,
1117
- rawResult: {
1118
- requests: unapprovedRequests,
1119
- count: unapprovedRequests.length
1120
- }
1121
- };
1122
- if (unapprovedRequests.length === 0) {
1123
- this.addNote("No unapproved connection requests found.");
1124
- } else {
1125
- this.addNote(
1126
- `Found ${unapprovedRequests.length} unapproved connection request(s).`
1127
- );
1128
- }
1129
- } catch (error) {
1130
- this.logger.error(
1131
- "Failed to list unapproved connection requests:",
1132
- error
1133
- );
1134
- throw error;
1135
- }
1136
- return this;
43
+ static setPreferWalletOnly(flag) {
44
+ this._preferWalletOnly = !!flag;
1137
45
  }
1138
46
  /**
1139
- * List connections with enhanced details
47
+ * Register a factory to construct a BrowserHCSClient-like instance for wallet-driven flows
1140
48
  */
1141
- async listConnections(params = {}) {
1142
- this.clearNotes();
1143
- if (!this.stateManager) {
1144
- throw new Error("StateManager is required to list connections");
1145
- }
1146
- const includeDetails = params.includeDetails ?? true;
1147
- const showPending = params.showPending ?? true;
1148
- try {
1149
- const connections = await this.getEnhancedConnections();
1150
- if (connections.length === 0) {
1151
- this.executeResult = {
1152
- success: true,
1153
- rawResult: {
1154
- connections: [],
1155
- message: "There are currently no active connections."
1156
- }
1157
- };
1158
- return this;
1159
- }
1160
- const activeConnections = connections.filter(
1161
- (c) => c.status === "established"
1162
- );
1163
- const pendingConnections = connections.filter(
1164
- (c) => c.isPending
1165
- );
1166
- const needsConfirmation = connections.filter(
1167
- (c) => c.needsConfirmation
1168
- );
1169
- let output = "";
1170
- if (activeConnections.length > 0) {
1171
- output += `🟢 Active Connections (${activeConnections.length}):
1172
- `;
1173
- activeConnections.forEach((conn, index) => {
1174
- output += this.formatConnection(conn, index, includeDetails);
1175
- });
1176
- output += "\n";
1177
- }
1178
- if (showPending && needsConfirmation.length > 0) {
1179
- output += `🟠 Connections Needing Confirmation (${needsConfirmation.length}):
1180
- `;
1181
- needsConfirmation.forEach((conn, index) => {
1182
- output += this.formatConnection(conn, index, includeDetails);
1183
- });
1184
- output += "\n";
1185
- }
1186
- if (showPending && pendingConnections.length > 0) {
1187
- output += `⚪ Pending Connection Requests (${pendingConnections.length}):
1188
- `;
1189
- pendingConnections.forEach((conn, index) => {
1190
- output += this.formatConnection(conn, index, includeDetails);
1191
- });
1192
- }
1193
- this.executeResult = {
1194
- success: true,
1195
- rawResult: {
1196
- connections,
1197
- formattedOutput: output.trim(),
1198
- activeCount: activeConnections.length,
1199
- pendingCount: pendingConnections.length,
1200
- needsConfirmationCount: needsConfirmation.length
1201
- }
1202
- };
1203
- } catch (error) {
1204
- this.logger.error("Failed to list connections:", error);
1205
- this.executeResult = {
1206
- success: false,
1207
- error: `Failed to list connections: ${error instanceof Error ? error.message : String(error)}`
1208
- };
1209
- }
1210
- return this;
1211
- }
1212
- formatConnection(conn, index, includeDetails) {
1213
- const connection = conn;
1214
- let output = `${index + 1}. ${connection.profileInfo?.display_name || connection.targetAgentName || "Unknown Agent"} (${connection.targetAccountId})
1215
- `;
1216
- const displayTopicId = connection.isPending ? "(Pending Request)" : connection.connectionTopicId;
1217
- output += ` Topic: ${displayTopicId}
1218
- `;
1219
- const statusText = connection.status || "unknown";
1220
- output += ` Status: ${statusText}
1221
- `;
1222
- if (includeDetails) {
1223
- if (connection.profileInfo?.bio) {
1224
- output += ` Bio: ${connection.profileInfo.bio.substring(0, 100)}${connection.profileInfo.bio.length > 100 ? "..." : ""}
1225
- `;
1226
- }
1227
- if (connection.created) {
1228
- const createdLabel = connection.isPending ? "Request sent" : "Connection established";
1229
- output += ` ${createdLabel}: ${connection.created.toLocaleString()}
1230
- `;
1231
- }
1232
- if (connection.lastActivity) {
1233
- output += ` Last activity: ${connection.lastActivity.toLocaleString()}
1234
- `;
1235
- }
1236
- }
1237
- return output;
1238
- }
1239
- async getEnhancedConnections() {
1240
- try {
1241
- const { accountId } = this.getAccountAndSigner();
1242
- if (!accountId) {
1243
- return this.stateManager.listConnections();
1244
- }
1245
- const connectionManager = this.stateManager.getConnectionsManager();
1246
- if (!connectionManager) {
1247
- this.logger.error(NOT_INITIALIZED_ERROR);
1248
- return this.stateManager.listConnections();
1249
- }
1250
- const connections = await connectionManager.fetchConnectionData(
1251
- accountId
1252
- );
1253
- for (const connection of connections) {
1254
- this.stateManager.addActiveConnection(
1255
- connection
1256
- );
1257
- }
1258
- return connections;
1259
- } catch (error) {
1260
- this.logger.error("Failed to get enhanced connections:", error);
1261
- return this.stateManager.listConnections();
1262
- }
1263
- }
1264
- /**
1265
- * Check messages on a connection
1266
- */
1267
- async checkMessages(params) {
1268
- this.clearNotes();
1269
- if (!this.stateManager) {
1270
- throw new Error("StateManager is required to check messages");
1271
- }
1272
- const connection = this.stateManager.getConnectionByIdentifier(
1273
- params.targetIdentifier
1274
- );
1275
- if (!connection) {
1276
- this.executeResult = {
1277
- success: false,
1278
- error: `Could not find an active connection matching identifier "${params.targetIdentifier}". Use 'list_connections' to see active connections.`
1279
- };
1280
- return this;
1281
- }
1282
- const connectionTopicId = connection.connectionTopicId || "";
1283
- if (!connectionTopicId || !connectionTopicId.match(/^\d+\.\d+\.\d+$/)) {
1284
- this.logger.error(
1285
- `Invalid connection topic ID format: ${connectionTopicId}`
1286
- );
1287
- this.executeResult = {
1288
- success: false,
1289
- error: `Invalid connection topic ID format: ${connectionTopicId}. Expected format: 0.0.XXXXX`
1290
- };
1291
- return this;
1292
- }
1293
- const targetAgentName = connection.targetAgentName;
1294
- const lastProcessedTimestamp = this.stateManager.getLastTimestamp(connectionTopicId);
1295
- this.logger.info(
1296
- `Checking messages for connection with ${targetAgentName} (${connection.targetAccountId}) on topic ${connectionTopicId} (fetchLatest: ${params.fetchLatest}, lastCount: ${params.lastMessagesCount}, since: ${lastProcessedTimestamp})`
1297
- );
1298
- try {
1299
- const result = await this.getMessages(connectionTopicId);
1300
- const allMessages = result.messages;
1301
- if (!allMessages || allMessages.length === 0) {
1302
- this.executeResult = {
1303
- success: true,
1304
- rawResult: {
1305
- messages: [],
1306
- message: `No messages found on connection topic ${connectionTopicId}.`
1307
- }
1308
- };
1309
- return this;
1310
- }
1311
- let messagesToProcess = [];
1312
- let latestTimestampNanos = lastProcessedTimestamp;
1313
- const isFetchingLatest = params.fetchLatest === true;
1314
- if (isFetchingLatest) {
1315
- this.logger.info("Fetching latest messages regardless of timestamp.");
1316
- const count = params.lastMessagesCount ?? 1;
1317
- messagesToProcess = allMessages.slice(-count);
1318
- } else {
1319
- this.logger.info(
1320
- `Filtering for messages newer than ${lastProcessedTimestamp}`
1321
- );
1322
- messagesToProcess = allMessages.filter(
1323
- (msg) => {
1324
- const msgTimestampNanos = msg.timestamp * 1e6;
1325
- return msgTimestampNanos > lastProcessedTimestamp;
1326
- }
1327
- );
1328
- if (messagesToProcess.length > 0) {
1329
- latestTimestampNanos = messagesToProcess.reduce(
1330
- (maxTs, msg) => Math.max(maxTs, msg.timestamp * 1e6),
1331
- lastProcessedTimestamp
1332
- );
1333
- }
1334
- }
1335
- if (messagesToProcess.length === 0) {
1336
- const message = isFetchingLatest ? `Could not retrieve the latest message(s). No messages found on topic ${connectionTopicId}.` : `No new messages found for connection with ${targetAgentName} since last check.`;
1337
- this.executeResult = {
1338
- success: true,
1339
- rawResult: {
1340
- messages: [],
1341
- message
1342
- }
1343
- };
1344
- return this;
1345
- }
1346
- this.logger.info(`Processing ${messagesToProcess.length} message(s).`);
1347
- let outputString = isFetchingLatest ? `Latest message(s) from ${targetAgentName}:
1348
- ` : `New messages from ${targetAgentName}:
1349
- `;
1350
- const processedMessages = [];
1351
- for (const msg of messagesToProcess) {
1352
- let content = msg.data;
1353
- try {
1354
- if (typeof content === "string" && content.startsWith("hcs://")) {
1355
- this.logger.debug(`Resolving inscribed message: ${content}`);
1356
- content = await this.getMessageContent(content);
1357
- this.logger.debug(`Resolved content length: ${content?.length}`);
1358
- }
1359
- let displayContent = content;
1360
- try {
1361
- const parsed = JSON.parse(content || "{}");
1362
- if (parsed.p === "hcs-10" && parsed.op === "message" && parsed.data) {
1363
- const senderOpId = parsed.operator_id || "unknown_sender";
1364
- displayContent = `[${senderOpId}]: ${parsed.data}`;
1365
- } else {
1366
- displayContent = content;
1367
- }
1368
- } catch {
1369
- displayContent = content;
1370
- }
1371
- const messageDate = new Date(msg.timestamp);
1372
- outputString += `
1373
- [${messageDate.toLocaleString()}] (Seq: ${msg.sequence_number})
1374
- ${displayContent}
1375
- `;
1376
- processedMessages.push({
1377
- timestamp: msg.timestamp,
1378
- sequenceNumber: msg.sequence_number,
1379
- content: displayContent,
1380
- raw: msg
1381
- });
1382
- } catch (error) {
1383
- const errorMsg = `Error processing message (Seq: ${msg.sequence_number}): ${error instanceof Error ? error.message : String(error)}`;
1384
- this.logger.error(errorMsg);
1385
- outputString += `
1386
- [Error processing message Seq: ${msg.sequence_number}]
1387
- `;
1388
- }
1389
- }
1390
- if (!isFetchingLatest && latestTimestampNanos > lastProcessedTimestamp) {
1391
- this.logger.debug(
1392
- `Updating timestamp for topic ${connectionTopicId} to ${latestTimestampNanos}`
1393
- );
1394
- this.stateManager.updateTimestamp(
1395
- connectionTopicId,
1396
- latestTimestampNanos
1397
- );
1398
- }
1399
- this.executeResult = {
1400
- success: true,
1401
- rawResult: {
1402
- messages: processedMessages,
1403
- formattedOutput: outputString.trim(),
1404
- targetAgentName,
1405
- connectionTopicId
1406
- }
1407
- };
1408
- } catch (error) {
1409
- this.logger.error(
1410
- `Failed to check messages for topic ${connectionTopicId}: ${error}`
1411
- );
1412
- this.executeResult = {
1413
- success: false,
1414
- error: `Error checking messages for ${targetAgentName}: ${error instanceof Error ? error.message : String(error)}`
1415
- };
1416
- }
1417
- return this;
1418
- }
1419
- /**
1420
- * Find registrations using the configured registry
1421
- */
1422
- async findRegistrations(params) {
1423
- this.clearNotes();
1424
- try {
1425
- const options = {
1426
- network: this.network
1427
- };
1428
- if (params.accountId) {
1429
- options.accountId = params.accountId;
1430
- }
1431
- if (params.tags && params.tags.length > 0) {
1432
- options.tags = params.tags;
1433
- }
1434
- const result = await this.standardClient.findRegistrations(options);
1435
- if (!result.success || result.error) {
1436
- this.executeResult = {
1437
- success: false,
1438
- error: `Error finding registrations: ${result.error || "Unknown error"}`
1439
- };
1440
- return this;
1441
- }
1442
- if (!result.registrations || result.registrations.length === 0) {
1443
- this.executeResult = {
1444
- success: true,
1445
- rawResult: {
1446
- registrations: [],
1447
- message: "No registrations found matching the criteria."
1448
- }
1449
- };
1450
- return this;
1451
- }
1452
- const formattedRegistrations = result.registrations.map((reg) => {
1453
- const registration = reg;
1454
- const agentName = registration.agent?.name || "Unknown Agent";
1455
- const accountId = registration.accountId || "Unknown Account";
1456
- const capabilities = registration.agent?.capabilities?.join(", ") || "None";
1457
- return `Agent: ${agentName} (${accountId}), Capabilities: ${capabilities}`;
1458
- }).join("\\n");
1459
- this.executeResult = {
1460
- success: true,
1461
- rawResult: {
1462
- registrations: result.registrations,
1463
- formattedOutput: `Found ${result.registrations.length} registration(s):\\n${formattedRegistrations}`
1464
- }
1465
- };
1466
- } catch (error) {
1467
- this.logger.error("Error during FindRegistrations execution:", error);
1468
- this.executeResult = {
1469
- success: false,
1470
- error: `Failed to search registrations: ${error instanceof Error ? error.message : String(error)}`
1471
- };
1472
- }
1473
- return this;
49
+ static setBrowserHCSClientFactory(factory) {
50
+ this._browserHCSClientFactory = factory || null;
1474
51
  }
1475
- /**
1476
- * Retrieve detailed profile information for an agent
1477
- */
1478
- async retrieveProfile(params) {
1479
- this.clearNotes();
1480
- try {
1481
- const profileResponse = await this.standardClient.retrieveProfile(
1482
- params.accountId,
1483
- params.disableCache || false
1484
- );
1485
- if (!profileResponse.success) {
1486
- this.executeResult = {
1487
- success: false,
1488
- error: `Failed to retrieve profile: ${profileResponse.error || "Unknown error"}`
1489
- };
1490
- return this;
1491
- }
1492
- const profile = profileResponse.profile;
1493
- const topicInfo = profileResponse.topicInfo;
1494
- let profileDetails = `Profile for ${params.accountId}:
1495
- `;
1496
- profileDetails += `Name: ${profile.name || "Unknown"}
1497
- `;
1498
- profileDetails += `Bio: ${profile.bio || "No bio provided"}
1499
- `;
1500
- profileDetails += `Type: ${profile.type || "Unknown"}
1501
- `;
1502
- profileDetails += `Model: ${profile.model || "Unknown"}
1503
- `;
1504
- if (profile.capabilities && profile.capabilities.length > 0) {
1505
- profileDetails += `Capabilities: ${profile.capabilities.join(", ")}
1506
- `;
1507
- } else {
1508
- profileDetails += `Capabilities: None listed
1509
- `;
1510
- }
1511
- if (topicInfo) {
1512
- profileDetails += `Inbound Topic: ${topicInfo.inboundTopic || "Unknown"}
1513
- `;
1514
- profileDetails += `Outbound Topic: ${topicInfo.outboundTopic || "Unknown"}
1515
- `;
1516
- profileDetails += `Profile Topic: ${topicInfo.profileTopicId || "Unknown"}
1517
- `;
1518
- }
1519
- if (profile.social && Object.keys(profile.social).length > 0) {
1520
- profileDetails += `Social: ${Object.entries(profile.social).map(
1521
- ([platform, handle]) => `${platform}: ${handle}`
1522
- ).join(", ")}
1523
- `;
1524
- }
1525
- if (profile.properties && Object.keys(profile.properties).length > 0) {
1526
- profileDetails += `Properties: ${JSON.stringify(profile.properties)}
1527
- `;
1528
- }
1529
- this.executeResult = {
1530
- success: true,
1531
- rawResult: {
1532
- profileDetails,
1533
- rawProfile: profileResponse
1534
- }
1535
- };
1536
- } catch (error) {
1537
- this.logger.error(
1538
- `Unexpected error retrieving profile for ${params.accountId}:`,
1539
- error
1540
- );
1541
- this.executeResult = {
1542
- success: false,
1543
- error: `Unexpected error retrieving profile for ${params.accountId}: ${error instanceof Error ? error.message : String(error)}`
1544
- };
1545
- }
1546
- return this;
52
+ static getBrowserHCSClient(network) {
53
+ return this._browserHCSClientFactory ? this._browserHCSClientFactory(network) : null;
1547
54
  }
1548
- /**
1549
- * Override execute to return stored HCS10 operation results
1550
- */
1551
- async execute() {
1552
- if (this.executeResult) {
1553
- return {
1554
- success: this.executeResult.success,
1555
- transactionId: this.executeResult.transactionId,
1556
- receipt: this.executeResult.receipt,
1557
- scheduleId: this.executeResult.scheduleId,
1558
- error: this.executeResult.error,
1559
- rawResult: this.executeResult.rawResult,
1560
- notes: this.notes
1561
- };
1562
- }
1563
- return {
1564
- success: false,
1565
- error: "No operation result available. Call a builder method first."
1566
- };
55
+ static get preferWalletOnly() {
56
+ return this._preferWalletOnly;
1567
57
  }
1568
- }
58
+ };
59
+ _SignerProviderRegistry._preferWalletOnly = false;
60
+ let SignerProviderRegistry = _SignerProviderRegistry;
1569
61
  export {
1570
- HCS10Builder
62
+ SignerProviderRegistry
1571
63
  };
1572
64
  //# sourceMappingURL=standards-agent-kit.es3.js.map