@hiero-ledger/sdk 2.72.0 → 2.73.1
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/umd.js +648 -338
- package/dist/umd.min.js +16 -15
- package/lib/EntityIdHelper.cjs +1 -2
- package/lib/EntityIdHelper.js +1 -1
- package/lib/EntityIdHelper.js.map +1 -1
- package/lib/EthereumFlow.cjs +1 -2
- package/lib/EthereumTransaction.cjs +1 -2
- package/lib/EthereumTransactionDataEip1559.cjs +1 -2
- package/lib/EthereumTransactionDataEip1559.js +1 -1
- package/lib/EthereumTransactionDataEip1559.js.map +1 -1
- package/lib/EthereumTransactionDataEip2930.cjs +1 -2
- package/lib/EthereumTransactionDataEip2930.js +1 -1
- package/lib/EthereumTransactionDataEip2930.js.map +1 -1
- package/lib/EthereumTransactionDataLegacy.cjs +1 -2
- package/lib/EthereumTransactionDataLegacy.js +1 -1
- package/lib/EthereumTransactionDataLegacy.js.map +1 -1
- package/lib/EvmAddress.cjs +1 -2
- package/lib/ExchangeRates.cjs +1 -2
- package/lib/Executable.cjs +1 -2
- package/lib/Executable.js +1 -1
- package/lib/Executable.js.map +1 -1
- package/lib/FeeComponents.cjs +1 -2
- package/lib/FeeData.cjs +1 -2
- package/lib/FeeSchedule.cjs +1 -2
- package/lib/FeeSchedule.js +1 -1
- package/lib/FeeSchedule.js.map +1 -1
- package/lib/FeeSchedules.cjs +1 -2
- package/lib/KeyList.js +1 -1
- package/lib/KeyList.js.map +1 -1
- package/lib/LedgerId.cjs +1 -2
- package/lib/LocalProviderWeb.cjs +165 -0
- package/lib/LocalProviderWeb.d.ts +127 -0
- package/lib/LocalProviderWeb.js +2 -0
- package/lib/LocalProviderWeb.js.map +1 -0
- package/lib/ManagedNode.js +1 -1
- package/lib/ManagedNode.js.map +1 -1
- package/lib/ObjectMap.js +1 -1
- package/lib/ObjectMap.js.map +1 -1
- package/lib/PrivateKey.js +1 -1
- package/lib/PrivateKey.js.map +1 -1
- package/lib/PrngTransaction.cjs +1 -2
- package/lib/PublicKey.js +1 -1
- package/lib/PublicKey.js.map +1 -1
- package/lib/StakingInfo.cjs +1 -2
- package/lib/Timestamp.js.map +1 -1
- package/lib/TransactionFeeSchedule.cjs +1 -2
- package/lib/TransactionFeeSchedule.js +1 -1
- package/lib/TransactionFeeSchedule.js.map +1 -1
- package/lib/Wallet.cjs +1 -2
- package/lib/Wallet.js +1 -1
- package/lib/Wallet.js.map +1 -1
- package/lib/account/AccountAllowanceAdjustTransaction.cjs +1 -2
- package/lib/account/AccountAllowanceAdjustTransaction.js +1 -1
- package/lib/account/AccountAllowanceAdjustTransaction.js.map +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.cjs +1 -2
- package/lib/account/AccountAllowanceApproveTransaction.js +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -1
- package/lib/account/AccountAllowanceDeleteTransaction.cjs +1 -2
- package/lib/account/AccountAllowanceDeleteTransaction.js +1 -1
- package/lib/account/AccountAllowanceDeleteTransaction.js.map +1 -1
- package/lib/account/AccountBalance.cjs +1 -2
- package/lib/account/AccountBalanceQuery.cjs +1 -2
- package/lib/account/AccountCreateTransaction.cjs +1 -2
- package/lib/account/AccountDeleteTransaction.cjs +1 -2
- package/lib/account/AccountId.cjs +1 -2
- package/lib/account/AccountId.js +1 -1
- package/lib/account/AccountId.js.map +1 -1
- package/lib/account/AccountInfo.cjs +1 -2
- package/lib/account/AccountInfo.js +1 -1
- package/lib/account/AccountInfo.js.map +1 -1
- package/lib/account/AccountInfoQuery.cjs +1 -2
- package/lib/account/AccountRecordsQuery.cjs +1 -2
- package/lib/account/AccountRecordsQuery.js +1 -1
- package/lib/account/AccountRecordsQuery.js.map +1 -1
- package/lib/account/AccountUpdateTransaction.cjs +1 -2
- package/lib/account/HbarTransferMap.js +1 -1
- package/lib/account/HbarTransferMap.js.map +1 -1
- package/lib/account/LiveHashAddTransaction.cjs +1 -2
- package/lib/account/LiveHashAddTransaction.js +1 -1
- package/lib/account/LiveHashAddTransaction.js.map +1 -1
- package/lib/account/LiveHashDeleteTransaction.cjs +1 -2
- package/lib/account/LiveHashQuery.cjs +1 -2
- package/lib/account/NullableTokenDecimalMap.js +1 -1
- package/lib/account/NullableTokenDecimalMap.js.map +1 -1
- package/lib/account/TokenBalanceMap.js +1 -1
- package/lib/account/TokenBalanceMap.js.map +1 -1
- package/lib/account/TokenDecimalMap.js +1 -1
- package/lib/account/TokenDecimalMap.js.map +1 -1
- package/lib/account/TokenNftAllowance.js +1 -1
- package/lib/account/TokenNftAllowance.js.map +1 -1
- package/lib/account/TokenNftTransferMap.js +1 -1
- package/lib/account/TokenNftTransferMap.js.map +1 -1
- package/lib/account/TokenRelationshipMap.js +1 -1
- package/lib/account/TokenRelationshipMap.js.map +1 -1
- package/lib/account/TokenTransferAccountMap.js +1 -1
- package/lib/account/TokenTransferAccountMap.js.map +1 -1
- package/lib/account/TokenTransferMap.js +1 -1
- package/lib/account/TokenTransferMap.js.map +1 -1
- package/lib/account/TransferTransaction.cjs +1 -2
- package/lib/account/TransferTransaction.js +1 -1
- package/lib/account/TransferTransaction.js.map +1 -1
- package/lib/address_book/AddressBooks.cjs +1 -2
- package/lib/address_book/NodeAddress.cjs +1 -2
- package/lib/address_book/NodeAddress.js +1 -1
- package/lib/address_book/NodeAddress.js.map +1 -1
- package/lib/address_book/NodeAddressBook.cjs +1 -2
- package/lib/address_book/NodeAddressBook.js +1 -1
- package/lib/address_book/NodeAddressBook.js.map +1 -1
- package/lib/browser.cjs +8 -0
- package/lib/browser.d.ts +1 -0
- package/lib/browser.js +1 -1
- package/lib/channel/Channel.cjs +1 -2
- package/lib/channel/NativeChannel.cjs +1 -2
- package/lib/channel/NativeChannel.js +1 -1
- package/lib/channel/NativeChannel.js.map +1 -1
- package/lib/channel/NodeChannel.js +1 -1
- package/lib/channel/NodeChannel.js.map +1 -1
- package/lib/channel/NodeMirrorChannel.cjs +1 -2
- package/lib/channel/NodeMirrorChannel.js +1 -1
- package/lib/channel/NodeMirrorChannel.js.map +1 -1
- package/lib/channel/WebChannel.cjs +1 -2
- package/lib/client/Client.js +1 -1
- package/lib/client/Client.js.map +1 -1
- package/lib/client/ManagedNetwork.cjs +1 -2
- package/lib/client/ManagedNetwork.js +1 -1
- package/lib/client/ManagedNetwork.js.map +1 -1
- package/lib/client/MirrorNetwork.js +1 -1
- package/lib/client/MirrorNetwork.js.map +1 -1
- package/lib/client/NativeClient.js.map +1 -1
- package/lib/client/Network.js +1 -1
- package/lib/client/Network.js.map +1 -1
- package/lib/client/NodeClient.cjs +4 -11
- package/lib/client/NodeClient.d.ts +5 -6
- package/lib/client/NodeClient.js +1 -1
- package/lib/client/NodeClient.js.map +1 -1
- package/lib/client/WebClient.cjs +32 -7
- package/lib/client/WebClient.d.ts +10 -0
- package/lib/client/WebClient.js +1 -1
- package/lib/client/WebClient.js.map +1 -1
- package/lib/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/client/addressbooks/previewnet.cjs +1 -1
- package/lib/client/addressbooks/previewnet.d.ts +1 -1
- package/lib/client/addressbooks/previewnet.js +1 -1
- package/lib/client/addressbooks/previewnet.js.map +1 -1
- package/lib/client/addressbooks/testnet.cjs +1 -1
- package/lib/client/addressbooks/testnet.d.ts +1 -1
- package/lib/client/addressbooks/testnet.js +1 -1
- package/lib/client/addressbooks/testnet.js.map +1 -1
- package/lib/constants/ClientConstants.cjs +21 -2
- package/lib/constants/ClientConstants.d.ts +17 -0
- package/lib/constants/ClientConstants.js +1 -1
- package/lib/constants/ClientConstants.js.map +1 -1
- package/lib/contract/ContractByteCodeQuery.cjs +1 -2
- package/lib/contract/ContractCallQuery.cjs +1 -2
- package/lib/contract/ContractCreateFlow.cjs +1 -2
- package/lib/contract/ContractCreateFlow.js +1 -1
- package/lib/contract/ContractCreateFlow.js.map +1 -1
- package/lib/contract/ContractCreateTransaction.cjs +1 -2
- package/lib/contract/ContractDeleteTransaction.cjs +1 -2
- package/lib/contract/ContractExecuteTransaction.cjs +1 -2
- package/lib/contract/ContractFunctionParameters.cjs +1 -2
- package/lib/contract/ContractFunctionParameters.js +1 -1
- package/lib/contract/ContractFunctionParameters.js.map +1 -1
- package/lib/contract/ContractFunctionResult.cjs +1 -2
- package/lib/contract/ContractFunctionResult.js +1 -1
- package/lib/contract/ContractFunctionResult.js.map +1 -1
- package/lib/contract/ContractFunctionSelector.cjs +1 -2
- package/lib/contract/ContractId.cjs +1 -2
- package/lib/contract/ContractId.js +1 -1
- package/lib/contract/ContractId.js.map +1 -1
- package/lib/contract/ContractInfo.cjs +1 -2
- package/lib/contract/ContractInfoQuery.cjs +1 -2
- package/lib/contract/ContractNonceInfo.cjs +1 -2
- package/lib/contract/ContractStateChange.cjs +1 -2
- package/lib/contract/ContractUpdateTransaction.cjs +1 -2
- package/lib/contract/DelegateContractId.js +1 -1
- package/lib/contract/DelegateContractId.js.map +1 -1
- package/lib/contract/StorageChange.cjs +1 -2
- package/lib/cryptography/keccak.js +1 -1
- package/lib/cryptography/keccak.js.map +1 -1
- package/lib/cryptography/sha384.native.cjs +1 -2
- package/lib/encoding/base64.native.js +1 -1
- package/lib/encoding/base64.native.js.map +1 -1
- package/lib/encoding/hex.browser.js +1 -1
- package/lib/encoding/hex.browser.js.map +1 -1
- package/lib/encoding/utf8.native.cjs +1 -2
- package/lib/exports.cjs +1 -2
- package/lib/file/FileAppendTransaction.cjs +1 -2
- package/lib/file/FileContentsQuery.cjs +1 -2
- package/lib/file/FileCreateTransaction.cjs +1 -2
- package/lib/file/FileCreateTransaction.js +1 -1
- package/lib/file/FileCreateTransaction.js.map +1 -1
- package/lib/file/FileDeleteTransaction.cjs +1 -2
- package/lib/file/FileId.cjs +1 -2
- package/lib/file/FileInfo.cjs +1 -2
- package/lib/file/FileInfoQuery.cjs +1 -2
- package/lib/file/FileUpdateTransaction.cjs +1 -2
- package/lib/file/FileUpdateTransaction.js +1 -1
- package/lib/file/FileUpdateTransaction.js.map +1 -1
- package/lib/network/AddressBookQuery.cjs +1 -2
- package/lib/network/AddressBookQuery.js +1 -1
- package/lib/network/AddressBookQuery.js.map +1 -1
- package/lib/network/AddressBookQueryWeb.js +1 -1
- package/lib/network/AddressBookQueryWeb.js.map +1 -1
- package/lib/network/NetworkVersionInfo.cjs +1 -2
- package/lib/network/NetworkVersionInfoQuery.cjs +1 -2
- package/lib/network/SemanticVersion.cjs +1 -2
- package/lib/node/NodeCreateTransaction.cjs +1 -2
- package/lib/node/NodeCreateTransaction.js +1 -1
- package/lib/node/NodeCreateTransaction.js.map +1 -1
- package/lib/node/NodeDeleteTransaction.cjs +15 -3
- package/lib/node/NodeDeleteTransaction.d.ts +2 -1
- package/lib/node/NodeDeleteTransaction.js +1 -1
- package/lib/node/NodeDeleteTransaction.js.map +1 -1
- package/lib/node/NodeUpdateTransaction.cjs +13 -3
- package/lib/node/NodeUpdateTransaction.d.ts +2 -1
- package/lib/node/NodeUpdateTransaction.js +1 -1
- package/lib/node/NodeUpdateTransaction.js.map +1 -1
- package/lib/query/CostQuery.cjs +1 -2
- package/lib/query/MirrorNodeContractCallQuery.cjs +1 -2
- package/lib/query/MirrorNodeContractEstimateQuery.cjs +1 -2
- package/lib/query/MirrorNodeContractQuery.cjs +2 -1
- package/lib/query/MirrorNodeContractQuery.js +1 -1
- package/lib/query/MirrorNodeContractQuery.js.map +1 -1
- package/lib/query/Query.cjs +1 -2
- package/lib/query/Query.js +1 -1
- package/lib/query/Query.js.map +1 -1
- package/lib/query/QueryBase.cjs +1 -2
- package/lib/schedule/ScheduleCreateTransaction.cjs +1 -2
- package/lib/schedule/ScheduleCreateTransaction.js +1 -1
- package/lib/schedule/ScheduleCreateTransaction.js.map +1 -1
- package/lib/schedule/ScheduleDeleteTransaction.cjs +1 -2
- package/lib/schedule/ScheduleId.cjs +1 -2
- package/lib/schedule/ScheduleInfo.cjs +1 -2
- package/lib/schedule/ScheduleInfoQuery.cjs +1 -2
- package/lib/schedule/ScheduleSignTransaction.cjs +1 -2
- package/lib/system/FreezeTransaction.cjs +1 -2
- package/lib/system/SystemDeleteTransaction.cjs +1 -2
- package/lib/system/SystemUndeleteTransaction.cjs +1 -2
- package/lib/token/AbstractTokenTransferTransaction.js +1 -1
- package/lib/token/AbstractTokenTransferTransaction.js.map +1 -1
- package/lib/token/AssessedCustomFee.js +1 -1
- package/lib/token/AssessedCustomFee.js.map +1 -1
- package/lib/token/NftId.cjs +1 -2
- package/lib/token/TokenAirdropTransaction.cjs +1 -2
- package/lib/token/TokenAssociateTransaction.cjs +1 -2
- package/lib/token/TokenAssociateTransaction.js +1 -1
- package/lib/token/TokenAssociateTransaction.js.map +1 -1
- package/lib/token/TokenBurnTransaction.cjs +1 -2
- package/lib/token/TokenBurnTransaction.js +1 -1
- package/lib/token/TokenBurnTransaction.js.map +1 -1
- package/lib/token/TokenCancelAirdropTransaction.cjs +1 -2
- package/lib/token/TokenCancelAirdropTransaction.js +1 -1
- package/lib/token/TokenCancelAirdropTransaction.js.map +1 -1
- package/lib/token/TokenClaimAirdropTransaction.cjs +1 -2
- package/lib/token/TokenClaimAirdropTransaction.js +1 -1
- package/lib/token/TokenClaimAirdropTransaction.js.map +1 -1
- package/lib/token/TokenCreateTransaction.cjs +1 -2
- package/lib/token/TokenCreateTransaction.js +1 -1
- package/lib/token/TokenCreateTransaction.js.map +1 -1
- package/lib/token/TokenDeleteTransaction.cjs +1 -2
- package/lib/token/TokenDissociateTransaction.cjs +1 -2
- package/lib/token/TokenDissociateTransaction.js +1 -1
- package/lib/token/TokenDissociateTransaction.js.map +1 -1
- package/lib/token/TokenFeeScheduleUpdateTransaction.cjs +1 -2
- package/lib/token/TokenFeeScheduleUpdateTransaction.js +1 -1
- package/lib/token/TokenFeeScheduleUpdateTransaction.js.map +1 -1
- package/lib/token/TokenFreezeTransaction.cjs +1 -2
- package/lib/token/TokenGrantKycTransaction.cjs +1 -2
- package/lib/token/TokenId.cjs +1 -2
- package/lib/token/TokenInfo.cjs +1 -2
- package/lib/token/TokenInfo.js +1 -1
- package/lib/token/TokenInfo.js.map +1 -1
- package/lib/token/TokenInfoQuery.cjs +1 -2
- package/lib/token/TokenMintTransaction.cjs +1 -2
- package/lib/token/TokenMintTransaction.js +1 -1
- package/lib/token/TokenMintTransaction.js.map +1 -1
- package/lib/token/TokenNftInfo.cjs +1 -2
- package/lib/token/TokenNftInfoQuery.cjs +1 -2
- package/lib/token/TokenNftInfoQuery.js +1 -1
- package/lib/token/TokenNftInfoQuery.js.map +1 -1
- package/lib/token/TokenNftsUpdateTransaction.cjs +1 -2
- package/lib/token/TokenPauseTransaction.cjs +1 -2
- package/lib/token/TokenRejectFlow.js +1 -1
- package/lib/token/TokenRejectFlow.js.map +1 -1
- package/lib/token/TokenRejectTransaction.cjs +1 -2
- package/lib/token/TokenRejectTransaction.js +1 -1
- package/lib/token/TokenRejectTransaction.js.map +1 -1
- package/lib/token/TokenRevokeKycTransaction.cjs +1 -2
- package/lib/token/TokenUnfreezeTransaction.cjs +1 -2
- package/lib/token/TokenUnpauseTransaction.cjs +1 -2
- package/lib/token/TokenUpdateNftsTransaction.cjs +1 -2
- package/lib/token/TokenUpdateTransaction.cjs +1 -2
- package/lib/token/TokenWipeTransaction.cjs +1 -2
- package/lib/token/TokenWipeTransaction.js +1 -1
- package/lib/token/TokenWipeTransaction.js.map +1 -1
- package/lib/topic/TopicCreateTransaction.cjs +1 -2
- package/lib/topic/TopicCreateTransaction.js +1 -1
- package/lib/topic/TopicCreateTransaction.js.map +1 -1
- package/lib/topic/TopicDeleteTransaction.cjs +1 -2
- package/lib/topic/TopicId.cjs +1 -2
- package/lib/topic/TopicInfo.cjs +1 -2
- package/lib/topic/TopicInfo.js +1 -1
- package/lib/topic/TopicInfo.js.map +1 -1
- package/lib/topic/TopicInfoQuery.cjs +1 -2
- package/lib/topic/TopicMessage.js +1 -1
- package/lib/topic/TopicMessage.js.map +1 -1
- package/lib/topic/TopicMessageQuery.cjs +1 -2
- package/lib/topic/TopicMessageQuery.js +1 -1
- package/lib/topic/TopicMessageQuery.js.map +1 -1
- package/lib/topic/TopicMessageSubmitTransaction.cjs +1 -2
- package/lib/topic/TopicUpdateTransaction.cjs +1 -2
- package/lib/topic/TopicUpdateTransaction.js +1 -1
- package/lib/topic/TopicUpdateTransaction.js.map +1 -1
- package/lib/transaction/BatchTransaction.cjs +1 -2
- package/lib/transaction/BatchTransaction.js +1 -1
- package/lib/transaction/BatchTransaction.js.map +1 -1
- package/lib/transaction/CustomFeeLimit.js +1 -1
- package/lib/transaction/CustomFeeLimit.js.map +1 -1
- package/lib/transaction/NodeAccountIdSignatureMap.cjs +1 -2
- package/lib/transaction/NodeAccountIdSignatureMap.js +1 -1
- package/lib/transaction/NodeAccountIdSignatureMap.js.map +1 -1
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.js +1 -1
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.js.map +1 -1
- package/lib/transaction/SignatureMap.js +1 -1
- package/lib/transaction/SignatureMap.js.map +1 -1
- package/lib/transaction/SignatureMapLegacy.js +1 -1
- package/lib/transaction/SignatureMapLegacy.js.map +1 -1
- package/lib/transaction/SignaturePairMap.js +1 -1
- package/lib/transaction/SignaturePairMap.js.map +1 -1
- package/lib/transaction/Transaction.cjs +1 -2
- package/lib/transaction/Transaction.js +1 -1
- package/lib/transaction/Transaction.js.map +1 -1
- package/lib/transaction/TransactionHashMap.cjs +1 -2
- package/lib/transaction/TransactionHashMap.js +1 -1
- package/lib/transaction/TransactionHashMap.js.map +1 -1
- package/lib/transaction/TransactionId.cjs +1 -2
- package/lib/transaction/TransactionReceipt.cjs +1 -2
- package/lib/transaction/TransactionReceipt.js +1 -1
- package/lib/transaction/TransactionReceipt.js.map +1 -1
- package/lib/transaction/TransactionReceiptQuery.cjs +1 -2
- package/lib/transaction/TransactionRecord.cjs +1 -2
- package/lib/transaction/TransactionRecord.js +1 -1
- package/lib/transaction/TransactionRecord.js.map +1 -1
- package/lib/transaction/TransactionRecordQuery.cjs +1 -2
- package/lib/transaction/TransactionResponse.cjs +1 -2
- package/lib/transaction/TransactionResponse.js.map +1 -1
- package/lib/util/ASN1-Decoder.js +1 -1
- package/lib/util/ASN1-Decoder.js.map +1 -1
- package/lib/util.js +1 -1
- package/lib/util.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +75 -71
- package/src/Executable.js +10 -4
- package/src/LocalProviderWeb.js +165 -0
- package/src/Timestamp.js +2 -2
- package/src/account/AccountAllowanceAdjustTransaction.js +48 -48
- package/src/account/AccountAllowanceApproveTransaction.js +48 -48
- package/src/account/TokenNftAllowance.js +4 -4
- package/src/browser.js +1 -0
- package/src/client/NodeClient.js +6 -9
- package/src/client/WebClient.js +33 -8
- package/src/client/addressbooks/mainnet.js +1 -1
- package/src/client/addressbooks/previewnet.js +1 -1
- package/src/client/addressbooks/testnet.js +1 -1
- package/src/constants/ClientConstants.js +25 -0
- package/src/network/AddressBookQueryWeb.js +8 -2
- package/src/node/NodeDeleteTransaction.js +20 -1
- package/src/node/NodeUpdateTransaction.js +19 -1
- package/src/query/MirrorNodeContractQuery.js +8 -1
- package/src/token/TokenInfo.js +4 -4
- package/src/topic/TopicMessageQuery.js +7 -5
- package/src/transaction/TransactionRecord.js +5 -5
- package/src/transaction/TransactionResponse.js +3 -1
|
@@ -8,8 +8,7 @@ var _TokenId = _interopRequireDefault(require("./TokenId.cjs"));
|
|
|
8
8
|
var _AccountId = _interopRequireDefault(require("../account/AccountId.cjs"));
|
|
9
9
|
var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.cjs"));
|
|
10
10
|
var _long = _interopRequireDefault(require("long"));
|
|
11
|
-
function
|
|
12
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
15
14
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"./TokenId.js";import o from"../account/AccountId.js";import n,{TRANSACTION_REGISTRY as e}from"../transaction/Transaction.js";import r from"long";class s extends n{constructor(t={}){super(),this._tokenId=null,this._accountId=null,this._serials=[],this._amount=null,null!=t.tokenId&&this.setTokenId(t.tokenId),null!=t.accountId&&this.setAccountId(t.accountId),null!=t.amount&&this.setAmount(t.amount),null!=t.serials&&this.setSerials(t.serials)}static _fromProtobuf(e,r,u,i,a){const c=a[0].tokenWipe;return n._fromProtobufTransactions(new s({tokenId:null!=c.token?t._fromProtobuf(c.token):void 0,accountId:null!=c.account?o._fromProtobuf(c.account):void 0,amount:null!=c.amount?c.amount:void 0,serials:null!=c.serialNumbers?c.serialNumbers:void 0}),e,r,u,i,a)}get tokenId(){return this._tokenId}setTokenId(o){return this._requireNotFrozen(),this._tokenId="string"==typeof o?t.fromString(o):o.clone(),this}get accountId(){return this._accountId}setAccountId(t){return this._requireNotFrozen(),this._accountId="string"==typeof t?o.fromString(t):t.clone(),this}get amount(){return this._amount}setAmount(t){return this._requireNotFrozen(),this._amount=t instanceof r?t:r.fromValue(t),this}_validateChecksums(t){null!=this._tokenId&&this._tokenId.validateChecksum(t),null!=this._accountId&&this._accountId.validateChecksum(t)}get serials(){return this._serials}setSerials(t){return this._requireNotFrozen(),this._serials=t.map(
|
|
1
|
+
import t from"./TokenId.js";import o from"../account/AccountId.js";import n,{TRANSACTION_REGISTRY as e}from"../transaction/Transaction.js";import r from"long";class s extends n{constructor(t={}){super(),this._tokenId=null,this._accountId=null,this._serials=[],this._amount=null,null!=t.tokenId&&this.setTokenId(t.tokenId),null!=t.accountId&&this.setAccountId(t.accountId),null!=t.amount&&this.setAmount(t.amount),null!=t.serials&&this.setSerials(t.serials)}static _fromProtobuf(e,r,u,i,a){const c=a[0].tokenWipe;return n._fromProtobufTransactions(new s({tokenId:null!=c.token?t._fromProtobuf(c.token):void 0,accountId:null!=c.account?o._fromProtobuf(c.account):void 0,amount:null!=c.amount?c.amount:void 0,serials:null!=c.serialNumbers?c.serialNumbers:void 0}),e,r,u,i,a)}get tokenId(){return this._tokenId}setTokenId(o){return this._requireNotFrozen(),this._tokenId="string"==typeof o?t.fromString(o):o.clone(),this}get accountId(){return this._accountId}setAccountId(t){return this._requireNotFrozen(),this._accountId="string"==typeof t?o.fromString(t):t.clone(),this}get amount(){return this._amount}setAmount(t){return this._requireNotFrozen(),this._amount=t instanceof r?t:r.fromValue(t),this}_validateChecksums(t){null!=this._tokenId&&this._tokenId.validateChecksum(t),null!=this._accountId&&this._accountId.validateChecksum(t)}get serials(){return this._serials}setSerials(t){return this._requireNotFrozen(),this._serials=t.map(t=>"number"==typeof t?r.fromNumber(t):t),this}_execute(t,o){return t.token.wipeTokenAccount(o)}_getTransactionDataCase(){return"tokenWipe"}_makeTransactionData(){return{amount:this._amount,token:null!=this._tokenId?this._tokenId._toProtobuf():null,account:null!=this._accountId?this._accountId._toProtobuf():null,serialNumbers:this.serials}}_getLogId(){return`TokenWipeTransaction:${this._transactionIds.current.validStart.toString()}`}}e.set("tokenWipe",s._fromProtobuf);export{s as default};
|
|
2
2
|
//# sourceMappingURL=TokenWipeTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenWipeTransaction.js","sources":["../../src/token/TokenWipeTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"./TokenId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenWipeAccountTransactionBody} HieroProto.proto.ITokenWipeAccountTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Wipe a new Hedera™ crypto-currency token.\n */\nexport default class TokenWipeTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {AccountId | string} [props.accountId]\n * @param {Long | number} [props.amount]\n * @param {(Long | number)[]} [props.serials]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n /**\n * @private\n * @type {?Long[]}\n */\n this._serials = [];\n\n /**\n * @private\n * @type {?Long}\n */\n this._amount = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n if (props.serials != null) {\n this.setSerials(props.serials);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {TokenWipeTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const wipeToken =\n /** @type {HieroProto.proto.ITokenWipeAccountTransactionBody} */ (\n body.tokenWipe\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenWipeTransaction({\n tokenId:\n wipeToken.token != null\n ? TokenId._fromProtobuf(wipeToken.token)\n : undefined,\n accountId:\n wipeToken.account != null\n ? AccountId._fromProtobuf(wipeToken.account)\n : undefined,\n amount: wipeToken.amount != null ? wipeToken.amount : undefined,\n serials:\n wipeToken.serialNumbers != null\n ? wipeToken.serialNumbers\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? TokenId.fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? AccountId.fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {this}\n */\n setAmount(amount) {\n this._requireNotFrozen();\n this._amount = amount instanceof Long ? amount : Long.fromValue(amount);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {?Long[]}\n */\n get serials() {\n return this._serials;\n }\n\n /**\n * @param {(Long | number)[]} serials\n * @returns {this}\n */\n setSerials(serials) {\n this._requireNotFrozen();\n this._serials = serials.map((serial) =>\n typeof serial === \"number\" ? Long.fromNumber(serial) : serial,\n );\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.token.wipeTokenAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"tokenWipe\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.ITokenWipeAccountTransactionBody}\n */\n _makeTransactionData() {\n return {\n amount: this._amount,\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n serialNumbers: this.serials,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenWipeTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"tokenWipe\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenWipeTransaction._fromProtobuf,\n);\n"],"names":["TokenWipeTransaction","Transaction","constructor","props","super","this","_tokenId","_accountId","_serials","_amount","tokenId","setTokenId","accountId","setAccountId","amount","setAmount","serials","setSerials","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","wipeToken","_fromProtobufTransactions","token","TokenId","undefined","account","AccountId","serialNumbers","_requireNotFrozen","fromString","clone","Long","fromValue","_validateChecksums","client","validateChecksum","map","serial","fromNumber","_execute","channel","request","wipeTokenAccount","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"+JA6Be,MAAMA,UAA6BC,EAQ9C,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,SAAW,KAMhBD,KAAKE,WAAa,KAMlBF,KAAKG,SAAW,GAMhBH,KAAKI,QAAU,KAEM,MAAjBN,EAAMO,SACNL,KAAKM,WAAWR,EAAMO,SAGH,MAAnBP,EAAMS,WACNP,KAAKQ,aAAaV,EAAMS,WAGR,MAAhBT,EAAMW,QACNT,KAAKU,UAAUZ,EAAMW,QAGJ,MAAjBX,EAAMa,SACNX,KAAKY,WAAWd,EAAMa,QAElC,CAWI,oBAAOE,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAIf,UAEL,OAAOtB,EAAYwB,0BACf,IAAIzB,EAAqB,CACrBU,QACuB,MAAnBc,EAAUE,MACJC,EAAQT,cAAcM,EAAUE,YAChCE,EACVhB,UACyB,MAArBY,EAAUK,QACJC,EAAUZ,cAAcM,EAAUK,cAClCD,EACVd,OAA4B,MAApBU,EAAUV,OAAiBU,EAAUV,YAASc,EACtDZ,QAC+B,MAA3BQ,EAAUO,cACJP,EAAUO,mBACVH,IAEdT,EACAC,EACAC,EACAC,EACAC,EAEZ,CAKI,WAAIb,GACA,OAAOL,KAAKC,QACpB,CAMI,UAAAK,CAAWD,GAOP,OANAL,KAAK2B,oBACL3B,KAAKC,SACkB,iBAAZI,EACDiB,EAAQM,WAAWvB,GACnBA,EAAQwB,QAEX7B,IACf,CAKI,aAAIO,GACA,OAAOP,KAAKE,UACpB,CAMI,YAAAM,CAAaD,GAOT,OANAP,KAAK2B,oBACL3B,KAAKE,WACoB,iBAAdK,EACDkB,EAAUG,WAAWrB,GACrBA,EAAUsB,QAEb7B,IACf,CAKI,UAAIS,GACA,OAAOT,KAAKI,OACpB,CAMI,SAAAM,CAAUD,GAIN,OAHAT,KAAK2B,oBACL3B,KAAKI,QAAUK,aAAkBqB,EAAOrB,EAASqB,EAAKC,UAAUtB,GAEzDT,IACf,CAKI,kBAAAgC,CAAmBC,GACM,MAAjBjC,KAAKC,UACLD,KAAKC,SAASiC,iBAAiBD,GAGZ,MAAnBjC,KAAKE,YACLF,KAAKE,WAAWgC,iBAAiBD,EAE7C,CAKI,WAAItB,GACA,OAAOX,KAAKG,QACpB,CAMI,UAAAS,CAAWD,GAMP,OALAX,KAAK2B,oBACL3B,KAAKG,SAAWQ,EAAQwB,KAAKC,GACP,iBAAXA,EAAsBN,EAAKO,WAAWD,GAAUA,IAGpDpC,IACf,CASI,QAAAsC,CAASC,EAASC,GACd,OAAOD,EAAQlB,MAAMoB,iBAAiBD,EAC9C,CAOI,uBAAAE,GACI,MAAO,WACf,CAOI,oBAAAC,GACI,MAAO,CACHlC,OAAQT,KAAKI,QACbiB,MAAwB,MAAjBrB,KAAKC,SAAmBD,KAAKC,SAAS2C,cAAgB,KAC7DpB,QACuB,MAAnBxB,KAAKE,WAAqBF,KAAKE,WAAW0C,cAAgB,KAC9DlB,cAAe1B,KAAKW,QAEhC,CAKI,SAAAkC,GAII,MAAO,wBAFH7C,KAAK8C,gBAAgBC,QACxB,WACwCC,YACjD,EAGAC,EAAqBC,IACjB,YAEAvD,EAAqBkB"}
|
|
1
|
+
{"version":3,"file":"TokenWipeTransaction.js","sources":["../../src/token/TokenWipeTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"./TokenId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Long from \"long\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenWipeAccountTransactionBody} HieroProto.proto.ITokenWipeAccountTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Wipe a new Hedera™ crypto-currency token.\n */\nexport default class TokenWipeTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {TokenId | string} [props.tokenId]\n * @param {AccountId | string} [props.accountId]\n * @param {Long | number} [props.amount]\n * @param {(Long | number)[]} [props.serials]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?TokenId}\n */\n this._tokenId = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n /**\n * @private\n * @type {?Long[]}\n */\n this._serials = [];\n\n /**\n * @private\n * @type {?Long}\n */\n this._amount = null;\n\n if (props.tokenId != null) {\n this.setTokenId(props.tokenId);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n\n if (props.amount != null) {\n this.setAmount(props.amount);\n }\n\n if (props.serials != null) {\n this.setSerials(props.serials);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {TokenWipeTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const wipeToken =\n /** @type {HieroProto.proto.ITokenWipeAccountTransactionBody} */ (\n body.tokenWipe\n );\n\n return Transaction._fromProtobufTransactions(\n new TokenWipeTransaction({\n tokenId:\n wipeToken.token != null\n ? TokenId._fromProtobuf(wipeToken.token)\n : undefined,\n accountId:\n wipeToken.account != null\n ? AccountId._fromProtobuf(wipeToken.account)\n : undefined,\n amount: wipeToken.amount != null ? wipeToken.amount : undefined,\n serials:\n wipeToken.serialNumbers != null\n ? wipeToken.serialNumbers\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?TokenId}\n */\n get tokenId() {\n return this._tokenId;\n }\n\n /**\n * @param {TokenId | string} tokenId\n * @returns {this}\n */\n setTokenId(tokenId) {\n this._requireNotFrozen();\n this._tokenId =\n typeof tokenId === \"string\"\n ? TokenId.fromString(tokenId)\n : tokenId.clone();\n\n return this;\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._requireNotFrozen();\n this._accountId =\n typeof accountId === \"string\"\n ? AccountId.fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get amount() {\n return this._amount;\n }\n\n /**\n * @param {Long | number} amount\n * @returns {this}\n */\n setAmount(amount) {\n this._requireNotFrozen();\n this._amount = amount instanceof Long ? amount : Long.fromValue(amount);\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._tokenId != null) {\n this._tokenId.validateChecksum(client);\n }\n\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @returns {?Long[]}\n */\n get serials() {\n return this._serials;\n }\n\n /**\n * @param {(Long | number)[]} serials\n * @returns {this}\n */\n setSerials(serials) {\n this._requireNotFrozen();\n this._serials = serials.map((serial) =>\n typeof serial === \"number\" ? Long.fromNumber(serial) : serial,\n );\n\n return this;\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.token.wipeTokenAccount(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"tokenWipe\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.ITokenWipeAccountTransactionBody}\n */\n _makeTransactionData() {\n return {\n amount: this._amount,\n token: this._tokenId != null ? this._tokenId._toProtobuf() : null,\n account:\n this._accountId != null ? this._accountId._toProtobuf() : null,\n serialNumbers: this.serials,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TokenWipeTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"tokenWipe\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TokenWipeTransaction._fromProtobuf,\n);\n"],"names":["TokenWipeTransaction","Transaction","constructor","props","super","this","_tokenId","_accountId","_serials","_amount","tokenId","setTokenId","accountId","setAccountId","amount","setAmount","serials","setSerials","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","wipeToken","_fromProtobufTransactions","token","TokenId","undefined","account","AccountId","serialNumbers","_requireNotFrozen","fromString","clone","Long","fromValue","_validateChecksums","client","validateChecksum","map","serial","fromNumber","_execute","channel","request","wipeTokenAccount","_getTransactionDataCase","_makeTransactionData","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"+JA6Be,MAAMA,UAA6BC,EAQ9C,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,SAAW,KAMhBD,KAAKE,WAAa,KAMlBF,KAAKG,SAAW,GAMhBH,KAAKI,QAAU,KAEM,MAAjBN,EAAMO,SACNL,KAAKM,WAAWR,EAAMO,SAGH,MAAnBP,EAAMS,WACNP,KAAKQ,aAAaV,EAAMS,WAGR,MAAhBT,EAAMW,QACNT,KAAKU,UAAUZ,EAAMW,QAGJ,MAAjBX,EAAMa,SACNX,KAAKY,WAAWd,EAAMa,QAElC,CAWI,oBAAOE,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MACMC,EADOD,EAAO,GAIf,UAEL,OAAOtB,EAAYwB,0BACf,IAAIzB,EAAqB,CACrBU,QACuB,MAAnBc,EAAUE,MACJC,EAAQT,cAAcM,EAAUE,YAChCE,EACVhB,UACyB,MAArBY,EAAUK,QACJC,EAAUZ,cAAcM,EAAUK,cAClCD,EACVd,OAA4B,MAApBU,EAAUV,OAAiBU,EAAUV,YAASc,EACtDZ,QAC+B,MAA3BQ,EAAUO,cACJP,EAAUO,mBACVH,IAEdT,EACAC,EACAC,EACAC,EACAC,EAEZ,CAKI,WAAIb,GACA,OAAOL,KAAKC,QACpB,CAMI,UAAAK,CAAWD,GAOP,OANAL,KAAK2B,oBACL3B,KAAKC,SACkB,iBAAZI,EACDiB,EAAQM,WAAWvB,GACnBA,EAAQwB,QAEX7B,IACf,CAKI,aAAIO,GACA,OAAOP,KAAKE,UACpB,CAMI,YAAAM,CAAaD,GAOT,OANAP,KAAK2B,oBACL3B,KAAKE,WACoB,iBAAdK,EACDkB,EAAUG,WAAWrB,GACrBA,EAAUsB,QAEb7B,IACf,CAKI,UAAIS,GACA,OAAOT,KAAKI,OACpB,CAMI,SAAAM,CAAUD,GAIN,OAHAT,KAAK2B,oBACL3B,KAAKI,QAAUK,aAAkBqB,EAAOrB,EAASqB,EAAKC,UAAUtB,GAEzDT,IACf,CAKI,kBAAAgC,CAAmBC,GACM,MAAjBjC,KAAKC,UACLD,KAAKC,SAASiC,iBAAiBD,GAGZ,MAAnBjC,KAAKE,YACLF,KAAKE,WAAWgC,iBAAiBD,EAE7C,CAKI,WAAItB,GACA,OAAOX,KAAKG,QACpB,CAMI,UAAAS,CAAWD,GAMP,OALAX,KAAK2B,oBACL3B,KAAKG,SAAWQ,EAAQwB,IAAKC,GACP,iBAAXA,EAAsBN,EAAKO,WAAWD,GAAUA,GAGpDpC,IACf,CASI,QAAAsC,CAASC,EAASC,GACd,OAAOD,EAAQlB,MAAMoB,iBAAiBD,EAC9C,CAOI,uBAAAE,GACI,MAAO,WACf,CAOI,oBAAAC,GACI,MAAO,CACHlC,OAAQT,KAAKI,QACbiB,MAAwB,MAAjBrB,KAAKC,SAAmBD,KAAKC,SAAS2C,cAAgB,KAC7DpB,QACuB,MAAnBxB,KAAKE,WAAqBF,KAAKE,WAAW0C,cAAgB,KAC9DlB,cAAe1B,KAAKW,QAEhC,CAKI,SAAAkC,GAII,MAAO,wBAFH7C,KAAK8C,gBAAgBC,QACxB,WACwCC,YACjD,EAGAC,EAAqBC,IACjB,YAEAvD,EAAqBkB"}
|
|
@@ -10,8 +10,7 @@ var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.c
|
|
|
10
10
|
var _Duration = _interopRequireDefault(require("../Duration.cjs"));
|
|
11
11
|
var _Key = _interopRequireDefault(require("../Key.cjs"));
|
|
12
12
|
var _Hbar = _interopRequireDefault(require("../Hbar.cjs"));
|
|
13
|
-
function
|
|
14
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
15
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
16
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../account/AccountId.js";import t from"../token/CustomFixedFee.js";import o,{TRANSACTION_REGISTRY as s,DEFAULT_AUTO_RENEW_PERIOD as u}from"../transaction/Transaction.js";import i from"../Duration.js";import n from"../Key.js";import r from"../Hbar.js";class c extends o{constructor(e={}){super(),this._defaultMaxTransactionFee=new r(25),this._adminKey=null,this._submitKey=null,this._feeScheduleKey=null,this._feeExemptKeys=[],this._autoRenewAccountId=null,this._autoRenewPeriod=new i(u),this._customFees=[],this._topicMemo=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.submitKey&&this.setSubmitKey(e.submitKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.topicMemo&&this.setTopicMemo(e.topicMemo)}static _fromProtobuf(s,u,i,r,m){const h=m[0].consensusCreateTopic;return o._fromProtobufTransactions(new c({adminKey:null!=h.adminKey?n._fromProtobufKey(h.adminKey):void 0,submitKey:null!=h.submitKey?n._fromProtobufKey(h.submitKey):void 0,feeScheduleKey:null!=h.feeScheduleKey?n._fromProtobufKey(h.feeScheduleKey):void 0,feeExemptKeys:null!=h.feeExemptKeyList?h.feeExemptKeyList.map(
|
|
1
|
+
import e from"../account/AccountId.js";import t from"../token/CustomFixedFee.js";import o,{TRANSACTION_REGISTRY as s,DEFAULT_AUTO_RENEW_PERIOD as u}from"../transaction/Transaction.js";import i from"../Duration.js";import n from"../Key.js";import r from"../Hbar.js";class c extends o{constructor(e={}){super(),this._defaultMaxTransactionFee=new r(25),this._adminKey=null,this._submitKey=null,this._feeScheduleKey=null,this._feeExemptKeys=[],this._autoRenewAccountId=null,this._autoRenewPeriod=new i(u),this._customFees=[],this._topicMemo=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.submitKey&&this.setSubmitKey(e.submitKey),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.customFees&&this.setCustomFees(e.customFees),null!=e.topicMemo&&this.setTopicMemo(e.topicMemo)}static _fromProtobuf(s,u,i,r,m){const h=m[0].consensusCreateTopic;return o._fromProtobufTransactions(new c({adminKey:null!=h.adminKey?n._fromProtobufKey(h.adminKey):void 0,submitKey:null!=h.submitKey?n._fromProtobufKey(h.submitKey):void 0,feeScheduleKey:null!=h.feeScheduleKey?n._fromProtobufKey(h.feeScheduleKey):void 0,feeExemptKeys:null!=h.feeExemptKeyList?h.feeExemptKeyList.map(e=>n._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=h.autoRenewAccount?e._fromProtobuf(h.autoRenewAccount):void 0,autoRenewPeriod:null!=h.autoRenewPeriod&&null!=h.autoRenewPeriod.seconds?h.autoRenewPeriod.seconds:void 0,customFees:null!=h.customFees?h.customFees.map(e=>t._fromProtobuf(e)):void 0,topicMemo:null!=h.memo?h.memo:void 0}),s,u,i,r,m)}get topicMemo(){return this._topicMemo}getTopicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}get adminKey(){return this._adminKey}getAdminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get submitKey(){return this._submitKey}getSubmitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}getAutoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(t){return this._requireNotFrozen(),this._autoRenewAccountId=t instanceof e?t:e.fromString(t),this}get autoRenewPeriod(){return this._autoRenewPeriod}getAutoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof i?e:new i(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}freezeWith(e){return!this._autoRenewAccountId&&this.transactionId?.accountId?this.setAutoRenewAccountId(this.transactionId?.accountId):!this._autoRenewAccountId&&e?.operatorAccountId&&this.setAutoRenewAccountId(e.operatorAccountId),super.freezeWith(e)}_execute(e,t){return e.consensus.createTopic(t)}_getTransactionDataCase(){return"consensusCreateTopic"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:this._feeExemptKeys.map(e=>e._toProtobufKey()),autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:this._autoRenewPeriod._toProtobuf(),customFees:this._customFees.map(e=>e._toTopicFeeProtobuf()),memo:this._topicMemo}}_getLogId(){return`TopicCreateTransaction:${this._transactionIds.current.validStart.toString()}`}}s.set("consensusCreateTopic",c._fromProtobuf);export{c as default};
|
|
2
2
|
//# sourceMappingURL=TopicCreateTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopicCreateTransaction.js","sources":["../../src/topic/TopicCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"../account/AccountId.js\";\nimport CustomFixedFee from \"../token/CustomFixedFee.js\";\nimport Transaction, {\n DEFAULT_AUTO_RENEW_PERIOD,\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\nimport Hbar from \"../Hbar.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusCreateTopicTransactionBody} HieroProto.proto.IConsensusCreateTopicTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Create a topic to be used for consensus.\n */\nexport default class TopicCreateTransaction extends Transaction {\n /**\n * @param {object} props\n * @param {Key} [props.adminKey]\n * @param {Key} [props.submitKey]\n * @param {Key} [props.feeScheduleKey]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {CustomFixedFee[]} [props.customFees]\n * @param {Key[]} [props.feeExemptKeys]\n * @param {string} [props.topicMemo]\n */\n constructor(props = {}) {\n super();\n\n this._defaultMaxTransactionFee = new Hbar(25);\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._submitKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._feeScheduleKey = null;\n\n /**\n * @private\n * @type {Key[]}\n */\n this._feeExemptKeys = [];\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n /**\n * @private\n * @type {Duration}\n */\n this._autoRenewPeriod = new Duration(DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {CustomFixedFee[]}\n */\n this._customFees = [];\n\n /**\n * @private\n * @type {?string}\n */\n this._topicMemo = null;\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.submitKey != null) {\n this.setSubmitKey(props.submitKey);\n }\n\n if (props.feeScheduleKey != null) {\n this.setFeeScheduleKey(props.feeScheduleKey);\n }\n\n if (props.feeExemptKeys != null) {\n this.setFeeExemptKeys(props.feeExemptKeys);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.customFees != null) {\n this.setCustomFees(props.customFees);\n }\n\n if (props.topicMemo != null) {\n this.setTopicMemo(props.topicMemo);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {TopicCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const create =\n /** @type {HieroProto.proto.IConsensusCreateTopicTransactionBody} */ (\n body.consensusCreateTopic\n );\n\n return Transaction._fromProtobufTransactions(\n new TopicCreateTransaction({\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n submitKey:\n create.submitKey != null\n ? Key._fromProtobufKey(create.submitKey)\n : undefined,\n feeScheduleKey:\n create.feeScheduleKey != null\n ? Key._fromProtobufKey(create.feeScheduleKey)\n : undefined,\n feeExemptKeys:\n create.feeExemptKeyList != null\n ? create.feeExemptKeyList.map((key) =>\n Key._fromProtobufKey(key),\n )\n : undefined,\n autoRenewAccountId:\n create.autoRenewAccount != null\n ? AccountId._fromProtobuf(create.autoRenewAccount)\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? create.autoRenewPeriod.seconds != null\n ? create.autoRenewPeriod.seconds\n : undefined\n : undefined,\n customFees:\n create.customFees != null\n ? create.customFees.map((customFee) =>\n CustomFixedFee._fromProtobuf(customFee),\n )\n : undefined,\n topicMemo: create.memo != null ? create.memo : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @deprecated - Use `getTopicMemo()` instead\n * @returns {?string}\n */\n get topicMemo() {\n return this._topicMemo;\n }\n\n /**\n * @returns {?string}\n */\n getTopicMemo() {\n return this._topicMemo;\n }\n\n /**\n * @param {string} topicMemo\n * @returns {this}\n */\n setTopicMemo(topicMemo) {\n this._requireNotFrozen();\n this._topicMemo = topicMemo;\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAdminKey()` instead\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @returns {?Key}\n */\n getAdminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @deprecated - Use `getSubmitKey()` instead\n * @returns {?Key}\n */\n get submitKey() {\n return this._submitKey;\n }\n\n /**\n * @returns {?Key}\n */\n getSubmitKey() {\n return this._submitKey;\n }\n\n /**\n * @param {Key} submitKey\n * @returns {this}\n */\n setSubmitKey(submitKey) {\n this._requireNotFrozen();\n this._submitKey = submitKey;\n\n return this;\n }\n\n /**\n * Returns the key which allows updates to the new topic’s fees.\n * @returns {?Key}\n */\n getFeeScheduleKey() {\n return this._feeScheduleKey;\n }\n\n /**\n * Sets the key which allows updates to the new topic’s fees.\n * @param {Key} feeScheduleKey\n * @returns {this}\n */\n setFeeScheduleKey(feeScheduleKey) {\n this._requireNotFrozen();\n this._feeScheduleKey = feeScheduleKey;\n\n return this;\n }\n\n /**\n * Returns the keys that will be exempt from paying fees.\n * @returns {Key[]}\n */\n getFeeExemptKeys() {\n return this._feeExemptKeys;\n }\n\n /**\n * Sets the keys that will be exempt from paying fees.\n * @param {Key[]} feeExemptKeys\n * @returns {this}\n */\n setFeeExemptKeys(feeExemptKeys) {\n this._requireNotFrozen();\n this._feeExemptKeys = feeExemptKeys;\n\n return this;\n }\n\n /**\n * Adds a key that will be exempt from paying fees.\n * @param {Key} key\n * @returns {this}\n */\n addFeeExemptKey(key) {\n this._requireNotFrozen();\n this._feeExemptKeys.push(key);\n\n return this;\n }\n\n /**\n * Clears all keys that will be exempt from paying fees.\n * @returns {this}\n */\n clearFeeExemptKeys() {\n this._requireNotFrozen();\n this._feeExemptKeys = [];\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAutoRenewAccountId()` instead\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @returns {?AccountId}\n */\n getAutoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n autoRenewAccountId instanceof AccountId\n ? autoRenewAccountId\n : AccountId.fromString(autoRenewAccountId);\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAutoRenewPeriod()` instead\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * @returns {Duration}\n */\n getAutoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * Set the auto renew period for this account.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof Duration\n ? autoRenewPeriod\n : new Duration(autoRenewPeriod);\n\n return this;\n }\n\n /**\n * Returns the fixed fees to assess when a message is submitted to the new topic.\n * @returns {CustomFixedFee[]}\n */\n getCustomFees() {\n return this._customFees;\n }\n\n /**\n * Sets the fixed fees to assess when a message is submitted to the new topic.\n *\n * @param {CustomFixedFee[]} customFees\n * @returns {this}\n */\n setCustomFees(customFees) {\n this._requireNotFrozen();\n this._customFees = customFees;\n\n return this;\n }\n\n /**\n * Adds fixed fee to assess when a message is submitted to the new topic.\n *\n * @param {CustomFixedFee} customFee\n * @returns {this}\n */\n addCustomFee(customFee) {\n this._requireNotFrozen();\n\n this._customFees.push(customFee);\n\n return this;\n }\n\n /**\n * Clears fixed fees.\n *\n * @returns {this}\n */\n clearCustomFees() {\n this._requireNotFrozen();\n\n this._customFees = [];\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.validateChecksum(client);\n }\n }\n\n /*\n * Temporarily disabled due to issues with consensus node version 0.60.\n * This will be reintroduced once all networks (previewnet, testnet, mainnet)\n * are on version 0.60.\n *\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n /*\n freezeWith(client) {\n if (!this._autoRenewAccountId && this.transactionId?.accountId) {\n this.setAutoRenewAccountId(this.transactionId?.accountId);\n } else if (!this._autoRenewAccountId && client?.operatorAccountId) {\n this.setAutoRenewAccountId(client.operatorAccountId);\n }\n return super.freezeWith(client);\n }\n */\n\n /**\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n freezeWith(client) {\n if (!this._autoRenewAccountId && this.transactionId?.accountId) {\n this.setAutoRenewAccountId(this.transactionId?.accountId);\n } else if (!this._autoRenewAccountId && client?.operatorAccountId) {\n this.setAutoRenewAccountId(client.operatorAccountId);\n }\n return super.freezeWith(client);\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.consensus.createTopic(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"consensusCreateTopic\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IConsensusCreateTopicTransactionBody}\n */\n _makeTransactionData() {\n return {\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n submitKey:\n this._submitKey != null\n ? this._submitKey._toProtobufKey()\n : null,\n feeScheduleKey:\n this._feeScheduleKey != null\n ? this._feeScheduleKey._toProtobufKey()\n : null,\n feeExemptKeyList: this._feeExemptKeys.map((key) =>\n key._toProtobufKey(),\n ),\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n autoRenewPeriod: this._autoRenewPeriod._toProtobuf(),\n customFees: this._customFees.map((customFee) =>\n customFee._toTopicFeeProtobuf(),\n ),\n memo: this._topicMemo,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TopicCreateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"consensusCreateTopic\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TopicCreateTransaction._fromProtobuf,\n);\n"],"names":["TopicCreateTransaction","Transaction","constructor","props","super","this","_defaultMaxTransactionFee","Hbar","_adminKey","_submitKey","_feeScheduleKey","_feeExemptKeys","_autoRenewAccountId","_autoRenewPeriod","Duration","DEFAULT_AUTO_RENEW_PERIOD","_customFees","_topicMemo","adminKey","setAdminKey","submitKey","setSubmitKey","feeScheduleKey","setFeeScheduleKey","feeExemptKeys","setFeeExemptKeys","autoRenewAccountId","setAutoRenewAccountId","autoRenewPeriod","setAutoRenewPeriod","customFees","setCustomFees","topicMemo","setTopicMemo","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","create","_fromProtobufTransactions","Key","_fromProtobufKey","undefined","feeExemptKeyList","map","key","autoRenewAccount","AccountId","seconds","customFee","CustomFixedFee","memo","getTopicMemo","_requireNotFrozen","getAdminKey","getSubmitKey","getFeeScheduleKey","getFeeExemptKeys","addFeeExemptKey","push","clearFeeExemptKeys","getAutoRenewAccountId","fromString","getAutoRenewPeriod","getCustomFees","addCustomFee","clearCustomFees","_validateChecksums","client","validateChecksum","freezeWith","transactionId","accountId","operatorAccountId","_execute","channel","request","consensus","createTopic","_getTransactionDataCase","_makeTransactionData","_toProtobufKey","_toProtobuf","_toTopicFeeProtobuf","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KAAKI,WACCJ,KAAKI,WAAW0E,iBAChB,KACV7D,eAC4B,MAAxBjB,KAAKK,gBACCL,KAAKK,gBAAgByE,iBACrB,KACVtC,iBAAkBxC,KAAKM,eAAemC,KAAKC,GACvCA,EAAIoC,mBAERnC,iBACgC,MAA5B3C,KAAKO,oBACCP,KAAKO,oBAAoBwE,cACzB,KACVxD,gBAAiBvB,KAAKQ,iBAAiBuE,cACvCtD,WAAYzB,KAAKW,YAAY8B,KAAKK,GAC9BA,EAAUkC,wBAEdhC,KAAMhD,KAAKY,WAEvB,CAKI,SAAAqE,GAII,MAAO,0BAFHjF,KAAKkF,gBAAgBC,QACxB,WAC0CC,YACnD,EAGAC,EAAqBC,IACjB,uBAEA3F,EAAuBkC"}
|
|
1
|
+
{"version":3,"file":"TopicCreateTransaction.js","sources":["../../src/topic/TopicCreateTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"../account/AccountId.js\";\nimport CustomFixedFee from \"../token/CustomFixedFee.js\";\nimport Transaction, {\n DEFAULT_AUTO_RENEW_PERIOD,\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\nimport Hbar from \"../Hbar.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IConsensusCreateTopicTransactionBody} HieroProto.proto.IConsensusCreateTopicTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n * @typedef {import(\"../transaction/TransactionId.js\").default} TransactionId\n */\n\n/**\n * Create a topic to be used for consensus.\n */\nexport default class TopicCreateTransaction extends Transaction {\n /**\n * @param {object} props\n * @param {Key} [props.adminKey]\n * @param {Key} [props.submitKey]\n * @param {Key} [props.feeScheduleKey]\n * @param {Duration | Long | number} [props.autoRenewPeriod]\n * @param {AccountId | string} [props.autoRenewAccountId]\n * @param {CustomFixedFee[]} [props.customFees]\n * @param {Key[]} [props.feeExemptKeys]\n * @param {string} [props.topicMemo]\n */\n constructor(props = {}) {\n super();\n\n this._defaultMaxTransactionFee = new Hbar(25);\n\n /**\n * @private\n * @type {?Key}\n */\n this._adminKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._submitKey = null;\n\n /**\n * @private\n * @type {?Key}\n */\n this._feeScheduleKey = null;\n\n /**\n * @private\n * @type {Key[]}\n */\n this._feeExemptKeys = [];\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._autoRenewAccountId = null;\n\n /**\n * @private\n * @type {Duration}\n */\n this._autoRenewPeriod = new Duration(DEFAULT_AUTO_RENEW_PERIOD);\n\n /**\n * @private\n * @type {CustomFixedFee[]}\n */\n this._customFees = [];\n\n /**\n * @private\n * @type {?string}\n */\n this._topicMemo = null;\n\n if (props.adminKey != null) {\n this.setAdminKey(props.adminKey);\n }\n\n if (props.submitKey != null) {\n this.setSubmitKey(props.submitKey);\n }\n\n if (props.feeScheduleKey != null) {\n this.setFeeScheduleKey(props.feeScheduleKey);\n }\n\n if (props.feeExemptKeys != null) {\n this.setFeeExemptKeys(props.feeExemptKeys);\n }\n\n if (props.autoRenewAccountId != null) {\n this.setAutoRenewAccountId(props.autoRenewAccountId);\n }\n\n if (props.autoRenewPeriod != null) {\n this.setAutoRenewPeriod(props.autoRenewPeriod);\n }\n\n if (props.customFees != null) {\n this.setCustomFees(props.customFees);\n }\n\n if (props.topicMemo != null) {\n this.setTopicMemo(props.topicMemo);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.ITransaction[]} transactions\n * @param {HieroProto.proto.ISignedTransaction[]} signedTransactions\n * @param {TransactionId[]} transactionIds\n * @param {AccountId[]} nodeIds\n * @param {HieroProto.proto.ITransactionBody[]} bodies\n * @returns {TopicCreateTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const create =\n /** @type {HieroProto.proto.IConsensusCreateTopicTransactionBody} */ (\n body.consensusCreateTopic\n );\n\n return Transaction._fromProtobufTransactions(\n new TopicCreateTransaction({\n adminKey:\n create.adminKey != null\n ? Key._fromProtobufKey(create.adminKey)\n : undefined,\n submitKey:\n create.submitKey != null\n ? Key._fromProtobufKey(create.submitKey)\n : undefined,\n feeScheduleKey:\n create.feeScheduleKey != null\n ? Key._fromProtobufKey(create.feeScheduleKey)\n : undefined,\n feeExemptKeys:\n create.feeExemptKeyList != null\n ? create.feeExemptKeyList.map((key) =>\n Key._fromProtobufKey(key),\n )\n : undefined,\n autoRenewAccountId:\n create.autoRenewAccount != null\n ? AccountId._fromProtobuf(create.autoRenewAccount)\n : undefined,\n autoRenewPeriod:\n create.autoRenewPeriod != null\n ? create.autoRenewPeriod.seconds != null\n ? create.autoRenewPeriod.seconds\n : undefined\n : undefined,\n customFees:\n create.customFees != null\n ? create.customFees.map((customFee) =>\n CustomFixedFee._fromProtobuf(customFee),\n )\n : undefined,\n topicMemo: create.memo != null ? create.memo : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @deprecated - Use `getTopicMemo()` instead\n * @returns {?string}\n */\n get topicMemo() {\n return this._topicMemo;\n }\n\n /**\n * @returns {?string}\n */\n getTopicMemo() {\n return this._topicMemo;\n }\n\n /**\n * @param {string} topicMemo\n * @returns {this}\n */\n setTopicMemo(topicMemo) {\n this._requireNotFrozen();\n this._topicMemo = topicMemo;\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAdminKey()` instead\n * @returns {?Key}\n */\n get adminKey() {\n return this._adminKey;\n }\n\n /**\n * @returns {?Key}\n */\n getAdminKey() {\n return this._adminKey;\n }\n\n /**\n * @param {Key} adminKey\n * @returns {this}\n */\n setAdminKey(adminKey) {\n this._requireNotFrozen();\n this._adminKey = adminKey;\n\n return this;\n }\n\n /**\n * @deprecated - Use `getSubmitKey()` instead\n * @returns {?Key}\n */\n get submitKey() {\n return this._submitKey;\n }\n\n /**\n * @returns {?Key}\n */\n getSubmitKey() {\n return this._submitKey;\n }\n\n /**\n * @param {Key} submitKey\n * @returns {this}\n */\n setSubmitKey(submitKey) {\n this._requireNotFrozen();\n this._submitKey = submitKey;\n\n return this;\n }\n\n /**\n * Returns the key which allows updates to the new topic’s fees.\n * @returns {?Key}\n */\n getFeeScheduleKey() {\n return this._feeScheduleKey;\n }\n\n /**\n * Sets the key which allows updates to the new topic’s fees.\n * @param {Key} feeScheduleKey\n * @returns {this}\n */\n setFeeScheduleKey(feeScheduleKey) {\n this._requireNotFrozen();\n this._feeScheduleKey = feeScheduleKey;\n\n return this;\n }\n\n /**\n * Returns the keys that will be exempt from paying fees.\n * @returns {Key[]}\n */\n getFeeExemptKeys() {\n return this._feeExemptKeys;\n }\n\n /**\n * Sets the keys that will be exempt from paying fees.\n * @param {Key[]} feeExemptKeys\n * @returns {this}\n */\n setFeeExemptKeys(feeExemptKeys) {\n this._requireNotFrozen();\n this._feeExemptKeys = feeExemptKeys;\n\n return this;\n }\n\n /**\n * Adds a key that will be exempt from paying fees.\n * @param {Key} key\n * @returns {this}\n */\n addFeeExemptKey(key) {\n this._requireNotFrozen();\n this._feeExemptKeys.push(key);\n\n return this;\n }\n\n /**\n * Clears all keys that will be exempt from paying fees.\n * @returns {this}\n */\n clearFeeExemptKeys() {\n this._requireNotFrozen();\n this._feeExemptKeys = [];\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAutoRenewAccountId()` instead\n * @returns {?AccountId}\n */\n get autoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @returns {?AccountId}\n */\n getAutoRenewAccountId() {\n return this._autoRenewAccountId;\n }\n\n /**\n * @param {AccountId | string} autoRenewAccountId\n * @returns {this}\n */\n setAutoRenewAccountId(autoRenewAccountId) {\n this._requireNotFrozen();\n this._autoRenewAccountId =\n autoRenewAccountId instanceof AccountId\n ? autoRenewAccountId\n : AccountId.fromString(autoRenewAccountId);\n\n return this;\n }\n\n /**\n * @deprecated - Use `getAutoRenewPeriod()` instead\n * @returns {Duration}\n */\n get autoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * @returns {Duration}\n */\n getAutoRenewPeriod() {\n return this._autoRenewPeriod;\n }\n\n /**\n * Set the auto renew period for this account.\n *\n * @param {Duration | Long | number} autoRenewPeriod\n * @returns {this}\n */\n setAutoRenewPeriod(autoRenewPeriod) {\n this._requireNotFrozen();\n this._autoRenewPeriod =\n autoRenewPeriod instanceof Duration\n ? autoRenewPeriod\n : new Duration(autoRenewPeriod);\n\n return this;\n }\n\n /**\n * Returns the fixed fees to assess when a message is submitted to the new topic.\n * @returns {CustomFixedFee[]}\n */\n getCustomFees() {\n return this._customFees;\n }\n\n /**\n * Sets the fixed fees to assess when a message is submitted to the new topic.\n *\n * @param {CustomFixedFee[]} customFees\n * @returns {this}\n */\n setCustomFees(customFees) {\n this._requireNotFrozen();\n this._customFees = customFees;\n\n return this;\n }\n\n /**\n * Adds fixed fee to assess when a message is submitted to the new topic.\n *\n * @param {CustomFixedFee} customFee\n * @returns {this}\n */\n addCustomFee(customFee) {\n this._requireNotFrozen();\n\n this._customFees.push(customFee);\n\n return this;\n }\n\n /**\n * Clears fixed fees.\n *\n * @returns {this}\n */\n clearCustomFees() {\n this._requireNotFrozen();\n\n this._customFees = [];\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._autoRenewAccountId != null) {\n this._autoRenewAccountId.validateChecksum(client);\n }\n }\n\n /*\n * Temporarily disabled due to issues with consensus node version 0.60.\n * This will be reintroduced once all networks (previewnet, testnet, mainnet)\n * are on version 0.60.\n *\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n /*\n freezeWith(client) {\n if (!this._autoRenewAccountId && this.transactionId?.accountId) {\n this.setAutoRenewAccountId(this.transactionId?.accountId);\n } else if (!this._autoRenewAccountId && client?.operatorAccountId) {\n this.setAutoRenewAccountId(client.operatorAccountId);\n }\n return super.freezeWith(client);\n }\n */\n\n /**\n * @override\n * @param {?import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {this}\n */\n freezeWith(client) {\n if (!this._autoRenewAccountId && this.transactionId?.accountId) {\n this.setAutoRenewAccountId(this.transactionId?.accountId);\n } else if (!this._autoRenewAccountId && client?.operatorAccountId) {\n this.setAutoRenewAccountId(client.operatorAccountId);\n }\n return super.freezeWith(client);\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.ITransaction} request\n * @returns {Promise<HieroProto.proto.ITransactionResponse>}\n */\n _execute(channel, request) {\n return channel.consensus.createTopic(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"consensusCreateTopic\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.IConsensusCreateTopicTransactionBody}\n */\n _makeTransactionData() {\n return {\n adminKey:\n this._adminKey != null ? this._adminKey._toProtobufKey() : null,\n submitKey:\n this._submitKey != null\n ? this._submitKey._toProtobufKey()\n : null,\n feeScheduleKey:\n this._feeScheduleKey != null\n ? this._feeScheduleKey._toProtobufKey()\n : null,\n feeExemptKeyList: this._feeExemptKeys.map((key) =>\n key._toProtobufKey(),\n ),\n autoRenewAccount:\n this._autoRenewAccountId != null\n ? this._autoRenewAccountId._toProtobuf()\n : null,\n autoRenewPeriod: this._autoRenewPeriod._toProtobuf(),\n customFees: this._customFees.map((customFee) =>\n customFee._toTopicFeeProtobuf(),\n ),\n memo: this._topicMemo,\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp = /** @type {import(\"../Timestamp.js\").default} */ (\n this._transactionIds.current.validStart\n );\n return `TopicCreateTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"consensusCreateTopic\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n TopicCreateTransaction._fromProtobuf,\n);\n"],"names":["TopicCreateTransaction","Transaction","constructor","props","super","this","_defaultMaxTransactionFee","Hbar","_adminKey","_submitKey","_feeScheduleKey","_feeExemptKeys","_autoRenewAccountId","_autoRenewPeriod","Duration","DEFAULT_AUTO_RENEW_PERIOD","_customFees","_topicMemo","adminKey","setAdminKey","submitKey","setSubmitKey","feeScheduleKey","setFeeScheduleKey","feeExemptKeys","setFeeExemptKeys","autoRenewAccountId","setAutoRenewAccountId","autoRenewPeriod","setAutoRenewPeriod","customFees","setCustomFees","topicMemo","setTopicMemo","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","create","_fromProtobufTransactions","Key","_fromProtobufKey","undefined","feeExemptKeyList","map","key","autoRenewAccount","AccountId","seconds","customFee","CustomFixedFee","memo","getTopicMemo","_requireNotFrozen","getAdminKey","getSubmitKey","getFeeScheduleKey","getFeeExemptKeys","addFeeExemptKey","push","clearFeeExemptKeys","getAutoRenewAccountId","fromString","getAutoRenewPeriod","getCustomFees","addCustomFee","clearCustomFees","_validateChecksums","client","validateChecksum","freezeWith","transactionId","accountId","operatorAccountId","_execute","channel","request","consensus","createTopic","_getTransactionDataCase","_makeTransactionData","_toProtobufKey","_toProtobuf","_toTopicFeeProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"yQA+Be,MAAMA,UAA+BC,EAYhD,WAAAC,CAAYC,EAAQ,IAChBC,QAEAC,KAAKC,0BAA4B,IAAIC,EAAK,IAM1CF,KAAKG,UAAY,KAMjBH,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3C,KAAKO,oBACCP,KAAKO,oBAAoBwE,cACzB,KACVxD,gBAAiBvB,KAAKQ,iBAAiBuE,cACvCtD,WAAYzB,KAAKW,YAAY8B,IAAKK,GAC9BA,EAAUkC,uBAEdhC,KAAMhD,KAAKY,WAEvB,CAKI,SAAAqE,GAII,MAAO,0BAFHjF,KAAKkF,gBAAgBC,QACxB,WAC0CC,YACnD,EAGAC,EAAqBC,IACjB,uBAEA3F,EAAuBkC"}
|
|
@@ -7,8 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.cjs"));
|
|
8
8
|
var _TopicId = _interopRequireDefault(require("./TopicId.cjs"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
function
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
12
11
|
// SPDX-License-Identifier: Apache-2.0
|
|
13
12
|
|
|
14
13
|
/**
|
package/lib/topic/TopicId.cjs
CHANGED
|
@@ -9,8 +9,7 @@ var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
|
|
|
9
9
|
var _EvmAddress = _interopRequireDefault(require("../EvmAddress.cjs"));
|
|
10
10
|
var util = _interopRequireWildcard(require("../util.cjs"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
15
14
|
|
|
16
15
|
/**
|
package/lib/topic/TopicInfo.cjs
CHANGED
|
@@ -13,8 +13,7 @@ var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
|
|
|
13
13
|
var _Key = _interopRequireDefault(require("../Key.cjs"));
|
|
14
14
|
var _LedgerId = _interopRequireDefault(require("../LedgerId.cjs"));
|
|
15
15
|
var _CustomFixedFee = _interopRequireDefault(require("../token/CustomFixedFee.cjs"));
|
|
16
|
-
function
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
17
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
18
|
// SPDX-License-Identifier: Apache-2.0
|
|
20
19
|
|
package/lib/topic/TopicInfo.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"./TopicId.js";import o from"../account/AccountId.js";import t from"../Timestamp.js";import u from"long";import n from"../Duration.js";import*as i from"@hashgraph/proto";import s from"../Key.js";import r from"../LedgerId.js";import m from"../token/CustomFixedFee.js";class l{constructor(e){this.topicId=e.topicId,this.topicMemo=e.topicMemo,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.expirationTime=e.expirationTime,this.adminKey=e.adminKey,this.submitKey=e.submitKey,this.feeScheduleKey=e.feeScheduleKey,this.feeExemptKeys=e.feeExemptKeys,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.customFees=e.customFees,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(i){const c=i.topicInfo;return new l({topicId:e._fromProtobuf(i.topicID),topicMemo:null!=c.memo?c.memo:"",runningHash:null!=c.runningHash?c.runningHash:new Uint8Array,sequenceNumber:null!=c.sequenceNumber?c.sequenceNumber instanceof u?c.sequenceNumber:u.fromValue(c.sequenceNumber):u.ZERO,expirationTime:null!=c.expirationTime?t._fromProtobuf(c.expirationTime):null,adminKey:null!=c.adminKey?s._fromProtobufKey(c.adminKey):null,submitKey:null!=c.submitKey?s._fromProtobufKey(c.submitKey):null,feeScheduleKey:null!=c.feeScheduleKey?s._fromProtobufKey(c.feeScheduleKey):null,feeExemptKeys:null!=c.feeExemptKeyList?c.feeExemptKeyList.map(
|
|
1
|
+
import e from"./TopicId.js";import o from"../account/AccountId.js";import t from"../Timestamp.js";import u from"long";import n from"../Duration.js";import*as i from"@hashgraph/proto";import s from"../Key.js";import r from"../LedgerId.js";import m from"../token/CustomFixedFee.js";class l{constructor(e){this.topicId=e.topicId,this.topicMemo=e.topicMemo,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.expirationTime=e.expirationTime,this.adminKey=e.adminKey,this.submitKey=e.submitKey,this.feeScheduleKey=e.feeScheduleKey,this.feeExemptKeys=e.feeExemptKeys,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.customFees=e.customFees,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(i){const c=i.topicInfo;return new l({topicId:e._fromProtobuf(i.topicID),topicMemo:null!=c.memo?c.memo:"",runningHash:null!=c.runningHash?c.runningHash:new Uint8Array,sequenceNumber:null!=c.sequenceNumber?c.sequenceNumber instanceof u?c.sequenceNumber:u.fromValue(c.sequenceNumber):u.ZERO,expirationTime:null!=c.expirationTime?t._fromProtobuf(c.expirationTime):null,adminKey:null!=c.adminKey?s._fromProtobufKey(c.adminKey):null,submitKey:null!=c.submitKey?s._fromProtobufKey(c.submitKey):null,feeScheduleKey:null!=c.feeScheduleKey?s._fromProtobufKey(c.feeScheduleKey):null,feeExemptKeys:null!=c.feeExemptKeyList?c.feeExemptKeyList.map(e=>s._fromProtobufKey(e)):null,autoRenewPeriod:null!=c.autoRenewPeriod?new n(c.autoRenewPeriod.seconds):null,autoRenewAccountId:null!=c.autoRenewAccount?o._fromProtobuf(c.autoRenewAccount):null,customFees:null!=c.customFees?c.customFees.map(e=>m._fromProtobuf(e)):null,ledgerId:null!=c.ledgerId?r.fromBytes(c.ledgerId):null})}_toProtobuf(){return{topicID:this.topicId._toProtobuf(),topicInfo:{memo:this.topicMemo,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber,expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,submitKey:null!=this.submitKey?this.submitKey._toProtobufKey():null,feeScheduleKey:null!=this.feeScheduleKey?this.feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this.feeExemptKeys?this.feeExemptKeys.map(e=>e._toProtobufKey()):null,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,customFees:null!=this.customFees?this.customFees.map(e=>e._toProtobuf()):null}}}static fromBytes(e){return l._fromProtobuf(i.proto.ConsensusGetTopicInfoResponse.decode(e))}toBytes(){return i.proto.ConsensusGetTopicInfoResponse.encode(this._toProtobuf()).finish()}}export{l as default};
|
|
2
2
|
//# sourceMappingURL=TopicInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopicInfo.js","sources":["../../src/topic/TopicInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TopicId from \"./TopicId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Long from \"long\";\nimport Duration from \"../Duration.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport Key from \"../Key.js\";\nimport LedgerId from \"../LedgerId.js\";\nimport CustomFixedFee from \"../token/CustomFixedFee.js\";\n\n/**\n * Current state of a topic.\n */\nexport default class TopicInfo {\n /**\n * @private\n * @param {object} props\n * @param {TopicId} props.topicId\n * @param {string} props.topicMemo\n * @param {Uint8Array} props.runningHash\n * @param {Long} props.sequenceNumber\n * @param {?Timestamp} props.expirationTime\n * @param {?Key} props.adminKey\n * @param {?Key} props.submitKey\n * @param {?Key} props.feeScheduleKey\n * @param {?Key[]} props.feeExemptKeys\n * @param {?Duration} props.autoRenewPeriod\n * @param {?AccountId} props.autoRenewAccountId\n * @param {?CustomFixedFee[]} props.customFees\n * @param {LedgerId|null} props.ledgerId\n */\n constructor(props) {\n /**\n * The ID of the topic for which information is requested.\n *\n * @readonly\n */\n this.topicId = props.topicId;\n\n /**\n * Short publicly visible memo about the topic. No guarantee of uniqueness.\n *\n * @readonly\n */\n this.topicMemo = props.topicMemo;\n\n /**\n * SHA-384 running hash of (previousRunningHash, topicId, consensusTimestamp, sequenceNumber, message).\n *\n * @readonly\n */\n this.runningHash = props.runningHash;\n\n /**\n * Sequence number (starting at 1 for the first submitMessage) of messages on the topic.\n *\n * @readonly\n */\n this.sequenceNumber = props.sequenceNumber;\n\n /**\n * Effective consensus timestamp at (and after) which submitMessage calls will no longer succeed on the topic.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * Access control for update/delete of the topic. Null if there is no key.\n *\n * @readonly\n */\n this.adminKey = props.adminKey;\n\n /**\n * Access control for ConsensusService.submitMessage. Null if there is no key.\n *\n * @readonly\n */\n this.submitKey = props.submitKey;\n\n /**\n * Access control for updating topic fees. Null If there is no key.\n *\n * @readonly\n */\n this.feeScheduleKey = props.feeScheduleKey;\n\n /**\n * The keys that will are exempt from paying fees.\n * @readonly\n */\n this.feeExemptKeys = props.feeExemptKeys;\n /**\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /**\n * @readonly\n */\n this.autoRenewAccountId = props.autoRenewAccountId;\n\n /**\n * The fixed fees assessed when a message is submitted to the topic.\n * @readonly\n */\n this.customFees = props.customFees;\n\n this.ledgerId = props.ledgerId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IConsensusGetTopicInfoResponse} infoResponse\n * @returns {TopicInfo}\n */\n static _fromProtobuf(infoResponse) {\n const info = /** @type {HieroProto.proto.IConsensusTopicInfo} */ (\n infoResponse.topicInfo\n );\n\n return new TopicInfo({\n topicId: TopicId._fromProtobuf(\n /** @type {HieroProto.proto.ITopicID} */ (infoResponse.topicID),\n ),\n topicMemo: info.memo != null ? info.memo : \"\",\n runningHash:\n info.runningHash != null ? info.runningHash : new Uint8Array(),\n sequenceNumber:\n info.sequenceNumber != null\n ? info.sequenceNumber instanceof Long\n ? info.sequenceNumber\n : Long.fromValue(info.sequenceNumber)\n : Long.ZERO,\n expirationTime:\n info.expirationTime != null\n ? Timestamp._fromProtobuf(info.expirationTime)\n : null,\n adminKey:\n info.adminKey != null\n ? Key._fromProtobufKey(info.adminKey)\n : null,\n submitKey:\n info.submitKey != null\n ? Key._fromProtobufKey(info.submitKey)\n : null,\n feeScheduleKey:\n info.feeScheduleKey != null\n ? Key._fromProtobufKey(info.feeScheduleKey)\n : null,\n feeExemptKeys:\n info.feeExemptKeyList != null\n ? info.feeExemptKeyList.map((key) =>\n Key._fromProtobufKey(key),\n )\n : null,\n autoRenewPeriod:\n info.autoRenewPeriod != null\n ? new Duration(\n /** @type {Long} */ (info.autoRenewPeriod.seconds),\n )\n : null,\n autoRenewAccountId:\n info.autoRenewAccount != null\n ? AccountId._fromProtobuf(info.autoRenewAccount)\n : null,\n customFees:\n info.customFees != null\n ? info.customFees.map((customFee) =>\n CustomFixedFee._fromProtobuf(customFee),\n )\n : null,\n ledgerId:\n info.ledgerId != null\n ? LedgerId.fromBytes(info.ledgerId)\n : null,\n });\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.IConsensusGetTopicInfoResponse}\n */\n _toProtobuf() {\n return {\n topicID: this.topicId._toProtobuf(),\n topicInfo: {\n memo: this.topicMemo,\n runningHash: this.runningHash,\n sequenceNumber: this.sequenceNumber,\n expirationTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : null,\n adminKey:\n this.adminKey != null\n ? this.adminKey._toProtobufKey()\n : null,\n submitKey:\n this.submitKey != null\n ? this.submitKey._toProtobufKey()\n : null,\n feeScheduleKey:\n this.feeScheduleKey != null\n ? this.feeScheduleKey._toProtobufKey()\n : null,\n feeExemptKeyList:\n this.feeExemptKeys != null\n ? this.feeExemptKeys.map((key) => key._toProtobufKey())\n : null,\n autoRenewPeriod:\n this.autoRenewPeriod != null\n ? this.autoRenewPeriod._toProtobuf()\n : null,\n autoRenewAccount:\n this.autoRenewAccountId != null\n ? this.autoRenewAccountId._toProtobuf()\n : null,\n customFees:\n this.customFees != null\n ? this.customFees.map((customFee) =>\n customFee._toProtobuf(),\n )\n : null,\n },\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TopicInfo}\n */\n static fromBytes(bytes) {\n return TopicInfo._fromProtobuf(\n HieroProto.proto.ConsensusGetTopicInfoResponse.decode(bytes),\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.ConsensusGetTopicInfoResponse.encode(\n /** @type {HieroProto.proto.ConsensusGetTopicInfoResponse} */ (\n this._toProtobuf()\n ),\n ).finish();\n }\n}\n"],"names":["TopicInfo","constructor","props","this","topicId","topicMemo","runningHash","sequenceNumber","expirationTime","adminKey","submitKey","feeScheduleKey","feeExemptKeys","autoRenewPeriod","autoRenewAccountId","customFees","ledgerId","Object","freeze","_fromProtobuf","infoResponse","info","TopicId","memo","Uint8Array","Long","fromValue","ZERO","Timestamp","Key","_fromProtobufKey","feeExemptKeyList","map","key","Duration","autoRenewAccount","AccountId","customFee","CustomFixedFee","LedgerId","fromBytes","_toProtobuf","topicID","topicInfo","_toProtobufKey","bytes","HieroProto","proto","ConsensusGetTopicInfoResponse","decode","toBytes","encode","finish"],"mappings":"wRAee,MAAMA,EAkBjB,WAAAC,CAAYC,GAMRC,KAAKC,QAAUF,EAAME,QAOrBD,KAAKE,UAAYH,EAAMG,UAOvBF,KAAKG,YAAcJ,EAAMI,YAOzBH,KAAKI,eAAiBL,EAAMK,eAO5BJ,KAAKK,eAAiBN,EAAMM,eAO5BL,KAAKM,SAAWP,EAAMO,SAOtBN,KAAKO,UAAYR,EAAMQ,UAOvBP,KAAKQ,eAAiBT,EAAMS,eAM5BR,KAAKS,cAAgBV,EAAMU,cAI3BT,KAAKU,gBAAkBX,EAAMW,gBAK7BV,KAAKW,mBAAqBZ,EAAMY,mBAMhCX,KAAKY,WAAab,EAAMa,WAExBZ,KAAKa,SAAWd,EAAMc,SAEtBC,OAAOC,OAAOf,KACtB,CAOI,oBAAOgB,CAAcC,GACjB,MAAMC,EACFD,EACH,UAED,OAAO,IAAIpB,EAAU,CACjBI,QAASkB,EAAQH,cAC6BC,EAAoB,SAElEf,UAAwB,MAAbgB,EAAKE,KAAeF,EAAKE,KAAO,GAC3CjB,YACwB,MAApBe,EAAKf,YAAsBe,EAAKf,YAAc,IAAIkB,WACtDjB,eAC2B,MAAvBc,EAAKd,eACCc,EAAKd,0BAA0BkB,EAC3BJ,EAAKd,eACLkB,EAAKC,UAAUL,EAAKd,gBACxBkB,EAAKE,KACfnB,eAC2B,MAAvBa,EAAKb,eACCoB,EAAUT,cAAcE,EAAKb,gBAC7B,KACVC,SACqB,MAAjBY,EAAKZ,SACCoB,EAAIC,iBAAiBT,EAAKZ,UAC1B,KACVC,UACsB,MAAlBW,EAAKX,UACCmB,EAAIC,iBAAiBT,EAAKX,WAC1B,KACVC,eAC2B,MAAvBU,EAAKV,eACCkB,EAAIC,iBAAiBT,EAA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,QACV"}
|
|
1
|
+
{"version":3,"file":"TopicInfo.js","sources":["../../src/topic/TopicInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TopicId from \"./TopicId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Long from \"long\";\nimport Duration from \"../Duration.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport Key from \"../Key.js\";\nimport LedgerId from \"../LedgerId.js\";\nimport CustomFixedFee from \"../token/CustomFixedFee.js\";\n\n/**\n * Current state of a topic.\n */\nexport default class TopicInfo {\n /**\n * @private\n * @param {object} props\n * @param {TopicId} props.topicId\n * @param {string} props.topicMemo\n * @param {Uint8Array} props.runningHash\n * @param {Long} props.sequenceNumber\n * @param {?Timestamp} props.expirationTime\n * @param {?Key} props.adminKey\n * @param {?Key} props.submitKey\n * @param {?Key} props.feeScheduleKey\n * @param {?Key[]} props.feeExemptKeys\n * @param {?Duration} props.autoRenewPeriod\n * @param {?AccountId} props.autoRenewAccountId\n * @param {?CustomFixedFee[]} props.customFees\n * @param {LedgerId|null} props.ledgerId\n */\n constructor(props) {\n /**\n * The ID of the topic for which information is requested.\n *\n * @readonly\n */\n this.topicId = props.topicId;\n\n /**\n * Short publicly visible memo about the topic. No guarantee of uniqueness.\n *\n * @readonly\n */\n this.topicMemo = props.topicMemo;\n\n /**\n * SHA-384 running hash of (previousRunningHash, topicId, consensusTimestamp, sequenceNumber, message).\n *\n * @readonly\n */\n this.runningHash = props.runningHash;\n\n /**\n * Sequence number (starting at 1 for the first submitMessage) of messages on the topic.\n *\n * @readonly\n */\n this.sequenceNumber = props.sequenceNumber;\n\n /**\n * Effective consensus timestamp at (and after) which submitMessage calls will no longer succeed on the topic.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * Access control for update/delete of the topic. Null if there is no key.\n *\n * @readonly\n */\n this.adminKey = props.adminKey;\n\n /**\n * Access control for ConsensusService.submitMessage. Null if there is no key.\n *\n * @readonly\n */\n this.submitKey = props.submitKey;\n\n /**\n * Access control for updating topic fees. Null If there is no key.\n *\n * @readonly\n */\n this.feeScheduleKey = props.feeScheduleKey;\n\n /**\n * The keys that will are exempt from paying fees.\n * @readonly\n */\n this.feeExemptKeys = props.feeExemptKeys;\n /**\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /**\n * @readonly\n */\n this.autoRenewAccountId = props.autoRenewAccountId;\n\n /**\n * The fixed fees assessed when a message is submitted to the topic.\n * @readonly\n */\n this.customFees = props.customFees;\n\n this.ledgerId = props.ledgerId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IConsensusGetTopicInfoResponse} infoResponse\n * @returns {TopicInfo}\n */\n static _fromProtobuf(infoResponse) {\n const info = /** @type {HieroProto.proto.IConsensusTopicInfo} */ (\n infoResponse.topicInfo\n );\n\n return new TopicInfo({\n topicId: TopicId._fromProtobuf(\n /** @type {HieroProto.proto.ITopicID} */ (infoResponse.topicID),\n ),\n topicMemo: info.memo != null ? info.memo : \"\",\n runningHash:\n info.runningHash != null ? info.runningHash : new Uint8Array(),\n sequenceNumber:\n info.sequenceNumber != null\n ? info.sequenceNumber instanceof Long\n ? info.sequenceNumber\n : Long.fromValue(info.sequenceNumber)\n : Long.ZERO,\n expirationTime:\n info.expirationTime != null\n ? Timestamp._fromProtobuf(info.expirationTime)\n : null,\n adminKey:\n info.adminKey != null\n ? Key._fromProtobufKey(info.adminKey)\n : null,\n submitKey:\n info.submitKey != null\n ? Key._fromProtobufKey(info.submitKey)\n : null,\n feeScheduleKey:\n info.feeScheduleKey != null\n ? Key._fromProtobufKey(info.feeScheduleKey)\n : null,\n feeExemptKeys:\n info.feeExemptKeyList != null\n ? info.feeExemptKeyList.map((key) =>\n Key._fromProtobufKey(key),\n )\n : null,\n autoRenewPeriod:\n info.autoRenewPeriod != null\n ? new Duration(\n /** @type {Long} */ (info.autoRenewPeriod.seconds),\n )\n : null,\n autoRenewAccountId:\n info.autoRenewAccount != null\n ? AccountId._fromProtobuf(info.autoRenewAccount)\n : null,\n customFees:\n info.customFees != null\n ? info.customFees.map((customFee) =>\n CustomFixedFee._fromProtobuf(customFee),\n )\n : null,\n ledgerId:\n info.ledgerId != null\n ? LedgerId.fromBytes(info.ledgerId)\n : null,\n });\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.IConsensusGetTopicInfoResponse}\n */\n _toProtobuf() {\n return {\n topicID: this.topicId._toProtobuf(),\n topicInfo: {\n memo: this.topicMemo,\n runningHash: this.runningHash,\n sequenceNumber: this.sequenceNumber,\n expirationTime:\n this.expirationTime != null\n ? this.expirationTime._toProtobuf()\n : null,\n adminKey:\n this.adminKey != null\n ? this.adminKey._toProtobufKey()\n : null,\n submitKey:\n this.submitKey != null\n ? this.submitKey._toProtobufKey()\n : null,\n feeScheduleKey:\n this.feeScheduleKey != null\n ? this.feeScheduleKey._toProtobufKey()\n : null,\n feeExemptKeyList:\n this.feeExemptKeys != null\n ? this.feeExemptKeys.map((key) => key._toProtobufKey())\n : null,\n autoRenewPeriod:\n this.autoRenewPeriod != null\n ? this.autoRenewPeriod._toProtobuf()\n : null,\n autoRenewAccount:\n this.autoRenewAccountId != null\n ? this.autoRenewAccountId._toProtobuf()\n : null,\n customFees:\n this.customFees != null\n ? this.customFees.map((customFee) =>\n customFee._toProtobuf(),\n )\n : null,\n },\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {TopicInfo}\n */\n static fromBytes(bytes) {\n return TopicInfo._fromProtobuf(\n HieroProto.proto.ConsensusGetTopicInfoResponse.decode(bytes),\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.ConsensusGetTopicInfoResponse.encode(\n /** @type {HieroProto.proto.ConsensusGetTopicInfoResponse} */ (\n this._toProtobuf()\n ),\n ).finish();\n }\n}\n"],"names":["TopicInfo","constructor","props","this","topicId","topicMemo","runningHash","sequenceNumber","expirationTime","adminKey","submitKey","feeScheduleKey","feeExemptKeys","autoRenewPeriod","autoRenewAccountId","customFees","ledgerId","Object","freeze","_fromProtobuf","infoResponse","info","TopicId","memo","Uint8Array","Long","fromValue","ZERO","Timestamp","Key","_fromProtobufKey","feeExemptKeyList","map","key","Duration","autoRenewAccount","AccountId","customFee","CustomFixedFee","LedgerId","fromBytes","_toProtobuf","topicID","topicInfo","_toProtobufKey","bytes","HieroProto","proto","ConsensusGetTopicInfoResponse","decode","toBytes","encode","finish"],"mappings":"wRAee,MAAMA,EAkBjB,WAAAC,CAAYC,GAMRC,KAAKC,QAAUF,EAAME,QAOrBD,KAAKE,UAAYH,EAAMG,UAOvBF,KAAKG,YAAcJ,EAAMI,YAOzBH,KAAKI,eAAiBL,EAAMK,eAO5BJ,KAAKK,eAAiBN,EAAMM,eAO5BL,KAAKM,SAAWP,EAAMO,SAOtBN,KAAKO,UAAYR,EAAMQ,UAOvBP,KAAKQ,eAAiBT,EAAMS,eAM5BR,KAAKS,cAAgBV,EAAMU,cAI3BT,KAAKU,gBAAkBX,EAAMW,gBAK7BV,KAAKW,mBAAqBZ,EAAMY,mBAMhCX,KAAKY,WAAab,EAAMa,WAExBZ,KAAKa,SAAWd,EAAMc,SAEtBC,OAAOC,OAAOf,KACtB,CAOI,oBAAOgB,CAAcC,GACjB,MAAMC,EACFD,EACH,UAED,OAAO,IAAIpB,EAAU,CACjBI,QAASkB,EAAQH,cAC6BC,EAAoB,SAElEf,UAAwB,MAAbgB,EAAKE,KAAeF,EAAKE,KAAO,GAC3CjB,YACwB,MAApBe,EAAKf,YAAsBe,EAAKf,YAAc,IAAIkB,WACtDjB,eAC2B,MAAvBc,EAAKd,eACCc,EAAKd,0BAA0BkB,EAC3BJ,EAAKd,eACLkB,EAAKC,UAAUL,EAAKd,gBACxBkB,EAAKE,KACfnB,eAC2B,MAAvBa,EAAKb,eACCoB,EAAUT,cAAcE,EAAKb,gBAC7B,KACVC,SACqB,MAAjBY,EAAKZ,SACCoB,EAAIC,iBAAiB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b,OAAO7C,EAAUmB,cACb2B,EAAWC,MAAMC,8BAA8BC,OAAOJ,GAElE,CAKI,OAAAK,GACI,OAAOJ,EAAWC,MAAMC,8BAA8BG,OAE9ChD,KAAKsC,eAEXW,QACV"}
|
|
@@ -9,8 +9,7 @@ var _TopicId = _interopRequireDefault(require("./TopicId.cjs"));
|
|
|
9
9
|
var _TopicInfo = _interopRequireDefault(require("./TopicInfo.cjs"));
|
|
10
10
|
var _Hbar = _interopRequireDefault(require("../Hbar.cjs"));
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
function
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
15
14
|
|
|
16
15
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import n from"../Timestamp.js";import e from"./TopicMessageChunk.js";import s from"long";import u from"../transaction/TransactionId.js";class t{constructor(n){this.consensusTimestamp=n.consensusTimestamp,this.contents=n.contents,this.runningHash=n.runningHash,this.sequenceNumber=n.sequenceNumber,this.chunks=n.chunks,this.initialTransactionId=n.initialTransactionId,Object.freeze(this)}static _ofSingle(o){return new t({consensusTimestamp:n._fromProtobuf(o.consensusTimestamp),contents:null!=o.message?o.message:new Uint8Array,runningHash:null!=o.runningHash?o.runningHash:new Uint8Array,sequenceNumber:null!=o.sequenceNumber?o.sequenceNumber instanceof s?o.sequenceNumber:s.fromNumber(o.sequenceNumber):s.ZERO,initialTransactionId:null!=o.chunkInfo&&null!=o.chunkInfo.initialTransactionID?u._fromProtobuf(o.chunkInfo.initialTransactionID):null,chunks:[e._fromProtobuf(o)]})}static _ofMany(o){const r=o[o.length-1],i=n._fromProtobuf(r.consensusTimestamp),a=r.runningHash,c=null!=r.sequenceNumber?r.sequenceNumber instanceof s?r.sequenceNumber:s.fromValue(r.sequenceNumber):s.ZERO;o.sort((
|
|
1
|
+
import n from"../Timestamp.js";import e from"./TopicMessageChunk.js";import s from"long";import u from"../transaction/TransactionId.js";class t{constructor(n){this.consensusTimestamp=n.consensusTimestamp,this.contents=n.contents,this.runningHash=n.runningHash,this.sequenceNumber=n.sequenceNumber,this.chunks=n.chunks,this.initialTransactionId=n.initialTransactionId,Object.freeze(this)}static _ofSingle(o){return new t({consensusTimestamp:n._fromProtobuf(o.consensusTimestamp),contents:null!=o.message?o.message:new Uint8Array,runningHash:null!=o.runningHash?o.runningHash:new Uint8Array,sequenceNumber:null!=o.sequenceNumber?o.sequenceNumber instanceof s?o.sequenceNumber:s.fromNumber(o.sequenceNumber):s.ZERO,initialTransactionId:null!=o.chunkInfo&&null!=o.chunkInfo.initialTransactionID?u._fromProtobuf(o.chunkInfo.initialTransactionID):null,chunks:[e._fromProtobuf(o)]})}static _ofMany(o){const r=o[o.length-1],i=n._fromProtobuf(r.consensusTimestamp),a=r.runningHash,c=null!=r.sequenceNumber?r.sequenceNumber instanceof s?r.sequenceNumber:s.fromValue(r.sequenceNumber):s.ZERO;o.sort((n,e)=>(null!=n&&null!=n.chunkInfo&&null!=n.chunkInfo.number?n.chunkInfo.number:0)<(null!=e&&null!=e.chunkInfo&&null!=e.chunkInfo.number?e.chunkInfo.number:0)?-1:1);const m=o.map(n=>e._fromProtobuf(n)),l=m.map(n=>n.contents.length).reduce((n,e)=>n+e,0),f=new Uint8Array(l);let h=0;o.forEach(n=>{f.set(n.message,h),h+=n.message.length});let b=null;return o.length>0&&null!=o[0].chunkInfo&&null!=o[0].chunkInfo.initialTransactionID&&(b=u._fromProtobuf(o[0].chunkInfo.initialTransactionID)),new t({consensusTimestamp:i,contents:f,runningHash:a,sequenceNumber:c,chunks:m,initialTransactionId:b})}}export{t as default};
|
|
2
2
|
//# sourceMappingURL=TopicMessage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopicMessage.js","sources":["../../src/topic/TopicMessage.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Timestamp from \"../Timestamp.js\";\nimport TopicMessageChunk from \"./TopicMessageChunk.js\";\nimport Long from \"long\";\nimport TransactionId from \"../transaction/TransactionId.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITimestamp} HieroProto.proto.ITimestamp\n */\n\n/**\n * @namespace com\n * @typedef {import(\"@hashgraph/proto\").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse\n */\n\nexport default class TopicMessage {\n /**\n * @private\n * @param {object} props\n * @param {Timestamp} props.consensusTimestamp\n * @param {Uint8Array} props.contents\n * @param {Uint8Array} props.runningHash\n * @param {Long} props.sequenceNumber\n * @param {?TransactionId} props.initialTransactionId\n * @param {TopicMessageChunk[]} props.chunks\n */\n constructor(props) {\n /** @readonly */\n this.consensusTimestamp = props.consensusTimestamp;\n /** @readonly */\n this.contents = props.contents;\n /** @readonly */\n this.runningHash = props.runningHash;\n /** @readonly */\n this.sequenceNumber = props.sequenceNumber;\n /** @readonly */\n this.chunks = props.chunks;\n /** @readonly */\n this.initialTransactionId = props.initialTransactionId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse} response\n * @returns {TopicMessage}\n */\n static _ofSingle(response) {\n return new TopicMessage({\n consensusTimestamp: Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */\n (response.consensusTimestamp),\n ),\n contents:\n response.message != null ? response.message : new Uint8Array(),\n runningHash:\n response.runningHash != null\n ? response.runningHash\n : new Uint8Array(),\n sequenceNumber:\n response.sequenceNumber != null\n ? response.sequenceNumber instanceof Long\n ? response.sequenceNumber\n : Long.fromNumber(response.sequenceNumber)\n : Long.ZERO,\n initialTransactionId:\n response.chunkInfo != null &&\n response.chunkInfo.initialTransactionID != null\n ? TransactionId._fromProtobuf(\n response.chunkInfo.initialTransactionID,\n )\n : null,\n chunks: [TopicMessageChunk._fromProtobuf(response)],\n });\n }\n\n /**\n * @internal\n * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse[]} responses\n * @returns {TopicMessage}\n */\n static _ofMany(responses) {\n const length = responses.length;\n\n const last =\n /** @type {com.hedera.mirror.api.proto.IConsensusTopicResponse} */ (\n responses[length - 1]\n );\n\n const consensusTimestamp = Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */\n (last.consensusTimestamp),\n );\n\n const runningHash = /** @type {Uint8Array} */ (last.runningHash);\n\n /**\n * @type {Long}\n */\n const sequenceNumber =\n last.sequenceNumber != null\n ? last.sequenceNumber instanceof Long\n ? last.sequenceNumber\n : Long.fromValue(last.sequenceNumber)\n : Long.ZERO;\n\n responses.sort((a, b) =>\n (a != null\n ? a.chunkInfo != null\n ? a.chunkInfo.number != null\n ? a.chunkInfo.number\n : 0\n : 0\n : 0) <\n (b != null\n ? b.chunkInfo != null\n ? b.chunkInfo.number != null\n ? b.chunkInfo.number\n : 0\n : 0\n : 0)\n ? -1\n : 1,\n );\n\n /**\n * @type {TopicMessageChunk[]}\n */\n const chunks = responses.map(\n /**\n * @type {com.hedera.mirror.api.proto.IConsensusTopicResponse}\n */ (m) => TopicMessageChunk._fromProtobuf(m),\n );\n\n const size = chunks\n .map((chunk) => chunk.contents.length)\n .reduce((sum, current) => sum + current, 0);\n\n const contents = new Uint8Array(size);\n let offset = 0;\n\n responses.forEach((value) => {\n contents.set(/** @type {Uint8Array} */ (value.message), offset);\n offset += /** @type {Uint8Array} */ (value.message).length;\n });\n\n let initialTransactionId = null;\n if (\n responses.length > 0 &&\n responses[0].chunkInfo != null &&\n responses[0].chunkInfo.initialTransactionID != null\n ) {\n initialTransactionId = TransactionId._fromProtobuf(\n responses[0].chunkInfo.initialTransactionID,\n );\n }\n\n return new TopicMessage({\n consensusTimestamp,\n contents,\n runningHash,\n sequenceNumber,\n chunks,\n initialTransactionId,\n });\n }\n}\n"],"names":["TopicMessage","constructor","props","this","consensusTimestamp","contents","runningHash","sequenceNumber","chunks","initialTransactionId","Object","freeze","_ofSingle","response","Timestamp","_fromProtobuf","message","Uint8Array","Long","fromNumber","ZERO","chunkInfo","initialTransactionID","TransactionId","TopicMessageChunk","_ofMany","responses","last","length","fromValue","sort","a","b","number","map","m","size","chunk","reduce","sum","current","offset","forEach","value","set"],"mappings":"wIAiBe,MAAMA,EAWjB,WAAAC,CAAYC,GAERC,KAAKC,mBAAqBF,EAAME,mBAEhCD,KAAKE,SAAWH,EAAMG,SAEtBF,KAAKG,YAAcJ,EAAMI,YAEzBH,KAAKI,eAAiBL,EAAMK,eAE5BJ,KAAKK,OAASN,EAAMM,OAEpBL,KAAKM,qBAAuBP,EAAMO,qBAElCC,OAAOC,OAAOR,KACtB,CAOI,gBAAOS,CAAUC,GACb,OAAO,IAAIb,EAAa,CACpBI,mBAAoBU,EAAUC,cAEzBF,EAA2B,oBAEhCR,SACwB,MAApBQ,EAASG,QAAkBH,EAASG,QAAU,IAAIC,WACtDX,YAC4B,MAAxBO,EAASP,YACHO,EAASP,YACT,IAAIW,WACdV,eAC+B,MAA3BM,EAASN,eACHM,EAASN,0BAA0BW,EAC/BL,EAASN,eACTW,EAAKC,WAAWN,EAASN,gBAC7BW,EAAKE,KACfX,qBAC0B,MAAtBI,EAASQ,WACkC,MAA3CR,EAASQ,UAAUC,qBACbC,EAAcR,cACVF,EAASQ,UAAUC,sBAEvB,KACVd,OAAQ,CAACgB,EAAkBT,cAAcF,KAErD,CAOI,cAAOY,CAAQC,GACX,MAEMC,EAEED,EAJOA,EAAUE,OAIE,GAGrBxB,EAAqBU,EAAUC,cAEhCY,EAAuB,oBAGtBrB,EAAyCqB,EAAgB,YAKzDpB,EACqB,MAAvBoB,EAAKpB,eACCoB,EAAKpB,0BAA0BW,EAC3BS,EAAKpB,eACLW,EAAKW,UAAUF,EAAKpB,gBACxBW,EAAKE,KAEfM,EAAUI,
|
|
1
|
+
{"version":3,"file":"TopicMessage.js","sources":["../../src/topic/TopicMessage.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Timestamp from \"../Timestamp.js\";\nimport TopicMessageChunk from \"./TopicMessageChunk.js\";\nimport Long from \"long\";\nimport TransactionId from \"../transaction/TransactionId.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITimestamp} HieroProto.proto.ITimestamp\n */\n\n/**\n * @namespace com\n * @typedef {import(\"@hashgraph/proto\").com.hedera.mirror.api.proto.IConsensusTopicResponse} com.hedera.mirror.api.proto.IConsensusTopicResponse\n */\n\nexport default class TopicMessage {\n /**\n * @private\n * @param {object} props\n * @param {Timestamp} props.consensusTimestamp\n * @param {Uint8Array} props.contents\n * @param {Uint8Array} props.runningHash\n * @param {Long} props.sequenceNumber\n * @param {?TransactionId} props.initialTransactionId\n * @param {TopicMessageChunk[]} props.chunks\n */\n constructor(props) {\n /** @readonly */\n this.consensusTimestamp = props.consensusTimestamp;\n /** @readonly */\n this.contents = props.contents;\n /** @readonly */\n this.runningHash = props.runningHash;\n /** @readonly */\n this.sequenceNumber = props.sequenceNumber;\n /** @readonly */\n this.chunks = props.chunks;\n /** @readonly */\n this.initialTransactionId = props.initialTransactionId;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse} response\n * @returns {TopicMessage}\n */\n static _ofSingle(response) {\n return new TopicMessage({\n consensusTimestamp: Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */\n (response.consensusTimestamp),\n ),\n contents:\n response.message != null ? response.message : new Uint8Array(),\n runningHash:\n response.runningHash != null\n ? response.runningHash\n : new Uint8Array(),\n sequenceNumber:\n response.sequenceNumber != null\n ? response.sequenceNumber instanceof Long\n ? response.sequenceNumber\n : Long.fromNumber(response.sequenceNumber)\n : Long.ZERO,\n initialTransactionId:\n response.chunkInfo != null &&\n response.chunkInfo.initialTransactionID != null\n ? TransactionId._fromProtobuf(\n response.chunkInfo.initialTransactionID,\n )\n : null,\n chunks: [TopicMessageChunk._fromProtobuf(response)],\n });\n }\n\n /**\n * @internal\n * @param {com.hedera.mirror.api.proto.IConsensusTopicResponse[]} responses\n * @returns {TopicMessage}\n */\n static _ofMany(responses) {\n const length = responses.length;\n\n const last =\n /** @type {com.hedera.mirror.api.proto.IConsensusTopicResponse} */ (\n responses[length - 1]\n );\n\n const consensusTimestamp = Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */\n (last.consensusTimestamp),\n );\n\n const runningHash = /** @type {Uint8Array} */ (last.runningHash);\n\n /**\n * @type {Long}\n */\n const sequenceNumber =\n last.sequenceNumber != null\n ? last.sequenceNumber instanceof Long\n ? last.sequenceNumber\n : Long.fromValue(last.sequenceNumber)\n : Long.ZERO;\n\n responses.sort((a, b) =>\n (a != null\n ? a.chunkInfo != null\n ? a.chunkInfo.number != null\n ? a.chunkInfo.number\n : 0\n : 0\n : 0) <\n (b != null\n ? b.chunkInfo != null\n ? b.chunkInfo.number != null\n ? b.chunkInfo.number\n : 0\n : 0\n : 0)\n ? -1\n : 1,\n );\n\n /**\n * @type {TopicMessageChunk[]}\n */\n const chunks = responses.map(\n /**\n * @type {com.hedera.mirror.api.proto.IConsensusTopicResponse}\n */ (m) => TopicMessageChunk._fromProtobuf(m),\n );\n\n const size = chunks\n .map((chunk) => chunk.contents.length)\n .reduce((sum, current) => sum + current, 0);\n\n const contents = new Uint8Array(size);\n let offset = 0;\n\n responses.forEach((value) => {\n contents.set(/** @type {Uint8Array} */ (value.message), offset);\n offset += /** @type {Uint8Array} */ (value.message).length;\n });\n\n let initialTransactionId = null;\n if (\n responses.length > 0 &&\n responses[0].chunkInfo != null &&\n responses[0].chunkInfo.initialTransactionID != null\n ) {\n initialTransactionId = TransactionId._fromProtobuf(\n responses[0].chunkInfo.initialTransactionID,\n );\n }\n\n return new TopicMessage({\n consensusTimestamp,\n contents,\n runningHash,\n sequenceNumber,\n chunks,\n initialTransactionId,\n });\n }\n}\n"],"names":["TopicMessage","constructor","props","this","consensusTimestamp","contents","runningHash","sequenceNumber","chunks","initialTransactionId","Object","freeze","_ofSingle","response","Timestamp","_fromProtobuf","message","Uint8Array","Long","fromNumber","ZERO","chunkInfo","initialTransactionID","TransactionId","TopicMessageChunk","_ofMany","responses","last","length","fromValue","sort","a","b","number","map","m","size","chunk","reduce","sum","current","offset","forEach","value","set"],"mappings":"wIAiBe,MAAMA,EAWjB,WAAAC,CAAYC,GAERC,KAAKC,mBAAqBF,EAAME,mBAEhCD,KAAKE,SAAWH,EAAMG,SAEtBF,KAAKG,YAAcJ,EAAMI,YAEzBH,KAAKI,eAAiBL,EAAMK,eAE5BJ,KAAKK,OAASN,EAAMM,OAEpBL,KAAKM,qBAAuBP,EAAMO,qBAElCC,OAAOC,OAAOR,KACtB,CAOI,gBAAOS,CAAUC,GACb,OAAO,IAAIb,EAAa,CACpBI,mBAAoBU,EAAUC,cAEzBF,EAA2B,oBAEhCR,SACwB,MAApBQ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Bc,EAAcR,cACjCW,EAAU,GAAGL,UAAUC,uBAIxB,IAAItB,EAAa,CACpBI,qBACAC,WACAC,cACAC,iBACAC,SACAC,wBAEZ"}
|
|
@@ -12,8 +12,7 @@ var _TopicId = _interopRequireDefault(require("./TopicId.cjs"));
|
|
|
12
12
|
var _long = _interopRequireDefault(require("long"));
|
|
13
13
|
var _Timestamp = _interopRequireDefault(require("../Timestamp.cjs"));
|
|
14
14
|
var _Executable = require("../Executable.cjs");
|
|
15
|
-
function
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
17
|
// SPDX-License-Identifier: Apache-2.0
|
|
19
18
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../transaction/TransactionId.js";import e from"./SubscriptionHandle.js";import r from"./TopicMessage.js";import*as i from"@hashgraph/proto";import s from"./TopicId.js";import n from"long";import o from"../Timestamp.js";import{RST_STREAM as l}from"../Executable.js";class a{constructor(t={}){this._topicId=null,null!=t.topicId&&this.setTopicId(t.topicId),this._startTime=null,null!=t.startTime&&this.setStartTime(t.startTime),this._endTime=null,null!=t.endTime&&this.setEndTime(t.endTime),this._limit=null,null!=t.limit&&this.setLimit(t.limit),this._errorHandler=(t,e)=>{console.error(`Error attempting to subscribe to topic: ${null!=this._topicId?this._topicId.toString():""}`)},null!=t.errorHandler&&(this._errorHandler=t.errorHandler),this._listener=null,this._completionHandler=()=>{console.log(`Subscription to topic ${null!=this._topicId?this._topicId.toString():""} complete`)},null!=t.completionHandler&&(this._completionHandler=t.completionHandler),this._maxAttempts=20,this._maxBackoff=8e3,this._retryHandler=t=>{if(null!=t){if(t instanceof Error)return!0;switch(t.code){case 13:return l.test(t.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},null!=t.retryHandler&&(this._retryHandler=t.retryHandler),this._attempt=0,this._handle=null,this.setMaxBackoff(8e3)}get topicId(){return this._topicId}setTopicId(t){return this.requireNotSubscribed(),this._topicId="string"==typeof t?s.fromString(t):t.clone(),this}get startTime(){return this._startTime}setStartTime(t){return this.requireNotSubscribed(),this._startTime=t instanceof o?t:t instanceof Date?o.fromDate(t):new o(t,0),this}get endTime(){return this._endTime}setEndTime(t){return this.requireNotSubscribed(),this._endTime=t instanceof o?t:t instanceof Date?o.fromDate(t):new o(t,0),this}get limit(){return this._limit}setLimit(t){return this.requireNotSubscribed(),this._limit=t instanceof n?t:n.fromValue(t),this}setErrorHandler(t){return this._errorHandler=t,this}setCompletionHandler(t){return this.requireNotSubscribed(),this._completionHandler=t,this}setMaxAttempts(t){return this.requireNotSubscribed(),this._maxAttempts=t,this}setMaxBackoff(t){return this.requireNotSubscribed(),this._maxBackoff=t,this}subscribe(t,r,i){return this._handle=new e,this._listener=i,null!=r&&(this._errorHandler=r),this._makeServerStreamRequest(t),this._handle}_makeServerStreamRequest(t){const e=this._buildConsensusRequest(),r=new Map,i=t._mirrorNetwork.getNextMirrorNode().getChannel().makeServerStreamRequest("ConsensusService","subscribeTopic",e,
|
|
1
|
+
import t from"../transaction/TransactionId.js";import e from"./SubscriptionHandle.js";import r from"./TopicMessage.js";import*as i from"@hashgraph/proto";import s from"./TopicId.js";import n from"long";import o from"../Timestamp.js";import{RST_STREAM as l}from"../Executable.js";class a{constructor(t={}){this._topicId=null,null!=t.topicId&&this.setTopicId(t.topicId),this._startTime=null,null!=t.startTime&&this.setStartTime(t.startTime),this._endTime=null,null!=t.endTime&&this.setEndTime(t.endTime),this._limit=null,null!=t.limit&&this.setLimit(t.limit),this._errorHandler=(t,e)=>{console.error(`Error attempting to subscribe to topic: ${null!=this._topicId?this._topicId.toString():""}`)},null!=t.errorHandler&&(this._errorHandler=t.errorHandler),this._listener=null,this._completionHandler=()=>{console.log(`Subscription to topic ${null!=this._topicId?this._topicId.toString():""} complete`)},null!=t.completionHandler&&(this._completionHandler=t.completionHandler),this._maxAttempts=20,this._maxBackoff=8e3,this._retryHandler=t=>{if(null!=t){if(t instanceof Error)return!0;switch(t.code){case 13:return l.test(t.details.toString());case 5:case 8:case 14:case 17:return!0;default:return!1}}return!1},null!=t.retryHandler&&(this._retryHandler=t.retryHandler),this._attempt=0,this._handle=null,this.setMaxBackoff(8e3)}get topicId(){return this._topicId}setTopicId(t){return this.requireNotSubscribed(),this._topicId="string"==typeof t?s.fromString(t):t.clone(),this}get startTime(){return this._startTime}setStartTime(t){return this.requireNotSubscribed(),this._startTime=t instanceof o?t:t instanceof Date?o.fromDate(t):new o(t,0),this}get endTime(){return this._endTime}setEndTime(t){return this.requireNotSubscribed(),this._endTime=t instanceof o?t:t instanceof Date?o.fromDate(t):new o(t,0),this}get limit(){return this._limit}setLimit(t){return this.requireNotSubscribed(),this._limit=t instanceof n?t:n.fromValue(t),this}setErrorHandler(t){return this._errorHandler=t,this}setCompletionHandler(t){return this.requireNotSubscribed(),this._completionHandler=t,this}setMaxAttempts(t){return this.requireNotSubscribed(),this._maxAttempts=t,this}setMaxBackoff(t){return this.requireNotSubscribed(),this._maxBackoff=t,this}subscribe(t,r,i){return this._handle=new e,this._listener=i,null!=r&&(this._errorHandler=r),this._makeServerStreamRequest(t),this._handle}_makeServerStreamRequest(t){const e=this._buildConsensusRequest(),r=new Map,i=t._mirrorNetwork.getNextMirrorNode().getChannel().makeServerStreamRequest("ConsensusService","subscribeTopic",e,t=>this._handleMessage(t,r),e=>this._handleError(e,t),this._completionHandler);null!=this._handle&&this._handle._setCall(()=>i())}requireNotSubscribed(){if(null!=this._handle)throw new Error("Cannot change fields on an already subscribed query")}_passTopicMessage(t){try{if(null==this._listener)throw new Error("(BUG) listener is unexpectedly not set");this._listener(t)}catch(e){this._errorHandler(t,e)}}_buildConsensusRequest(){return i.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode({topicID:this._topicId?._toProtobuf()??null,consensusStartTime:this._startTime?._toProtobuf()??null,consensusEndTime:this._endTime?._toProtobuf()??null,limit:this._limit}).finish()}_handleMessage(t,e){const s=i.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(t);this._limit?.gt(0)&&(this._limit=this._limit.sub(1)),this._startTime=o._fromProtobuf(s.consensusTimestamp).plusNanos(1),null==s.chunkInfo||null!=s.chunkInfo&&1===s.chunkInfo.total?this._passTopicMessage(r._ofSingle(s)):this._handleChunkedMessage(s,e)}_handleChunkedMessage(e,i){const s=e.chunkInfo,n=s.initialTransactionID,o=s.total,l=t._fromProtobuf(n).toString();let a=[];const h=i.get(l);if(null==h?i.set(l,a):a=h,a.push(e),a.length===o){const t=r._ofMany(a);i.delete(l),this._passTopicMessage(t)}}_handleError(t,e){const r=t instanceof Error?t.message:t.details;this._handle?._unsubscribed||(this.shouldRetry(t)?this._scheduleRetry(e,r):this._errorHandler(null,new Error(r)))}shouldRetry(t){return this._attempt<this._maxAttempts&&this._retryHandler(t)}_scheduleRetry(t,e){const r=Math.min(250*2**this._attempt,this._maxBackoff);console.warn(`Error subscribing to topic ${this._topicId?.toString()??"UNKNOWN"} during attempt ${this._attempt}. Waiting ${r} ms before next attempt: ${e}`),this._attempt+=1,setTimeout(()=>this._makeServerStreamRequest(t),r)}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=TopicMessageQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TopicMessageQuery.js","sources":["../../src/topic/TopicMessageQuery.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport SubscriptionHandle from \"./SubscriptionHandle.js\";\nimport TopicMessage from \"./TopicMessage.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport TopicId from \"./TopicId.js\";\nimport Long from \"long\";\nimport Timestamp from \"../Timestamp.js\";\nimport { RST_STREAM } from \"../Executable.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../channel/MirrorChannel.js\").MirrorError} MirrorError\n */\n\n/**\n * @template {Channel} ChannelT\n * @typedef {import(\"../client/Client.js\").default<ChannelT, MirrorChannel>} Client<ChannelT, MirrorChannel>\n */\n\n/**\n * Represents a class that you can use to subscribe to\n * different topics on Hedera network.\n * @augments {Query<TopicMessageQuery>}\n */\nexport default class TopicMessageQuery {\n /**\n * @param {object} props\n * @param {TopicId | string} [props.topicId]\n * @param {Timestamp} [props.startTime]\n * @param {Timestamp} [props.endTime]\n * @param {(message: TopicMessage | null, error: Error)=> void} [props.errorHandler]\n * @param {() => void} [props.completionHandler]\n * @param {(error: MirrorError | Error | null) => boolean} [props.retryHandler]\n * @param {Long | number} [props.limit]\n */\n constructor(props = {}) {\n /**\n * @private\n * @type {?TopicId}\n */\n this._topicId = null;\n if (props.topicId != null) {\n this.setTopicId(props.topicId);\n }\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._startTime = null;\n if (props.startTime != null) {\n this.setStartTime(props.startTime);\n }\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._endTime = null;\n if (props.endTime != null) {\n this.setEndTime(props.endTime);\n }\n\n /**\n * @private\n * @type {?Long}\n */\n this._limit = null;\n if (props.limit != null) {\n this.setLimit(props.limit);\n }\n\n /**\n * @private\n * @type {(message: TopicMessage | null, error: Error) => void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._errorHandler = (message, error) => {\n console.error(\n `Error attempting to subscribe to topic: ${\n this._topicId != null ? this._topicId.toString() : \"\"\n }`,\n );\n };\n\n if (props.errorHandler != null) {\n this._errorHandler = props.errorHandler;\n }\n\n /*\n * @private\n * @type {((message: TopicMessage) => void) | null}\n */\n this._listener = null;\n\n /**\n * @private\n * @type {() => void}\n */\n this._completionHandler = () => {\n console.log(\n `Subscription to topic ${\n this._topicId != null ? this._topicId.toString() : \"\"\n } complete`,\n );\n };\n\n if (props.completionHandler != null) {\n this._completionHandler = props.completionHandler;\n }\n\n /* The number of times we can retry the grpc call\n *\n * @internal\n * @type {number}\n */\n this._maxAttempts = 20;\n\n /**\n * This is the request's max backoff\n *\n * @internal\n * @type {number}\n */\n this._maxBackoff = 8000;\n\n /**\n * @private\n * @type {(error: MirrorError | Error | null) => boolean}\n */\n this._retryHandler = (error) => {\n if (error != null) {\n if (error instanceof Error) {\n // Retry on all errors which are not `MirrorError` because they're\n // likely lower level HTTP/2 errors\n return true;\n } else {\n // Retry on `NOT_FOUND`, `RESOURCE_EXHAUSTED`, `UNAVAILABLE`, and conditionally on `INTERNAL`\n // if the message matches the right regex.\n switch (error.code) {\n // INTERNAL\n // eslint-disable-next-line no-fallthrough\n case 13:\n return RST_STREAM.test(error.details.toString());\n // NOT_FOUND\n // eslint-disable-next-line no-fallthrough\n case 5:\n // RESOURCE_EXHAUSTED\n // eslint-disable-next-line no-fallthrough\n case 8:\n // UNAVAILABLE\n // eslint-disable-next-line no-fallthrough\n case 14:\n case 17:\n return true;\n default:\n return false;\n }\n }\n }\n\n return false;\n };\n\n if (props.retryHandler != null) {\n this._retryHandler = props.retryHandler;\n }\n\n /**\n * @private\n * @type {number}\n */\n this._attempt = 0;\n\n /**\n * @private\n * @type {SubscriptionHandle | null}\n */\n this._handle = null;\n\n this.setMaxBackoff(8000);\n }\n\n /**\n * @returns {?TopicId}\n */\n get topicId() {\n return this._topicId;\n }\n\n /**\n * @param {TopicId | string} topicId\n * @returns {TopicMessageQuery}\n */\n setTopicId(topicId) {\n this.requireNotSubscribed();\n\n this._topicId =\n typeof topicId === \"string\"\n ? TopicId.fromString(topicId)\n : topicId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get startTime() {\n return this._startTime;\n }\n\n /**\n * @param {Timestamp | Date | number} startTime\n * @returns {TopicMessageQuery}\n */\n setStartTime(startTime) {\n this.requireNotSubscribed();\n\n this._startTime =\n startTime instanceof Timestamp\n ? startTime\n : startTime instanceof Date\n ? Timestamp.fromDate(startTime)\n : new Timestamp(startTime, 0);\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get endTime() {\n return this._endTime;\n }\n\n /**\n * @param {Timestamp | Date | number} endTime\n * @returns {TopicMessageQuery}\n */\n setEndTime(endTime) {\n this.requireNotSubscribed();\n\n this._endTime =\n endTime instanceof Timestamp\n ? endTime\n : endTime instanceof Date\n ? Timestamp.fromDate(endTime)\n : new Timestamp(endTime, 0);\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get limit() {\n return this._limit;\n }\n\n /**\n * @param {Long | number} limit\n * @returns {TopicMessageQuery}\n */\n setLimit(limit) {\n this.requireNotSubscribed();\n\n this._limit = limit instanceof Long ? limit : Long.fromValue(limit);\n\n return this;\n }\n\n /**\n * @param {(message: TopicMessage | null, error: Error)=> void} errorHandler\n * @returns {TopicMessageQuery}\n */\n setErrorHandler(errorHandler) {\n this._errorHandler = errorHandler;\n\n return this;\n }\n\n /**\n * @param {() => void} completionHandler\n * @returns {TopicMessageQuery}\n */\n setCompletionHandler(completionHandler) {\n this.requireNotSubscribed();\n\n this._completionHandler = completionHandler;\n\n return this;\n }\n\n /**\n * @param {number} attempts\n * @returns {this}\n */\n setMaxAttempts(attempts) {\n this.requireNotSubscribed();\n this._maxAttempts = attempts;\n return this;\n }\n\n /**\n * @param {number} backoff\n * @returns {this}\n */\n setMaxBackoff(backoff) {\n this.requireNotSubscribed();\n this._maxBackoff = backoff;\n return this;\n }\n\n /**\n * @param {Client<Channel>} client\n * @param {((message: TopicMessage | null, error: Error) => void) | null} errorHandler\n * @param {(message: TopicMessage) => void} listener\n * @returns {SubscriptionHandle}\n */\n subscribe(client, errorHandler, listener) {\n this._handle = new SubscriptionHandle();\n this._listener = listener;\n\n if (errorHandler != null) {\n this._errorHandler = errorHandler;\n }\n\n this._makeServerStreamRequest(client);\n\n return this._handle;\n }\n\n /**\n * Makes a server stream request to subscribe to topic messages\n * @private\n * @param {Client<Channel>} client\n * @returns {void}\n */\n _makeServerStreamRequest(client) {\n const request = this._buildConsensusRequest();\n /** @type {Map<string, HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]>} */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const list = new Map();\n\n const streamHandler = client._mirrorNetwork\n .getNextMirrorNode()\n .getChannel()\n .makeServerStreamRequest(\n \"ConsensusService\",\n \"subscribeTopic\",\n request,\n (data) => this._handleMessage(data, list),\n (error) => this._handleError(error, client),\n this._completionHandler,\n );\n\n if (this._handle != null) {\n this._handle._setCall(() => streamHandler());\n }\n }\n\n requireNotSubscribed() {\n if (this._handle != null) {\n throw new Error(\n \"Cannot change fields on an already subscribed query\",\n );\n }\n }\n\n /**\n * @private\n * @param {TopicMessage} topicMessage\n */\n _passTopicMessage(topicMessage) {\n try {\n if (this._listener != null) {\n this._listener(topicMessage);\n } else {\n throw new Error(\"(BUG) listener is unexpectedly not set\");\n }\n } catch (error) {\n this._errorHandler(topicMessage, /** @type {Error} */ (error));\n }\n }\n\n /**\n * Builds the consensus topic query request\n * @private\n * @returns {Uint8Array} Encoded consensus topic query\n */\n _buildConsensusRequest() {\n return HieroProto.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode(\n {\n topicID: this._topicId?._toProtobuf() ?? null,\n consensusStartTime: this._startTime?._toProtobuf() ?? null,\n consensusEndTime: this._endTime?._toProtobuf() ?? null,\n limit: this._limit,\n },\n ).finish();\n }\n\n /**\n * Handles an incoming message from the topic subscription\n * @private\n * @param {Uint8Array} data - Raw message data\n * @param {Map<string, HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]>} list\n */\n _handleMessage(data, list) {\n const message =\n HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(\n data,\n );\n\n if (this._limit?.gt(0)) {\n this._limit = this._limit.sub(1);\n }\n\n this._startTime = Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n message.consensusTimestamp\n ),\n ).plusNanos(1);\n\n if (\n message.chunkInfo == null ||\n (message.chunkInfo != null && message.chunkInfo.total === 1)\n ) {\n this._passTopicMessage(TopicMessage._ofSingle(message));\n } else {\n this._handleChunkedMessage(message, list);\n }\n }\n\n /**\n * Handles a chunked message from the topic subscription\n * @private\n * @param {HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse} message - The message response\n * @param {Map<string, HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]>} list\n */\n _handleChunkedMessage(message, list) {\n const chunkInfo =\n /** @type {HieroProto.proto.IConsensusMessageChunkInfo} */ (\n message.chunkInfo\n );\n const initialTransactionID =\n /** @type {HieroProto.proto.ITransactionID} */ (\n chunkInfo.initialTransactionID\n );\n const total = /** @type {number} */ (chunkInfo.total);\n const transactionId =\n TransactionId._fromProtobuf(initialTransactionID).toString();\n\n /** @type {HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]} */\n let responses = [];\n\n const temp = list.get(transactionId);\n if (temp == null) {\n list.set(transactionId, responses);\n } else {\n responses = temp;\n }\n\n responses.push(message);\n\n if (responses.length === total) {\n const topicMessage = TopicMessage._ofMany(responses);\n list.delete(transactionId);\n this._passTopicMessage(topicMessage);\n }\n }\n\n /**\n * Handles errors from the topic subscription\n * @private\n * @param {MirrorError | Error} error - The error that occurred\n * @param {Client<Channel>} client - The client to use for retries\n * @returns {void}\n */\n _handleError(error, client) {\n const message = error instanceof Error ? error.message : error.details;\n\n if (this._handle?._unsubscribed) {\n return;\n }\n\n if (this.shouldRetry(error)) {\n this._scheduleRetry(client, message);\n } else {\n this._errorHandler(null, new Error(message));\n }\n }\n\n /**\n * Determines if a retry should be attempted\n * @private\n * @param {MirrorError | Error} error - The error to check\n * @returns {boolean} - Whether to retry\n */\n shouldRetry(error) {\n return this._attempt < this._maxAttempts && this._retryHandler(error);\n }\n\n /**\n * Schedules a retry of the server stream request\n * @private\n * @param {Client<Channel>} client - The client to use for the retry\n * @param {string} errorMessage - The error message for logging\n * @returns {void}\n */\n _scheduleRetry(client, errorMessage) {\n const delay = Math.min(250 * 2 ** this._attempt, this._maxBackoff);\n\n console.warn(\n `Error subscribing to topic ${this._topicId?.toString() ?? \"UNKNOWN\"} ` +\n `during attempt ${this._attempt}. Waiting ${delay} ms before next attempt: ${errorMessage}`,\n );\n\n this._attempt += 1;\n setTimeout(() => this._makeServerStreamRequest(client), delay);\n }\n}\n"],"names":["TopicMessageQuery","constructor","props","this","_topicId","topicId","setTopicId","_startTime","startTime","setStartTime","_endTime","endTime","setEndTime","_limit","limit","setLimit","_errorHandler","message","error","console","toString","errorHandler","_listener","_completionHandler","log","completionHandler","_maxAttempts","_maxBackoff","_retryHandler","Error","code","RST_STREAM","test","details","retryHandler","_attempt","_handle","setMaxBackoff","requireNotSubscribed","TopicId","fromString","clone","Timestamp","Date","fromDate","Long","fromValue","setErrorHandler","setCompletionHandler","setMaxAttempts","attempts","backoff","subscribe","client","listener","SubscriptionHandle","_makeServerStreamRequest","request","_buildConsensusRequest","list","Map","streamHandler","_mirrorNetwork","getNextMirrorNode","getChannel","makeServerStreamRequest","data","_handleMessage","_handleError","_setCall","_passTopicMessage","topicMessage","HieroProto","com","hedera","mirror","api","proto","ConsensusTopicQuery","encode","topicID","_toProtobuf","consensusStartTime","consensusEndTime","finish","ConsensusTopicResponse","decode","gt","sub","_fromProtobuf","plusNanos","chunkInfo","total","TopicMessage","_ofSingle","_handleChunkedMessage","initialTransactionID","transactionId","TransactionId","responses","temp","get","set","push","length","_ofMany","delete","_unsubscribed","shouldRetry","_scheduleRetry","errorMessage","delay","Math","min","warn","setTimeout"],"mappings":"uRA2Be,MAAMA,EAWjB,WAAAC,CAAYC,EAAQ,IAKhBC,KAAKC,SAAW,KACK,MAAjBF,EAAMG,SACNF,KAAKG,WAAWJ,EAAMG,SAO1BF,KAAKI,WAAa,KACK,MAAnBL,EAAMM,WACNL,KAAKM,aAAaP,EAAMM,WAO5BL,KAAKO,SAAW,KACK,MAAjBR,EAAMS,SACNR,KAAKS,WAAWV,EAAMS,SAO1BR,KAAKU,OAAS,KACK,MAAfX,EAAMY,OACNX,KAAKY,SAASb,EAAMY,OAQxBX,KAAKa,cAAgB,CAACC,EAASC,KAC3BC,QAAQD,MACJ,2CACqB,MAAjBf,KAAKC,SAAmBD,KAAKC,SAASgB,WAAa,KAE1D,EAGqB,MAAtBlB,EAAMmB,eACNlB,KAAKa,cAAgBd,EAAMmB,cAO/BlB,KAAKmB,UAAY,KAMjBnB,KAAKoB,mBAAqB,KACtBJ,QAAQK,IACJ,yBACqB,MAAjBrB,KAAKC,SAAmBD,KAAKC,SAASgB,WAAa,cAE1D,EAG0B,MAA3BlB,EAAMuB,oBACNtB,KAAKoB,mBAAqBrB,EAAMuB,mBAQpCtB,KAAKuB,aAAe,GAQpBvB,KAAKwB,YAAc,IAMnBxB,KAAKyB,cAAiBV,IAClB,GAAa,MAATA,EAAe,CACf,GAAIA,aAAiBW,MAGjB,OAAO,EAIP,OAAQX,EAAMY,MAGV,KAAK,GACD,OAAOC,EAAWC,KAAKd,EAAMe,QAAQb,YAGzC,KAAK,EAGL,KAAK,EAGL,KAAK,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/TopicMessageQuery.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TransactionId from \"../transaction/TransactionId.js\";\nimport SubscriptionHandle from \"./SubscriptionHandle.js\";\nimport TopicMessage from \"./TopicMessage.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport TopicId from \"./TopicId.js\";\nimport Long from \"long\";\nimport Timestamp from \"../Timestamp.js\";\nimport { RST_STREAM } from \"../Executable.js\";\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"../channel/MirrorChannel.js\").MirrorError} MirrorError\n */\n\n/**\n * @template {Channel} ChannelT\n * @typedef {import(\"../client/Client.js\").default<ChannelT, MirrorChannel>} Client<ChannelT, MirrorChannel>\n */\n\n/**\n * Represents a class that you can use to subscribe to\n * different topics on Hedera network.\n * @augments {Query<TopicMessageQuery>}\n */\nexport default class TopicMessageQuery {\n /**\n * @param {object} props\n * @param {TopicId | string} [props.topicId]\n * @param {Timestamp} [props.startTime]\n * @param {Timestamp} [props.endTime]\n * @param {(message: TopicMessage | null, error: Error)=> void} [props.errorHandler]\n * @param {() => void} [props.completionHandler]\n * @param {(error: MirrorError | Error | null) => boolean} [props.retryHandler]\n * @param {Long | number} [props.limit]\n */\n constructor(props = {}) {\n /**\n * @private\n * @type {?TopicId}\n */\n this._topicId = null;\n if (props.topicId != null) {\n this.setTopicId(props.topicId);\n }\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._startTime = null;\n if (props.startTime != null) {\n this.setStartTime(props.startTime);\n }\n\n /**\n * @private\n * @type {?Timestamp}\n */\n this._endTime = null;\n if (props.endTime != null) {\n this.setEndTime(props.endTime);\n }\n\n /**\n * @private\n * @type {?Long}\n */\n this._limit = null;\n if (props.limit != null) {\n this.setLimit(props.limit);\n }\n\n /**\n * @private\n * @type {(message: TopicMessage | null, error: Error) => void}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n this._errorHandler = (message, error) => {\n console.error(\n `Error attempting to subscribe to topic: ${\n this._topicId != null ? this._topicId.toString() : \"\"\n }`,\n );\n };\n\n if (props.errorHandler != null) {\n this._errorHandler = props.errorHandler;\n }\n\n /*\n * @private\n * @type {((message: TopicMessage) => void) | null}\n */\n this._listener = null;\n\n /**\n * @private\n * @type {() => void}\n */\n this._completionHandler = () => {\n console.log(\n `Subscription to topic ${\n this._topicId != null ? this._topicId.toString() : \"\"\n } complete`,\n );\n };\n\n if (props.completionHandler != null) {\n this._completionHandler = props.completionHandler;\n }\n\n /* The number of times we can retry the grpc call\n *\n * @internal\n * @type {number}\n */\n this._maxAttempts = 20;\n\n /**\n * This is the request's max backoff\n *\n * @internal\n * @type {number}\n */\n this._maxBackoff = 8000;\n\n /**\n * @private\n * @type {(error: MirrorError | Error | null) => boolean}\n */\n this._retryHandler = (error) => {\n if (error != null) {\n if (error instanceof Error) {\n // Retry on all errors which are not `MirrorError` because they're\n // likely lower level HTTP/2 errors\n return true;\n } else {\n // Retry on `NOT_FOUND`, `RESOURCE_EXHAUSTED`, `UNAVAILABLE`, and conditionally on `INTERNAL`\n // if the message matches the right regex.\n switch (error.code) {\n // INTERNAL\n // eslint-disable-next-line no-fallthrough\n case 13:\n return RST_STREAM.test(error.details.toString());\n // NOT_FOUND\n // eslint-disable-next-line no-fallthrough\n case 5:\n // RESOURCE_EXHAUSTED\n // eslint-disable-next-line no-fallthrough\n case 8:\n // UNAVAILABLE\n // eslint-disable-next-line no-fallthrough\n case 14:\n case 17:\n return true;\n default:\n return false;\n }\n }\n }\n\n return false;\n };\n\n if (props.retryHandler != null) {\n this._retryHandler = props.retryHandler;\n }\n\n /**\n * @private\n * @type {number}\n */\n this._attempt = 0;\n\n /**\n * @private\n * @type {SubscriptionHandle | null}\n */\n this._handle = null;\n\n this.setMaxBackoff(8000);\n }\n\n /**\n * @returns {?TopicId}\n */\n get topicId() {\n return this._topicId;\n }\n\n /**\n * @param {TopicId | string} topicId\n * @returns {TopicMessageQuery}\n */\n setTopicId(topicId) {\n this.requireNotSubscribed();\n\n this._topicId =\n typeof topicId === \"string\"\n ? TopicId.fromString(topicId)\n : topicId.clone();\n\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get startTime() {\n return this._startTime;\n }\n\n /**\n * @param {Timestamp | Date | number} startTime\n * @returns {TopicMessageQuery}\n */\n setStartTime(startTime) {\n this.requireNotSubscribed();\n\n this._startTime =\n startTime instanceof Timestamp\n ? startTime\n : startTime instanceof Date\n ? Timestamp.fromDate(startTime)\n : new Timestamp(startTime, 0);\n return this;\n }\n\n /**\n * @returns {?Timestamp}\n */\n get endTime() {\n return this._endTime;\n }\n\n /**\n * @param {Timestamp | Date | number} endTime\n * @returns {TopicMessageQuery}\n */\n setEndTime(endTime) {\n this.requireNotSubscribed();\n\n this._endTime =\n endTime instanceof Timestamp\n ? endTime\n : endTime instanceof Date\n ? Timestamp.fromDate(endTime)\n : new Timestamp(endTime, 0);\n return this;\n }\n\n /**\n * @returns {?Long}\n */\n get limit() {\n return this._limit;\n }\n\n /**\n * @param {Long | number} limit\n * @returns {TopicMessageQuery}\n */\n setLimit(limit) {\n this.requireNotSubscribed();\n\n this._limit = limit instanceof Long ? limit : Long.fromValue(limit);\n\n return this;\n }\n\n /**\n * @param {(message: TopicMessage | null, error: Error)=> void} errorHandler\n * @returns {TopicMessageQuery}\n */\n setErrorHandler(errorHandler) {\n this._errorHandler = errorHandler;\n\n return this;\n }\n\n /**\n * @param {() => void} completionHandler\n * @returns {TopicMessageQuery}\n */\n setCompletionHandler(completionHandler) {\n this.requireNotSubscribed();\n\n this._completionHandler = completionHandler;\n\n return this;\n }\n\n /**\n * @param {number} attempts\n * @returns {this}\n */\n setMaxAttempts(attempts) {\n this.requireNotSubscribed();\n this._maxAttempts = attempts;\n return this;\n }\n\n /**\n * @param {number} backoff\n * @returns {this}\n */\n setMaxBackoff(backoff) {\n this.requireNotSubscribed();\n this._maxBackoff = backoff;\n return this;\n }\n\n /**\n * @param {Client<Channel>} client\n * @param {((message: TopicMessage | null, error: Error) => void) | null} errorHandler\n * @param {(message: TopicMessage) => void} listener\n * @returns {SubscriptionHandle}\n */\n subscribe(client, errorHandler, listener) {\n this._handle = new SubscriptionHandle();\n this._listener = listener;\n\n if (errorHandler != null) {\n this._errorHandler = errorHandler;\n }\n\n this._makeServerStreamRequest(client);\n\n return this._handle;\n }\n\n /**\n * Makes a server stream request to subscribe to topic messages\n * @private\n * @param {Client<Channel>} client\n * @returns {void}\n */\n _makeServerStreamRequest(client) {\n const request = this._buildConsensusRequest();\n /** @type {Map<string, HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]>} */\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const list = new Map();\n\n const streamHandler = client._mirrorNetwork\n .getNextMirrorNode()\n .getChannel()\n .makeServerStreamRequest(\n \"ConsensusService\",\n \"subscribeTopic\",\n request,\n (data) => this._handleMessage(data, list),\n (error) => this._handleError(error, client),\n this._completionHandler,\n );\n\n if (this._handle != null) {\n this._handle._setCall(() => streamHandler());\n }\n }\n\n requireNotSubscribed() {\n if (this._handle != null) {\n throw new Error(\n \"Cannot change fields on an already subscribed query\",\n );\n }\n }\n\n /**\n * @private\n * @param {TopicMessage} topicMessage\n */\n _passTopicMessage(topicMessage) {\n try {\n if (this._listener != null) {\n this._listener(topicMessage);\n } else {\n throw new Error(\"(BUG) listener is unexpectedly not set\");\n }\n } catch (error) {\n this._errorHandler(topicMessage, /** @type {Error} */ (error));\n }\n }\n\n /**\n * Builds the consensus topic query request\n * @private\n * @returns {Uint8Array} Encoded consensus topic query\n */\n _buildConsensusRequest() {\n return HieroProto.com.hedera.mirror.api.proto.ConsensusTopicQuery.encode(\n {\n topicID: this._topicId?._toProtobuf() ?? null,\n consensusStartTime: this._startTime?._toProtobuf() ?? null,\n consensusEndTime: this._endTime?._toProtobuf() ?? null,\n limit: this._limit,\n },\n ).finish();\n }\n\n /**\n * Handles an incoming message from the topic subscription\n * @private\n * @param {Uint8Array} data - Raw message data\n * @param {Map<string, HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]>} list\n */\n _handleMessage(data, list) {\n const message =\n HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse.decode(\n data,\n );\n\n if (this._limit?.gt(0)) {\n this._limit = this._limit.sub(1);\n }\n\n this._startTime = Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n message.consensusTimestamp\n ),\n ).plusNanos(1);\n\n if (\n message.chunkInfo == null ||\n (message.chunkInfo != null && message.chunkInfo.total === 1)\n ) {\n this._passTopicMessage(TopicMessage._ofSingle(message));\n } else {\n this._handleChunkedMessage(message, list);\n }\n }\n\n /**\n * Handles a chunked message from the topic subscription\n * @private\n * @param {HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse} message - The message response\n * @param {Map<string, HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]>} list\n */\n _handleChunkedMessage(message, list) {\n const chunkInfo =\n /** @type {HieroProto.proto.IConsensusMessageChunkInfo} */ (\n message.chunkInfo\n );\n const initialTransactionID =\n /** @type {HieroProto.proto.ITransactionID} */ (\n chunkInfo.initialTransactionID\n );\n const total = /** @type {number} */ (chunkInfo.total);\n const transactionId =\n TransactionId._fromProtobuf(initialTransactionID).toString();\n\n /** @type {HieroProto.com.hedera.mirror.api.proto.ConsensusTopicResponse[]} */\n let responses = [];\n\n const temp = list.get(transactionId);\n if (temp == null) {\n list.set(transactionId, responses);\n } else {\n responses = temp;\n }\n\n responses.push(message);\n\n if (responses.length === total) {\n const topicMessage = TopicMessage._ofMany(responses);\n list.delete(transactionId);\n this._passTopicMessage(topicMessage);\n }\n }\n\n /**\n * Handles errors from the topic subscription\n * @private\n * @param {MirrorError | Error} error - The error that occurred\n * @param {Client<Channel>} client - The client to use for retries\n * @returns {void}\n */\n _handleError(error, client) {\n const message = error instanceof Error ? error.message : error.details;\n\n if (this._handle?._unsubscribed) {\n return;\n }\n\n if (this.shouldRetry(error)) {\n this._scheduleRetry(client, message);\n } else {\n this._errorHandler(null, new Error(message));\n }\n }\n\n /**\n * Determines if a retry should be attempted\n * @private\n * @param {MirrorError | Error} error - The error to check\n * @returns {boolean} - Whether to retry\n */\n shouldRetry(error) {\n return this._attempt < this._maxAttempts && this._retryHandler(error);\n }\n\n /**\n * Schedules a retry of the server stream request\n * @private\n * @param {Client<Channel>} client - The client to use for the retry\n * @param {string} errorMessage - The error message for logging\n * @returns {void}\n */\n _scheduleRetry(client, errorMessage) {\n const delay = Math.min(250 * 2 ** this._attempt, this._maxBackoff);\n\n console.warn(\n `Error subscribing to topic ${\n this._topicId?.toString() ?? \"UNKNOWN\"\n } ` +\n `during attempt ${this._attempt}. Waiting ${delay} ms before next attempt: ${errorMessage}`,\n );\n\n this._attempt += 1;\n setTimeout(() => this._makeServerStreamRequest(client), delay);\n }\n}\n"],"names":["TopicMessageQuery","constructor","props","this","_topicId","topicId","setTopicId","_startTime","startTime","setStartTime","_endTime","endTime","setEndTime","_limit","limit","setLimit","_errorHandler","message","error","console","toString","errorHandler","_listener","_completionHandler","log","completionHandler","_maxAttempts","_maxBackoff","_retryHandler","Error","code","RST_STREAM","test","details","retryHandler","_attempt","_handle","setMaxBackoff","requireNotSubscribed","TopicId","fromString","clone","Timestamp","Date","fromDate","Long","fromValue","setErrorHandler","setCompletionHandler","setMaxAttempts","attempts","backoff","subscribe","client","listener","SubscriptionHandle","_makeServerStreamRequest","request","_buildConsensusRequest","list","Map","streamHandler","_mirrorNetwork","getNextMirrorNode","getChannel","makeServerStreamRequest","data","_handleMessage","_handleError","_setCall","_passTopicMessage","topicMessage","HieroProto","com","hedera","mirror","api","proto","ConsensusTopicQuery","encode","topicID","_toProtobuf","consensusStartTime","consensusEndTime","finish","ConsensusTopicResponse","decode","gt","sub","_fromProtobuf","plusNanos","chunkInfo","total","TopicMessage","_ofSingle","_handleChunkedMessage","initialTransactionID","transactionId","TransactionId","responses","temp","get","set","push","length","_ofMany","delete","_un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