@hashgraphonline/standards-sdk 0.0.43 → 0.0.44

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.
package/LICENSE ADDED
@@ -0,0 +1,189 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ SPDX-License-Identifier: Apache-2.0
package/README.md CHANGED
@@ -1,243 +1,116 @@
1
- # Hashgraph Consensus Standards SDK
1
+ # Hashgraph Online Standards SDK
2
2
 
3
- This SDK provides reference implementations for Hashgraph Consensus Standards (HCS) created by Hashgraph Online.
3
+ A lightweight SDK providing reference implementations for Hashgraph Consensus Standards (HCS) created by Hashgraph Online.
4
4
 
5
- ## Supported Standards
6
-
7
- | Standard | Description | Environments |
8
- | -------- | --------------------------------------------------- | ----------------------------------- |
9
- | HCS-3 | Recursion for Inscribed Files | Browser (WebAssembly, HTML5) |
10
- | HCS-7 | Dynamic, Programmable, and 100% on-graph assets | Node.js, Browser (EVM, WebAssembly) |
11
- | HCS-10 | Trustless, peer to peer communication for AI Agents | Node.js, Browser |
12
-
13
- ## Installation
5
+ ## Quick Start
14
6
 
15
7
  ```bash
16
8
  npm install @hashgraphonline/standards-sdk
17
9
  ```
18
10
 
11
+ ## Documentation
12
+
13
+ For complete documentation, examples, and API references, visit:
14
+
15
+ - [Standards SDK Documentation](https://hashgraphonline.com/docs/libraries/standards-sdk/)
16
+
17
+ ## Supported Standards
18
+
19
+ - **HCS-3**: Recursion for Inscribed Files
20
+ - **HCS-7**: Dynamic, Programmable, and 100% on-graph assets
21
+ - **HCS-10**: Trustless, peer to peer communication for AI Agents
22
+ - **HCS-11**: Profile Standard
23
+
19
24
  ## Running Demos
20
25
 
21
- The SDK includes demo implementations showcasing various features. To run the demos:
26
+ The SDK includes demo implementations that showcase various features. Follow these steps to run them:
22
27
 
23
28
  1. Clone the repository
24
- 2. Install dependencies:
25
29
 
26
- ```bash
27
- npm install
28
- ```
30
+ ```bash
31
+ git clone https://github.com/hashgraph-online/standards-sdk.git
32
+ cd standards-sdk
33
+ ```
29
34
 
30
- 3. Set up your environment variables:
35
+ 2. Install dependencies
31
36
 
32
- ```bash
33
- cp .env.example .env
34
- ```
37
+ ```bash
38
+ npm install
39
+ ```
35
40
 
36
- 4. Edit `.env` with your credentials:
41
+ 3. Set up environment variables
37
42
 
38
- ```
39
- API_KEY=your_api_key_here
40
- ACCOUNT_ID=0.0.12345
41
- PRIVATE_KEY=your_private_key_here
42
- NETWORK=testnet
43
- ```
43
+ ```bash
44
+ cp .env.example .env
45
+ ```
46
+
47
+ 4. Edit the `.env` file with your Hedera credentials:
48
+
49
+ ```
50
+ API_KEY=your_api_key_here
51
+ HEDERA_ACCOUNT_ID=0.0.12345
52
+ HEDERA_PRIVATE_KEY=your_private_key_here
53
+ HEDERA_NETWORK=testnet
54
+ REGISTRY_URL=https://moonscape.tech
55
+ ```
44
56
 
45
57
  5. Run the demos:
46
58
 
47
- ```bash
48
- # Run the Inscribe Demo
49
- npm run demo
59
+ ```bash
60
+ # Run the inscribe demo
61
+ npm run demo
50
62
 
51
- # Run the HCS-10 Demo
52
- npm run demo:hcs-10
53
- ```
63
+ # Run the HCS-10 AI agent communication demo
64
+ npm run demo:hcs-10
65
+ ```
54
66
 
55
- ### Available Demos
56
-
57
- - **Inscribe Demo** (`demo/inscribe-demo.ts`): Demonstrates file inscription capabilities
58
-
59
- - Text inscription
60
- - URL inscription
61
- - Buffer inscription
62
- - Hashinal NFT creation (from URL, buffer, and text)
63
- - Manual inscription retrieval
64
-
65
- - **HCS-10 Demo** (`demo/hcs-10/index.ts`): Demonstrates AI agent communication
66
- - Agent setup and registration
67
- - Connection establishment between agents
68
- - Message exchange
69
- - Request monitoring
70
- - Agent metadata management
71
-
72
- ## Usage
73
-
74
- ### Inscribing Files
75
-
76
- ```typescript
77
- import { inscribe } from '@hashgraphonline/standards-sdk';
78
-
79
- // Inscribe from URL
80
- const urlResult = await inscribe(
81
- {
82
- type: 'url',
83
- url: 'https://example.com/file.json',
84
- },
85
- {
86
- network: 'mainnet',
87
- accountId: '0.0.123456',
88
- privateKey: 'your-private-key',
89
- },
90
- {
91
- mode: 'file',
92
- metadata: {
93
- name: 'My File',
94
- description: 'A JSON file',
95
- },
96
- }
97
- );
98
-
99
- // Inscribe from local file
100
- const fileResult = await inscribe(
101
- {
102
- type: 'file',
103
- path: './path/to/file.json',
104
- },
105
- {
106
- network: 'mainnet',
107
- accountId: '0.0.123456',
108
- privateKey: 'your-private-key',
109
- },
110
- {
111
- mode: 'file',
112
- }
113
- );
114
-
115
- // Inscribe from buffer
116
- const bufferResult = await inscribe(
117
- {
118
- type: 'buffer',
119
- buffer: fileBuffer,
120
- fileName: 'file.json',
121
- mimeType: 'application/json',
122
- },
123
- {
124
- network: 'mainnet',
125
- accountId: '0.0.123456',
126
- privateKey: 'your-private-key',
127
- },
128
- {
129
- mode: 'file',
130
- }
131
- );
132
- ```
67
+ ### Demo Descriptions
133
68
 
134
- ### HCS-7: Smart Contract State Processing
135
-
136
- ```typescript
137
- import { HCS7 } from '@hashgraphonline/standards-sdk';
138
-
139
- // Initialize EVM Bridge to read smart contract state
140
- const evmBridge = new HCS7.EVMBridge('mainnet-public');
141
-
142
- // Read state from a smart contract
143
- const contractState = await evmBridge.executeCommand({
144
- p: 'evm',
145
- op: 'read',
146
- m: 'latestRoundData',
147
- c: {
148
- contractAddress: '0x...', // Your contract address
149
- abi: {
150
- name: 'latestRoundData',
151
- inputs: [],
152
- outputs: [
153
- { name: 'roundId', type: 'uint80' },
154
- { name: 'answer', type: 'int256' },
155
- { name: 'startedAt', type: 'uint256' },
156
- { name: 'updatedAt', type: 'uint256' },
157
- { name: 'answeredInRound', type: 'uint80' },
158
- ],
159
- stateMutability: 'view',
160
- type: 'function',
161
- },
162
- },
163
- });
164
-
165
- // Process state using WASM
166
- const wasmBridge = new HCS7.WasmBridge();
167
- await wasmBridge.initWasm(wasmBytes);
168
- const result = await wasmBridge.executeCommand({
169
- p: 'wasm',
170
- op: 'process',
171
- m: 'process_state',
172
- c: {
173
- wasmTopicId: '0.0.123456',
174
- inputType: {
175
- stateData: contractState,
176
- },
177
- outputType: {
178
- type: 'json',
179
- format: 'string',
180
- },
181
- },
182
- });
183
- ```
69
+ #### Inscribe Demo
184
70
 
185
- ### HCS-3: Recursive Content Loading
186
-
187
- ```typescript
188
- import { HCS3 } from '@hashgraphonline/standards-sdk';
189
-
190
- // Initialize HCS-3 with configuration
191
- const hcs = new HCS3.HCS({
192
- cdnUrl: 'https://kiloscribe.com/api/inscription-cdn/',
193
- network: 'mainnet',
194
- retryAttempts: 3,
195
- retryBackoff: 300,
196
- debug: false,
197
- });
198
-
199
- // Load specific content types
200
- await hcs.loadScript('hcs://1/0.0.123456');
201
- await hcs.loadImage('hcs://1/0.0.123456');
202
- await hcs.loadVideo('hcs://1/0.0.123456');
203
- await hcs.loadAudio('hcs://1/0.0.123456');
204
- await hcs.loadGLB('hcs://1/0.0.123456');
205
- ```
71
+ The inscribe demo (`demo/inscribe-demo.ts`) showcases different file inscription capabilities:
206
72
 
207
- ### HCS-10: AI Agent Communication
208
-
209
- ```typescript
210
- import { HCS10 } from '@hashgraphonline/standards-sdk';
211
-
212
- // Initialize HCS-10 SDK
213
- const sdk = new HCS10.SDK({
214
- network: 'mainnet',
215
- topicId: '0.0.123456',
216
- });
217
-
218
- // Send message to AI agent
219
- await sdk.sendMessage({
220
- type: 'command',
221
- content: 'Process this data',
222
- metadata: {
223
- agentId: 'agent-123',
224
- timestamp: Date.now(),
225
- },
226
- });
227
- ```
73
+ - Text inscription using buffers
74
+ - URL-based inscriptions
75
+ - File buffer inscriptions
76
+ - Creating Hashinal NFTs from URLs
77
+ - Creating Hashinal NFTs from buffers
78
+ - Creating Hashinal NFTs from text content
79
+
80
+ Each inscription demonstrates different options and metadata capabilities.
81
+
82
+ #### HCS-10 AI Agent Communication Demo
83
+
84
+ The HCS-10 demo (`demo/hcs-10/index.ts`) demonstrates trustless peer-to-peer communication between AI agents:
85
+
86
+ - Agent creation and registration (Alice and Bob)
87
+ - Agent metadata and profile management
88
+ - Connection establishment between agents
89
+ - Sending and retrieving small messages
90
+ - Sending and retrieving large messages with recursive storage
91
+ - Message data processing
92
+
93
+ The demo automatically handles agent funding, topic creation, and registration with the global registry.
228
94
 
229
95
  ## Contributing
230
96
 
231
- 1. Fork the repository.
232
- 2. Create a new feature branch.
233
- 3. Implement your changes.
234
- 4. Submit a pull request.
97
+ Please read our [Contributing Guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) before contributing to this project.
98
+
99
+ For bugs and feature requests, please use the [issue templates](https://github.com/hashgraph-online/standards-sdk/issues/new/choose).
100
+
101
+ ## Security
102
+
103
+ For security concerns, please refer to our [Security Policy](SECURITY.md).
104
+
105
+ ## Maintainers
106
+
107
+ See [MAINTAINERS.md](MAINTAINERS.md) for a list of project maintainers.
235
108
 
236
109
  ## Resources
237
110
 
238
111
  - [HCS Standards Documentation](https://hcs-improvement-proposals.pages.dev/docs/standards)
239
112
  - [Hedera Documentation](https://docs.hedera.com)
240
- - Join our [Telegram Community](https://t.me/hashinals)
113
+ - [Telegram Community](https://t.me/hashinals)
241
114
 
242
115
  ## License
243
116
 
@@ -650,7 +650,7 @@ let Logger$1 = (_a = class {
650
650
  }
651
651
  }
652
652
  }, _a.instances = /* @__PURE__ */ new Map(), _a);
653
- const sleep = (ms2) => {
653
+ const sleep$1 = (ms2) => {
654
654
  return new Promise((resolve) => setTimeout(resolve, ms2));
655
655
  };
656
656
  class HCS {
@@ -16315,7 +16315,7 @@ async function waitForInscriptionConfirmation(sdk, transactionId, maxAttempts =
16315
16315
  intervalMs
16316
16316
  });
16317
16317
  try {
16318
- const waitMethod = sdk.waitForInscription;
16318
+ const waitMethod = sdk.waitForInscription.bind(sdk);
16319
16319
  const wrappedCallback = (data) => {
16320
16320
  const stage = data.stage || "confirming";
16321
16321
  const message = data.message || "Processing inscription";
@@ -16324,7 +16324,7 @@ async function waitForInscriptionConfirmation(sdk, transactionId, maxAttempts =
16324
16324
  stage,
16325
16325
  message,
16326
16326
  progressPercent: percent,
16327
- details: data.details
16327
+ details: {}
16328
16328
  });
16329
16329
  };
16330
16330
  return await waitMethod(
@@ -16335,6 +16335,7 @@ async function waitForInscriptionConfirmation(sdk, transactionId, maxAttempts =
16335
16335
  wrappedCallback
16336
16336
  );
16337
16337
  } catch (e) {
16338
+ console.log(e);
16338
16339
  logger.debug("Falling back to standard waitForInscription method", {
16339
16340
  error: e
16340
16341
  });
@@ -23121,8 +23122,8 @@ class HCS11Client {
23121
23122
  {
23122
23123
  network: this.network,
23123
23124
  waitForConfirmation,
23124
- waitMaxAttempts: 60,
23125
- waitIntervalMs: 2e3,
23125
+ waitMaxAttempts: 150,
23126
+ waitIntervalMs: 4e3,
23126
23127
  logging: {
23127
23128
  level: "debug"
23128
23129
  },
@@ -23164,7 +23165,7 @@ class HCS11Client {
23164
23165
  },
23165
23166
  {
23166
23167
  waitForConfirmation,
23167
- waitMaxAttempts: 60,
23168
+ waitMaxAttempts: 150,
23168
23169
  waitIntervalMs: 2e3,
23169
23170
  logging: {
23170
23171
  level: "debug"
@@ -23252,8 +23253,8 @@ class HCS11Client {
23252
23253
  waitMaxAttempts: 100,
23253
23254
  waitIntervalMs: 2e3,
23254
23255
  progressCallback: (data) => {
23255
- const adjustedPercent = 20 + (data.progressPercent || 0) * 0.75;
23256
- progressReporter.report({
23256
+ const adjustedPercent = 20 + Number(data?.progressPercent || 0) * 0.75;
23257
+ progressReporter?.report({
23257
23258
  stage: data.stage,
23258
23259
  message: data.message,
23259
23260
  progressPercent: adjustedPercent,
@@ -23356,9 +23357,9 @@ class HCS11Client {
23356
23357
  });
23357
23358
  }
23358
23359
  });
23359
- if (!inscriptionResult.success) {
23360
+ if (!inscriptionResult?.success) {
23360
23361
  progressReporter.failed("Profile inscription failed", {
23361
- error: inscriptionResult.error
23362
+ error: inscriptionResult?.error
23362
23363
  });
23363
23364
  return inscriptionResult;
23364
23365
  }
@@ -23370,12 +23371,12 @@ class HCS11Client {
23370
23371
  );
23371
23372
  if (!memoResult.success) {
23372
23373
  progressReporter.failed("Failed to update account memo", {
23373
- error: memoResult.error
23374
+ error: memoResult?.error
23374
23375
  });
23375
23376
  return {
23376
23377
  ...inscriptionResult,
23377
23378
  success: false,
23378
- error: memoResult.error
23379
+ error: memoResult?.error
23379
23380
  };
23380
23381
  }
23381
23382
  }
@@ -23544,6 +23545,7 @@ class HCS11Client {
23544
23545
  }
23545
23546
  }
23546
23547
  }
23548
+ const sleep = (ms2) => new Promise((resolve) => setTimeout(resolve, ms2));
23547
23549
  class Registration {
23548
23550
  /**
23549
23551
  * Checks the status of a registration request.
@@ -23649,22 +23651,22 @@ class Registration {
23649
23651
  auth: { operatorId: "0.0.0" }
23650
23652
  });
23651
23653
  logger?.info(
23652
- "Fetching profile by account ID",
23653
- `${accountId}-${network}`
23654
+ `Fetching profile by account ID ${accountId} on ${network}`
23654
23655
  );
23656
+ await sleep(5e3);
23655
23657
  const profileResult = await hcs11Client.fetchProfileByAccountId(
23656
23658
  accountId,
23657
23659
  network
23658
23660
  );
23659
23661
  logger?.info("Profile fetched", profileResult);
23660
- if (profileResult.error) {
23662
+ if (profileResult?.error) {
23661
23663
  logger?.error("Error fetching profile", profileResult.error);
23662
23664
  return {
23663
23665
  error: profileResult.error,
23664
23666
  success: false
23665
23667
  };
23666
23668
  }
23667
- if (!profileResult.success || !profileResult.profile) {
23669
+ if (!profileResult?.success || !profileResult?.profile) {
23668
23670
  if (logger) {
23669
23671
  logger.error("Profile not found for agent registration");
23670
23672
  }
@@ -24316,7 +24318,7 @@ class HCS10Client extends HCS10BaseClient {
24316
24318
  `Failed to inscribe profile picture: ${imageResult.error}`
24317
24319
  );
24318
24320
  throw new Error(
24319
- imageResult.error || "Failed to inscribe profile picture"
24321
+ imageResult?.error || "Failed to inscribe profile picture"
24320
24322
  );
24321
24323
  }
24322
24324
  this.logger.info(
@@ -26389,6 +26391,6 @@ export {
26389
26391
  inscribe,
26390
26392
  inscribeWithSigner,
26391
26393
  retrieveInscription,
26392
- sleep
26394
+ sleep$1 as sleep
26393
26395
  };
26394
26396
  //# sourceMappingURL=standards-sdk.es.js.map