@hashgraphonline/standards-sdk 0.0.2 → 0.0.4
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-
|
|
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-CXCIEcrN.js";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2019 Google LLC
|
|
@@ -117532,6 +117532,9 @@ __publicField(_InscriptionSDK, "VALID_MIME_TYPES", {
|
|
|
117532
117532
|
jpeg: "image/jpeg",
|
|
117533
117533
|
png: "image/png",
|
|
117534
117534
|
gif: "image/gif",
|
|
117535
|
+
ico: "image/x-icon",
|
|
117536
|
+
heic: "image/heic",
|
|
117537
|
+
heif: "image/heif",
|
|
117535
117538
|
bmp: "image/bmp",
|
|
117536
117539
|
webp: "image/webp",
|
|
117537
117540
|
tiff: "image/tiff",
|
|
@@ -117548,11 +117551,64 @@ __publicField(_InscriptionSDK, "VALID_MIME_TYPES", {
|
|
|
117548
117551
|
pptx: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
117549
117552
|
html: "text/html",
|
|
117550
117553
|
css: "text/css",
|
|
117554
|
+
php: "text/x-php",
|
|
117555
|
+
java: "text/x-java",
|
|
117551
117556
|
js: "text/javascript",
|
|
117552
117557
|
csv: "text/csv",
|
|
117553
117558
|
json: "application/json",
|
|
117554
117559
|
txt: "text/plain",
|
|
117555
|
-
glb: "model/gltf-binary"
|
|
117560
|
+
glb: "model/gltf-binary",
|
|
117561
|
+
wav: "audio/wav",
|
|
117562
|
+
ogg: "audio/ogg",
|
|
117563
|
+
flac: "audio/flac",
|
|
117564
|
+
aac: "audio/aac",
|
|
117565
|
+
m4a: "audio/mp4",
|
|
117566
|
+
avi: "video/x-msvideo",
|
|
117567
|
+
mov: "video/quicktime",
|
|
117568
|
+
mkv: "video/x-matroska",
|
|
117569
|
+
m4v: "video/mp4",
|
|
117570
|
+
ts: "video/mp2t",
|
|
117571
|
+
zip: "application/zip",
|
|
117572
|
+
rar: "application/vnd.rar",
|
|
117573
|
+
tar: "application/x-tar",
|
|
117574
|
+
gz: "application/gzip",
|
|
117575
|
+
"7z": "application/x-7z-compressed",
|
|
117576
|
+
xml: "application/xml",
|
|
117577
|
+
yaml: "application/yaml",
|
|
117578
|
+
yml: "application/yaml",
|
|
117579
|
+
md: "text/markdown",
|
|
117580
|
+
markdown: "text/markdown",
|
|
117581
|
+
rtf: "application/rtf",
|
|
117582
|
+
gltf: "model/gltf+json",
|
|
117583
|
+
usdz: "model/vnd.usdz+zip",
|
|
117584
|
+
obj: "model/obj",
|
|
117585
|
+
stl: "model/stl",
|
|
117586
|
+
fbx: "application/octet-stream",
|
|
117587
|
+
ttf: "font/ttf",
|
|
117588
|
+
otf: "font/otf",
|
|
117589
|
+
woff: "font/woff",
|
|
117590
|
+
woff2: "font/woff2",
|
|
117591
|
+
eot: "application/vnd.ms-fontobject",
|
|
117592
|
+
psd: "image/vnd.adobe.photoshop",
|
|
117593
|
+
ai: "application/postscript",
|
|
117594
|
+
eps: "application/postscript",
|
|
117595
|
+
ps: "application/postscript",
|
|
117596
|
+
sqlite: "application/vnd.sqlite3",
|
|
117597
|
+
db: "application/vnd.sqlite3",
|
|
117598
|
+
apk: "application/vnd.android.package-archive",
|
|
117599
|
+
ics: "text/calendar",
|
|
117600
|
+
vcf: "text/vcard",
|
|
117601
|
+
py: "text/x-python",
|
|
117602
|
+
rb: "text/x-ruby",
|
|
117603
|
+
go: "text/x-go",
|
|
117604
|
+
rs: "text/x-rust",
|
|
117605
|
+
typescript: "text/typescript",
|
|
117606
|
+
jsx: "text/jsx",
|
|
117607
|
+
tsx: "text/tsx",
|
|
117608
|
+
sql: "application/sql",
|
|
117609
|
+
toml: "application/toml",
|
|
117610
|
+
avif: "image/avif",
|
|
117611
|
+
jxl: "image/jxl"
|
|
117556
117612
|
});
|
|
117557
117613
|
let InscriptionSDK = _InscriptionSDK;
|
|
117558
117614
|
class Registration {
|
|
@@ -129135,16 +129191,19 @@ class HCS10Client extends Outbound {
|
|
|
129135
129191
|
throw new Error(`Error retrieving topics from account: ${error.message}`);
|
|
129136
129192
|
}
|
|
129137
129193
|
}
|
|
129138
|
-
async registerAgentWithGaurdedRegistry(accountId, inboundTopicId, metadata, network, maxAttempts =
|
|
129139
|
-
const
|
|
129140
|
-
|
|
129194
|
+
async registerAgentWithGaurdedRegistry(accountId, inboundTopicId, metadata, network, maxAttempts = 60, delayMs = 2e3) {
|
|
129195
|
+
const options = {
|
|
129196
|
+
maxAttempts,
|
|
129197
|
+
delayMs,
|
|
129198
|
+
baseUrl: this.guardedRegistryBaseUrl
|
|
129199
|
+
};
|
|
129141
129200
|
try {
|
|
129142
129201
|
const registrationResult = await this.executeRegistration(
|
|
129143
129202
|
accountId,
|
|
129144
129203
|
inboundTopicId,
|
|
129145
129204
|
metadata,
|
|
129146
129205
|
network,
|
|
129147
|
-
|
|
129206
|
+
this.guardedRegistryBaseUrl
|
|
129148
129207
|
);
|
|
129149
129208
|
if (!registrationResult.success) {
|
|
129150
129209
|
return registrationResult;
|
|
@@ -129258,6 +129317,15 @@ class HCS10Client extends Outbound {
|
|
|
129258
129317
|
);
|
|
129259
129318
|
return false;
|
|
129260
129319
|
}
|
|
129320
|
+
/**
|
|
129321
|
+
* Registers an agent with the guarded registry. Should be called by a registry.
|
|
129322
|
+
* @param registryTopicId - The topic ID of the guarded registry.
|
|
129323
|
+
* @param accountId - The account ID of the agent
|
|
129324
|
+
* @param inboundTopicId - The topic ID of the inbound topic
|
|
129325
|
+
* @param metadata - The metadata of the agent
|
|
129326
|
+
* @param memo - The memo of the agent
|
|
129327
|
+
* @param submitKey - The submit key of the agent
|
|
129328
|
+
*/
|
|
129261
129329
|
async registerAgent(registryTopicId, accountId, inboundTopicId, metadata, memo, submitKey) {
|
|
129262
129330
|
const validTags = [
|
|
129263
129331
|
"autonomous",
|
|
@@ -129592,7 +129660,7 @@ class HCS10Client extends Outbound {
|
|
|
129592
129660
|
const status = await sdk.waitForInscription(result.jobId, 30, 4e3, true);
|
|
129593
129661
|
return status;
|
|
129594
129662
|
}
|
|
129595
|
-
async waitForConnectionConfirmation(inboundTopicId, connectionRequestId, maxAttempts =
|
|
129663
|
+
async waitForConnectionConfirmation(inboundTopicId, connectionRequestId, maxAttempts = 60, delayMs = 2e3) {
|
|
129596
129664
|
this.logger.info(
|
|
129597
129665
|
`Waiting for connection confirmation on inbound topic ${inboundTopicId}`
|
|
129598
129666
|
);
|
|
@@ -133958,7 +134026,7 @@ function publicKeyToAddress(publicKey) {
|
|
|
133958
134026
|
}
|
|
133959
134027
|
async function recoverPublicKey({ hash: hash3, signature: signature2 }) {
|
|
133960
134028
|
const hashHex = isHex(hash3) ? hash3 : toHex(hash3);
|
|
133961
|
-
const { secp256k1: secp256k12 } = await import("./secp256k1-
|
|
134029
|
+
const { secp256k1: secp256k12 } = await import("./secp256k1-DrkwdU-G.js");
|
|
133962
134030
|
const signature_ = (() => {
|
|
133963
134031
|
if (typeof signature2 === "object" && "r" in signature2 && "s" in signature2) {
|
|
133964
134032
|
const { r: r3, s: s2, v: v2, yParity } = signature2;
|
|
@@ -145704,7 +145772,7 @@ class WalletConnectModal {
|
|
|
145704
145772
|
}
|
|
145705
145773
|
async initUi() {
|
|
145706
145774
|
if (typeof window !== "undefined") {
|
|
145707
|
-
await import("./index-
|
|
145775
|
+
await import("./index-5jxKYRjw.js");
|
|
145708
145776
|
const modal = document.createElement("wcm-modal");
|
|
145709
145777
|
document.body.insertAdjacentElement("beforeend", modal);
|
|
145710
145778
|
OptionsCtrl.setIsUiLoaded(true);
|
|
@@ -152216,6 +152284,31 @@ class BrowserHCSClient extends Outbound {
|
|
|
152216
152284
|
network: config.network,
|
|
152217
152285
|
logLevel: config.logLevel
|
|
152218
152286
|
});
|
|
152287
|
+
this.validTags = [
|
|
152288
|
+
"autonomous",
|
|
152289
|
+
"goal_based",
|
|
152290
|
+
"meme",
|
|
152291
|
+
"image_generation",
|
|
152292
|
+
"learning",
|
|
152293
|
+
"utility",
|
|
152294
|
+
"reflex",
|
|
152295
|
+
"hierarchical",
|
|
152296
|
+
"task_automation",
|
|
152297
|
+
"decision_support",
|
|
152298
|
+
"nlp",
|
|
152299
|
+
"customer_interaction",
|
|
152300
|
+
"data_processing",
|
|
152301
|
+
"knowledge_retrieval",
|
|
152302
|
+
"real_time",
|
|
152303
|
+
"web3_interaction",
|
|
152304
|
+
"secure_messaging",
|
|
152305
|
+
"multi_agent_systems",
|
|
152306
|
+
"intelligent_workflows",
|
|
152307
|
+
"dynamic_planning",
|
|
152308
|
+
"environment_adaptation",
|
|
152309
|
+
"feedback_driven"
|
|
152310
|
+
];
|
|
152311
|
+
this.guardedRegistryBaseUrl = config.guardedRegistryBaseUrl;
|
|
152219
152312
|
this.hwc = config.hwc;
|
|
152220
152313
|
this.guardedRegistryTopicId = config.guardedRegistryTopicId;
|
|
152221
152314
|
this.logger = Logger$3.getInstance({
|
|
@@ -152223,17 +152316,6 @@ class BrowserHCSClient extends Outbound {
|
|
|
152223
152316
|
module: "HCS-Browser"
|
|
152224
152317
|
});
|
|
152225
152318
|
}
|
|
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
152319
|
async sendMessage(connectionTopicId, operatorId, data, memo) {
|
|
152238
152320
|
this.logger.info("Sending message");
|
|
152239
152321
|
const payload = {
|
|
@@ -152484,7 +152566,7 @@ class BrowserHCSClient extends Outbound {
|
|
|
152484
152566
|
};
|
|
152485
152567
|
}
|
|
152486
152568
|
}
|
|
152487
|
-
async createAndRegisterAgent(name, description, tags, metadata, pfpBuffer, pfpFileName) {
|
|
152569
|
+
async createAndRegisterAgent(name, description, tags, metadata, pfpBuffer, pfpFileName, network) {
|
|
152488
152570
|
const { accountId } = this.getAccountAndSigner();
|
|
152489
152571
|
const {
|
|
152490
152572
|
outboundTopicId,
|
|
@@ -152509,16 +152591,12 @@ class BrowserHCSClient extends Outbound {
|
|
|
152509
152591
|
logo: pfpTopicId ? `hcs://1/${pfpTopicId}` : void 0
|
|
152510
152592
|
};
|
|
152511
152593
|
const operatorId = `${inboundTopicId}@${accountId}`;
|
|
152512
|
-
|
|
152513
|
-
this.guardedRegistryTopicId,
|
|
152594
|
+
await this.registerAgentWithGaurdedRegistry(
|
|
152514
152595
|
accountId,
|
|
152515
152596
|
inboundTopicId,
|
|
152516
152597
|
finalMetadata,
|
|
152517
|
-
|
|
152598
|
+
network
|
|
152518
152599
|
);
|
|
152519
|
-
if (registration.error) {
|
|
152520
|
-
throw new Error(registration.error);
|
|
152521
|
-
}
|
|
152522
152600
|
return {
|
|
152523
152601
|
accountId,
|
|
152524
152602
|
operatorId,
|
|
@@ -152529,6 +152607,41 @@ class BrowserHCSClient extends Outbound {
|
|
|
152529
152607
|
client: this
|
|
152530
152608
|
};
|
|
152531
152609
|
}
|
|
152610
|
+
async registerAgentWithGaurdedRegistry(accountId, inboundTopicId, metadata, network, maxAttempts = 60, delayMs = 2e3) {
|
|
152611
|
+
const hasValidTag = metadata.tags.some((tag) => this.validTags.includes(tag));
|
|
152612
|
+
if (!hasValidTag) {
|
|
152613
|
+
return {
|
|
152614
|
+
error: "Metadata must contain at least one valid tag.",
|
|
152615
|
+
success: false
|
|
152616
|
+
};
|
|
152617
|
+
}
|
|
152618
|
+
const invalidTags = metadata.tags.filter((tag) => !this.validTags.includes(tag));
|
|
152619
|
+
if (invalidTags.length > 0) {
|
|
152620
|
+
return {
|
|
152621
|
+
error: `Invalid tags found: ${invalidTags.join(", ")}. All tags must be valid.`,
|
|
152622
|
+
success: false
|
|
152623
|
+
};
|
|
152624
|
+
}
|
|
152625
|
+
this.logger.info("Registering agent with guarded registry");
|
|
152626
|
+
const payload = {
|
|
152627
|
+
p: "hcs-10",
|
|
152628
|
+
op: "register",
|
|
152629
|
+
account_id: accountId,
|
|
152630
|
+
inbound_topic_id: inboundTopicId,
|
|
152631
|
+
metadata,
|
|
152632
|
+
m: "Registering agent with guarded registry"
|
|
152633
|
+
};
|
|
152634
|
+
const response = await this.submitPayload(this.guardedRegistryTopicId, payload);
|
|
152635
|
+
if (response.error) {
|
|
152636
|
+
return {
|
|
152637
|
+
error: response.error,
|
|
152638
|
+
success: false
|
|
152639
|
+
};
|
|
152640
|
+
}
|
|
152641
|
+
return {
|
|
152642
|
+
success: true
|
|
152643
|
+
};
|
|
152644
|
+
}
|
|
152532
152645
|
async storeHCS11Profile(agentName, agentDescription, inboundTopicId, outboundTopicId, tags = [], metadata = {}, pfpBuffer, pfpFileName) {
|
|
152533
152646
|
try {
|
|
152534
152647
|
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-
|
|
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-CXCIEcrN.js";
|
|
2
2
|
function setBigUint64(view, byteOffset, value, isLE) {
|
|
3
3
|
if (typeof view.setBigUint64 === "function")
|
|
4
4
|
return view.setBigUint64(byteOffset, value, isLE);
|