@hashgraphonline/standards-sdk 0.1.141-feat-hcs-21-flora-adapter.canary.b569177.46 → 0.1.141-feat-hcs-21-flora-adapter.canary.053f0af.47
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/cjs/hcs-11/client.d.ts.map +1 -1
- package/dist/cjs/hcs-11/types.d.ts +1 -0
- package/dist/cjs/hcs-11/types.d.ts.map +1 -1
- package/dist/cjs/hcs-21/browser.d.ts.map +1 -1
- package/dist/cjs/hcs-21/sdk.d.ts.map +1 -1
- package/dist/cjs/hcs-21/types.d.ts +13 -10
- package/dist/cjs/hcs-21/types.d.ts.map +1 -1
- package/dist/cjs/hcs-21/verify.d.ts.map +1 -1
- package/dist/cjs/inscribe/inscriber.d.ts +2 -1
- package/dist/cjs/inscribe/inscriber.d.ts.map +1 -1
- package/dist/cjs/inscribe/types.d.ts +5 -0
- package/dist/cjs/inscribe/types.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/client.d.ts.map +1 -1
- package/dist/cjs/services/registry-broker/schemas.d.ts +14 -14
- package/dist/cjs/standards-sdk.cjs +2 -2
- package/dist/cjs/standards-sdk.cjs.map +1 -1
- package/dist/es/hcs-11/client.d.ts.map +1 -1
- package/dist/es/hcs-11/types.d.ts +1 -0
- package/dist/es/hcs-11/types.d.ts.map +1 -1
- package/dist/es/hcs-21/browser.d.ts.map +1 -1
- package/dist/es/hcs-21/sdk.d.ts.map +1 -1
- package/dist/es/hcs-21/types.d.ts +13 -10
- package/dist/es/hcs-21/types.d.ts.map +1 -1
- package/dist/es/hcs-21/verify.d.ts.map +1 -1
- package/dist/es/inscribe/inscriber.d.ts +2 -1
- package/dist/es/inscribe/inscriber.d.ts.map +1 -1
- package/dist/es/inscribe/types.d.ts +5 -0
- package/dist/es/inscribe/types.d.ts.map +1 -1
- package/dist/es/services/registry-broker/client.d.ts.map +1 -1
- package/dist/es/services/registry-broker/schemas.d.ts +14 -14
- package/dist/es/standards-sdk.es100.js +1 -1
- package/dist/es/standards-sdk.es102.js +1 -1
- package/dist/es/standards-sdk.es104.js +1 -1
- package/dist/es/standards-sdk.es110.js +1 -1
- package/dist/es/standards-sdk.es111.js +5 -5
- package/dist/es/standards-sdk.es12.js +1 -1
- package/dist/es/standards-sdk.es121.js +1 -1
- package/dist/es/standards-sdk.es122.js +1 -1
- package/dist/es/standards-sdk.es123.js +5 -5
- package/dist/es/standards-sdk.es125.js +93 -5
- package/dist/es/standards-sdk.es125.js.map +1 -1
- package/dist/es/standards-sdk.es126.js +1 -1
- package/dist/es/standards-sdk.es128.js +2 -2
- package/dist/es/standards-sdk.es128.js.map +1 -1
- package/dist/es/standards-sdk.es129.js +1 -1
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es135.js +28 -82
- package/dist/es/standards-sdk.es135.js.map +1 -1
- package/dist/es/standards-sdk.es136.js +766 -28
- package/dist/es/standards-sdk.es136.js.map +1 -1
- package/dist/es/standards-sdk.es137.js +12241 -105
- package/dist/es/standards-sdk.es137.js.map +1 -1
- package/dist/es/standards-sdk.es138.js +133 -37
- package/dist/es/standards-sdk.es138.js.map +1 -1
- package/dist/es/standards-sdk.es139.js +34 -12266
- package/dist/es/standards-sdk.es139.js.map +1 -1
- package/dist/es/standards-sdk.es140.js +56 -766
- package/dist/es/standards-sdk.es140.js.map +1 -1
- package/dist/es/standards-sdk.es141.js +80 -15
- package/dist/es/standards-sdk.es141.js.map +1 -1
- package/dist/es/standards-sdk.es142.js +13 -168
- package/dist/es/standards-sdk.es142.js.map +1 -1
- package/dist/es/standards-sdk.es143.js +139 -289
- package/dist/es/standards-sdk.es143.js.map +1 -1
- package/dist/es/standards-sdk.es144.js +274 -298
- package/dist/es/standards-sdk.es144.js.map +1 -1
- package/dist/es/standards-sdk.es145.js +262 -369
- package/dist/es/standards-sdk.es145.js.map +1 -1
- package/dist/es/standards-sdk.es146.js +316 -194
- package/dist/es/standards-sdk.es146.js.map +1 -1
- package/dist/es/standards-sdk.es147.js +319 -64
- package/dist/es/standards-sdk.es147.js.map +1 -1
- package/dist/es/standards-sdk.es148.js +69 -49
- package/dist/es/standards-sdk.es148.js.map +1 -1
- package/dist/es/standards-sdk.es17.js +1 -1
- package/dist/es/standards-sdk.es19.js +4 -4
- package/dist/es/standards-sdk.es2.js +72 -26
- package/dist/es/standards-sdk.es2.js.map +1 -1
- package/dist/es/standards-sdk.es20.js +2 -2
- package/dist/es/standards-sdk.es23.js +1 -1
- package/dist/es/standards-sdk.es28.js +8 -6
- package/dist/es/standards-sdk.es28.js.map +1 -1
- package/dist/es/standards-sdk.es29.js.map +1 -1
- package/dist/es/standards-sdk.es31.js +1 -1
- package/dist/es/standards-sdk.es32.js +1 -1
- package/dist/es/standards-sdk.es36.js +3 -2
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es37.js +3 -3
- package/dist/es/standards-sdk.es38.js +1 -1
- package/dist/es/standards-sdk.es5.js +1 -1
- package/dist/es/standards-sdk.es54.js +1 -1
- package/dist/es/standards-sdk.es57.js +1 -1
- package/dist/es/standards-sdk.es59.js +1 -1
- package/dist/es/standards-sdk.es60.js +1 -1
- package/dist/es/standards-sdk.es61.js +2 -2
- package/dist/es/standards-sdk.es63.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/dist/es/standards-sdk.es66.js +2 -2
- package/dist/es/standards-sdk.es69.js +2 -2
- package/dist/es/standards-sdk.es70.js +1 -1
- package/dist/es/standards-sdk.es72.js +1 -1
- package/dist/es/standards-sdk.es77.js +1 -1
- package/dist/es/standards-sdk.es78.js +1 -1
- package/dist/es/standards-sdk.es79.js +1 -1
- package/dist/es/standards-sdk.es8.js +1 -1
- package/dist/es/standards-sdk.es80.js +1 -1
- package/dist/es/standards-sdk.es80.js.map +1 -1
- package/dist/es/standards-sdk.es82.js +1 -1
- package/dist/es/standards-sdk.es84.js +4 -2
- package/dist/es/standards-sdk.es84.js.map +1 -1
- package/dist/es/standards-sdk.es85.js +1 -3
- package/dist/es/standards-sdk.es85.js.map +1 -1
- package/dist/es/standards-sdk.es86.js.map +1 -1
- package/dist/es/standards-sdk.es88.js +1 -1
- package/dist/es/standards-sdk.es92.js +1 -1
- package/dist/es/standards-sdk.es93.js +1 -1
- package/dist/es/standards-sdk.es98.js +1 -1
- package/package.json +1 -1
|
@@ -1,59 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { proto } from "@hashgraph/proto";
|
|
2
|
+
import { ContractId } from "@hashgraph/sdk";
|
|
3
|
+
import { Buffer } from "buffer";
|
|
4
|
+
function parseKey(key) {
|
|
5
|
+
if (!key) {
|
|
6
|
+
return void 0;
|
|
7
|
+
}
|
|
8
|
+
if (key.contractID) {
|
|
9
|
+
return `ContractID: ${new ContractId(
|
|
10
|
+
key.contractID.shardNum ?? 0,
|
|
11
|
+
key.contractID.realmNum ?? 0,
|
|
12
|
+
key.contractID.contractNum ?? 0
|
|
13
|
+
).toString()}`;
|
|
14
|
+
}
|
|
15
|
+
if (key.ed25519) {
|
|
16
|
+
return `ED25519: ${Buffer.from(key.ed25519).toString("hex")}`;
|
|
17
|
+
}
|
|
18
|
+
if (key.ECDSASecp256k1) {
|
|
19
|
+
return `ECDSA_secp256k1: ${Buffer.from(key.ECDSASecp256k1).toString(
|
|
20
|
+
"hex"
|
|
21
|
+
)}`;
|
|
22
|
+
}
|
|
23
|
+
if (key?.keyList?.keys?.length > 0) {
|
|
24
|
+
const keys = key.keyList.keys.map((k) => parseKey(k)).filter(Boolean);
|
|
25
|
+
return `KeyList (${keys.length} keys): [${keys.join(", ")}]`;
|
|
20
26
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
if (key?.thresholdKey?.keys?.keys?.length > 0) {
|
|
28
|
+
const keys = key.thresholdKey.keys.keys.map((k) => parseKey(k)).filter(Boolean);
|
|
29
|
+
return `ThresholdKey (${key.thresholdKey.threshold} of ${keys.length}): [${keys.join(", ")}]`;
|
|
30
|
+
}
|
|
31
|
+
if (key.delegatableContractId) {
|
|
32
|
+
return `DelegatableContractID: ${new ContractId(
|
|
33
|
+
key.delegatableContractId.shardNum ?? 0,
|
|
34
|
+
key.delegatableContractId.realmNum ?? 0,
|
|
35
|
+
key.delegatableContractId.contractNum ?? 0
|
|
36
|
+
).toString()}`;
|
|
37
|
+
}
|
|
38
|
+
if (Object.keys(key).length === 0) {
|
|
39
|
+
return "Empty Key Structure";
|
|
40
|
+
}
|
|
41
|
+
return "Unknown or Unset Key Type";
|
|
25
42
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
carry = x >> 8;
|
|
43
|
+
function extractTransactionBody(transaction) {
|
|
44
|
+
try {
|
|
45
|
+
const bytes = transaction.toBytes ? transaction.toBytes() : void 0;
|
|
46
|
+
if (!bytes) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const decoded = proto.TransactionList.decode(bytes);
|
|
50
|
+
if (!decoded.transactionList || decoded.transactionList.length === 0) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const tx = decoded.transactionList[0];
|
|
54
|
+
if (tx.bodyBytes && tx.bodyBytes.length > 0) {
|
|
55
|
+
return proto.TransactionBody.decode(tx.bodyBytes);
|
|
40
56
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
if (tx.signedTransactionBytes && tx.signedTransactionBytes.length > 0) {
|
|
58
|
+
const signedTx = proto.SignedTransaction.decode(
|
|
59
|
+
tx.signedTransactionBytes
|
|
60
|
+
);
|
|
61
|
+
if (signedTx.bodyBytes) {
|
|
62
|
+
return proto.TransactionBody.decode(signedTx.bodyBytes);
|
|
63
|
+
}
|
|
44
64
|
}
|
|
65
|
+
return null;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return null;
|
|
45
68
|
}
|
|
46
|
-
for (let i = 0; i < zeros; i++) b256.push(0);
|
|
47
|
-
b256.reverse();
|
|
48
|
-
return Uint8Array.from(b256);
|
|
49
69
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
return
|
|
70
|
+
function hasTransactionType(transaction, transactionField) {
|
|
71
|
+
const txBody = extractTransactionBody(transaction);
|
|
72
|
+
return !!(txBody && txBody[transactionField]);
|
|
53
73
|
}
|
|
54
74
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
75
|
+
extractTransactionBody,
|
|
76
|
+
hasTransactionType,
|
|
77
|
+
parseKey
|
|
58
78
|
};
|
|
59
79
|
//# sourceMappingURL=standards-sdk.es148.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es148.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es148.js","sources":["../../src/utils/parsers/parser-utils.ts"],"sourcesContent":["import { proto } from '@hashgraph/proto';\nimport { ContractId, Transaction } from '@hashgraph/sdk';\nimport { Buffer } from 'buffer';\n\nexport function parseKey(\n key: proto.IKey | null | undefined,\n): string | undefined {\n if (!key) {\n return undefined;\n }\n\n if (key.contractID) {\n return `ContractID: ${new ContractId(\n key.contractID.shardNum ?? 0,\n key.contractID.realmNum ?? 0,\n key.contractID.contractNum ?? 0,\n ).toString()}`;\n }\n if (key.ed25519) {\n return `ED25519: ${Buffer.from(key.ed25519).toString('hex')}`;\n }\n if (key.ECDSASecp256k1) {\n return `ECDSA_secp256k1: ${Buffer.from(key.ECDSASecp256k1).toString(\n 'hex',\n )}`;\n }\n if (key?.keyList?.keys?.length > 0) {\n const keys = key.keyList.keys.map(k => parseKey(k)).filter(Boolean);\n return `KeyList (${keys.length} keys): [${keys.join(', ')}]`;\n }\n if (key?.thresholdKey?.keys?.keys?.length > 0) {\n const keys = key.thresholdKey.keys.keys\n .map(k => parseKey(k))\n .filter(Boolean);\n return `ThresholdKey (${key.thresholdKey.threshold} of ${\n keys.length\n }): [${keys.join(', ')}]`;\n }\n if (key.delegatableContractId) {\n return `DelegatableContractID: ${new ContractId(\n key.delegatableContractId.shardNum ?? 0,\n key.delegatableContractId.realmNum ?? 0,\n key.delegatableContractId.contractNum ?? 0,\n ).toString()}`;\n }\n if (Object.keys(key).length === 0) {\n return 'Empty Key Structure';\n }\n\n return 'Unknown or Unset Key Type';\n}\n\n/**\n * Extract TransactionBody from Transaction object using protobuf parsing\n * This replaces fragile constructor name checking with reliable protobuf data\n */\nexport function extractTransactionBody(\n transaction: Transaction,\n): proto.ITransactionBody | null {\n try {\n const bytes = transaction.toBytes ? transaction.toBytes() : undefined;\n if (!bytes) {\n return null;\n }\n\n const decoded = proto.TransactionList.decode(bytes);\n if (!decoded.transactionList || decoded.transactionList.length === 0) {\n return null;\n }\n\n const tx = decoded.transactionList[0];\n\n if (tx.bodyBytes && tx.bodyBytes.length > 0) {\n return proto.TransactionBody.decode(tx.bodyBytes);\n }\n\n if (tx.signedTransactionBytes && tx.signedTransactionBytes.length > 0) {\n const signedTx = proto.SignedTransaction.decode(\n tx.signedTransactionBytes,\n );\n if (signedTx.bodyBytes) {\n return proto.TransactionBody.decode(signedTx.bodyBytes);\n }\n }\n\n return null;\n } catch (error) {\n return null;\n }\n}\n\n/**\n * Check if transaction has specific transaction type using protobuf data\n * This replaces constructor name checking with reliable protobuf field detection\n */\nexport function hasTransactionType(\n transaction: Transaction,\n transactionField: keyof proto.ITransactionBody,\n): boolean {\n const txBody = extractTransactionBody(transaction);\n return !!(txBody && txBody[transactionField]);\n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/B,MAAI;AACF,UAAM,QAAQ,YAAY,UAAU,YAAY,YAAY;AAC5D,QAAI,CAAC,OAAO;AACV,aAAO;AAAA,IACT;AAEA,UAAM,UAAU,MAAM,gBAAgB,OAAO,KAAK;AAClD,QAAI,CAAC,QAAQ,mBAAmB,QAAQ,gBAAgB,WAAW,GAAG;AACpE,aAAO;AAAA,IACT;AAEA,UAAM,KAAK,QAAQ,gBAAgB,CAAC;AAEpC,QAAI,GAAG,aAAa,GAAG,UAAU,SAAS,GAAG;AAC3C,aAAO,MAAM,gBAAgB,OAAO,GAAG,SAAS;AAAA,IAClD;AAEA,QAAI,GAAG,0BAA0B,GAAG,uBAAuB,SAAS,GAAG;AACrE,YAAM,WAAW,MAAM,kBAAkB;AAAA,QACvC,GAAG;AAAA,MAAA;AAEL,UAAI,SAAS,WAAW;AACtB,eAAO,MAAM,gBAAgB,OAAO,SAAS,SAAS;AAAA,MACxD;AAAA,IACF;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,WAAO;AAAA,EACT;AACF;AAMO,SAAS,mBACd,aACA,kBACS;AACT,QAAM,SAAS,uBAAuB,WAAW;AACjD,SAAO,CAAC,EAAE,UAAU,OAAO,gBAAgB;AAC7C;"}
|
|
@@ -8,7 +8,7 @@ import "node:buffer";
|
|
|
8
8
|
import "node:crypto";
|
|
9
9
|
import "@noble/curves/secp256k1.js";
|
|
10
10
|
import "./standards-sdk.es130.js";
|
|
11
|
-
import "./standards-sdk.
|
|
11
|
+
import "./standards-sdk.es136.js";
|
|
12
12
|
import "zod";
|
|
13
13
|
import { buildHcs10SubmitConnectionRequestTx, buildHcs10OutboundConnectionRequestRecordTx, buildHcs10OutboundConnectionCreatedRecordTx } from "./standards-sdk.es23.js";
|
|
14
14
|
import { HRLResolver } from "./standards-sdk.es110.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./standards-sdk.es2.js";
|
|
2
2
|
import { Client, PrivateKey, AccountCreateTransaction, Hbar, CustomFixedFee, AccountId, TokenId, KeyList, TopicMessageSubmitTransaction, Transaction, ScheduleCreateTransaction, Timestamp } from "@hashgraph/sdk";
|
|
3
3
|
import { AccountCreationError, TopicCreationError, ConnectionConfirmationError, PayloadSizeError } from "./standards-sdk.es18.js";
|
|
4
|
-
import { InscriptionSDK } from "./standards-sdk.
|
|
4
|
+
import { InscriptionSDK } from "./standards-sdk.es137.js";
|
|
5
5
|
import { Logger } from "./standards-sdk.es106.js";
|
|
6
6
|
import { accountIdsToExemptKeys } from "./standards-sdk.es108.js";
|
|
7
7
|
import { ProgressReporter } from "./standards-sdk.es109.js";
|
|
@@ -12,14 +12,14 @@ import "node:buffer";
|
|
|
12
12
|
import "node:crypto";
|
|
13
13
|
import "@noble/curves/secp256k1.js";
|
|
14
14
|
import "./standards-sdk.es130.js";
|
|
15
|
-
import "./standards-sdk.
|
|
15
|
+
import "./standards-sdk.es136.js";
|
|
16
16
|
import "zod";
|
|
17
17
|
import "buffer";
|
|
18
18
|
import "ethers";
|
|
19
19
|
import "./standards-sdk.es123.js";
|
|
20
20
|
import { detectKeyTypeFromString } from "./standards-sdk.es114.js";
|
|
21
21
|
import { getTopicId } from "./standards-sdk.es115.js";
|
|
22
|
-
import { createNodeOperatorContext, NodeOperatorResolver } from "./standards-sdk.
|
|
22
|
+
import { createNodeOperatorContext, NodeOperatorResolver } from "./standards-sdk.es138.js";
|
|
23
23
|
import { HCS10BaseClient, Hcs10MemoType } from "./standards-sdk.es17.js";
|
|
24
24
|
import * as mime from "mime-types";
|
|
25
25
|
import { AgentBuilder } from "./standards-sdk.es24.js";
|
|
@@ -27,7 +27,7 @@ import { InboundTopicType } from "./standards-sdk.es29.js";
|
|
|
27
27
|
import { HCS11Client } from "./standards-sdk.es28.js";
|
|
28
28
|
import { inscribe } from "./standards-sdk.es125.js";
|
|
29
29
|
import { addSeconds } from "date-fns";
|
|
30
|
-
import { buildTopicCreateTx, buildMessageTx } from "./standards-sdk.
|
|
30
|
+
import { buildTopicCreateTx, buildMessageTx } from "./standards-sdk.es139.js";
|
|
31
31
|
import { buildHcs10CreateInboundTopicTx, buildHcs10CreateConnectionTopicTx, buildHcs10ConfirmConnectionTx, buildHcs10SendMessageTx, buildHcs10RegistryRegisterTx, buildHcs10CreateOutboundTopicTx, buildHcs10CreateRegistryTopicTx } from "./standards-sdk.es23.js";
|
|
32
32
|
class HCS10Client extends HCS10BaseClient {
|
|
33
33
|
constructor(config) {
|
|
@@ -1,40 +1,87 @@
|
|
|
1
|
-
import { optionalImportSync } from "./standards-sdk.es135.js";
|
|
2
1
|
const accountIdPattern = /^\d+\.\d+\.\d+$/u;
|
|
3
2
|
const prototypeMarker = Symbol.for("standards-sdk.topic-auto-renew.patch");
|
|
4
3
|
const accountMarker = Symbol.for("standards-sdk.account-id.patch");
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
);
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
11
|
-
const sdkModule = optionalImportSync("@hashgraph/sdk");
|
|
12
|
-
const candidates = [];
|
|
13
|
-
if (accountModule?.default && topicModule?.default) {
|
|
14
|
-
candidates.push({
|
|
15
|
-
accountId: accountModule.default,
|
|
16
|
-
topic: topicModule.default
|
|
17
|
-
});
|
|
4
|
+
const nodeRequire = getNodeRequire();
|
|
5
|
+
if (nodeRequire) {
|
|
6
|
+
bootstrap(nodeRequire);
|
|
7
|
+
} else {
|
|
8
|
+
Reflect.set(globalThis, "__standardsSdkTopicAutoRenewPatched", false);
|
|
18
9
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
function bootstrap(requireFn) {
|
|
11
|
+
const accountModule = safeRequire(
|
|
12
|
+
requireFn,
|
|
13
|
+
"@hashgraph/sdk/lib/account/AccountId.cjs"
|
|
14
|
+
);
|
|
15
|
+
const topicModule = safeRequire(
|
|
16
|
+
requireFn,
|
|
17
|
+
"@hashgraph/sdk/lib/topic/TopicCreateTransaction.cjs"
|
|
18
|
+
);
|
|
19
|
+
const sdkModule = safeRequire(requireFn, "@hashgraph/sdk");
|
|
20
|
+
const candidates = [];
|
|
21
|
+
if (accountModule?.default && topicModule?.default) {
|
|
22
|
+
candidates.push({
|
|
23
|
+
accountId: accountModule.default,
|
|
24
|
+
topic: topicModule.default
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
if (sdkModule) {
|
|
28
|
+
candidates.push({
|
|
29
|
+
accountId: sdkModule.AccountId ?? sdkModule.default?.AccountId,
|
|
30
|
+
topic: sdkModule.TopicCreateTransaction ?? sdkModule.default?.TopicCreateTransaction
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
for (const candidate of candidates) {
|
|
34
|
+
patchTopicModule(candidate.topic, candidate.accountId);
|
|
35
|
+
}
|
|
36
|
+
Reflect.set(globalThis, "__standardsSdkTopicAutoRenewPatched", true);
|
|
24
37
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
38
|
+
function getNodeRequire() {
|
|
39
|
+
const moduleConstructor = getModuleConstructor();
|
|
40
|
+
if (moduleConstructor?.createRequire) {
|
|
41
|
+
try {
|
|
42
|
+
return moduleConstructor.createRequire(import.meta.url);
|
|
43
|
+
} catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (typeof require === "function") {
|
|
48
|
+
return require;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
function getModuleConstructor() {
|
|
53
|
+
try {
|
|
54
|
+
if (typeof module !== "undefined" && module?.createRequire) {
|
|
55
|
+
return module;
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
if (typeof require === "function") {
|
|
61
|
+
const requiredModule = require("module");
|
|
62
|
+
if (requiredModule?.createRequire) {
|
|
63
|
+
return requiredModule;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
function safeRequire(requireFn, moduleId) {
|
|
71
|
+
try {
|
|
72
|
+
return requireFn(moduleId);
|
|
73
|
+
} catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
28
76
|
}
|
|
29
|
-
Reflect.set(globalThis, "__standardsSdkTopicAutoRenewPatched", patched);
|
|
30
77
|
function patchTopicModule(topicCtor, accountCtor) {
|
|
31
78
|
if (!topicCtor || !accountCtor) {
|
|
32
|
-
return
|
|
79
|
+
return;
|
|
33
80
|
}
|
|
34
81
|
patchAccountId(accountCtor);
|
|
35
82
|
const prototype = topicCtor.prototype;
|
|
36
83
|
if (Reflect.get(prototype, prototypeMarker)) {
|
|
37
|
-
return
|
|
84
|
+
return;
|
|
38
85
|
}
|
|
39
86
|
const originalSet = prototype.setAutoRenewAccountId;
|
|
40
87
|
const originalFreeze = prototype.freezeWith;
|
|
@@ -66,7 +113,6 @@ function patchTopicModule(topicCtor, accountCtor) {
|
|
|
66
113
|
return originalFreeze.call(this, client);
|
|
67
114
|
};
|
|
68
115
|
Reflect.set(prototype, prototypeMarker, true);
|
|
69
|
-
return true;
|
|
70
116
|
}
|
|
71
117
|
function patchAccountId(accountCtor) {
|
|
72
118
|
if (Reflect.get(accountCtor, accountMarker)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es2.js","sources":["../../src/patches/topic-autorenew-patch.ts"],"sourcesContent":["type TopicCreateTransactionCtor =\n (typeof import('@hashgraph/sdk'))['TopicCreateTransaction'];\ntype AccountIdCtor = (typeof import('@hashgraph/sdk'))['AccountId'];\ntype AccountIdInstance = InstanceType<AccountIdCtor>;\nimport { optionalImportSync } from '../utils/dynamic-import';\n\nconst accountIdPattern = /^\\d+\\.\\d+\\.\\d+$/u;\nconst prototypeMarker = Symbol.for('standards-sdk.topic-auto-renew.patch');\nconst accountMarker = Symbol.for('standards-sdk.account-id.patch');\n\nconst accountModule = optionalImportSync<{ default: AccountIdCtor }>(\n '@hashgraph/sdk/lib/account/AccountId.cjs',\n);\nconst topicModule = optionalImportSync<{ default: TopicCreateTransactionCtor }>(\n '@hashgraph/sdk/lib/topic/TopicCreateTransaction.cjs',\n);\nconst sdkModule = optionalImportSync<{\n AccountId?: AccountIdCtor;\n TopicCreateTransaction?: TopicCreateTransactionCtor;\n default?: {\n AccountId?: AccountIdCtor;\n TopicCreateTransaction?: TopicCreateTransactionCtor;\n };\n}>('@hashgraph/sdk');\n\nconst candidates: Array<{\n accountId?: AccountIdCtor;\n topic?: TopicCreateTransactionCtor;\n}> = [];\n\nif (accountModule?.default && topicModule?.default) {\n candidates.push({\n accountId: accountModule.default,\n topic: topicModule.default,\n });\n}\n\nif (sdkModule) {\n candidates.push({\n accountId: sdkModule.AccountId ?? sdkModule.default?.AccountId,\n topic:\n sdkModule.TopicCreateTransaction ?? sdkModule.default?.TopicCreateTransaction,\n });\n}\n\nlet patched = false;\n\nfor (const candidate of candidates) {\n patched = patchTopicModule(candidate.topic, candidate.accountId) || patched;\n}\n\nReflect.set(globalThis, '__standardsSdkTopicAutoRenewPatched', patched);\n\nfunction patchTopicModule(\n topicCtor?: TopicCreateTransactionCtor,\n accountCtor?: AccountIdCtor,\n): boolean {\n if (!topicCtor || !accountCtor) {\n return false;\n }\n\n patchAccountId(accountCtor);\n\n const prototype = topicCtor.prototype;\n\n if (Reflect.get(prototype, prototypeMarker)) {\n return false;\n }\n\n const originalSet = prototype.setAutoRenewAccountId;\n const originalFreeze = prototype.freezeWith;\n\n prototype.setAutoRenewAccountId = function setAutoRenewAccountIdPatched(\n this: TopicPrototype,\n autoRenewAccountId: unknown,\n ) {\n const resolved = resolveAccountId(autoRenewAccountId, accountCtor);\n\n if (resolved) {\n requireNotFrozen(this);\n this._autoRenewAccountId = resolved;\n return this;\n }\n\n return originalSet.call(\n this,\n autoRenewAccountId as AccountIdInstance | string,\n );\n };\n\n prototype.freezeWith = function freezeWithPatched(\n this: TopicPrototype,\n client?: unknown,\n ) {\n if (\n !this.getAutoRenewAccountId ||\n typeof this.getAutoRenewAccountId !== 'function'\n ) {\n return originalFreeze.call(this, client);\n }\n\n const current = this.getAutoRenewAccountId();\n\n if (!current) {\n const transactionAccountId = this.transactionId?.accountId;\n const operatorAccountId = (client as ClientLike | null | undefined)\n ?.operatorAccountId;\n const resolved =\n resolveAccountId(transactionAccountId, accountCtor) ??\n resolveAccountId(operatorAccountId, accountCtor);\n\n if (resolved) {\n this._autoRenewAccountId = resolved;\n }\n }\n\n return originalFreeze.call(this, client);\n };\n\n Reflect.set(prototype, prototypeMarker, true);\n return true;\n}\n\nfunction patchAccountId(accountCtor: AccountIdCtor): void {\n if (Reflect.get(accountCtor, accountMarker)) {\n return;\n }\n\n const originalFromString = accountCtor.fromString.bind(accountCtor);\n\n accountCtor.fromString = function accountIdFromStringPatched(\n value: unknown,\n ): AccountIdInstance {\n if (typeof value === 'string') {\n return originalFromString(value);\n }\n\n const extracted = extractAccountIdString(value);\n\n if (extracted) {\n return originalFromString(extracted);\n }\n\n if (isProtoAccountId(value)) {\n const shard = toNumericString(value.shard);\n const realm = toNumericString(value.realm);\n const num = toNumericString(value.num);\n\n if (shard && realm && num) {\n return originalFromString(`${shard}.${realm}.${num}`);\n }\n }\n\n return originalFromString(value as string);\n };\n\n Reflect.set(accountCtor, accountMarker, true);\n}\n\nfunction resolveAccountId(\n value: unknown,\n accountCtor: AccountIdCtor,\n): AccountIdInstance | null {\n if (value instanceof accountCtor) {\n return value;\n }\n\n if (typeof value === 'string' && accountIdPattern.test(value)) {\n return accountCtor.fromString(value);\n }\n\n const normalized = normalizeAutoRenewValue(value);\n\n if (normalized) {\n return accountCtor.fromString(normalized);\n }\n\n return null;\n}\n\nfunction normalizeAutoRenewValue(value: unknown): string | null {\n if (typeof value === 'string' && accountIdPattern.test(value)) {\n return value;\n }\n\n const extracted = extractAccountIdString(value);\n\n if (extracted) {\n return extracted;\n }\n\n if (isProtoAccountId(value)) {\n const shard = toNumericString(value.shard);\n const realm = toNumericString(value.realm);\n const num = toNumericString(value.num);\n\n if (shard && realm && num) {\n const composed = `${shard}.${realm}.${num}`;\n if (accountIdPattern.test(composed)) {\n return composed;\n }\n }\n }\n\n return null;\n}\n\nfunction extractAccountIdString(value: unknown): string | null {\n if (typeof value !== 'object' || value === null) {\n return null;\n }\n\n const candidate = value as { toString?: () => unknown };\n const method = candidate.toString;\n\n if (typeof method !== 'function') {\n return null;\n }\n\n const result = method.call(value);\n\n if (typeof result !== 'string') {\n return null;\n }\n\n return accountIdPattern.test(result) ? result : null;\n}\n\nfunction isProtoAccountId(value: unknown): value is {\n shard: { toString: () => string };\n realm: { toString: () => string };\n num: { toString: () => string };\n} {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n\n const candidate = value as Record<string, unknown>;\n\n return (\n hasToString(candidate.shard) &&\n hasToString(candidate.realm) &&\n hasToString(candidate.num)\n );\n}\n\nfunction hasToString(value: unknown): value is { toString: () => string } {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { toString?: unknown }).toString === 'function'\n );\n}\n\nfunction toNumericString(value: unknown): string | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return String(Math.trunc(value));\n }\n\n if (typeof value === 'bigint') {\n return value.toString();\n }\n\n if (hasToString(value)) {\n const result = value.toString();\n if (/^\\d+$/u.test(result)) {\n return result;\n }\n }\n\n return null;\n}\n\nfunction requireNotFrozen(target: TopicPrototype): void {\n const candidate = target as { _requireNotFrozen?: () => void };\n candidate._requireNotFrozen?.();\n}\n\ntype ClientLike = {\n operatorAccountId?: unknown;\n};\n\ntype TopicPrototype = {\n setAutoRenewAccountId?: (...args: unknown[]) => unknown;\n freezeWith?: (...args: unknown[]) => unknown;\n getAutoRenewAccountId?: () => AccountIdInstance | null;\n transactionId?: { accountId?: unknown } | null;\n _autoRenewAccountId?: AccountIdInstance | null;\n [key: string]: unknown;\n};\n"],"names":[],"mappings":";AAMA,MAAM,mBAAmB;AACzB,MAAM,kBAAkB,OAAO,IAAI,sCAAs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AACtD,MAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,GAAG;AACvD,WAAO,OAAO,KAAK,MAAM,KAAK,CAAC;AAAA,EACjC;AAEA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,MAAM,SAAA;AAAA,EACf;AAEA,MAAI,YAAY,KAAK,GAAG;AACtB,UAAM,SAAS,MAAM,SAAA;AACrB,QAAI,SAAS,KAAK,MAAM,GAAG;AACzB,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,QAA8B;AACtD,QAAM,YAAY;AAClB,YAAU,oBAAA;AACZ;"}
|
|
1
|
+
{"version":3,"file":"standards-sdk.es2.js","sources":["../../src/patches/topic-autorenew-patch.ts"],"sourcesContent":["type TopicCreateTransactionCtor =\n (typeof import('@hashgraph/sdk'))['TopicCreateTransaction'];\ntype AccountIdCtor = (typeof import('@hashgraph/sdk'))['AccountId'];\ntype AccountIdInstance = InstanceType<AccountIdCtor>;\ntype NodeRequire = (moduleId: string) => unknown;\ntype ModuleConstructor = {\n createRequire?: (url: string | URL | undefined) => NodeRequire;\n};\n\ndeclare const module: ModuleConstructor | undefined;\ndeclare const require: NodeRequire | undefined;\n\nconst accountIdPattern = /^\\d+\\.\\d+\\.\\d+$/u;\nconst prototypeMarker = Symbol.for('standards-sdk.topic-auto-renew.patch');\nconst accountMarker = Symbol.for('standards-sdk.account-id.patch');\n\nconst nodeRequire = getNodeRequire();\n\nif (nodeRequire) {\n bootstrap(nodeRequire);\n} else {\n Reflect.set(globalThis, '__standardsSdkTopicAutoRenewPatched', false);\n}\n\nfunction bootstrap(requireFn: NodeRequire): void {\n const accountModule = safeRequire<{ default: AccountIdCtor }>(\n requireFn,\n '@hashgraph/sdk/lib/account/AccountId.cjs',\n );\n const topicModule = safeRequire<{ default: TopicCreateTransactionCtor }>(\n requireFn,\n '@hashgraph/sdk/lib/topic/TopicCreateTransaction.cjs',\n );\n const sdkModule = safeRequire<{\n AccountId?: AccountIdCtor;\n TopicCreateTransaction?: TopicCreateTransactionCtor;\n default?: {\n AccountId?: AccountIdCtor;\n TopicCreateTransaction?: TopicCreateTransactionCtor;\n };\n }>(requireFn, '@hashgraph/sdk');\n\n const candidates: Array<{\n accountId?: AccountIdCtor;\n topic?: TopicCreateTransactionCtor;\n }> = [];\n\n if (accountModule?.default && topicModule?.default) {\n candidates.push({\n accountId: accountModule.default,\n topic: topicModule.default,\n });\n }\n\n if (sdkModule) {\n candidates.push({\n accountId: sdkModule.AccountId ?? sdkModule.default?.AccountId,\n topic:\n sdkModule.TopicCreateTransaction ??\n sdkModule.default?.TopicCreateTransaction,\n });\n }\n\n for (const candidate of candidates) {\n patchTopicModule(candidate.topic, candidate.accountId);\n }\n\n Reflect.set(globalThis, '__standardsSdkTopicAutoRenewPatched', true);\n}\n\nfunction getNodeRequire(): NodeRequire | null {\n const moduleConstructor = getModuleConstructor();\n\n if (moduleConstructor?.createRequire) {\n try {\n return moduleConstructor.createRequire(import.meta.url);\n } catch {\n return null;\n }\n }\n\n if (typeof require === 'function') {\n return require;\n }\n\n return null;\n}\n\nfunction getModuleConstructor(): ModuleConstructor | null {\n try {\n if (typeof module !== 'undefined' && module?.createRequire) {\n return module;\n }\n } catch {}\n\n try {\n if (typeof require === 'function') {\n const requiredModule = require('module') as ModuleConstructor;\n\n if (requiredModule?.createRequire) {\n return requiredModule;\n }\n }\n } catch {}\n\n return null;\n}\n\nfunction safeRequire<T>(requireFn: NodeRequire, moduleId: string): T | null {\n try {\n return requireFn(moduleId) as T;\n } catch {\n return null;\n }\n}\n\nfunction patchTopicModule(\n topicCtor?: TopicCreateTransactionCtor,\n accountCtor?: AccountIdCtor,\n): void {\n if (!topicCtor || !accountCtor) {\n return;\n }\n\n patchAccountId(accountCtor);\n\n const prototype = topicCtor.prototype;\n\n if (Reflect.get(prototype, prototypeMarker)) {\n return;\n }\n\n const originalSet = prototype.setAutoRenewAccountId;\n const originalFreeze = prototype.freezeWith;\n\n prototype.setAutoRenewAccountId = function setAutoRenewAccountIdPatched(\n this: TopicPrototype,\n autoRenewAccountId: unknown,\n ) {\n const resolved = resolveAccountId(autoRenewAccountId, accountCtor);\n\n if (resolved) {\n requireNotFrozen(this);\n this._autoRenewAccountId = resolved;\n return this;\n }\n\n return originalSet.call(\n this,\n autoRenewAccountId as AccountIdInstance | string,\n );\n };\n\n prototype.freezeWith = function freezeWithPatched(\n this: TopicPrototype,\n client?: unknown,\n ) {\n if (\n !this.getAutoRenewAccountId ||\n typeof this.getAutoRenewAccountId !== 'function'\n ) {\n return originalFreeze.call(this, client);\n }\n\n const current = this.getAutoRenewAccountId();\n\n if (!current) {\n const transactionAccountId = this.transactionId?.accountId;\n const operatorAccountId = (client as ClientLike | null | undefined)\n ?.operatorAccountId;\n const resolved =\n resolveAccountId(transactionAccountId, accountCtor) ??\n resolveAccountId(operatorAccountId, accountCtor);\n\n if (resolved) {\n this._autoRenewAccountId = resolved;\n }\n }\n\n return originalFreeze.call(this, client);\n };\n\n Reflect.set(prototype, prototypeMarker, true);\n}\n\nfunction patchAccountId(accountCtor: AccountIdCtor): void {\n if (Reflect.get(accountCtor, accountMarker)) {\n return;\n }\n\n const originalFromString = accountCtor.fromString.bind(accountCtor);\n\n accountCtor.fromString = function accountIdFromStringPatched(\n value: unknown,\n ): AccountIdInstance {\n if (typeof value === 'string') {\n return originalFromString(value);\n }\n\n const extracted = extractAccountIdString(value);\n\n if (extracted) {\n return originalFromString(extracted);\n }\n\n if (isProtoAccountId(value)) {\n const shard = toNumericString(value.shard);\n const realm = toNumericString(value.realm);\n const num = toNumericString(value.num);\n\n if (shard && realm && num) {\n return originalFromString(`${shard}.${realm}.${num}`);\n }\n }\n\n return originalFromString(value as string);\n };\n\n Reflect.set(accountCtor, accountMarker, true);\n}\n\nfunction resolveAccountId(\n value: unknown,\n accountCtor: AccountIdCtor,\n): AccountIdInstance | null {\n if (value instanceof accountCtor) {\n return value;\n }\n\n if (typeof value === 'string' && accountIdPattern.test(value)) {\n return accountCtor.fromString(value);\n }\n\n const normalized = normalizeAutoRenewValue(value);\n\n if (normalized) {\n return accountCtor.fromString(normalized);\n }\n\n return null;\n}\n\nfunction normalizeAutoRenewValue(value: unknown): string | null {\n if (typeof value === 'string' && accountIdPattern.test(value)) {\n return value;\n }\n\n const extracted = extractAccountIdString(value);\n\n if (extracted) {\n return extracted;\n }\n\n if (isProtoAccountId(value)) {\n const shard = toNumericString(value.shard);\n const realm = toNumericString(value.realm);\n const num = toNumericString(value.num);\n\n if (shard && realm && num) {\n const composed = `${shard}.${realm}.${num}`;\n if (accountIdPattern.test(composed)) {\n return composed;\n }\n }\n }\n\n return null;\n}\n\nfunction extractAccountIdString(value: unknown): string | null {\n if (typeof value !== 'object' || value === null) {\n return null;\n }\n\n const candidate = value as { toString?: () => unknown };\n const method = candidate.toString;\n\n if (typeof method !== 'function') {\n return null;\n }\n\n const result = method.call(value);\n\n if (typeof result !== 'string') {\n return null;\n }\n\n return accountIdPattern.test(result) ? result : null;\n}\n\nfunction isProtoAccountId(value: unknown): value is {\n shard: { toString: () => string };\n realm: { toString: () => string };\n num: { toString: () => string };\n} {\n if (typeof value !== 'object' || value === null) {\n return false;\n }\n\n const candidate = value as Record<string, unknown>;\n\n return (\n hasToString(candidate.shard) &&\n hasToString(candidate.realm) &&\n hasToString(candidate.num)\n );\n}\n\nfunction hasToString(value: unknown): value is { toString: () => string } {\n return (\n typeof value === 'object' &&\n value !== null &&\n typeof (value as { toString?: unknown }).toString === 'function'\n );\n}\n\nfunction toNumericString(value: unknown): string | null {\n if (typeof value === 'number' && Number.isFinite(value)) {\n return String(Math.trunc(value));\n }\n\n if (typeof value === 'bigint') {\n return value.toString();\n }\n\n if (hasToString(value)) {\n const result = value.toString();\n if (/^\\d+$/u.test(result)) {\n return result;\n }\n }\n\n return null;\n}\n\nfunction requireNotFrozen(target: TopicPrototype): void {\n const candidate = target as { _requireNotFrozen?: () => void };\n candidate._requireNotFrozen?.();\n}\n\ntype ClientLike = {\n operatorAccountId?: unknown;\n};\n\ntype TopicPrototype = {\n setAutoRenewAccountId?: (...args: unknown[]) => unknown;\n freezeWith?: (...args: unknown[]) => unknown;\n getAutoRenewAccountId?: () => AccountIdInstance | null;\n transactionId?: { accountId?: unknown } | null;\n _autoRenewAccountId?: AccountIdInstance | null;\n [key: string]: unknown;\n};\n"],"names":[],"mappings":"AAYA,MAAM,mBAAmB;AACzB,MAAM,kBAAkB,OAAO,IAAI,sCAAsC;AACzE,MAAM,gBAAgB,OAAO,IAAI,gCAAgC;AAEjE,MAAM,cAAc,eAAA;AAEpB,IAAI,aAAa;AACf,YAAU,WAAW;AACvB,OAAO;AACL,UAAQ,IAAI,YAAY,uCAAuC,KAAK;AACtE;AAEA,SAAS,UAAU,WAA8B;AAC/C,QAAM,gBAAgB;AAAA,IACpB;AAAA,IACA;AAAA,EAAA;AAEF,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,EAAA;AAEF,QAAM,YAAY,YAOf,WAAW,gBAAgB;AAE9B,QAAM,aAGD,CAAA;AAEL,MAAI,eAAe,WAAW,aAAa,SAAS;AAClD,eAAW,KAAK;AAAA,MACd,WAAW,cAAc;AAAA,MACzB,OAAO,YAAY;AAAA,IAAA,CACpB;AAAA,EACH;AAEA,MAAI,WAAW;AACb,eAAW,KAAK;AAAA,MACd,WAAW,UAAU,aAAa,UAAU,SAAS;AAAA,MACrD,OACE,UAAU,0BACV,UAAU,SAAS;AAAA,IAAA,CACtB;AAAA,EACH;AAEA,aAAW,aAAa,YAAY;AAClC,qBAAiB,UAAU,OAAO,UAAU,SAAS;AAAA,EACvD;AAEA,UAAQ,IAAI,YAAY,uCAAuC,IAAI;AACrE;AAEA,SAAS,iBAAqC;AAC5C,QAAM,oBAAoB,qBAAA;AAE1B,MAAI,mBAAmB,eAAe;AACpC,QAAI;AACF,aAAO,kBAAkB,cAAc,YAAY,GAAG;AAAA,IACxD,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,OA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OAAO,UAAU,UAAU;AAC7B,WAAO,MAAM,SAAA;AAAA,EACf;AAEA,MAAI,YAAY,KAAK,GAAG;AACtB,UAAM,SAAS,MAAM,SAAA;AACrB,QAAI,SAAS,KAAK,MAAM,GAAG;AACzB,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;AAEA,SAAS,iBAAiB,QAA8B;AACtD,QAAM,YAAY;AAClB,YAAU,oBAAA;AACZ;"}
|
|
@@ -8,14 +8,14 @@ import "node:buffer";
|
|
|
8
8
|
import "node:crypto";
|
|
9
9
|
import "@noble/curves/secp256k1.js";
|
|
10
10
|
import "./standards-sdk.es130.js";
|
|
11
|
-
import "./standards-sdk.
|
|
11
|
+
import "./standards-sdk.es136.js";
|
|
12
12
|
import "zod";
|
|
13
13
|
import "buffer";
|
|
14
14
|
import "ethers";
|
|
15
15
|
import "./standards-sdk.es123.js";
|
|
16
16
|
import "./standards-sdk.es114.js";
|
|
17
17
|
import { getTopicId } from "./standards-sdk.es115.js";
|
|
18
|
-
import { InscriptionSDK } from "./standards-sdk.
|
|
18
|
+
import { InscriptionSDK } from "./standards-sdk.es137.js";
|
|
19
19
|
import { HCS10BaseClient, Hcs10MemoType } from "./standards-sdk.es17.js";
|
|
20
20
|
import * as mime from "mime-types";
|
|
21
21
|
import { AgentBuilder } from "./standards-sdk.es24.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client, Status, PrivateKey, AccountUpdateTransaction } from "@hashgraph/sdk";
|
|
2
2
|
import { inscribeWithSigner, inscribe } from "./standards-sdk.es125.js";
|
|
3
|
-
import "./standards-sdk.
|
|
3
|
+
import "./standards-sdk.es137.js";
|
|
4
4
|
import { Logger } from "./standards-sdk.es106.js";
|
|
5
5
|
import { HederaMirrorNode } from "./standards-sdk.es127.js";
|
|
6
6
|
import { ProgressReporter } from "./standards-sdk.es109.js";
|
|
@@ -10,7 +10,7 @@ import "node:buffer";
|
|
|
10
10
|
import "node:crypto";
|
|
11
11
|
import "@noble/curves/secp256k1.js";
|
|
12
12
|
import "./standards-sdk.es130.js";
|
|
13
|
-
import "./standards-sdk.
|
|
13
|
+
import "./standards-sdk.es136.js";
|
|
14
14
|
import { z } from "zod";
|
|
15
15
|
import "@hashgraph/proto";
|
|
16
16
|
import "buffer";
|
|
@@ -20,7 +20,7 @@ import "./standards-sdk.es114.js";
|
|
|
20
20
|
import { getTopicId } from "./standards-sdk.es115.js";
|
|
21
21
|
import * as mime from "mime-types";
|
|
22
22
|
import { isHederaNetwork, toHederaCaip10 } from "./standards-sdk.es58.js";
|
|
23
|
-
import { createNodeOperatorContext } from "./standards-sdk.
|
|
23
|
+
import { createNodeOperatorContext } from "./standards-sdk.es138.js";
|
|
24
24
|
import { AIAgentCapability, AIAgentType, VerificationType, MCPServerCapability, ProfileType, capabilityNameToCapabilityMap } from "./standards-sdk.es29.js";
|
|
25
25
|
const SocialLinkSchema = z.object({
|
|
26
26
|
platform: z.string().min(1),
|
|
@@ -571,7 +571,8 @@ class HCS11Client {
|
|
|
571
571
|
return {
|
|
572
572
|
profileTopicId: topicId,
|
|
573
573
|
transactionId: inscriptionResponse.result.transactionId,
|
|
574
|
-
success: true
|
|
574
|
+
success: true,
|
|
575
|
+
totalCostHbar: inscriptionResponse.costSummary?.totalCostHbar
|
|
575
576
|
};
|
|
576
577
|
} catch (error) {
|
|
577
578
|
progressReporter.failed(
|
|
@@ -593,7 +594,7 @@ class HCS11Client {
|
|
|
593
594
|
return;
|
|
594
595
|
}
|
|
595
596
|
try {
|
|
596
|
-
const { HCS14Client } = await import("./standards-sdk.
|
|
597
|
+
const { HCS14Client } = await import("./standards-sdk.es135.js");
|
|
597
598
|
const hcs14 = new HCS14Client({ client: this.client });
|
|
598
599
|
const did = await hcs14.createDid({
|
|
599
600
|
method: "hedera",
|
|
@@ -701,7 +702,8 @@ class HCS11Client {
|
|
|
701
702
|
}
|
|
702
703
|
progressReporter.completed("Profile creation completed successfully", {
|
|
703
704
|
profileTopicId: inscriptionResult.profileTopicId,
|
|
704
|
-
transactionId: inscriptionResult.transactionId
|
|
705
|
+
transactionId: inscriptionResult.transactionId,
|
|
706
|
+
totalCostHbar: inscriptionResult.totalCostHbar
|
|
705
707
|
});
|
|
706
708
|
return inscriptionResult;
|
|
707
709
|
}
|