@hashgraphonline/standards-sdk 0.0.174 → 0.0.176
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-xQfUfn20.cjs → index-DBI7RYzm.cjs} +19 -19
- package/dist/cjs/{index-xQfUfn20.cjs.map → index-DBI7RYzm.cjs.map} +1 -1
- package/dist/cjs/{index-DNOBUKZd-g0uNa1rQ.cjs → index-DNOBUKZd-PuaZE8zI.cjs} +2 -2
- package/dist/cjs/{index-DNOBUKZd-g0uNa1rQ.cjs.map → index-DNOBUKZd-PuaZE8zI.cjs.map} +1 -1
- package/dist/cjs/standards-sdk.cjs +1 -1
- package/dist/cjs/{standards-sdk.es47-LpJXpYet-fj1bqMZs.cjs → standards-sdk.es47-LpJXpYet-Dn0a_M7H.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es47-LpJXpYet-fj1bqMZs.cjs.map → standards-sdk.es47-LpJXpYet-Dn0a_M7H.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es48-PT6ZHlCU-vkSluOOc.cjs → standards-sdk.es48-PT6ZHlCU-CpnblkfW.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es48-PT6ZHlCU-vkSluOOc.cjs.map → standards-sdk.es48-PT6ZHlCU-CpnblkfW.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es49-BoFc-ELK-DC0zfqT0.cjs → standards-sdk.es49-BoFc-ELK-AFqdqMBQ.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es49-BoFc-ELK-DC0zfqT0.cjs.map → standards-sdk.es49-BoFc-ELK-AFqdqMBQ.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es50-miBtNmtl-B2MpsQnf.cjs → standards-sdk.es50-miBtNmtl-BXhMfUtd.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es50-miBtNmtl-B2MpsQnf.cjs.map → standards-sdk.es50-miBtNmtl-BXhMfUtd.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es51-rS2UvvV5-CRkd1bF-.cjs → standards-sdk.es51-rS2UvvV5-Bh2x7xrp.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es51-rS2UvvV5-CRkd1bF-.cjs.map → standards-sdk.es51-rS2UvvV5-Bh2x7xrp.cjs.map} +1 -1
- package/dist/cjs/{standards-sdk.es52-D-lvSMBY-DdUJIqZX.cjs → standards-sdk.es52-D-lvSMBY-DvI5ClIb.cjs} +2 -2
- package/dist/cjs/{standards-sdk.es52-D-lvSMBY-DdUJIqZX.cjs.map → standards-sdk.es52-D-lvSMBY-DvI5ClIb.cjs.map} +1 -1
- package/dist/cjs/utils/parsers/crypto-parser.d.ts +37 -0
- package/dist/cjs/utils/parsers/crypto-parser.d.ts.map +1 -1
- package/dist/cjs/utils/parsers/file-parser.d.ts +46 -0
- package/dist/cjs/utils/parsers/file-parser.d.ts.map +1 -1
- package/dist/cjs/utils/parsers/hcs-parser.d.ts +10 -0
- package/dist/cjs/utils/parsers/hcs-parser.d.ts.map +1 -1
- package/dist/cjs/utils/parsers/hts-parser.d.ts +23 -5
- package/dist/cjs/utils/parsers/hts-parser.d.ts.map +1 -1
- package/dist/cjs/utils/parsers/parser-utils.d.ts +11 -0
- package/dist/cjs/utils/parsers/parser-utils.d.ts.map +1 -1
- package/dist/cjs/utils/parsers/schedule-parser.d.ts +56 -11
- package/dist/cjs/utils/parsers/schedule-parser.d.ts.map +1 -1
- package/dist/cjs/utils/parsers/scs-parser.d.ts +51 -0
- package/dist/cjs/utils/parsers/scs-parser.d.ts.map +1 -1
- package/dist/cjs/utils/parsers/util-parser.d.ts +72 -1
- package/dist/cjs/utils/parsers/util-parser.d.ts.map +1 -1
- package/dist/cjs/utils/transaction-parser-types.d.ts +60 -0
- package/dist/cjs/utils/transaction-parser-types.d.ts.map +1 -1
- package/dist/cjs/utils/transaction-parser.d.ts +16 -14
- package/dist/cjs/utils/transaction-parser.d.ts.map +1 -1
- package/dist/es/standards-sdk.es35.js +388 -387
- package/dist/es/standards-sdk.es35.js.map +1 -1
- package/dist/es/standards-sdk.es36.js.map +1 -1
- package/dist/es/standards-sdk.es39.js +385 -18
- package/dist/es/standards-sdk.es39.js.map +1 -1
- package/dist/es/standards-sdk.es40.js +209 -86
- package/dist/es/standards-sdk.es40.js.map +1 -1
- package/dist/es/standards-sdk.es50.js +55 -0
- package/dist/es/standards-sdk.es50.js.map +1 -1
- package/dist/es/standards-sdk.es51.js +249 -1
- package/dist/es/standards-sdk.es51.js.map +1 -1
- package/dist/es/standards-sdk.es52.js +90 -0
- package/dist/es/standards-sdk.es52.js.map +1 -1
- package/dist/es/standards-sdk.es53.js +268 -9
- package/dist/es/standards-sdk.es53.js.map +1 -1
- package/dist/es/standards-sdk.es54.js +306 -0
- package/dist/es/standards-sdk.es54.js.map +1 -1
- package/dist/es/standards-sdk.es55.js +32 -0
- package/dist/es/standards-sdk.es55.js.map +1 -1
- package/dist/es/utils/parsers/crypto-parser.d.ts +37 -0
- package/dist/es/utils/parsers/crypto-parser.d.ts.map +1 -1
- package/dist/es/utils/parsers/file-parser.d.ts +46 -0
- package/dist/es/utils/parsers/file-parser.d.ts.map +1 -1
- package/dist/es/utils/parsers/hcs-parser.d.ts +10 -0
- package/dist/es/utils/parsers/hcs-parser.d.ts.map +1 -1
- package/dist/es/utils/parsers/hts-parser.d.ts +23 -5
- package/dist/es/utils/parsers/hts-parser.d.ts.map +1 -1
- package/dist/es/utils/parsers/parser-utils.d.ts +11 -0
- package/dist/es/utils/parsers/parser-utils.d.ts.map +1 -1
- package/dist/es/utils/parsers/schedule-parser.d.ts +56 -11
- package/dist/es/utils/parsers/schedule-parser.d.ts.map +1 -1
- package/dist/es/utils/parsers/scs-parser.d.ts +51 -0
- package/dist/es/utils/parsers/scs-parser.d.ts.map +1 -1
- package/dist/es/utils/parsers/util-parser.d.ts +72 -1
- package/dist/es/utils/parsers/util-parser.d.ts.map +1 -1
- package/dist/es/utils/transaction-parser-types.d.ts +60 -0
- package/dist/es/utils/transaction-parser-types.d.ts.map +1 -1
- package/dist/es/utils/transaction-parser.d.ts +16 -14
- package/dist/es/utils/transaction-parser.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/utils/__tests__/hts-parser.test.d.ts +0 -2
- package/dist/cjs/utils/__tests__/hts-parser.test.d.ts.map +0 -1
- package/dist/cjs/utils/__tests__/schedule-parser.test.d.ts +0 -2
- package/dist/cjs/utils/__tests__/schedule-parser.test.d.ts.map +0 -1
- package/dist/cjs/utils/__tests__/token-create-parsing.test.d.ts +0 -2
- package/dist/cjs/utils/__tests__/token-create-parsing.test.d.ts.map +0 -1
- package/dist/cjs/utils/__tests__/transaction-parser.test.d.ts +0 -2
- package/dist/cjs/utils/__tests__/transaction-parser.test.d.ts.map +0 -1
- package/dist/es/utils/__tests__/hts-parser.test.d.ts +0 -2
- package/dist/es/utils/__tests__/hts-parser.test.d.ts.map +0 -1
- package/dist/es/utils/__tests__/schedule-parser.test.d.ts +0 -2
- package/dist/es/utils/__tests__/schedule-parser.test.d.ts.map +0 -1
- package/dist/es/utils/__tests__/token-create-parsing.test.d.ts +0 -2
- package/dist/es/utils/__tests__/token-create-parsing.test.d.ts.map +0 -1
- package/dist/es/utils/__tests__/transaction-parser.test.d.ts +0 -2
- package/dist/es/utils/__tests__/transaction-parser.test.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { proto } from "@hashgraph/proto";
|
|
2
2
|
import { AccountId, Long, TokenId } from "@hashgraph/sdk";
|
|
3
|
-
import { parseKey } from "./standards-sdk.es55.js";
|
|
3
|
+
import { parseKey, hasTransactionType, extractTransactionBody } from "./standards-sdk.es55.js";
|
|
4
4
|
import { Buffer } from "buffer";
|
|
5
5
|
class HTSParser {
|
|
6
6
|
/**
|
|
@@ -713,23 +713,26 @@ class HTSParser {
|
|
|
713
713
|
)
|
|
714
714
|
};
|
|
715
715
|
}
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
if (tokenTransfersList.length > 0) {
|
|
721
|
-
return {
|
|
722
|
-
tokenTransfers: tokenTransfersList.map((transfer) => ({
|
|
723
|
-
tokenId: transfer.tokenId?.toString() || "Unknown",
|
|
724
|
-
transfers: (transfer.transfers || []).map((t) => ({
|
|
725
|
-
accountId: t.accountId?.toString() || "Unknown",
|
|
726
|
-
amount: t.amount?.toString() || "0",
|
|
727
|
-
serialNumbers: t.serialNumbers?.map((sn) => sn.toString())
|
|
728
|
-
}))
|
|
729
|
-
}))
|
|
730
|
-
};
|
|
716
|
+
if (hasTransactionType(transaction, "tokenAirdrop")) {
|
|
717
|
+
const txBody = extractTransactionBody(transaction);
|
|
718
|
+
if (txBody?.tokenAirdrop) {
|
|
719
|
+
return this.parseTokenAirdropFromProto(txBody.tokenAirdrop);
|
|
731
720
|
}
|
|
732
721
|
}
|
|
722
|
+
const tx = transaction;
|
|
723
|
+
const tokenTransfersList = tx._tokenTransfers || [];
|
|
724
|
+
if (tokenTransfersList.length > 0) {
|
|
725
|
+
return {
|
|
726
|
+
tokenTransfers: tokenTransfersList.map((transfer) => ({
|
|
727
|
+
tokenId: transfer.tokenId?.toString() || "Unknown",
|
|
728
|
+
transfers: (transfer.transfers || []).map((t) => ({
|
|
729
|
+
accountId: t.accountId?.toString() || "Unknown",
|
|
730
|
+
amount: t.amount?.toString() || "0",
|
|
731
|
+
serialNumbers: t.serialNumbers?.map((sn) => sn.toString())
|
|
732
|
+
}))
|
|
733
|
+
}))
|
|
734
|
+
};
|
|
735
|
+
}
|
|
733
736
|
return null;
|
|
734
737
|
} catch (error) {
|
|
735
738
|
console.warn("[HTSParser] Failed to parse token airdrop:", error);
|
|
@@ -743,11 +746,19 @@ class HTSParser {
|
|
|
743
746
|
const tokenTransfers = [];
|
|
744
747
|
if (airdrop.tokenTransfers) {
|
|
745
748
|
for (const tokenTransfer of airdrop.tokenTransfers) {
|
|
746
|
-
const token = tokenTransfer.token ? TokenId
|
|
749
|
+
const token = tokenTransfer.token ? new TokenId(
|
|
750
|
+
tokenTransfer.token.shardNum ?? 0,
|
|
751
|
+
tokenTransfer.token.realmNum ?? 0,
|
|
752
|
+
tokenTransfer.token.tokenNum ?? 0
|
|
753
|
+
) : null;
|
|
747
754
|
const transfers = [];
|
|
748
755
|
if (tokenTransfer.transfers) {
|
|
749
756
|
for (const transfer of tokenTransfer.transfers) {
|
|
750
|
-
const accountId = transfer.accountID ? AccountId
|
|
757
|
+
const accountId = transfer.accountID ? new AccountId(
|
|
758
|
+
transfer.accountID.shardNum ?? 0,
|
|
759
|
+
transfer.accountID.realmNum ?? 0,
|
|
760
|
+
transfer.accountID.accountNum ?? 0
|
|
761
|
+
) : null;
|
|
751
762
|
transfers.push({
|
|
752
763
|
accountId: accountId?.toString() || "Unknown",
|
|
753
764
|
amount: transfer.amount ? Long.fromValue(transfer.amount).toString() : "0",
|
|
@@ -765,6 +776,362 @@ class HTSParser {
|
|
|
765
776
|
}
|
|
766
777
|
return { tokenTransfers };
|
|
767
778
|
}
|
|
779
|
+
/**
|
|
780
|
+
* Extract token creation data from Transaction object internal fields
|
|
781
|
+
* This handles the case where token creation data is stored in Transaction internals
|
|
782
|
+
*/
|
|
783
|
+
static extractTokenCreationFromTransaction(transaction) {
|
|
784
|
+
try {
|
|
785
|
+
const tx = transaction;
|
|
786
|
+
if (tx._tokenName || tx._tokenSymbol) {
|
|
787
|
+
const result = {
|
|
788
|
+
tokenName: tx._tokenName || "Unknown Token",
|
|
789
|
+
tokenSymbol: tx._tokenSymbol || "UNKNOWN",
|
|
790
|
+
initialSupply: tx._initialSupply?.toString() || "0",
|
|
791
|
+
decimals: Number(tx._decimals || 0),
|
|
792
|
+
treasuryAccountId: tx._treasuryAccountId?.toString() || "Unknown"
|
|
793
|
+
};
|
|
794
|
+
if (tx._maxSupply) {
|
|
795
|
+
result.maxSupply = tx._maxSupply.toString();
|
|
796
|
+
}
|
|
797
|
+
if (tx._tokenType) {
|
|
798
|
+
result.tokenType = tx._tokenType.toString ? tx._tokenType.toString() : String(tx._tokenType);
|
|
799
|
+
}
|
|
800
|
+
if (tx._supplyType) {
|
|
801
|
+
result.supplyType = tx._supplyType.toString ? tx._supplyType.toString() : String(tx._supplyType);
|
|
802
|
+
}
|
|
803
|
+
if (tx._tokenMemo) {
|
|
804
|
+
result.memo = tx._tokenMemo;
|
|
805
|
+
}
|
|
806
|
+
if (tx._adminKey) {
|
|
807
|
+
result.adminKey = tx._adminKey.toString();
|
|
808
|
+
}
|
|
809
|
+
if (tx._kycKey) {
|
|
810
|
+
result.kycKey = tx._kycKey.toString();
|
|
811
|
+
}
|
|
812
|
+
if (tx._freezeKey) {
|
|
813
|
+
result.freezeKey = tx._freezeKey.toString();
|
|
814
|
+
}
|
|
815
|
+
if (tx._wipeKey) {
|
|
816
|
+
result.wipeKey = tx._wipeKey.toString();
|
|
817
|
+
}
|
|
818
|
+
if (tx._supplyKey) {
|
|
819
|
+
result.supplyKey = tx._supplyKey.toString();
|
|
820
|
+
}
|
|
821
|
+
if (tx._feeScheduleKey) {
|
|
822
|
+
result.feeScheduleKey = tx._feeScheduleKey.toString();
|
|
823
|
+
}
|
|
824
|
+
if (tx._pauseKey) {
|
|
825
|
+
result.pauseKey = tx._pauseKey.toString();
|
|
826
|
+
}
|
|
827
|
+
if (tx._metadataKey) {
|
|
828
|
+
result.metadataKey = tx._metadataKey.toString();
|
|
829
|
+
}
|
|
830
|
+
if (tx._autoRenewAccountId) {
|
|
831
|
+
result.autoRenewAccount = tx._autoRenewAccountId.toString();
|
|
832
|
+
}
|
|
833
|
+
if (tx._autoRenewPeriod) {
|
|
834
|
+
result.autoRenewPeriod = tx._autoRenewPeriod.seconds?.toString() || tx._autoRenewPeriod.toString();
|
|
835
|
+
}
|
|
836
|
+
if (tx._expirationTime) {
|
|
837
|
+
result.expiry = tx._expirationTime.seconds?.toString() || tx._expirationTime.toString();
|
|
838
|
+
}
|
|
839
|
+
if (tx._customFees && Array.isArray(tx._customFees) && tx._customFees.length > 0) {
|
|
840
|
+
result.customFees = tx._customFees.map((fee) => {
|
|
841
|
+
const customFee = {
|
|
842
|
+
feeCollectorAccountId: fee.feeCollectorAccountId?.toString() || "",
|
|
843
|
+
feeType: "FIXED_FEE"
|
|
844
|
+
};
|
|
845
|
+
if (fee.fixedFee) {
|
|
846
|
+
customFee.feeType = "FIXED_FEE";
|
|
847
|
+
customFee.fixedFee = {
|
|
848
|
+
amount: fee.fixedFee.amount?.toString() || "0",
|
|
849
|
+
denominatingTokenId: fee.fixedFee.denominatingTokenId?.toString()
|
|
850
|
+
};
|
|
851
|
+
} else if (fee.fractionalFee) {
|
|
852
|
+
customFee.feeType = "FRACTIONAL_FEE";
|
|
853
|
+
customFee.fractionalFee = {
|
|
854
|
+
numerator: fee.fractionalFee.numerator?.toString() || "0",
|
|
855
|
+
denominator: fee.fractionalFee.denominator?.toString() || "1",
|
|
856
|
+
minimumAmount: fee.fractionalFee.minimumAmount?.toString() || "0",
|
|
857
|
+
maximumAmount: fee.fractionalFee.maximumAmount?.toString() || "0",
|
|
858
|
+
netOfTransfers: fee.fractionalFee.netOfTransfers || false
|
|
859
|
+
};
|
|
860
|
+
} else if (fee.royaltyFee) {
|
|
861
|
+
customFee.feeType = "ROYALTY_FEE";
|
|
862
|
+
customFee.royaltyFee = {
|
|
863
|
+
numerator: fee.royaltyFee.numerator?.toString() || "0",
|
|
864
|
+
denominator: fee.royaltyFee.denominator?.toString() || "1",
|
|
865
|
+
fallbackFee: fee.royaltyFee.fallbackFee ? {
|
|
866
|
+
amount: fee.royaltyFee.fallbackFee.amount?.toString() || "0",
|
|
867
|
+
denominatingTokenId: fee.royaltyFee.fallbackFee.denominatingTokenId?.toString()
|
|
868
|
+
} : void 0
|
|
869
|
+
};
|
|
870
|
+
}
|
|
871
|
+
customFee.allCollectorsAreExempt = fee.allCollectorsAreExempt || false;
|
|
872
|
+
return customFee;
|
|
873
|
+
});
|
|
874
|
+
}
|
|
875
|
+
return result;
|
|
876
|
+
}
|
|
877
|
+
return null;
|
|
878
|
+
} catch (error) {
|
|
879
|
+
return null;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
/**
|
|
883
|
+
* Extract token airdrop data from Transaction object internal fields
|
|
884
|
+
* This handles the case where airdrop data is stored in Transaction internals
|
|
885
|
+
*/
|
|
886
|
+
static extractTokenAirdropFromTransaction(transaction) {
|
|
887
|
+
try {
|
|
888
|
+
const tx = transaction;
|
|
889
|
+
if (tx._tokenAirdrops && Array.isArray(tx._tokenAirdrops)) {
|
|
890
|
+
const tokenTransfers = tx._tokenAirdrops.map((airdrop) => ({
|
|
891
|
+
tokenId: airdrop.tokenId?.toString() || "Unknown",
|
|
892
|
+
transfers: (airdrop.transfers || []).map((transfer) => ({
|
|
893
|
+
accountId: transfer.accountId?.toString() || "Unknown",
|
|
894
|
+
amount: transfer.amount?.toString() || "0",
|
|
895
|
+
serialNumbers: transfer.serialNumbers?.map((s) => s.toString()) || []
|
|
896
|
+
}))
|
|
897
|
+
}));
|
|
898
|
+
return { tokenTransfers };
|
|
899
|
+
}
|
|
900
|
+
return null;
|
|
901
|
+
} catch (error) {
|
|
902
|
+
return null;
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Parse HTS transaction from Transaction object with comprehensive extraction
|
|
907
|
+
* This is the unified entry point that handles both protobuf and internal field extraction
|
|
908
|
+
*/
|
|
909
|
+
static parseFromTransactionObject(transaction) {
|
|
910
|
+
try {
|
|
911
|
+
try {
|
|
912
|
+
const bytes = transaction.toBytes ? transaction.toBytes() : void 0;
|
|
913
|
+
if (bytes) {
|
|
914
|
+
const decoded = proto.TransactionList.decode(bytes);
|
|
915
|
+
if (decoded.transactionList && decoded.transactionList.length > 0) {
|
|
916
|
+
const tx = decoded.transactionList[0];
|
|
917
|
+
let txBody = null;
|
|
918
|
+
if (tx.bodyBytes && tx.bodyBytes.length > 0) {
|
|
919
|
+
txBody = proto.TransactionBody.decode(tx.bodyBytes);
|
|
920
|
+
} else if (tx.signedTransactionBytes && tx.signedTransactionBytes.length > 0) {
|
|
921
|
+
const signedTx = proto.SignedTransaction.decode(
|
|
922
|
+
tx.signedTransactionBytes
|
|
923
|
+
);
|
|
924
|
+
if (signedTx.bodyBytes) {
|
|
925
|
+
txBody = proto.TransactionBody.decode(signedTx.bodyBytes);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
if (txBody) {
|
|
929
|
+
if (txBody.tokenCreation) {
|
|
930
|
+
const tokenCreation2 = this.parseTokenCreate(txBody.tokenCreation);
|
|
931
|
+
if (tokenCreation2) {
|
|
932
|
+
return {
|
|
933
|
+
type: "TOKENCREATE",
|
|
934
|
+
humanReadableType: "Token Creation",
|
|
935
|
+
tokenCreation: tokenCreation2
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
if (txBody.tokenMint) {
|
|
940
|
+
const tokenMint = this.parseTokenMint(txBody.tokenMint);
|
|
941
|
+
if (tokenMint) {
|
|
942
|
+
return {
|
|
943
|
+
type: "TOKENMINT",
|
|
944
|
+
humanReadableType: "Token Mint",
|
|
945
|
+
tokenMint
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
if (txBody.tokenBurn) {
|
|
950
|
+
const tokenBurn = this.parseTokenBurn(txBody.tokenBurn);
|
|
951
|
+
if (tokenBurn) {
|
|
952
|
+
return {
|
|
953
|
+
type: "TOKENBURN",
|
|
954
|
+
humanReadableType: "Token Burn",
|
|
955
|
+
tokenBurn
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
if (txBody.tokenUpdate) {
|
|
960
|
+
const tokenUpdate = this.parseTokenUpdate(txBody.tokenUpdate);
|
|
961
|
+
if (tokenUpdate) {
|
|
962
|
+
return {
|
|
963
|
+
type: "TOKENUPDATE",
|
|
964
|
+
humanReadableType: "Token Update",
|
|
965
|
+
tokenUpdate
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
if (txBody.tokenFreeze) {
|
|
970
|
+
const tokenFreeze = this.parseTokenFreeze(txBody.tokenFreeze);
|
|
971
|
+
if (tokenFreeze) {
|
|
972
|
+
return {
|
|
973
|
+
type: "TOKENFREEZE",
|
|
974
|
+
humanReadableType: "Token Freeze",
|
|
975
|
+
tokenFreeze
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
if (txBody.tokenUnfreeze) {
|
|
980
|
+
const tokenUnfreeze = this.parseTokenUnfreeze(
|
|
981
|
+
txBody.tokenUnfreeze
|
|
982
|
+
);
|
|
983
|
+
if (tokenUnfreeze) {
|
|
984
|
+
return {
|
|
985
|
+
type: "TOKENUNFREEZE",
|
|
986
|
+
humanReadableType: "Token Unfreeze",
|
|
987
|
+
tokenUnfreeze
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
if (txBody.tokenGrantKyc) {
|
|
992
|
+
const tokenGrantKyc = this.parseTokenGrantKyc(
|
|
993
|
+
txBody.tokenGrantKyc
|
|
994
|
+
);
|
|
995
|
+
if (tokenGrantKyc) {
|
|
996
|
+
return {
|
|
997
|
+
type: "TOKENGRANTKYC",
|
|
998
|
+
humanReadableType: "Token Grant KYC",
|
|
999
|
+
tokenGrantKyc
|
|
1000
|
+
};
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
if (txBody.tokenRevokeKyc) {
|
|
1004
|
+
const tokenRevokeKyc = this.parseTokenRevokeKyc(
|
|
1005
|
+
txBody.tokenRevokeKyc
|
|
1006
|
+
);
|
|
1007
|
+
if (tokenRevokeKyc) {
|
|
1008
|
+
return {
|
|
1009
|
+
type: "TOKENREVOKEKYC",
|
|
1010
|
+
humanReadableType: "Token Revoke KYC",
|
|
1011
|
+
tokenRevokeKyc
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
if (txBody.tokenPause) {
|
|
1016
|
+
const tokenPause = this.parseTokenPause(txBody.tokenPause);
|
|
1017
|
+
if (tokenPause) {
|
|
1018
|
+
return {
|
|
1019
|
+
type: "TOKENPAUSE",
|
|
1020
|
+
humanReadableType: "Token Pause",
|
|
1021
|
+
tokenPause
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
if (txBody.tokenUnpause) {
|
|
1026
|
+
const tokenUnpause = this.parseTokenUnpause(txBody.tokenUnpause);
|
|
1027
|
+
if (tokenUnpause) {
|
|
1028
|
+
return {
|
|
1029
|
+
type: "TOKENUNPAUSE",
|
|
1030
|
+
humanReadableType: "Token Unpause",
|
|
1031
|
+
tokenUnpause
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
if (txBody.tokenWipe) {
|
|
1036
|
+
const tokenWipeAccount = this.parseTokenWipeAccount(
|
|
1037
|
+
txBody.tokenWipe
|
|
1038
|
+
);
|
|
1039
|
+
if (tokenWipeAccount) {
|
|
1040
|
+
return {
|
|
1041
|
+
type: "TOKENWIPEACCOUNT",
|
|
1042
|
+
humanReadableType: "Token Wipe Account",
|
|
1043
|
+
tokenWipeAccount
|
|
1044
|
+
};
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if (txBody.tokenDeletion) {
|
|
1048
|
+
const tokenDelete = this.parseTokenDelete(txBody.tokenDeletion);
|
|
1049
|
+
if (tokenDelete) {
|
|
1050
|
+
return {
|
|
1051
|
+
type: "TOKENDELETE",
|
|
1052
|
+
humanReadableType: "Token Delete",
|
|
1053
|
+
tokenDelete
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
if (txBody.tokenAssociate) {
|
|
1058
|
+
const tokenAssociate = this.parseTokenAssociate(
|
|
1059
|
+
txBody.tokenAssociate
|
|
1060
|
+
);
|
|
1061
|
+
if (tokenAssociate) {
|
|
1062
|
+
return {
|
|
1063
|
+
type: "TOKENASSOCIATE",
|
|
1064
|
+
humanReadableType: "Token Associate",
|
|
1065
|
+
tokenAssociate
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
if (txBody.tokenDissociate) {
|
|
1070
|
+
const tokenDissociate = this.parseTokenDissociate(
|
|
1071
|
+
txBody.tokenDissociate
|
|
1072
|
+
);
|
|
1073
|
+
if (tokenDissociate) {
|
|
1074
|
+
return {
|
|
1075
|
+
type: "TOKENDISSOCIATE",
|
|
1076
|
+
humanReadableType: "Token Dissociate",
|
|
1077
|
+
tokenDissociate
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (txBody.tokenFeeScheduleUpdate) {
|
|
1082
|
+
const tokenFeeScheduleUpdate = this.parseTokenFeeScheduleUpdate(
|
|
1083
|
+
txBody.tokenFeeScheduleUpdate
|
|
1084
|
+
);
|
|
1085
|
+
if (tokenFeeScheduleUpdate) {
|
|
1086
|
+
return {
|
|
1087
|
+
type: "TOKENFEESCHEDULEUPDATE",
|
|
1088
|
+
humanReadableType: "Token Fee Schedule Update",
|
|
1089
|
+
tokenFeeScheduleUpdate
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
if (txBody.tokenAirdrop) {
|
|
1094
|
+
const tokenAirdrop2 = this.parseTokenAirdropFromProto(
|
|
1095
|
+
txBody.tokenAirdrop
|
|
1096
|
+
);
|
|
1097
|
+
if (tokenAirdrop2) {
|
|
1098
|
+
return {
|
|
1099
|
+
type: "TOKENAIRDROP",
|
|
1100
|
+
humanReadableType: "Token Airdrop",
|
|
1101
|
+
tokenAirdrop: tokenAirdrop2
|
|
1102
|
+
};
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
} catch (e) {
|
|
1109
|
+
}
|
|
1110
|
+
const protoResult = this.parseHTSTransaction(transaction);
|
|
1111
|
+
if (protoResult.type) {
|
|
1112
|
+
return protoResult;
|
|
1113
|
+
}
|
|
1114
|
+
const tokenCreation = this.extractTokenCreationFromTransaction(transaction);
|
|
1115
|
+
const tokenAirdrop = this.extractTokenAirdropFromTransaction(transaction);
|
|
1116
|
+
if (tokenCreation) {
|
|
1117
|
+
return {
|
|
1118
|
+
type: "TOKENCREATE",
|
|
1119
|
+
humanReadableType: "Token Creation",
|
|
1120
|
+
tokenCreation
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1123
|
+
if (tokenAirdrop) {
|
|
1124
|
+
return {
|
|
1125
|
+
type: "TOKENAIRDROP",
|
|
1126
|
+
humanReadableType: "Token Airdrop",
|
|
1127
|
+
tokenAirdrop
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
return {};
|
|
1131
|
+
} catch (error) {
|
|
1132
|
+
return {};
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
768
1135
|
}
|
|
769
1136
|
export {
|
|
770
1137
|
HTSParser
|