@hashgraphonline/standards-sdk 0.0.70 → 0.0.72
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/base-client.d.ts +45 -0
- package/dist/es/hcs-10/base-client.d.ts.map +1 -1
- package/dist/es/hcs-10/browser.d.ts +0 -1
- package/dist/es/hcs-10/browser.d.ts.map +1 -1
- package/dist/es/hcs-10/sdk.d.ts +0 -1
- package/dist/es/hcs-10/sdk.d.ts.map +1 -1
- package/dist/es/standards-sdk.es100.js +13 -61
- package/dist/es/standards-sdk.es100.js.map +1 -1
- package/dist/es/standards-sdk.es101.js +13 -1289
- package/dist/es/standards-sdk.es101.js.map +1 -1
- package/dist/es/standards-sdk.es102.js +14 -146
- package/dist/es/standards-sdk.es102.js.map +1 -1
- package/dist/es/standards-sdk.es103.js +4 -90
- package/dist/es/standards-sdk.es103.js.map +1 -1
- package/dist/es/standards-sdk.es104.js +39 -84
- package/dist/es/standards-sdk.es104.js.map +1 -1
- package/dist/es/standards-sdk.es105.js +36 -28
- package/dist/es/standards-sdk.es105.js.map +1 -1
- package/dist/es/standards-sdk.es106.js +37 -6
- package/dist/es/standards-sdk.es106.js.map +1 -1
- package/dist/es/standards-sdk.es107.js +69 -150
- package/dist/es/standards-sdk.es107.js.map +1 -1
- package/dist/es/standards-sdk.es108.js +2281 -22
- package/dist/es/standards-sdk.es108.js.map +1 -1
- package/dist/es/standards-sdk.es109.js +30 -789
- package/dist/es/standards-sdk.es109.js.map +1 -1
- package/dist/es/standards-sdk.es110.js +30 -171
- package/dist/es/standards-sdk.es110.js.map +1 -1
- package/dist/es/standards-sdk.es111.js +9 -143
- package/dist/es/standards-sdk.es111.js.map +1 -1
- package/dist/es/standards-sdk.es112.js +32 -19
- package/dist/es/standards-sdk.es112.js.map +1 -1
- package/dist/es/standards-sdk.es113.js +3 -27
- package/dist/es/standards-sdk.es113.js.map +1 -1
- package/dist/es/standards-sdk.es114.js +2 -26
- package/dist/es/standards-sdk.es114.js.map +1 -1
- package/dist/es/standards-sdk.es115.js +2 -38
- package/dist/es/standards-sdk.es115.js.map +1 -1
- package/dist/es/standards-sdk.es12.js +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 +6627 -36
- package/dist/es/standards-sdk.es22.js.map +1 -1
- package/dist/es/standards-sdk.es23.js +1039 -46
- package/dist/es/standards-sdk.es23.js.map +1 -1
- package/dist/es/standards-sdk.es24.js +36 -6627
- package/dist/es/standards-sdk.es24.js.map +1 -1
- package/dist/es/standards-sdk.es25.js +48 -3
- package/dist/es/standards-sdk.es25.js.map +1 -1
- package/dist/es/standards-sdk.es26.js +3 -2
- package/dist/es/standards-sdk.es26.js.map +1 -1
- package/dist/es/standards-sdk.es27.js +2 -1041
- package/dist/es/standards-sdk.es27.js.map +1 -1
- package/dist/es/standards-sdk.es36.js +2 -364
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +362 -4
- package/dist/es/standards-sdk.es37.js.map +1 -1
- package/dist/es/standards-sdk.es38.js +5 -178
- package/dist/es/standards-sdk.es38.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +171 -73
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es4.js +1 -1
- package/dist/es/standards-sdk.es40.js +74 -107
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es41.js +107 -45
- package/dist/es/standards-sdk.es41.js.map +1 -1
- package/dist/es/standards-sdk.es42.js +51 -9
- package/dist/es/standards-sdk.es42.js.map +1 -1
- package/dist/es/standards-sdk.es43.js +9 -96
- package/dist/es/standards-sdk.es43.js.map +1 -1
- package/dist/es/standards-sdk.es44.js +96 -3
- package/dist/es/standards-sdk.es44.js.map +1 -1
- package/dist/es/standards-sdk.es45.js +4 -2
- package/dist/es/standards-sdk.es45.js.map +1 -1
- package/dist/es/standards-sdk.es46.js +2 -113
- package/dist/es/standards-sdk.es46.js.map +1 -1
- package/dist/es/standards-sdk.es47.js +109 -70
- package/dist/es/standards-sdk.es47.js.map +1 -1
- package/dist/es/standards-sdk.es48.js +73 -5
- package/dist/es/standards-sdk.es48.js.map +1 -1
- package/dist/es/standards-sdk.es49.js +5 -4
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es5.js +111 -2
- package/dist/es/standards-sdk.es5.js.map +1 -1
- package/dist/es/standards-sdk.es50.js +4 -220
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +214 -51
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +56 -67
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +69 -101
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +23 -2
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +173 -15
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/standards-sdk.es56.js +85 -403
- package/dist/es/standards-sdk.es56.js.map +1 -1
- package/dist/es/standards-sdk.es57.js +192 -29
- package/dist/es/standards-sdk.es57.js.map +1 -1
- package/dist/es/standards-sdk.es58.js +417 -42
- package/dist/es/standards-sdk.es58.js.map +1 -1
- package/dist/es/standards-sdk.es59.js +21 -46
- package/dist/es/standards-sdk.es59.js.map +1 -1
- package/dist/es/standards-sdk.es60.js +138 -9
- package/dist/es/standards-sdk.es60.js.map +1 -1
- package/dist/es/standards-sdk.es61.js +14 -61
- package/dist/es/standards-sdk.es61.js.map +1 -1
- package/dist/es/standards-sdk.es62.js +29 -6
- package/dist/es/standards-sdk.es62.js.map +1 -1
- package/dist/es/standards-sdk.es63.js +27 -13
- package/dist/es/standards-sdk.es63.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +21 -7
- package/dist/es/standards-sdk.es64.js.map +1 -1
- package/dist/es/standards-sdk.es65.js +42 -43
- package/dist/es/standards-sdk.es65.js.map +1 -1
- package/dist/es/standards-sdk.es66.js +18 -2
- package/dist/es/standards-sdk.es66.js.map +1 -1
- package/dist/es/standards-sdk.es67.js +55 -130
- package/dist/es/standards-sdk.es67.js.map +1 -1
- package/dist/es/standards-sdk.es68.js +1272 -155
- package/dist/es/standards-sdk.es68.js.map +1 -1
- package/dist/es/standards-sdk.es69.js +148 -2282
- package/dist/es/standards-sdk.es69.js.map +1 -1
- package/dist/es/standards-sdk.es7.js +2 -44
- package/dist/es/standards-sdk.es7.js.map +1 -1
- package/dist/es/standards-sdk.es70.js +84 -13
- package/dist/es/standards-sdk.es70.js.map +1 -1
- package/dist/es/standards-sdk.es71.js +32 -13
- package/dist/es/standards-sdk.es71.js.map +1 -1
- package/dist/es/standards-sdk.es72.js +5 -31
- package/dist/es/standards-sdk.es72.js.map +1 -1
- package/dist/es/standards-sdk.es73.js +157 -13
- package/dist/es/standards-sdk.es73.js.map +1 -1
- package/dist/es/standards-sdk.es74.js +792 -3
- package/dist/es/standards-sdk.es74.js.map +1 -1
- package/dist/es/standards-sdk.es75.js +142 -3
- package/dist/es/standards-sdk.es75.js.map +1 -1
- package/dist/es/standards-sdk.es76.js +29 -13
- package/dist/es/standards-sdk.es76.js.map +1 -1
- package/dist/es/standards-sdk.es77.js +62 -4
- package/dist/es/standards-sdk.es77.js.map +1 -1
- package/dist/es/standards-sdk.es78.js +50 -39
- package/dist/es/standards-sdk.es78.js.map +1 -1
- package/dist/es/standards-sdk.es79.js +9 -39
- package/dist/es/standards-sdk.es79.js.map +1 -1
- package/dist/es/standards-sdk.es8.js +2 -46
- package/dist/es/standards-sdk.es8.js.map +1 -1
- package/dist/es/standards-sdk.es80.js +62 -34
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es81.js +5 -77
- package/dist/es/standards-sdk.es81.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +15 -3
- package/dist/es/standards-sdk.es82.js.map +1 -1
- package/dist/es/standards-sdk.es83.js +7 -2
- package/dist/es/standards-sdk.es83.js.map +1 -1
- package/dist/es/standards-sdk.es84.js +45 -2
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +2 -2
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js +134 -32
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es87.js +169 -30
- package/dist/es/standards-sdk.es87.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +27 -9
- package/dist/es/standards-sdk.es88.js.map +1 -1
- package/dist/es/standards-sdk.es89.js +25 -33
- package/dist/es/standards-sdk.es89.js.map +1 -1
- package/dist/es/standards-sdk.es9.js +1 -1
- package/dist/es/standards-sdk.es90.js +36 -193
- package/dist/es/standards-sdk.es90.js.map +1 -1
- package/dist/es/standards-sdk.es91.js +13 -430
- package/dist/es/standards-sdk.es91.js.map +1 -1
- package/dist/es/standards-sdk.es92.js +99 -23
- package/dist/es/standards-sdk.es92.js.map +1 -1
- package/dist/es/standards-sdk.es93.js +2 -139
- package/dist/es/standards-sdk.es93.js.map +1 -1
- package/dist/es/standards-sdk.es94.js +15 -17
- package/dist/es/standards-sdk.es94.js.map +1 -1
- package/dist/es/standards-sdk.es95.js +405 -25
- package/dist/es/standards-sdk.es95.js.map +1 -1
- package/dist/es/standards-sdk.es96.js +31 -28
- package/dist/es/standards-sdk.es96.js.map +1 -1
- package/dist/es/standards-sdk.es97.js +14 -20
- package/dist/es/standards-sdk.es97.js.map +1 -1
- package/dist/es/standards-sdk.es98.js +3 -43
- package/dist/es/standards-sdk.es98.js.map +1 -1
- package/dist/es/standards-sdk.es99.js +3 -17
- package/dist/es/standards-sdk.es99.js.map +1 -1
- package/dist/umd/hcs-10/base-client.d.ts +45 -0
- package/dist/umd/hcs-10/base-client.d.ts.map +1 -1
- package/dist/umd/hcs-10/browser.d.ts +0 -1
- package/dist/umd/hcs-10/browser.d.ts.map +1 -1
- package/dist/umd/hcs-10/sdk.d.ts +0 -1
- package/dist/umd/hcs-10/sdk.d.ts.map +1 -1
- package/dist/umd/standards-sdk.umd.js +1 -1
- package/dist/umd/standards-sdk.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@ import { Logger } from "./standards-sdk.es14.js";
|
|
|
3
3
|
import { Registration } from "./standards-sdk.es9.js";
|
|
4
4
|
import { HCS11Client } from "./standards-sdk.es12.js";
|
|
5
5
|
import { PublicKey } from "@hashgraph/sdk";
|
|
6
|
-
import "./standards-sdk.
|
|
6
|
+
import "./standards-sdk.es24.js";
|
|
7
7
|
import { HederaMirrorNode } from "./standards-sdk.es18.js";
|
|
8
|
-
import axios from "./standards-sdk.
|
|
8
|
+
import axios from "./standards-sdk.es25.js";
|
|
9
9
|
var Hcs10MemoType = /* @__PURE__ */ ((Hcs10MemoType2) => {
|
|
10
10
|
Hcs10MemoType2["INBOUND"] = "inbound";
|
|
11
11
|
Hcs10MemoType2["OUTBOUND"] = "outbound";
|
|
@@ -205,6 +205,11 @@ class HCS10BaseClient extends Registration {
|
|
|
205
205
|
return { messages: [] };
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
+
/**
|
|
209
|
+
* Requests an account from the mirror node
|
|
210
|
+
* @param account The account ID to request
|
|
211
|
+
* @returns The account response
|
|
212
|
+
*/
|
|
208
213
|
async requestAccount(account) {
|
|
209
214
|
try {
|
|
210
215
|
return await this.mirrorNode.requestAccount(account);
|
|
@@ -213,9 +218,20 @@ class HCS10BaseClient extends Registration {
|
|
|
213
218
|
throw e;
|
|
214
219
|
}
|
|
215
220
|
}
|
|
221
|
+
/**
|
|
222
|
+
* Retrieves the memo for an account
|
|
223
|
+
* @param accountId The account ID to retrieve the memo for
|
|
224
|
+
* @returns The memo
|
|
225
|
+
*/
|
|
216
226
|
async getAccountMemo(accountId) {
|
|
217
227
|
return await this.mirrorNode.getAccountMemo(accountId);
|
|
218
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Retrieves the profile for an account
|
|
231
|
+
* @param accountId The account ID to retrieve the profile for
|
|
232
|
+
* @param disableCache Whether to disable caching of the result
|
|
233
|
+
* @returns The profile
|
|
234
|
+
*/
|
|
219
235
|
async retrieveProfile(accountId, disableCache) {
|
|
220
236
|
this.logger.info(`Retrieving profile for account: ${accountId}`);
|
|
221
237
|
const cacheKey = `${accountId}-${this.network}`;
|
|
@@ -320,6 +336,11 @@ class HCS10BaseClient extends Registration {
|
|
|
320
336
|
throw error;
|
|
321
337
|
}
|
|
322
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* Retrieves outbound messages for an agent
|
|
341
|
+
* @param agentAccountId The account ID of the agent
|
|
342
|
+
* @returns The outbound messages
|
|
343
|
+
*/
|
|
323
344
|
async retrieveOutboundMessages(agentAccountId) {
|
|
324
345
|
try {
|
|
325
346
|
const topicInfo = await this.retrieveCommunicationTopics(agentAccountId);
|
|
@@ -338,6 +359,12 @@ class HCS10BaseClient extends Registration {
|
|
|
338
359
|
return [];
|
|
339
360
|
}
|
|
340
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Checks if a connection has been created for an agent
|
|
364
|
+
* @param agentAccountId The account ID of the agent
|
|
365
|
+
* @param connectionId The ID of the connection
|
|
366
|
+
* @returns True if the connection has been created, false otherwise
|
|
367
|
+
*/
|
|
341
368
|
async hasConnectionCreated(agentAccountId, connectionId) {
|
|
342
369
|
try {
|
|
343
370
|
const outBoundTopic = await this.retrieveCommunicationTopics(
|
|
@@ -385,6 +412,65 @@ class HCS10BaseClient extends Registration {
|
|
|
385
412
|
);
|
|
386
413
|
}
|
|
387
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* Submits a connection request to an inbound topic
|
|
417
|
+
* @param inboundTopicId The ID of the inbound topic
|
|
418
|
+
* @param memo An optional memo for the message
|
|
419
|
+
* @returns The transaction receipt
|
|
420
|
+
*/
|
|
421
|
+
async submitConnectionRequest(inboundTopicId, memo) {
|
|
422
|
+
const accountResponse = this.getAccountAndSigner();
|
|
423
|
+
if (!accountResponse.accountId) {
|
|
424
|
+
throw new Error("Operator account ID is not set");
|
|
425
|
+
}
|
|
426
|
+
const operatorId = await this.getOperatorId();
|
|
427
|
+
const accountId = accountResponse.accountId;
|
|
428
|
+
const submissionCheck = await this.canSubmitToTopic(
|
|
429
|
+
inboundTopicId,
|
|
430
|
+
accountId
|
|
431
|
+
);
|
|
432
|
+
if (!submissionCheck.canSubmit) {
|
|
433
|
+
throw new Error(`Cannot submit to topic: ${submissionCheck.reason}`);
|
|
434
|
+
}
|
|
435
|
+
const inboundAccountOwner = await this.retrieveInboundAccountId(
|
|
436
|
+
inboundTopicId
|
|
437
|
+
);
|
|
438
|
+
if (!inboundAccountOwner) {
|
|
439
|
+
throw new Error("Failed to retrieve topic info account ID");
|
|
440
|
+
}
|
|
441
|
+
const connectionRequestMessage = {
|
|
442
|
+
p: "hcs-10",
|
|
443
|
+
op: "connection_request",
|
|
444
|
+
operator_id: operatorId,
|
|
445
|
+
m: memo
|
|
446
|
+
};
|
|
447
|
+
const requiresFee = submissionCheck.requiresFee;
|
|
448
|
+
const response = await this.submitPayload(
|
|
449
|
+
inboundTopicId,
|
|
450
|
+
connectionRequestMessage,
|
|
451
|
+
void 0,
|
|
452
|
+
requiresFee
|
|
453
|
+
);
|
|
454
|
+
this.logger.info(
|
|
455
|
+
`Submitted connection request to topic ID: ${inboundTopicId}`
|
|
456
|
+
);
|
|
457
|
+
const outboundTopic = await this.retrieveCommunicationTopics(accountId);
|
|
458
|
+
if (!outboundTopic) {
|
|
459
|
+
throw new Error("Failed to retrieve outbound topic");
|
|
460
|
+
}
|
|
461
|
+
const responseSequenceNumber = response.topicSequenceNumber?.toNumber();
|
|
462
|
+
if (!responseSequenceNumber) {
|
|
463
|
+
throw new Error("Failed to get response sequence number");
|
|
464
|
+
}
|
|
465
|
+
const requestorOperatorId = `${inboundTopicId}@${inboundAccountOwner}`;
|
|
466
|
+
await this.submitPayload(outboundTopic.outboundTopic, {
|
|
467
|
+
...connectionRequestMessage,
|
|
468
|
+
outbound_topic_id: outboundTopic.outboundTopic,
|
|
469
|
+
connection_request_id: responseSequenceNumber,
|
|
470
|
+
operator_id: requestorOperatorId
|
|
471
|
+
});
|
|
472
|
+
return response;
|
|
473
|
+
}
|
|
388
474
|
/**
|
|
389
475
|
* Records an outbound connection confirmation
|
|
390
476
|
* @param outboundTopicId The ID of the outbound topic
|
|
@@ -416,6 +502,11 @@ class HCS10BaseClient extends Registration {
|
|
|
416
502
|
};
|
|
417
503
|
return await this.submitPayload(outboundTopicId, payload);
|
|
418
504
|
}
|
|
505
|
+
/**
|
|
506
|
+
* Retrieves the operator ID for the current agent
|
|
507
|
+
* @param disableCache Whether to disable caching of the result
|
|
508
|
+
* @returns The operator ID
|
|
509
|
+
*/
|
|
419
510
|
async getOperatorId(disableCache) {
|
|
420
511
|
if (this.operatorId && !disableCache) {
|
|
421
512
|
return this.operatorId;
|
|
@@ -432,6 +523,24 @@ class HCS10BaseClient extends Registration {
|
|
|
432
523
|
this.operatorId = operatorId;
|
|
433
524
|
return operatorId;
|
|
434
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Retrieves the account ID of the owner of an inbound topic
|
|
528
|
+
* @param inboundTopicId The ID of the inbound topic
|
|
529
|
+
* @returns The account ID of the owner of the inbound topic
|
|
530
|
+
*/
|
|
531
|
+
async retrieveInboundAccountId(inboundTopicId) {
|
|
532
|
+
const topicInfo = await this.mirrorNode.getTopicInfo(inboundTopicId);
|
|
533
|
+
if (!topicInfo?.memo) {
|
|
534
|
+
throw new Error("Failed to retrieve topic info");
|
|
535
|
+
}
|
|
536
|
+
const topicInfoMemo = topicInfo.memo.toString();
|
|
537
|
+
const topicInfoParts = topicInfoMemo.split(":");
|
|
538
|
+
const inboundAccountOwner = topicInfoParts?.[4];
|
|
539
|
+
if (!inboundAccountOwner) {
|
|
540
|
+
throw new Error("Failed to retrieve topic info account ID");
|
|
541
|
+
}
|
|
542
|
+
return inboundAccountOwner;
|
|
543
|
+
}
|
|
435
544
|
clearCache() {
|
|
436
545
|
HCS10Cache.getInstance().clear();
|
|
437
546
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es5.js","sources":["../../src/hcs-10/base-client.ts"],"sourcesContent":["import { Logger, LogLevel } from '../utils/logger';\nimport { Registration } from './registrations';\nimport { HCS11Client } from '../hcs-11/client';\nimport { AccountResponse, TopicResponse } from '../services/types';\nimport { TopicInfo } from '../services/types';\nimport { TransactionReceipt, PrivateKey, PublicKey } from '@hashgraph/sdk';\nimport axios from 'axios';\nimport { NetworkType } from '../utils/types';\nimport { HederaMirrorNode } from '../services';\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 public extractTopicFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 0) {\n return parts[0];\n }\n return '';\n }\n\n public extractAccountFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 1) {\n return parts[1];\n }\n return '';\n }\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 * Public method to retrieve topic information using the internal mirror node client.\n *\n * @param topicId The ID of the topic to query.\n * @returns Topic information or null if not found or an error occurs.\n */\n async getPublicTopicInfo(topicId: string): Promise<TopicResponse | null> {\n try {\n return await this.mirrorNode.getTopicInfo(topicId);\n } catch (error) {\n this.logger.error(\n `Error getting public topic info for ${topicId}:`,\n error\n );\n return null;\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(\n accountId: string,\n disableCache?: boolean\n ): Promise<ProfileResponse> {\n this.logger.info(`Retrieving profile for account: ${accountId}`);\n\n const cacheKey = `${accountId}-${this.network}`;\n\n if (!disableCache) {\n const cachedProfileResponse = HCS10Cache.getInstance().get(cacheKey);\n if (cachedProfileResponse) {\n this.logger.info(`Cache hit for profile: ${accountId}`);\n return cachedProfileResponse;\n }\n }\n\n this.logger.info(\n `Cache miss for profile: ${accountId}, fetching from network`\n );\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: TopicInfo | null = 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\n const responseToCache: ProfileResponse = {\n profile,\n topicInfo,\n success: true,\n };\n HCS10Cache.getInstance().set(cacheKey, responseToCache);\n return responseToCache;\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 /**\n * @deprecated Use retrieveCommunicationTopics instead\n * @param accountId The account ID to retrieve the outbound connect topic for\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveOutboundConnectTopic(\n accountId: string\n ): Promise<TopicInfo> {\n return await this.retrieveCommunicationTopics(accountId, true);\n }\n\n /**\n * Retrieves the communication topics for an account\n * @param accountId The account ID to retrieve the communication topics for\n * @param disableCache Whether to disable caching of the result\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveCommunicationTopics(\n accountId: string,\n disableCache?: boolean\n ): Promise<TopicInfo> {\n this.logger.info(`Retrieving topics for account: ${accountId}`);\n const cacheKey = `${accountId}-${this.network}`;\n\n try {\n const profileResponse = await this.retrieveProfile(\n accountId,\n disableCache\n );\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 if (!profileResponse.topicInfo) {\n throw new Error(\n `TopicInfo is missing in the profile for account ${accountId}`\n );\n }\n\n return profileResponse.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.retrieveCommunicationTopics(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.retrieveCommunicationTopics(\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 original message sender.\n * @param memo An optional memo for the message\n */\n public async recordOutboundConnectionConfirmation({\n outboundTopicId,\n requestorOutboundTopicId,\n connectionRequestId,\n confirmedRequestId,\n connectionTopicId,\n operatorId,\n memo,\n }: {\n outboundTopicId: string;\n requestorOutboundTopicId: 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 requestor_outbound_topic_id: requestorOutboundTopicId,\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, ProfileResponse>;\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: ProfileResponse): void {\n this.cache.set(key, value);\n this.cacheExpiry.set(key, Date.now() + this.CACHE_TTL);\n }\n\n get(key: string): ProfileResponse | 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":";;;;;;;;AAUY,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,aAAa;AAAA,EAAA;AAAA,EAYhC,2BAA2B,YAA4B;AAC5D,QAAI,CAAC,YAAY;AACR,aAAA;AAAA,IAAA;AAEH,UAAA,QAAQ,WAAW,MAAM,GAAG;AAC9B,QAAA,MAAM,SAAS,GAAG;AACpB,aAAO,MAAM,CAAC;AAAA,IAAA;AAET,WAAA;AAAA,EAAA;AAAA,EAGF,6BAA6B,YAA4B;AAC9D,QAAI,CAAC,YAAY;AACR,aAAA;AAAA,IAAA;AAEH,UAAA,QAAQ,WAAW,MAAM,GAAG;AAC9B,QAAA,MAAM,SAAS,GAAG;AACpB,aAAO,MAAM,CAAC;AAAA,IAAA;AAET,WAAA;AAAA,EAAA;AAA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0B;AAC3B,QAAA,CAAC,WAAW,UAAU;AACb,iBAAA,WAAW,IAAI,WAAW;AAAA,IAAA;AAEvC,WAAO,WAAW;AAAA,EAAA;AAAA,EAGpB,IAAI,KAAa,OAA8B;AACxC,SAAA,MAAM,IAAI,KAAK,KAAK;AACzB,SAAK,YAAY,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,SAAS;AAAA,EAAA;AAAA,EAGvD,IAAI,KAA0C;AAC5C,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.es5.js","sources":["../../src/hcs-10/base-client.ts"],"sourcesContent":["import { Logger, LogLevel } from '../utils/logger';\nimport { Registration } from './registrations';\nimport { HCS11Client } from '../hcs-11/client';\nimport { AccountResponse, TopicResponse } from '../services/types';\nimport { TopicInfo } from '../services/types';\nimport { TransactionReceipt, PrivateKey, PublicKey } from '@hashgraph/sdk';\nimport axios from 'axios';\nimport { NetworkType } from '../utils/types';\nimport { HederaMirrorNode } from '../services';\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 public extractTopicFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 0) {\n return parts[0];\n }\n return '';\n }\n\n public extractAccountFromOperatorId(operatorId: string): string {\n if (!operatorId) {\n return '';\n }\n const parts = operatorId.split('@');\n if (parts.length > 1) {\n return parts[1];\n }\n return '';\n }\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 * Public method to retrieve topic information using the internal mirror node client.\n *\n * @param topicId The ID of the topic to query.\n * @returns Topic information or null if not found or an error occurs.\n */\n async getPublicTopicInfo(topicId: string): Promise<TopicResponse | null> {\n try {\n return await this.mirrorNode.getTopicInfo(topicId);\n } catch (error) {\n this.logger.error(\n `Error getting public topic info for ${topicId}:`,\n error\n );\n return null;\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 /**\n * Requests an account from the mirror node\n * @param account The account ID to request\n * @returns The account response\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 /**\n * Retrieves the memo for an account\n * @param accountId The account ID to retrieve the memo for\n * @returns The memo\n */\n public async getAccountMemo(accountId: string): Promise<string | null> {\n return await this.mirrorNode.getAccountMemo(accountId);\n }\n\n /**\n * Retrieves the profile for an account\n * @param accountId The account ID to retrieve the profile for\n * @param disableCache Whether to disable caching of the result\n * @returns The profile\n */\n public async retrieveProfile(\n accountId: string,\n disableCache?: boolean\n ): Promise<ProfileResponse> {\n this.logger.info(`Retrieving profile for account: ${accountId}`);\n\n const cacheKey = `${accountId}-${this.network}`;\n\n if (!disableCache) {\n const cachedProfileResponse = HCS10Cache.getInstance().get(cacheKey);\n if (cachedProfileResponse) {\n this.logger.info(`Cache hit for profile: ${accountId}`);\n return cachedProfileResponse;\n }\n }\n\n this.logger.info(\n `Cache miss for profile: ${accountId}, fetching from network`\n );\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: TopicInfo | null = 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\n const responseToCache: ProfileResponse = {\n profile,\n topicInfo,\n success: true,\n };\n HCS10Cache.getInstance().set(cacheKey, responseToCache);\n return responseToCache;\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 /**\n * @deprecated Use retrieveCommunicationTopics instead\n * @param accountId The account ID to retrieve the outbound connect topic for\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveOutboundConnectTopic(\n accountId: string\n ): Promise<TopicInfo> {\n return await this.retrieveCommunicationTopics(accountId, true);\n }\n\n /**\n * Retrieves the communication topics for an account\n * @param accountId The account ID to retrieve the communication topics for\n * @param disableCache Whether to disable caching of the result\n * @returns {TopicInfo} Topic Info from target profile.\n */\n public async retrieveCommunicationTopics(\n accountId: string,\n disableCache?: boolean\n ): Promise<TopicInfo> {\n this.logger.info(`Retrieving topics for account: ${accountId}`);\n const cacheKey = `${accountId}-${this.network}`;\n\n try {\n const profileResponse = await this.retrieveProfile(\n accountId,\n disableCache\n );\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 if (!profileResponse.topicInfo) {\n throw new Error(\n `TopicInfo is missing in the profile for account ${accountId}`\n );\n }\n\n return profileResponse.topicInfo;\n } catch (error) {\n this.logger.error('Failed to retrieve topic info:', error);\n throw error;\n }\n }\n\n /**\n * Retrieves outbound messages for an agent\n * @param agentAccountId The account ID of the agent\n * @returns The outbound messages\n */\n public async retrieveOutboundMessages(\n agentAccountId: string\n ): Promise<HCSMessage[]> {\n try {\n const topicInfo = await this.retrieveCommunicationTopics(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 /**\n * Checks if a connection has been created for an agent\n * @param agentAccountId The account ID of the agent\n * @param connectionId The ID of the connection\n * @returns True if the connection has been created, false otherwise\n */\n public async hasConnectionCreated(\n agentAccountId: string,\n connectionId: number\n ): Promise<boolean> {\n try {\n const outBoundTopic = await this.retrieveCommunicationTopics(\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 * Submits a connection request to an inbound topic\n * @param inboundTopicId The ID of the inbound topic\n * @param memo An optional memo for the message\n * @returns The transaction receipt\n */\n async submitConnectionRequest(\n inboundTopicId: string,\n memo: string\n ): Promise<TransactionReceipt> {\n const accountResponse = this.getAccountAndSigner();\n if (!accountResponse.accountId) {\n throw new Error('Operator account ID is not set');\n }\n const operatorId = await this.getOperatorId();\n const accountId = accountResponse.accountId;\n\n const submissionCheck = await this.canSubmitToTopic(\n inboundTopicId,\n accountId\n );\n\n if (!submissionCheck.canSubmit) {\n throw new Error(`Cannot submit to topic: ${submissionCheck.reason}`);\n }\n\n const inboundAccountOwner = await this.retrieveInboundAccountId(\n inboundTopicId\n );\n\n if (!inboundAccountOwner) {\n throw new Error('Failed to retrieve topic info account ID');\n }\n\n const connectionRequestMessage = {\n p: 'hcs-10',\n op: 'connection_request',\n operator_id: operatorId,\n m: memo,\n };\n\n const requiresFee = submissionCheck.requiresFee;\n const response = await this.submitPayload(\n inboundTopicId,\n connectionRequestMessage,\n undefined,\n requiresFee\n );\n\n this.logger.info(\n `Submitted connection request to topic ID: ${inboundTopicId}`\n );\n\n const outboundTopic = await this.retrieveCommunicationTopics(accountId);\n\n if (!outboundTopic) {\n throw new Error('Failed to retrieve outbound topic');\n }\n\n const responseSequenceNumber = response.topicSequenceNumber?.toNumber();\n\n if (!responseSequenceNumber) {\n throw new Error('Failed to get response sequence number');\n }\n\n const requestorOperatorId = `${inboundTopicId}@${inboundAccountOwner}`;\n\n await this.submitPayload(outboundTopic.outboundTopic, {\n ...connectionRequestMessage,\n outbound_topic_id: outboundTopic.outboundTopic,\n connection_request_id: responseSequenceNumber,\n operator_id: requestorOperatorId,\n });\n\n return response;\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 original message sender.\n * @param memo An optional memo for the message\n */\n public async recordOutboundConnectionConfirmation({\n outboundTopicId,\n requestorOutboundTopicId,\n connectionRequestId,\n confirmedRequestId,\n connectionTopicId,\n operatorId,\n memo,\n }: {\n outboundTopicId: string;\n requestorOutboundTopicId: 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 requestor_outbound_topic_id: requestorOutboundTopicId,\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 /**\n * Retrieves the operator ID for the current agent\n * @param disableCache Whether to disable caching of the result\n * @returns The operator ID\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 /**\n * Retrieves the account ID of the owner of an inbound topic\n * @param inboundTopicId The ID of the inbound topic\n * @returns The account ID of the owner of the inbound topic\n */\n public async retrieveInboundAccountId(\n inboundTopicId: string\n ): Promise<string> {\n const topicInfo = await this.mirrorNode.getTopicInfo(inboundTopicId);\n\n if (!topicInfo?.memo) {\n throw new Error('Failed to retrieve topic info');\n }\n\n const topicInfoMemo = topicInfo.memo.toString();\n const topicInfoParts = topicInfoMemo.split(':');\n const inboundAccountOwner = topicInfoParts?.[4];\n\n if (!inboundAccountOwner) {\n throw new Error('Failed to retrieve topic info account ID');\n }\n\n return inboundAccountOwner;\n }\n\n public 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, ProfileResponse>;\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: ProfileResponse): void {\n this.cache.set(key, value);\n this.cacheExpiry.set(key, Date.now() + this.CACHE_TTL);\n }\n\n get(key: string): ProfileResponse | 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":";;;;;;;;AAUY,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,aAAa;AAAA,EAAA;AAAA,EAYhC,2BAA2B,YAA4B;AAC5D,QAAI,CAAC,YAAY;AACR,aAAA;AAAA,IAAA;AAEH,UAAA,QAAQ,WAAW,MAAM,GAAG;AAC9B,QAAA,MAAM,SAAS,GAAG;AACpB,aAAO,MAAM,CAAC;AAAA,IAAA;AAET,WAAA;AAAA,EAAA;AAAA,EAGF,6BAA6B,YAA4B;AAC9D,QAAI,CAAC,YAAY;AACR,aAAA;AAAA,IAAA;AAEH,UAAA,QAAQ,WAAW,MAAM,GAAG;AAC9B,QAAA,MAAM,SAAS,GAAG;AACpB,aAAO,MAAM,CAAC;AAAA,IAAA;AAET,WAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQT,MAAa,iBACX,SACqC;AACjC,QAAA;AACF,YAAM,WAAW,MAAM,KAAK,WAAW,iBAAiB,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
-
return header && String(header).trim().toLowerCase();
|
|
1
|
+
import utils from "./standards-sdk.es37.js";
|
|
2
|
+
function isAxiosError(payload) {
|
|
3
|
+
return utils.isObject(payload) && payload.isAxiosError === true;
|
|
6
4
|
}
|
|
7
|
-
function normalizeValue(value) {
|
|
8
|
-
if (value === false || value == null) {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
return utils.isArray(value) ? value.map(normalizeValue) : String(value);
|
|
12
|
-
}
|
|
13
|
-
function parseTokens(str) {
|
|
14
|
-
const tokens = /* @__PURE__ */ Object.create(null);
|
|
15
|
-
const tokensRE = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;
|
|
16
|
-
let match;
|
|
17
|
-
while (match = tokensRE.exec(str)) {
|
|
18
|
-
tokens[match[1]] = match[2];
|
|
19
|
-
}
|
|
20
|
-
return tokens;
|
|
21
|
-
}
|
|
22
|
-
const isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());
|
|
23
|
-
function matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {
|
|
24
|
-
if (utils.isFunction(filter)) {
|
|
25
|
-
return filter.call(this, value, header);
|
|
26
|
-
}
|
|
27
|
-
if (isHeaderNameFilter) {
|
|
28
|
-
value = header;
|
|
29
|
-
}
|
|
30
|
-
if (!utils.isString(value)) return;
|
|
31
|
-
if (utils.isString(filter)) {
|
|
32
|
-
return value.indexOf(filter) !== -1;
|
|
33
|
-
}
|
|
34
|
-
if (utils.isRegExp(filter)) {
|
|
35
|
-
return filter.test(value);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function formatHeader(header) {
|
|
39
|
-
return header.trim().toLowerCase().replace(/([a-z\d])(\w*)/g, (w, char, str) => {
|
|
40
|
-
return char.toUpperCase() + str;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
function buildAccessors(obj, header) {
|
|
44
|
-
const accessorName = utils.toCamelCase(" " + header);
|
|
45
|
-
["get", "set", "has"].forEach((methodName) => {
|
|
46
|
-
Object.defineProperty(obj, methodName + accessorName, {
|
|
47
|
-
value: function(arg1, arg2, arg3) {
|
|
48
|
-
return this[methodName].call(this, header, arg1, arg2, arg3);
|
|
49
|
-
},
|
|
50
|
-
configurable: true
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
class AxiosHeaders {
|
|
55
|
-
constructor(headers) {
|
|
56
|
-
headers && this.set(headers);
|
|
57
|
-
}
|
|
58
|
-
set(header, valueOrRewrite, rewrite) {
|
|
59
|
-
const self = this;
|
|
60
|
-
function setHeader(_value, _header, _rewrite) {
|
|
61
|
-
const lHeader = normalizeHeader(_header);
|
|
62
|
-
if (!lHeader) {
|
|
63
|
-
throw new Error("header name must be a non-empty string");
|
|
64
|
-
}
|
|
65
|
-
const key = utils.findKey(self, lHeader);
|
|
66
|
-
if (!key || self[key] === void 0 || _rewrite === true || _rewrite === void 0 && self[key] !== false) {
|
|
67
|
-
self[key || _header] = normalizeValue(_value);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const setHeaders = (headers, _rewrite) => utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));
|
|
71
|
-
if (utils.isPlainObject(header) || header instanceof this.constructor) {
|
|
72
|
-
setHeaders(header, valueOrRewrite);
|
|
73
|
-
} else if (utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {
|
|
74
|
-
setHeaders(parseHeaders(header), valueOrRewrite);
|
|
75
|
-
} else if (utils.isHeaders(header)) {
|
|
76
|
-
for (const [key, value] of header.entries()) {
|
|
77
|
-
setHeader(value, key, rewrite);
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
header != null && setHeader(valueOrRewrite, header, rewrite);
|
|
81
|
-
}
|
|
82
|
-
return this;
|
|
83
|
-
}
|
|
84
|
-
get(header, parser) {
|
|
85
|
-
header = normalizeHeader(header);
|
|
86
|
-
if (header) {
|
|
87
|
-
const key = utils.findKey(this, header);
|
|
88
|
-
if (key) {
|
|
89
|
-
const value = this[key];
|
|
90
|
-
if (!parser) {
|
|
91
|
-
return value;
|
|
92
|
-
}
|
|
93
|
-
if (parser === true) {
|
|
94
|
-
return parseTokens(value);
|
|
95
|
-
}
|
|
96
|
-
if (utils.isFunction(parser)) {
|
|
97
|
-
return parser.call(this, value, key);
|
|
98
|
-
}
|
|
99
|
-
if (utils.isRegExp(parser)) {
|
|
100
|
-
return parser.exec(value);
|
|
101
|
-
}
|
|
102
|
-
throw new TypeError("parser must be boolean|regexp|function");
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
has(header, matcher) {
|
|
107
|
-
header = normalizeHeader(header);
|
|
108
|
-
if (header) {
|
|
109
|
-
const key = utils.findKey(this, header);
|
|
110
|
-
return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
|
|
111
|
-
}
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
delete(header, matcher) {
|
|
115
|
-
const self = this;
|
|
116
|
-
let deleted = false;
|
|
117
|
-
function deleteHeader(_header) {
|
|
118
|
-
_header = normalizeHeader(_header);
|
|
119
|
-
if (_header) {
|
|
120
|
-
const key = utils.findKey(self, _header);
|
|
121
|
-
if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {
|
|
122
|
-
delete self[key];
|
|
123
|
-
deleted = true;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (utils.isArray(header)) {
|
|
128
|
-
header.forEach(deleteHeader);
|
|
129
|
-
} else {
|
|
130
|
-
deleteHeader(header);
|
|
131
|
-
}
|
|
132
|
-
return deleted;
|
|
133
|
-
}
|
|
134
|
-
clear(matcher) {
|
|
135
|
-
const keys = Object.keys(this);
|
|
136
|
-
let i = keys.length;
|
|
137
|
-
let deleted = false;
|
|
138
|
-
while (i--) {
|
|
139
|
-
const key = keys[i];
|
|
140
|
-
if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
|
|
141
|
-
delete this[key];
|
|
142
|
-
deleted = true;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return deleted;
|
|
146
|
-
}
|
|
147
|
-
normalize(format) {
|
|
148
|
-
const self = this;
|
|
149
|
-
const headers = {};
|
|
150
|
-
utils.forEach(this, (value, header) => {
|
|
151
|
-
const key = utils.findKey(headers, header);
|
|
152
|
-
if (key) {
|
|
153
|
-
self[key] = normalizeValue(value);
|
|
154
|
-
delete self[header];
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const normalized = format ? formatHeader(header) : String(header).trim();
|
|
158
|
-
if (normalized !== header) {
|
|
159
|
-
delete self[header];
|
|
160
|
-
}
|
|
161
|
-
self[normalized] = normalizeValue(value);
|
|
162
|
-
headers[normalized] = true;
|
|
163
|
-
});
|
|
164
|
-
return this;
|
|
165
|
-
}
|
|
166
|
-
concat(...targets) {
|
|
167
|
-
return this.constructor.concat(this, ...targets);
|
|
168
|
-
}
|
|
169
|
-
toJSON(asStrings) {
|
|
170
|
-
const obj = /* @__PURE__ */ Object.create(null);
|
|
171
|
-
utils.forEach(this, (value, header) => {
|
|
172
|
-
value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(", ") : value);
|
|
173
|
-
});
|
|
174
|
-
return obj;
|
|
175
|
-
}
|
|
176
|
-
[Symbol.iterator]() {
|
|
177
|
-
return Object.entries(this.toJSON())[Symbol.iterator]();
|
|
178
|
-
}
|
|
179
|
-
toString() {
|
|
180
|
-
return Object.entries(this.toJSON()).map(([header, value]) => header + ": " + value).join("\n");
|
|
181
|
-
}
|
|
182
|
-
get [Symbol.toStringTag]() {
|
|
183
|
-
return "AxiosHeaders";
|
|
184
|
-
}
|
|
185
|
-
static from(thing) {
|
|
186
|
-
return thing instanceof this ? thing : new this(thing);
|
|
187
|
-
}
|
|
188
|
-
static concat(first, ...targets) {
|
|
189
|
-
const computed = new this(first);
|
|
190
|
-
targets.forEach((target) => computed.set(target));
|
|
191
|
-
return computed;
|
|
192
|
-
}
|
|
193
|
-
static accessor(header) {
|
|
194
|
-
const internals = this[$internals] = this[$internals] = {
|
|
195
|
-
accessors: {}
|
|
196
|
-
};
|
|
197
|
-
const accessors = internals.accessors;
|
|
198
|
-
const prototype = this.prototype;
|
|
199
|
-
function defineAccessor(_header) {
|
|
200
|
-
const lHeader = normalizeHeader(_header);
|
|
201
|
-
if (!accessors[lHeader]) {
|
|
202
|
-
buildAccessors(prototype, _header);
|
|
203
|
-
accessors[lHeader] = true;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);
|
|
207
|
-
return this;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
AxiosHeaders.accessor(["Content-Type", "Content-Length", "Accept", "Accept-Encoding", "User-Agent", "Authorization"]);
|
|
211
|
-
utils.reduceDescriptors(AxiosHeaders.prototype, ({ value }, key) => {
|
|
212
|
-
let mapped = key[0].toUpperCase() + key.slice(1);
|
|
213
|
-
return {
|
|
214
|
-
get: () => value,
|
|
215
|
-
set(headerValue) {
|
|
216
|
-
this[mapped] = headerValue;
|
|
217
|
-
}
|
|
218
|
-
};
|
|
219
|
-
});
|
|
220
|
-
utils.freezeMethods(AxiosHeaders);
|
|
221
5
|
export {
|
|
222
|
-
|
|
6
|
+
isAxiosError as default
|
|
223
7
|
};
|
|
224
8
|
//# sourceMappingURL=standards-sdk.es50.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es50.js","sources":["../../node_modules/axios/lib/core/AxiosHeaders.js"],"sourcesContent":["'use strict';\n\nimport utils from '../utils.js';\nimport parseHeaders from '../helpers/parseHeaders.js';\n\nconst $internals = Symbol('internals');\n\nfunction normalizeHeader(header) {\n return header && String(header).trim().toLowerCase();\n}\n\nfunction normalizeValue(value) {\n if (value === false || value == null) {\n return value;\n }\n\n return utils.isArray(value) ? value.map(normalizeValue) : String(value);\n}\n\nfunction parseTokens(str) {\n const tokens = Object.create(null);\n const tokensRE = /([^\\s,;=]+)\\s*(?:=\\s*([^,;]+))?/g;\n let match;\n\n while ((match = tokensRE.exec(str))) {\n tokens[match[1]] = match[2];\n }\n\n return tokens;\n}\n\nconst isValidHeaderName = (str) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(str.trim());\n\nfunction matchHeaderValue(context, value, header, filter, isHeaderNameFilter) {\n if (utils.isFunction(filter)) {\n return filter.call(this, value, header);\n }\n\n if (isHeaderNameFilter) {\n value = header;\n }\n\n if (!utils.isString(value)) return;\n\n if (utils.isString(filter)) {\n return value.indexOf(filter) !== -1;\n }\n\n if (utils.isRegExp(filter)) {\n return filter.test(value);\n }\n}\n\nfunction formatHeader(header) {\n return header.trim()\n .toLowerCase().replace(/([a-z\\d])(\\w*)/g, (w, char, str) => {\n return char.toUpperCase() + str;\n });\n}\n\nfunction buildAccessors(obj, header) {\n const accessorName = utils.toCamelCase(' ' + header);\n\n ['get', 'set', 'has'].forEach(methodName => {\n Object.defineProperty(obj, methodName + accessorName, {\n value: function(arg1, arg2, arg3) {\n return this[methodName].call(this, header, arg1, arg2, arg3);\n },\n configurable: true\n });\n });\n}\n\nclass AxiosHeaders {\n constructor(headers) {\n headers && this.set(headers);\n }\n\n set(header, valueOrRewrite, rewrite) {\n const self = this;\n\n function setHeader(_value, _header, _rewrite) {\n const lHeader = normalizeHeader(_header);\n\n if (!lHeader) {\n throw new Error('header name must be a non-empty string');\n }\n\n const key = utils.findKey(self, lHeader);\n\n if(!key || self[key] === undefined || _rewrite === true || (_rewrite === undefined && self[key] !== false)) {\n self[key || _header] = normalizeValue(_value);\n }\n }\n\n const setHeaders = (headers, _rewrite) =>\n utils.forEach(headers, (_value, _header) => setHeader(_value, _header, _rewrite));\n\n if (utils.isPlainObject(header) || header instanceof this.constructor) {\n setHeaders(header, valueOrRewrite)\n } else if(utils.isString(header) && (header = header.trim()) && !isValidHeaderName(header)) {\n setHeaders(parseHeaders(header), valueOrRewrite);\n } else if (utils.isHeaders(header)) {\n for (const [key, value] of header.entries()) {\n setHeader(value, key, rewrite);\n }\n } else {\n header != null && setHeader(valueOrRewrite, header, rewrite);\n }\n\n return this;\n }\n\n get(header, parser) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n if (key) {\n const value = this[key];\n\n if (!parser) {\n return value;\n }\n\n if (parser === true) {\n return parseTokens(value);\n }\n\n if (utils.isFunction(parser)) {\n return parser.call(this, value, key);\n }\n\n if (utils.isRegExp(parser)) {\n return parser.exec(value);\n }\n\n throw new TypeError('parser must be boolean|regexp|function');\n }\n }\n }\n\n has(header, matcher) {\n header = normalizeHeader(header);\n\n if (header) {\n const key = utils.findKey(this, header);\n\n return !!(key && this[key] !== undefined && (!matcher || matchHeaderValue(this, this[key], key, matcher)));\n }\n\n return false;\n }\n\n delete(header, matcher) {\n const self = this;\n let deleted = false;\n\n function deleteHeader(_header) {\n _header = normalizeHeader(_header);\n\n if (_header) {\n const key = utils.findKey(self, _header);\n\n if (key && (!matcher || matchHeaderValue(self, self[key], key, matcher))) {\n delete self[key];\n\n deleted = true;\n }\n }\n }\n\n if (utils.isArray(header)) {\n header.forEach(deleteHeader);\n } else {\n deleteHeader(header);\n }\n\n return deleted;\n }\n\n clear(matcher) {\n const keys = Object.keys(this);\n let i = keys.length;\n let deleted = false;\n\n while (i--) {\n const key = keys[i];\n if(!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {\n delete this[key];\n deleted = true;\n }\n }\n\n return deleted;\n }\n\n normalize(format) {\n const self = this;\n const headers = {};\n\n utils.forEach(this, (value, header) => {\n const key = utils.findKey(headers, header);\n\n if (key) {\n self[key] = normalizeValue(value);\n delete self[header];\n return;\n }\n\n const normalized = format ? formatHeader(header) : String(header).trim();\n\n if (normalized !== header) {\n delete self[header];\n }\n\n self[normalized] = normalizeValue(value);\n\n headers[normalized] = true;\n });\n\n return this;\n }\n\n concat(...targets) {\n return this.constructor.concat(this, ...targets);\n }\n\n toJSON(asStrings) {\n const obj = Object.create(null);\n\n utils.forEach(this, (value, header) => {\n value != null && value !== false && (obj[header] = asStrings && utils.isArray(value) ? value.join(', ') : value);\n });\n\n return obj;\n }\n\n [Symbol.iterator]() {\n return Object.entries(this.toJSON())[Symbol.iterator]();\n }\n\n toString() {\n return Object.entries(this.toJSON()).map(([header, value]) => header + ': ' + value).join('\\n');\n }\n\n get [Symbol.toStringTag]() {\n return 'AxiosHeaders';\n }\n\n static from(thing) {\n return thing instanceof this ? thing : new this(thing);\n }\n\n static concat(first, ...targets) {\n const computed = new this(first);\n\n targets.forEach((target) => computed.set(target));\n\n return computed;\n }\n\n static accessor(header) {\n const internals = this[$internals] = (this[$internals] = {\n accessors: {}\n });\n\n const accessors = internals.accessors;\n const prototype = this.prototype;\n\n function defineAccessor(_header) {\n const lHeader = normalizeHeader(_header);\n\n if (!accessors[lHeader]) {\n buildAccessors(prototype, _header);\n accessors[lHeader] = true;\n }\n }\n\n utils.isArray(header) ? header.forEach(defineAccessor) : defineAccessor(header);\n\n return this;\n }\n}\n\nAxiosHeaders.accessor(['Content-Type', 'Content-Length', 'Accept', 'Accept-Encoding', 'User-Agent', 'Authorization']);\n\n// reserved names hotfix\nutils.reduceDescriptors(AxiosHeaders.prototype, ({value}, key) => {\n let mapped = key[0].toUpperCase() + key.slice(1); // map `set` => `Set`\n return {\n get: () => value,\n set(headerValue) {\n this[mapped] = headerValue;\n }\n }\n});\n\nutils.freezeMethods(AxiosHeaders);\n\nexport default AxiosHeaders;\n"],"names":[],"mappings":";;AAKA,MAAM,aAAa,OAAO,WAAW;AAErC,SAAS,gBAAgB,QAAQ;AAC/B,SAAO,UAAU,OAAO,MAAM,EAAE,KAAI,EAAG,YAAa;AACtD;AAEA,SAAS,eAAe,OAAO;AAC7B,MAAI,UAAU,SAAS,SAAS,MAAM;AACpC,WAAO;AAAA,EACX;AAEE,SAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,IAA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,EAClG;AAAA,EAEE,KAAK,OAAO,WAAW,IAAI;AACzB,WAAO;AAAA,EACX;AAAA,EAEE,OAAO,KAAK,OAAO;AACjB,WAAO,iBAAiB,OAAO,QAAQ,IAAI,KAAK,KAAK;AAAA,EACzD;AAAA,EAEE,OAAO,OAAO,UAAU,SAAS;AAC/B,UAAM,WAAW,IAAI,KAAK,KAAK;AAE/B,YAAQ,QAAQ,CAAC,WAAW,SAAS,IAAI,MAAM,CAAC;AAEhD,WAAO;AAAA,EACX;AAAA,EAEE,OAAO,SAAS,QAAQ;AACtB,UAAM,YAAY,KAAK,UAAU,IAAK,KAAK,UAAU,IAAI;AAAA,MACvD,WAAW,CAAA;AAAA,IACjB;AAEI,UAAM,YAAY,UAAU;AAC5B,UAAM,YAAY,KAAK;AAEvB,aAAS,eAAe,SAAS;AAC/B,YAAM,UAAU,gBAAgB,OAAO;AAEvC,UAAI,CAAC,UAAU,OAAO,GAAG;AACvB,uBAAe,WAAW,OAAO;AACjC,kBAAU,OAAO,IAAI;AAAA,MAC7B;AAAA,IACA;AAEI,UAAM,QAAQ,MAAM,IAAI,OAAO,QAAQ,cAAc,IAAI,eAAe,MAAM;AAE9E,WAAO;AAAA,EACX;AACA;AAEA,aAAa,SAAS,CAAC,gBAAgB,kBAAkB,UAAU,mBAAmB,cAAc,eAAe,CAAC;AAGpH,MAAM,kBAAkB,aAAa,WAAW,CAAC,EAAC,MAAK,GAAG,QAAQ;AAChE,MAAI,SAAS,IAAI,CAAC,EAAE,YAAW,IAAK,IAAI,MAAM,CAAC;AAC/C,SAAO;AAAA,IACL,KAAK,MAAM;AAAA,IACX,IAAI,aAAa;AACf,WAAK,MAAM,IAAI;AAAA,IACrB;AAAA,EACA;AACA,CAAC;AAED,MAAM,cAAc,YAAY;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es50.js","sources":["../../node_modules/axios/lib/helpers/isAxiosError.js"],"sourcesContent":["'use strict';\n\nimport utils from './../utils.js';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n *\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nexport default function isAxiosError(payload) {\n return utils.isObject(payload) && (payload.isAxiosError === true);\n}\n"],"names":[],"mappings":";AAWe,SAAS,aAAa,SAAS;AAC5C,SAAO,MAAM,SAAS,OAAO,KAAM,QAAQ,iBAAiB;AAC9D;","x_google_ignoreList":[0]}
|