@hashgraphonline/standards-sdk 0.0.2 → 0.0.3

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.
@@ -1,4 +1,4 @@
1
- import { d as dijkstraExports, M as ModalCtrl, R as RouterCtrl, T as ToastCtrl, a as ThemeCtrl, E as EventsCtrl, b as ExplorerCtrl, C as ConfigCtrl, c as CoreUtil, O as OptionsCtrl } from "./index-wA88M1Il.js";
1
+ import { d as dijkstraExports, M as ModalCtrl, R as RouterCtrl, T as ToastCtrl, a as ThemeCtrl, E as EventsCtrl, b as ExplorerCtrl, C as ConfigCtrl, c as CoreUtil, O as OptionsCtrl } from "./index-jG6VI_MC.js";
2
2
  /**
3
3
  * @license
4
4
  * Copyright 2019 Google LLC
@@ -129135,16 +129135,19 @@ class HCS10Client extends Outbound {
129135
129135
  throw new Error(`Error retrieving topics from account: ${error.message}`);
129136
129136
  }
129137
129137
  }
129138
- async registerAgentWithGaurdedRegistry(accountId, inboundTopicId, metadata, network, maxAttempts = 10, delayMs = 2e3) {
129139
- const baseUrl = "https://hcs-10.hashgraphonline.com";
129140
- const options = { maxAttempts, delayMs, baseUrl };
129138
+ async registerAgentWithGaurdedRegistry(accountId, inboundTopicId, metadata, network, maxAttempts = 60, delayMs = 2e3) {
129139
+ const options = {
129140
+ maxAttempts,
129141
+ delayMs,
129142
+ baseUrl: this.guardedRegistryBaseUrl
129143
+ };
129141
129144
  try {
129142
129145
  const registrationResult = await this.executeRegistration(
129143
129146
  accountId,
129144
129147
  inboundTopicId,
129145
129148
  metadata,
129146
129149
  network,
129147
- baseUrl
129150
+ this.guardedRegistryBaseUrl
129148
129151
  );
129149
129152
  if (!registrationResult.success) {
129150
129153
  return registrationResult;
@@ -129258,6 +129261,15 @@ class HCS10Client extends Outbound {
129258
129261
  );
129259
129262
  return false;
129260
129263
  }
129264
+ /**
129265
+ * Registers an agent with the guarded registry. Should be called by a registry.
129266
+ * @param registryTopicId - The topic ID of the guarded registry.
129267
+ * @param accountId - The account ID of the agent
129268
+ * @param inboundTopicId - The topic ID of the inbound topic
129269
+ * @param metadata - The metadata of the agent
129270
+ * @param memo - The memo of the agent
129271
+ * @param submitKey - The submit key of the agent
129272
+ */
129261
129273
  async registerAgent(registryTopicId, accountId, inboundTopicId, metadata, memo, submitKey) {
129262
129274
  const validTags = [
129263
129275
  "autonomous",
@@ -129592,7 +129604,7 @@ class HCS10Client extends Outbound {
129592
129604
  const status = await sdk.waitForInscription(result.jobId, 30, 4e3, true);
129593
129605
  return status;
129594
129606
  }
129595
- async waitForConnectionConfirmation(inboundTopicId, connectionRequestId, maxAttempts = 10, delayMs = 2e3) {
129607
+ async waitForConnectionConfirmation(inboundTopicId, connectionRequestId, maxAttempts = 60, delayMs = 2e3) {
129596
129608
  this.logger.info(
129597
129609
  `Waiting for connection confirmation on inbound topic ${inboundTopicId}`
129598
129610
  );
@@ -133958,7 +133970,7 @@ function publicKeyToAddress(publicKey) {
133958
133970
  }
133959
133971
  async function recoverPublicKey({ hash: hash3, signature: signature2 }) {
133960
133972
  const hashHex = isHex(hash3) ? hash3 : toHex(hash3);
133961
- const { secp256k1: secp256k12 } = await import("./secp256k1-C2Ousbk3.js");
133973
+ const { secp256k1: secp256k12 } = await import("./secp256k1-CXHq2QGB.js");
133962
133974
  const signature_ = (() => {
133963
133975
  if (typeof signature2 === "object" && "r" in signature2 && "s" in signature2) {
133964
133976
  const { r: r3, s: s2, v: v2, yParity } = signature2;
@@ -145704,7 +145716,7 @@ class WalletConnectModal {
145704
145716
  }
145705
145717
  async initUi() {
145706
145718
  if (typeof window !== "undefined") {
145707
- await import("./index-DwQun2ka.js");
145719
+ await import("./index-G5o9_z49.js");
145708
145720
  const modal = document.createElement("wcm-modal");
145709
145721
  document.body.insertAdjacentElement("beforeend", modal);
145710
145722
  OptionsCtrl.setIsUiLoaded(true);
@@ -152216,6 +152228,31 @@ class BrowserHCSClient extends Outbound {
152216
152228
  network: config.network,
152217
152229
  logLevel: config.logLevel
152218
152230
  });
152231
+ this.validTags = [
152232
+ "autonomous",
152233
+ "goal_based",
152234
+ "meme",
152235
+ "image_generation",
152236
+ "learning",
152237
+ "utility",
152238
+ "reflex",
152239
+ "hierarchical",
152240
+ "task_automation",
152241
+ "decision_support",
152242
+ "nlp",
152243
+ "customer_interaction",
152244
+ "data_processing",
152245
+ "knowledge_retrieval",
152246
+ "real_time",
152247
+ "web3_interaction",
152248
+ "secure_messaging",
152249
+ "multi_agent_systems",
152250
+ "intelligent_workflows",
152251
+ "dynamic_planning",
152252
+ "environment_adaptation",
152253
+ "feedback_driven"
152254
+ ];
152255
+ this.guardedRegistryBaseUrl = config.guardedRegistryBaseUrl;
152219
152256
  this.hwc = config.hwc;
152220
152257
  this.guardedRegistryTopicId = config.guardedRegistryTopicId;
152221
152258
  this.logger = Logger$3.getInstance({
@@ -152223,17 +152260,6 @@ class BrowserHCSClient extends Outbound {
152223
152260
  module: "HCS-Browser"
152224
152261
  });
152225
152262
  }
152226
- async registerAgent(registryTopicId, accountId, inboundTopicId, metadata, memo) {
152227
- this.logger.info("Registering agent");
152228
- const payload = {
152229
- p: "hcs-10",
152230
- op: "register",
152231
- operator_id: `${inboundTopicId}@${accountId}`,
152232
- metadata,
152233
- m: memo
152234
- };
152235
- return await this.submitPayload(registryTopicId, payload);
152236
- }
152237
152263
  async sendMessage(connectionTopicId, operatorId, data, memo) {
152238
152264
  this.logger.info("Sending message");
152239
152265
  const payload = {
@@ -152484,7 +152510,7 @@ class BrowserHCSClient extends Outbound {
152484
152510
  };
152485
152511
  }
152486
152512
  }
152487
- async createAndRegisterAgent(name, description, tags, metadata, pfpBuffer, pfpFileName) {
152513
+ async createAndRegisterAgent(name, description, tags, metadata, pfpBuffer, pfpFileName, network) {
152488
152514
  const { accountId } = this.getAccountAndSigner();
152489
152515
  const {
152490
152516
  outboundTopicId,
@@ -152509,16 +152535,12 @@ class BrowserHCSClient extends Outbound {
152509
152535
  logo: pfpTopicId ? `hcs://1/${pfpTopicId}` : void 0
152510
152536
  };
152511
152537
  const operatorId = `${inboundTopicId}@${accountId}`;
152512
- const registration = await this.registerAgent(
152513
- this.guardedRegistryTopicId,
152538
+ await this.registerAgentWithGaurdedRegistry(
152514
152539
  accountId,
152515
152540
  inboundTopicId,
152516
152541
  finalMetadata,
152517
- "Registering agent with guarded registry"
152542
+ network
152518
152543
  );
152519
- if (registration.error) {
152520
- throw new Error(registration.error);
152521
- }
152522
152544
  return {
152523
152545
  accountId,
152524
152546
  operatorId,
@@ -152529,6 +152551,41 @@ class BrowserHCSClient extends Outbound {
152529
152551
  client: this
152530
152552
  };
152531
152553
  }
152554
+ async registerAgentWithGaurdedRegistry(accountId, inboundTopicId, metadata, network, maxAttempts = 60, delayMs = 2e3) {
152555
+ const hasValidTag = metadata.tags.some((tag) => this.validTags.includes(tag));
152556
+ if (!hasValidTag) {
152557
+ return {
152558
+ error: "Metadata must contain at least one valid tag.",
152559
+ success: false
152560
+ };
152561
+ }
152562
+ const invalidTags = metadata.tags.filter((tag) => !this.validTags.includes(tag));
152563
+ if (invalidTags.length > 0) {
152564
+ return {
152565
+ error: `Invalid tags found: ${invalidTags.join(", ")}. All tags must be valid.`,
152566
+ success: false
152567
+ };
152568
+ }
152569
+ this.logger.info("Registering agent with guarded registry");
152570
+ const payload = {
152571
+ p: "hcs-10",
152572
+ op: "register",
152573
+ account_id: accountId,
152574
+ inbound_topic_id: inboundTopicId,
152575
+ metadata,
152576
+ m: "Registering agent with guarded registry"
152577
+ };
152578
+ const response = await this.submitPayload(this.guardedRegistryTopicId, payload);
152579
+ if (response.error) {
152580
+ return {
152581
+ error: response.error,
152582
+ success: false
152583
+ };
152584
+ }
152585
+ return {
152586
+ success: true
152587
+ };
152588
+ }
152532
152589
  async storeHCS11Profile(agentName, agentDescription, inboundTopicId, outboundTopicId, tags = [], metadata = {}, pfpBuffer, pfpFileName) {
152533
152590
  try {
152534
152591
  let pfpTopicId;
@@ -1,4 +1,4 @@
1
- import { H as Hash, e as createView, f as aexists, t as toBytes, g as aoutput, w as wrapConstructor, r as rotr, h as ahash, i as abytes$1, j as randomBytes, k as concatBytes$1 } from "./index-wA88M1Il.js";
1
+ import { H as Hash, e as createView, f as aexists, t as toBytes, g as aoutput, w as wrapConstructor, r as rotr, h as ahash, i as abytes$1, j as randomBytes, k as concatBytes$1 } from "./index-jG6VI_MC.js";
2
2
  function setBigUint64(view, byteOffset, value, isLE) {
3
3
  if (typeof view.setBigUint64 === "function")
4
4
  return view.setBigUint64(byteOffset, value, isLE);
@@ -1,4 +1,4 @@
1
- import { n, l, m, L, W, o, p, q } from "./index-wA88M1Il.js";
1
+ import { n, l, m, L, W, o, p, q } from "./index-jG6VI_MC.js";
2
2
  export {
3
3
  n as EVMBridge,
4
4
  l as HCS10,