@hiero-ledger/sdk 2.77.0 → 2.78.0-beta.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/README.md +6 -6
- package/dist/umd.js +592 -592
- package/dist/umd.min.js +2 -2
- package/lib/Cache.cjs +6 -6
- package/lib/Cache.d.ts +12 -12
- package/lib/Cache.js.map +1 -1
- package/lib/Duration.cjs +1 -1
- package/lib/Duration.d.ts +2 -2
- package/lib/Duration.js.map +1 -1
- package/lib/EntityIdHelper.cjs +1 -1
- package/lib/EntityIdHelper.js +1 -1
- package/lib/EntityIdHelper.js.map +1 -1
- package/lib/EthereumFlow.cjs +7 -7
- package/lib/EthereumFlow.d.ts +14 -14
- package/lib/EthereumFlow.js.map +1 -1
- package/lib/EthereumTransaction.cjs +7 -7
- package/lib/EthereumTransaction.d.ts +14 -14
- package/lib/EthereumTransaction.js.map +1 -1
- package/lib/EvmAddress.cjs +1 -1
- package/lib/EvmAddress.d.ts +2 -2
- package/lib/EvmAddress.js.map +1 -1
- package/lib/ExchangeRate.cjs +2 -2
- package/lib/ExchangeRate.d.ts +4 -4
- package/lib/ExchangeRate.js.map +1 -1
- package/lib/ExchangeRates.cjs +1 -1
- package/lib/ExchangeRates.d.ts +1 -1
- package/lib/ExchangeRates.js +1 -1
- package/lib/ExchangeRates.js.map +1 -1
- package/lib/FeeComponents.cjs +1 -1
- package/lib/FeeComponents.d.ts +1 -1
- package/lib/FeeComponents.js +1 -1
- package/lib/FeeComponents.js.map +1 -1
- package/lib/FeeData.cjs +1 -1
- package/lib/FeeData.d.ts +1 -1
- package/lib/FeeData.js +1 -1
- package/lib/FeeData.js.map +1 -1
- package/lib/FeeDataType.cjs +1 -1
- package/lib/FeeDataType.d.ts +2 -2
- package/lib/FeeDataType.js.map +1 -1
- package/lib/FeeSchedule.cjs +1 -1
- package/lib/FeeSchedule.d.ts +1 -1
- package/lib/FeeSchedule.js +1 -1
- package/lib/FeeSchedule.js.map +1 -1
- package/lib/FeeSchedules.cjs +1 -1
- package/lib/FeeSchedules.d.ts +1 -1
- package/lib/FeeSchedules.js +1 -1
- package/lib/FeeSchedules.js.map +1 -1
- package/lib/FreezeType.cjs +1 -1
- package/lib/FreezeType.d.ts +2 -2
- package/lib/FreezeType.js.map +1 -1
- package/lib/Key.cjs +1 -1
- package/lib/Key.d.ts +2 -2
- package/lib/Key.js.map +1 -1
- package/lib/KeyList.cjs +3 -3
- package/lib/KeyList.d.ts +6 -6
- package/lib/KeyList.js.map +1 -1
- package/lib/Mnemonic.cjs +1 -1
- package/lib/Mnemonic.d.ts +1 -1
- package/lib/Mnemonic.js +1 -1
- package/lib/Mnemonic.js.map +1 -1
- package/lib/PrivateKey.cjs +7 -7
- package/lib/PrivateKey.d.ts +11 -11
- package/lib/PrivateKey.js +1 -1
- package/lib/PrivateKey.js.map +1 -1
- package/lib/PrngTransaction.cjs +9 -9
- package/lib/PrngTransaction.d.ts +18 -18
- package/lib/PrngTransaction.js.map +1 -1
- package/lib/PublicKey.cjs +5 -5
- package/lib/PublicKey.d.ts +9 -9
- package/lib/PublicKey.js +1 -1
- package/lib/PublicKey.js.map +1 -1
- package/lib/RequestType.cjs +1 -1
- package/lib/RequestType.d.ts +2 -2
- package/lib/RequestType.js.map +1 -1
- package/lib/StakingInfo.cjs +1 -1
- package/lib/StakingInfo.d.ts +1 -1
- package/lib/StakingInfo.js +1 -1
- package/lib/StakingInfo.js.map +1 -1
- package/lib/Status.cjs +1 -1
- package/lib/Status.d.ts +2 -2
- package/lib/Status.js.map +1 -1
- package/lib/Timestamp.cjs +1 -1
- package/lib/Timestamp.d.ts +1 -1
- package/lib/Timestamp.js.map +1 -1
- package/lib/TransactionFeeSchedule.cjs +1 -1
- package/lib/TransactionFeeSchedule.d.ts +1 -1
- package/lib/TransactionFeeSchedule.js +1 -1
- package/lib/TransactionFeeSchedule.js.map +1 -1
- package/lib/Transfer.cjs +2 -2
- package/lib/Transfer.d.ts +4 -4
- package/lib/Transfer.js.map +1 -1
- package/lib/account/AccountAllowanceAdjustTransaction.cjs +7 -7
- package/lib/account/AccountAllowanceAdjustTransaction.d.ts +14 -14
- package/lib/account/AccountAllowanceAdjustTransaction.js.map +1 -1
- package/lib/account/AccountAllowanceApproveTransaction.cjs +8 -8
- package/lib/account/AccountAllowanceApproveTransaction.d.ts +16 -16
- package/lib/account/AccountAllowanceApproveTransaction.js.map +1 -1
- package/lib/account/AccountAllowanceDeleteTransaction.cjs +7 -7
- package/lib/account/AccountAllowanceDeleteTransaction.d.ts +14 -14
- package/lib/account/AccountAllowanceDeleteTransaction.js.map +1 -1
- package/lib/account/AccountBalance.cjs +1 -1
- package/lib/account/AccountBalance.d.ts +1 -1
- package/lib/account/AccountBalance.js +1 -1
- package/lib/account/AccountBalance.js.map +1 -1
- package/lib/account/AccountBalanceQuery.cjs +6 -6
- package/lib/account/AccountBalanceQuery.d.ts +12 -12
- package/lib/account/AccountBalanceQuery.js.map +1 -1
- package/lib/account/AccountCreateTransaction.cjs +1 -1
- package/lib/account/AccountCreateTransaction.d.ts +1 -1
- package/lib/account/AccountCreateTransaction.js +1 -1
- package/lib/account/AccountCreateTransaction.js.map +1 -1
- package/lib/account/AccountDeleteTransaction.cjs +7 -7
- package/lib/account/AccountDeleteTransaction.d.ts +14 -14
- package/lib/account/AccountDeleteTransaction.js.map +1 -1
- package/lib/account/AccountId.cjs +1 -1
- package/lib/account/AccountId.d.ts +1 -1
- package/lib/account/AccountId.js +1 -1
- package/lib/account/AccountId.js.map +1 -1
- package/lib/account/AccountInfo.cjs +1 -1
- package/lib/account/AccountInfo.d.ts +1 -1
- package/lib/account/AccountInfo.js +1 -1
- package/lib/account/AccountInfo.js.map +1 -1
- package/lib/account/AccountInfoQuery.cjs +7 -7
- package/lib/account/AccountInfoQuery.d.ts +14 -14
- package/lib/account/AccountInfoQuery.js.map +1 -1
- package/lib/account/AccountRecordsQuery.cjs +7 -7
- package/lib/account/AccountRecordsQuery.d.ts +14 -14
- package/lib/account/AccountRecordsQuery.js.map +1 -1
- package/lib/account/AccountUpdateTransaction.cjs +7 -7
- package/lib/account/AccountUpdateTransaction.d.ts +14 -14
- package/lib/account/AccountUpdateTransaction.js.map +1 -1
- package/lib/account/HbarAllowance.cjs +3 -3
- package/lib/account/HbarAllowance.d.ts +6 -6
- package/lib/account/HbarAllowance.js.map +1 -1
- package/lib/account/HbarTransferMap.cjs +2 -2
- package/lib/account/HbarTransferMap.d.ts +4 -4
- package/lib/account/HbarTransferMap.js.map +1 -1
- package/lib/account/LiveHash.cjs +3 -3
- package/lib/account/LiveHash.d.ts +6 -6
- package/lib/account/LiveHash.js.map +1 -1
- package/lib/account/LiveHashAddTransaction.cjs +7 -7
- package/lib/account/LiveHashAddTransaction.d.ts +14 -14
- package/lib/account/LiveHashAddTransaction.js.map +1 -1
- package/lib/account/LiveHashDeleteTransaction.cjs +6 -6
- package/lib/account/LiveHashDeleteTransaction.d.ts +12 -12
- package/lib/account/LiveHashDeleteTransaction.js.map +1 -1
- package/lib/account/LiveHashQuery.cjs +7 -7
- package/lib/account/LiveHashQuery.d.ts +14 -14
- package/lib/account/LiveHashQuery.js.map +1 -1
- package/lib/account/NullableTokenDecimalMap.cjs +2 -2
- package/lib/account/NullableTokenDecimalMap.d.ts +4 -4
- package/lib/account/NullableTokenDecimalMap.js.map +1 -1
- package/lib/account/ProxyStaker.cjs +2 -2
- package/lib/account/ProxyStaker.d.ts +4 -4
- package/lib/account/ProxyStaker.js.map +1 -1
- package/lib/account/TokenAllowance.cjs +4 -4
- package/lib/account/TokenAllowance.d.ts +8 -8
- package/lib/account/TokenAllowance.js.map +1 -1
- package/lib/account/TokenBalanceMap.cjs +2 -2
- package/lib/account/TokenBalanceMap.d.ts +4 -4
- package/lib/account/TokenBalanceMap.js.map +1 -1
- package/lib/account/TokenDecimalMap.cjs +2 -2
- package/lib/account/TokenDecimalMap.d.ts +4 -4
- package/lib/account/TokenDecimalMap.js.map +1 -1
- package/lib/account/TokenNftAllowance.cjs +5 -5
- package/lib/account/TokenNftAllowance.d.ts +10 -10
- package/lib/account/TokenNftAllowance.js.map +1 -1
- package/lib/account/TokenNftTransferMap.cjs +5 -5
- package/lib/account/TokenNftTransferMap.d.ts +10 -10
- package/lib/account/TokenNftTransferMap.js.map +1 -1
- package/lib/account/TokenRelationship.cjs +4 -4
- package/lib/account/TokenRelationship.d.ts +8 -8
- package/lib/account/TokenRelationship.js.map +1 -1
- package/lib/account/TokenRelationshipMap.cjs +2 -2
- package/lib/account/TokenRelationshipMap.d.ts +4 -4
- package/lib/account/TokenRelationshipMap.js.map +1 -1
- package/lib/account/TokenTransferMap.cjs +4 -4
- package/lib/account/TokenTransferMap.d.ts +8 -8
- package/lib/account/TokenTransferMap.js.map +1 -1
- package/lib/account/TransferTransaction.cjs +6 -6
- package/lib/account/TransferTransaction.d.ts +12 -12
- package/lib/account/TransferTransaction.js.map +1 -1
- package/lib/address_book/AddressBooks.cjs +1 -1
- package/lib/address_book/AddressBooks.js +1 -1
- package/lib/address_book/AddressBooks.js.map +1 -1
- package/lib/address_book/Endpoint.cjs +1 -1
- package/lib/address_book/Endpoint.d.ts +2 -2
- package/lib/address_book/Endpoint.js.map +1 -1
- package/lib/address_book/NodeAddress.cjs +1 -1
- package/lib/address_book/NodeAddress.d.ts +2 -2
- package/lib/address_book/NodeAddress.js.map +1 -1
- package/lib/address_book/NodeAddressBook.cjs +1 -1
- package/lib/address_book/NodeAddressBook.d.ts +1 -1
- package/lib/address_book/NodeAddressBook.js +1 -1
- package/lib/address_book/NodeAddressBook.js.map +1 -1
- package/lib/browser.js +1 -1
- package/lib/channel/Channel.cjs +1 -1
- package/lib/channel/Channel.d.ts +1 -1
- package/lib/channel/Channel.js +1 -1
- package/lib/channel/Channel.js.map +1 -1
- package/lib/contract/ContractByteCodeQuery.cjs +6 -6
- package/lib/contract/ContractByteCodeQuery.d.ts +12 -12
- package/lib/contract/ContractByteCodeQuery.js.map +1 -1
- package/lib/contract/ContractCallQuery.cjs +1 -1
- package/lib/contract/ContractCallQuery.d.ts +1 -1
- package/lib/contract/ContractCallQuery.js +1 -1
- package/lib/contract/ContractCallQuery.js.map +1 -1
- package/lib/contract/ContractCreateTransaction.cjs +8 -8
- package/lib/contract/ContractCreateTransaction.d.ts +16 -16
- package/lib/contract/ContractCreateTransaction.js.map +1 -1
- package/lib/contract/ContractDeleteTransaction.cjs +8 -8
- package/lib/contract/ContractDeleteTransaction.d.ts +16 -16
- package/lib/contract/ContractDeleteTransaction.js.map +1 -1
- package/lib/contract/ContractExecuteTransaction.cjs +9 -9
- package/lib/contract/ContractExecuteTransaction.d.ts +18 -18
- package/lib/contract/ContractExecuteTransaction.js.map +1 -1
- package/lib/contract/ContractFunctionResult.cjs +2 -2
- package/lib/contract/ContractFunctionResult.d.ts +4 -4
- package/lib/contract/ContractFunctionResult.js.map +1 -1
- package/lib/contract/ContractId.cjs +1 -1
- package/lib/contract/ContractId.d.ts +1 -1
- package/lib/contract/ContractId.js +1 -1
- package/lib/contract/ContractId.js.map +1 -1
- package/lib/contract/ContractInfo.cjs +1 -1
- package/lib/contract/ContractInfo.d.ts +1 -1
- package/lib/contract/ContractInfo.js +1 -1
- package/lib/contract/ContractInfo.js.map +1 -1
- package/lib/contract/ContractInfoQuery.cjs +7 -7
- package/lib/contract/ContractInfoQuery.d.ts +14 -14
- package/lib/contract/ContractInfoQuery.js.map +1 -1
- package/lib/contract/ContractLogInfo.cjs +2 -2
- package/lib/contract/ContractLogInfo.d.ts +4 -4
- package/lib/contract/ContractLogInfo.js.map +1 -1
- package/lib/contract/ContractNonceInfo.cjs +3 -3
- package/lib/contract/ContractNonceInfo.d.ts +4 -4
- package/lib/contract/ContractNonceInfo.js +1 -1
- package/lib/contract/ContractNonceInfo.js.map +1 -1
- package/lib/contract/ContractStateChange.cjs +1 -1
- package/lib/contract/ContractStateChange.d.ts +1 -1
- package/lib/contract/ContractUpdateTransaction.cjs +10 -10
- package/lib/contract/ContractUpdateTransaction.d.ts +18 -18
- package/lib/contract/ContractUpdateTransaction.js +1 -1
- package/lib/contract/ContractUpdateTransaction.js.map +1 -1
- package/lib/contract/DelegateContractId.cjs +2 -2
- package/lib/contract/DelegateContractId.d.ts +4 -4
- package/lib/contract/DelegateContractId.js.map +1 -1
- package/lib/contract/StorageChange.cjs +1 -1
- package/lib/contract/StorageChange.d.ts +1 -1
- package/lib/exports.cjs +1 -1
- package/lib/exports.d.ts +1 -1
- package/lib/exports.js +1 -1
- package/lib/exports.js.map +1 -1
- package/lib/file/FileAppendTransaction.cjs +7 -7
- package/lib/file/FileAppendTransaction.d.ts +14 -14
- package/lib/file/FileAppendTransaction.js.map +1 -1
- package/lib/file/FileContentsQuery.cjs +7 -7
- package/lib/file/FileContentsQuery.d.ts +14 -14
- package/lib/file/FileContentsQuery.js.map +1 -1
- package/lib/file/FileCreateTransaction.cjs +6 -6
- package/lib/file/FileCreateTransaction.d.ts +12 -12
- package/lib/file/FileCreateTransaction.js.map +1 -1
- package/lib/file/FileDeleteTransaction.cjs +7 -7
- package/lib/file/FileDeleteTransaction.d.ts +14 -14
- package/lib/file/FileDeleteTransaction.js.map +1 -1
- package/lib/file/FileId.cjs +1 -1
- package/lib/file/FileId.d.ts +1 -1
- package/lib/file/FileId.js +1 -1
- package/lib/file/FileId.js.map +1 -1
- package/lib/file/FileInfo.cjs +1 -1
- package/lib/file/FileInfo.d.ts +1 -1
- package/lib/file/FileInfo.js +1 -1
- package/lib/file/FileInfo.js.map +1 -1
- package/lib/file/FileInfoQuery.cjs +7 -7
- package/lib/file/FileInfoQuery.d.ts +14 -14
- package/lib/file/FileInfoQuery.js.map +1 -1
- package/lib/file/FileUpdateTransaction.cjs +6 -6
- package/lib/file/FileUpdateTransaction.d.ts +12 -12
- package/lib/file/FileUpdateTransaction.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/native.js +1 -1
- package/lib/network/AddressBookQuery.cjs +1 -1
- package/lib/network/AddressBookQuery.js +1 -1
- package/lib/network/AddressBookQuery.js.map +1 -1
- package/lib/network/NetworkVersionInfo.cjs +1 -1
- package/lib/network/NetworkVersionInfo.d.ts +1 -1
- package/lib/network/NetworkVersionInfo.js +1 -1
- package/lib/network/NetworkVersionInfo.js.map +1 -1
- package/lib/network/NetworkVersionInfoQuery.cjs +6 -6
- package/lib/network/NetworkVersionInfoQuery.d.ts +12 -12
- package/lib/network/NetworkVersionInfoQuery.js.map +1 -1
- package/lib/network/SemanticVersion.cjs +1 -1
- package/lib/network/SemanticVersion.d.ts +1 -1
- package/lib/network/SemanticVersion.js +1 -1
- package/lib/network/SemanticVersion.js.map +1 -1
- package/lib/node/NodeCreateTransaction.cjs +6 -6
- package/lib/node/NodeCreateTransaction.d.ts +12 -12
- package/lib/node/NodeCreateTransaction.js.map +1 -1
- package/lib/node/NodeDeleteTransaction.cjs +6 -6
- package/lib/node/NodeDeleteTransaction.d.ts +12 -12
- package/lib/node/NodeDeleteTransaction.js.map +1 -1
- package/lib/node/NodeUpdateTransaction.cjs +6 -6
- package/lib/node/NodeUpdateTransaction.d.ts +12 -12
- package/lib/node/NodeUpdateTransaction.js.map +1 -1
- package/lib/node/ServiceEndpoint.cjs +1 -1
- package/lib/node/ServiceEndpoint.d.ts +2 -2
- package/lib/node/ServiceEndpoint.js.map +1 -1
- package/lib/query/CostQuery.cjs +1 -1
- package/lib/query/CostQuery.d.ts +1 -1
- package/lib/query/CostQuery.js +1 -1
- package/lib/query/CostQuery.js.map +1 -1
- package/lib/query/Query.cjs +1 -1
- package/lib/query/Query.d.ts +1 -1
- package/lib/query/Query.js +1 -1
- package/lib/query/Query.js.map +1 -1
- package/lib/query/QueryBase.cjs +1 -1
- package/lib/query/QueryBase.d.ts +1 -1
- package/lib/query/QueryBase.js +1 -1
- package/lib/query/QueryBase.js.map +1 -1
- package/lib/schedule/ScheduleCreateTransaction.cjs +1 -1
- package/lib/schedule/ScheduleCreateTransaction.d.ts +1 -1
- package/lib/schedule/ScheduleCreateTransaction.js +1 -1
- package/lib/schedule/ScheduleCreateTransaction.js.map +1 -1
- package/lib/schedule/ScheduleDeleteTransaction.cjs +8 -8
- package/lib/schedule/ScheduleDeleteTransaction.d.ts +16 -16
- package/lib/schedule/ScheduleDeleteTransaction.js.map +1 -1
- package/lib/schedule/ScheduleId.cjs +1 -1
- package/lib/schedule/ScheduleId.d.ts +1 -1
- package/lib/schedule/ScheduleId.js +1 -1
- package/lib/schedule/ScheduleId.js.map +1 -1
- package/lib/schedule/ScheduleInfo.cjs +1 -1
- package/lib/schedule/ScheduleInfo.d.ts +1 -1
- package/lib/schedule/ScheduleInfo.js +1 -1
- package/lib/schedule/ScheduleInfo.js.map +1 -1
- package/lib/schedule/ScheduleInfoQuery.cjs +7 -7
- package/lib/schedule/ScheduleInfoQuery.d.ts +14 -14
- package/lib/schedule/ScheduleInfoQuery.js.map +1 -1
- package/lib/schedule/ScheduleSignTransaction.cjs +10 -10
- package/lib/schedule/ScheduleSignTransaction.d.ts +20 -20
- package/lib/schedule/ScheduleSignTransaction.js.map +1 -1
- package/lib/system/FreezeTransaction.cjs +6 -6
- package/lib/system/FreezeTransaction.d.ts +12 -12
- package/lib/system/FreezeTransaction.js.map +1 -1
- package/lib/system/SystemDeleteTransaction.cjs +8 -8
- package/lib/system/SystemDeleteTransaction.d.ts +16 -16
- package/lib/system/SystemDeleteTransaction.js.map +1 -1
- package/lib/system/SystemUndeleteTransaction.cjs +8 -8
- package/lib/system/SystemUndeleteTransaction.d.ts +16 -16
- package/lib/system/SystemUndeleteTransaction.js.map +1 -1
- package/lib/token/AbstractTokenTransferTransaction.cjs +1 -1
- package/lib/token/AbstractTokenTransferTransaction.d.ts +2 -2
- package/lib/token/AbstractTokenTransferTransaction.js.map +1 -1
- package/lib/token/AssessedCustomFee.cjs +1 -1
- package/lib/token/AssessedCustomFee.d.ts +2 -2
- package/lib/token/AssessedCustomFee.js.map +1 -1
- package/lib/token/CustomFee.cjs +1 -1
- package/lib/token/CustomFee.d.ts +2 -2
- package/lib/token/CustomFee.js.map +1 -1
- package/lib/token/CustomFixedFee.cjs +3 -3
- package/lib/token/CustomFixedFee.d.ts +6 -6
- package/lib/token/CustomFixedFee.js.map +1 -1
- package/lib/token/CustomFractionalFee.cjs +3 -3
- package/lib/token/CustomFractionalFee.d.ts +6 -6
- package/lib/token/CustomFractionalFee.js.map +1 -1
- package/lib/token/CustomRoyaltyFee.cjs +4 -4
- package/lib/token/CustomRoyaltyFee.d.ts +8 -8
- package/lib/token/CustomRoyaltyFee.js.map +1 -1
- package/lib/token/NftId.cjs +1 -1
- package/lib/token/NftId.d.ts +1 -1
- package/lib/token/NftId.js +1 -1
- package/lib/token/NftId.js.map +1 -1
- package/lib/token/PendingAirdropId.cjs +1 -1
- package/lib/token/PendingAirdropId.d.ts +1 -1
- package/lib/token/PendingAirdropId.js.map +1 -1
- package/lib/token/PendingAirdropRecord.cjs +1 -1
- package/lib/token/PendingAirdropRecord.d.ts +1 -1
- package/lib/token/PendingAirdropRecord.js.map +1 -1
- package/lib/token/TokenAirdropTransaction.cjs +8 -8
- package/lib/token/TokenAirdropTransaction.d.ts +16 -16
- package/lib/token/TokenAirdropTransaction.js.map +1 -1
- package/lib/token/TokenAssociateTransaction.cjs +7 -7
- package/lib/token/TokenAssociateTransaction.d.ts +14 -14
- package/lib/token/TokenAssociateTransaction.js.map +1 -1
- package/lib/token/TokenAssociation.cjs +1 -1
- package/lib/token/TokenAssociation.d.ts +2 -2
- package/lib/token/TokenAssociation.js.map +1 -1
- package/lib/token/TokenBurnTransaction.cjs +7 -7
- package/lib/token/TokenBurnTransaction.d.ts +14 -14
- package/lib/token/TokenBurnTransaction.js.map +1 -1
- package/lib/token/TokenCancelAirdropTransaction.cjs +6 -6
- package/lib/token/TokenCancelAirdropTransaction.d.ts +12 -12
- package/lib/token/TokenCancelAirdropTransaction.js.map +1 -1
- package/lib/token/TokenClaimAirdropTransaction.cjs +6 -6
- package/lib/token/TokenClaimAirdropTransaction.d.ts +12 -12
- package/lib/token/TokenClaimAirdropTransaction.js.map +1 -1
- package/lib/token/TokenCreateTransaction.cjs +7 -7
- package/lib/token/TokenCreateTransaction.d.ts +14 -14
- package/lib/token/TokenCreateTransaction.js.map +1 -1
- package/lib/token/TokenDeleteTransaction.cjs +7 -7
- package/lib/token/TokenDeleteTransaction.d.ts +14 -14
- package/lib/token/TokenDeleteTransaction.js.map +1 -1
- package/lib/token/TokenDissociateTransaction.cjs +7 -7
- package/lib/token/TokenDissociateTransaction.d.ts +14 -14
- package/lib/token/TokenDissociateTransaction.js.map +1 -1
- package/lib/token/TokenFeeScheduleUpdateTransaction.cjs +7 -7
- package/lib/token/TokenFeeScheduleUpdateTransaction.d.ts +14 -14
- package/lib/token/TokenFeeScheduleUpdateTransaction.js.map +1 -1
- package/lib/token/TokenFreezeTransaction.cjs +7 -7
- package/lib/token/TokenFreezeTransaction.d.ts +14 -14
- package/lib/token/TokenFreezeTransaction.js.map +1 -1
- package/lib/token/TokenGrantKycTransaction.cjs +7 -7
- package/lib/token/TokenGrantKycTransaction.d.ts +14 -14
- package/lib/token/TokenGrantKycTransaction.js.map +1 -1
- package/lib/token/TokenId.cjs +1 -1
- package/lib/token/TokenId.d.ts +1 -1
- package/lib/token/TokenId.js +1 -1
- package/lib/token/TokenId.js.map +1 -1
- package/lib/token/TokenInfo.cjs +1 -1
- package/lib/token/TokenInfo.d.ts +1 -1
- package/lib/token/TokenInfo.js +1 -1
- package/lib/token/TokenInfo.js.map +1 -1
- package/lib/token/TokenInfoQuery.cjs +7 -7
- package/lib/token/TokenInfoQuery.d.ts +14 -14
- package/lib/token/TokenInfoQuery.js.map +1 -1
- package/lib/token/TokenKeyValidation.cjs +1 -1
- package/lib/token/TokenKeyValidation.d.ts +2 -2
- package/lib/token/TokenKeyValidation.js.map +1 -1
- package/lib/token/TokenMintTransaction.cjs +7 -7
- package/lib/token/TokenMintTransaction.d.ts +14 -14
- package/lib/token/TokenMintTransaction.js.map +1 -1
- package/lib/token/TokenNftInfo.cjs +10 -10
- package/lib/token/TokenNftInfo.d.ts +20 -20
- package/lib/token/TokenNftInfo.js.map +1 -1
- package/lib/token/TokenNftInfoQuery.cjs +11 -11
- package/lib/token/TokenNftInfoQuery.d.ts +22 -22
- package/lib/token/TokenNftInfoQuery.js.map +1 -1
- package/lib/token/TokenNftTransfer.cjs +5 -5
- package/lib/token/TokenNftTransfer.d.ts +10 -10
- package/lib/token/TokenNftTransfer.js.map +1 -1
- package/lib/token/TokenNftsUpdateTransaction.cjs +7 -7
- package/lib/token/TokenNftsUpdateTransaction.d.ts +14 -14
- package/lib/token/TokenPauseTransaction.cjs +7 -7
- package/lib/token/TokenPauseTransaction.d.ts +14 -14
- package/lib/token/TokenPauseTransaction.js.map +1 -1
- package/lib/token/TokenReference.cjs +1 -1
- package/lib/token/TokenReference.d.ts +2 -2
- package/lib/token/TokenReference.js.map +1 -1
- package/lib/token/TokenRejectTransaction.cjs +7 -7
- package/lib/token/TokenRejectTransaction.d.ts +14 -14
- package/lib/token/TokenRejectTransaction.js.map +1 -1
- package/lib/token/TokenRevokeKycTransaction.cjs +7 -7
- package/lib/token/TokenRevokeKycTransaction.d.ts +14 -14
- package/lib/token/TokenRevokeKycTransaction.js.map +1 -1
- package/lib/token/TokenSupplyType.cjs +1 -1
- package/lib/token/TokenSupplyType.d.ts +2 -2
- package/lib/token/TokenSupplyType.js.map +1 -1
- package/lib/token/TokenTransfer.cjs +4 -4
- package/lib/token/TokenTransfer.d.ts +8 -8
- package/lib/token/TokenTransfer.js.map +1 -1
- package/lib/token/TokenType.cjs +1 -1
- package/lib/token/TokenType.d.ts +2 -2
- package/lib/token/TokenType.js.map +1 -1
- package/lib/token/TokenUnfreezeTransaction.cjs +7 -7
- package/lib/token/TokenUnfreezeTransaction.d.ts +14 -14
- package/lib/token/TokenUnfreezeTransaction.js.map +1 -1
- package/lib/token/TokenUnpauseTransaction.cjs +7 -7
- package/lib/token/TokenUnpauseTransaction.d.ts +14 -14
- package/lib/token/TokenUnpauseTransaction.js.map +1 -1
- package/lib/token/TokenUpdateNftsTransaction.cjs +7 -7
- package/lib/token/TokenUpdateNftsTransaction.d.ts +14 -14
- package/lib/token/TokenUpdateNftsTransaction.js.map +1 -1
- package/lib/token/TokenUpdateTransaction.cjs +7 -7
- package/lib/token/TokenUpdateTransaction.d.ts +14 -14
- package/lib/token/TokenUpdateTransaction.js.map +1 -1
- package/lib/token/TokenWipeTransaction.cjs +7 -7
- package/lib/token/TokenWipeTransaction.d.ts +14 -14
- package/lib/token/TokenWipeTransaction.js.map +1 -1
- package/lib/topic/TopicCreateTransaction.cjs +6 -6
- package/lib/topic/TopicCreateTransaction.d.ts +12 -12
- package/lib/topic/TopicCreateTransaction.js.map +1 -1
- package/lib/topic/TopicDeleteTransaction.cjs +6 -6
- package/lib/topic/TopicDeleteTransaction.d.ts +12 -12
- package/lib/topic/TopicDeleteTransaction.js.map +1 -1
- package/lib/topic/TopicId.cjs +1 -1
- package/lib/topic/TopicId.d.ts +1 -1
- package/lib/topic/TopicId.js +1 -1
- package/lib/topic/TopicId.js.map +1 -1
- package/lib/topic/TopicInfo.cjs +1 -1
- package/lib/topic/TopicInfo.d.ts +1 -1
- package/lib/topic/TopicInfo.js +1 -1
- package/lib/topic/TopicInfo.js.map +1 -1
- package/lib/topic/TopicInfoQuery.cjs +7 -7
- package/lib/topic/TopicInfoQuery.d.ts +14 -14
- package/lib/topic/TopicInfoQuery.js.map +1 -1
- package/lib/topic/TopicMessage.cjs +2 -2
- package/lib/topic/TopicMessage.d.ts +4 -4
- package/lib/topic/TopicMessage.js.map +1 -1
- package/lib/topic/TopicMessageChunk.cjs +2 -2
- package/lib/topic/TopicMessageChunk.d.ts +4 -4
- package/lib/topic/TopicMessageChunk.js.map +1 -1
- package/lib/topic/TopicMessageQuery.cjs +1 -1
- package/lib/topic/TopicMessageQuery.js +1 -1
- package/lib/topic/TopicMessageQuery.js.map +1 -1
- package/lib/topic/TopicMessageSubmitTransaction.cjs +9 -9
- package/lib/topic/TopicMessageSubmitTransaction.d.ts +18 -18
- package/lib/topic/TopicMessageSubmitTransaction.js.map +1 -1
- package/lib/topic/TopicUpdateTransaction.cjs +6 -6
- package/lib/topic/TopicUpdateTransaction.d.ts +12 -12
- package/lib/topic/TopicUpdateTransaction.js.map +1 -1
- package/lib/transaction/BatchTransaction.cjs +5 -5
- package/lib/transaction/BatchTransaction.d.ts +9 -9
- package/lib/transaction/BatchTransaction.js +1 -1
- package/lib/transaction/BatchTransaction.js.map +1 -1
- package/lib/transaction/CustomFeeLimit.cjs +2 -2
- package/lib/transaction/CustomFeeLimit.d.ts +4 -4
- package/lib/transaction/CustomFeeLimit.js.map +1 -1
- package/lib/transaction/NodeAccountIdSignatureMap.cjs +2 -2
- package/lib/transaction/NodeAccountIdSignatureMap.d.ts +2 -2
- package/lib/transaction/NodeAccountIdSignatureMap.js +1 -1
- package/lib/transaction/NodeAccountIdSignatureMap.js.map +1 -1
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.cjs +1 -1
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.d.ts +2 -2
- package/lib/transaction/NodeAccountIdSignatureMapLegacy.js.map +1 -1
- package/lib/transaction/SignatureMap.cjs +1 -1
- package/lib/transaction/SignatureMap.js.map +1 -1
- package/lib/transaction/SignaturePairMap.cjs +1 -1
- package/lib/transaction/SignaturePairMap.d.ts +2 -2
- package/lib/transaction/SignaturePairMap.js.map +1 -1
- package/lib/transaction/Transaction.cjs +1 -1
- package/lib/transaction/Transaction.d.ts +1 -1
- package/lib/transaction/Transaction.js +1 -1
- package/lib/transaction/Transaction.js.map +1 -1
- package/lib/transaction/TransactionHashMap.cjs +1 -1
- package/lib/transaction/TransactionHashMap.d.ts +2 -2
- package/lib/transaction/TransactionHashMap.js.map +1 -1
- package/lib/transaction/TransactionId.cjs +1 -1
- package/lib/transaction/TransactionId.d.ts +1 -1
- package/lib/transaction/TransactionId.js +1 -1
- package/lib/transaction/TransactionId.js.map +1 -1
- package/lib/transaction/TransactionReceipt.cjs +1 -1
- package/lib/transaction/TransactionReceipt.d.ts +1 -1
- package/lib/transaction/TransactionReceipt.js +1 -1
- package/lib/transaction/TransactionReceipt.js.map +1 -1
- package/lib/transaction/TransactionReceiptQuery.cjs +1 -1
- package/lib/transaction/TransactionReceiptQuery.d.ts +1 -1
- package/lib/transaction/TransactionReceiptQuery.js +1 -1
- package/lib/transaction/TransactionReceiptQuery.js.map +1 -1
- package/lib/transaction/TransactionRecord.cjs +1 -1
- package/lib/transaction/TransactionRecord.d.ts +1 -1
- package/lib/transaction/TransactionRecord.js +1 -1
- package/lib/transaction/TransactionRecord.js.map +1 -1
- package/lib/transaction/TransactionRecordQuery.cjs +1 -1
- package/lib/transaction/TransactionRecordQuery.d.ts +1 -1
- package/lib/transaction/TransactionRecordQuery.js +1 -1
- package/lib/transaction/TransactionRecordQuery.js.map +1 -1
- package/lib/util/ASN1-Decoder.cjs +1 -1
- package/lib/util/ASN1-Decoder.js +1 -1
- package/lib/util/ASN1-Decoder.js.map +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -3
- package/src/Cache.js +6 -6
- package/src/Duration.js +1 -1
- package/src/EntityIdHelper.js +1 -1
- package/src/EthereumFlow.js +7 -7
- package/src/EthereumTransaction.js +7 -7
- package/src/EvmAddress.js +1 -1
- package/src/ExchangeRate.js +2 -2
- package/src/ExchangeRates.js +1 -1
- package/src/FeeComponents.js +1 -1
- package/src/FeeData.js +1 -1
- package/src/FeeDataType.js +1 -1
- package/src/FeeSchedule.js +1 -1
- package/src/FeeSchedules.js +1 -1
- package/src/FreezeType.js +1 -1
- package/src/Key.js +1 -1
- package/src/KeyList.js +3 -3
- package/src/Mnemonic.js +1 -1
- package/src/PrivateKey.js +7 -7
- package/src/PrngTransaction.js +9 -9
- package/src/PublicKey.js +5 -5
- package/src/RequestType.js +1 -1
- package/src/StakingInfo.js +1 -1
- package/src/Status.js +1 -1
- package/src/Timestamp.js +1 -1
- package/src/TransactionFeeSchedule.js +1 -1
- package/src/Transfer.js +2 -2
- package/src/account/AccountAllowanceAdjustTransaction.js +7 -7
- package/src/account/AccountAllowanceApproveTransaction.js +8 -8
- package/src/account/AccountAllowanceDeleteTransaction.js +7 -7
- package/src/account/AccountBalance.js +1 -1
- package/src/account/AccountBalanceQuery.js +6 -6
- package/src/account/AccountCreateTransaction.js +1 -1
- package/src/account/AccountDeleteTransaction.js +7 -7
- package/src/account/AccountId.js +1 -1
- package/src/account/AccountInfo.js +1 -1
- package/src/account/AccountInfoQuery.js +7 -7
- package/src/account/AccountRecordsQuery.js +7 -7
- package/src/account/AccountUpdateTransaction.js +7 -7
- package/src/account/HbarAllowance.js +3 -3
- package/src/account/HbarTransferMap.js +2 -2
- package/src/account/LiveHash.js +3 -3
- package/src/account/LiveHashAddTransaction.js +7 -7
- package/src/account/LiveHashDeleteTransaction.js +6 -6
- package/src/account/LiveHashQuery.js +7 -7
- package/src/account/NullableTokenDecimalMap.js +2 -2
- package/src/account/ProxyStaker.js +2 -2
- package/src/account/TokenAllowance.js +4 -4
- package/src/account/TokenBalanceMap.js +2 -2
- package/src/account/TokenDecimalMap.js +2 -2
- package/src/account/TokenNftAllowance.js +5 -5
- package/src/account/TokenNftTransferMap.js +5 -5
- package/src/account/TokenRelationship.js +4 -4
- package/src/account/TokenRelationshipMap.js +2 -2
- package/src/account/TokenTransferMap.js +4 -4
- package/src/account/TransferTransaction.js +6 -6
- package/src/address_book/AddressBooks.js +1 -1
- package/src/address_book/Endpoint.js +1 -1
- package/src/address_book/NodeAddress.js +1 -1
- package/src/address_book/NodeAddressBook.js +1 -1
- package/src/channel/Channel.js +1 -1
- package/src/contract/ContractByteCodeQuery.js +6 -6
- package/src/contract/ContractCallQuery.js +1 -1
- package/src/contract/ContractCreateTransaction.js +8 -8
- package/src/contract/ContractDeleteTransaction.js +8 -8
- package/src/contract/ContractExecuteTransaction.js +9 -9
- package/src/contract/ContractFunctionResult.js +2 -2
- package/src/contract/ContractId.js +1 -1
- package/src/contract/ContractInfo.js +1 -1
- package/src/contract/ContractInfoQuery.js +7 -7
- package/src/contract/ContractLogInfo.js +2 -2
- package/src/contract/ContractNonceInfo.js +3 -3
- package/src/contract/ContractStateChange.js +1 -1
- package/src/contract/ContractUpdateTransaction.js +10 -10
- package/src/contract/DelegateContractId.js +2 -2
- package/src/contract/StorageChange.js +1 -1
- package/src/exports.js +1 -1
- package/src/file/FileAppendTransaction.js +7 -7
- package/src/file/FileContentsQuery.js +7 -7
- package/src/file/FileCreateTransaction.js +6 -6
- package/src/file/FileDeleteTransaction.js +7 -7
- package/src/file/FileId.js +1 -1
- package/src/file/FileInfo.js +1 -1
- package/src/file/FileInfoQuery.js +7 -7
- package/src/file/FileUpdateTransaction.js +6 -6
- package/src/network/AddressBookQuery.js +1 -1
- package/src/network/NetworkVersionInfo.js +1 -1
- package/src/network/NetworkVersionInfoQuery.js +6 -6
- package/src/network/SemanticVersion.js +1 -1
- package/src/node/NodeCreateTransaction.js +6 -6
- package/src/node/NodeDeleteTransaction.js +6 -6
- package/src/node/NodeUpdateTransaction.js +6 -6
- package/src/node/ServiceEndpoint.js +1 -1
- package/src/query/CostQuery.js +1 -1
- package/src/query/Query.js +1 -1
- package/src/query/QueryBase.js +1 -1
- package/src/schedule/ScheduleCreateTransaction.js +1 -1
- package/src/schedule/ScheduleDeleteTransaction.js +8 -8
- package/src/schedule/ScheduleId.js +1 -1
- package/src/schedule/ScheduleInfo.js +1 -1
- package/src/schedule/ScheduleInfoQuery.js +7 -7
- package/src/schedule/ScheduleSignTransaction.js +10 -10
- package/src/system/FreezeTransaction.js +6 -6
- package/src/system/SystemDeleteTransaction.js +8 -8
- package/src/system/SystemUndeleteTransaction.js +8 -8
- package/src/token/AbstractTokenTransferTransaction.js +1 -1
- package/src/token/AssessedCustomFee.js +1 -1
- package/src/token/CustomFee.js +1 -1
- package/src/token/CustomFixedFee.js +3 -3
- package/src/token/CustomFractionalFee.js +3 -3
- package/src/token/CustomRoyaltyFee.js +4 -4
- package/src/token/NftId.js +1 -1
- package/src/token/PendingAirdropId.js +1 -1
- package/src/token/PendingAirdropRecord.js +1 -1
- package/src/token/TokenAirdropTransaction.js +8 -8
- package/src/token/TokenAssociateTransaction.js +7 -7
- package/src/token/TokenAssociation.js +1 -1
- package/src/token/TokenBurnTransaction.js +7 -7
- package/src/token/TokenCancelAirdropTransaction.js +6 -6
- package/src/token/TokenClaimAirdropTransaction.js +6 -6
- package/src/token/TokenCreateTransaction.js +7 -7
- package/src/token/TokenDeleteTransaction.js +7 -7
- package/src/token/TokenDissociateTransaction.js +7 -7
- package/src/token/TokenFeeScheduleUpdateTransaction.js +7 -7
- package/src/token/TokenFreezeTransaction.js +7 -7
- package/src/token/TokenGrantKycTransaction.js +7 -7
- package/src/token/TokenId.js +1 -1
- package/src/token/TokenInfo.js +1 -1
- package/src/token/TokenInfoQuery.js +7 -7
- package/src/token/TokenKeyValidation.js +1 -1
- package/src/token/TokenMintTransaction.js +7 -7
- package/src/token/TokenNftInfo.js +10 -10
- package/src/token/TokenNftInfoQuery.js +11 -11
- package/src/token/TokenNftTransfer.js +5 -5
- package/src/token/TokenNftsUpdateTransaction.js +7 -7
- package/src/token/TokenPauseTransaction.js +7 -7
- package/src/token/TokenReference.js +1 -1
- package/src/token/TokenRejectTransaction.js +7 -7
- package/src/token/TokenRevokeKycTransaction.js +7 -7
- package/src/token/TokenSupplyType.js +1 -1
- package/src/token/TokenTransfer.js +4 -4
- package/src/token/TokenType.js +1 -1
- package/src/token/TokenUnfreezeTransaction.js +7 -7
- package/src/token/TokenUnpauseTransaction.js +7 -7
- package/src/token/TokenUpdateNftsTransaction.js +7 -7
- package/src/token/TokenUpdateTransaction.js +7 -7
- package/src/token/TokenWipeTransaction.js +7 -7
- package/src/topic/TopicCreateTransaction.js +6 -6
- package/src/topic/TopicDeleteTransaction.js +6 -6
- package/src/topic/TopicId.js +1 -1
- package/src/topic/TopicInfo.js +1 -1
- package/src/topic/TopicInfoQuery.js +7 -7
- package/src/topic/TopicMessage.js +2 -2
- package/src/topic/TopicMessageChunk.js +2 -2
- package/src/topic/TopicMessageQuery.js +1 -1
- package/src/topic/TopicMessageSubmitTransaction.js +9 -9
- package/src/topic/TopicUpdateTransaction.js +6 -6
- package/src/transaction/BatchTransaction.js +5 -5
- package/src/transaction/CustomFeeLimit.js +2 -2
- package/src/transaction/NodeAccountIdSignatureMap.js +2 -2
- package/src/transaction/NodeAccountIdSignatureMapLegacy.js +1 -1
- package/src/transaction/SignatureMap.js +1 -1
- package/src/transaction/SignaturePairMap.js +1 -1
- package/src/transaction/Transaction.js +1 -1
- package/src/transaction/TransactionHashMap.js +1 -1
- package/src/transaction/TransactionId.js +1 -1
- package/src/transaction/TransactionReceipt.js +1 -1
- package/src/transaction/TransactionReceiptQuery.js +1 -1
- package/src/transaction/TransactionRecord.js +1 -1
- package/src/transaction/TransactionRecordQuery.js +1 -1
- package/src/util/ASN1-Decoder.js +1 -1
package/lib/account/AccountId.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import s from"long";import{constructor as t,fromStringSplitter as e,fromEvmAddress as r,validateChecksum as i,fromSolidityAddress as n,toSolidityAddress as l,toEvmAddress as a,toStringWithChecksum as o}from"../EntityIdHelper.js";import*as m from"@
|
|
1
|
+
import s from"long";import{constructor as t,fromStringSplitter as e,fromEvmAddress as r,validateChecksum as i,fromSolidityAddress as n,toSolidityAddress as l,toEvmAddress as a,toStringWithChecksum as o}from"../EntityIdHelper.js";import*as m from"@hiero-ledger/proto";import u from"../Key.js";import h from"../PublicKey.js";import d from"../Cache.js";import c from"../EvmAddress.js";import{decode as f}from"../encoding/hex.js";import{isLongZeroAddress as v}from"../util.js";class y{constructor(s,e,r,i,n){const l=t(s,e,r);this.shard=l.shard,this.realm=l.realm,this.num=l.num,this.aliasKey=null!=i?i:null,this.evmAddress=null!=n?n:null,this._checksum=null}static fromString(t){let r,i,n=s.ZERO,l=s.ZERO,a=s.ZERO;if(t.startsWith("0x")&&42==t.length||40==t.length)i=c.fromString(t);else{const o=e(t);if(Number.isNaN(o.shard)||Number.isNaN(o.realm))throw new Error("invalid format for entity ID");null!=o.shard&&(n=s.fromString(o.shard)),null!=o.realm&&(l=s.fromString(o.realm)),o.numOrHex.length<20?a=s.fromString(o.numOrHex):40==o.numOrHex.length?i=c.fromString(o.numOrHex):r=h.fromString(o.numOrHex)}return new y(n,l,a,r,i)}static fromEvmAddress(s,t,e){const i="string"==typeof e?c.fromString(e):e,[n,l,a,o]=r(s,t,i.toString());return new y(n,l,a,void 0,o||void 0)}static fromEvmPublicAddress(s){return new y(0,0,0,void 0,s)}static _fromProtobuf(s){let t,e;return null!=s.alias&&(20===s.alias.length?e=c.fromBytes(s.alias):t=u._fromProtobufKey(m.proto.Key.decode(s.alias))),t instanceof h||(t=void 0),new y(null!=s.shardNum?s.shardNum:0,null!=s.realmNum?s.realmNum:0,null!=s.accountNum?s.accountNum:0,t,e)}get checksum(){return this._checksum}getEvmAddress(){return this.evmAddress}async populateAccountNum(t){if(null===this.evmAddress)throw new Error("field `evmAddress` should not be null");const e=`${t.mirrorRestApiBaseUrl}/accounts/${this.evmAddress.toString()}`;await new Promise(s=>{setTimeout(s,3e3)});const r=await fetch(e),i=(await r.json()).account;return this.num=s.fromString(i.slice(i.lastIndexOf(".")+1)),this}async populateAccountEvmAddress(s){if(null===this.num)throw new Error("field `num` should not be null");const t=`${s.mirrorRestApiBaseUrl}/accounts/${this.num.toString()}`;await new Promise(s=>{setTimeout(s,3e3)});const e=await fetch(t),r=(await e.json()).evm_address;return this.evmAddress=c.fromString(r),this}validate(s){console.warn("Deprecated: Use `validateChecksum` instead"),this.validateChecksum(s)}validateChecksum(s){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");i(this.shard,this.realm,this.num,this._checksum,s)}static fromBytes(s){return y._fromProtobuf(m.proto.AccountID.decode(s))}static fromSolidityAddress(s){return v(f(s))?new y(...n(s)):this.fromEvmAddress(0,0,s)}toSolidityAddress(){return null!=this.evmAddress?this.evmAddress.toString():null!=this.aliasKey&&"secp256k1"==this.aliasKey._key._type?this.aliasKey.toEvmAddress():l([this.shard,this.realm,this.num])}toEvmAddress(){return null!=this.evmAddress?a(this.evmAddress.toBytes()):a(this.num)}_toProtobuf(){let t=null;null!=this.aliasKey?t=m.proto.Key.encode(this.aliasKey._toProtobufKey()).finish():null!=this.evmAddress&&(t=this.evmAddress._bytes);const e=this.num.eq(s.fromBigInt(0n))&&t;return t?{alias:e?t:null,accountNum:e?null:this.num,shardNum:this.shard,realmNum:this.realm}:{alias:null,accountNum:this.num,shardNum:this.shard,realmNum:this.realm}}toBytes(){return m.proto.AccountID.encode(this._toProtobuf()).finish()}toString(){let s=this.num.toString();return null!=this.aliasKey?s=this.aliasKey.toString():null!=this.evmAddress&&(s=this.evmAddress.toString()),`${this.shard.toString()}.${this.realm.toString()}.${s}`}toStringWithChecksum(s){if(null!=this.aliasKey)throw new Error("cannot calculate checksum with an account ID that has a aliasKey");return o(this.toString(),s)}equals(s){let t=!1;return null!=this.aliasKey&&null!=s.aliasKey?t=this.aliasKey.equals(s.aliasKey):null!=this.evmAddress&&null!=s.evmAddress?t=this.evmAddress.equals(s.evmAddress):null==this.aliasKey&&null==s.aliasKey&&null==this.evmAddress&&null==s.evmAddress&&(t=this.num.eq(s.num)),this.shard.eq(s.shard)&&this.realm.eq(s.realm)&&t}clone(){const s=new y(this);return s._checksum=this._checksum,s.aliasKey=this.aliasKey,s.evmAddress=this.evmAddress,s}compare(s){let t=this.shard.compare(s.shard);if(0!=t)return t;if(t=this.realm.compare(s.realm),0!=t)return t;if(null!=this.aliasKey&&null!=s.aliasKey){const t=this.aliasKey.toString(),e=s.aliasKey.toString();return t>e?1:t<e?-1:0}if(null!=this.evmAddress&&null!=s.evmAddress){const t=this.evmAddress.toString(),e=s.evmAddress.toString();return t>e?1:t<e?-1:0}return null==this.aliasKey&&null==s.aliasKey&&null==this.evmAddress&&null==s.evmAddress?this.num.compare(s.num):1}}d.setAccountIdConstructor((t,e,r)=>new y(t,e,s.ZERO,r));export{y as default};
|
|
2
2
|
//# sourceMappingURL=AccountId.js.map
|
|
@@ -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 mirrorRestApiBaseUrl = client.mirrorRestApiBaseUrl;\n\n const url = `${mirrorRestApiBaseUrl}/accounts/${this.evmAddress.toString()}`;\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\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 mirrorRestApiBaseUrl = client.mirrorRestApiBaseUrl;\n\n const url = `${mirrorRestApiBaseUrl}/accounts/${this.num.toString()}`;\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\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","url","mirrorRestApiBaseUrl","Promise","resolve","setTimeout","response","fetch","mirrorAccountId","json","account","slice","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,E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MAAlBwF,EAAMxF,SAAkB,CACjD,MAAM4F,EAAIxF,KAAKJ,SAAS0B,WAClBmE,EAAIL,EAAMxF,SAAS0B,WAEzB,OAAIkE,EAAIC,EACG,EACAD,EAAIC,GACF,EAEF,CAEvB,CAAe,GAAuB,MAAnBzF,KAAKH,YAA0C,MAApBuF,EAAMvF,WAAoB,CAC5D,MAAM2F,EAAIxF,KAAKH,WAAWyB,WACpBmE,EAAIL,EAAMvF,WAAWyB,WAE3B,OAAIkE,EAAIC,EACG,EACAD,EAAIC,GACF,EAEF,CAEvB,CAAe,OACc,MAAjBzF,KAAKJ,UACa,MAAlBwF,EAAMxF,UACa,MAAnBI,KAAKH,YACe,MAApBuF,EAAMvF,WAECG,KAAKL,IAAI2F,QAAQF,EAAMzF,KAEvB,CAEnB,EAGA+F,EAAMC,wBACF,CAAC1F,EAAOP,EAAOkG,IAAQ,IAAIrG,EAAUU,EAAOP,EAAOW,EAAKC,KAAMsF"}
|
|
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 \"@hiero-ledger/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 mirrorRestApiBaseUrl = client.mirrorRestApiBaseUrl;\n\n const url = `${mirrorRestApiBaseUrl}/accounts/${this.evmAddress.toString()}`;\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\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 mirrorRestApiBaseUrl = client.mirrorRestApiBaseUrl;\n\n const url = `${mirrorRestApiBaseUrl}/accounts/${this.num.toString()}`;\n\n await new Promise((resolve) => {\n setTimeout(resolve, 3000);\n });\n\n /* eslint-disable */\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","url","mirrorRestApiBaseUrl","Promise","resolve","setTimeout","response","fetch","mirrorAccountId","json","account","slice","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":"ydAmBe,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,EAAO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RequireDefault(require("../Timestamp.cjs"));
|
|
12
12
|
var _long = _interopRequireDefault(require("long"));
|
|
13
13
|
var _TokenRelationshipMap = _interopRequireDefault(require("./TokenRelationshipMap.cjs"));
|
|
14
|
-
var HieroProto = _interopRequireWildcard(require("@
|
|
14
|
+
var HieroProto = _interopRequireWildcard(require("@hiero-ledger/proto"));
|
|
15
15
|
var _Duration = _interopRequireDefault(require("../Duration.cjs"));
|
|
16
16
|
var _Key = _interopRequireDefault(require("../Key.cjs"));
|
|
17
17
|
var _PublicKey = _interopRequireDefault(require("../PublicKey.cjs"));
|
|
@@ -231,4 +231,4 @@ import Long from "long";
|
|
|
231
231
|
import PublicKey from "../PublicKey.js";
|
|
232
232
|
import LedgerId from "../LedgerId.js";
|
|
233
233
|
import StakingInfo from "../StakingInfo.js";
|
|
234
|
-
import * as HieroProto from "@
|
|
234
|
+
import * as HieroProto from "@hiero-ledger/proto";
|
|
@@ -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"@
|
|
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"@hiero-ledger/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 R=e._fromProtobuf(m.accountID);return new d({accountId:R,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","CryptoGetInfoResponse","toString","JSON","stringify","toJSON"],"mappings":"yWAgDe,MAAMA,EA6BjB,WAAAC,CAAYC,GAMRC,KAAKC,UAAYF,EAAME,UAQvBD,KAAKE,kBAAoBH,EAAMG,kBAQ/BF,KAAKG,UAAYJ,EAAMI,UAavBH,KAAKI,eAAiBL,EAAMK,eAS5BJ,KAAKK,cAAgBN,EAAMM,cAQ3BL,KAAKM,IAAMP,EAAMO,IAOjBN,KAAKO,QAAUR,EAAMQ,QAQrBP,KAAKQ,oBAAsBT,EAAMS,oBAQjCR,KAAKS,uBAAyBV,EAAMU,uBAOpCT,KAAKU,4BAA8BX,EAAMW,4BAOzCV,KAAKW,eAAiBZ,EAAMY,eAS5BX,KAAKY,gBAAkBb,EAAMa,gBAG7BZ,KAAKa,WAAad,EAAMc,WAGxBb,KAAKc,mB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WhB,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 \"@hiero-ledger/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":"4WAgDe,MAAMA,EA6BjB,WAAAC,CAAYC,GAMRC,KAAKC,UAAYF,EAAME,UAQvBD,KAAKE,kBAAoBH,EAAMG,kBAQ/BF,KAAKG,UAAYJ,EAAMI,UAavBH,KAAKI,eAAiBL,EAAMK,eAS5BJ,KAAKK,cAAgBN,EAAMM,cAQ3BL,KAAKM,IAAMP,EAAMO,IAOjBN,KAAKO,QAAUR,EAAMQ,QAQrBP,KAAKQ,oBAAsBT,EAAMS,oBAQjCR,KAAKS,uBAAyBV,EAAMU,uBAOpCT,KAAKU,4BAA8BX,EAAMW,4BAOzCV,KAAKW,eAAiBZ,EAAMY,eAS5BX,KAAKY,gBAAkBb,EAAMa,gBAG7BZ,KAAKa,WAAad,EAAMc,WAGxBb,KAAKc,mBAAqBf,EAAMe,mBAGhCd,KAAKe,YAAchB,EAAMgB,YAGz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A8BqD,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"}
|
|
@@ -16,13 +16,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @namespace proto
|
|
19
|
-
* @typedef {import("@
|
|
20
|
-
* @typedef {import("@
|
|
21
|
-
* @typedef {import("@
|
|
22
|
-
* @typedef {import("@
|
|
23
|
-
* @typedef {import("@
|
|
24
|
-
* @typedef {import("@
|
|
25
|
-
* @typedef {import("@
|
|
19
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQuery} HieroProto.proto.IQuery
|
|
20
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQueryHeader} HieroProto.proto.IQueryHeader
|
|
21
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponse} HieroProto.proto.IResponse
|
|
22
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponseHeader} HieroProto.proto.IResponseHeader
|
|
23
|
+
* @typedef {import("@hiero-ledger/proto").proto.CryptoGetInfoResponse.IAccountInfo} HieroProto.proto.CryptoGetInfoResponse.IAccountInfo
|
|
24
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetInfoQuery} HieroProto.proto.ICryptoGetInfoQuery
|
|
25
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetInfoResponse} HieroProto.proto.ICryptoGetInfoResponse
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @namespace proto
|
|
3
|
-
* @typedef {import("@
|
|
4
|
-
* @typedef {import("@
|
|
5
|
-
* @typedef {import("@
|
|
6
|
-
* @typedef {import("@
|
|
7
|
-
* @typedef {import("@
|
|
8
|
-
* @typedef {import("@
|
|
9
|
-
* @typedef {import("@
|
|
3
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQuery} HieroProto.proto.IQuery
|
|
4
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQueryHeader} HieroProto.proto.IQueryHeader
|
|
5
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponse} HieroProto.proto.IResponse
|
|
6
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponseHeader} HieroProto.proto.IResponseHeader
|
|
7
|
+
* @typedef {import("@hiero-ledger/proto").proto.CryptoGetInfoResponse.IAccountInfo} HieroProto.proto.CryptoGetInfoResponse.IAccountInfo
|
|
8
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetInfoQuery} HieroProto.proto.ICryptoGetInfoQuery
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetInfoResponse} HieroProto.proto.ICryptoGetInfoResponse
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {import("../channel/Channel.js").default} Channel
|
|
@@ -49,15 +49,15 @@ export default class AccountInfoQuery extends Query<AccountInfo> {
|
|
|
49
49
|
}
|
|
50
50
|
export namespace HieroProto {
|
|
51
51
|
namespace proto {
|
|
52
|
-
type IQuery = import("@
|
|
53
|
-
type IQueryHeader = import("@
|
|
54
|
-
type IResponse = import("@
|
|
55
|
-
type IResponseHeader = import("@
|
|
52
|
+
type IQuery = import("@hiero-ledger/proto").proto.IQuery;
|
|
53
|
+
type IQueryHeader = import("@hiero-ledger/proto").proto.IQueryHeader;
|
|
54
|
+
type IResponse = import("@hiero-ledger/proto").proto.IResponse;
|
|
55
|
+
type IResponseHeader = import("@hiero-ledger/proto").proto.IResponseHeader;
|
|
56
56
|
namespace CryptoGetInfoResponse {
|
|
57
|
-
type IAccountInfo = import("@
|
|
57
|
+
type IAccountInfo = import("@hiero-ledger/proto").proto.CryptoGetInfoResponse.IAccountInfo;
|
|
58
58
|
}
|
|
59
|
-
type ICryptoGetInfoQuery = import("@
|
|
60
|
-
type ICryptoGetInfoResponse = import("@
|
|
59
|
+
type ICryptoGetInfoQuery = import("@hiero-ledger/proto").proto.ICryptoGetInfoQuery;
|
|
60
|
+
type ICryptoGetInfoResponse = import("@hiero-ledger/proto").proto.ICryptoGetInfoResponse;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
export type Channel = import("../channel/Channel.js").default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountInfoQuery.js","sources":["../../src/account/AccountInfoQuery.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Query, { QUERY_REGISTRY } from \"../query/Query.js\";\nimport AccountId from \"./AccountId.js\";\nimport AccountInfo from \"./AccountInfo.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport Hbar from \"../Hbar.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@
|
|
1
|
+
{"version":3,"file":"AccountInfoQuery.js","sources":["../../src/account/AccountInfoQuery.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Query, { QUERY_REGISTRY } from \"../query/Query.js\";\nimport AccountId from \"./AccountId.js\";\nimport AccountInfo from \"./AccountInfo.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport Hbar from \"../Hbar.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IQuery} HieroProto.proto.IQuery\n * @typedef {import(\"@hiero-ledger/proto\").proto.IQueryHeader} HieroProto.proto.IQueryHeader\n * @typedef {import(\"@hiero-ledger/proto\").proto.IResponse} HieroProto.proto.IResponse\n * @typedef {import(\"@hiero-ledger/proto\").proto.IResponseHeader} HieroProto.proto.IResponseHeader\n * @typedef {import(\"@hiero-ledger/proto\").proto.CryptoGetInfoResponse.IAccountInfo} HieroProto.proto.CryptoGetInfoResponse.IAccountInfo\n * @typedef {import(\"@hiero-ledger/proto\").proto.ICryptoGetInfoQuery} HieroProto.proto.ICryptoGetInfoQuery\n * @typedef {import(\"@hiero-ledger/proto\").proto.ICryptoGetInfoResponse} HieroProto.proto.ICryptoGetInfoResponse\n */\n\n/**\n * @typedef {import(\"../channel/Channel.js\").default} Channel\n * @typedef {import(\"../client/Client.js\").default<*, *>} Client\n */\n\n/**\n * Retrieves the metadata of an account\n * @augments {Query<AccountInfo>}\n */\nexport default class AccountInfoQuery extends Query {\n /**\n * @param {object} props\n * @param {AccountId | string} [props.accountId]\n */\n constructor(props = {}) {\n super();\n\n /**\n * @private\n * @type {?AccountId}\n */\n this._accountId = null;\n if (props.accountId != null) {\n this.setAccountId(props.accountId);\n }\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IQuery} query\n * @returns {AccountInfoQuery}\n */\n static _fromProtobuf(query) {\n const info = /** @type {HieroProto.proto.ICryptoGetInfoQuery} */ (\n query.cryptoGetInfo\n );\n\n return new AccountInfoQuery({\n accountId:\n info.accountID != null\n ? AccountId._fromProtobuf(info.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 info is being requested.\n *\n * @param {AccountId | string} accountId\n * @returns {AccountInfoQuery}\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.getAccountInfo(request);\n }\n\n /**\n * @override\n * @param {import(\"../client/Client.js\").default<Channel, *>} client\n * @returns {Promise<Hbar>}\n */\n async getCost(client) {\n return super.getCost(client);\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @returns {HieroProto.proto.IResponseHeader}\n */\n _mapResponseHeader(response) {\n const cryptoGetInfo =\n /** @type {HieroProto.proto.ICryptoGetInfoResponse} */ (\n response.cryptoGetInfo\n );\n return /** @type {HieroProto.proto.IResponseHeader} */ (\n cryptoGetInfo.header\n );\n }\n\n /**\n * @override\n * @internal\n * @param {HieroProto.proto.IResponse} response\n * @param {AccountId} nodeAccountId\n * @param {HieroProto.proto.IQuery} request\n * @returns {Promise<AccountInfo>}\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _mapResponse(response, nodeAccountId, request) {\n const info = /** @type {HieroProto.proto.ICryptoGetInfoResponse} */ (\n response.cryptoGetInfo\n );\n\n return Promise.resolve(\n AccountInfo._fromProtobuf(\n /** @type {HieroProto.proto.CryptoGetInfoResponse.IAccountInfo} */ (\n info.accountInfo\n ),\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 cryptoGetInfo: {\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 return `AccountInfoQuery:${timestamp.toString()}`;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nQUERY_REGISTRY.set(\"cryptoGetInfo\", AccountInfoQuery._fromProtobuf);\n"],"names":["AccountInfoQuery","Query","constructor","props","super","this","_accountId","accountId","setAccountId","_fromProtobuf","query","info","accountID","AccountId","undefined","fromString","clone","_validateChecksums","client","validateChecksum","_execute","channel","request","crypto","getAccountInfo","getCost","_mapResponseHeader","response","_mapResponse","nodeAccountId","Promise","resolve","AccountInfo","_onMakeRequest","header","cryptoGetInfo","_toProtobuf","_getLogId","_paymentTransactionId","validStart","_timestamp","toString","QUERY_REGISTRY","set"],"mappings":"6KA4Be,MAAMA,UAAyBC,EAK1C,WAAAC,CAAYC,EAAQ,IAChBC,QAMAC,KAAKC,WAAa,KACK,MAAnBH,EAAMI,WACNF,KAAKG,aAAaL,EAAMI,UAEpC,CAOI,oBAAOE,CAAcC,GACjB,MAAMC,EACFD,EACH,cAED,OAAO,IAAIV,EAAiB,CACxBO,UACsB,MAAlBI,EAAKC,UACCC,EAAUJ,cAAcE,EAAKC,gBAC7BE,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,eAAeF,EAC7C,CAOI,aAAMG,CAAQP,GACV,OAAOd,MAAMqB,QAAQP,EAC7B,CAQI,kBAAAQ,CAAmBC,GAKf,OAFQA,EACH,cAGb,MACA,CAWI,YAAAC,CAAaD,EAAUE,EAAeP,GAClC,MAAMX,EACFgB,EACH,cAED,OAAOG,QAAQC,QACXC,EAAYvB,cAEJE,EACpB,aAGA,CAQI,cAAAsB,CAAeC,GACX,MAAO,CACHC,cAAe,CACXD,SACAtB,UACuB,MAAnBP,KAAKC,WACCD,KAAKC,WAAW8B,cAChB,MAG1B,CAKI,SAAAC,GAMI,MAAO,qBAJ2B,MAA9BhC,KAAKiC,uBACoC,MAAzCjC,KAAKiC,sBAAsBC,WACrBlC,KAAKiC,sBAAsBC,WAC3BlC,KAAKmC,YACsBC,YAC7C,EAIAC,EAAeC,IAAI,gBAAiB3C,EAAiBS"}
|
|
@@ -13,13 +13,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @namespace proto
|
|
16
|
-
* @typedef {import("@
|
|
17
|
-
* @typedef {import("@
|
|
18
|
-
* @typedef {import("@
|
|
19
|
-
* @typedef {import("@
|
|
20
|
-
* @typedef {import("@
|
|
21
|
-
* @typedef {import("@
|
|
22
|
-
* @typedef {import("@
|
|
16
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQuery} HieroProto.proto.IQuery
|
|
17
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQueryHeader} HieroProto.proto.IQueryHeader
|
|
18
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponse} HieroProto.proto.IResponse
|
|
19
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponseHeader} HieroProto.proto.IResponseHeader
|
|
20
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetAccountRecordsQuery} HieroProto.proto.ICryptoGetAccountRecordsQuery
|
|
21
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetAccountRecordsResponse} HieroProto.proto.ICryptoGetAccountRecordsResponse
|
|
22
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionRecord} HieroProto.proto.ITransactionRecord
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @namespace proto
|
|
3
|
-
* @typedef {import("@
|
|
4
|
-
* @typedef {import("@
|
|
5
|
-
* @typedef {import("@
|
|
6
|
-
* @typedef {import("@
|
|
7
|
-
* @typedef {import("@
|
|
8
|
-
* @typedef {import("@
|
|
9
|
-
* @typedef {import("@
|
|
3
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQuery} HieroProto.proto.IQuery
|
|
4
|
+
* @typedef {import("@hiero-ledger/proto").proto.IQueryHeader} HieroProto.proto.IQueryHeader
|
|
5
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponse} HieroProto.proto.IResponse
|
|
6
|
+
* @typedef {import("@hiero-ledger/proto").proto.IResponseHeader} HieroProto.proto.IResponseHeader
|
|
7
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetAccountRecordsQuery} HieroProto.proto.ICryptoGetAccountRecordsQuery
|
|
8
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoGetAccountRecordsResponse} HieroProto.proto.ICryptoGetAccountRecordsResponse
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionRecord} HieroProto.proto.ITransactionRecord
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {import("../channel/Channel.js").default} Channel
|
|
@@ -51,13 +51,13 @@ export default class AccountRecordsQuery extends Query<TransactionRecord[]> {
|
|
|
51
51
|
}
|
|
52
52
|
export namespace HieroProto {
|
|
53
53
|
namespace proto {
|
|
54
|
-
type IQuery = import("@
|
|
55
|
-
type IQueryHeader = import("@
|
|
56
|
-
type IResponse = import("@
|
|
57
|
-
type IResponseHeader = import("@
|
|
58
|
-
type ICryptoGetAccountRecordsQuery = import("@
|
|
59
|
-
type ICryptoGetAccountRecordsResponse = import("@
|
|
60
|
-
type ITransactionRecord = import("@
|
|
54
|
+
type IQuery = import("@hiero-ledger/proto").proto.IQuery;
|
|
55
|
+
type IQueryHeader = import("@hiero-ledger/proto").proto.IQueryHeader;
|
|
56
|
+
type IResponse = import("@hiero-ledger/proto").proto.IResponse;
|
|
57
|
+
type IResponseHeader = import("@hiero-ledger/proto").proto.IResponseHeader;
|
|
58
|
+
type ICryptoGetAccountRecordsQuery = import("@hiero-ledger/proto").proto.ICryptoGetAccountRecordsQuery;
|
|
59
|
+
type ICryptoGetAccountRecordsResponse = import("@hiero-ledger/proto").proto.ICryptoGetAccountRecordsResponse;
|
|
60
|
+
type ITransactionRecord = import("@hiero-ledger/proto").proto.ITransactionRecord;
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
export type Channel = import("../channel/Channel.js").default;
|
|
@@ -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(\"@
|
|
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(\"@hiero-ledger/proto\").proto.IQuery} HieroProto.proto.IQuery\n * @typedef {import(\"@hiero-ledger/proto\").proto.IQueryHeader} HieroProto.proto.IQueryHeader\n * @typedef {import(\"@hiero-ledger/proto\").proto.IResponse} HieroProto.proto.IResponse\n * @typedef {import(\"@hiero-ledger/proto\").proto.IResponseHeader} HieroProto.proto.IResponseHeader\n * @typedef {import(\"@hiero-ledger/proto\").proto.ICryptoGetAccountRecordsQuery} HieroProto.proto.ICryptoGetAccountRecordsQuery\n * @typedef {import(\"@hiero-ledger/proto\").proto.ICryptoGetAccountRecordsResponse} HieroProto.proto.ICryptoGetAccountRecordsResponse\n * @typedef {import(\"@hiero-ledger/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"}
|
|
@@ -16,13 +16,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @namespace proto
|
|
19
|
-
* @typedef {import("@
|
|
20
|
-
* @typedef {import("@
|
|
21
|
-
* @typedef {import("@
|
|
22
|
-
* @typedef {import("@
|
|
23
|
-
* @typedef {import("@
|
|
24
|
-
* @typedef {import("@
|
|
25
|
-
* @typedef {import("@
|
|
19
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
20
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
21
|
+
* @typedef {import("@hiero-ledger/proto").proto.TransactionBody} HieroProto.proto.TransactionBody
|
|
22
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionBody} HieroProto.proto.ITransactionBody
|
|
23
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse
|
|
24
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoUpdateTransactionBody} HieroProto.proto.ICryptoUpdateTransactionBody
|
|
25
|
+
* @typedef {import("@hiero-ledger/proto").proto.IAccountID} HieroProto.proto.IAccountID
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @namespace proto
|
|
3
|
-
* @typedef {import("@
|
|
4
|
-
* @typedef {import("@
|
|
5
|
-
* @typedef {import("@
|
|
6
|
-
* @typedef {import("@
|
|
7
|
-
* @typedef {import("@
|
|
8
|
-
* @typedef {import("@
|
|
9
|
-
* @typedef {import("@
|
|
3
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransaction} HieroProto.proto.ITransaction
|
|
4
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
5
|
+
* @typedef {import("@hiero-ledger/proto").proto.TransactionBody} HieroProto.proto.TransactionBody
|
|
6
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionBody} HieroProto.proto.ITransactionBody
|
|
7
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse
|
|
8
|
+
* @typedef {import("@hiero-ledger/proto").proto.ICryptoUpdateTransactionBody} HieroProto.proto.ICryptoUpdateTransactionBody
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.IAccountID} HieroProto.proto.IAccountID
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {import("../channel/Channel.js").default} Channel
|
|
@@ -251,13 +251,13 @@ export default class AccountUpdateTransaction extends Transaction {
|
|
|
251
251
|
}
|
|
252
252
|
export namespace HieroProto {
|
|
253
253
|
namespace proto {
|
|
254
|
-
type ITransaction = import("@
|
|
255
|
-
type ISignedTransaction = import("@
|
|
256
|
-
type TransactionBody = import("@
|
|
257
|
-
type ITransactionBody = import("@
|
|
258
|
-
type ITransactionResponse = import("@
|
|
259
|
-
type ICryptoUpdateTransactionBody = import("@
|
|
260
|
-
type IAccountID = import("@
|
|
254
|
+
type ITransaction = import("@hiero-ledger/proto").proto.ITransaction;
|
|
255
|
+
type ISignedTransaction = import("@hiero-ledger/proto").proto.ISignedTransaction;
|
|
256
|
+
type TransactionBody = import("@hiero-ledger/proto").proto.TransactionBody;
|
|
257
|
+
type ITransactionBody = import("@hiero-ledger/proto").proto.ITransactionBody;
|
|
258
|
+
type ITransactionResponse = import("@hiero-ledger/proto").proto.ITransactionResponse;
|
|
259
|
+
type ICryptoUpdateTransactionBody = import("@hiero-ledger/proto").proto.ICryptoUpdateTransactionBody;
|
|
260
|
+
type IAccountID = import("@hiero-ledger/proto").proto.IAccountID;
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
export type Channel = import("../channel/Channel.js").default;
|