@hashgraphonline/standards-sdk 0.0.171 → 0.0.173
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/{index-C6JuEaqa.cjs → index-BbO9PbXS.cjs} +8 -8
- package/dist/cjs/{index-C6JuEaqa.cjs.map → index-BbO9PbXS.cjs.map} +1 -1
- package/dist/cjs/{index-DNOBUKZd-Dp3YIBD3.cjs → index-DNOBUKZd-CrpHimck.cjs} +2 -2
- package/dist/cjs/{index-DNOBUKZd-Dp3YIBD3.cjs.map → index-DNOBUKZd-CrpHimck.cjs.map} +1 -1
- package/dist/cjs/standards-sdk.cjs +1 -1
- package/dist/cjs/{standards-sdk.es47-LpJXpYet-DXAbL7jc.cjs → standards-sdk.es47-LpJXpYet-P7i59MNI.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es47-LpJXpYet-DXAbL7jc.cjs.map → standards-sdk.es47-LpJXpYet-P7i59MNI.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es48-PT6ZHlCU-yByY8MDI.cjs → standards-sdk.es48-PT6ZHlCU-CZ2H1KZJ.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es48-PT6ZHlCU-yByY8MDI.cjs.map → standards-sdk.es48-PT6ZHlCU-CZ2H1KZJ.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es49-BoFc-ELK-Dui1BE61.cjs → standards-sdk.es49-BoFc-ELK-C-p3rJ1y.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es49-BoFc-ELK-Dui1BE61.cjs.map → standards-sdk.es49-BoFc-ELK-C-p3rJ1y.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es50-miBtNmtl-CnkMw8lO.cjs → standards-sdk.es50-miBtNmtl--P7v7jgv.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es50-miBtNmtl-CnkMw8lO.cjs.map → standards-sdk.es50-miBtNmtl--P7v7jgv.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es51-rS2UvvV5-tEniytpy.cjs → standards-sdk.es51-rS2UvvV5-D58VZ14i.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es51-rS2UvvV5-tEniytpy.cjs.map → standards-sdk.es51-rS2UvvV5-D58VZ14i.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es52-D-lvSMBY-BfaYfbif.cjs → standards-sdk.es52-D-lvSMBY-1GLlqmth.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es52-D-lvSMBY-BfaYfbif.cjs.map → standards-sdk.es52-D-lvSMBY-1GLlqmth.cjs.map} +1 -1
- package/dist/cjs/utils/transaction-parser.d.ts +0 -16
- package/dist/cjs/utils/transaction-parser.d.ts.map +1 -1
- package/dist/es/standards-sdk.es.js +1 -2
- package/dist/es/standards-sdk.es13.js +1 -1
- package/dist/es/standards-sdk.es28.js +1 -1
- package/dist/es/standards-sdk.es35.js +167 -110
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +1 -1
- package/dist/es/standards-sdk.es49.js +2 -109
- package/dist/es/standards-sdk.es49.js.map +1 -1
- package/dist/es/standards-sdk.es50.js +80 -37
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +33 -223
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +184 -101
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +167 -5
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +9 -40
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +42 -2
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/utils/transaction-parser.d.ts +0 -16
- package/dist/es/utils/transaction-parser.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -113,27 +113,11 @@ export declare class TransactionParser {
|
|
|
113
113
|
* Extract token transfers from Transaction object
|
|
114
114
|
*/
|
|
115
115
|
private static extractTokenTransfersFromTransaction;
|
|
116
|
-
/**
|
|
117
|
-
* Extracts token creation information from a Transaction object
|
|
118
|
-
* @param transaction - The Hedera Transaction object
|
|
119
|
-
* @returns Token creation data or null if not a token creation transaction
|
|
120
|
-
*/
|
|
121
116
|
private static extractTokenCreation;
|
|
122
|
-
/**
|
|
123
|
-
* Extracts token airdrop information from a Transaction object
|
|
124
|
-
* @param transaction - The Hedera Transaction object
|
|
125
|
-
* @returns Token airdrop data or null if not an airdrop transaction
|
|
126
|
-
*/
|
|
127
117
|
private static extractTokenAirdrop;
|
|
128
118
|
/**
|
|
129
119
|
* Create fallback result when all parsing methods fail
|
|
130
120
|
*/
|
|
131
121
|
private static createFallbackResult;
|
|
132
122
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Backward compatibility alias for UnifiedTransactionParser
|
|
135
|
-
* @deprecated Use TransactionParser instead
|
|
136
|
-
*/
|
|
137
|
-
export declare class UnifiedTransactionParser extends TransactionParser {
|
|
138
|
-
}
|
|
139
123
|
//# sourceMappingURL=transaction-parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-parser.d.ts","sourceRoot":"","sources":["../../../src/utils/transaction-parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,WAAW,
|
|
1
|
+
{"version":3,"file":"transaction-parser.d.ts","sourceRoot":"","sources":["../../../src/utils/transaction-parser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwB,WAAW,EAAa,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EAEL,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EAIb,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AA+BrE;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B;;;;;;;OAOG;WACU,qBAAqB,CAChC,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,iBAAiB,CAAC;IA4E7B;;;;;;;OAOG;IACH,MAAM,CAAC,sBAAsB,CAC3B,WAAW,EAAE,WAAW,EACxB,OAAO,GAAE,YAAiB,GACzB,iBAAiB;IA6GpB;;;;OAIG;IACH,MAAM,CAAC,oBAAoB,CACzB,qBAAqB,EAAE,MAAM,GAC5B,iBAAiB;IAgOpB;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,gBAAgB,EAAE;QAC7C,gBAAgB,EAAE,MAAM,CAAC;QACzB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,iBAAiB;IAuBrB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAgFjC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;IA8DnC;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM;IA6SjE;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB;IAoC3E;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK;IAI1E;;;;;OAKG;IACH,MAAM,CAAC,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,GAAG,UAAU;IAoBnE;;OAEG;WACU,wBAAwB,CACnC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,OAAO,CAAC;IAcnB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAIhC;;OAEG;mBACkB,gBAAgB;IAuLrC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,yBAAyB;IAmCxC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,0BAA0B;IAiBzC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,kCAAkC;IAqBjD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,4BAA4B;IAiC3C;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mCAAmC;IA2BlD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oCAAoC;IAqCnD,OAAO,CAAC,MAAM,CAAC,oBAAoB;IA4CnC,OAAO,CAAC,MAAM,CAAC,mBAAmB;IA4ClC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,oBAAoB;CA8BpC"}
|
|
@@ -31,7 +31,7 @@ import { createLoggerAdapter, ensureLoggerType, isConcreteLogger } from "./stand
|
|
|
31
31
|
import { accountIdsToExemptKeys } from "./standards-sdk.es32.js";
|
|
32
32
|
import { ProgressReporter } from "./standards-sdk.es33.js";
|
|
33
33
|
import { HRLResolver } from "./standards-sdk.es34.js";
|
|
34
|
-
import { TransactionParser
|
|
34
|
+
import { TransactionParser } from "./standards-sdk.es35.js";
|
|
35
35
|
import { TransactionParsingError } from "./standards-sdk.es36.js";
|
|
36
36
|
import { KeyType, KeyTypeDetector, detectKeyTypeFromString } from "./standards-sdk.es37.js";
|
|
37
37
|
import { getTopicId } from "./standards-sdk.es38.js";
|
|
@@ -133,7 +133,6 @@ export {
|
|
|
133
133
|
TopicRegistrationError,
|
|
134
134
|
TransactionParser,
|
|
135
135
|
TransactionParsingError,
|
|
136
|
-
UnifiedTransactionParser,
|
|
137
136
|
VerificationType,
|
|
138
137
|
WasmBridge,
|
|
139
138
|
accountIdsToExemptKeys,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AccountId, Client, PrivateKey, TopicMessageSubmitTransaction, TopicId, Status, TopicCreateTransaction } from "@hashgraph/sdk";
|
|
2
2
|
import { HCS20BaseClient } from "./standards-sdk.es26.js";
|
|
3
3
|
import { PointsDeploymentError, PointsValidationError, PointsTransferError, PointsBurnError } from "./standards-sdk.es25.js";
|
|
4
|
-
import { sleep } from "./standards-sdk.
|
|
4
|
+
import { sleep } from "./standards-sdk.es49.js";
|
|
5
5
|
import { detectKeyTypeFromString } from "./standards-sdk.es37.js";
|
|
6
6
|
import { HCS2Client } from "./standards-sdk.es21.js";
|
|
7
7
|
class HCS20Client extends HCS20BaseClient {
|
|
@@ -4,11 +4,11 @@ import { Hbar, Long, HbarUnit, Transaction } from "@hashgraph/sdk";
|
|
|
4
4
|
import { ethers } from "ethers";
|
|
5
5
|
import { TransactionParsingError } from "./standards-sdk.es36.js";
|
|
6
6
|
import { HTSParser } from "./standards-sdk.es39.js";
|
|
7
|
-
import { HCSParser } from "./standards-sdk.
|
|
8
|
-
import { FileParser } from "./standards-sdk.
|
|
9
|
-
import { CryptoParser } from "./standards-sdk.
|
|
10
|
-
import { SCSParser } from "./standards-sdk.
|
|
11
|
-
import { UtilParser } from "./standards-sdk.
|
|
7
|
+
import { HCSParser } from "./standards-sdk.es50.js";
|
|
8
|
+
import { FileParser } from "./standards-sdk.es51.js";
|
|
9
|
+
import { CryptoParser } from "./standards-sdk.es52.js";
|
|
10
|
+
import { SCSParser } from "./standards-sdk.es53.js";
|
|
11
|
+
import { UtilParser } from "./standards-sdk.es54.js";
|
|
12
12
|
import { ScheduleParser } from "./standards-sdk.es40.js";
|
|
13
13
|
class TransactionParser {
|
|
14
14
|
/**
|
|
@@ -98,19 +98,60 @@ class TransactionParser {
|
|
|
98
98
|
const metadata = this.extractTransactionMetadata(transaction);
|
|
99
99
|
const specificData = this.parseTransactionSpecificData(transaction);
|
|
100
100
|
const scheduleData = ScheduleParser.parseScheduleTransaction(transaction);
|
|
101
|
-
const transactionClassName = transaction.constructor.name;
|
|
102
101
|
let type = "UNKNOWN";
|
|
103
102
|
let humanReadableType = "Unknown Transaction";
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
103
|
+
try {
|
|
104
|
+
const transactionBytes = transaction.toBytes();
|
|
105
|
+
const decoded = proto.TransactionList.decode(transactionBytes);
|
|
106
|
+
if (decoded.transactionList && decoded.transactionList.length > 0) {
|
|
107
|
+
const tx = decoded.transactionList[0];
|
|
108
|
+
if (tx.signedTransactionBytes) {
|
|
109
|
+
const signedTx = proto.SignedTransaction.decode(
|
|
110
|
+
tx.signedTransactionBytes
|
|
111
|
+
);
|
|
112
|
+
if (signedTx.bodyBytes) {
|
|
113
|
+
const txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
|
|
114
|
+
if (txBody.cryptoTransfer) {
|
|
115
|
+
type = "CRYPTOTRANSFER";
|
|
116
|
+
humanReadableType = "Crypto Transfer";
|
|
117
|
+
} else if (txBody.tokenCreation) {
|
|
118
|
+
type = "TOKENCREATE";
|
|
119
|
+
humanReadableType = "Token Creation";
|
|
120
|
+
} else if (txBody.tokenAirdrop) {
|
|
121
|
+
type = "TOKENAIRDROP";
|
|
122
|
+
humanReadableType = "Token Airdrop";
|
|
123
|
+
} else if (txBody.consensusSubmitMessage) {
|
|
124
|
+
type = "CONSENSUSSUBMITMESSAGE";
|
|
125
|
+
humanReadableType = "Submit Message";
|
|
126
|
+
} else if (txBody.contractCall) {
|
|
127
|
+
type = "CONTRACTCALL";
|
|
128
|
+
humanReadableType = "Contract Call";
|
|
129
|
+
} else if (txBody.cryptoCreateAccount) {
|
|
130
|
+
type = "ACCOUNTCREATE";
|
|
131
|
+
humanReadableType = "Account Creation";
|
|
132
|
+
} else if (txBody.tokenMint) {
|
|
133
|
+
type = "TOKENMINT";
|
|
134
|
+
humanReadableType = "Token Mint";
|
|
135
|
+
} else if (txBody.tokenBurn) {
|
|
136
|
+
type = "TOKENBURN";
|
|
137
|
+
humanReadableType = "Token Burn";
|
|
138
|
+
} else if (txBody.tokenAssociate) {
|
|
139
|
+
type = "TOKENASSOCIATE";
|
|
140
|
+
humanReadableType = "Token Association";
|
|
141
|
+
} else if (txBody.fileCreate) {
|
|
142
|
+
type = "FILECREATE";
|
|
143
|
+
humanReadableType = "File Creation";
|
|
144
|
+
} else if (txBody.consensusCreateTopic) {
|
|
145
|
+
type = "TOPICCREATE";
|
|
146
|
+
humanReadableType = "Topic Creation";
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
} catch (protoError) {
|
|
152
|
+
console.warn("Failed to parse transaction protobuf:", protoError);
|
|
153
|
+
}
|
|
154
|
+
if (type === "UNKNOWN" && specificData.type) {
|
|
114
155
|
type = specificData.type;
|
|
115
156
|
humanReadableType = specificData.humanReadableType || humanReadableType;
|
|
116
157
|
}
|
|
@@ -322,7 +363,7 @@ class TransactionParser {
|
|
|
322
363
|
humanReadableType: "Unknown Transaction",
|
|
323
364
|
transfers: [],
|
|
324
365
|
tokenTransfers: [],
|
|
325
|
-
raw:
|
|
366
|
+
raw: void 0,
|
|
326
367
|
details: {
|
|
327
368
|
error: `Failed to parse transaction body: ${error instanceof Error ? error.message : String(error)}`
|
|
328
369
|
}
|
|
@@ -341,7 +382,7 @@ class TransactionParser {
|
|
|
341
382
|
humanReadableType: "Unknown Transaction",
|
|
342
383
|
transfers: [],
|
|
343
384
|
tokenTransfers: [],
|
|
344
|
-
raw:
|
|
385
|
+
raw: void 0,
|
|
345
386
|
details: {
|
|
346
387
|
error: "Schedule response missing transaction_body"
|
|
347
388
|
}
|
|
@@ -840,19 +881,60 @@ class TransactionParser {
|
|
|
840
881
|
const tokenAirdrop = this.extractTokenAirdrop(transaction);
|
|
841
882
|
const htsResult = HTSParser.parseHTSTransaction(transaction);
|
|
842
883
|
const scheduleResult = ScheduleParser.parseScheduleTransaction(transaction);
|
|
843
|
-
const transactionClassName = transaction.constructor.name;
|
|
844
884
|
let transactionType = "UNKNOWN";
|
|
845
885
|
let humanReadableType = "Unknown Transaction";
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
886
|
+
try {
|
|
887
|
+
const transactionBytes2 = transaction.toBytes();
|
|
888
|
+
const decoded = proto.TransactionList.decode(transactionBytes2);
|
|
889
|
+
if (decoded.transactionList && decoded.transactionList.length > 0) {
|
|
890
|
+
const tx = decoded.transactionList[0];
|
|
891
|
+
if (tx.signedTransactionBytes) {
|
|
892
|
+
const signedTx = proto.SignedTransaction.decode(
|
|
893
|
+
tx.signedTransactionBytes
|
|
894
|
+
);
|
|
895
|
+
if (signedTx.bodyBytes) {
|
|
896
|
+
const txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
|
|
897
|
+
if (txBody.cryptoTransfer) {
|
|
898
|
+
transactionType = "CRYPTOTRANSFER";
|
|
899
|
+
humanReadableType = "Crypto Transfer";
|
|
900
|
+
} else if (txBody.tokenCreation) {
|
|
901
|
+
transactionType = "TOKENCREATE";
|
|
902
|
+
humanReadableType = "Token Creation";
|
|
903
|
+
} else if (txBody.tokenAirdrop) {
|
|
904
|
+
transactionType = "TOKENAIRDROP";
|
|
905
|
+
humanReadableType = "Token Airdrop";
|
|
906
|
+
} else if (txBody.consensusSubmitMessage) {
|
|
907
|
+
transactionType = "CONSENSUSSUBMITMESSAGE";
|
|
908
|
+
humanReadableType = "Submit Message";
|
|
909
|
+
} else if (txBody.contractCall) {
|
|
910
|
+
transactionType = "CONTRACTCALL";
|
|
911
|
+
humanReadableType = "Contract Call";
|
|
912
|
+
} else if (txBody.cryptoCreateAccount) {
|
|
913
|
+
transactionType = "ACCOUNTCREATE";
|
|
914
|
+
humanReadableType = "Account Creation";
|
|
915
|
+
} else if (txBody.tokenMint) {
|
|
916
|
+
transactionType = "TOKENMINT";
|
|
917
|
+
humanReadableType = "Token Mint";
|
|
918
|
+
} else if (txBody.tokenBurn) {
|
|
919
|
+
transactionType = "TOKENBURN";
|
|
920
|
+
humanReadableType = "Token Burn";
|
|
921
|
+
} else if (txBody.tokenAssociate) {
|
|
922
|
+
transactionType = "TOKENASSOCIATE";
|
|
923
|
+
humanReadableType = "Token Association";
|
|
924
|
+
} else if (txBody.fileCreate) {
|
|
925
|
+
transactionType = "FILECREATE";
|
|
926
|
+
humanReadableType = "File Creation";
|
|
927
|
+
} else if (txBody.consensusCreateTopic) {
|
|
928
|
+
transactionType = "TOPICCREATE";
|
|
929
|
+
humanReadableType = "Topic Creation";
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
} catch (protoError) {
|
|
935
|
+
console.warn("Failed to parse transaction protobuf:", protoError);
|
|
936
|
+
}
|
|
937
|
+
if (transactionType === "UNKNOWN") {
|
|
856
938
|
transactionType = htsResult.type || scheduleResult.type || "UNKNOWN";
|
|
857
939
|
humanReadableType = htsResult.humanReadableType || scheduleResult.humanReadableType || "Unknown Transaction";
|
|
858
940
|
if (!transactionType || transactionType === "UNKNOWN") {
|
|
@@ -949,7 +1031,7 @@ class TransactionParser {
|
|
|
949
1031
|
const enhancedResult = {
|
|
950
1032
|
...parsedTx,
|
|
951
1033
|
details: {
|
|
952
|
-
...parsedTx.details,
|
|
1034
|
+
...parsedTx.details || {},
|
|
953
1035
|
parseMethod: "scheduled",
|
|
954
1036
|
validation,
|
|
955
1037
|
parseAttempts: parsedTx.details?.parseAttempts || 1
|
|
@@ -1072,51 +1154,34 @@ class TransactionParser {
|
|
|
1072
1154
|
}
|
|
1073
1155
|
return tokenTransfers;
|
|
1074
1156
|
}
|
|
1075
|
-
/**
|
|
1076
|
-
* Extracts token creation information from a Transaction object
|
|
1077
|
-
* @param transaction - The Hedera Transaction object
|
|
1078
|
-
* @returns Token creation data or null if not a token creation transaction
|
|
1079
|
-
*/
|
|
1080
1157
|
static extractTokenCreation(transaction) {
|
|
1081
1158
|
try {
|
|
1082
|
-
const
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
name: name || "Unknown Token",
|
|
1109
|
-
symbol: symbol || "UNKNOWN",
|
|
1110
|
-
initialSupply: initialSupplyValue,
|
|
1111
|
-
decimals: decimalsValue,
|
|
1112
|
-
maxSupply: maxSupplyValue,
|
|
1113
|
-
tokenType: (tx._tokenType || tx.tokenType)?.toString?.() || (tx._tokenType || tx.tokenType)?._code || tx._tokenType || tx.tokenType || "FUNGIBLE_COMMON",
|
|
1114
|
-
supplyType: (tx._supplyType || tx.supplyType)?.toString?.() || (tx._supplyType || tx.supplyType)?._code || tx._supplyType || tx.supplyType || "INFINITE",
|
|
1115
|
-
memo: tx._tokenMemo || tx.tokenMemo || "",
|
|
1116
|
-
treasuryAccountId: (tx._treasuryAccountId || tx.treasuryAccountId)?.toString() || "Unknown",
|
|
1117
|
-
autoRenewPeriod: (tx._autoRenewPeriod || tx.autoRenewPeriod)?.toString(),
|
|
1118
|
-
expirationTime: (tx._expirationTime || tx.expirationTime)?.toString()
|
|
1119
|
-
};
|
|
1159
|
+
const transactionBytes = transaction.toBytes();
|
|
1160
|
+
const decoded = proto.TransactionList.decode(transactionBytes);
|
|
1161
|
+
if (decoded.transactionList && decoded.transactionList.length > 0) {
|
|
1162
|
+
const tx = decoded.transactionList[0];
|
|
1163
|
+
if (tx.signedTransactionBytes) {
|
|
1164
|
+
const signedTx = proto.SignedTransaction.decode(
|
|
1165
|
+
tx.signedTransactionBytes
|
|
1166
|
+
);
|
|
1167
|
+
if (signedTx.bodyBytes) {
|
|
1168
|
+
const txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
|
|
1169
|
+
if (txBody.tokenCreation) {
|
|
1170
|
+
const tokenCreation = txBody.tokenCreation;
|
|
1171
|
+
return {
|
|
1172
|
+
tokenName: tokenCreation.name || "Unknown Token",
|
|
1173
|
+
tokenSymbol: tokenCreation.symbol || "UNKNOWN",
|
|
1174
|
+
initialSupply: tokenCreation.initialSupply?.toString() || "0",
|
|
1175
|
+
decimals: Number(tokenCreation.decimals || 0),
|
|
1176
|
+
maxSupply: tokenCreation.maxSupply?.toString(),
|
|
1177
|
+
tokenType: tokenCreation.tokenType || "FUNGIBLE_COMMON",
|
|
1178
|
+
supplyType: tokenCreation.supplyType || "INFINITE",
|
|
1179
|
+
tokenMemo: tokenCreation.memo || "",
|
|
1180
|
+
treasuryAccountId: tokenCreation.treasury?.toString() || "Unknown"
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1120
1185
|
}
|
|
1121
1186
|
return null;
|
|
1122
1187
|
} catch (error) {
|
|
@@ -1126,41 +1191,36 @@ class TransactionParser {
|
|
|
1126
1191
|
return null;
|
|
1127
1192
|
}
|
|
1128
1193
|
}
|
|
1129
|
-
/**
|
|
1130
|
-
* Extracts token airdrop information from a Transaction object
|
|
1131
|
-
* @param transaction - The Hedera Transaction object
|
|
1132
|
-
* @returns Token airdrop data or null if not an airdrop transaction
|
|
1133
|
-
*/
|
|
1134
1194
|
static extractTokenAirdrop(transaction) {
|
|
1135
1195
|
try {
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1196
|
+
const transactionBytes = transaction.toBytes();
|
|
1197
|
+
const decoded = proto.TransactionList.decode(transactionBytes);
|
|
1198
|
+
if (decoded.transactionList && decoded.transactionList.length > 0) {
|
|
1199
|
+
const tx = decoded.transactionList[0];
|
|
1200
|
+
if (tx.signedTransactionBytes) {
|
|
1201
|
+
const signedTx = proto.SignedTransaction.decode(
|
|
1202
|
+
tx.signedTransactionBytes
|
|
1203
|
+
);
|
|
1204
|
+
if (signedTx.bodyBytes) {
|
|
1205
|
+
const txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
|
|
1206
|
+
if (txBody.tokenAirdrop) {
|
|
1207
|
+
const airdrop = txBody.tokenAirdrop;
|
|
1208
|
+
const tokenTransfers = airdrop.tokenTransfers || [];
|
|
1209
|
+
return {
|
|
1210
|
+
tokenTransfers: tokenTransfers.map(
|
|
1211
|
+
(transfer) => ({
|
|
1212
|
+
tokenId: transfer.token?.toString() || "Unknown",
|
|
1213
|
+
transfers: (transfer.transfers || []).map(
|
|
1214
|
+
(t) => ({
|
|
1215
|
+
accountId: t.accountID?.toString() || "Unknown",
|
|
1216
|
+
amount: t.amount?.toString() || "0"
|
|
1217
|
+
})
|
|
1218
|
+
)
|
|
1219
|
+
})
|
|
1220
|
+
)
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1164
1224
|
}
|
|
1165
1225
|
}
|
|
1166
1226
|
return null;
|
|
@@ -1194,11 +1254,8 @@ class TransactionParser {
|
|
|
1194
1254
|
};
|
|
1195
1255
|
}
|
|
1196
1256
|
}
|
|
1197
|
-
class UnifiedTransactionParser extends TransactionParser {
|
|
1198
|
-
}
|
|
1199
1257
|
export {
|
|
1200
1258
|
TransactionParser,
|
|
1201
|
-
TransactionParsingError
|
|
1202
|
-
UnifiedTransactionParser
|
|
1259
|
+
TransactionParsingError
|
|
1203
1260
|
};
|
|
1204
1261
|
//# sourceMappingURL=standards-sdk.es35.js.map
|