@hashgraphonline/standards-sdk 0.1.144-feat-xmpt.canary.94e47b6.82 → 0.1.145
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/standards-sdk.es110.js +5 -5
- package/dist/es/standards-sdk.es120.js +1 -1
- package/dist/es/standards-sdk.es121.js +1 -1
- package/dist/es/standards-sdk.es122.js +5 -5
- package/dist/es/standards-sdk.es152.js +13 -168
- package/dist/es/standards-sdk.es152.js.map +1 -1
- package/dist/es/standards-sdk.es153.js +139 -289
- package/dist/es/standards-sdk.es153.js.map +1 -1
- package/dist/es/standards-sdk.es154.js +274 -298
- package/dist/es/standards-sdk.es154.js.map +1 -1
- package/dist/es/standards-sdk.es155.js +262 -369
- package/dist/es/standards-sdk.es155.js.map +1 -1
- package/dist/es/standards-sdk.es156.js +316 -194
- package/dist/es/standards-sdk.es156.js.map +1 -1
- package/dist/es/standards-sdk.es157.js +319 -64
- package/dist/es/standards-sdk.es157.js.map +1 -1
- package/dist/es/standards-sdk.es158.js +74 -15
- package/dist/es/standards-sdk.es158.js.map +1 -1
- package/dist/es/standards-sdk.es64.js +1 -1
- package/dist/es/standards-sdk.es65.js +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
constructor(config) {
|
|
8
|
-
this.network = config.network;
|
|
9
|
-
this.logger = config.logger || Logger.getInstance({
|
|
10
|
-
level: config.logLevel || "info",
|
|
11
|
-
module: "HCS5Client",
|
|
12
|
-
silent: config.silent
|
|
13
|
-
});
|
|
14
|
-
this.mirrorNode = new HederaMirrorNode(this.network, this.logger);
|
|
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;
|
|
15
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(", ")}]`;
|
|
26
|
+
}
|
|
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";
|
|
42
|
+
}
|
|
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);
|
|
56
|
+
}
|
|
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
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
} catch (error) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function hasTransactionType(transaction, transactionField) {
|
|
71
|
+
const txBody = extractTransactionBody(transaction);
|
|
72
|
+
return !!(txBody && txBody[transactionField]);
|
|
16
73
|
}
|
|
17
74
|
export {
|
|
18
|
-
|
|
75
|
+
extractTransactionBody,
|
|
76
|
+
hasTransactionType,
|
|
77
|
+
parseKey
|
|
19
78
|
};
|
|
20
79
|
//# sourceMappingURL=standards-sdk.es158.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standards-sdk.es158.js","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"standards-sdk.es158.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}\n"],"names":[],"mappings":";;;AAIO,SAAS,SACd,KACoB;AACpB,MAAI,CAAC,KAAK;AACR,WAAO;AAAA,EACT;AAEA,MAAI,IAAI,YAAY;AAClB,WAAO,eAAe,IAAI;AAAA,MACxB,IAAI,WAAW,YAAY;AAAA,MAC3B,IAAI,WAAW,YAAY;AAAA,MAC3B,IAAI,WAAW,eAAe;AAAA,IAAA,EAC9B,UAAU;AAAA,EACd;AACA,MAAI,IAAI,SAAS;AACf,WAAO,YAAY,OAAO,KAAK,IAAI,OAAO,EAAE,SAAS,KAAK,CAAC;AAAA,EAC7D;AACA,MAAI,IAAI,gBAAgB;AACtB,WAAO,oBAAoB,OAAO,KAAK,IAAI,cAAc,EAAE;AAAA,MACzD;AAAA,IAAA,CACD;AAAA,EACH;AACA,MAAI,KAAK,SAAS,MAAM,SAAS,GAAG;AAClC,UAAM,OAAO,IAAI,QAAQ,KAAK,IAAI,CAAA,MAAK,SAAS,CAAC,CAAC,EAAE,OAAO,OAAO;AAClE,WAAO,YAAY,KAAK,MAAM,YAAY,KAAK,KAAK,IAAI,CAAC;AAAA,EAC3D;AACA,MAAI,KAAK,cAAc,MAAM,MAAM,SAAS,GAAG;AAC7C,UAAM,OAAO,IAAI,aAAa,KAAK,KAChC,IAAI,CAAA,MAAK,SAAS,CAAC,CAAC,EACpB,OAAO,OAAO;AACjB,WAAO,iBAAiB,IAAI,aAAa,SAAS,OAChD,KAAK,MACP,OAAO,KAAK,KAAK,IAAI,CAAC;AAAA,EACxB;AACA,MAAI,IAAI,uBAAuB;AAC7B,WAAO,0BAA0B,IAAI;AAAA,MACnC,IAAI,sBAAsB,YAAY;AAAA,MACtC,IAAI,sBAAsB,YAAY;AAAA,MACtC,IAAI,sBAAsB,eAAe;AAAA,IAAA,EACzC,UAAU;AAAA,EACd;AACA,MAAI,OAAO,KAAK,GAAG,EAAE,WAAW,GAAG;AACjC,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAMO,SAAS,uBACd,aAC+B;AAC/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;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HCS5BaseClient } from "./standards-sdk.
|
|
1
|
+
import { HCS5BaseClient } from "./standards-sdk.es152.js";
|
|
2
2
|
import { buildHcs1Hrl } from "./standards-sdk.es63.js";
|
|
3
3
|
import { PrivateKey } from "@hashgraph/sdk";
|
|
4
4
|
import { inscribeWithSigner } from "./standards-sdk.es124.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HCS5BaseClient } from "./standards-sdk.
|
|
1
|
+
import { HCS5BaseClient } from "./standards-sdk.es152.js";
|
|
2
2
|
import { buildHcs1Hrl } from "./standards-sdk.es63.js";
|
|
3
3
|
import { AccountId } from "@hashgraph/sdk";
|
|
4
4
|
import { inscribe } from "./standards-sdk.es124.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hashgraphonline/standards-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.145",
|
|
4
4
|
"description": "The Hashgraph Online Standards SDK provides a complete implementation of the Hiero Consensus Standards (HCS), giving developers all the tools needed to build wonderful decentralized applications on the Hashgraph network.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|