@hashgraphonline/standards-sdk 0.0.58 → 0.0.60
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/dist/es/hcs-10/agent-builder.d.ts +2 -0
- package/dist/es/hcs-10/agent-builder.d.ts.map +1 -1
- package/dist/es/hcs-10/base-client.d.ts +2 -1
- package/dist/es/hcs-10/base-client.d.ts.map +1 -1
- package/dist/es/hcs-10/browser.d.ts +1 -1
- package/dist/es/hcs-10/browser.d.ts.map +1 -1
- package/dist/es/hcs-10/sdk.d.ts +2 -2
- package/dist/es/hcs-10/sdk.d.ts.map +1 -1
- package/dist/es/hcs-10/types.d.ts +1 -18
- package/dist/es/hcs-10/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es10.js +12 -9
- package/dist/es/standards-sdk.es10.js.map +1 -1
- package/dist/es/standards-sdk.es100.js +144 -17
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +86 -39
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +79 -13
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +28 -57
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +5 -1288
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +153 -26
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +22 -5
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +781 -147
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +166 -785
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +2 -2
- package/dist/es/standards-sdk.es110.js +19 -25
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +24 -23
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +23 -35
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +36 -19
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es12.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es13.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +5 -21
- package/dist/es/standards-sdk.es14.js.map +1 -1
- package/dist/es/standards-sdk.es17.js +1 -1
- package/dist/es/standards-sdk.es18.js +2 -2
- package/dist/es/standards-sdk.es22.js +36 -6627
- package/dist/es/standards-sdk.es22.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +48 -36
- package/dist/es/standards-sdk.es23.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +6600 -21
- package/dist/es/standards-sdk.es24.js.map +1 -1
- package/dist/es/standards-sdk.es26.js +5 -1041
- package/dist/es/standards-sdk.es26.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +1041 -5
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +5 -5
- package/dist/es/standards-sdk.es38.js +3 -3
- package/dist/es/standards-sdk.es4.js +1 -1
- package/dist/es/standards-sdk.es48.js +1 -1
- package/dist/es/standards-sdk.es49.js +3 -3
- package/dist/es/standards-sdk.es5.js +13 -9
- package/dist/es/standards-sdk.es5.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +3 -31
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +25 -56
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +58 -45
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +48 -8
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +8 -63
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +64 -5
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +6 -15
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +15 -7
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +6 -44
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +45 -2
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +2 -136
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +123 -159
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +172 -4
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +3 -3
- package/dist/es/standards-sdk.es7.js +5 -1
- package/dist/es/standards-sdk.es7.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +2 -2
- package/dist/es/standards-sdk.es74.js +5 -5
- package/dist/es/standards-sdk.es77.js +3 -34
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +2 -33
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +2 -9
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +9 -4
- package/dist/es/standards-sdk.es8.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +32 -32
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +33 -3
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +9 -2
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +34 -2
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +419 -2
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +2 -419
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +120 -2
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +2 -120
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +185 -74
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +433 -18
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +21 -144
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +130 -82
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +13 -169
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +23 -189
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +24 -433
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +12 -16
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +31 -126
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +9 -9
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +54 -22
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +1280 -20
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/es/utils/logger.d.ts.map +1 -1
- package/dist/umd/hcs-10/agent-builder.d.ts +2 -0
- package/dist/umd/hcs-10/agent-builder.d.ts.map +1 -1
- package/dist/umd/hcs-10/base-client.d.ts +2 -1
- package/dist/umd/hcs-10/base-client.d.ts.map +1 -1
- package/dist/umd/hcs-10/browser.d.ts +1 -1
- package/dist/umd/hcs-10/browser.d.ts.map +1 -1
- package/dist/umd/hcs-10/sdk.d.ts +2 -2
- package/dist/umd/hcs-10/sdk.d.ts.map +1 -1
- package/dist/umd/hcs-10/types.d.ts +1 -18
- package/dist/umd/hcs-10/types.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js +2 -2
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/dist/umd/utils/logger.d.ts.map +1 -1
- package/package.json +4 -2
|
@@ -1,7 +1,175 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import platform from "./standards-sdk.es60.js";
|
|
2
|
+
import utils from "./standards-sdk.es34.js";
|
|
3
|
+
import AxiosError from "./standards-sdk.es45.js";
|
|
4
|
+
import composeSignals from "./standards-sdk.es75.js";
|
|
5
|
+
import { trackStream } from "./standards-sdk.es76.js";
|
|
6
|
+
import AxiosHeaders from "./standards-sdk.es48.js";
|
|
7
|
+
import { progressEventDecorator, progressEventReducer, asyncDecorator } from "./standards-sdk.es73.js";
|
|
8
|
+
import resolveConfig from "./standards-sdk.es74.js";
|
|
9
|
+
import settle from "./standards-sdk.es71.js";
|
|
10
|
+
const isFetchSupported = typeof fetch === "function" && typeof Request === "function" && typeof Response === "function";
|
|
11
|
+
const isReadableStreamSupported = isFetchSupported && typeof ReadableStream === "function";
|
|
12
|
+
const encodeText = isFetchSupported && (typeof TextEncoder === "function" ? /* @__PURE__ */ ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) : async (str) => new Uint8Array(await new Response(str).arrayBuffer()));
|
|
13
|
+
const test = (fn, ...args) => {
|
|
14
|
+
try {
|
|
15
|
+
return !!fn(...args);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const supportsRequestStream = isReadableStreamSupported && test(() => {
|
|
21
|
+
let duplexAccessed = false;
|
|
22
|
+
const hasContentType = new Request(platform.origin, {
|
|
23
|
+
body: new ReadableStream(),
|
|
24
|
+
method: "POST",
|
|
25
|
+
get duplex() {
|
|
26
|
+
duplexAccessed = true;
|
|
27
|
+
return "half";
|
|
28
|
+
}
|
|
29
|
+
}).headers.has("Content-Type");
|
|
30
|
+
return duplexAccessed && !hasContentType;
|
|
31
|
+
});
|
|
32
|
+
const DEFAULT_CHUNK_SIZE = 64 * 1024;
|
|
33
|
+
const supportsResponseStream = isReadableStreamSupported && test(() => utils.isReadableStream(new Response("").body));
|
|
34
|
+
const resolvers = {
|
|
35
|
+
stream: supportsResponseStream && ((res) => res.body)
|
|
36
|
+
};
|
|
37
|
+
isFetchSupported && ((res) => {
|
|
38
|
+
["text", "arrayBuffer", "blob", "formData", "stream"].forEach((type) => {
|
|
39
|
+
!resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res2) => res2[type]() : (_, config) => {
|
|
40
|
+
throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
})(new Response());
|
|
44
|
+
const getBodyLength = async (body) => {
|
|
45
|
+
if (body == null) {
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
if (utils.isBlob(body)) {
|
|
49
|
+
return body.size;
|
|
50
|
+
}
|
|
51
|
+
if (utils.isSpecCompliantForm(body)) {
|
|
52
|
+
const _request = new Request(platform.origin, {
|
|
53
|
+
method: "POST",
|
|
54
|
+
body
|
|
55
|
+
});
|
|
56
|
+
return (await _request.arrayBuffer()).byteLength;
|
|
57
|
+
}
|
|
58
|
+
if (utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {
|
|
59
|
+
return body.byteLength;
|
|
60
|
+
}
|
|
61
|
+
if (utils.isURLSearchParams(body)) {
|
|
62
|
+
body = body + "";
|
|
63
|
+
}
|
|
64
|
+
if (utils.isString(body)) {
|
|
65
|
+
return (await encodeText(body)).byteLength;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const resolveBodyLength = async (headers, body) => {
|
|
69
|
+
const length = utils.toFiniteNumber(headers.getContentLength());
|
|
70
|
+
return length == null ? getBodyLength(body) : length;
|
|
71
|
+
};
|
|
72
|
+
const fetchAdapter = isFetchSupported && (async (config) => {
|
|
73
|
+
let {
|
|
74
|
+
url,
|
|
75
|
+
method,
|
|
76
|
+
data,
|
|
77
|
+
signal,
|
|
78
|
+
cancelToken,
|
|
79
|
+
timeout,
|
|
80
|
+
onDownloadProgress,
|
|
81
|
+
onUploadProgress,
|
|
82
|
+
responseType,
|
|
83
|
+
headers,
|
|
84
|
+
withCredentials = "same-origin",
|
|
85
|
+
fetchOptions
|
|
86
|
+
} = resolveConfig(config);
|
|
87
|
+
responseType = responseType ? (responseType + "").toLowerCase() : "text";
|
|
88
|
+
let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);
|
|
89
|
+
let request;
|
|
90
|
+
const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {
|
|
91
|
+
composedSignal.unsubscribe();
|
|
92
|
+
});
|
|
93
|
+
let requestContentLength;
|
|
94
|
+
try {
|
|
95
|
+
if (onUploadProgress && supportsRequestStream && method !== "get" && method !== "head" && (requestContentLength = await resolveBodyLength(headers, data)) !== 0) {
|
|
96
|
+
let _request = new Request(url, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
body: data,
|
|
99
|
+
duplex: "half"
|
|
100
|
+
});
|
|
101
|
+
let contentTypeHeader;
|
|
102
|
+
if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get("content-type"))) {
|
|
103
|
+
headers.setContentType(contentTypeHeader);
|
|
104
|
+
}
|
|
105
|
+
if (_request.body) {
|
|
106
|
+
const [onProgress, flush] = progressEventDecorator(
|
|
107
|
+
requestContentLength,
|
|
108
|
+
progressEventReducer(asyncDecorator(onUploadProgress))
|
|
109
|
+
);
|
|
110
|
+
data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (!utils.isString(withCredentials)) {
|
|
114
|
+
withCredentials = withCredentials ? "include" : "omit";
|
|
115
|
+
}
|
|
116
|
+
const isCredentialsSupported = "credentials" in Request.prototype;
|
|
117
|
+
request = new Request(url, {
|
|
118
|
+
...fetchOptions,
|
|
119
|
+
signal: composedSignal,
|
|
120
|
+
method: method.toUpperCase(),
|
|
121
|
+
headers: headers.normalize().toJSON(),
|
|
122
|
+
body: data,
|
|
123
|
+
duplex: "half",
|
|
124
|
+
credentials: isCredentialsSupported ? withCredentials : void 0
|
|
125
|
+
});
|
|
126
|
+
let response = await fetch(request);
|
|
127
|
+
const isStreamResponse = supportsResponseStream && (responseType === "stream" || responseType === "response");
|
|
128
|
+
if (supportsResponseStream && (onDownloadProgress || isStreamResponse && unsubscribe)) {
|
|
129
|
+
const options = {};
|
|
130
|
+
["status", "statusText", "headers"].forEach((prop) => {
|
|
131
|
+
options[prop] = response[prop];
|
|
132
|
+
});
|
|
133
|
+
const responseContentLength = utils.toFiniteNumber(response.headers.get("content-length"));
|
|
134
|
+
const [onProgress, flush] = onDownloadProgress && progressEventDecorator(
|
|
135
|
+
responseContentLength,
|
|
136
|
+
progressEventReducer(asyncDecorator(onDownloadProgress), true)
|
|
137
|
+
) || [];
|
|
138
|
+
response = new Response(
|
|
139
|
+
trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {
|
|
140
|
+
flush && flush();
|
|
141
|
+
unsubscribe && unsubscribe();
|
|
142
|
+
}),
|
|
143
|
+
options
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
responseType = responseType || "text";
|
|
147
|
+
let responseData = await resolvers[utils.findKey(resolvers, responseType) || "text"](response, config);
|
|
148
|
+
!isStreamResponse && unsubscribe && unsubscribe();
|
|
149
|
+
return await new Promise((resolve, reject) => {
|
|
150
|
+
settle(resolve, reject, {
|
|
151
|
+
data: responseData,
|
|
152
|
+
headers: AxiosHeaders.from(response.headers),
|
|
153
|
+
status: response.status,
|
|
154
|
+
statusText: response.statusText,
|
|
155
|
+
config,
|
|
156
|
+
request
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
} catch (err) {
|
|
160
|
+
unsubscribe && unsubscribe();
|
|
161
|
+
if (err && err.name === "TypeError" && /fetch/i.test(err.message)) {
|
|
162
|
+
throw Object.assign(
|
|
163
|
+
new AxiosError("Network Error", AxiosError.ERR_NETWORK, config, request),
|
|
164
|
+
{
|
|
165
|
+
cause: err.cause || err
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
throw AxiosError.from(err, err && err.code, config, request);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
4
172
|
export {
|
|
5
|
-
|
|
173
|
+
fetchAdapter as default
|
|
6
174
|
};
|
|
7
175
|
//# sourceMappingURL=standards-sdk.es64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es64.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es64.js","sources":["../../node_modules/axios/lib/adapters/fetch.js"],"sourcesContent":["import platform from \"../platform/index.js\";\nimport utils from \"../utils.js\";\nimport AxiosError from \"../core/AxiosError.js\";\nimport composeSignals from \"../helpers/composeSignals.js\";\nimport {trackStream} from \"../helpers/trackStream.js\";\nimport AxiosHeaders from \"../core/AxiosHeaders.js\";\nimport {progressEventReducer, progressEventDecorator, asyncDecorator} from \"../helpers/progressEventReducer.js\";\nimport resolveConfig from \"../helpers/resolveConfig.js\";\nimport settle from \"../core/settle.js\";\n\nconst isFetchSupported = typeof fetch === 'function' && typeof Request === 'function' && typeof Response === 'function';\nconst isReadableStreamSupported = isFetchSupported && typeof ReadableStream === 'function';\n\n// used only inside the fetch adapter\nconst encodeText = isFetchSupported && (typeof TextEncoder === 'function' ?\n ((encoder) => (str) => encoder.encode(str))(new TextEncoder()) :\n async (str) => new Uint8Array(await new Response(str).arrayBuffer())\n);\n\nconst test = (fn, ...args) => {\n try {\n return !!fn(...args);\n } catch (e) {\n return false\n }\n}\n\nconst supportsRequestStream = isReadableStreamSupported && test(() => {\n let duplexAccessed = false;\n\n const hasContentType = new Request(platform.origin, {\n body: new ReadableStream(),\n method: 'POST',\n get duplex() {\n duplexAccessed = true;\n return 'half';\n },\n }).headers.has('Content-Type');\n\n return duplexAccessed && !hasContentType;\n});\n\nconst DEFAULT_CHUNK_SIZE = 64 * 1024;\n\nconst supportsResponseStream = isReadableStreamSupported &&\n test(() => utils.isReadableStream(new Response('').body));\n\n\nconst resolvers = {\n stream: supportsResponseStream && ((res) => res.body)\n};\n\nisFetchSupported && (((res) => {\n ['text', 'arrayBuffer', 'blob', 'formData', 'stream'].forEach(type => {\n !resolvers[type] && (resolvers[type] = utils.isFunction(res[type]) ? (res) => res[type]() :\n (_, config) => {\n throw new AxiosError(`Response type '${type}' is not supported`, AxiosError.ERR_NOT_SUPPORT, config);\n })\n });\n})(new Response));\n\nconst getBodyLength = async (body) => {\n if (body == null) {\n return 0;\n }\n\n if(utils.isBlob(body)) {\n return body.size;\n }\n\n if(utils.isSpecCompliantForm(body)) {\n const _request = new Request(platform.origin, {\n method: 'POST',\n body,\n });\n return (await _request.arrayBuffer()).byteLength;\n }\n\n if(utils.isArrayBufferView(body) || utils.isArrayBuffer(body)) {\n return body.byteLength;\n }\n\n if(utils.isURLSearchParams(body)) {\n body = body + '';\n }\n\n if(utils.isString(body)) {\n return (await encodeText(body)).byteLength;\n }\n}\n\nconst resolveBodyLength = async (headers, body) => {\n const length = utils.toFiniteNumber(headers.getContentLength());\n\n return length == null ? getBodyLength(body) : length;\n}\n\nexport default isFetchSupported && (async (config) => {\n let {\n url,\n method,\n data,\n signal,\n cancelToken,\n timeout,\n onDownloadProgress,\n onUploadProgress,\n responseType,\n headers,\n withCredentials = 'same-origin',\n fetchOptions\n } = resolveConfig(config);\n\n responseType = responseType ? (responseType + '').toLowerCase() : 'text';\n\n let composedSignal = composeSignals([signal, cancelToken && cancelToken.toAbortSignal()], timeout);\n\n let request;\n\n const unsubscribe = composedSignal && composedSignal.unsubscribe && (() => {\n composedSignal.unsubscribe();\n });\n\n let requestContentLength;\n\n try {\n if (\n onUploadProgress && supportsRequestStream && method !== 'get' && method !== 'head' &&\n (requestContentLength = await resolveBodyLength(headers, data)) !== 0\n ) {\n let _request = new Request(url, {\n method: 'POST',\n body: data,\n duplex: \"half\"\n });\n\n let contentTypeHeader;\n\n if (utils.isFormData(data) && (contentTypeHeader = _request.headers.get('content-type'))) {\n headers.setContentType(contentTypeHeader)\n }\n\n if (_request.body) {\n const [onProgress, flush] = progressEventDecorator(\n requestContentLength,\n progressEventReducer(asyncDecorator(onUploadProgress))\n );\n\n data = trackStream(_request.body, DEFAULT_CHUNK_SIZE, onProgress, flush);\n }\n }\n\n if (!utils.isString(withCredentials)) {\n withCredentials = withCredentials ? 'include' : 'omit';\n }\n\n // Cloudflare Workers throws when credentials are defined\n // see https://github.com/cloudflare/workerd/issues/902\n const isCredentialsSupported = \"credentials\" in Request.prototype;\n request = new Request(url, {\n ...fetchOptions,\n signal: composedSignal,\n method: method.toUpperCase(),\n headers: headers.normalize().toJSON(),\n body: data,\n duplex: \"half\",\n credentials: isCredentialsSupported ? withCredentials : undefined\n });\n\n let response = await fetch(request);\n\n const isStreamResponse = supportsResponseStream && (responseType === 'stream' || responseType === 'response');\n\n if (supportsResponseStream && (onDownloadProgress || (isStreamResponse && unsubscribe))) {\n const options = {};\n\n ['status', 'statusText', 'headers'].forEach(prop => {\n options[prop] = response[prop];\n });\n\n const responseContentLength = utils.toFiniteNumber(response.headers.get('content-length'));\n\n const [onProgress, flush] = onDownloadProgress && progressEventDecorator(\n responseContentLength,\n progressEventReducer(asyncDecorator(onDownloadProgress), true)\n ) || [];\n\n response = new Response(\n trackStream(response.body, DEFAULT_CHUNK_SIZE, onProgress, () => {\n flush && flush();\n unsubscribe && unsubscribe();\n }),\n options\n );\n }\n\n responseType = responseType || 'text';\n\n let responseData = await resolvers[utils.findKey(resolvers, responseType) || 'text'](response, config);\n\n !isStreamResponse && unsubscribe && unsubscribe();\n\n return await new Promise((resolve, reject) => {\n settle(resolve, reject, {\n data: responseData,\n headers: AxiosHeaders.from(response.headers),\n status: response.status,\n statusText: response.statusText,\n config,\n request\n })\n })\n } catch (err) {\n unsubscribe && unsubscribe();\n\n if (err && err.name === 'TypeError' && /fetch/i.test(err.message)) {\n throw Object.assign(\n new AxiosError('Network Error', AxiosError.ERR_NETWORK, config, request),\n {\n cause: err.cause || err\n }\n )\n }\n\n throw AxiosError.from(err, err && err.code, config, request);\n }\n});\n\n\n"],"names":["res"],"mappings":";;;;;;;;;AAUA,MAAM,mBAAmB,OAAO,UAAU,cAAc,OAAO,YAAY,cAAc,OAAO,aAAa;AAC7G,MAAM,4BAA4B,oBAAoB,OAAO,mBAAmB;AAGhF,MAAM,aAAa,qBAAqB,OAAO,gBAAgB,aAC1D,kBAAC,YAAY,CAAC,QAAQ,QAAQ,OAAO,GAAG,GAAG,IAAI,aAAa,IAC7D,OAAO,QAAQ,IAAI,WAAW,MAAM,IAAI,SAAS,GAAG,EAAE,YAAa,CAAA;AAGvE,MAAM,OAAO,CAAC,OAAO,SAAS;AAC5B,MAAI;AACF,WAAO,CAAC,CAAC,GAAG,GAAG,IAAI;AAAA,EACpB,SAAQ,GAAG;AACV,WAAO;AAAA,EACX;AACA;AAEA,MAAM,wBAAwB,6BAA6B,KAAK,MAAM;AACpE,MAAI,iBAAiB;AAErB,QAAM,iBAAiB,IAAI,QAAQ,SAAS,QAAQ;AAAA,IAClD,MAAM,IAAI,eAAgB;AAAA,IAC1B,QAAQ;AAAA,IACR,IAAI,SAAS;AACX,uBAAiB;AACjB,aAAO;AAAA,IACR;AAAA,EACL,CAAG,EAAE,QAAQ,IAAI,cAAc;AAE7B,SAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,qBAAqB,KAAK;AAEhC,MAAM,yBAAyB,6BAC7B,KAAK,MAAM,MAAM,iBAAiB,IAAI,SAAS,EAAE,EAAE,IAAI,CAAC;AAG1D,MAAM,YAAY;AAAA,EAChB,QAAQ,2BAA2B,CAAC,QAAQ,IAAI;AAClD;AAEA,qBAAsB,CAAC,QAAQ;AAC7B,G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AAA,EAC/D;AACA;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import URLSearchParams from "./standards-sdk.
|
|
2
|
-
import FormData from "./standards-sdk.
|
|
3
|
-
import Blob from "./standards-sdk.
|
|
1
|
+
import URLSearchParams from "./standards-sdk.es77.js";
|
|
2
|
+
import FormData from "./standards-sdk.es78.js";
|
|
3
|
+
import Blob from "./standards-sdk.es79.js";
|
|
4
4
|
const platform = {
|
|
5
5
|
isBrowser: true,
|
|
6
6
|
classes: {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { InboundTopicType } from "./standards-sdk.es12.js";
|
|
2
|
+
import { Logger } from "./standards-sdk.es14.js";
|
|
2
3
|
class AgentBuilder {
|
|
3
4
|
constructor() {
|
|
4
5
|
this.config = {};
|
|
6
|
+
this.logger = Logger.getInstance({
|
|
7
|
+
module: "AgentBuilder"
|
|
8
|
+
});
|
|
5
9
|
}
|
|
6
10
|
setName(name) {
|
|
7
11
|
this.config.name = name;
|
|
@@ -98,7 +102,7 @@ class AgentBuilder {
|
|
|
98
102
|
throw new Error("Agent description is required");
|
|
99
103
|
}
|
|
100
104
|
if (!this.config.pfpBuffer || !this.config.pfpFileName) {
|
|
101
|
-
|
|
105
|
+
this.logger.warn("No profile picture provided, skipping...");
|
|
102
106
|
}
|
|
103
107
|
if (!this.config.network) {
|
|
104
108
|
throw new Error("Network is required");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es7.js","sources":["../../src/hcs-10/agent-builder.ts"],"sourcesContent":["import {\n InboundTopicType,\n NetworkType,\n FeeConfigBuilderInterface,\n AgentConfiguration,\n
|
|
1
|
+
{"version":3,"file":"standards-sdk.es7.js","sources":["../../src/hcs-10/agent-builder.ts"],"sourcesContent":["import {\n InboundTopicType,\n NetworkType,\n FeeConfigBuilderInterface,\n AgentConfiguration,\n} from './types';\nimport { AIAgentCapability } from '../hcs-11';\nimport { AgentMetadata } from './types';\nimport { Logger } from '../utils/logger';\n\ntype SocialPlatform =\n | 'twitter'\n | 'discord'\n | 'github'\n | 'website'\n | 'x'\n | 'linkedin'\n | 'youtube'\n | 'telegram';\n\n/**\n * AgentBuilder is a builder class for creating agent configurations.\n * It provides a fluent interface for setting various properties of the agent.\n *\n * Example usage:\n * ```typescript\n * const agentBuilder = new AgentBuilder();\n * agentBuilder.setName('My Agent');\n * agentBuilder.setDescription('This is my agent');\n * agentBuilder.setCapabilities([AIAgentCapability.CREATE_CONTENT]);\n * agentBuilder.setModel('gpt-4o');\n * agentBuilder.setCreator('John Doe');\n * agentBuilder.addSocial('twitter', 'JohnDoe');\n * agentBuilder.addProperty('key', 'value');\n * const agentConfig = agentBuilder.build();\n * ```\n *\n */\nexport class AgentBuilder {\n private config: Partial<AgentConfiguration> = {};\n private logger: Logger;\n\n constructor() {\n this.logger = Logger.getInstance({\n module: 'AgentBuilder',\n });\n }\n\n setName(name: string): AgentBuilder {\n this.config.name = name;\n return this;\n }\n\n setDescription(description: string): AgentBuilder {\n this.config.description = description;\n return this;\n }\n\n setCapabilities(capabilities: AIAgentCapability[]): AgentBuilder {\n this.config.capabilities = capabilities;\n return this;\n }\n\n setAgentType(type: 'autonomous' | 'manual'): AgentBuilder {\n if (!this.config.metadata) {\n this.config.metadata = { type };\n } else {\n this.config.metadata.type = type;\n }\n return this;\n }\n\n setModel(model: string): AgentBuilder {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'autonomous', model };\n } else {\n this.config.metadata.model = model;\n }\n return this;\n }\n\n setCreator(creator: string): AgentBuilder {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'autonomous', creator };\n } else {\n this.config.metadata.creator = creator;\n }\n return this;\n }\n\n addSocial(platform: SocialPlatform, handle: string): AgentBuilder {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'autonomous', socials: {} };\n } else if (!this.config.metadata.socials) {\n this.config.metadata.socials = {};\n }\n\n this.config.metadata.socials[platform] = handle;\n return this;\n }\n\n addProperty(key: string, value: any): AgentBuilder {\n if (!this.config.metadata) {\n this.config.metadata = { type: 'autonomous', properties: {} };\n } else if (!this.config.metadata.properties) {\n this.config.metadata.properties = {};\n }\n\n this.config.metadata.properties[key] = value;\n return this;\n }\n\n setMetadata(metadata: AgentMetadata): AgentBuilder {\n this.config.metadata = metadata;\n return this;\n }\n\n setProfilePicture(pfpBuffer: Buffer, pfpFileName: string): AgentBuilder {\n this.config.pfpBuffer = pfpBuffer;\n this.config.pfpFileName = pfpFileName;\n return this;\n }\n\n setExistingProfilePicture(pfpTopicId: string): AgentBuilder {\n this.config.existingPfpTopicId = pfpTopicId;\n return this;\n }\n\n setNetwork(network: NetworkType): AgentBuilder {\n this.config.network = network;\n return this;\n }\n\n setInboundTopicType(inboundTopicType: InboundTopicType): AgentBuilder {\n this.config.inboundTopicType = inboundTopicType;\n return this;\n }\n\n setFeeConfig(feeConfigBuilder: FeeConfigBuilderInterface): AgentBuilder {\n this.config.feeConfig = feeConfigBuilder;\n return this;\n }\n\n setConnectionFeeConfig(\n feeConfigBuilder: FeeConfigBuilderInterface\n ): AgentBuilder {\n this.config.connectionFeeConfig = feeConfigBuilder;\n return this;\n }\n\n setExistingAccount(accountId: string, privateKey: string): AgentBuilder {\n this.config.existingAccount = { accountId, privateKey };\n return this;\n }\n\n build(): AgentConfiguration {\n if (!this.config.name) {\n throw new Error('Agent name is required');\n }\n\n if (!this.config.description) {\n throw new Error('Agent description is required');\n }\n\n if (!this.config.pfpBuffer || !this.config.pfpFileName) {\n this.logger.warn('No profile picture provided, skipping...');\n }\n\n if (!this.config.network) {\n throw new Error('Network is required');\n }\n\n if (!this.config.inboundTopicType) {\n this.config.inboundTopicType = InboundTopicType.PUBLIC;\n }\n\n if (!this.config.capabilities) {\n this.config.capabilities = [];\n }\n\n if (!this.config.metadata) {\n this.config.metadata = { type: 'autonomous' };\n }\n\n if (\n this.config.inboundTopicType === InboundTopicType.FEE_BASED &&\n !this.config.feeConfig\n ) {\n throw new Error('Fee configu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AAa,CAAC,KAAK,OAAO,aAAa;AACjD,WAAA,OAAO,KAAK,0CAA0C;AAAA,IAAA;AAGzD,QAAA,CAAC,KAAK,OAAO,SAAS;AAClB,YAAA,IAAI,MAAM,qBAAqB;AAAA,IAAA;AAGnC,QAAA,CAAC,KAAK,OAAO,kBAAkB;AAC5B,WAAA,OAAO,mBAAmB,iBAAiB;AAAA,IAAA;AAG9C,QAAA,CAAC,KAAK,OAAO,cAAc;AACxB,WAAA,OAAO,eAAe,CAAC;AAAA,IAAA;AAG1B,QAAA,CAAC,KAAK,OAAO,UAAU;AACzB,WAAK,OAAO,WAAW,EAAE,MAAM,aAAa;AAAA,IAAA;AAI5C,QAAA,KAAK,OAAO,qBAAqB,iBAAiB,aAClD,CAAC,KAAK,OAAO,WACb;AACM,YAAA,IAAI,MAAM,oDAAoD;AAAA,IAAA;AAGtE,WAAO,KAAK;AAAA,EAAA;AAEhB;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import speedometer from "./standards-sdk.
|
|
2
|
-
import throttle from "./standards-sdk.
|
|
1
|
+
import speedometer from "./standards-sdk.es80.js";
|
|
2
|
+
import throttle from "./standards-sdk.es81.js";
|
|
3
3
|
import utils from "./standards-sdk.es34.js";
|
|
4
4
|
const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
|
|
5
5
|
let bytesNotified = 0;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import platform from "./standards-sdk.
|
|
1
|
+
import platform from "./standards-sdk.es60.js";
|
|
2
2
|
import utils from "./standards-sdk.es34.js";
|
|
3
|
-
import isURLSameOrigin from "./standards-sdk.
|
|
4
|
-
import cookies from "./standards-sdk.
|
|
5
|
-
import buildFullPath from "./standards-sdk.
|
|
3
|
+
import isURLSameOrigin from "./standards-sdk.es82.js";
|
|
4
|
+
import cookies from "./standards-sdk.es83.js";
|
|
5
|
+
import buildFullPath from "./standards-sdk.es56.js";
|
|
6
6
|
import mergeConfig from "./standards-sdk.es37.js";
|
|
7
7
|
import AxiosHeaders from "./standards-sdk.es48.js";
|
|
8
|
-
import buildURL from "./standards-sdk.
|
|
8
|
+
import buildURL from "./standards-sdk.es53.js";
|
|
9
9
|
const resolveConfig = (config) => {
|
|
10
10
|
const newConfig = mergeConfig({}, config);
|
|
11
11
|
let { data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth } = newConfig;
|
|
@@ -1,37 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const bytes = new Array(samplesCount);
|
|
4
|
-
const timestamps = new Array(samplesCount);
|
|
5
|
-
let head = 0;
|
|
6
|
-
let tail = 0;
|
|
7
|
-
let firstSampleTS;
|
|
8
|
-
min = min !== void 0 ? min : 1e3;
|
|
9
|
-
return function push(chunkLength) {
|
|
10
|
-
const now = Date.now();
|
|
11
|
-
const startedAt = timestamps[tail];
|
|
12
|
-
if (!firstSampleTS) {
|
|
13
|
-
firstSampleTS = now;
|
|
14
|
-
}
|
|
15
|
-
bytes[head] = chunkLength;
|
|
16
|
-
timestamps[head] = now;
|
|
17
|
-
let i = tail;
|
|
18
|
-
let bytesCount = 0;
|
|
19
|
-
while (i !== head) {
|
|
20
|
-
bytesCount += bytes[i++];
|
|
21
|
-
i = i % samplesCount;
|
|
22
|
-
}
|
|
23
|
-
head = (head + 1) % samplesCount;
|
|
24
|
-
if (head === tail) {
|
|
25
|
-
tail = (tail + 1) % samplesCount;
|
|
26
|
-
}
|
|
27
|
-
if (now - firstSampleTS < min) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const passed = startedAt && now - startedAt;
|
|
31
|
-
return passed ? Math.round(bytesCount * 1e3 / passed) : void 0;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
1
|
+
import AxiosURLSearchParams from "./standards-sdk.es67.js";
|
|
2
|
+
const URLSearchParams$1 = typeof URLSearchParams !== "undefined" ? URLSearchParams : AxiosURLSearchParams;
|
|
34
3
|
export {
|
|
35
|
-
|
|
4
|
+
URLSearchParams$1 as default
|
|
36
5
|
};
|
|
37
6
|
//# sourceMappingURL=standards-sdk.es77.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es77.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es77.js","sources":["../../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js"],"sourcesContent":["'use strict';\n\nimport AxiosURLSearchParams from '../../../helpers/AxiosURLSearchParams.js';\nexport default typeof URLSearchParams !== 'undefined' ? URLSearchParams : AxiosURLSearchParams;\n"],"names":[],"mappings":";AAGA,MAAA,oBAAe,OAAO,oBAAoB,cAAc,kBAAkB;","x_google_ignoreList":[0]}
|
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
let timestamp = 0;
|
|
3
|
-
let threshold = 1e3 / freq;
|
|
4
|
-
let lastArgs;
|
|
5
|
-
let timer;
|
|
6
|
-
const invoke = (args, now = Date.now()) => {
|
|
7
|
-
timestamp = now;
|
|
8
|
-
lastArgs = null;
|
|
9
|
-
if (timer) {
|
|
10
|
-
clearTimeout(timer);
|
|
11
|
-
timer = null;
|
|
12
|
-
}
|
|
13
|
-
fn.apply(null, args);
|
|
14
|
-
};
|
|
15
|
-
const throttled = (...args) => {
|
|
16
|
-
const now = Date.now();
|
|
17
|
-
const passed = now - timestamp;
|
|
18
|
-
if (passed >= threshold) {
|
|
19
|
-
invoke(args, now);
|
|
20
|
-
} else {
|
|
21
|
-
lastArgs = args;
|
|
22
|
-
if (!timer) {
|
|
23
|
-
timer = setTimeout(() => {
|
|
24
|
-
timer = null;
|
|
25
|
-
invoke(lastArgs);
|
|
26
|
-
}, threshold - passed);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const flush = () => lastArgs && invoke(lastArgs);
|
|
31
|
-
return [throttled, flush];
|
|
32
|
-
}
|
|
1
|
+
const FormData$1 = typeof FormData !== "undefined" ? FormData : null;
|
|
33
2
|
export {
|
|
34
|
-
|
|
3
|
+
FormData$1 as default
|
|
35
4
|
};
|
|
36
5
|
//# sourceMappingURL=standards-sdk.es78.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es78.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es78.js","sources":["../../node_modules/axios/lib/platform/browser/classes/FormData.js"],"sourcesContent":["'use strict';\n\nexport default typeof FormData !== 'undefined' ? FormData : null;\n"],"names":[],"mappings":"AAEA,MAAA,aAAe,OAAO,aAAa,cAAc,WAAW;","x_google_ignoreList":[0]}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
const isURLSameOrigin = platform.hasStandardBrowserEnv ? /* @__PURE__ */ ((origin, isMSIE) => (url) => {
|
|
3
|
-
url = new URL(url, platform.origin);
|
|
4
|
-
return origin.protocol === url.protocol && origin.host === url.host && (isMSIE || origin.port === url.port);
|
|
5
|
-
})(
|
|
6
|
-
new URL(platform.origin),
|
|
7
|
-
platform.navigator && /(msie|trident)/i.test(platform.navigator.userAgent)
|
|
8
|
-
) : () => true;
|
|
1
|
+
const Blob$1 = typeof Blob !== "undefined" ? Blob : null;
|
|
9
2
|
export {
|
|
10
|
-
|
|
3
|
+
Blob$1 as default
|
|
11
4
|
};
|
|
12
5
|
//# sourceMappingURL=standards-sdk.es79.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es79.js","sources":["../../node_modules/axios/lib/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es79.js","sources":["../../node_modules/axios/lib/platform/browser/classes/Blob.js"],"sourcesContent":["'use strict'\n\nexport default typeof Blob !== 'undefined' ? Blob : null\n"],"names":[],"mappings":"AAEA,MAAA,SAAe,OAAO,SAAS,cAAc,OAAO;","x_google_ignoreList":[0]}
|
|
@@ -4,8 +4,8 @@ import { Logger } from "./standards-sdk.es14.js";
|
|
|
4
4
|
import { Registration } from "./standards-sdk.es9.js";
|
|
5
5
|
import { HCS11Client } from "./standards-sdk.es13.js";
|
|
6
6
|
import { PublicKey } from "@hashgraph/sdk";
|
|
7
|
-
import "./standards-sdk.
|
|
8
|
-
import axios from "./standards-sdk.
|
|
7
|
+
import "./standards-sdk.es22.js";
|
|
8
|
+
import axios from "./standards-sdk.es23.js";
|
|
9
9
|
var Hcs10MemoType = /* @__PURE__ */ ((Hcs10MemoType2) => {
|
|
10
10
|
Hcs10MemoType2["INBOUND"] = "inbound";
|
|
11
11
|
Hcs10MemoType2["OUTBOUND"] = "outbound";
|
|
@@ -350,7 +350,10 @@ class HCS10BaseClient extends Registration {
|
|
|
350
350
|
};
|
|
351
351
|
return await this.submitPayload(outboundTopicId, payload);
|
|
352
352
|
}
|
|
353
|
-
async getOperatorId() {
|
|
353
|
+
async getOperatorId(disableCache) {
|
|
354
|
+
if (this.operatorId && !disableCache) {
|
|
355
|
+
return this.operatorId;
|
|
356
|
+
}
|
|
354
357
|
const accountResponse = this.getAccountAndSigner();
|
|
355
358
|
if (!accountResponse.accountId) {
|
|
356
359
|
throw new Error("Operator ID not found");
|
|
@@ -359,7 +362,9 @@ class HCS10BaseClient extends Registration {
|
|
|
359
362
|
if (!profile.success) {
|
|
360
363
|
throw new Error("Failed to retrieve profile");
|
|
361
364
|
}
|
|
362
|
-
|
|
365
|
+
const operatorId = `${profile.topicInfo?.inboundTopic}@${accountResponse.accountId}`;
|
|
366
|
+
this.operatorId = operatorId;
|
|
367
|
+
return operatorId;
|
|
363
368
|
}
|
|
364
369
|
clearCache() {
|
|
365
370
|
HCS10Cache.getInstance().clear();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es8.js","sources":["../../src/hcs-10/base-client.ts"],"sourcesContent":["import { HederaMirrorNode } from '../services/mirror-node';\nimport { Logger, LogLevel } from '../utils/logger';\nimport { Registration } from './registrations';\nimport { HCS11Client } from '../hcs-11';\nimport { AccountResponse, NetworkType } from '../services/types';\nimport { TopicInfo } from '../services/types';\nimport { TransactionReceipt, PrivateKey, PublicKey } from '@hashgraph/sdk';\nimport axios from 'axios';\n\nexport enum Hcs10MemoType {\n INBOUND = 'inbound',\n OUTBOUND = 'outbound',\n CONNECTION = 'connection',\n}\n\nexport interface HCS10Config {\n network: 'mainnet' | 'testnet';\n logLevel?: LogLevel;\n prettyPrint?: boolean;\n feeAmount?: number;\n}\n\nexport interface HCSMessage {\n p: 'hcs-10';\n op:\n | 'connection_request'\n | 'connection_created'\n | 'message'\n | 'close_connection';\n data: string;\n created?: Date;\n consensus_timestamp?: string;\n m?: string;\n payer: string;\n outbound_topic_id?: string;\n connection_request_id?: number;\n confirmed_request_id?: number;\n connection_topic_id?: string;\n connected_account_id?: string;\n requesting_account_id?: string;\n connection_id?: number;\n sequence_number: number;\n operator_id?: string;\n reason?: string;\n close_method?: string;\n}\n\nexport interface ProfileResponse {\n profile: any;\n topicInfo?: TopicInfo;\n success: boolean;\n error?: string;\n}\n\nexport abstract class HCS10BaseClient extends Registration {\n protected network: string;\n protected logger: Logger;\n protected mirrorNode: HederaMirrorNode;\n protected feeAmount: number;\n\n constructor(config: HCS10Config) {\n super();\n this.network = config.network;\n this.logger = Logger.getInstance({\n level: config.logLevel || 'info',\n module: 'HCS10-BaseClient',\n prettyPrint: config.prettyPrint,\n });\n this.mirrorNode = new HederaMirrorNode(\n config.network as NetworkType,\n this.logger\n );\n this.feeAmount = config.feeAmount || 0.001;\n }\n\n abstract submitPayload(\n topicId: string,\n payload: object | string,\n submitKey?: PrivateKey,\n requiresFee?: boolean\n ): Promise<TransactionReceipt>;\n\n abstract getAccountAndSigner(): { accountId: string; signer: any };\n\n /**\n * Get a stream of messages from a connection topic\n * @param topicId The connection topic ID to get messages from\n * @returns A stream of filtered messages valid for connection topics\n */\n public async getMessageStream(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n const validOps = ['message', 'close_connection'];\n\n const filteredMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10' || !validOps.includes(msg.op)) {\n return false;\n }\n\n if (msg.op === 'message') {\n if (!msg.data) {\n return false;\n }\n\n if (!msg.operator_id) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n\n if (msg.op === 'close_connection') {\n if (!msg.operator_id) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n\n return true;\n });\n\n return {\n messages: filteredMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n /**\n * Checks if a user can submit to a topic and determines if a fee is required\n * @param topicId The topic ID to check\n * @param userAccountId The account ID of the user attempting to submit\n * @returns Object with canSubmit, requiresFee, and optional reason\n */\n public async canSubmitToTopic(\n topicId: string,\n userAccountId: string\n ): Promise<{ canSubmit: boolean; requiresFee: boolean; reason?: string }> {\n try {\n const topicInfo = await this.mirrorNode.getTopicInfo(topicId);\n\n if (!topicInfo) {\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'Topic does not exist',\n };\n }\n\n if (!topicInfo.submit_key?.key) {\n return { canSubmit: true, requiresFee: false };\n }\n\n try {\n const userPublicKey = await this.mirrorNode.getPublicKey(userAccountId);\n\n if (topicInfo.submit_key._type === 'ProtobufEncoded') {\n const keyBytes = Buffer.from(topicInfo.submit_key.key, 'hex');\n const hasAccess = await this.mirrorNode.checkKeyListAccess(\n keyBytes,\n userPublicKey\n );\n\n if (hasAccess) {\n return { canSubmit: true, requiresFee: false };\n }\n } else {\n const topicSubmitKey = PublicKey.fromString(topicInfo.submit_key.key);\n if (userPublicKey.toString() === topicSubmitKey.toString()) {\n return { canSubmit: true, requiresFee: false };\n }\n }\n } catch (error) {\n this.logger.error(\n `Key validation error: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n\n if (\n topicInfo.fee_schedule_key?.key &&\n topicInfo.custom_fees?.fixed_fees?.length > 0\n ) {\n return {\n canSubmit: true,\n requiresFee: true,\n reason: 'Requires fee payment via HIP-991',\n };\n }\n\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'User does not have submit permission for this topic',\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this.logger.error(`Topic submission validation error: ${errorMessage}`);\n return {\n canSubmit: false,\n requiresFee: false,\n reason: `Error: ${errorMessage}`,\n };\n }\n }\n\n /**\n * Get all messages from a topic\n * @param topicId The topic ID to get messages from\n * @returns All messages from the topic\n */\n public async getMessages(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n\n const validatedMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10') {\n return false;\n }\n\n if (msg.op === 'message') {\n if (!msg.data) {\n return false;\n }\n\n if (msg.operator_id) {\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n }\n\n return true;\n });\n\n return {\n messages: validatedMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n public async requestAccount(account: string): Promise<AccountResponse> {\n try {\n return await this.mirrorNode.requestAccount(account);\n } catch (e) {\n this.logger.error('Failed to fetch account', e);\n throw e;\n }\n }\n\n public async getAccountMemo(accountId: string): Promise<string | null> {\n return await this.mirrorNode.getAccountMemo(accountId);\n }\n\n public async retrieveProfile(accountId: string): Promise<ProfileResponse> {\n this.logger.info(`Retrieving profile for account: ${accountId}`);\n\n try {\n const hcs11Client = new HCS11Client({\n network: this.network as 'mainnet' | 'testnet',\n auth: {\n operatorId: '0.0.0', // Read-only operations only\n },\n logLevel: 'info',\n });\n\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n this.network\n );\n\n if (!profileResult?.success) {\n this.logger.error(\n `Failed to retrieve profile for account ID: ${accountId}`,\n profileResult?.error\n );\n return {\n profile: null,\n success: false,\n error:\n profileResult?.error ||\n `Failed to retrieve profile for account ID: ${accountId}`,\n };\n }\n\n const profile = profileResult.profile;\n let topicInfo = null;\n\n if (\n profileResult.topicInfo?.inboundTopic &&\n profileResult.topicInfo?.outboundTopic &&\n profileResult.topicInfo?.profileTopicId\n ) {\n topicInfo = {\n inboundTopic: profileResult.topicInfo.inboundTopic,\n outboundTopic: profileResult.topicInfo.outboundTopic,\n profileTopicId: profileResult.topicInfo.profileTopicId,\n };\n\n const cacheKey = `${accountId}-${this.network}`;\n HCS10Cache.getInstance().set(cacheKey, topicInfo);\n }\n\n return {\n profile,\n topicInfo,\n success: true,\n };\n } catch (error) {\n this.logger.error('Failed to retrieve profile:', error);\n return {\n profile: null,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n }\n\n public async retrieveOutboundConnectTopic(\n accountId: string\n ): Promise<TopicInfo> {\n this.logger.info(`Retrieving topics for account: ${accountId}`);\n\n try {\n const profileResponse = await this.retrieveProfile(accountId);\n\n if (!profileResponse?.success) {\n throw new Error(profileResponse.error || 'Failed to retrieve profile');\n }\n\n const profile = profileResponse.profile;\n\n if (!profile.inboundTopicId || !profile.outboundTopicId) {\n throw new Error(\n `Invalid HCS-11 profile for HCS-10 agent: missing inboundTopicId or outboundTopicId`\n );\n }\n\n const topicInfo = {\n inboundTopic: profile.inboundTopicId,\n outboundTopic: profile.outboundTopicId,\n profileTopicId: profile.profileTopicId,\n };\n\n const cacheKey = `${accountId}-${this.network}`;\n HCS10Cache.getInstance().set(cacheKey, topicInfo);\n return topicInfo;\n } catch (error) {\n this.logger.error('Failed to retrieve topic info:', error);\n throw error;\n }\n }\n\n public async retrieveOutboundMessages(\n agentAccountId: string\n ): Promise<HCSMessage[]> {\n try {\n const topicInfo = await this.retrieveOutboundConnectTopic(agentAccountId);\n if (!topicInfo) {\n this.logger.warn(\n `No outbound connect topic found for agentAccountId: ${agentAccountId}`\n );\n return [];\n }\n const response = await this.getMessages(topicInfo.outboundTopic);\n return response.messages.filter(\n (msg) =>\n msg.p === 'hcs-10' &&\n (msg.op === 'connection_request' ||\n msg.op === 'connection_created' ||\n msg.op === 'message')\n );\n } catch (error) {\n this.logger.error('Failed to retrieve outbound messages:', error);\n return [];\n }\n }\n\n public async hasConnectionCreated(\n agentAccountId: string,\n connectionId: number\n ): Promise<boolean> {\n try {\n const outBoundTopic = await this.retrieveOutboundConnectTopic(\n agentAccountId\n );\n const messages = await this.retrieveOutboundMessages(\n outBoundTopic.outboundTopic\n );\n return messages.some(\n (msg) =>\n msg.op === 'connection_created' && msg.connection_id === connectionId\n );\n } catch (error) {\n this.logger.error('Failed to check connection created:', error);\n return false;\n }\n }\n\n /**\n * Gets message content, resolving any HRL references if needed\n * @param data The message data which might be an HRL reference\n * @returns The resolved content\n */\n async getMessageContent(data: string): Promise<string> {\n const hrlPattern = /^hcs:\\/\\/(\\d+)\\/([0-9.]+)$/;\n const match = data.match(hrlPattern);\n\n if (!match) {\n return data;\n }\n\n const [_, standard, topicId] = match;\n\n this.logger.info(\n `Resolving HRL reference: standard=${standard}, topicId=${topicId}`\n );\n\n try {\n const cdnUrl = `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${this.network}`;\n const response = await axios.get(cdnUrl);\n\n if (!response.data) {\n throw new Error(`Failed to fetch content from topic: ${topicId}`);\n }\n\n return (\n response.data.content ||\n response.data.text ||\n JSON.stringify(response.data)\n );\n } catch (error) {\n this.logger.error(\n `Error resolving HRL reference: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`\n );\n throw new Error(\n `Failed to resolve HRL reference: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`\n );\n }\n }\n\n /**\n * Records an outbound connection confirmation\n * @param outboundTopicId The ID of the outbound topic\n * @param connectionRequestId The ID of the connection request\n * @param confirmedRequestId The ID of the confirmed request\n * @param connectionTopicId The ID of the connection topic\n * @param operatorId The operator ID of the message sender\n * @param memo An optional memo for the message\n */\n public async recordOutboundConnectionConfirmation({\n outboundTopicId,\n connectionRequestId,\n confirmedRequestId,\n connectionTopicId,\n operatorId,\n memo,\n }: {\n outboundTopicId: string;\n connectionRequestId: number;\n confirmedRequestId: number;\n connectionTopicId: string;\n operatorId: string;\n memo: string;\n }): Promise<TransactionReceipt> {\n const payload = {\n p: 'hcs-10',\n op: 'connection_created',\n connection_topic_id: connectionTopicId,\n outbound_topic_id: outboundTopicId,\n confirmed_request_id: confirmedRequestId,\n connection_request_id: connectionRequestId,\n operator_id: operatorId,\n m: memo,\n };\n return await this.submitPayload(outboundTopicId, payload);\n }\n\n public async getOperatorId(): Promise<string> {\n const accountResponse = this.getAccountAndSigner();\n\n if (!accountResponse.accountId) {\n throw new Error('Operator ID not found');\n }\n\n const profile = await this.retrieveProfile(accountResponse.accountId);\n\n if (!profile.success) {\n throw new Error('Failed to retrieve profile');\n }\n\n return `${profile.topicInfo?.inboundTopic}@${accountResponse.accountId}`;\n }\n\n clearCache(): void {\n HCS10Cache.getInstance().clear();\n }\n\n /**\n * Generates a standard HCS-10 memo string.\n * @param type The type of topic memo ('inbound', 'outbound', 'connection').\n * @param options Configuration options for the memo.\n * @returns The formatted memo string.\n * @protected\n */\n protected _generateHcs10Memo(\n type: Hcs10MemoType,\n options: {\n ttl?: number;\n accountId?: string;\n inboundTopicId?: string;\n connectionId?: number;\n }\n ): string {\n const ttl = options.ttl ?? 60; // Default TTL to 60 if not provided\n\n switch (type) {\n case Hcs10MemoType.INBOUND:\n if (!options.accountId) {\n throw new Error('accountId is required for inbound memo');\n }\n return `hcs-10:0:${ttl}:0:${options.accountId}`;\n case Hcs10MemoType.OUTBOUND:\n return `hcs-10:0:${ttl}:1`;\n case Hcs10MemoType.CONNECTION:\n if (!options.inboundTopicId || options.connectionId === undefined) {\n throw new Error(\n 'inboundTopicId and connectionId are required for connection memo'\n );\n }\n return `hcs-10:1:${ttl}:2:${options.inboundTopicId}:${options.connectionId}`;\n default:\n throw new Error(`Invalid HCS-10 memo type: ${type}`);\n }\n }\n\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string\n ): Promise<{ status: 'pending' | 'success' | 'failed' }> {\n try {\n const response = await fetch(`${baseUrl}/api/request-confirm`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Network': network,\n },\n body: JSON.stringify({ transaction_id: transactionId }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to confirm registration: ${response.statusText}`\n );\n }\n\n return await response.json();\n } catch (error) {\n this.logger.error(`Error checking registration status: ${error}`);\n throw error;\n }\n }\n\n /**\n * Validates if an operator_id follows the correct format (agentTopicId@accountId)\n * @param operatorId The operator ID to validate\n * @returns True if the format is valid, false otherwise\n */\n protected isValidOperatorId(operatorId: string): boolean {\n if (!operatorId) {\n return false;\n }\n\n const parts = operatorId.split('@');\n\n if (parts.length !== 2) {\n return false;\n }\n\n const agentTopicId = parts[0];\n const accountId = parts[1];\n\n if (!agentTopicId) {\n return false;\n }\n\n if (!accountId) {\n return false;\n }\n\n const hederaIdPattern = /^[0-9]+\\.[0-9]+\\.[0-9]+$/;\n\n if (!hederaIdPattern.test(accountId)) {\n return false;\n }\n\n if (!hederaIdPattern.test(agentTopicId)) {\n return false;\n }\n\n return true;\n }\n}\n\nexport class HCS10Cache {\n private static instance: HCS10Cache;\n private cache: Map<string, TopicInfo>;\n private cacheExpiry: Map<string, number>;\n private readonly CACHE_TTL = 3600000;\n\n private constructor() {\n this.cache = new Map();\n this.cacheExpiry = new Map();\n }\n\n static getInstance(): HCS10Cache {\n if (!HCS10Cache.instance) {\n HCS10Cache.instance = new HCS10Cache();\n }\n return HCS10Cache.instance;\n }\n\n set(key: string, value: TopicInfo): void {\n this.cache.set(key, value);\n this.cacheExpiry.set(key, Date.now() + this.CACHE_TTL);\n }\n\n get(key: string): TopicInfo | undefined {\n const expiry = this.cacheExpiry.get(key);\n if (expiry && expiry > Date.now()) {\n return this.cache.get(key);\n }\n if (expiry) {\n this.cache.delete(key);\n this.cacheExpiry.delete(key);\n }\n return undefined;\n }\n\n clear(): void {\n this.cache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,IAAI,KAAK,SAAS;AAAA,EAAA;AAAA,EAGvD,IAAI,KAAoC;AACtC,UAAM,SAAS,KAAK,YAAY,IAAI,GAAG;AACvC,QAAI,UAAU,SAAS,KAAK,IAAA,GAAO;AAC1B,aAAA,KAAK,MAAM,IAAI,GAAG;AAAA,IAAA;AAE3B,QAAI,QAAQ;AACL,WAAA,MAAM,OAAO,GAAG;AAChB,WAAA,YAAY,OAAO,GAAG;AAAA,IAAA;AAEtB,WAAA;AAAA,EAAA;AAAA,EAGT,QAAc;AACZ,SAAK,MAAM,MAAM;AACjB,SAAK,YAAY,MAAM;AAAA,EAAA;AAE3B;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es8.js","sources":["../../src/hcs-10/base-client.ts"],"sourcesContent":["import { HederaMirrorNode } from '../services/mirror-node';\nimport { Logger, LogLevel } from '../utils/logger';\nimport { Registration } from './registrations';\nimport { HCS11Client } from '../hcs-11';\nimport { AccountResponse, NetworkType } from '../services/types';\nimport { TopicInfo } from '../services/types';\nimport { TransactionReceipt, PrivateKey, PublicKey } from '@hashgraph/sdk';\nimport axios from 'axios';\n\nexport enum Hcs10MemoType {\n INBOUND = 'inbound',\n OUTBOUND = 'outbound',\n CONNECTION = 'connection',\n}\n\nexport interface HCS10Config {\n network: 'mainnet' | 'testnet';\n logLevel?: LogLevel;\n prettyPrint?: boolean;\n feeAmount?: number;\n}\n\nexport interface HCSMessage {\n p: 'hcs-10';\n op:\n | 'connection_request'\n | 'connection_created'\n | 'message'\n | 'close_connection';\n data: string;\n created?: Date;\n consensus_timestamp?: string;\n m?: string;\n payer: string;\n outbound_topic_id?: string;\n connection_request_id?: number;\n confirmed_request_id?: number;\n connection_topic_id?: string;\n connected_account_id?: string;\n requesting_account_id?: string;\n connection_id?: number;\n sequence_number: number;\n operator_id?: string;\n reason?: string;\n close_method?: string;\n}\n\nexport interface ProfileResponse {\n profile: any;\n topicInfo?: TopicInfo;\n success: boolean;\n error?: string;\n}\n\nexport abstract class HCS10BaseClient extends Registration {\n protected network: string;\n protected logger: Logger;\n protected mirrorNode: HederaMirrorNode;\n protected feeAmount: number;\n\n protected operatorId: string;\n\n constructor(config: HCS10Config) {\n super();\n this.network = config.network;\n this.logger = Logger.getInstance({\n level: config.logLevel || 'info',\n module: 'HCS10-BaseClient',\n prettyPrint: config.prettyPrint,\n });\n this.mirrorNode = new HederaMirrorNode(\n config.network as NetworkType,\n this.logger\n );\n this.feeAmount = config.feeAmount || 0.001;\n }\n\n abstract submitPayload(\n topicId: string,\n payload: object | string,\n submitKey?: PrivateKey,\n requiresFee?: boolean\n ): Promise<TransactionReceipt>;\n\n abstract getAccountAndSigner(): { accountId: string; signer: any };\n\n /**\n * Get a stream of messages from a connection topic\n * @param topicId The connection topic ID to get messages from\n * @returns A stream of filtered messages valid for connection topics\n */\n public async getMessageStream(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n const validOps = ['message', 'close_connection'];\n\n const filteredMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10' || !validOps.includes(msg.op)) {\n return false;\n }\n\n if (msg.op === 'message') {\n if (!msg.data) {\n return false;\n }\n\n if (!msg.operator_id) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n\n if (msg.op === 'close_connection') {\n if (!msg.operator_id) {\n return false;\n }\n\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n\n return true;\n });\n\n return {\n messages: filteredMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n /**\n * Checks if a user can submit to a topic and determines if a fee is required\n * @param topicId The topic ID to check\n * @param userAccountId The account ID of the user attempting to submit\n * @returns Object with canSubmit, requiresFee, and optional reason\n */\n public async canSubmitToTopic(\n topicId: string,\n userAccountId: string\n ): Promise<{ canSubmit: boolean; requiresFee: boolean; reason?: string }> {\n try {\n const topicInfo = await this.mirrorNode.getTopicInfo(topicId);\n\n if (!topicInfo) {\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'Topic does not exist',\n };\n }\n\n if (!topicInfo.submit_key?.key) {\n return { canSubmit: true, requiresFee: false };\n }\n\n try {\n const userPublicKey = await this.mirrorNode.getPublicKey(userAccountId);\n\n if (topicInfo.submit_key._type === 'ProtobufEncoded') {\n const keyBytes = Buffer.from(topicInfo.submit_key.key, 'hex');\n const hasAccess = await this.mirrorNode.checkKeyListAccess(\n keyBytes,\n userPublicKey\n );\n\n if (hasAccess) {\n return { canSubmit: true, requiresFee: false };\n }\n } else {\n const topicSubmitKey = PublicKey.fromString(topicInfo.submit_key.key);\n if (userPublicKey.toString() === topicSubmitKey.toString()) {\n return { canSubmit: true, requiresFee: false };\n }\n }\n } catch (error) {\n this.logger.error(\n `Key validation error: ${\n error instanceof Error ? error.message : String(error)\n }`\n );\n }\n\n if (\n topicInfo.fee_schedule_key?.key &&\n topicInfo.custom_fees?.fixed_fees?.length > 0\n ) {\n return {\n canSubmit: true,\n requiresFee: true,\n reason: 'Requires fee payment via HIP-991',\n };\n }\n\n return {\n canSubmit: false,\n requiresFee: false,\n reason: 'User does not have submit permission for this topic',\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this.logger.error(`Topic submission validation error: ${errorMessage}`);\n return {\n canSubmit: false,\n requiresFee: false,\n reason: `Error: ${errorMessage}`,\n };\n }\n }\n\n /**\n * Get all messages from a topic\n * @param topicId The topic ID to get messages from\n * @returns All messages from the topic\n */\n public async getMessages(\n topicId: string\n ): Promise<{ messages: HCSMessage[] }> {\n try {\n const messages = await this.mirrorNode.getTopicMessages(topicId);\n\n const validatedMessages = messages.filter((msg) => {\n if (msg.p !== 'hcs-10') {\n return false;\n }\n\n if (msg.op === 'message') {\n if (!msg.data) {\n return false;\n }\n\n if (msg.operator_id) {\n if (!this.isValidOperatorId(msg.operator_id)) {\n return false;\n }\n }\n }\n\n return true;\n });\n\n return {\n messages: validatedMessages,\n };\n } catch (error: any) {\n if (this.logger) {\n this.logger.error(`Error fetching messages: ${error.message}`);\n }\n return { messages: [] };\n }\n }\n\n public async requestAccount(account: string): Promise<AccountResponse> {\n try {\n return await this.mirrorNode.requestAccount(account);\n } catch (e) {\n this.logger.error('Failed to fetch account', e);\n throw e;\n }\n }\n\n public async getAccountMemo(accountId: string): Promise<string | null> {\n return await this.mirrorNode.getAccountMemo(accountId);\n }\n\n public async retrieveProfile(accountId: string): Promise<ProfileResponse> {\n this.logger.info(`Retrieving profile for account: ${accountId}`);\n\n try {\n const hcs11Client = new HCS11Client({\n network: this.network as 'mainnet' | 'testnet',\n auth: {\n operatorId: '0.0.0', // Read-only operations only\n },\n logLevel: 'info',\n });\n\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n this.network\n );\n\n if (!profileResult?.success) {\n this.logger.error(\n `Failed to retrieve profile for account ID: ${accountId}`,\n profileResult?.error\n );\n return {\n profile: null,\n success: false,\n error:\n profileResult?.error ||\n `Failed to retrieve profile for account ID: ${accountId}`,\n };\n }\n\n const profile = profileResult.profile;\n let topicInfo = null;\n\n if (\n profileResult.topicInfo?.inboundTopic &&\n profileResult.topicInfo?.outboundTopic &&\n profileResult.topicInfo?.profileTopicId\n ) {\n topicInfo = {\n inboundTopic: profileResult.topicInfo.inboundTopic,\n outboundTopic: profileResult.topicInfo.outboundTopic,\n profileTopicId: profileResult.topicInfo.profileTopicId,\n };\n\n const cacheKey = `${accountId}-${this.network}`;\n HCS10Cache.getInstance().set(cacheKey, topicInfo);\n }\n\n return {\n profile,\n topicInfo,\n success: true,\n };\n } catch (error) {\n this.logger.error('Failed to retrieve profile:', error);\n return {\n profile: null,\n success: false,\n error: error instanceof Error ? error.message : String(error),\n };\n }\n }\n\n public async retrieveOutboundConnectTopic(\n accountId: string\n ): Promise<TopicInfo> {\n this.logger.info(`Retrieving topics for account: ${accountId}`);\n\n try {\n const profileResponse = await this.retrieveProfile(accountId);\n\n if (!profileResponse?.success) {\n throw new Error(profileResponse.error || 'Failed to retrieve profile');\n }\n\n const profile = profileResponse.profile;\n\n if (!profile.inboundTopicId || !profile.outboundTopicId) {\n throw new Error(\n `Invalid HCS-11 profile for HCS-10 agent: missing inboundTopicId or outboundTopicId`\n );\n }\n\n const topicInfo = {\n inboundTopic: profile.inboundTopicId,\n outboundTopic: profile.outboundTopicId,\n profileTopicId: profile.profileTopicId,\n };\n\n const cacheKey = `${accountId}-${this.network}`;\n HCS10Cache.getInstance().set(cacheKey, topicInfo);\n return topicInfo;\n } catch (error) {\n this.logger.error('Failed to retrieve topic info:', error);\n throw error;\n }\n }\n\n public async retrieveOutboundMessages(\n agentAccountId: string\n ): Promise<HCSMessage[]> {\n try {\n const topicInfo = await this.retrieveOutboundConnectTopic(agentAccountId);\n if (!topicInfo) {\n this.logger.warn(\n `No outbound connect topic found for agentAccountId: ${agentAccountId}`\n );\n return [];\n }\n const response = await this.getMessages(topicInfo.outboundTopic);\n return response.messages.filter(\n (msg) =>\n msg.p === 'hcs-10' &&\n (msg.op === 'connection_request' ||\n msg.op === 'connection_created' ||\n msg.op === 'message')\n );\n } catch (error) {\n this.logger.error('Failed to retrieve outbound messages:', error);\n return [];\n }\n }\n\n public async hasConnectionCreated(\n agentAccountId: string,\n connectionId: number\n ): Promise<boolean> {\n try {\n const outBoundTopic = await this.retrieveOutboundConnectTopic(\n agentAccountId\n );\n const messages = await this.retrieveOutboundMessages(\n outBoundTopic.outboundTopic\n );\n return messages.some(\n (msg) =>\n msg.op === 'connection_created' && msg.connection_id === connectionId\n );\n } catch (error) {\n this.logger.error('Failed to check connection created:', error);\n return false;\n }\n }\n\n /**\n * Gets message content, resolving any HRL references if needed\n * @param data The message data which might be an HRL reference\n * @returns The resolved content\n */\n async getMessageContent(data: string): Promise<string> {\n const hrlPattern = /^hcs:\\/\\/(\\d+)\\/([0-9.]+)$/;\n const match = data.match(hrlPattern);\n\n if (!match) {\n return data;\n }\n\n const [_, standard, topicId] = match;\n\n this.logger.info(\n `Resolving HRL reference: standard=${standard}, topicId=${topicId}`\n );\n\n try {\n const cdnUrl = `https://kiloscribe.com/api/inscription-cdn/${topicId}?network=${this.network}`;\n const response = await axios.get(cdnUrl);\n\n if (!response.data) {\n throw new Error(`Failed to fetch content from topic: ${topicId}`);\n }\n\n return (\n response.data.content ||\n response.data.text ||\n JSON.stringify(response.data)\n );\n } catch (error) {\n this.logger.error(\n `Error resolving HRL reference: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`\n );\n throw new Error(\n `Failed to resolve HRL reference: ${\n error instanceof Error ? error.message : 'Unknown error'\n }`\n );\n }\n }\n\n /**\n * Records an outbound connection confirmation\n * @param outboundTopicId The ID of the outbound topic\n * @param connectionRequestId The ID of the connection request\n * @param confirmedRequestId The ID of the confirmed request\n * @param connectionTopicId The ID of the connection topic\n * @param operatorId The operator ID of the message sender\n * @param memo An optional memo for the message\n */\n public async recordOutboundConnectionConfirmation({\n outboundTopicId,\n connectionRequestId,\n confirmedRequestId,\n connectionTopicId,\n operatorId,\n memo,\n }: {\n outboundTopicId: string;\n connectionRequestId: number;\n confirmedRequestId: number;\n connectionTopicId: string;\n operatorId: string;\n memo: string;\n }): Promise<TransactionReceipt> {\n const payload = {\n p: 'hcs-10',\n op: 'connection_created',\n connection_topic_id: connectionTopicId,\n outbound_topic_id: outboundTopicId,\n confirmed_request_id: confirmedRequestId,\n connection_request_id: connectionRequestId,\n operator_id: operatorId,\n m: memo,\n };\n return await this.submitPayload(outboundTopicId, payload);\n }\n\n public async getOperatorId(disableCache?: boolean): Promise<string> {\n if (this.operatorId && !disableCache) {\n return this.operatorId;\n }\n\n const accountResponse = this.getAccountAndSigner();\n\n if (!accountResponse.accountId) {\n throw new Error('Operator ID not found');\n }\n\n const profile = await this.retrieveProfile(accountResponse.accountId);\n\n if (!profile.success) {\n throw new Error('Failed to retrieve profile');\n }\n\n const operatorId = `${profile.topicInfo?.inboundTopic}@${accountResponse.accountId}`;\n this.operatorId = operatorId;\n return operatorId;\n }\n\n clearCache(): void {\n HCS10Cache.getInstance().clear();\n }\n\n /**\n * Generates a standard HCS-10 memo string.\n * @param type The type of topic memo ('inbound', 'outbound', 'connection').\n * @param options Configuration options for the memo.\n * @returns The formatted memo string.\n * @protected\n */\n protected _generateHcs10Memo(\n type: Hcs10MemoType,\n options: {\n ttl?: number;\n accountId?: string;\n inboundTopicId?: string;\n connectionId?: number;\n }\n ): string {\n const ttl = options.ttl ?? 60; // Default TTL to 60 if not provided\n\n switch (type) {\n case Hcs10MemoType.INBOUND:\n if (!options.accountId) {\n throw new Error('accountId is required for inbound memo');\n }\n return `hcs-10:0:${ttl}:0:${options.accountId}`;\n case Hcs10MemoType.OUTBOUND:\n return `hcs-10:0:${ttl}:1`;\n case Hcs10MemoType.CONNECTION:\n if (!options.inboundTopicId || options.connectionId === undefined) {\n throw new Error(\n 'inboundTopicId and connectionId are required for connection memo'\n );\n }\n return `hcs-10:1:${ttl}:2:${options.inboundTopicId}:${options.connectionId}`;\n default:\n throw new Error(`Invalid HCS-10 memo type: ${type}`);\n }\n }\n\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string\n ): Promise<{ status: 'pending' | 'success' | 'failed' }> {\n try {\n const response = await fetch(`${baseUrl}/api/request-confirm`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Network': network,\n },\n body: JSON.stringify({ transaction_id: transactionId }),\n });\n\n if (!response.ok) {\n throw new Error(\n `Failed to confirm registration: ${response.statusText}`\n );\n }\n\n return await response.json();\n } catch (error) {\n this.logger.error(`Error checking registration status: ${error}`);\n throw error;\n }\n }\n\n /**\n * Validates if an operator_id follows the correct format (agentTopicId@accountId)\n * @param operatorId The operator ID to validate\n * @returns True if the format is valid, false otherwise\n */\n protected isValidOperatorId(operatorId: string): boolean {\n if (!operatorId) {\n return false;\n }\n\n const parts = operatorId.split('@');\n\n if (parts.length !== 2) {\n return false;\n }\n\n const agentTopicId = parts[0];\n const accountId = parts[1];\n\n if (!agentTopicId) {\n return false;\n }\n\n if (!accountId) {\n return false;\n }\n\n const hederaIdPattern = /^[0-9]+\\.[0-9]+\\.[0-9]+$/;\n\n if (!hederaIdPattern.test(accountId)) {\n return false;\n }\n\n if (!hederaIdPattern.test(agentTopicId)) {\n return false;\n }\n\n return true;\n }\n}\n\nexport class HCS10Cache {\n private static instance: HCS10Cache;\n private cache: Map<string, TopicInfo>;\n private cacheExpiry: Map<string, number>;\n private readonly CACHE_TTL = 3600000;\n\n private constructor() {\n this.cache = new Map();\n this.cacheExpiry = new Map();\n }\n\n static getInstance(): HCS10Cache {\n if (!HCS10Cache.instance) {\n HCS10Cache.instance = new HCS10Cache();\n }\n return HCS10Cache.instance;\n }\n\n set(key: string, value: TopicInfo): void {\n this.cache.set(key, value);\n this.cacheExpiry.set(key, Date.now() + this.CACHE_TTL);\n }\n\n get(key: string): TopicInfo | undefined {\n const expiry = this.cacheExpiry.get(key);\n if (expiry && expiry > Date.now()) {\n return this.cache.get(key);\n }\n if (expiry) {\n this.cache.delete(key);\n this.cacheExpiry.delete(key);\n }\n return undefined;\n }\n\n clear(): void {\n this.cache.clear();\n this.cacheExpiry.clear();\n }\n}\n"],"names":["Hcs10MemoType"],"mappings":";;;;;;;;AASY,IAAA,kCAAAA,mBAAL;AACLA,iBAAA,SAAU,IAAA;AACVA,iBAAA,UAAW,IAAA;AACXA,iBAAA,YAAa,IAAA;AAHHA,SAAAA;AAAA,GAAA,iBAAA,CAAA,CAAA;AA6CL,MAAe,wBAAwB,aAAa;AAAA,EAQzD,YAAY,QAAqB;AACzB,UAAA;AACN,SAAK,UAAU,OAAO;AACjB,SAAA,SAAS,OAAO,YAAY;AAAA,MAC/B,OAAO,OAAO,YAAY;AAAA,MAC1B,QAAQ;AAAA,MACR,aAAa,OAAO;AAAA,IAAA,CACrB;AACD,SAAK,aAAa,IAAI;AAAA,MACpB,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AACK,SAAA,YAAY,OAAO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