@hashgraphonline/standards-sdk 0.0.57 → 0.0.58
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 +1 -2
- package/dist/es/hcs-10/agent-builder.d.ts.map +1 -1
- package/dist/es/hcs-10/index.d.ts +1 -0
- package/dist/es/hcs-10/index.d.ts.map +1 -1
- package/dist/es/hcs-10/registrations.d.ts +1 -60
- package/dist/es/hcs-10/registrations.d.ts.map +1 -1
- package/dist/es/hcs-10/sdk.d.ts +1 -30
- package/dist/es/hcs-10/sdk.d.ts.map +1 -1
- package/dist/es/hcs-10/types.d.ts +106 -6
- package/dist/es/hcs-10/types.d.ts.map +1 -1
- package/dist/es/hcs-11/index.d.ts +1 -1
- package/dist/es/hcs-11/index.d.ts.map +1 -1
- package/dist/es/inscribe/types.d.ts +1 -1
- package/dist/es/inscribe/types.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +7 -7
- package/dist/es/standards-sdk.es10.js +3 -3
- package/dist/es/standards-sdk.es100.js +13 -36
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +36 -10
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +10 -53
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +47 -1275
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +1282 -25
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +31 -5
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +5 -158
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +147 -781
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +785 -166
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +25 -19
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +23 -24
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +35 -23
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +19 -36
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +7 -739
- package/dist/es/standards-sdk.es12.js.map +1 -1
- package/dist/es/standards-sdk.es13.js +722 -52
- package/dist/es/standards-sdk.es13.js.map +1 -1
- package/dist/es/standards-sdk.es14.js +67 -20
- package/dist/es/standards-sdk.es14.js.map +1 -1
- package/dist/es/standards-sdk.es15.js +18 -156
- package/dist/es/standards-sdk.es15.js.map +1 -1
- package/dist/es/standards-sdk.es16.js +138 -385
- package/dist/es/standards-sdk.es16.js.map +1 -1
- package/dist/es/standards-sdk.es17.js +385 -211
- package/dist/es/standards-sdk.es17.js.map +1 -1
- package/dist/es/standards-sdk.es18.js +233 -7
- package/dist/es/standards-sdk.es18.js.map +1 -1
- package/dist/es/standards-sdk.es2.js +1 -1
- package/dist/es/standards-sdk.es26.js +7 -7
- package/dist/es/standards-sdk.es27.js +1 -1
- package/dist/es/standards-sdk.es3.js +1 -1
- package/dist/es/standards-sdk.es4.js +1 -1
- package/dist/es/standards-sdk.es5.js +4 -4
- package/dist/es/standards-sdk.es5.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +3 -3
- package/dist/es/standards-sdk.es7.js +1 -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 +2 -2
- package/dist/es/standards-sdk.es77.js +34 -3
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +33 -2
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +9 -2
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +3 -3
- 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 +3 -33
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +2 -9
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +2 -34
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +2 -419
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +419 -2
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +2 -120
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +120 -2
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +1 -1
- package/dist/es/standards-sdk.es9.js +1 -1
- package/dist/es/standards-sdk.es9.js.map +1 -1
- package/dist/es/standards-sdk.es90.js +2 -2
- package/dist/es/standards-sdk.es92.js +158 -179
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +163 -406
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +432 -19
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +16 -130
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +131 -10
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +11 -22
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +22 -22
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +21 -13
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/umd/hcs-10/agent-builder.d.ts +1 -2
- package/dist/umd/hcs-10/agent-builder.d.ts.map +1 -1
- package/dist/umd/hcs-10/index.d.ts +1 -0
- package/dist/umd/hcs-10/index.d.ts.map +1 -1
- package/dist/umd/hcs-10/registrations.d.ts +1 -60
- package/dist/umd/hcs-10/registrations.d.ts.map +1 -1
- package/dist/umd/hcs-10/sdk.d.ts +1 -30
- package/dist/umd/hcs-10/sdk.d.ts.map +1 -1
- package/dist/umd/hcs-10/types.d.ts +106 -6
- package/dist/umd/hcs-10/types.d.ts.map +1 -1
- package/dist/umd/hcs-11/index.d.ts +1 -1
- package/dist/umd/hcs-11/index.d.ts.map +1 -1
- package/dist/umd/inscribe/types.d.ts +1 -1
- package/dist/umd/inscribe/types.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,123 @@
|
|
|
1
|
-
|
|
1
|
+
var quickFormatUnescaped;
|
|
2
|
+
var hasRequiredQuickFormatUnescaped;
|
|
3
|
+
function requireQuickFormatUnescaped() {
|
|
4
|
+
if (hasRequiredQuickFormatUnescaped) return quickFormatUnescaped;
|
|
5
|
+
hasRequiredQuickFormatUnescaped = 1;
|
|
6
|
+
function tryStringify(o) {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.stringify(o);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
return '"[Circular]"';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
quickFormatUnescaped = format;
|
|
14
|
+
function format(f, args, opts) {
|
|
15
|
+
var ss = opts && opts.stringify || tryStringify;
|
|
16
|
+
var offset = 1;
|
|
17
|
+
if (typeof f === "object" && f !== null) {
|
|
18
|
+
var len = args.length + offset;
|
|
19
|
+
if (len === 1) return f;
|
|
20
|
+
var objects = new Array(len);
|
|
21
|
+
objects[0] = ss(f);
|
|
22
|
+
for (var index = 1; index < len; index++) {
|
|
23
|
+
objects[index] = ss(args[index]);
|
|
24
|
+
}
|
|
25
|
+
return objects.join(" ");
|
|
26
|
+
}
|
|
27
|
+
if (typeof f !== "string") {
|
|
28
|
+
return f;
|
|
29
|
+
}
|
|
30
|
+
var argLen = args.length;
|
|
31
|
+
if (argLen === 0) return f;
|
|
32
|
+
var str = "";
|
|
33
|
+
var a = 1 - offset;
|
|
34
|
+
var lastPos = -1;
|
|
35
|
+
var flen = f && f.length || 0;
|
|
36
|
+
for (var i = 0; i < flen; ) {
|
|
37
|
+
if (f.charCodeAt(i) === 37 && i + 1 < flen) {
|
|
38
|
+
lastPos = lastPos > -1 ? lastPos : 0;
|
|
39
|
+
switch (f.charCodeAt(i + 1)) {
|
|
40
|
+
case 100:
|
|
41
|
+
// 'd'
|
|
42
|
+
case 102:
|
|
43
|
+
if (a >= argLen)
|
|
44
|
+
break;
|
|
45
|
+
if (args[a] == null) break;
|
|
46
|
+
if (lastPos < i)
|
|
47
|
+
str += f.slice(lastPos, i);
|
|
48
|
+
str += Number(args[a]);
|
|
49
|
+
lastPos = i + 2;
|
|
50
|
+
i++;
|
|
51
|
+
break;
|
|
52
|
+
case 105:
|
|
53
|
+
if (a >= argLen)
|
|
54
|
+
break;
|
|
55
|
+
if (args[a] == null) break;
|
|
56
|
+
if (lastPos < i)
|
|
57
|
+
str += f.slice(lastPos, i);
|
|
58
|
+
str += Math.floor(Number(args[a]));
|
|
59
|
+
lastPos = i + 2;
|
|
60
|
+
i++;
|
|
61
|
+
break;
|
|
62
|
+
case 79:
|
|
63
|
+
// 'O'
|
|
64
|
+
case 111:
|
|
65
|
+
// 'o'
|
|
66
|
+
case 106:
|
|
67
|
+
if (a >= argLen)
|
|
68
|
+
break;
|
|
69
|
+
if (args[a] === void 0) break;
|
|
70
|
+
if (lastPos < i)
|
|
71
|
+
str += f.slice(lastPos, i);
|
|
72
|
+
var type = typeof args[a];
|
|
73
|
+
if (type === "string") {
|
|
74
|
+
str += "'" + args[a] + "'";
|
|
75
|
+
lastPos = i + 2;
|
|
76
|
+
i++;
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
if (type === "function") {
|
|
80
|
+
str += args[a].name || "<anonymous>";
|
|
81
|
+
lastPos = i + 2;
|
|
82
|
+
i++;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
str += ss(args[a]);
|
|
86
|
+
lastPos = i + 2;
|
|
87
|
+
i++;
|
|
88
|
+
break;
|
|
89
|
+
case 115:
|
|
90
|
+
if (a >= argLen)
|
|
91
|
+
break;
|
|
92
|
+
if (lastPos < i)
|
|
93
|
+
str += f.slice(lastPos, i);
|
|
94
|
+
str += String(args[a]);
|
|
95
|
+
lastPos = i + 2;
|
|
96
|
+
i++;
|
|
97
|
+
break;
|
|
98
|
+
case 37:
|
|
99
|
+
if (lastPos < i)
|
|
100
|
+
str += f.slice(lastPos, i);
|
|
101
|
+
str += "%";
|
|
102
|
+
lastPos = i + 2;
|
|
103
|
+
i++;
|
|
104
|
+
a--;
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
++a;
|
|
108
|
+
}
|
|
109
|
+
++i;
|
|
110
|
+
}
|
|
111
|
+
if (lastPos === -1)
|
|
112
|
+
return f;
|
|
113
|
+
else if (lastPos < flen) {
|
|
114
|
+
str += f.slice(lastPos);
|
|
115
|
+
}
|
|
116
|
+
return str;
|
|
117
|
+
}
|
|
118
|
+
return quickFormatUnescaped;
|
|
119
|
+
}
|
|
2
120
|
export {
|
|
3
|
-
|
|
121
|
+
requireQuickFormatUnescaped as __require
|
|
4
122
|
};
|
|
5
123
|
//# sourceMappingURL=standards-sdk.es87.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es87.js","sources":["../../node_modules/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es87.js","sources":["../../node_modules/quick-format-unescaped/index.js"],"sourcesContent":["'use strict'\nfunction tryStringify (o) {\n try { return JSON.stringify(o) } catch(e) { return '\"[Circular]\"' }\n}\n\nmodule.exports = format\n\nfunction format(f, args, opts) {\n var ss = (opts && opts.stringify) || tryStringify\n var offset = 1\n if (typeof f === 'object' && f !== null) {\n var len = args.length + offset\n if (len === 1) return f\n var objects = new Array(len)\n objects[0] = ss(f)\n for (var index = 1; index < len; index++) {\n objects[index] = ss(args[index])\n }\n return objects.join(' ')\n }\n if (typeof f !== 'string') {\n return f\n }\n var argLen = args.length\n if (argLen === 0) return f\n var str = ''\n var a = 1 - offset\n var lastPos = -1\n var flen = (f && f.length) || 0\n for (var i = 0; i < flen;) {\n if (f.charCodeAt(i) === 37 && i + 1 < flen) {\n lastPos = lastPos > -1 ? lastPos : 0\n switch (f.charCodeAt(i + 1)) {\n case 100: // 'd'\n case 102: // 'f'\n if (a >= argLen)\n break\n if (args[a] == null) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += Number(args[a])\n lastPos = i + 2\n i++\n break\n case 105: // 'i'\n if (a >= argLen)\n break\n if (args[a] == null) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += Math.floor(Number(args[a]))\n lastPos = i + 2\n i++\n break\n case 79: // 'O'\n case 111: // 'o'\n case 106: // 'j'\n if (a >= argLen)\n break\n if (args[a] === undefined) break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n var type = typeof args[a]\n if (type === 'string') {\n str += '\\'' + args[a] + '\\''\n lastPos = i + 2\n i++\n break\n }\n if (type === 'function') {\n str += args[a].name || '<anonymous>'\n lastPos = i + 2\n i++\n break\n }\n str += ss(args[a])\n lastPos = i + 2\n i++\n break\n case 115: // 's'\n if (a >= argLen)\n break\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += String(args[a])\n lastPos = i + 2\n i++\n break\n case 37: // '%'\n if (lastPos < i)\n str += f.slice(lastPos, i)\n str += '%'\n lastPos = i + 2\n i++\n a--\n break\n }\n ++a\n }\n ++i\n }\n if (lastPos === -1)\n return f\n else if (lastPos < flen) {\n str += f.slice(lastPos)\n }\n\n return str\n}\n"],"names":[],"mappings":";;;;;AACA,WAAS,aAAc,GAAG;AACxB,QAAI;AAAE,aAAO,KAAK,UAAU,CAAC;AAAA,IAAC,SAAS,GAAG;AAAE,aAAO;AAAA,IAAc;A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;AACjC,sBAAU,IAAI;AACd;AACA;AAAA,UACF,KAAK;AAAA;AAAA,UACL,KAAK;AAAA;AAAA,UACL,KAAK;AACH,gBAAI,KAAK;AACP;AACF,gBAAI,KAAK,CAAC,MAAM,OAAW;AAC3B,gBAAI,UAAU;AACZ,qBAAO,EAAE,MAAM,SAAS,CAAC;AAC3B,gBAAI,OAAO,OAAO,KAAK,CAAC;AACxB,gBAAI,SAAS,UAAU;AACrB,qBAAO,MAAO,KAAK,CAAC,IAAI;AACxB,wBAAU,IAAI;AACd;AACA;AAAA,YACZ;AACU,gBAAI,SAAS,YAAY;AACvB,qBAAO,KAAK,CAAC,EAAE,QAAQ;AACvB,wBAAU,IAAI;AACd;AACA;AAAA,YACZ;AACU,mBAAO,GAAG,KAAK,CAAC,CAAC;AACjB,sBAAU,IAAI;AACd;AACA;AAAA,UACF,KAAK;AACH,gBAAI,KAAK;AACP;AACF,gBAAI,UAAU;AACZ,qBAAO,EAAE,MAAM,SAAS,CAAC;AAC3B,mBAAO,OAAO,KAAK,CAAC,CAAC;AACrB,sBAAU,IAAI;AACd;AACA;AAAA,UACF,KAAK;AACH,gBAAI,UAAU;AACZ,qBAAO,EAAE,MAAM,SAAS,CAAC;AAC3B,mBAAO;AACP,sBAAU,IAAI;AACd;AACA;AACA;AAAA,QACV;AACM,UAAE;AAAA,MACR;AACI,QAAE;AAAA,IACN;AACE,QAAI,YAAY;AACd,aAAO;AAAA,aACA,UAAU,MAAM;AACvB,aAAO,EAAE,MAAM,OAAO;AAAA,IAC1B;AAEE,WAAO;AAAA,EACT;;;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es9.js","sources":["../../src/hcs-10/registrations.ts"],"sourcesContent":["import { AgentMetadata } from './sdk';\nimport { Logger } from '../utils/logger';\nimport { HCS11Client } from '../hcs-11';\nimport { sleep } from '../utils/sleep';\n\nexport interface RegistrationSearchOptions {\n tags?: string[];\n accountId?: string;\n network?: string;\n}\n\nexport interface RegistrationSearchResult {\n registrations: Array<{\n id: string;\n transaction_id: string;\n status: 'pending' | 'success' | 'failed';\n network: string;\n account_id: string;\n inbound_topic_id: string;\n outbound_topic_id: string;\n operator_id: string;\n metadata: AgentMetadata;\n registry_topic_id: string;\n created_at: string;\n updated_at: string;\n }>;\n error?: string;\n success: boolean;\n}\n\nexport interface RegistrationsApiResponse {\n registrations: Array<{\n id: string;\n transaction_id: string;\n status: 'pending' | 'success' | 'failed';\n network: string;\n account_id: string;\n inbound_topic_id: string;\n outbound_topic_id: string;\n operator_id: string;\n metadata: AgentMetadata;\n registry_topic_id: string;\n created_at: string;\n updated_at: string;\n }>;\n error?: string;\n}\n\nexport type RegistrationResult = {\n transaction?: any;\n transactionId?: string;\n success: boolean;\n error?: string;\n validationErrors?: ValidationError[];\n};\n\nexport interface ValidationError {\n message: string;\n path?: string[];\n type?: string;\n context?: any;\n}\n\nexport interface RegistrationApiResponse {\n transaction_id: string;\n transaction: string;\n error?: string;\n details?: ValidationError[];\n}\n\nexport interface RegistrationStatusResponse {\n status: 'pending' | 'success' | 'failed';\n error?: string;\n}\n\nexport abstract class Registration {\n /**\n * Checks the status of a registration request.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration status response.\n */\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string,\n logger?: Logger\n ): Promise<RegistrationStatusResponse> {\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 const error = `Failed to confirm registration: ${response.statusText}`;\n if (logger) {\n logger.error(error);\n }\n throw new Error(error);\n }\n\n return (await response.json()) as RegistrationStatusResponse;\n } catch (error: any) {\n if (logger) {\n logger.error(`Error checking registration status: ${error.message}`);\n }\n throw error;\n }\n }\n\n /**\n * Waits for a registration to be confirmed.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param maxAttempts - The maximum number of attempts to check the registration status.\n * @param delayMs - The delay in milliseconds between attempts.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to true if the registration is confirmed, false otherwise.\n */\n async waitForRegistrationConfirmation(\n transactionId: string,\n network: string,\n baseUrl: string,\n maxAttempts: number = 60,\n delayMs: number = 2000,\n logger?: Logger\n ): Promise<boolean> {\n let attempts = 0;\n while (attempts < maxAttempts) {\n if (logger) {\n logger.info(\n `Checking registration status. Attempt ${attempts + 1}/${maxAttempts}`\n );\n }\n\n const status = await this.checkRegistrationStatus(\n transactionId,\n network,\n baseUrl,\n logger\n );\n\n if (status.status === 'success') {\n if (logger) {\n logger.info('Registration confirmed successfully');\n }\n return true;\n }\n\n if (status.status === 'failed') {\n if (logger) {\n logger.error('Registration confirmation failed');\n }\n throw new Error('Registration confirmation failed');\n }\n\n if (logger) {\n logger.info(\n `Registration still pending. Waiting ${delayMs}ms before next attempt`\n );\n }\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n attempts++;\n }\n\n if (logger) {\n logger.warn(`Registration not confirmed after ${maxAttempts} attempts`);\n }\n return false;\n }\n\n /**\n * Executes a registration request for an agent.\n *\n * @param accountId - The account ID of the agent to register.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration result.\n */\n async executeRegistration(\n accountId: string,\n network: string = 'mainnet',\n baseUrl: string = 'https://moonscape.tech',\n logger?: Logger\n ): Promise<RegistrationResult> {\n try {\n if (logger) {\n logger.info('Registering agent with guarded registry');\n }\n\n try {\n const hcs11Client = new HCS11Client({\n network: network as 'mainnet' | 'testnet',\n auth: { operatorId: '0.0.0' },\n });\n logger?.info(\n `Fetching profile by account ID ${accountId} on ${network}`\n );\n await sleep(5000);\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n network\n );\n logger?.info('Profile fetched', profileResult);\n\n if (profileResult?.error) {\n logger?.error('Error fetching profile', profileResult.error);\n return {\n error: profileResult.error,\n success: false,\n };\n }\n if (!profileResult?.success || !profileResult?.profile) {\n if (logger) {\n logger.error('Profile not found for agent registration');\n }\n return {\n error: 'Profile not found for the provided account ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.inboundTopicId) {\n if (logger) {\n logger.error('Missing inbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required inbound topic ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.outboundTopicId) {\n if (logger) {\n logger.error('Missing outbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required outbound topic ID',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Profile validation successful. Inbound topic: ${profileResult.profile.inboundTopicId}, Outbound topic: ${profileResult.profile.outboundTopicId}`\n );\n }\n } catch (profileError: any) {\n if (logger) {\n logger.error(`Error validating profile: ${profileError.message}`);\n }\n return {\n error: `Error validating profile: ${profileError.message}`,\n success: false,\n };\n }\n\n const response = await fetch(`${baseUrl}/api/request-register`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n 'X-Network': network,\n },\n body: JSON.stringify({\n accountId,\n }),\n });\n\n const data = (await response.json()) as RegistrationApiResponse;\n\n if (!response.ok) {\n if (data.details?.length > 0) {\n return {\n validationErrors: data.details,\n error: data.error || 'Validation failed',\n success: false,\n };\n }\n return {\n error: data.error || 'Failed to register agent',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Created new registration request. Transaction ID: ${data.transaction_id}`\n );\n }\n\n return {\n transactionId: data.transaction_id,\n transaction: data.transaction,\n success: true,\n };\n } catch (error: any) {\n return {\n error: `Error during registration request: ${error.message}`,\n success: false,\n };\n }\n }\n\n /**\n * Finds registrations based on the provided options.\n *\n * @param options - The options for searching registrations.\n * @param baseUrl - The base URL of the guarded registry.\n * @returns A promise that resolves to the registration search result.\n */\n async findRegistrations(\n options: RegistrationSearchOptions = {},\n baseUrl: string = 'https://moonscape.tech'\n ): Promise<RegistrationSearchResult> {\n try {\n const queryParams = new URLSearchParams();\n options.tags?.forEach((tag) => queryParams.append('tags', tag));\n if (options.accountId) {\n queryParams.append('accountId', options.accountId);\n }\n if (options.network) {\n queryParams.append('network', options.network);\n }\n\n const response = await fetch(\n `${baseUrl}/api/registrations?${queryParams}`,\n {\n headers: {\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n },\n }\n );\n\n if (!response.ok) {\n const error = await response.text();\n return {\n registrations: [],\n error: error || 'Failed to fetch registrations',\n success: false,\n };\n }\n\n const data = (await response.json()) as RegistrationsApiResponse;\n if (data.error) {\n return {\n registrations: [],\n error: data.error,\n success: false,\n };\n }\n\n return {\n registrations: data.registrations || [],\n success: true,\n };\n } catch (e) {\n const error = e as Error;\n return {\n registrations: [],\n error: `Error fetching registrations: ${error.message}`,\n success: false,\n };\n }\n }\n}\n"],"names":[],"mappings":";;AA2EO,MAAe,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUjC,MAAgB,wBACd,eACA,SACA,SACA,QACqC;AACjC,QAAA;AACF,YAAM,WAAW,MAAM,MAAM,GAAG,OAAO,wBAAwB;AAAA,QAC7D,QAAQ;AAAA,QACR,SAAS;AAAA,UACP,gBAAgB;AAAA,UAChB,aAAa;AAAA,QACf;AAAA,QACA,MAAM,KAAK,UAAU,EAAE,gBAAgB,cAAe,CAAA;AAAA,MAAA,CACvD;AAEG,UAAA,CAAC,SAAS,IAAI;AACV,cAAA,QAAQ,mCAAmC,SAAS,UAAU;AACpE,YAAI,QAAQ;AACV,iBAAO,MAAM,KAAK;AAAA,QAAA;AAEd,cAA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,SAAS;AACP,oBAAA,OAAO,WAAW,QAAQ,OAAO;AAAA,MAAA;AAG/C,YAAM,WAAW,MAAM;AAAA,QACrB,GAAG,OAAO,sBAAsB,WAAW;AAAA,QAC3C;AAAA,UACE,SAAS;AAAA,YACP,QAAQ;AAAA,YACR,mBAAmB;AAAA,YACnB,QAAQ;AAAA,YACR,SAAS,GAAG,OAAO;AAAA,UAAA;AAAA,QACrB;AAAA,MAEJ;AAEI,UAAA,CAAC,SAAS,IAAI;AACV,cAAA,QAAQ,MAAM,SAAS,KAAK;AAC3B,eAAA;AAAA,UACL,eAAe,CAAC;AAAA,UAChB,OAAO,SAAS;AAAA,UAChB,SAAS;AAAA,QACX;AAAA,MAAA;AAGI,YAAA,OAAQ,MAAM,SAAS,KAAK;AAClC,UAAI,KAAK,OAAO;AACP,eAAA;AAAA,UACL,eAAe,CAAC;AAAA,UAChB,OAAO,KAAK;AAAA,UACZ,SAAS;AAAA,QACX;AAAA,MAAA;AAGK,aAAA;AAAA,QACL,eAAe,KAAK,iBAAiB,CAAC;AAAA,QACtC,SAAS;AAAA,MACX;AAAA,aACO,GAAG;AACV,YAAM,QAAQ;AACP,aAAA;AAAA,QACL,eAAe,CAAC;AAAA,QAChB,OAAO,iCAAiC,MAAM,OAAO;AAAA,QACrD,SAAS;AAAA,MACX;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es9.js","sources":["../../src/hcs-10/registrations.ts"],"sourcesContent":["import { Logger } from '../utils/logger';\nimport { HCS11Client } from '../hcs-11';\nimport { sleep } from '../utils/sleep';\nimport {\n RegistrationSearchResult,\n AgentMetadata,\n RegistrationResult,\n RegistrationsApiResponse,\n RegistrationSearchOptions,\n} from './types';\n\nexport interface RegistrationStatusResponse {\n status: 'pending' | 'success' | 'failed';\n error?: string;\n}\n\nexport abstract class Registration {\n /**\n * Checks the status of a registration request.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration status response.\n */\n protected async checkRegistrationStatus(\n transactionId: string,\n network: string,\n baseUrl: string,\n logger?: Logger\n ): Promise<RegistrationStatusResponse> {\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 const error = `Failed to confirm registration: ${response.statusText}`;\n if (logger) {\n logger.error(error);\n }\n throw new Error(error);\n }\n\n return (await response.json()) as RegistrationStatusResponse;\n } catch (error: any) {\n if (logger) {\n logger.error(`Error checking registration status: ${error.message}`);\n }\n throw error;\n }\n }\n\n /**\n * Waits for a registration to be confirmed.\n *\n * @param transactionId - The transaction ID of the registration.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param maxAttempts - The maximum number of attempts to check the registration status.\n * @param delayMs - The delay in milliseconds between attempts.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to true if the registration is confirmed, false otherwise.\n */\n async waitForRegistrationConfirmation(\n transactionId: string,\n network: string,\n baseUrl: string,\n maxAttempts: number = 60,\n delayMs: number = 2000,\n logger?: Logger\n ): Promise<boolean> {\n let attempts = 0;\n while (attempts < maxAttempts) {\n if (logger) {\n logger.info(\n `Checking registration status. Attempt ${attempts + 1}/${maxAttempts}`\n );\n }\n\n const status = await this.checkRegistrationStatus(\n transactionId,\n network,\n baseUrl,\n logger\n );\n\n if (status.status === 'success') {\n if (logger) {\n logger.info('Registration confirmed successfully');\n }\n return true;\n }\n\n if (status.status === 'failed') {\n if (logger) {\n logger.error('Registration confirmation failed');\n }\n throw new Error('Registration confirmation failed');\n }\n\n if (logger) {\n logger.info(\n `Registration still pending. Waiting ${delayMs}ms before next attempt`\n );\n }\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n attempts++;\n }\n\n if (logger) {\n logger.warn(`Registration not confirmed after ${maxAttempts} attempts`);\n }\n return false;\n }\n\n /**\n * Executes a registration request for an agent.\n *\n * @param accountId - The account ID of the agent to register.\n * @param network - The network to use for the registration.\n * @param baseUrl - The base URL of the guarded registry.\n * @param logger - The logger to use for logging.\n * @returns A promise that resolves to the registration result.\n */\n async executeRegistration(\n accountId: string,\n network: string = 'mainnet',\n baseUrl: string = 'https://moonscape.tech',\n logger?: Logger\n ): Promise<RegistrationResult> {\n try {\n if (logger) {\n logger.info('Registering agent with guarded registry');\n }\n\n try {\n const hcs11Client = new HCS11Client({\n network: network as 'mainnet' | 'testnet',\n auth: { operatorId: '0.0.0' },\n });\n logger?.info(\n `Fetching profile by account ID ${accountId} on ${network}`\n );\n await sleep(5000);\n const profileResult = await hcs11Client.fetchProfileByAccountId(\n accountId,\n network\n );\n logger?.info('Profile fetched', profileResult);\n\n if (profileResult?.error) {\n logger?.error('Error fetching profile', profileResult.error);\n return {\n error: profileResult.error,\n success: false,\n };\n }\n if (!profileResult?.success || !profileResult?.profile) {\n if (logger) {\n logger.error('Profile not found for agent registration');\n }\n return {\n error: 'Profile not found for the provided account ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.inboundTopicId) {\n if (logger) {\n logger.error('Missing inbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required inbound topic ID',\n success: false,\n };\n }\n\n if (!profileResult.profile.outboundTopicId) {\n if (logger) {\n logger.error('Missing outbound topic ID in profile');\n }\n return {\n error: 'Profile is missing required outbound topic ID',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Profile validation successful. Inbound topic: ${profileResult.profile.inboundTopicId}, Outbound topic: ${profileResult.profile.outboundTopicId}`\n );\n }\n } catch (profileError: any) {\n if (logger) {\n logger.error(`Error validating profile: ${profileError.message}`);\n }\n return {\n error: `Error validating profile: ${profileError.message}`,\n success: false,\n };\n }\n\n const response = await fetch(`${baseUrl}/api/request-register`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n 'X-Network': network,\n },\n body: JSON.stringify({\n accountId,\n }),\n });\n\n const data = (await response.json()) as RegistrationsApiResponse;\n\n if (!response.ok) {\n if (data.details?.length > 0) {\n return {\n validationErrors: data.details,\n error: data.error || 'Validation failed',\n success: false,\n };\n }\n return {\n error: data.error || 'Failed to register agent',\n success: false,\n };\n }\n\n if (logger) {\n logger.info(\n `Created new registration request. Transaction ID: ${data.transaction_id}`\n );\n }\n\n return {\n transactionId: data.transaction_id,\n transaction: data.transaction,\n success: true,\n };\n } catch (error: any) {\n return {\n error: `Error during registration request: ${error.message}`,\n success: false,\n };\n }\n }\n\n /**\n * Finds registrations based on the provided options.\n *\n * @param options - The options for searching registrations.\n * @param baseUrl - The base URL of the guarded registry.\n * @returns A promise that resolves to the registration search result.\n */\n async findRegistrations(\n options: RegistrationSearchOptions = {},\n baseUrl: string = 'https://moonscape.tech'\n ): Promise<RegistrationSearchResult> {\n try {\n const queryParams = new URLSearchParams();\n options.tags?.forEach((tag) => queryParams.append('tags', tag));\n if (options.accountId) {\n queryParams.append('accountId', options.accountId);\n }\n if (options.network) {\n queryParams.append('network', options.network);\n }\n\n const response = await fetch(\n `${baseUrl}/api/registrations?${queryParams}`,\n {\n headers: {\n Accept: '*/*',\n 'Accept-Language': 'en;q=0.5',\n Origin: baseUrl,\n Referer: `${baseUrl}/`,\n },\n }\n );\n\n if (!response.ok) {\n const error = await response.text();\n return {\n registrations: [],\n error: error || 'Failed to fetch registrations',\n success: false,\n };\n }\n\n const data = (await response.json()) as RegistrationsApiResponse;\n if (data.error) {\n return {\n registrations: [],\n error: data.error,\n success: false,\n };\n }\n\n return {\n registrations: data.registrations || [],\n success: true,\n };\n } catch (e) {\n const error = e as Error;\n return {\n registrations: [],\n error: `Error fetching registrations: ${error.message}`,\n success: false,\n };\n }\n }\n}\n"],"names":[],"mappings":";;AAgBO,MAAe,aAAa;AAAA;AAAA;AA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QACrD,SAAS;AAAA,MACX;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { version } from "./standards-sdk.
|
|
2
|
-
import { defineProperties } from "./standards-sdk.
|
|
1
|
+
import { version } from "./standards-sdk.es84.js";
|
|
2
|
+
import { defineProperties } from "./standards-sdk.es105.js";
|
|
3
3
|
function stringify(value) {
|
|
4
4
|
if (value == null) {
|
|
5
5
|
return "null";
|
|
@@ -1,198 +1,177 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
let revert = null;
|
|
42
|
-
if (data) {
|
|
43
|
-
message = "execution reverted";
|
|
44
|
-
const bytes = getBytes(data);
|
|
45
|
-
data = hexlify(data);
|
|
46
|
-
if (bytes.length === 0) {
|
|
47
|
-
message += " (no data present; likely require(false) occurred";
|
|
48
|
-
reason = "require(false)";
|
|
49
|
-
} else if (bytes.length % 32 !== 4) {
|
|
50
|
-
message += " (could not decode reason; invalid data length)";
|
|
51
|
-
} else if (hexlify(bytes.slice(0, 4)) === "0x08c379a0") {
|
|
52
|
-
try {
|
|
53
|
-
reason = abiCoder.decode(["string"], bytes.slice(4))[0];
|
|
54
|
-
revert = {
|
|
55
|
-
signature: "Error(string)",
|
|
56
|
-
name: "Error",
|
|
57
|
-
args: [reason]
|
|
58
|
-
};
|
|
59
|
-
message += `: ${JSON.stringify(reason)}`;
|
|
60
|
-
} catch (error) {
|
|
61
|
-
message += " (could not decode reason; invalid string data)";
|
|
62
|
-
}
|
|
63
|
-
} else if (hexlify(bytes.slice(0, 4)) === "0x4e487b71") {
|
|
64
|
-
try {
|
|
65
|
-
const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]);
|
|
66
|
-
revert = {
|
|
67
|
-
signature: "Panic(uint256)",
|
|
68
|
-
name: "Panic",
|
|
69
|
-
args: [code]
|
|
70
|
-
};
|
|
71
|
-
reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`;
|
|
72
|
-
message += `: ${reason}`;
|
|
73
|
-
} catch (error) {
|
|
74
|
-
message += " (could not decode panic code)";
|
|
1
|
+
import { number, exists, bytes, output } from "./standards-sdk.es110.js";
|
|
2
|
+
import { rotlSH, rotlSL, rotlBH, rotlBL, split } from "./standards-sdk.es111.js";
|
|
3
|
+
import { wrapConstructor, Hash, u32, toBytes } from "./standards-sdk.es112.js";
|
|
4
|
+
const [SHA3_PI, SHA3_ROTL, _SHA3_IOTA] = [[], [], []];
|
|
5
|
+
const _0n = /* @__PURE__ */ BigInt(0);
|
|
6
|
+
const _1n = /* @__PURE__ */ BigInt(1);
|
|
7
|
+
const _2n = /* @__PURE__ */ BigInt(2);
|
|
8
|
+
const _7n = /* @__PURE__ */ BigInt(7);
|
|
9
|
+
const _256n = /* @__PURE__ */ BigInt(256);
|
|
10
|
+
const _0x71n = /* @__PURE__ */ BigInt(113);
|
|
11
|
+
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
12
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
13
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
14
|
+
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
15
|
+
let t = _0n;
|
|
16
|
+
for (let j = 0; j < 7; j++) {
|
|
17
|
+
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
18
|
+
if (R & _2n)
|
|
19
|
+
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
20
|
+
}
|
|
21
|
+
_SHA3_IOTA.push(t);
|
|
22
|
+
}
|
|
23
|
+
const [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);
|
|
24
|
+
const rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s);
|
|
25
|
+
const rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s);
|
|
26
|
+
function keccakP(s, rounds = 24) {
|
|
27
|
+
const B = new Uint32Array(5 * 2);
|
|
28
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
29
|
+
for (let x = 0; x < 10; x++)
|
|
30
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
31
|
+
for (let x = 0; x < 10; x += 2) {
|
|
32
|
+
const idx1 = (x + 8) % 10;
|
|
33
|
+
const idx0 = (x + 2) % 10;
|
|
34
|
+
const B0 = B[idx0];
|
|
35
|
+
const B1 = B[idx0 + 1];
|
|
36
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
37
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
38
|
+
for (let y = 0; y < 50; y += 10) {
|
|
39
|
+
s[x + y] ^= Th;
|
|
40
|
+
s[x + y + 1] ^= Tl;
|
|
75
41
|
}
|
|
76
|
-
} else {
|
|
77
|
-
message += " (unknown custom error)";
|
|
78
42
|
}
|
|
43
|
+
let curH = s[2];
|
|
44
|
+
let curL = s[3];
|
|
45
|
+
for (let t = 0; t < 24; t++) {
|
|
46
|
+
const shift = SHA3_ROTL[t];
|
|
47
|
+
const Th = rotlH(curH, curL, shift);
|
|
48
|
+
const Tl = rotlL(curH, curL, shift);
|
|
49
|
+
const PI = SHA3_PI[t];
|
|
50
|
+
curH = s[PI];
|
|
51
|
+
curL = s[PI + 1];
|
|
52
|
+
s[PI] = Th;
|
|
53
|
+
s[PI + 1] = Tl;
|
|
54
|
+
}
|
|
55
|
+
for (let y = 0; y < 50; y += 10) {
|
|
56
|
+
for (let x = 0; x < 10; x++)
|
|
57
|
+
B[x] = s[y + x];
|
|
58
|
+
for (let x = 0; x < 10; x++)
|
|
59
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
60
|
+
}
|
|
61
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
62
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
79
63
|
}
|
|
80
|
-
|
|
81
|
-
to: tx.to ? getAddress(tx.to) : null,
|
|
82
|
-
data: tx.data || "0x"
|
|
83
|
-
};
|
|
84
|
-
if (tx.from) {
|
|
85
|
-
transaction.from = getAddress(tx.from);
|
|
86
|
-
}
|
|
87
|
-
return makeError(message, "CALL_EXCEPTION", {
|
|
88
|
-
action,
|
|
89
|
-
data,
|
|
90
|
-
reason,
|
|
91
|
-
transaction,
|
|
92
|
-
invocation,
|
|
93
|
-
revert
|
|
94
|
-
});
|
|
64
|
+
B.fill(0);
|
|
95
65
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
66
|
+
class Keccak extends Hash {
|
|
67
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
68
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
69
|
+
super();
|
|
70
|
+
this.blockLen = blockLen;
|
|
71
|
+
this.suffix = suffix;
|
|
72
|
+
this.outputLen = outputLen;
|
|
73
|
+
this.enableXOF = enableXOF;
|
|
74
|
+
this.rounds = rounds;
|
|
75
|
+
this.pos = 0;
|
|
76
|
+
this.posOut = 0;
|
|
77
|
+
this.finished = false;
|
|
78
|
+
this.destroyed = false;
|
|
79
|
+
number(outputLen);
|
|
80
|
+
if (0 >= this.blockLen || this.blockLen >= 200)
|
|
81
|
+
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
82
|
+
this.state = new Uint8Array(200);
|
|
83
|
+
this.state32 = u32(this.state);
|
|
110
84
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*/
|
|
116
|
-
encode(types, values) {
|
|
117
|
-
assertArgumentCount(values.length, types.length, "types/values length mismatch");
|
|
118
|
-
const coders = types.map((type) => __privateMethod(this, _AbiCoder_instances, getCoder_fn).call(this, ParamType.from(type)));
|
|
119
|
-
const coder = new TupleCoder(coders, "_");
|
|
120
|
-
const writer = new Writer();
|
|
121
|
-
coder.encode(writer, values);
|
|
122
|
-
return writer.data;
|
|
85
|
+
keccak() {
|
|
86
|
+
keccakP(this.state32, this.rounds);
|
|
87
|
+
this.posOut = 0;
|
|
88
|
+
this.pos = 0;
|
|
123
89
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
90
|
+
update(data) {
|
|
91
|
+
exists(this);
|
|
92
|
+
const { blockLen, state } = this;
|
|
93
|
+
data = toBytes(data);
|
|
94
|
+
const len = data.length;
|
|
95
|
+
for (let pos = 0; pos < len; ) {
|
|
96
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
97
|
+
for (let i = 0; i < take; i++)
|
|
98
|
+
state[this.pos++] ^= data[pos++];
|
|
99
|
+
if (this.pos === blockLen)
|
|
100
|
+
this.keccak();
|
|
101
|
+
}
|
|
102
|
+
return this;
|
|
135
103
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
104
|
+
finish() {
|
|
105
|
+
if (this.finished)
|
|
106
|
+
return;
|
|
107
|
+
this.finished = true;
|
|
108
|
+
const { state, suffix, pos, blockLen } = this;
|
|
109
|
+
state[pos] ^= suffix;
|
|
110
|
+
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
111
|
+
this.keccak();
|
|
112
|
+
state[blockLen - 1] ^= 128;
|
|
113
|
+
this.keccak();
|
|
139
114
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
115
|
+
writeInto(out) {
|
|
116
|
+
exists(this, false);
|
|
117
|
+
bytes(out);
|
|
118
|
+
this.finish();
|
|
119
|
+
const bufferOut = this.state;
|
|
120
|
+
const { blockLen } = this;
|
|
121
|
+
for (let pos = 0, len = out.length; pos < len; ) {
|
|
122
|
+
if (this.posOut >= blockLen)
|
|
123
|
+
this.keccak();
|
|
124
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
125
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
126
|
+
this.posOut += take;
|
|
127
|
+
pos += take;
|
|
148
128
|
}
|
|
149
|
-
return
|
|
129
|
+
return out;
|
|
150
130
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*/
|
|
156
|
-
static getBuiltinCallException(action, tx, data) {
|
|
157
|
-
return getBuiltinCallException(action, tx, data, _AbiCoder.defaultAbiCoder());
|
|
131
|
+
xofInto(out) {
|
|
132
|
+
if (!this.enableXOF)
|
|
133
|
+
throw new Error("XOF is not possible for this instance");
|
|
134
|
+
return this.writeInto(out);
|
|
158
135
|
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if (param.isArray()) {
|
|
163
|
-
return new ArrayCoder(__privateMethod(this, _AbiCoder_instances, getCoder_fn).call(this, param.arrayChildren), param.arrayLength, param.name);
|
|
136
|
+
xof(bytes2) {
|
|
137
|
+
number(bytes2);
|
|
138
|
+
return this.xofInto(new Uint8Array(bytes2));
|
|
164
139
|
}
|
|
165
|
-
|
|
166
|
-
|
|
140
|
+
digestInto(out) {
|
|
141
|
+
output(out, this);
|
|
142
|
+
if (this.finished)
|
|
143
|
+
throw new Error("digest() was already called");
|
|
144
|
+
this.writeInto(out);
|
|
145
|
+
this.destroy();
|
|
146
|
+
return out;
|
|
167
147
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
return new AddressCoder(param.name);
|
|
171
|
-
case "bool":
|
|
172
|
-
return new BooleanCoder(param.name);
|
|
173
|
-
case "string":
|
|
174
|
-
return new StringCoder(param.name);
|
|
175
|
-
case "bytes":
|
|
176
|
-
return new BytesCoder(param.name);
|
|
177
|
-
case "":
|
|
178
|
-
return new NullCoder(param.name);
|
|
148
|
+
digest() {
|
|
149
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
179
150
|
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
assertArgument(size !== 0 && size <= 256 && size % 8 === 0, "invalid " + match[1] + " bit length", "param", param);
|
|
184
|
-
return new NumberCoder(size / 8, match[1] === "int", param.name);
|
|
151
|
+
destroy() {
|
|
152
|
+
this.destroyed = true;
|
|
153
|
+
this.state.fill(0);
|
|
185
154
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
155
|
+
_cloneInto(to) {
|
|
156
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
157
|
+
to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
158
|
+
to.state32.set(this.state32);
|
|
159
|
+
to.pos = this.pos;
|
|
160
|
+
to.posOut = this.posOut;
|
|
161
|
+
to.finished = this.finished;
|
|
162
|
+
to.rounds = rounds;
|
|
163
|
+
to.suffix = suffix;
|
|
164
|
+
to.outputLen = outputLen;
|
|
165
|
+
to.enableXOF = enableXOF;
|
|
166
|
+
to.destroyed = this.destroyed;
|
|
167
|
+
return to;
|
|
191
168
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
169
|
+
}
|
|
170
|
+
const gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));
|
|
171
|
+
const keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8);
|
|
195
172
|
export {
|
|
196
|
-
|
|
173
|
+
Keccak,
|
|
174
|
+
keccakP,
|
|
175
|
+
keccak_256
|
|
197
176
|
};
|
|
198
177
|
//# sourceMappingURL=standards-sdk.es92.js.map
|