@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountId.js","sources":["../../src/account/AccountId.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Long from \"long\";\nimport * as EntityIdHelper from \"../EntityIdHelper.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport Key from \"../Key.js\";\nimport PublicKey from \"../PublicKey.js\";\nimport CACHE from \"../Cache.js\";\nimport EvmAddress from \"../EvmAddress.js\";\nimport * as hex from \".././encoding/hex.js\";\nimport { isLongZeroAddress } from \"../util.js\";\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * The ID for a crypto-currency account on Hedera.\n */\nexport default class AccountId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n * @param {(PublicKey)=} aliasKey\n * @param {(EvmAddress)=} evmAddress\n */\n constructor(props, realm, num, aliasKey, evmAddress) {\n const result = EntityIdHelper.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n this.aliasKey = aliasKey != null ? aliasKey : null;\n this.evmAddress = evmAddress != null ? evmAddress : null;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @description Accepts the following formats as string:\n * - as stand alone nubmers\n * - as shard.realm.num\n * - as shard.realm.hex (wo 0x prefix)\n * - hex (w/wo 0x prefix)\n * @param {string} text\n * @returns {AccountId}\n */\n static fromString(text) {\n let shard = Long.ZERO;\n let realm = Long.ZERO;\n let num = Long.ZERO;\n let aliasKey = undefined;\n let evmAddress = undefined;\n\n if ((text.startsWith(\"0x\") && text.length == 42) || text.length == 40) {\n evmAddress = EvmAddress.fromString(text);\n } else {\n const result = EntityIdHelper.fromStringSplitter(text);\n\n if (Number.isNaN(result.shard) || Number.isNaN(result.realm)) {\n throw new Error(\"invalid format for entity ID\");\n }\n\n if (result.shard != null) shard = Long.fromString(result.shard);\n if (result.realm != null) realm = Long.fromString(result.realm);\n\n if (result.numOrHex.length < 20) {\n num = Long.fromString(result.numOrHex);\n } else if (result.numOrHex.length == 40) {\n evmAddress = EvmAddress.fromString(result.numOrHex);\n } else {\n aliasKey = PublicKey.fromString(result.numOrHex);\n }\n }\n\n return new AccountId(shard, realm, num, aliasKey, evmAddress);\n }\n\n /**\n * @description This handles both long-zero format and evm address format addresses.\n * If an actual evm address is passed, please use `AccountId.populateAccountNum(client)` method\n * to get the actual `num` value, since there is no cryptographic relation to the evm address\n * and cannot be populated directly\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @param {EvmAddress | string} evmAddress\n * @returns {AccountId}\n */\n static fromEvmAddress(shard, realm, evmAddress) {\n const evmAddressObj =\n typeof evmAddress === \"string\"\n ? EvmAddress.fromString(evmAddress)\n : evmAddress;\n\n const [shardLong, realmLong, num, address] =\n EntityIdHelper.fromEvmAddress(\n shard,\n realm,\n evmAddressObj.toString(),\n );\n\n return new AccountId(\n shardLong,\n realmLong,\n num,\n undefined,\n address || undefined,\n );\n }\n\n /**\n * @deprecated - Use `fromEvmAddress` instead\n * @summary Accepts an evm address only as `EvmAddress` type\n * @param {EvmAddress} evmAddress\n * @returns {AccountId}\n */\n static fromEvmPublicAddress(evmAddress) {\n return new AccountId(0, 0, 0, undefined, evmAddress);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IAccountID} id\n * @returns {AccountId}\n */\n static _fromProtobuf(id) {\n let aliasKey = undefined;\n let evmAddress = undefined;\n\n if (id.alias != null) {\n if (id.alias.length === 20) {\n evmAddress = EvmAddress.fromBytes(id.alias);\n } else {\n aliasKey = Key._fromProtobufKey(\n HieroProto.proto.Key.decode(id.alias),\n );\n }\n }\n\n if (!(aliasKey instanceof PublicKey)) {\n aliasKey = undefined;\n }\n\n return new AccountId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.accountNum != null ? id.accountNum : 0,\n aliasKey,\n evmAddress,\n );\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @returns {?EvmAddress}\n */\n getEvmAddress() {\n return this.evmAddress;\n }\n\n /**\n * @description Gets the actual `num` field of the `AccountId` from the Mirror Node.\n * Should be used after generating `AccountId.fromEvmAddress()` because it sets the `num` field to `0`\n * automatically since there is no connection between the `num` and the `evmAddress`\n * @param {Client} client\n * @returns {Promise<AccountId>}\n */\n async populateAccountNum(client) {\n if (this.evmAddress === null) {\n throw new Error(\"field `evmAddress` should not be null\");\n }\n const mirrorUrl = client.mirrorNetwork[0].slice(\n 0,\n client.mirrorNetwork[0].indexOf(\":\"),\n );\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\n const url = `https://${mirrorUrl}/api/v1/accounts/${this.evmAddress.toString()}`;\n const response = await fetch(url);\n const data = await response.json();\n const mirrorAccountId = data.account;\n\n this.num = Long.fromString(\n mirrorAccountId.slice(mirrorAccountId.lastIndexOf(\".\") + 1),\n );\n /* eslint-enable */\n\n return this;\n }\n\n /**\n * @description Populates `evmAddress` field of the `AccountId` extracted from the Mirror Node.\n * @param {Client} client\n * @returns {Promise<AccountId>}\n */\n async populateAccountEvmAddress(client) {\n if (this.num === null) {\n throw new Error(\"field `num` should not be null\");\n }\n const mirrorUrl = client.mirrorNetwork[0].slice(\n 0,\n client.mirrorNetwork[0].indexOf(\":\"),\n );\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\n const url = `https://${mirrorUrl}/api/v1/accounts/${this.num.toString()}`;\n const response = await fetch(url);\n const data = await response.json();\n const mirrorAccountId = data.evm_address;\n\n this.evmAddress = EvmAddress.fromString(mirrorAccountId);\n /* eslint-enable */\n\n return this;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n if (this.aliasKey != null) {\n throw new Error(\n \"cannot calculate checksum with an account ID that has a aliasKey\",\n );\n }\n\n EntityIdHelper.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client,\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {AccountId}\n */\n static fromBytes(bytes) {\n return AccountId._fromProtobuf(\n HieroProto.proto.AccountID.decode(bytes),\n );\n }\n\n /**\n * @deprecated - Use `fromEvmAddress` instead\n * @param {string} address\n * @returns {AccountId}\n */\n static fromSolidityAddress(address) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n if (isLongZeroAddress(hex.decode(address))) {\n return new AccountId(\n ...EntityIdHelper.fromSolidityAddress(address),\n );\n } else {\n return this.fromEvmAddress(0, 0, address);\n }\n }\n\n /**\n * @description Statically compute the EVM address. Use only with non-native EVM accounts.\n * @deprecated - Use `toEvmAddress` instead\n * If the account is EVM-native, the EVM address depends on the public key and is not directly related to the account ID.\n * @returns {string}\n */\n toSolidityAddress() {\n if (this.evmAddress != null) {\n return this.evmAddress.toString();\n } else if (\n this.aliasKey != null &&\n this.aliasKey._key._type == \"secp256k1\"\n ) {\n return this.aliasKey.toEvmAddress();\n } else {\n return EntityIdHelper.toSolidityAddress([\n this.shard,\n this.realm,\n this.num,\n ]);\n }\n }\n\n /**\n * @returns {string} EVM-compatible address representation of the entity\n */\n toEvmAddress() {\n if (this.evmAddress != null) {\n return EntityIdHelper.toEvmAddress(this.evmAddress.toBytes());\n }\n\n return EntityIdHelper.toEvmAddress(this.num);\n }\n\n //TODO remove the comments after we get to HIP-631\n /**\n * @internal\n * @returns {HieroProto.proto.IAccountID}\n */\n _toProtobuf() {\n let alias = null;\n //let evmAddress = null;\n\n if (this.aliasKey != null) {\n alias = HieroProto.proto.Key.encode(\n this.aliasKey._toProtobufKey(),\n ).finish();\n } else if (this.evmAddress != null) {\n alias = this.evmAddress._bytes;\n }\n\n /* if (this.evmAddress != null) {\n evmAddress = this.evmAddress._bytes;\n } */\n\n const isHollowAccount = this.num.eq(Long.fromBigInt(0n)) && alias;\n\n if (alias) {\n return {\n alias: isHollowAccount ? alias : null,\n accountNum: isHollowAccount ? null : this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n return {\n alias: null,\n accountNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.AccountID.encode(this._toProtobuf()).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n let account = this.num.toString();\n\n if (this.aliasKey != null) {\n account = this.aliasKey.toString();\n } else if (this.evmAddress != null) {\n account = this.evmAddress.toString();\n }\n\n return `${this.shard.toString()}.${this.realm.toString()}.${account}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n if (this.aliasKey != null) {\n throw new Error(\n \"cannot calculate checksum with an account ID that has a aliasKey\",\n );\n }\n\n return EntityIdHelper.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @param {this} other\n * @returns {boolean}\n */\n equals(other) {\n let account = false;\n\n if (this.aliasKey != null && other.aliasKey != null) {\n account = this.aliasKey.equals(other.aliasKey);\n } else if (this.evmAddress != null && other.evmAddress != null) {\n account = this.evmAddress.equals(other.evmAddress);\n } else if (\n this.aliasKey == null &&\n other.aliasKey == null &&\n this.evmAddress == null &&\n other.evmAddress == null\n ) {\n account = this.num.eq(other.num);\n }\n\n return (\n this.shard.eq(other.shard) && this.realm.eq(other.realm) && account\n );\n }\n\n /**\n * @returns {AccountId}\n */\n clone() {\n const id = new AccountId(this);\n id._checksum = this._checksum;\n id.aliasKey = this.aliasKey;\n id.evmAddress = this.evmAddress;\n return id;\n }\n\n /**\n * @param {AccountId} other\n * @returns {number}\n */\n compare(other) {\n let comparison = this.shard.compare(other.shard);\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = this.realm.compare(other.realm);\n if (comparison != 0) {\n return comparison;\n }\n\n if (this.aliasKey != null && other.aliasKey != null) {\n const t = this.aliasKey.toString();\n const o = other.aliasKey.toString();\n\n if (t > o) {\n return 1;\n } else if (t < o) {\n return -1;\n } else {\n return 0;\n }\n } else if (this.evmAddress != null && other.evmAddress != null) {\n const t = this.evmAddress.toString();\n const o = other.evmAddress.toString();\n\n if (t > o) {\n return 1;\n } else if (t < o) {\n return -1;\n } else {\n return 0;\n }\n } else if (\n this.aliasKey == null &&\n other.aliasKey == null &&\n this.evmAddress == null &&\n other.evmAddress == null\n ) {\n return this.num.compare(other.num);\n } else {\n return 1;\n }\n }\n}\n\nCACHE.setAccountIdConstructor(\n (shard, realm, key) => new AccountId(shard, realm, Long.ZERO, key),\n);\n"],"names":["AccountId","constructor","props","realm","num","aliasKey","evmAddress","result","EntityIdHelper.constructor","this","shard","_checksum","fromString","text","Long","ZERO","startsWith","length","EvmAddress","EntityIdHelper.fromStringSplitter","Number","isNaN","Error","numOrHex","PublicKey","fromEvmAddress","evmAddressObj","shardLong","realmLong","address","EntityIdHelper.fromEvmAddress","toString","undefined","fromEvmPublicAddress","_fromProtobuf","id","alias","fromBytes","Key","_fromProtobufKey","HieroProto","proto","decode","shardNum","realmNum","accountNum","checksum","getEvmAddress","populateAccountNum","client","mirrorUrl","mirrorNetwork","slice","indexOf","Promise","resolve","setTimeout","url","response","fetch","mirrorAccountId","json","account","lastIndexOf","populateAccountEvmAddress","evm_address","validate","console","warn","validateChecksum","EntityIdHelper.validateChecksum","bytes","AccountID","fromSolidityAddress","isLongZeroAddress","hex.decode","EntityIdHelper.fromSolidityAddress","toSolidityAddress","_key","_type","toEvmAddress","EntityIdHelper.toSolidityAddress","EntityIdHelper.toEvmAddress","toBytes","_toProtobuf","encode","_toProtobufKey","finish","_bytes","isHollowAccount","eq","fromBigInt","toStringWithChecksum","EntityIdHelper.toStringWithChecksum","equals","other","clone","compare","comparison","t","o","CACHE","setAccountIdConstructor","key"],"mappings":"sdAmBe,MAAMA,EAQjB,WAAAC,CAAYC,EAAOC,EAAOC,EAAKC,EAAUC,GACrC,MAAMC,EAASC,EAA2BN,EAAOC,EAAOC,GAExDK,KAAKC,MAAQH,EAAOG,MACpBD,KAAKN,MAAQI,EAAOJ,MACpBM,KAAKL,IAAMG,EAAOH,IAClBK,KAAKJ,SAAuB,MAAZA,EAAmBA,EAAW,KAC9CI,KAAKH,WAA2B,MAAdA,EAAqBA,EAAa,KAKpDG,KAAKE,UAAY,IACzB,CAWI,iBAAOC,CAAWC,GACd,IAGIR,EACAC,EAJAI,EAAQI,EAAKC,KACbZ,EAAQW,EAAKC,KACbX,EAAMU,EAAKC,KAIf,GAA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MAApByF,EAAMzF,WAAoB,CAC5D,MAAM6F,EAAI1F,KAAKH,WAAWyB,WACpBqE,EAAIL,EAAMzF,WAAWyB,WAE3B,OAAIoE,EAAIC,EACG,EACAD,EAAIC,GACF,EAEF,CAEvB,CAAe,OACc,MAAjB3F,KAAKJ,UACa,MAAlB0F,EAAM1F,UACa,MAAnBI,KAAKH,YACe,MAApByF,EAAMzF,WAECG,KAAKL,IAAI6F,QAAQF,EAAM3F,KAEvB,CAEnB,EAGAiG,EAAMC,yBACF,CAAC5F,EAAOP,EAAOoG,IAAQ,IAAIvG,EAAUU,EAAOP,EAAOW,EAAKC,KAAMwF"}
|
|
1
|
+
{"version":3,"file":"AccountId.js","sources":["../../src/account/AccountId.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Long from \"long\";\nimport * as EntityIdHelper from \"../EntityIdHelper.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport Key from \"../Key.js\";\nimport PublicKey from \"../PublicKey.js\";\nimport CACHE from \"../Cache.js\";\nimport EvmAddress from \"../EvmAddress.js\";\nimport * as hex from \".././encoding/hex.js\";\nimport { isLongZeroAddress } from \"../util.js\";\n\n/**\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * The ID for a crypto-currency account on Hedera.\n */\nexport default class AccountId {\n /**\n * @param {number | Long | import(\"../EntityIdHelper\").IEntityId} props\n * @param {(number | Long)=} realm\n * @param {(number | Long)=} num\n * @param {(PublicKey)=} aliasKey\n * @param {(EvmAddress)=} evmAddress\n */\n constructor(props, realm, num, aliasKey, evmAddress) {\n const result = EntityIdHelper.constructor(props, realm, num);\n\n this.shard = result.shard;\n this.realm = result.realm;\n this.num = result.num;\n this.aliasKey = aliasKey != null ? aliasKey : null;\n this.evmAddress = evmAddress != null ? evmAddress : null;\n\n /**\n * @type {string | null}\n */\n this._checksum = null;\n }\n\n /**\n * @description Accepts the following formats as string:\n * - as stand alone nubmers\n * - as shard.realm.num\n * - as shard.realm.hex (wo 0x prefix)\n * - hex (w/wo 0x prefix)\n * @param {string} text\n * @returns {AccountId}\n */\n static fromString(text) {\n let shard = Long.ZERO;\n let realm = Long.ZERO;\n let num = Long.ZERO;\n let aliasKey = undefined;\n let evmAddress = undefined;\n\n if ((text.startsWith(\"0x\") && text.length == 42) || text.length == 40) {\n evmAddress = EvmAddress.fromString(text);\n } else {\n const result = EntityIdHelper.fromStringSplitter(text);\n\n if (Number.isNaN(result.shard) || Number.isNaN(result.realm)) {\n throw new Error(\"invalid format for entity ID\");\n }\n\n if (result.shard != null) shard = Long.fromString(result.shard);\n if (result.realm != null) realm = Long.fromString(result.realm);\n\n if (result.numOrHex.length < 20) {\n num = Long.fromString(result.numOrHex);\n } else if (result.numOrHex.length == 40) {\n evmAddress = EvmAddress.fromString(result.numOrHex);\n } else {\n aliasKey = PublicKey.fromString(result.numOrHex);\n }\n }\n\n return new AccountId(shard, realm, num, aliasKey, evmAddress);\n }\n\n /**\n * @description This handles both long-zero format and evm address format addresses.\n * If an actual evm address is passed, please use `AccountId.populateAccountNum(client)` method\n * to get the actual `num` value, since there is no cryptographic relation to the evm address\n * and cannot be populated directly\n * @param {Long | number} shard\n * @param {Long | number} realm\n * @param {EvmAddress | string} evmAddress\n * @returns {AccountId}\n */\n static fromEvmAddress(shard, realm, evmAddress) {\n const evmAddressObj =\n typeof evmAddress === \"string\"\n ? EvmAddress.fromString(evmAddress)\n : evmAddress;\n\n const [shardLong, realmLong, num, address] =\n EntityIdHelper.fromEvmAddress(\n shard,\n realm,\n evmAddressObj.toString(),\n );\n\n return new AccountId(\n shardLong,\n realmLong,\n num,\n undefined,\n address || undefined,\n );\n }\n\n /**\n * @deprecated - Use `fromEvmAddress` instead\n * @summary Accepts an evm address only as `EvmAddress` type\n * @param {EvmAddress} evmAddress\n * @returns {AccountId}\n */\n static fromEvmPublicAddress(evmAddress) {\n return new AccountId(0, 0, 0, undefined, evmAddress);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IAccountID} id\n * @returns {AccountId}\n */\n static _fromProtobuf(id) {\n let aliasKey = undefined;\n let evmAddress = undefined;\n\n if (id.alias != null) {\n if (id.alias.length === 20) {\n evmAddress = EvmAddress.fromBytes(id.alias);\n } else {\n aliasKey = Key._fromProtobufKey(\n HieroProto.proto.Key.decode(id.alias),\n );\n }\n }\n\n if (!(aliasKey instanceof PublicKey)) {\n aliasKey = undefined;\n }\n\n return new AccountId(\n id.shardNum != null ? id.shardNum : 0,\n id.realmNum != null ? id.realmNum : 0,\n id.accountNum != null ? id.accountNum : 0,\n aliasKey,\n evmAddress,\n );\n }\n\n /**\n * @returns {string | null}\n */\n get checksum() {\n return this._checksum;\n }\n\n /**\n * @returns {?EvmAddress}\n */\n getEvmAddress() {\n return this.evmAddress;\n }\n\n /**\n * @description Gets the actual `num` field of the `AccountId` from the Mirror Node.\n * Should be used after generating `AccountId.fromEvmAddress()` because it sets the `num` field to `0`\n * automatically since there is no connection between the `num` and the `evmAddress`\n * @param {Client} client\n * @returns {Promise<AccountId>}\n */\n async populateAccountNum(client) {\n if (this.evmAddress === null) {\n throw new Error(\"field `evmAddress` should not be null\");\n }\n const mirrorUrl = client.mirrorNetwork[0].slice(\n 0,\n client.mirrorNetwork[0].indexOf(\":\"),\n );\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\n const url = `https://${mirrorUrl}/api/v1/accounts/${this.evmAddress.toString()}`;\n const response = await fetch(url);\n const data = await response.json();\n const mirrorAccountId = data.account;\n\n this.num = Long.fromString(\n mirrorAccountId.slice(mirrorAccountId.lastIndexOf(\".\") + 1),\n );\n /* eslint-enable */\n\n return this;\n }\n\n /**\n * @description Populates `evmAddress` field of the `AccountId` extracted from the Mirror Node.\n * @param {Client} client\n * @returns {Promise<AccountId>}\n */\n async populateAccountEvmAddress(client) {\n if (this.num === null) {\n throw new Error(\"field `num` should not be null\");\n }\n const mirrorUrl = client.mirrorNetwork[0].slice(\n 0,\n client.mirrorNetwork[0].indexOf(\":\"),\n );\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\n const url = `https://${mirrorUrl}/api/v1/accounts/${this.num.toString()}`;\n const response = await fetch(url);\n const data = await response.json();\n const mirrorAccountId = data.evm_address;\n\n this.evmAddress = EvmAddress.fromString(mirrorAccountId);\n /* eslint-enable */\n\n return this;\n }\n\n /**\n * @deprecated - Use `validateChecksum` instead\n * @param {Client} client\n */\n validate(client) {\n console.warn(\"Deprecated: Use `validateChecksum` instead\");\n this.validateChecksum(client);\n }\n\n /**\n * @param {Client} client\n */\n validateChecksum(client) {\n if (this.aliasKey != null) {\n throw new Error(\n \"cannot calculate checksum with an account ID that has a aliasKey\",\n );\n }\n\n EntityIdHelper.validateChecksum(\n this.shard,\n this.realm,\n this.num,\n this._checksum,\n client,\n );\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {AccountId}\n */\n static fromBytes(bytes) {\n return AccountId._fromProtobuf(\n HieroProto.proto.AccountID.decode(bytes),\n );\n }\n\n /**\n * @deprecated - Use `fromEvmAddress` instead\n * @param {string} address\n * @returns {AccountId}\n */\n static fromSolidityAddress(address) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n if (isLongZeroAddress(hex.decode(address))) {\n return new AccountId(\n ...EntityIdHelper.fromSolidityAddress(address),\n );\n } else {\n return this.fromEvmAddress(0, 0, address);\n }\n }\n\n /**\n * @description Statically compute the EVM address. Use only with non-native EVM accounts.\n * @deprecated - Use `toEvmAddress` instead\n * If the account is EVM-native, the EVM address depends on the public key and is not directly related to the account ID.\n * @returns {string}\n */\n toSolidityAddress() {\n if (this.evmAddress != null) {\n return this.evmAddress.toString();\n } else if (\n this.aliasKey != null &&\n this.aliasKey._key._type == \"secp256k1\"\n ) {\n return this.aliasKey.toEvmAddress();\n } else {\n return EntityIdHelper.toSolidityAddress([\n this.shard,\n this.realm,\n this.num,\n ]);\n }\n }\n\n /**\n * @returns {string} EVM-compatible address representation of the entity\n */\n toEvmAddress() {\n if (this.evmAddress != null) {\n return EntityIdHelper.toEvmAddress(this.evmAddress.toBytes());\n }\n\n return EntityIdHelper.toEvmAddress(this.num);\n }\n\n //TODO remove the comments after we get to HIP-631\n /**\n * @internal\n * @returns {HieroProto.proto.IAccountID}\n */\n _toProtobuf() {\n let alias = null;\n //let evmAddress = null;\n\n if (this.aliasKey != null) {\n alias = HieroProto.proto.Key.encode(\n this.aliasKey._toProtobufKey(),\n ).finish();\n } else if (this.evmAddress != null) {\n alias = this.evmAddress._bytes;\n }\n\n /* if (this.evmAddress != null) {\n evmAddress = this.evmAddress._bytes;\n } */\n\n const isHollowAccount = this.num.eq(Long.fromBigInt(0n)) && alias;\n\n if (alias) {\n return {\n alias: isHollowAccount ? alias : null,\n accountNum: isHollowAccount ? null : this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n return {\n alias: null,\n accountNum: this.num,\n shardNum: this.shard,\n realmNum: this.realm,\n };\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.AccountID.encode(this._toProtobuf()).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n let account = this.num.toString();\n\n if (this.aliasKey != null) {\n account = this.aliasKey.toString();\n } else if (this.evmAddress != null) {\n account = this.evmAddress.toString();\n }\n\n return `${this.shard.toString()}.${this.realm.toString()}.${account}`;\n }\n\n /**\n * @param {Client} client\n * @returns {string}\n */\n toStringWithChecksum(client) {\n if (this.aliasKey != null) {\n throw new Error(\n \"cannot calculate checksum with an account ID that has a aliasKey\",\n );\n }\n\n return EntityIdHelper.toStringWithChecksum(this.toString(), client);\n }\n\n /**\n * @param {this} other\n * @returns {boolean}\n */\n equals(other) {\n let account = false;\n\n if (this.aliasKey != null && other.aliasKey != null) {\n account = this.aliasKey.equals(other.aliasKey);\n } else if (this.evmAddress != null && other.evmAddress != null) {\n account = this.evmAddress.equals(other.evmAddress);\n } else if (\n this.aliasKey == null &&\n other.aliasKey == null &&\n this.evmAddress == null &&\n other.evmAddress == null\n ) {\n account = this.num.eq(other.num);\n }\n\n return (\n this.shard.eq(other.shard) && this.realm.eq(other.realm) && account\n );\n }\n\n /**\n * @returns {AccountId}\n */\n clone() {\n const id = new AccountId(this);\n id._checksum = this._checksum;\n id.aliasKey = this.aliasKey;\n id.evmAddress = this.evmAddress;\n return id;\n }\n\n /**\n * @param {AccountId} other\n * @returns {number}\n */\n compare(other) {\n let comparison = this.shard.compare(other.shard);\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = this.realm.compare(other.realm);\n if (comparison != 0) {\n return comparison;\n }\n\n if (this.aliasKey != null && other.aliasKey != null) {\n const t = this.aliasKey.toString();\n const o = other.aliasKey.toString();\n\n if (t > o) {\n return 1;\n } else if (t < o) {\n return -1;\n } else {\n return 0;\n }\n } else if (this.evmAddress != null && other.evmAddress != null) {\n const t = this.evmAddress.toString();\n const o = other.evmAddress.toString();\n\n if (t > o) {\n return 1;\n } else if (t < o) {\n return -1;\n } else {\n return 0;\n }\n } else if (\n this.aliasKey == null &&\n other.aliasKey == null &&\n this.evmAddress == null &&\n other.evmAddress == null\n ) {\n return this.num.compare(other.num);\n } else {\n return 1;\n }\n }\n}\n\nCACHE.setAccountIdConstructor(\n (shard, realm, key) => new AccountId(shard, realm, Long.ZERO, key),\n);\n"],"names":["AccountId","constructor","props","realm","num","aliasKey","evmAddress","result","EntityIdHelper.constructor","this","shard","_checksum","fromString","text","Long","ZERO","startsWith","length","EvmAddress","EntityIdHelper.fromStringSplitter","Number","isNaN","Error","numOrHex","PublicKey","fromEvmAddress","evmAddressObj","shardLong","realmLong","address","EntityIdHelper.fromEvmAddress","toString","undefined","fromEvmPublicAddress","_fromProtobuf","id","alias","fromBytes","Key","_fromProtobufKey","HieroProto","proto","decode","shardNum","realmNum","accountNum","checksum","getEvmAddress","populateAccountNum","client","mirrorUrl","mirrorNetwork","slice","indexOf","Promise","resolve","setTimeout","url","response","fetch","mirrorAccountId","json","account","lastIndexOf","populateAccountEvmAddress","evm_address","validate","console","warn","validateChecksum","EntityIdHelper.validateChecksum","bytes","AccountID","fromSolidityAddress","isLongZeroAddress","hex.decode","EntityIdHelper.fromSolidityAddress","toSolidityAddress","_key","_type","toEvmAddress","EntityIdHelper.toSolidityAddress","EntityIdHelper.toEvmAddress","toBytes","_toProtobuf","encode","_toProtobufKey","finish","_bytes","isHollowAccount","eq","fromBigInt","toStringWithChecksum","EntityIdHelper.toStringWithChecksum","equals","other","clone","compare","comparison","t","o","CACHE","setAccountIdConstructor","key"],"mappings":"sdAmBe,MAAMA,EAQjB,WAAAC,CAAYC,EAAOC,EAAOC,EAAKC,EAAUC,GACrC,MAAMC,EAASC,EAA2BN,EAAOC,EAAOC,GAExDK,KAAKC,MAAQH,EAAOG,MACpBD,KAAKN,MAAQI,EAAOJ,MACpBM,KAAKL,IAAMG,EAAOH,IAClBK,KAAKJ,SAAuB,MAAZA,EAAmBA,EAAW,KAC9CI,KAAKH,WAA2B,MAAdA,EAAqBA,EAAa,KAKpDG,KAAKE,UAAY,IACzB,CAWI,iBAAOC,CAAWC,GACd,IAGIR,EACAC,EAJAI,EAAQI,EAAKC,KACbZ,EAAQW,EAAKC,KACbX,EAAMU,EAAKC,KAIf,GAAKF,EAAKG,WAAW,OAAwB,IAAfH,EAAKI,QAAgC,IAAfJ,EAAKI,OACrDX,EAAaY,EAAWN,WAAWC,OAChC,CACH,MAAMN,EAASY,EAAkCN,GAEjD,GAAIO,OAAOC,MAAMd,EAAOG,QAAUU,OAAOC,MAAMd,EAAOJ,OAClD,MAAM,IAAImB,MAAM,gCAGA,MAAhBf,EAAOG,QAAeA,EAAQI,EAAKF,WAAWL,EAAOG,QACrC,MAAhBH,EAAOJ,QAAeA,EAAQW,EAAKF,WAAWL,EAAOJ,QAErDI,EAAOgB,SAASN,OAAS,GACzBb,EAAMU,EAAKF,WAAWL,EAAOgB,UACI,IAA1BhB,EAAOgB,SAASN,OACvBX,EAAaY,EAAWN,WAAWL,EAAOgB,UAE1ClB,EAAWm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("../Key.cjs"));
|
|
17
17
|
var _PublicKey = _interopRequireDefault(require("../PublicKey.cjs"));
|
|
18
18
|
var _LedgerId = _interopRequireDefault(require("../LedgerId.cjs"));
|
|
19
|
-
function
|
|
20
|
-
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; }
|
|
19
|
+
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); }
|
|
21
20
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
21
|
// SPDX-License-Identifier: Apache-2.0
|
|
23
22
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"./AccountId.js";import o from"../StakingInfo.js";import t from"./LiveHash.js";import i from"../Hbar.js";import n from"../Timestamp.js";import r from"long";import s from"./TokenRelationshipMap.js";import*as c from"@hashgraph/proto";import l from"../Duration.js";import a from"../Key.js";import u from"../PublicKey.js";import h from"../LedgerId.js";class d{constructor(e){this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.isDeleted=e.isDeleted,this.proxyAccountId=e.proxyAccountId,this.proxyReceived=e.proxyReceived,this.key=e.key,this.balance=e.balance,this.sendRecordThreshold=e.sendRecordThreshold,this.receiveRecordThreshold=e.receiveRecordThreshold,this.isReceiverSignatureRequired=e.isReceiverSignatureRequired,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.liveHashes=e.liveHashes,this.tokenRelationships=e.tokenRelationships,this.accountMemo=e.accountMemo,this.ownedNfts=e.ownedNfts,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.aliasKey=e.aliasKey,this.ledgerId=e.ledgerId,this.hbarAllowances=e.hbarAllowances,this.tokenAllowances=e.tokenAllowances,this.nftAllowances=e.nftAllowances,this.ethereumNonce=e.ethereumNonce,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(m){let f=null!=m.alias&&m.alias.length>0?a._fromProtobufKey(c.proto.Key.decode(m.alias)):null;f instanceof u||(f=null);const p=e._fromProtobuf(m.accountID);return new d({accountId:p,contractAccountId:null!=m.contractAccountID?m.contractAccountID:null,isDeleted:null!=m.deleted&&m.deleted,key:a._fromProtobufKey(m.key),balance:i.fromTinybars(null!=m.balance?m.balance:0),sendRecordThreshold:i.fromTinybars(null!=m.generateSendRecordThreshold?m.generateSendRecordThreshold:0),receiveRecordThreshold:i.fromTinybars(null!=m.generateReceiveRecordThreshold?m.generateReceiveRecordThreshold:0),isReceiverSignatureRequired:null!=m.receiverSigRequired&&m.receiverSigRequired,expirationTime:n._fromProtobuf(m.expirationTime),autoRenewPeriod:null!=m.autoRenewPeriod?new l(m.autoRenewPeriod.seconds):new l(0),proxyAccountId:null!=m.proxyAccountID&&0!==r.fromValue(m.proxyAccountID.shardNum).toInt()&&0!==r.fromValue(m.proxyAccountID.realmNum).toInt()&&0!==r.fromValue(m.proxyAccountID.accountNum).toInt()?e._fromProtobuf(m.proxyAccountID):null,proxyReceived:i.fromTinybars(null!=m.proxyReceived?m.proxyReceived:0),liveHashes:(null!=m.liveHashes?m.liveHashes:[]).map(
|
|
1
|
+
import e from"./AccountId.js";import o from"../StakingInfo.js";import t from"./LiveHash.js";import i from"../Hbar.js";import n from"../Timestamp.js";import r from"long";import s from"./TokenRelationshipMap.js";import*as c from"@hashgraph/proto";import l from"../Duration.js";import a from"../Key.js";import u from"../PublicKey.js";import h from"../LedgerId.js";class d{constructor(e){this.accountId=e.accountId,this.contractAccountId=e.contractAccountId,this.isDeleted=e.isDeleted,this.proxyAccountId=e.proxyAccountId,this.proxyReceived=e.proxyReceived,this.key=e.key,this.balance=e.balance,this.sendRecordThreshold=e.sendRecordThreshold,this.receiveRecordThreshold=e.receiveRecordThreshold,this.isReceiverSignatureRequired=e.isReceiverSignatureRequired,this.expirationTime=e.expirationTime,this.autoRenewPeriod=e.autoRenewPeriod,this.liveHashes=e.liveHashes,this.tokenRelationships=e.tokenRelationships,this.accountMemo=e.accountMemo,this.ownedNfts=e.ownedNfts,this.maxAutomaticTokenAssociations=e.maxAutomaticTokenAssociations,this.aliasKey=e.aliasKey,this.ledgerId=e.ledgerId,this.hbarAllowances=e.hbarAllowances,this.tokenAllowances=e.tokenAllowances,this.nftAllowances=e.nftAllowances,this.ethereumNonce=e.ethereumNonce,this.stakingInfo=e.stakingInfo,Object.freeze(this)}static _fromProtobuf(m){let f=null!=m.alias&&m.alias.length>0?a._fromProtobufKey(c.proto.Key.decode(m.alias)):null;f instanceof u||(f=null);const p=e._fromProtobuf(m.accountID);return new d({accountId:p,contractAccountId:null!=m.contractAccountID?m.contractAccountID:null,isDeleted:null!=m.deleted&&m.deleted,key:a._fromProtobufKey(m.key),balance:i.fromTinybars(null!=m.balance?m.balance:0),sendRecordThreshold:i.fromTinybars(null!=m.generateSendRecordThreshold?m.generateSendRecordThreshold:0),receiveRecordThreshold:i.fromTinybars(null!=m.generateReceiveRecordThreshold?m.generateReceiveRecordThreshold:0),isReceiverSignatureRequired:null!=m.receiverSigRequired&&m.receiverSigRequired,expirationTime:n._fromProtobuf(m.expirationTime),autoRenewPeriod:null!=m.autoRenewPeriod?new l(m.autoRenewPeriod.seconds):new l(0),proxyAccountId:null!=m.proxyAccountID&&0!==r.fromValue(m.proxyAccountID.shardNum).toInt()&&0!==r.fromValue(m.proxyAccountID.realmNum).toInt()&&0!==r.fromValue(m.proxyAccountID.accountNum).toInt()?e._fromProtobuf(m.proxyAccountID):null,proxyReceived:i.fromTinybars(null!=m.proxyReceived?m.proxyReceived:0),liveHashes:(null!=m.liveHashes?m.liveHashes:[]).map(e=>t._fromProtobuf(e)),tokenRelationships:s._fromProtobuf(null!=m.tokenRelationships?m.tokenRelationships:[]),accountMemo:null!=m.memo?m.memo:"",ownedNfts:m.ownedNfts?m.ownedNfts:r.ZERO,maxAutomaticTokenAssociations:m.maxAutomaticTokenAssociations?r.fromNumber(m.maxAutomaticTokenAssociations):r.ZERO,aliasKey:f,ledgerId:null!=m.ledgerId?h.fromBytes(m.ledgerId):null,hbarAllowances:[],tokenAllowances:[],nftAllowances:[],ethereumNonce:null!=m.ethereumNonce?m.ethereumNonce:null,stakingInfo:null!=m.stakingInfo?o._fromProtobuf(m.stakingInfo):null})}_toProtobuf(){return{accountID:this.accountId._toProtobuf(),contractAccountID:this.contractAccountId,deleted:this.isDeleted,proxyAccountID:null!=this.proxyAccountId?this.proxyAccountId._toProtobuf():null,proxyReceived:this.proxyReceived.toTinybars(),key:this.key._toProtobufKey(),balance:this.balance.toTinybars(),generateSendRecordThreshold:this.sendRecordThreshold.toTinybars(),generateReceiveRecordThreshold:this.receiveRecordThreshold.toTinybars(),receiverSigRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime._toProtobuf(),autoRenewPeriod:this.autoRenewPeriod._toProtobuf(),liveHashes:this.liveHashes.map(e=>e._toProtobuf()),tokenRelationships:null!=this.tokenRelationships?this.tokenRelationships._toProtobuf():null,memo:this.accountMemo,ownedNfts:this.ownedNfts,maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toInt(),alias:null!=this.aliasKey?c.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null,ledgerId:null!=this.ledgerId?this.ledgerId.toBytes():null,ethereumNonce:this.ethereumNonce,stakingInfo:null!=this.stakingInfo?this.stakingInfo._toProtobuf():null}}static fromBytes(e){return d._fromProtobuf(c.proto.CryptoGetInfoResponse.AccountInfo.decode(e))}toBytes(){return c.proto.CryptoGetInfoResponse.AccountInfo.encode(this._toProtobuf()).finish()}toString(){return JSON.stringify(this.toJSON())}toJSON(){return{balance:this.balance.toString(),accountId:this.accountId.toString(),contractAccountId:this.contractAccountId,isDeleted:this.isDeleted,proxyAccountId:null!=this.proxyAccountId?this.proxyAccountId.toString():null,proxyReceived:this.proxyReceived.toString(),key:null!=this.key?this.key.toString():null,sendRecordThreshold:this.sendRecordThreshold.toString(),receiveRecordThreshold:this.receiveRecordThreshold.toString(),isReceiverSignatureRequired:this.isReceiverSignatureRequired,expirationTime:this.expirationTime.toString(),autoRenewPeriod:this.autoRenewPeriod.toString(),accountMemo:this.accountMemo,ownedNfts:this.ownedNfts.toString(),maxAutomaticTokenAssociations:this.maxAutomaticTokenAssociations.toString(),aliasKey:null!=this.aliasKey?this.aliasKey.toString():null,ledgerId:null!=this.ledgerId?this.ledgerId.toString():null,ethereumNonce:null!=this.ethereumNonce?this.ethereumNonce.toString():null,stakingInfo:null!=this.stakingInfo?this.stakingInfo.toJSON():null}}}export{d as default};
|
|
2
2
|
//# sourceMappingURL=AccountInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountInfo.js","sources":["../../src/account/AccountInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"./AccountId.js\";\nimport StakingInfo from \"../StakingInfo.js\";\nimport LiveHash from \"./LiveHash.js\";\nimport Hbar from \"../Hbar.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Long from \"long\";\nimport TokenRelationshipMap from \"./TokenRelationshipMap.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\nimport PublicKey from \"../PublicKey.js\";\nimport LedgerId from \"../LedgerId.js\";\n\n/**\n * @typedef {import(\"./HbarAllowance.js\").default} HbarAllowance\n * @typedef {import(\"./TokenAllowance.js\").default} TokenAllowance\n * @typedef {import(\"./TokenNftAllowance.js\").default} TokenNftAllowance\n * @typedef {import(\"../StakingInfo.js\").StakingInfoJson} StakingInfoJson\n */\n\n/**\n * @typedef {object} AccountInfoJson\n * @property {string} accountId\n * @property {?string} contractAccountId\n * @property {boolean} isDeleted\n * @property {?string} proxyAccountId\n * @property {string} proxyReceived\n * @property {?string} key\n * @property {string} balance\n * @property {string} sendRecordThreshold\n * @property {string} receiveRecordThreshold\n * @property {boolean} isReceiverSignatureRequired\n * @property {string} expirationTime\n * @property {string} autoRenewPeriod\n * @property {string} accountMemo\n * @property {string} ownedNfts\n * @property {string} maxAutomaticTokenAssociations\n * @property {?string} aliasKey\n * @property {?string} ledgerId\n * @property {?string} ethereumNonce\n * @property {?StakingInfoJson} stakingInfo\n */\n\n/**\n * Current information about an account, including the balance.\n */\nexport default class AccountInfo {\n /**\n * @private\n * @param {object} props\n * @param {AccountId} props.accountId\n * @param {?string} props.contractAccountId\n * @param {boolean} props.isDeleted\n * @param {?AccountId} props.proxyAccountId\n * @param {Hbar} props.proxyReceived\n * @param {Key} props.key\n * @param {Hbar} props.balance\n * @param {Hbar} props.sendRecordThreshold\n * @param {Hbar} props.receiveRecordThreshold\n * @param {boolean} props.isReceiverSignatureRequired\n * @param {Timestamp} props.expirationTime\n * @param {Duration} props.autoRenewPeriod\n * @param {LiveHash[]} props.liveHashes\n * @param {TokenRelationshipMap} props.tokenRelationships\n * @param {string} props.accountMemo\n * @param {Long} props.ownedNfts\n * @param {Long} props.maxAutomaticTokenAssociations\n * @param {PublicKey | null} props.aliasKey\n * @param {LedgerId | null} props.ledgerId\n * @param {HbarAllowance[]} props.hbarAllowances\n * @param {TokenAllowance[]} props.tokenAllowances\n * @param {TokenNftAllowance[]} props.nftAllowances\n * @param {?Long} props.ethereumNonce\n * @param {?StakingInfo} props.stakingInfo\n */\n constructor(props) {\n /**\n * The account ID for which this information applies.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * The Contract Account ID comprising of both the contract instance and the cryptocurrency\n * account owned by the contract instance, in the format used by Solidity.\n *\n * @readonly\n */\n this.contractAccountId = props.contractAccountId;\n\n /**\n * If true, then this account has been deleted, it will disappear when it expires, and\n * all transactions for it will fail except the transaction to extend its expiration date.\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * @deprecated\n *\n * The Account ID of the account to which this is proxy staked. If proxyAccountID is null,\n * or is an invalid account, or is an account that isn't a node, then this account is\n * automatically proxy staked to a node chosen by the network, but without earning payments.\n * If the proxyAccountID account refuses to accept proxy staking , or if it is not currently\n * running a node, then it will behave as if proxyAccountID was null.\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId = props.proxyAccountId;\n\n /**\n * @deprecated\n * The total number of tinybars proxy staked to this account.\n *\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.proxyReceived = props.proxyReceived;\n\n /**\n * The key for the account, which must sign in order to transfer out, or to modify the account\n * in any way other than extending its expiration date.\n *\n * @readonly\n */\n this.key = props.key;\n\n /**\n * The current balance of account.\n *\n * @readonly\n */\n this.balance = props.balance;\n\n /**\n * The threshold amount (in tinybars) for which an account record is created (and this account\n * charged for them) for any send/withdraw transaction.\n *\n * @readonly\n */\n this.sendRecordThreshold = props.sendRecordThreshold;\n\n /**\n * The threshold amount (in tinybars) for which an account record is created\n * (and this account charged for them) for any transaction above this amount.\n *\n * @readonly\n */\n this.receiveRecordThreshold = props.receiveRecordThreshold;\n\n /**\n * If true, no transaction can transfer to this account unless signed by this account's key.\n *\n * @readonly\n */\n this.isReceiverSignatureRequired = props.isReceiverSignatureRequired;\n\n /**\n * The TimeStamp time at which this account is set to expire.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * The duration for expiration time will extend every this many seconds. If there are\n * insufficient funds, then it extends as long as possible. If it is empty when it\n * expires, then it is deleted.\n *\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /** @readonly */\n this.liveHashes = props.liveHashes;\n\n /** @readonly */\n this.tokenRelationships = props.tokenRelationships;\n\n /** @readonly */\n this.accountMemo = props.accountMemo;\n\n /** @readonly */\n this.ownedNfts = props.ownedNfts;\n\n /** @readonly */\n this.maxAutomaticTokenAssociations =\n props.maxAutomaticTokenAssociations;\n\n this.aliasKey = props.aliasKey;\n\n this.ledgerId = props.ledgerId;\n /*\n * @deprecated - no longer supported\n */\n this.hbarAllowances = props.hbarAllowances;\n /*\n * @deprecated - no longer supported\n */\n this.tokenAllowances = props.tokenAllowances;\n /*\n * @deprecated - no longer supported\n */\n this.nftAllowances = props.nftAllowances;\n\n /**\n * The ethereum transaction nonce associated with this account.\n */\n this.ethereumNonce = props.ethereumNonce;\n\n /**\n * Staking metadata for this account.\n */\n this.stakingInfo = props.stakingInfo;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.CryptoGetInfoResponse.IAccountInfo} info\n * @returns {AccountInfo}\n */\n static _fromProtobuf(info) {\n let aliasKey =\n info.alias != null && info.alias.length > 0\n ? Key._fromProtobufKey(HieroProto.proto.Key.decode(info.alias))\n : null;\n\n if (!(aliasKey instanceof PublicKey)) {\n aliasKey = null;\n }\n\n const accountId = AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (info.accountID),\n );\n\n return new AccountInfo({\n accountId,\n contractAccountId:\n info.contractAccountID != null ? info.contractAccountID : null,\n isDeleted: info.deleted != null ? info.deleted : false,\n key: Key._fromProtobufKey(\n /** @type {HieroProto.proto.IKey} */ (info.key),\n ),\n balance: Hbar.fromTinybars(info.balance != null ? info.balance : 0),\n sendRecordThreshold: Hbar.fromTinybars(\n info.generateSendRecordThreshold != null\n ? info.generateSendRecordThreshold\n : 0,\n ),\n receiveRecordThreshold: Hbar.fromTinybars(\n info.generateReceiveRecordThreshold != null\n ? info.generateReceiveRecordThreshold\n : 0,\n ),\n isReceiverSignatureRequired:\n info.receiverSigRequired != null\n ? info.receiverSigRequired\n : false,\n expirationTime: Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.expirationTime\n ),\n ),\n autoRenewPeriod:\n info.autoRenewPeriod != null\n ? new Duration(\n /** @type {Long} */ (info.autoRenewPeriod.seconds),\n )\n : new Duration(0),\n proxyAccountId:\n info.proxyAccountID != null &&\n Long.fromValue(\n /** @type {Long | number} */ (info.proxyAccountID.shardNum),\n ).toInt() !== 0 &&\n Long.fromValue(\n /** @type {Long | number} */ (info.proxyAccountID.realmNum),\n ).toInt() !== 0 &&\n Long.fromValue(\n /** @type {Long | number} */ (\n info.proxyAccountID.accountNum\n ),\n ).toInt() !== 0\n ? AccountId._fromProtobuf(info.proxyAccountID)\n : null,\n proxyReceived: Hbar.fromTinybars(\n info.proxyReceived != null ? info.proxyReceived : 0,\n ),\n liveHashes: (info.liveHashes != null ? info.liveHashes : []).map(\n (hash) => LiveHash._fromProtobuf(hash),\n ),\n tokenRelationships: TokenRelationshipMap._fromProtobuf(\n info.tokenRelationships != null ? info.tokenRelationships : [],\n ),\n accountMemo: info.memo != null ? info.memo : \"\",\n ownedNfts: info.ownedNfts ? info.ownedNfts : Long.ZERO,\n maxAutomaticTokenAssociations: info.maxAutomaticTokenAssociations\n ? Long.fromNumber(info.maxAutomaticTokenAssociations)\n : Long.ZERO,\n aliasKey,\n ledgerId:\n info.ledgerId != null\n ? LedgerId.fromBytes(info.ledgerId)\n : null,\n hbarAllowances: [],\n tokenAllowances: [],\n nftAllowances: [],\n ethereumNonce:\n info.ethereumNonce != null ? info.ethereumNonce : null,\n stakingInfo:\n info.stakingInfo != null\n ? StakingInfo._fromProtobuf(info.stakingInfo)\n : null,\n });\n }\n\n /**\n * @returns {HieroProto.proto.CryptoGetInfoResponse.IAccountInfo}\n */\n _toProtobuf() {\n return {\n accountID: this.accountId._toProtobuf(),\n contractAccountID: this.contractAccountId,\n deleted: this.isDeleted,\n proxyAccountID:\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId != null\n ? // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId._toProtobuf()\n : null,\n // eslint-disable-next-line deprecation/deprecation\n proxyReceived: this.proxyReceived.toTinybars(),\n key: this.key._toProtobufKey(),\n balance: this.balance.toTinybars(),\n generateSendRecordThreshold: this.sendRecordThreshold.toTinybars(),\n generateReceiveRecordThreshold:\n this.receiveRecordThreshold.toTinybars(),\n receiverSigRequired: this.isReceiverSignatureRequired,\n expirationTime: this.expirationTime._toProtobuf(),\n autoRenewPeriod: this.autoRenewPeriod._toProtobuf(),\n liveHashes: this.liveHashes.map((hash) => hash._toProtobuf()),\n tokenRelationships:\n this.tokenRelationships != null\n ? this.tokenRelationships._toProtobuf()\n : null,\n memo: this.accountMemo,\n ownedNfts: this.ownedNfts,\n maxAutomaticTokenAssociations:\n this.maxAutomaticTokenAssociations.toInt(),\n alias:\n this.aliasKey != null\n ? HieroProto.proto.Key.encode(\n this.aliasKey._toProtobufKey(),\n ).finish()\n : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n ethereumNonce: this.ethereumNonce,\n stakingInfo:\n this.stakingInfo != null\n ? this.stakingInfo._toProtobuf()\n : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {AccountInfo}\n */\n static fromBytes(bytes) {\n return AccountInfo._fromProtobuf(\n HieroProto.proto.CryptoGetInfoResponse.AccountInfo.decode(bytes),\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.CryptoGetInfoResponse.AccountInfo.encode(\n this._toProtobuf(),\n ).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {AccountInfoJson}\n */\n toJSON() {\n return {\n balance: this.balance.toString(),\n accountId: this.accountId.toString(),\n contractAccountId: this.contractAccountId,\n isDeleted: this.isDeleted,\n proxyAccountId:\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId != null\n ? // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId.toString()\n : null,\n // eslint-disable-next-line deprecation/deprecation\n proxyReceived: this.proxyReceived.toString(),\n key: this.key != null ? this.key.toString() : null,\n sendRecordThreshold: this.sendRecordThreshold.toString(),\n receiveRecordThreshold: this.receiveRecordThreshold.toString(),\n isReceiverSignatureRequired: this.isReceiverSignatureRequired,\n expirationTime: this.expirationTime.toString(),\n autoRenewPeriod: this.autoRenewPeriod.toString(),\n accountMemo: this.accountMemo,\n ownedNfts: this.ownedNfts.toString(),\n maxAutomaticTokenAssociations:\n this.maxAutomaticTokenAssociations.toString(),\n aliasKey: this.aliasKey != null ? this.aliasKey.toString() : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toString() : null,\n ethereumNonce:\n this.ethereumNonce != null\n ? this.ethereumNonce.toString()\n : null,\n stakingInfo:\n this.stakingInfo != null ? this.stakingInfo.toJSON() : null,\n };\n }\n}\n"],"names":["AccountInfo","constructor","props","this","accountId","contractAccountId","isDeleted","proxyAccountId","proxyReceived","key","balance","sendRecordThreshold","receiveRecordThreshold","isReceiverSignatureRequired","expirationTime","autoRenewPeriod","liveHashes","tokenRelationships","accountMemo","ownedNfts","maxAutomaticTokenAssociations","aliasKey","ledgerId","hbarAllowances","tokenAllowances","nftAllowances","ethereumNonce","stakingInfo","Object","freeze","_fromProtobuf","info","alias","length","Key","_fromProtobufKey","HieroProto","proto","decode","PublicKey","AccountId","contractAccountID","deleted","Hbar","fromTinybars","generateSendRecordThreshold","generateReceiveRecordThreshold","receiverSigRequired","Timestamp","Duration","proxyAccountID","Long","fromValue","toInt","map","hash","LiveHash","TokenRelationshipMap","memo","ZERO","fromNumber","LedgerId","fromBytes","StakingInfo","_toProtobuf","accountID","toTinybars","_toProtobufKey","encode","finish","toBytes","bytes","C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,KAAKC,UAAUxE,KAAKyE,SACnC,CAKI,MAAAA,GACI,MAAO,CACHlE,QAASP,KAAKO,QAAQ+D,WACtBrE,UAAWD,KAAKC,UAAUqE,WAC1BpE,kBAAmBF,KAAKE,kBACxBC,UAAWH,KAAKG,UAChBC,eAE2B,MAAvBJ,KAAKI,eAECJ,KAAKI,eAAekE,WACpB,KAEVjE,cAAeL,KAAKK,cAAciE,WAClChE,IAAiB,MAAZN,KAAKM,IAAcN,KAAKM,IAAIgE,WAAa,KAC9C9D,oBAAqBR,KAAKQ,oBAAoB8D,WAC9C7D,uBAAwBT,KAAKS,uBAAuB6D,WACpD5D,4BAA6BV,KAAKU,4BAClCC,eAAgBX,KAAKW,eAAe2D,WACpC1D,gBAAiBZ,KAAKY,gBAAgB0D,WACtCvD,YAAaf,KAAKe,YAClBC,UAAWhB,KAAKgB,UAAUsD,WAC1BrD,8BACIjB,KAAKiB,8BAA8BqD,WACvCpD,SAA2B,MAAjBlB,KAAKkB,SAAmBlB,KAAKkB,SAASoD,WAAa,KAC7DnD,SAA2B,MAAjBnB,KAAKmB,SAAmBnB,KAAKmB,SAASmD,WAAa,KAC7D/C,cAC0B,MAAtBvB,KAAKuB,cACCvB,KAAKuB,cAAc+C,WACnB,KACV9C,YACwB,MAApBxB,KAAKwB,YAAsBxB,KAAKwB,YAAYiD,SAAW,KAEvE"}
|
|
1
|
+
{"version":3,"file":"AccountInfo.js","sources":["../../src/account/AccountInfo.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"./AccountId.js\";\nimport StakingInfo from \"../StakingInfo.js\";\nimport LiveHash from \"./LiveHash.js\";\nimport Hbar from \"../Hbar.js\";\nimport Timestamp from \"../Timestamp.js\";\nimport Long from \"long\";\nimport TokenRelationshipMap from \"./TokenRelationshipMap.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\nimport PublicKey from \"../PublicKey.js\";\nimport LedgerId from \"../LedgerId.js\";\n\n/**\n * @typedef {import(\"./HbarAllowance.js\").default} HbarAllowance\n * @typedef {import(\"./TokenAllowance.js\").default} TokenAllowance\n * @typedef {import(\"./TokenNftAllowance.js\").default} TokenNftAllowance\n * @typedef {import(\"../StakingInfo.js\").StakingInfoJson} StakingInfoJson\n */\n\n/**\n * @typedef {object} AccountInfoJson\n * @property {string} accountId\n * @property {?string} contractAccountId\n * @property {boolean} isDeleted\n * @property {?string} proxyAccountId\n * @property {string} proxyReceived\n * @property {?string} key\n * @property {string} balance\n * @property {string} sendRecordThreshold\n * @property {string} receiveRecordThreshold\n * @property {boolean} isReceiverSignatureRequired\n * @property {string} expirationTime\n * @property {string} autoRenewPeriod\n * @property {string} accountMemo\n * @property {string} ownedNfts\n * @property {string} maxAutomaticTokenAssociations\n * @property {?string} aliasKey\n * @property {?string} ledgerId\n * @property {?string} ethereumNonce\n * @property {?StakingInfoJson} stakingInfo\n */\n\n/**\n * Current information about an account, including the balance.\n */\nexport default class AccountInfo {\n /**\n * @private\n * @param {object} props\n * @param {AccountId} props.accountId\n * @param {?string} props.contractAccountId\n * @param {boolean} props.isDeleted\n * @param {?AccountId} props.proxyAccountId\n * @param {Hbar} props.proxyReceived\n * @param {Key} props.key\n * @param {Hbar} props.balance\n * @param {Hbar} props.sendRecordThreshold\n * @param {Hbar} props.receiveRecordThreshold\n * @param {boolean} props.isReceiverSignatureRequired\n * @param {Timestamp} props.expirationTime\n * @param {Duration} props.autoRenewPeriod\n * @param {LiveHash[]} props.liveHashes\n * @param {TokenRelationshipMap} props.tokenRelationships\n * @param {string} props.accountMemo\n * @param {Long} props.ownedNfts\n * @param {Long} props.maxAutomaticTokenAssociations\n * @param {PublicKey | null} props.aliasKey\n * @param {LedgerId | null} props.ledgerId\n * @param {HbarAllowance[]} props.hbarAllowances\n * @param {TokenAllowance[]} props.tokenAllowances\n * @param {TokenNftAllowance[]} props.nftAllowances\n * @param {?Long} props.ethereumNonce\n * @param {?StakingInfo} props.stakingInfo\n */\n constructor(props) {\n /**\n * The account ID for which this information applies.\n *\n * @readonly\n */\n this.accountId = props.accountId;\n\n /**\n * The Contract Account ID comprising of both the contract instance and the cryptocurrency\n * account owned by the contract instance, in the format used by Solidity.\n *\n * @readonly\n */\n this.contractAccountId = props.contractAccountId;\n\n /**\n * If true, then this account has been deleted, it will disappear when it expires, and\n * all transactions for it will fail except the transaction to extend its expiration date.\n *\n * @readonly\n */\n this.isDeleted = props.isDeleted;\n\n /**\n * @deprecated\n *\n * The Account ID of the account to which this is proxy staked. If proxyAccountID is null,\n * or is an invalid account, or is an account that isn't a node, then this account is\n * automatically proxy staked to a node chosen by the network, but without earning payments.\n * If the proxyAccountID account refuses to accept proxy staking , or if it is not currently\n * running a node, then it will behave as if proxyAccountID was null.\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId = props.proxyAccountId;\n\n /**\n * @deprecated\n * The total number of tinybars proxy staked to this account.\n *\n * @readonly\n */\n // eslint-disable-next-line deprecation/deprecation\n this.proxyReceived = props.proxyReceived;\n\n /**\n * The key for the account, which must sign in order to transfer out, or to modify the account\n * in any way other than extending its expiration date.\n *\n * @readonly\n */\n this.key = props.key;\n\n /**\n * The current balance of account.\n *\n * @readonly\n */\n this.balance = props.balance;\n\n /**\n * The threshold amount (in tinybars) for which an account record is created (and this account\n * charged for them) for any send/withdraw transaction.\n *\n * @readonly\n */\n this.sendRecordThreshold = props.sendRecordThreshold;\n\n /**\n * The threshold amount (in tinybars) for which an account record is created\n * (and this account charged for them) for any transaction above this amount.\n *\n * @readonly\n */\n this.receiveRecordThreshold = props.receiveRecordThreshold;\n\n /**\n * If true, no transaction can transfer to this account unless signed by this account's key.\n *\n * @readonly\n */\n this.isReceiverSignatureRequired = props.isReceiverSignatureRequired;\n\n /**\n * The TimeStamp time at which this account is set to expire.\n *\n * @readonly\n */\n this.expirationTime = props.expirationTime;\n\n /**\n * The duration for expiration time will extend every this many seconds. If there are\n * insufficient funds, then it extends as long as possible. If it is empty when it\n * expires, then it is deleted.\n *\n * @readonly\n */\n this.autoRenewPeriod = props.autoRenewPeriod;\n\n /** @readonly */\n this.liveHashes = props.liveHashes;\n\n /** @readonly */\n this.tokenRelationships = props.tokenRelationships;\n\n /** @readonly */\n this.accountMemo = props.accountMemo;\n\n /** @readonly */\n this.ownedNfts = props.ownedNfts;\n\n /** @readonly */\n this.maxAutomaticTokenAssociations =\n props.maxAutomaticTokenAssociations;\n\n this.aliasKey = props.aliasKey;\n\n this.ledgerId = props.ledgerId;\n /*\n * @deprecated - no longer supported\n */\n this.hbarAllowances = props.hbarAllowances;\n /*\n * @deprecated - no longer supported\n */\n this.tokenAllowances = props.tokenAllowances;\n /*\n * @deprecated - no longer supported\n */\n this.nftAllowances = props.nftAllowances;\n\n /**\n * The ethereum transaction nonce associated with this account.\n */\n this.ethereumNonce = props.ethereumNonce;\n\n /**\n * Staking metadata for this account.\n */\n this.stakingInfo = props.stakingInfo;\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.CryptoGetInfoResponse.IAccountInfo} info\n * @returns {AccountInfo}\n */\n static _fromProtobuf(info) {\n let aliasKey =\n info.alias != null && info.alias.length > 0\n ? Key._fromProtobufKey(HieroProto.proto.Key.decode(info.alias))\n : null;\n\n if (!(aliasKey instanceof PublicKey)) {\n aliasKey = null;\n }\n\n const accountId = AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (info.accountID),\n );\n\n return new AccountInfo({\n accountId,\n contractAccountId:\n info.contractAccountID != null ? info.contractAccountID : null,\n isDeleted: info.deleted != null ? info.deleted : false,\n key: Key._fromProtobufKey(\n /** @type {HieroProto.proto.IKey} */ (info.key),\n ),\n balance: Hbar.fromTinybars(info.balance != null ? info.balance : 0),\n sendRecordThreshold: Hbar.fromTinybars(\n info.generateSendRecordThreshold != null\n ? info.generateSendRecordThreshold\n : 0,\n ),\n receiveRecordThreshold: Hbar.fromTinybars(\n info.generateReceiveRecordThreshold != null\n ? info.generateReceiveRecordThreshold\n : 0,\n ),\n isReceiverSignatureRequired:\n info.receiverSigRequired != null\n ? info.receiverSigRequired\n : false,\n expirationTime: Timestamp._fromProtobuf(\n /** @type {HieroProto.proto.ITimestamp} */ (\n info.expirationTime\n ),\n ),\n autoRenewPeriod:\n info.autoRenewPeriod != null\n ? new Duration(\n /** @type {Long} */ (info.autoRenewPeriod.seconds),\n )\n : new Duration(0),\n proxyAccountId:\n info.proxyAccountID != null &&\n Long.fromValue(\n /** @type {Long | number} */ (info.proxyAccountID.shardNum),\n ).toInt() !== 0 &&\n Long.fromValue(\n /** @type {Long | number} */ (info.proxyAccountID.realmNum),\n ).toInt() !== 0 &&\n Long.fromValue(\n /** @type {Long | number} */ (\n info.proxyAccountID.accountNum\n ),\n ).toInt() !== 0\n ? AccountId._fromProtobuf(info.proxyAccountID)\n : null,\n proxyReceived: Hbar.fromTinybars(\n info.proxyReceived != null ? info.proxyReceived : 0,\n ),\n liveHashes: (info.liveHashes != null ? info.liveHashes : []).map(\n (hash) => LiveHash._fromProtobuf(hash),\n ),\n tokenRelationships: TokenRelationshipMap._fromProtobuf(\n info.tokenRelationships != null ? info.tokenRelationships : [],\n ),\n accountMemo: info.memo != null ? info.memo : \"\",\n ownedNfts: info.ownedNfts ? info.ownedNfts : Long.ZERO,\n maxAutomaticTokenAssociations: info.maxAutomaticTokenAssociations\n ? Long.fromNumber(info.maxAutomaticTokenAssociations)\n : Long.ZERO,\n aliasKey,\n ledgerId:\n info.ledgerId != null\n ? LedgerId.fromBytes(info.ledgerId)\n : null,\n hbarAllowances: [],\n tokenAllowances: [],\n nftAllowances: [],\n ethereumNonce:\n info.ethereumNonce != null ? info.ethereumNonce : null,\n stakingInfo:\n info.stakingInfo != null\n ? StakingInfo._fromProtobuf(info.stakingInfo)\n : null,\n });\n }\n\n /**\n * @returns {HieroProto.proto.CryptoGetInfoResponse.IAccountInfo}\n */\n _toProtobuf() {\n return {\n accountID: this.accountId._toProtobuf(),\n contractAccountID: this.contractAccountId,\n deleted: this.isDeleted,\n proxyAccountID:\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId != null\n ? // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId._toProtobuf()\n : null,\n // eslint-disable-next-line deprecation/deprecation\n proxyReceived: this.proxyReceived.toTinybars(),\n key: this.key._toProtobufKey(),\n balance: this.balance.toTinybars(),\n generateSendRecordThreshold: this.sendRecordThreshold.toTinybars(),\n generateReceiveRecordThreshold:\n this.receiveRecordThreshold.toTinybars(),\n receiverSigRequired: this.isReceiverSignatureRequired,\n expirationTime: this.expirationTime._toProtobuf(),\n autoRenewPeriod: this.autoRenewPeriod._toProtobuf(),\n liveHashes: this.liveHashes.map((hash) => hash._toProtobuf()),\n tokenRelationships:\n this.tokenRelationships != null\n ? this.tokenRelationships._toProtobuf()\n : null,\n memo: this.accountMemo,\n ownedNfts: this.ownedNfts,\n maxAutomaticTokenAssociations:\n this.maxAutomaticTokenAssociations.toInt(),\n alias:\n this.aliasKey != null\n ? HieroProto.proto.Key.encode(\n this.aliasKey._toProtobufKey(),\n ).finish()\n : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toBytes() : null,\n ethereumNonce: this.ethereumNonce,\n stakingInfo:\n this.stakingInfo != null\n ? this.stakingInfo._toProtobuf()\n : null,\n };\n }\n\n /**\n * @param {Uint8Array} bytes\n * @returns {AccountInfo}\n */\n static fromBytes(bytes) {\n return AccountInfo._fromProtobuf(\n HieroProto.proto.CryptoGetInfoResponse.AccountInfo.decode(bytes),\n );\n }\n\n /**\n * @returns {Uint8Array}\n */\n toBytes() {\n return HieroProto.proto.CryptoGetInfoResponse.AccountInfo.encode(\n this._toProtobuf(),\n ).finish();\n }\n\n /**\n * @returns {string}\n */\n toString() {\n return JSON.stringify(this.toJSON());\n }\n\n /**\n * @returns {AccountInfoJson}\n */\n toJSON() {\n return {\n balance: this.balance.toString(),\n accountId: this.accountId.toString(),\n contractAccountId: this.contractAccountId,\n isDeleted: this.isDeleted,\n proxyAccountId:\n // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId != null\n ? // eslint-disable-next-line deprecation/deprecation\n this.proxyAccountId.toString()\n : null,\n // eslint-disable-next-line deprecation/deprecation\n proxyReceived: this.proxyReceived.toString(),\n key: this.key != null ? this.key.toString() : null,\n sendRecordThreshold: this.sendRecordThreshold.toString(),\n receiveRecordThreshold: this.receiveRecordThreshold.toString(),\n isReceiverSignatureRequired: this.isReceiverSignatureRequired,\n expirationTime: this.expirationTime.toString(),\n autoRenewPeriod: this.autoRenewPeriod.toString(),\n accountMemo: this.accountMemo,\n ownedNfts: this.ownedNfts.toString(),\n maxAutomaticTokenAssociations:\n this.maxAutomaticTokenAssociations.toString(),\n aliasKey: this.aliasKey != null ? this.aliasKey.toString() : null,\n ledgerId: this.ledgerId != null ? this.ledgerId.toString() : null,\n ethereumNonce:\n this.ethereumNonce != null\n ? this.ethereumNonce.toString()\n : null,\n stakingInfo:\n this.stakingInfo != null ? this.stakingInfo.toJSON() : null,\n };\n }\n}\n"],"names":["AccountInfo","constructor","props","this","accountId","contractAccountId","isDeleted","proxyAccountId","proxyReceived","key","balance","sendRecordThreshold","receiveRecordThreshold","isReceiverSignatureRequired","expirationTime","autoRenewPeriod","liveHashes","tokenRelationships","accountMemo","ownedNfts","maxAutomaticTokenAssociations","aliasKey","ledgerId","hbarAllowances","tokenAllowances","nftAllowances","ethereumNonce","stakingInfo","Object","freeze","_fromProtobuf","info","alias","length","Key","_fromProtobufKey","HieroProto","proto","decode","PublicKey","AccountId","contractAccountID","deleted","Hbar","fromTinybars","generateSendRecordThreshold","generateReceiveRecordThreshold","receiverSigRequired","Timestamp","Duration","proxyAccountID","Long","fromValue","toInt","map","hash","LiveHash","TokenRelationshipMap","memo","ZERO","fromNumber","LedgerId","fromBytes","StakingInfo","_toProtobuf","accountID","toTinybars","_toProtobufKey","encode","finish","toBytes","bytes","CryptoGetInfoResponse","toString","JSON","stringify","toJSON"],"mappings":"yWAgDe,MA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,CACHlE,QAASP,KAAKO,QAAQ+D,WACtBrE,UAAWD,KAAKC,UAAUqE,WAC1BpE,kBAAmBF,KAAKE,kBACxBC,UAAWH,KAAKG,UAChBC,eAE2B,MAAvBJ,KAAKI,eAECJ,KAAKI,eAAekE,WACpB,KAEVjE,cAAeL,KAAKK,cAAciE,WAClChE,IAAiB,MAAZN,KAAKM,IAAcN,KAAKM,IAAIgE,WAAa,KAC9C9D,oBAAqBR,KAAKQ,oBAAoB8D,WAC9C7D,uBAAwBT,KAAKS,uBAAuB6D,WACpD5D,4BAA6BV,KAAKU,4BAClCC,eAAgBX,KAAKW,eAAe2D,WACpC1D,gBAAiBZ,KAAKY,gBAAgB0D,WACtCvD,YAAaf,KAAKe,YAClBC,UAAWhB,KAAKgB,UAAUsD,WAC1BrD,8BACIjB,KAAKiB,8BAA8BqD,WACvCpD,SAA2B,MAAjBlB,KAAKkB,SAAmBlB,KAAKkB,SAASoD,WAAa,KAC7DnD,SAA2B,MAAjBnB,KAAKmB,SAAmBnB,KAAKmB,SAASmD,WAAa,KAC7D/C,cAC0B,MAAtBvB,KAAKuB,cACCvB,KAAKuB,cAAc+C,WACnB,KACV9C,YACwB,MAApBxB,KAAKwB,YAAsBxB,KAAKwB,YAAYiD,SAAW,KAEvE"}
|
|
@@ -9,8 +9,7 @@ var _AccountId = _interopRequireDefault(require("./AccountId.cjs"));
|
|
|
9
9
|
var _AccountInfo = _interopRequireDefault(require("./AccountInfo.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
|
|
@@ -8,8 +8,7 @@ var _Query = _interopRequireWildcard(require("../query/Query.cjs"));
|
|
|
8
8
|
var _AccountId = _interopRequireDefault(require("./AccountId.cjs"));
|
|
9
9
|
var _TransactionRecord = _interopRequireDefault(require("../transaction/TransactionRecord.cjs"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
// SPDX-License-Identifier: Apache-2.0
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t,{QUERY_REGISTRY as o}from"../query/Query.js";import c from"./AccountId.js";import r from"../transaction/TransactionRecord.js";class e extends t{constructor(t={}){super(),this._accountId=null,null!=t.accountId&&this.setAccountId(t.accountId)}static _fromProtobuf(t){const o=t.cryptoGetAccountRecords;return new e({accountId:null!=o.accountID?c._fromProtobuf(o.accountID):void 0})}get accountId(){return this._accountId}setAccountId(t){return this._accountId="string"==typeof t?c.fromString(t):t.clone(),this}_validateChecksums(t){null!=this._accountId&&this._accountId.validateChecksum(t)}_execute(t,o){return t.crypto.getAccountRecords(o)}_mapResponseHeader(t){return t.cryptoGetAccountRecords.header}_mapResponse(t,o,c){const e=t.cryptoGetAccountRecords.records;return Promise.resolve(e.map(
|
|
1
|
+
import t,{QUERY_REGISTRY as o}from"../query/Query.js";import c from"./AccountId.js";import r from"../transaction/TransactionRecord.js";class e extends t{constructor(t={}){super(),this._accountId=null,null!=t.accountId&&this.setAccountId(t.accountId)}static _fromProtobuf(t){const o=t.cryptoGetAccountRecords;return new e({accountId:null!=o.accountID?c._fromProtobuf(o.accountID):void 0})}get accountId(){return this._accountId}setAccountId(t){return this._accountId="string"==typeof t?c.fromString(t):t.clone(),this}_validateChecksums(t){null!=this._accountId&&this._accountId.validateChecksum(t)}_execute(t,o){return t.crypto.getAccountRecords(o)}_mapResponseHeader(t){return t.cryptoGetAccountRecords.header}_mapResponse(t,o,c){const e=t.cryptoGetAccountRecords.records;return Promise.resolve(e.map(t=>r._fromProtobuf({transactionRecord:t})))}_onMakeRequest(t){return{cryptoGetAccountRecords:{header:t,accountID:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`AccountRecordsQuery:${(null!=this._paymentTransactionId&&null!=this._paymentTransactionId.validStart?this._paymentTransactionId.validStart:this._timestamp).toString()}`}}o.set("cryptoGetAccountRecords",e._fromProtobuf);export{e as default};
|
|
2
2
|
//# sourceMappingURL=AccountRecordsQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountRecordsQuery.js","sources":["../../src/account/AccountRecordsQuery.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Query, { QUERY_REGISTRY } from \"../query/Query.js\";\nimport AccountId from \"./AccountId.js\";\nimport TransactionRecord from \"../transaction/TransactionRecord.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HieroProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HieroProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HieroProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HieroProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountRecordsQuery} HieroProto.proto.ICryptoGetAccountRecordsQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountRecordsResponse} HieroProto.proto.ICryptoGetAccountRecordsResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionRecord} HieroProto.proto.ITransactionRecord\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Get all the records for an account for any transfers into it and out of it,\n * that were above the threshold, during the last 25 hours.\n *\n * @augments {Query<TransactionRecord[]>}\n */\nexport default class AccountRecordsQuery extends Query {\n /**\n * @param {object} [props]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?AccountId}\n * @private\n */\n this._accountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IQuery} query\n * @returns {AccountRecordsQuery}\n */\n static _fromProtobuf(query) {\n const records =\n /** @type {HieroProto.proto.ICryptoGetAccountRecordsQuery} */ (\n query.cryptoGetAccountRecords\n );\n\n return new AccountRecordsQuery({\n accountId:\n records.accountID != null\n ? AccountId._fromProtobuf(records.accountID)\n : undefined,\n });\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account ID for which the records are being requested.\n *\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? AccountId.fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<HieroProto.proto.IResponse>}\n */\n _execute(channel, request) {\n return channel.crypto.getAccountRecords(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @returns {HieroProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptoGetAccountRecords =\n /** @type {HieroProto.proto.ICryptoGetAccountRecordsResponse} */ (\n response.cryptoGetAccountRecords\n );\n return /** @type {HieroProto.proto.IResponseHeader} */ (\n cryptoGetAccountRecords.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HieroProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<TransactionRecord[]>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const cryptoGetAccountRecords =\n /** @type {HieroProto.proto.ICryptoGetAccountRecordsResponse} */ (\n response.cryptoGetAccountRecords\n );\n const records = /** @type {HieroProto.proto.ITransactionRecord[]} */ (\n cryptoGetAccountRecords.records\n );\n\n return Promise.resolve(\n records.map((record) =>\n TransactionRecord._fromProtobuf({ transactionRecord: record }),\n ),\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IQueryHeader} header\n * @returns {HieroProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n cryptoGetAccountRecords: {\n header,\n accountID:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `AccountRecordsQuery:${timestamp.toString()}`;\n }\n}\n\nQUERY_REGISTRY.set(\n \"cryptoGetAccountRecords\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountRecordsQuery._fromProtobuf,\n);\n"],"names":["AccountRecordsQuery","Query","constructor","props","super","this","_accountId","accountId","setAccountId","_fromProtobuf","query","records","accountID","AccountId","undefined","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","crypto","getAccountRecords","_mapResponseHeader","response","_mapResponse","nodeAccountId","Promise","resolve","map","record","TransactionRecord","transactionRecord","_onMakeRequest","header","cryptoGetAccountRecords","_toProtobuf","_getLogId","_paymentTransactionId","validStart","_timestamp","toString","QUERY_REGISTRY","set"],"mappings":"uIA4Be,MAAMA,UAA4BC,EAK7C,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,WAAa,KAEK,MAAnBH,EAAMI,WACNF,KAAKG,aAAaL,EAAMI,UAEpC,CAOI,oBAAOE,CAAcC,GACjB,MAAMC,EAEED,EACH,wBAEL,OAAO,IAAIV,EAAoB,CAC3BO,UACyB,MAArBI,EAAQC,UACFC,EAAUJ,cAAcE,EAAQC,gBAChCE,GAEtB,CAKI,aAAIP,GACA,OAAOF,KAAKC,UACpB,CAQI,YAAAE,CAAaD,GAMT,OALAF,KAAKC,WACoB,iBAAdC,EACDM,EAAUE,WAAWR,GACrBA,EAAUS,QAEbX,IACf,CAKI,kBAAAY,CAAmBC,GACQ,MAAnBb,KAAKC,YACLD,KAAKC,WAAWa,iBAAiBD,EAE7C,CASI,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,OAAOC,kBAAkBF,EAChD,CAQI,kBAAAG,CAAmBC,GAKf,OAFQA,EACH,wBAGb,MACA,CAWI,YAAAC,CAAaD,EAAUE,EAAeN,GAClC,MAIMX,EAFEe,EACH,wBAGJ,QAED,OAAOG,QAAQC,QACXnB,EAAQoB,
|
|
1
|
+
{"version":3,"file":"AccountRecordsQuery.js","sources":["../../src/account/AccountRecordsQuery.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Query, { QUERY_REGISTRY } from \"../query/Query.js\";\nimport AccountId from \"./AccountId.js\";\nimport TransactionRecord from \"../transaction/TransactionRecord.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IQuery} HieroProto.proto.IQuery\n * @typedef {import(\"@hashgraph/proto\").proto.IQueryHeader} HieroProto.proto.IQueryHeader\n * @typedef {import(\"@hashgraph/proto\").proto.IResponse} HieroProto.proto.IResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IResponseHeader} HieroProto.proto.IResponseHeader\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountRecordsQuery} HieroProto.proto.ICryptoGetAccountRecordsQuery\n * @typedef {import(\"@hashgraph/proto\").proto.ICryptoGetAccountRecordsResponse} HieroProto.proto.ICryptoGetAccountRecordsResponse\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionRecord} HieroProto.proto.ITransactionRecord\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Get all the records for an account for any transfers into it and out of it,\n * that were above the threshold, during the last 25 hours.\n *\n * @augments {Query<TransactionRecord[]>}\n */\nexport default class AccountRecordsQuery extends Query {\n /**\n * @param {object} [props]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @type {?AccountId}\n * @private\n */\n this._accountId = null;\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IQuery} query\n * @returns {AccountRecordsQuery}\n */\n static _fromProtobuf(query) {\n const records =\n /** @type {HieroProto.proto.ICryptoGetAccountRecordsQuery} */ (\n query.cryptoGetAccountRecords\n );\n\n return new AccountRecordsQuery({\n accountId:\n records.accountID != null\n ? AccountId._fromProtobuf(records.accountID)\n : undefined,\n });\n }\n\n /**\n * @returns {?AccountId}\n */\n get accountId() {\n return this._accountId;\n }\n\n /**\n * Set the account ID for which the records are being requested.\n *\n * @param {AccountId | string} accountId\n * @returns {this}\n */\n setAccountId(accountId) {\n this._accountId =\n typeof accountId === \"string\"\n ? AccountId.fromString(accountId)\n : accountId.clone();\n\n return this;\n }\n\n /**\n * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\n }\n\n /**\n * @override\n * @internal\n * @param {Channel} channel\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<HieroProto.proto.IResponse>}\n */\n _execute(channel, request) {\n return channel.crypto.getAccountRecords(request);\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @returns {HieroProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptoGetAccountRecords =\n /** @type {HieroProto.proto.ICryptoGetAccountRecordsResponse} */ (\n response.cryptoGetAccountRecords\n );\n return /** @type {HieroProto.proto.IResponseHeader} */ (\n cryptoGetAccountRecords.header\n );\n }\n\n /**\n * @protected\n * @override\n * @param {HieroProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<TransactionRecord[]>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const cryptoGetAccountRecords =\n /** @type {HieroProto.proto.ICryptoGetAccountRecordsResponse} */ (\n response.cryptoGetAccountRecords\n );\n const records = /** @type {HieroProto.proto.ITransactionRecord[]} */ (\n cryptoGetAccountRecords.records\n );\n\n return Promise.resolve(\n records.map((record) =>\n TransactionRecord._fromProtobuf({ transactionRecord: record }),\n ),\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IQueryHeader} header\n * @returns {HieroProto.proto.IQuery}\n */\n _onMakeRequest(header) {\n return {\n cryptoGetAccountRecords: {\n header,\n accountID:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\n };\n }\n\n /**\n * @returns {string}\n */\n _getLogId() {\n const timestamp =\n this._paymentTransactionId != null &&\n this._paymentTransactionId.validStart != null\n ? this._paymentTransactionId.validStart\n : this._timestamp;\n\n return `AccountRecordsQuery:${timestamp.toString()}`;\n }\n}\n\nQUERY_REGISTRY.set(\n \"cryptoGetAccountRecords\",\n // eslint-disable-next-line @typescript-eslint/unbound-method\n AccountRecordsQuery._fromProtobuf,\n);\n"],"names":["AccountRecordsQuery","Query","constructor","props","super","this","_accountId","accountId","setAccountId","_fromProtobuf","query","records","accountID","AccountId","undefined","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","crypto","getAccountRecords","_mapResponseHeader","response","_mapResponse","nodeAccountId","Promise","resolve","map","record","TransactionRecord","transactionRecord","_onMakeRequest","header","cryptoGetAccountRecords","_toProtobuf","_getLogId","_paymentTransactionId","validStart","_timestamp","toString","QUERY_REGISTRY","set"],"mappings":"uIA4Be,MAAMA,UAA4BC,EAK7C,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,WAAa,KAEK,MAAnBH,EAAMI,WACNF,KAAKG,aAAaL,EAAMI,UAEpC,CAOI,oBAAOE,CAAcC,GACjB,MAAMC,EAEED,EACH,wBAEL,OAAO,IAAIV,EAAoB,CAC3BO,UACyB,MAArBI,EAAQC,UACFC,EAAUJ,cAAcE,EAAQC,gBAChCE,GAEtB,CAKI,aAAIP,GACA,OAAOF,KAAKC,UACpB,CAQI,YAAAE,CAAaD,GAMT,OALAF,KAAKC,WACoB,iBAAdC,EACDM,EAAUE,WAAWR,GACrBA,EAAUS,QAEbX,IACf,CAKI,kBAAAY,CAAmBC,GACQ,MAAnBb,KAAKC,YACLD,KAAKC,WAAWa,iBAAiBD,EAE7C,CASI,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,OAAOC,kBAAkBF,EAChD,CAQI,kBAAAG,CAAmBC,GAKf,OAFQA,EACH,wBAGb,MACA,CAWI,YAAAC,CAAaD,EAAUE,EAAeN,GAClC,MAIMX,EAFEe,EACH,wBAGJ,QAED,OAAOG,QAAQC,QACXnB,EAAQoB,IAAKC,GACTC,EAAkBxB,cAAc,CAAEyB,kBAAmBF,KAGrE,CAQI,cAAAG,CAAeC,GACX,MAAO,CACHC,wBAAyB,CACrBD,SACAxB,UACuB,MAAnBP,KAAKC,WACCD,KAAKC,WAAWgC,cAChB,MAG1B,CAKI,SAAAC,GAOI,MAAO,wBAL2B,MAA9BlC,KAAKmC,uBACoC,MAAzCnC,KAAKmC,sBAAsBC,WACrBpC,KAAKmC,sBAAsBC,WAC3BpC,KAAKqC,YAEyBC,YAChD,EAGAC,EAAeC,IACX,0BAEA7C,EAAoBS"}
|
|
@@ -11,8 +11,7 @@ var _Duration = _interopRequireDefault(require("../Duration.cjs"));
|
|
|
11
11
|
var _long = _interopRequireDefault(require("long"));
|
|
12
12
|
var _Key = _interopRequireDefault(require("../Key.cjs"));
|
|
13
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function
|
|
15
|
-
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; }
|
|
14
|
+
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); }
|
|
16
15
|
// SPDX-License-Identifier: Apache-2.0
|
|
17
16
|
|
|
18
17
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"./AccountId.js";import t from"../Hbar.js";import r from"../ObjectMap.js";class n extends r{constructor(){super(
|
|
1
|
+
import o from"./AccountId.js";import t from"../Hbar.js";import r from"../ObjectMap.js";class n extends r{constructor(){super(t=>o.fromString(t))}static _fromProtobuf(r){const s=new n;for(const n of null!=r.accountAmounts?r.accountAmounts:[]){const r=o._fromProtobuf(n.accountID);s._set(r,t.fromTinybars(n.amount))}return s}}export{n as default};
|
|
2
2
|
//# sourceMappingURL=HbarTransferMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HbarTransferMap.js","sources":["../../src/account/HbarTransferMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"./AccountId.js\";\nimport Hbar from \"../Hbar.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransferList} HieroProto.proto.ITransferList\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../long.js\").LongObject} LongObject\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * @augments {ObjectMap<AccountId, Hbar>}\n */\nexport default class HbarTransferMap extends ObjectMap {\n constructor() {\n super((s) => AccountId.fromString(s));\n }\n\n /**\n * @param {HieroProto.proto.ITransferList} transfers\n * @returns {HbarTransferMap}\n */\n static _fromProtobuf(transfers) {\n const accountTransfers = new HbarTransferMap();\n\n for (const transfer of transfers.accountAmounts != null\n ? transfers.accountAmounts\n : []) {\n const account = AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (transfer.accountID),\n );\n\n accountTransfers._set(\n account,\n Hbar.fromTinybars(/** @type {Long} */ (transfer.amount)),\n );\n }\n\n return accountTransfers;\n }\n}\n"],"names":["HbarTransferMap","ObjectMap","constructor","super","s","AccountId","fromString","_fromProtobuf","transfers","accountTransfers","transfer","accountAmounts","account","_set","Hbar","fromTinybars"],"mappings":"uFAoBe,MAAMA,UAAwBC,EACzC,WAAAC,GACIC,
|
|
1
|
+
{"version":3,"file":"HbarTransferMap.js","sources":["../../src/account/HbarTransferMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport AccountId from \"./AccountId.js\";\nimport Hbar from \"../Hbar.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransferList} HieroProto.proto.ITransferList\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"../long.js\").LongObject} LongObject\n * @typedef {import(\"bignumber.js\").default} BigNumber\n */\n\n/**\n * @augments {ObjectMap<AccountId, Hbar>}\n */\nexport default class HbarTransferMap extends ObjectMap {\n constructor() {\n super((s) => AccountId.fromString(s));\n }\n\n /**\n * @param {HieroProto.proto.ITransferList} transfers\n * @returns {HbarTransferMap}\n */\n static _fromProtobuf(transfers) {\n const accountTransfers = new HbarTransferMap();\n\n for (const transfer of transfers.accountAmounts != null\n ? transfers.accountAmounts\n : []) {\n const account = AccountId._fromProtobuf(\n /** @type {HieroProto.proto.IAccountID} */ (transfer.accountID),\n );\n\n accountTransfers._set(\n account,\n Hbar.fromTinybars(/** @type {Long} */ (transfer.amount)),\n );\n }\n\n return accountTransfers;\n }\n}\n"],"names":["HbarTransferMap","ObjectMap","constructor","super","s","AccountId","fromString","_fromProtobuf","transfers","accountTransfers","transfer","accountAmounts","account","_set","Hbar","fromTinybars"],"mappings":"uFAoBe,MAAMA,UAAwBC,EACzC,WAAAC,GACIC,MAAOC,GAAMC,EAAUC,WAAWF,GAC1C,CAMI,oBAAOG,CAAcC,GACjB,MAAMC,EAAmB,IAAIT,EAE7B,IAAK,MAAMU,KAAwC,MAA5BF,EAAUG,eAC3BH,EAAUG,eACV,GAAI,CACN,MAAMC,EAAUP,EAAUE,cACsBG,EAAkB,WAGlED,EAAiBI,KACbD,EACAE,EAAKC,aAAkCL,EAAe,QAEtE,CAEQ,OAAOD,CACf"}
|
|
@@ -10,8 +10,7 @@ var _Duration = _interopRequireDefault(require("../Duration.cjs"));
|
|
|
10
10
|
var _Key = _interopRequireDefault(require("../Key.cjs"));
|
|
11
11
|
var _KeyList = _interopRequireDefault(require("../KeyList.cjs"));
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
// SPDX-License-Identifier: Apache-2.0
|
|
16
15
|
|
|
17
16
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t,{TRANSACTION_REGISTRY as s}from"../transaction/Transaction.js";import o from"./AccountId.js";import r from"../Duration.js";import n from"../Key.js";import e from"../KeyList.js";class i extends t{constructor(t={}){super(),this._hash=null,this._keys=null,this._duration=null,this._accountId=null,null!=t.hash&&this.setHash(t.hash),null!=t.keys&&this.setKeys(t.keys),null!=t.duration&&this.setDuration(t.duration),null!=t.accountId&&this.setAccountId(t.accountId)}static _fromProtobuf(s,r,e,a,u){const h=u[0].cryptoAddLiveHash.liveHash;return t._fromProtobufTransactions(new i({hash:null!=h.hash?h.hash:void 0,keys:null!=h.keys&&null!=h.keys.keys?h.keys.keys.map(
|
|
1
|
+
import t,{TRANSACTION_REGISTRY as s}from"../transaction/Transaction.js";import o from"./AccountId.js";import r from"../Duration.js";import n from"../Key.js";import e from"../KeyList.js";class i extends t{constructor(t={}){super(),this._hash=null,this._keys=null,this._duration=null,this._accountId=null,null!=t.hash&&this.setHash(t.hash),null!=t.keys&&this.setKeys(t.keys),null!=t.duration&&this.setDuration(t.duration),null!=t.accountId&&this.setAccountId(t.accountId)}static _fromProtobuf(s,r,e,a,u){const h=u[0].cryptoAddLiveHash.liveHash;return t._fromProtobufTransactions(new i({hash:null!=h.hash?h.hash:void 0,keys:null!=h.keys&&null!=h.keys.keys?h.keys.keys.map(t=>n._fromProtobufKey(t)):void 0,duration:null!=h.duration&&null!=h.duration.seconds?h.duration.seconds:void 0,accountId:null!=h.accountId?o._fromProtobuf(h.accountId):void 0}),s,r,e,a,u)}get hash(){return this._hash}setHash(t){return this._requireNotFrozen(),this._hash=t,this}get keys(){return this._keys}setKeys(t){return this._requireNotFrozen(),this._keys=t instanceof e?t.toArray():t,this}get duration(){return this._duration}setDuration(t){return this._requireNotFrozen(),this._duration=t instanceof r?t:new r(t),this}get accountId(){return this._accountId}setAccountId(t){return this._requireNotFrozen(),this._accountId="string"==typeof t?o.fromString(t):t.clone(),this}_validateChecksums(t){null!=this._accountId&&this._accountId.validateChecksum(t)}_execute(t,s){return t.crypto.addLiveHash(s)}_getTransactionDataCase(){return"cryptoAddLiveHash"}_makeTransactionData(){return{liveHash:{hash:this._hash,keys:null!=this._keys?{keys:this._keys.map(t=>t._toProtobufKey())}:void 0,duration:null!=this._duration?this._duration._toProtobuf():null,accountId:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`LiveHashAddTransaction:${this._transactionIds.current.validStart.toString()}`}}s.set("cryptoAddLiveHash",i._fromProtobuf);export{i as default};
|
|
2
2
|
//# sourceMappingURL=LiveHashAddTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LiveHashAddTransaction.js","sources":["../../src/account/LiveHashAddTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport AccountId from \"./AccountId.js\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\nimport KeyList from \"../KeyList.js\";\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.ICryptoAddLiveHashTransactionBody} HieroProto.proto.ICryptoAddLiveHashTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ILiveHash} HieroProto.proto.ILiveHash\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 * @deprecated\n * This transaction is no longer supported.\n */\nexport default class LiveHashAddTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.hash]\n * @param {Key[]} [props.keys]\n * @param {Duration | Long | number} [props.duration]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._hash = null;\n\n /**\n * @private\n * @type {?Key[]}\n */\n this._keys = null;\n\n /**\n * @private\n * @type {?Duration}\n */\n this._duration = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.hash != null) {\n this.setHash(props.hash);\n }\n\n if (props.keys != null) {\n this.setKeys(props.keys);\n }\n\n if (props.duration != null) {\n this.setDuration(props.duration);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\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 {LiveHashAddTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const hashes =\n /** @type {HieroProto.proto.ICryptoAddLiveHashTransactionBody} */ (\n body.cryptoAddLiveHash\n );\n const liveHash_ = /** @type {HieroProto.proto.ILiveHash} */ (\n hashes.liveHash\n );\n\n return Transaction._fromProtobufTransactions(\n // eslint-disable-next-line deprecation/deprecation\n new LiveHashAddTransaction({\n hash: liveHash_.hash != null ? liveHash_.hash : undefined,\n keys:\n liveHash_.keys != null\n ? liveHash_.keys.keys != null\n ? liveHash_.keys.keys.map((key) =>\n Key._fromProtobufKey(key),\n )\n : undefined\n : undefined,\n duration:\n liveHash_.duration != null\n ? liveHash_.duration.seconds != null\n ? liveHash_.duration.seconds\n : undefined\n : undefined,\n accountId:\n liveHash_.accountId != null\n ? AccountId._fromProtobuf(liveHash_.accountId)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get hash() {\n return this._hash;\n }\n\n /**\n * @param {Uint8Array} hash\n * @returns {LiveHashAddTransaction}\n */\n setHash(hash) {\n this._requireNotFrozen();\n this._hash = hash;\n\n return this;\n }\n\n /**\n * @returns {?Key[]}\n */\n get keys() {\n return this._keys;\n }\n\n /**\n * @param {Key[] | KeyList} keys\n * @returns {LiveHashAddTransaction}\n */\n setKeys(keys) {\n this._requireNotFrozen();\n this._keys = keys instanceof KeyList ? keys.toArray() : keys;\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get duration() {\n return this._duration;\n }\n\n /**\n * @param {Duration | Long | number} duration\n * @returns {LiveHashAddTransaction}\n */\n setDuration(duration) {\n this._requireNotFrozen();\n this._duration =\n duration instanceof Duration ? duration : new Duration(duration);\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 {LiveHashAddTransaction}\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 * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\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.crypto.addLiveHash(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"cryptoAddLiveHash\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.ICryptoAddLiveHashTransactionBody}\n */\n _makeTransactionData() {\n return {\n liveHash: {\n hash: this._hash,\n keys:\n this._keys != null\n ? {\n keys: this._keys.map((key) =>\n key._toProtobufKey(),\n ),\n }\n : undefined,\n duration:\n this._duration != null\n ? this._duration._toProtobuf()\n : null,\n accountId:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\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 `LiveHashAddTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"cryptoAddLiveHash\",\n // eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation\n LiveHashAddTransaction._fromProtobuf,\n);\n"],"names":["LiveHashAddTransaction","Transaction","constructor","props","super","this","_hash","_keys","_duration","_accountId","hash","setHash","keys","setKeys","duration","setDuration","accountId","setAccountId","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","liveHash_","_fromProtobufTransactions","undefined","map","key","Key","_fromProtobufKey","seconds","AccountId","_requireNotFrozen","KeyList","toArray","Duration","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","crypto","addLiveHash","_getTransactionDataCase","_makeTransactionData","liveHash","_toProtobufKey","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"0LA+Be,MAAMA,UAA+BC,EAQhD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,MAAQ,KAMbD,KAAKE,MAAQ,KAMbF,KAAKG,UAAY,KAMjBH,KAAKI,WAAa,KAEA,MAAdN,EAAMO,MACNL,KAAKM,QAAQR,EAAMO,MAGL,MAAdP,EAAMS,MACNP,KAAKQ,QAAQV,EAAMS,MAGD,MAAlBT,EAAMW,UACNT,KAAKU,YAAYZ,EAAMW,UAGJ,MAAnBX,EAAMa,WACNX,KAAKY,aAAad,EAAMa,UAEpC,CAWI,oBAAOE,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MAKMC,EALOD,EAAO,GAIf,kBAGJ,SAED,OAAOtB,EAAYwB,0BAEf,IAAIzB,EAAuB,CACvBU,KAAwB,MAAlBc,EAAUd,KAAec,EAAUd,UAAOgB,EAChDd,KACsB,MAAlBY,EAAUZ,MACmB,MAAvBY,EAAUZ,KAAKA,KACXY,EAAUZ,KAAKA,KAAKe,KAAKC,GACrBC,EAAIC,iBAAiBF,UAG7BF,EACVZ,SAC0B,MAAtBU,EAAUV,UAC0B,MAA9BU,EAAUV,SAASiB,QACfP,EAAUV,SAASiB,aAEvBL,EACVV,UAC2B,MAAvBQ,EAAUR,UACJgB,EAAUd,cAAcM,EAAUR,gBAClCU,IAEdP,EACAC,EACAC,EACAC,EACAC,EAEZ,CAKI,QAAIb,GACA,OAAOL,KAAKC,KACpB,CAMI,OAAAK,CAAQD,GAIJ,OAHAL,KAAK4B,oBACL5B,KAAKC,MAAQI,EAENL,IACf,CAKI,QAAIO,GACA,OAAOP,KAAKE,KACpB,CAMI,OAAAM,CAAQD,GAIJ,OAHAP,KAAK4B,oBACL5B,KAAKE,MAAQK,aAAgBsB,EAAUtB,EAAKuB,UAAYvB,EAEjDP,IACf,CAKI,YAAIS,GACA,OAAOT,KAAKG,SACpB,CAMI,WAAAO,CAAYD,GAKR,OAJAT,KAAK4B,oBACL5B,KAAKG,UACDM,aAAoBsB,EAAWtB,EAAW,IAAIsB,EAAStB,GAEpDT,IACf,CAKI,aAAIW,GACA,OAAOX,KAAKI,UACpB,CAMI,YAAAQ,CAAaD,GAOT,OANAX,KAAK4B,oBACL5B,KAAKI,WACoB,iBAAdO,EACDgB,EAAUK,WAAWrB,GACrBA,EAAUsB,QAEbjC,IACf,CAKI,kBAAAkC,CAAmBC,GACQ,MAAnBnC,KAAKI,YACLJ,KAAKI,WAAWgC,iBAAiBD,EAE7C,CASI,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,OAAOC,YAAYF,EAC1C,CAOI,uBAAAG,GACI,MAAO,mBACf,CAOI,oBAAAC,GACI,MAAO,CACHC,SAAU,CACNvC,KAAML,KAAKC,MACXM,KACkB,MAAdP,KAAKE,MACC,CACIK,KAAMP,KAAKE,MAAMoB,KAAKC,GAClBA,EAAIsB,yBAGZxB,EACVZ,SACsB,MAAlBT,KAAKG,UACCH,KAAKG,UAAU2C,cACf,KACVnC,UACuB,MAAnBX,KAAKI,WACCJ,KAAKI,WAAW0C,cAChB,MAG1B,CAKI,SAAAC,GAII,MAAO,0BAFH/C,KAAKgD,gBAAgBC,QACxB,WAC0CC,YACnD,EAGAC,EAAqBC,IACjB,oBAEAzD,EAAuBkB"}
|
|
1
|
+
{"version":3,"file":"LiveHashAddTransaction.js","sources":["../../src/account/LiveHashAddTransaction.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Transaction, {\n TRANSACTION_REGISTRY,\n} from \"../transaction/Transaction.js\";\nimport AccountId from \"./AccountId.js\";\nimport Duration from \"../Duration.js\";\nimport Key from \"../Key.js\";\nimport KeyList from \"../KeyList.js\";\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.ICryptoAddLiveHashTransactionBody} HieroProto.proto.ICryptoAddLiveHashTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ILiveHash} HieroProto.proto.ILiveHash\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 * @deprecated\n * This transaction is no longer supported.\n */\nexport default class LiveHashAddTransaction extends Transaction {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.hash]\n * @param {Key[]} [props.keys]\n * @param {Duration | Long | number} [props.duration]\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?Uint8Array}\n */\n this._hash = null;\n\n /**\n * @private\n * @type {?Key[]}\n */\n this._keys = null;\n\n /**\n * @private\n * @type {?Duration}\n */\n this._duration = null;\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n\n if (props.hash != null) {\n this.setHash(props.hash);\n }\n\n if (props.keys != null) {\n this.setKeys(props.keys);\n }\n\n if (props.duration != null) {\n this.setDuration(props.duration);\n }\n\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\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 {LiveHashAddTransaction}\n */\n static _fromProtobuf(\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n ) {\n const body = bodies[0];\n const hashes =\n /** @type {HieroProto.proto.ICryptoAddLiveHashTransactionBody} */ (\n body.cryptoAddLiveHash\n );\n const liveHash_ = /** @type {HieroProto.proto.ILiveHash} */ (\n hashes.liveHash\n );\n\n return Transaction._fromProtobufTransactions(\n // eslint-disable-next-line deprecation/deprecation\n new LiveHashAddTransaction({\n hash: liveHash_.hash != null ? liveHash_.hash : undefined,\n keys:\n liveHash_.keys != null\n ? liveHash_.keys.keys != null\n ? liveHash_.keys.keys.map((key) =>\n Key._fromProtobufKey(key),\n )\n : undefined\n : undefined,\n duration:\n liveHash_.duration != null\n ? liveHash_.duration.seconds != null\n ? liveHash_.duration.seconds\n : undefined\n : undefined,\n accountId:\n liveHash_.accountId != null\n ? AccountId._fromProtobuf(liveHash_.accountId)\n : undefined,\n }),\n transactions,\n signedTransactions,\n transactionIds,\n nodeIds,\n bodies,\n );\n }\n\n /**\n * @returns {?Uint8Array}\n */\n get hash() {\n return this._hash;\n }\n\n /**\n * @param {Uint8Array} hash\n * @returns {LiveHashAddTransaction}\n */\n setHash(hash) {\n this._requireNotFrozen();\n this._hash = hash;\n\n return this;\n }\n\n /**\n * @returns {?Key[]}\n */\n get keys() {\n return this._keys;\n }\n\n /**\n * @param {Key[] | KeyList} keys\n * @returns {LiveHashAddTransaction}\n */\n setKeys(keys) {\n this._requireNotFrozen();\n this._keys = keys instanceof KeyList ? keys.toArray() : keys;\n\n return this;\n }\n\n /**\n * @returns {?Duration}\n */\n get duration() {\n return this._duration;\n }\n\n /**\n * @param {Duration | Long | number} duration\n * @returns {LiveHashAddTransaction}\n */\n setDuration(duration) {\n this._requireNotFrozen();\n this._duration =\n duration instanceof Duration ? duration : new Duration(duration);\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 {LiveHashAddTransaction}\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 * @param {Client} client\n */\n _validateChecksums(client) {\n if (this._accountId != null) {\n this._accountId.validateChecksum(client);\n }\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.crypto.addLiveHash(request);\n }\n\n /**\n * @override\n * @protected\n * @returns {NonNullable<HieroProto.proto.TransactionBody[\"data\"]>}\n */\n _getTransactionDataCase() {\n return \"cryptoAddLiveHash\";\n }\n\n /**\n * @override\n * @protected\n * @returns {HieroProto.proto.ICryptoAddLiveHashTransactionBody}\n */\n _makeTransactionData() {\n return {\n liveHash: {\n hash: this._hash,\n keys:\n this._keys != null\n ? {\n keys: this._keys.map((key) =>\n key._toProtobufKey(),\n ),\n }\n : undefined,\n duration:\n this._duration != null\n ? this._duration._toProtobuf()\n : null,\n accountId:\n this._accountId != null\n ? this._accountId._toProtobuf()\n : null,\n },\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 `LiveHashAddTransaction:${timestamp.toString()}`;\n }\n}\n\nTRANSACTION_REGISTRY.set(\n \"cryptoAddLiveHash\",\n // eslint-disable-next-line @typescript-eslint/unbound-method, deprecation/deprecation\n LiveHashAddTransaction._fromProtobuf,\n);\n"],"names":["LiveHashAddTransaction","Transaction","constructor","props","super","this","_hash","_keys","_duration","_accountId","hash","setHash","keys","setKeys","duration","setDuration","accountId","setAccountId","_fromProtobuf","transactions","signedTransactions","transactionIds","nodeIds","bodies","liveHash_","_fromProtobufTransactions","undefined","map","key","Key","_fromProtobufKey","seconds","AccountId","_requireNotFrozen","KeyList","toArray","Duration","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","crypto","addLiveHash","_getTransactionDataCase","_makeTransactionData","liveHash","_toProtobufKey","_toProtobuf","_getLogId","_transactionIds","current","toString","TRANSACTION_REGISTRY","set"],"mappings":"0LA+Be,MAAMA,UAA+BC,EAQhD,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,MAAQ,KAMbD,KAAKE,MAAQ,KAMbF,KAAKG,UAAY,KAMjBH,KAAKI,WAAa,KAEA,MAAdN,EAAMO,MACNL,KAAKM,QAAQR,EAAMO,MAGL,MAAdP,EAAMS,MACNP,KAAKQ,QAAQV,EAAMS,MAGD,MAAlBT,EAAMW,UACNT,KAAKU,YAAYZ,EAAMW,UAGJ,MAAnBX,EAAMa,WACNX,KAAKY,aAAad,EAAMa,UAEpC,CAWI,oBAAOE,CACHC,EACAC,EACAC,EACAC,EACAC,GAEA,MAKMC,EALOD,EAAO,GAIf,kBAGJ,SAED,OAAOtB,EAAYwB,0BAEf,IAAIzB,EAAuB,CACvBU,KAAwB,MAAlBc,EAAUd,KAAec,EAAUd,UAAOgB,EAChDd,KACsB,MAAlBY,EAAUZ,MACmB,MAAvBY,EAAUZ,KAAKA,KACXY,EAAUZ,KAAKA,KAAKe,IAAKC,GACrBC,EAAIC,iBAAiBF,SAG7BF,EACVZ,SAC0B,MAAtBU,EAAUV,UAC0B,MAA9BU,EAAUV,SAASiB,QACfP,EAAUV,SAASiB,aAEvBL,EACVV,UAC2B,MAAvBQ,EAAUR,UACJgB,EAAUd,cAAcM,EAAUR,gBAClCU,IAEdP,EACAC,EACAC,EACAC,EACAC,EAEZ,CAKI,QAAIb,GACA,OAAOL,KAAKC,KACpB,CAMI,OAAAK,CAAQD,GAIJ,OAHAL,KAAK4B,oBACL5B,KAAKC,MAAQI,EAENL,IACf,CAKI,QAAIO,GACA,OAAOP,KAAKE,KACpB,CAMI,OAAAM,CAAQD,GAIJ,OAHAP,KAAK4B,oBACL5B,KAAKE,MAAQK,aAAgBsB,EAAUtB,EAAKuB,UAAYvB,EAEjDP,IACf,CAKI,YAAIS,GACA,OAAOT,KAAKG,SACpB,CAMI,WAAAO,CAAYD,GAKR,OAJAT,KAAK4B,oBACL5B,KAAKG,UACDM,aAAoBsB,EAAWtB,EAAW,IAAIsB,EAAStB,GAEpDT,IACf,CAKI,aAAIW,GACA,OAAOX,KAAKI,UACpB,CAMI,YAAAQ,CAAaD,GAOT,OANAX,KAAK4B,oBACL5B,KAAKI,WACoB,iBAAdO,EACDgB,EAAUK,WAAWrB,GACrBA,EAAUsB,QAEbjC,IACf,CAKI,kBAAAkC,CAAmBC,GACQ,MAAnBnC,KAAKI,YACLJ,KAAKI,WAAWgC,iBAAiBD,EAE7C,CASI,QAAAE,CAASC,EAASC,GACd,OAAOD,EAAQE,OAAOC,YAAYF,EAC1C,CAOI,uBAAAG,GACI,MAAO,mBACf,CAOI,oBAAAC,GACI,MAAO,CACHC,SAAU,CACNvC,KAAML,KAAKC,MACXM,KACkB,MAAdP,KAAKE,MACC,CACIK,KAAMP,KAAKE,MAAMoB,IAAKC,GAClBA,EAAIsB,wBAGZxB,EACVZ,SACsB,MAAlBT,KAAKG,UACCH,KAAKG,UAAU2C,cACf,KACVnC,UACuB,MAAnBX,KAAKI,WACCJ,KAAKI,WAAW0C,cAChB,MAG1B,CAKI,SAAAC,GAII,MAAO,0BAFH/C,KAAKgD,gBAAgBC,QACxB,WAC0CC,YACnD,EAGAC,EAAqBC,IACjB,oBAEAzD,EAAuBkB"}
|
|
@@ -7,8 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _Transaction = _interopRequireWildcard(require("../transaction/Transaction.cjs"));
|
|
8
8
|
var _AccountId = _interopRequireDefault(require("./AccountId.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
|
/**
|
|
@@ -8,8 +8,7 @@ var _Query = _interopRequireWildcard(require("../query/Query.cjs"));
|
|
|
8
8
|
var _AccountId = _interopRequireDefault(require("./AccountId.cjs"));
|
|
9
9
|
var _LiveHash = _interopRequireDefault(require("./LiveHash.cjs"));
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
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
|
// SPDX-License-Identifier: Apache-2.0
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"../token/TokenId.js";import r from"../ObjectMap.js";class t extends r{constructor(){super(
|
|
1
|
+
import o from"../token/TokenId.js";import r from"../ObjectMap.js";class t extends r{constructor(){super(r=>o.fromString(r))}}export{t as default};
|
|
2
2
|
//# sourceMappingURL=NullableTokenDecimalMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NullableTokenDecimalMap.js","sources":["../../src/account/NullableTokenDecimalMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"../token/TokenId.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HieroProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @augments {ObjectMap<TokenId, number | null>}\n */\nexport default class NullableTokenDecimalMap extends ObjectMap {\n constructor() {\n super((s) => TokenId.fromString(s));\n }\n}\n"],"names":["NullableTokenDecimalMap","ObjectMap","constructor","super","s","TokenId","fromString"],"mappings":"kEAce,MAAMA,UAAgCC,EACjD,WAAAC,GACIC,
|
|
1
|
+
{"version":3,"file":"NullableTokenDecimalMap.js","sources":["../../src/account/NullableTokenDecimalMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"../token/TokenId.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HieroProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @augments {ObjectMap<TokenId, number | null>}\n */\nexport default class NullableTokenDecimalMap extends ObjectMap {\n constructor() {\n super((s) => TokenId.fromString(s));\n }\n}\n"],"names":["NullableTokenDecimalMap","ObjectMap","constructor","super","s","TokenId","fromString"],"mappings":"kEAce,MAAMA,UAAgCC,EACjD,WAAAC,GACIC,MAAOC,GAAMC,EAAQC,WAAWF,GACxC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"../token/TokenId.js";import r from"../ObjectMap.js";class t extends r{constructor(){super(
|
|
1
|
+
import o from"../token/TokenId.js";import r from"../ObjectMap.js";class t extends r{constructor(){super(r=>o.fromString(r))}}export{t as default};
|
|
2
2
|
//# sourceMappingURL=TokenBalanceMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenBalanceMap.js","sources":["../../src/account/TokenBalanceMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"../token/TokenId.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HieroProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * @augments {ObjectMap<TokenId, Long>}\n */\nexport default class TokenBalanceMap extends ObjectMap {\n constructor() {\n super((s) => TokenId.fromString(s));\n }\n}\n"],"names":["TokenBalanceMap","ObjectMap","constructor","super","s","TokenId","fromString"],"mappings":"kEAkBe,MAAMA,UAAwBC,EACzC,WAAAC,GACIC,
|
|
1
|
+
{"version":3,"file":"TokenBalanceMap.js","sources":["../../src/account/TokenBalanceMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"../token/TokenId.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HieroProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * @augments {ObjectMap<TokenId, Long>}\n */\nexport default class TokenBalanceMap extends ObjectMap {\n constructor() {\n super((s) => TokenId.fromString(s));\n }\n}\n"],"names":["TokenBalanceMap","ObjectMap","constructor","super","s","TokenId","fromString"],"mappings":"kEAkBe,MAAMA,UAAwBC,EACzC,WAAAC,GACIC,MAAOC,GAAMC,EAAQC,WAAWF,GACxC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"../token/TokenId.js";import r from"../ObjectMap.js";class t extends r{constructor(){super(
|
|
1
|
+
import o from"../token/TokenId.js";import r from"../ObjectMap.js";class t extends r{constructor(){super(r=>o.fromString(r))}}export{t as default};
|
|
2
2
|
//# sourceMappingURL=TokenDecimalMap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenDecimalMap.js","sources":["../../src/account/TokenDecimalMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"../token/TokenId.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HieroProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @augments {ObjectMap<TokenId, number>}\n */\nexport default class TokenDecimalMap extends ObjectMap {\n constructor() {\n super((s) => TokenId.fromString(s));\n }\n}\n"],"names":["TokenDecimalMap","ObjectMap","constructor","super","s","TokenId","fromString"],"mappings":"kEAce,MAAMA,UAAwBC,EACzC,WAAAC,GACIC,
|
|
1
|
+
{"version":3,"file":"TokenDecimalMap.js","sources":["../../src/account/TokenDecimalMap.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport TokenId from \"../token/TokenId.js\";\nimport ObjectMap from \"../ObjectMap.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenBalance} HieroProto.proto.ITokenBalance\n * @typedef {import(\"@hashgraph/proto\").proto.ITokenID} HieroProto.proto.ITokenID\n */\n\n/**\n * @augments {ObjectMap<TokenId, number>}\n */\nexport default class TokenDecimalMap extends ObjectMap {\n constructor() {\n super((s) => TokenId.fromString(s));\n }\n}\n"],"names":["TokenDecimalMap","ObjectMap","constructor","super","s","TokenId","fromString"],"mappings":"kEAce,MAAMA,UAAwBC,EACzC,WAAAC,GACIC,MAAOC,GAAMC,EAAQC,WAAWF,GACxC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../token/TokenId.js";import r from"./AccountId.js";import n from"long";class o{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.serialNumbers=e.serialNumbers,this.allSerials=e.allSerials,this.delegatingSpender=e.delegatingSpender,Object.freeze(this)}static _fromProtobuf(l){const t=null!=l.approvedForAll&&1==l.approvedForAll.value;return new o({tokenId:e._fromProtobuf(l.tokenId),spenderAccountId:null!=l.spender?r._fromProtobuf(l.spender):null,ownerAccountId:null!=l.owner?r._fromProtobuf(l.owner):null,serialNumbers:t?null:null!=l.serialNumbers?l.serialNumbers.map(
|
|
1
|
+
import e from"../token/TokenId.js";import r from"./AccountId.js";import n from"long";class o{constructor(e){this.tokenId=e.tokenId,this.spenderAccountId=e.spenderAccountId,this.ownerAccountId=e.ownerAccountId,this.serialNumbers=e.serialNumbers,this.allSerials=e.allSerials,this.delegatingSpender=e.delegatingSpender,Object.freeze(this)}static _fromProtobuf(l){const t=null!=l.approvedForAll&&1==l.approvedForAll.value;return new o({tokenId:e._fromProtobuf(l.tokenId),spenderAccountId:null!=l.spender?r._fromProtobuf(l.spender):null,ownerAccountId:null!=l.owner?r._fromProtobuf(l.owner):null,serialNumbers:t?null:null!=l.serialNumbers?l.serialNumbers.map(e=>n.fromValue(e)):[],allSerials:t,delegatingSpender:null!=l.delegatingSpender?r._fromProtobuf(l.delegatingSpender):null})}static _fromGrantedProtobuf(n,l){return new o({tokenId:e._fromProtobuf(n.tokenId),spenderAccountId:r._fromProtobuf(n.spender),ownerAccountId:l,serialNumbers:[],allSerials:null,delegatingSpender:null})}static _fromRemoveProtobuf(l){return new o({tokenId:e._fromProtobuf(l.tokenId),spenderAccountId:null,ownerAccountId:null!=l.owner?r._fromProtobuf(l.owner):null,serialNumbers:null!=l.serialNumbers?l.serialNumbers.map(e=>n.fromValue(e)):[],allSerials:null,delegatingSpender:null})}_toProtobuf(){return{tokenId:this.tokenId._toProtobuf(),spender:null!=this.spenderAccountId?this.spenderAccountId._toProtobuf():null,owner:null!=this.ownerAccountId?this.ownerAccountId._toProtobuf():null,approvedForAll:null==this.serialNumbers?{value:this.allSerials}:null,serialNumbers:this.serialNumbers,delegatingSpender:null!=this.delegatingSpender?this.delegatingSpender._toProtobuf():null}}_validateChecksums(e){this.tokenId.validateChecksum(e),null!=this.ownerAccountId&&this.ownerAccountId.validateChecksum(e),null!=this.spenderAccountId&&this.spenderAccountId.validateChecksum(e)}}export{o as default};
|
|
2
2
|
//# sourceMappingURL=TokenNftAllowance.js.map
|