@hashgraphonline/standards-sdk 0.0.23 → 0.0.25

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.
@@ -3,7 +3,7 @@ import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';
3
3
  import { Logger, LogLevel } from '../utils/logger';
4
4
  import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk';
5
5
  import { HCS10BaseClient } from './base-client';
6
- import { AgentConfig, NetworkType } from './types.d';
6
+ import { AgentConfig, NetworkType, RegistrationProgressCallback } from './types.d';
7
7
  export type BrowserHCSClientConfig = {
8
8
  network: 'mainnet' | 'testnet';
9
9
  hwc: HashinalsWalletConnectSDK;
@@ -67,7 +67,11 @@ export declare class BrowserHCSClient extends HCS10BaseClient {
67
67
  success: boolean;
68
68
  }>;
69
69
  createAndRegisterAgent(name: string, description: string, capabilities: number[], metadata: AgentMetadata, pfpBuffer: Buffer, pfpFileName: string, network: NetworkType, existingPfpTopicId?: string): Promise<BrowserAgentConfig>;
70
- registerAgentWithGuardedRegistry(accountId: string, inboundTopicId: string, network?: string, maxAttempts?: number, delayMs?: number): Promise<{
70
+ registerAgentWithGuardedRegistry(accountId: string, inboundTopicId: string, network?: string, options?: {
71
+ progressCallback?: RegistrationProgressCallback;
72
+ maxAttempts?: number;
73
+ delayMs?: number;
74
+ }): Promise<{
71
75
  error?: string;
72
76
  success: boolean;
73
77
  transaction?: any;
@@ -22,6 +22,19 @@ export interface AgentMetadata {
22
22
  creator?: string;
23
23
  properties?: Record<string, any>;
24
24
  }
25
+ /**
26
+ * Progress report data for registration operations
27
+ */
28
+ export interface RegistrationProgressData {
29
+ stage: 'preparing' | 'submitting' | 'confirming' | 'verifying' | 'completed';
30
+ message: string;
31
+ progressPercent?: number;
32
+ details?: Record<string, any>;
33
+ }
34
+ /**
35
+ * Progress callback function type for registration operations
36
+ */
37
+ export type RegistrationProgressCallback = (data: RegistrationProgressData) => void;
25
38
  export declare class HCS10Client extends HCS10BaseClient {
26
39
  private client;
27
40
  private operatorPrivateKey;
@@ -135,11 +148,14 @@ export declare class HCS10Client extends HCS10BaseClient {
135
148
  * @param accountId Account ID to register
136
149
  * @param inboundTopicId Inbound topic ID for the agent
137
150
  * @param network Network type ('mainnet' or 'testnet')
138
- * @param maxAttempts Maximum number of attempts for confirmation
139
- * @param delayMs Delay between confirmation attempts
151
+ * @param options Optional configuration including progress callback and confirmation settings
140
152
  * @returns Registration result
141
153
  */
142
- registerAgentWithGuardedRegistry(accountId: string, inboundTopicId: string, network?: string, maxAttempts?: number, delayMs?: number): Promise<AgentRegistrationResult>;
154
+ registerAgentWithGuardedRegistry(accountId: string, inboundTopicId: string, network?: string, options?: {
155
+ progressCallback?: RegistrationProgressCallback;
156
+ maxAttempts?: number;
157
+ delayMs?: number;
158
+ }): Promise<AgentRegistrationResult>;
143
159
  /**
144
160
  * Registers an agent with the guarded registry. Should be called by a registry.
145
161
  * @param registryTopicId - The topic ID of the guarded registry.
@@ -32770,13 +32770,22 @@ class HCS10Client extends HCS10BaseClient {
32770
32770
  * @param accountId Account ID to register
32771
32771
  * @param inboundTopicId Inbound topic ID for the agent
32772
32772
  * @param network Network type ('mainnet' or 'testnet')
32773
- * @param maxAttempts Maximum number of attempts for confirmation
32774
- * @param delayMs Delay between confirmation attempts
32773
+ * @param options Optional configuration including progress callback and confirmation settings
32775
32774
  * @returns Registration result
32776
32775
  */
32777
- async registerAgentWithGuardedRegistry(accountId, inboundTopicId, network = this.network, maxAttempts = 60, delayMs = 2e3) {
32776
+ async registerAgentWithGuardedRegistry(accountId, inboundTopicId, network = this.network, options) {
32778
32777
  try {
32779
32778
  this.logger.info("Registering agent with guarded registry");
32779
+ const maxAttempts = (options == null ? void 0 : options.maxAttempts) ?? 60;
32780
+ const delayMs = (options == null ? void 0 : options.delayMs) ?? 2e3;
32781
+ const progressCallback = options == null ? void 0 : options.progressCallback;
32782
+ if (progressCallback) {
32783
+ progressCallback({
32784
+ stage: "preparing",
32785
+ message: "Preparing agent registration",
32786
+ progressPercent: 10
32787
+ });
32788
+ }
32780
32789
  const registrationResult = await this.executeRegistration(
32781
32790
  accountId,
32782
32791
  inboundTopicId,
@@ -32787,6 +32796,16 @@ class HCS10Client extends HCS10BaseClient {
32787
32796
  if (!registrationResult.success) {
32788
32797
  return registrationResult;
32789
32798
  }
32799
+ if (progressCallback) {
32800
+ progressCallback({
32801
+ stage: "submitting",
32802
+ message: "Submitting registration to registry",
32803
+ progressPercent: 30,
32804
+ details: {
32805
+ transactionId: registrationResult.transactionId
32806
+ }
32807
+ });
32808
+ }
32790
32809
  if (registrationResult.transaction) {
32791
32810
  const transaction = Transaction.fromBytes(
32792
32811
  Buffer2.from(registrationResult.transaction, "base64")
@@ -32795,6 +32814,18 @@ class HCS10Client extends HCS10BaseClient {
32795
32814
  await transaction.execute(this.client);
32796
32815
  this.logger.info(`Successfully processed registration transaction`);
32797
32816
  }
32817
+ if (progressCallback) {
32818
+ progressCallback({
32819
+ stage: "confirming",
32820
+ message: "Confirming registration transaction",
32821
+ progressPercent: 60,
32822
+ details: {
32823
+ accountId,
32824
+ inboundTopicId,
32825
+ transactionId: registrationResult.transactionId
32826
+ }
32827
+ });
32828
+ }
32798
32829
  const confirmed = await this.waitForRegistrationConfirmation(
32799
32830
  registrationResult.transactionId,
32800
32831
  network,
@@ -32803,6 +32834,17 @@ class HCS10Client extends HCS10BaseClient {
32803
32834
  delayMs,
32804
32835
  this.logger
32805
32836
  );
32837
+ if (progressCallback) {
32838
+ progressCallback({
32839
+ stage: "completed",
32840
+ message: "Agent registration complete",
32841
+ progressPercent: 100,
32842
+ details: {
32843
+ confirmed,
32844
+ transactionId: registrationResult.transactionId
32845
+ }
32846
+ });
32847
+ }
32806
32848
  return {
32807
32849
  ...registrationResult,
32808
32850
  confirmed
@@ -33285,9 +33327,19 @@ class BrowserHCSClient extends HCS10BaseClient {
33285
33327
  throw new Error(`Failed to create and register agent: ${error.message}`);
33286
33328
  }
33287
33329
  }
33288
- async registerAgentWithGuardedRegistry(accountId, inboundTopicId, network = this.network, maxAttempts = 60, delayMs = 2e3) {
33330
+ async registerAgentWithGuardedRegistry(accountId, inboundTopicId, network = this.network, options) {
33289
33331
  try {
33290
33332
  this.logger.info("Registering agent with guarded registry");
33333
+ const maxAttempts = (options == null ? void 0 : options.maxAttempts) ?? 60;
33334
+ const delayMs = (options == null ? void 0 : options.delayMs) ?? 2e3;
33335
+ const progressCallback = options == null ? void 0 : options.progressCallback;
33336
+ if (progressCallback) {
33337
+ progressCallback({
33338
+ stage: "preparing",
33339
+ message: "Preparing agent registration",
33340
+ progressPercent: 10
33341
+ });
33342
+ }
33291
33343
  const registrationResult = await this.executeRegistration(
33292
33344
  accountId,
33293
33345
  inboundTopicId,
@@ -33298,6 +33350,16 @@ class BrowserHCSClient extends HCS10BaseClient {
33298
33350
  if (!registrationResult.success) {
33299
33351
  return registrationResult;
33300
33352
  }
33353
+ if (progressCallback) {
33354
+ progressCallback({
33355
+ stage: "submitting",
33356
+ message: "Submitting registration to registry",
33357
+ progressPercent: 30,
33358
+ details: {
33359
+ transactionId: registrationResult.transactionId
33360
+ }
33361
+ });
33362
+ }
33301
33363
  if (registrationResult.transaction) {
33302
33364
  const transaction = Transaction.fromBytes(
33303
33365
  Buffer2.from(registrationResult.transaction, "base64")
@@ -33316,6 +33378,18 @@ class BrowserHCSClient extends HCS10BaseClient {
33316
33378
  }
33317
33379
  this.logger.info(`Successfully processed registration transaction`);
33318
33380
  }
33381
+ if (progressCallback) {
33382
+ progressCallback({
33383
+ stage: "confirming",
33384
+ message: "Confirming registration transaction",
33385
+ progressPercent: 60,
33386
+ details: {
33387
+ accountId,
33388
+ inboundTopicId,
33389
+ transactionId: registrationResult.transactionId
33390
+ }
33391
+ });
33392
+ }
33319
33393
  const confirmed = await this.waitForRegistrationConfirmation(
33320
33394
  registrationResult.transactionId,
33321
33395
  network,
@@ -33323,6 +33397,17 @@ class BrowserHCSClient extends HCS10BaseClient {
33323
33397
  maxAttempts,
33324
33398
  delayMs
33325
33399
  );
33400
+ if (progressCallback) {
33401
+ progressCallback({
33402
+ stage: "completed",
33403
+ message: "Agent registration complete",
33404
+ progressPercent: 100,
33405
+ details: {
33406
+ confirmed,
33407
+ transactionId: registrationResult.transactionId
33408
+ }
33409
+ });
33410
+ }
33326
33411
  return {
33327
33412
  ...registrationResult,
33328
33413
  confirmed