@hiero-ledger/sdk 2.76.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 +1017 -673
- package/dist/umd.min.js +14 -14
- 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/Executable.cjs +13 -3
- package/lib/Executable.js +1 -1
- package/lib/Executable.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 +26 -2
- package/lib/channel/Channel.d.ts +21 -1
- package/lib/channel/Channel.js +1 -1
- package/lib/channel/Channel.js.map +1 -1
- package/lib/channel/NativeChannel.cjs +96 -2
- package/lib/channel/NativeChannel.d.ts +21 -1
- package/lib/channel/NativeChannel.js +1 -1
- package/lib/channel/NativeChannel.js.map +1 -1
- package/lib/channel/NodeChannel.cjs +4 -5
- package/lib/channel/NodeChannel.d.ts +2 -3
- package/lib/channel/NodeChannel.js +1 -1
- package/lib/channel/NodeChannel.js.map +1 -1
- package/lib/channel/WebChannel.cjs +163 -13
- package/lib/channel/WebChannel.d.ts +51 -1
- package/lib/channel/WebChannel.js +1 -1
- package/lib/channel/WebChannel.js.map +1 -1
- package/lib/client/Client.cjs +62 -5
- package/lib/client/Client.d.ts +26 -3
- package/lib/client/Client.js +1 -1
- package/lib/client/Client.js.map +1 -1
- package/lib/client/NativeClient.cjs +1 -1
- package/lib/client/NativeClient.js +1 -1
- package/lib/client/NativeClient.js.map +1 -1
- package/lib/client/NodeClient.cjs +7 -6
- package/lib/client/NodeClient.d.ts +3 -3
- package/lib/client/NodeClient.js +1 -1
- package/lib/client/NodeClient.js.map +1 -1
- package/lib/client/WebClient.cjs +55 -27
- package/lib/client/WebClient.d.ts +6 -0
- package/lib/client/WebClient.js +1 -1
- package/lib/client/WebClient.js.map +1 -1
- package/lib/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/client/addressbooks/previewnet.cjs +1 -1
- package/lib/client/addressbooks/previewnet.d.ts +1 -1
- package/lib/client/addressbooks/previewnet.js +1 -1
- package/lib/client/addressbooks/previewnet.js.map +1 -1
- package/lib/client/addressbooks/testnet.cjs +1 -1
- package/lib/client/addressbooks/testnet.d.ts +1 -1
- package/lib/client/addressbooks/testnet.js +1 -1
- package/lib/client/addressbooks/testnet.js.map +1 -1
- package/lib/constants/ClientConstants.cjs +17 -1
- package/lib/constants/ClientConstants.d.ts +14 -0
- package/lib/constants/ClientConstants.js +1 -1
- package/lib/constants/ClientConstants.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 -5
- package/lib/network/AddressBookQuery.js +1 -1
- package/lib/network/AddressBookQuery.js.map +1 -1
- package/lib/network/AddressBookQueryWeb.cjs +1 -5
- package/lib/network/AddressBookQueryWeb.js +1 -1
- package/lib/network/AddressBookQueryWeb.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 +6 -8
- 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/Executable.js +18 -2
- 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 +26 -2
- package/src/channel/NativeChannel.js +111 -2
- package/src/channel/NodeChannel.js +4 -7
- package/src/channel/WebChannel.js +189 -21
- package/src/client/Client.js +79 -5
- package/src/client/NativeClient.js +1 -1
- package/src/client/NodeClient.js +7 -6
- package/src/client/WebClient.js +64 -31
- package/src/client/addressbooks/mainnet.js +1 -1
- package/src/client/addressbooks/previewnet.js +1 -1
- package/src/client/addressbooks/testnet.js +1 -1
- package/src/constants/ClientConstants.js +16 -0
- 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 -8
- package/src/network/AddressBookQueryWeb.js +1 -8
- 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/Cache.cjs
CHANGED
|
@@ -22,16 +22,16 @@ exports.default = void 0;
|
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* @namespace proto
|
|
25
|
-
* @typedef {import("@
|
|
26
|
-
* @typedef {import("@
|
|
27
|
-
* @typedef {import("@
|
|
28
|
-
* @typedef {import("@
|
|
25
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
26
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKeyList} HieroProto.proto.IKeyList
|
|
27
|
+
* @typedef {import("@hiero-ledger/proto").proto.IThresholdKey} HieroProto.proto.IThresholdKey
|
|
28
|
+
* @typedef {import("@hiero-ledger/proto").proto.IContractID} HieroProto.proto.IContractID
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @namespace cryptography
|
|
33
|
-
* @typedef {import("@
|
|
34
|
-
* @typedef {import("@
|
|
33
|
+
* @typedef {import("@hiero-ledger/cryptography").PrivateKey} cryptography.PrivateKey
|
|
34
|
+
* @typedef {import("@hiero-ledger/cryptography").Mnemonic} cryptography.Mnemonic
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
/**
|
package/lib/Cache.d.ts
CHANGED
|
@@ -12,15 +12,15 @@ export type TransactionRecordQuery = import("./transaction/TransactionRecordQuer
|
|
|
12
12
|
export type AddressBookQuery = import("./network/AddressBookQuery.js").default;
|
|
13
13
|
export namespace HieroProto {
|
|
14
14
|
namespace proto {
|
|
15
|
-
type IKey = import("@
|
|
16
|
-
type IKeyList = import("@
|
|
17
|
-
type IThresholdKey = import("@
|
|
18
|
-
type IContractID = import("@
|
|
15
|
+
type IKey = import("@hiero-ledger/proto").proto.IKey;
|
|
16
|
+
type IKeyList = import("@hiero-ledger/proto").proto.IKeyList;
|
|
17
|
+
type IThresholdKey = import("@hiero-ledger/proto").proto.IThresholdKey;
|
|
18
|
+
type IContractID = import("@hiero-ledger/proto").proto.IContractID;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
export namespace cryptography {
|
|
22
|
-
type PrivateKey = import("@
|
|
23
|
-
type Mnemonic = import("@
|
|
22
|
+
type PrivateKey = import("@hiero-ledger/cryptography").PrivateKey;
|
|
23
|
+
type Mnemonic = import("@hiero-ledger/cryptography").Mnemonic;
|
|
24
24
|
}
|
|
25
25
|
export type FromProtobufKeyFuncT<ProtobufT extends object, SdkT extends object> = {
|
|
26
26
|
(proto: ProtobufT): SdkT;
|
|
@@ -44,15 +44,15 @@ declare const CACHE: Cache;
|
|
|
44
44
|
*/
|
|
45
45
|
/**
|
|
46
46
|
* @namespace proto
|
|
47
|
-
* @typedef {import("@
|
|
48
|
-
* @typedef {import("@
|
|
49
|
-
* @typedef {import("@
|
|
50
|
-
* @typedef {import("@
|
|
47
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKey} HieroProto.proto.IKey
|
|
48
|
+
* @typedef {import("@hiero-ledger/proto").proto.IKeyList} HieroProto.proto.IKeyList
|
|
49
|
+
* @typedef {import("@hiero-ledger/proto").proto.IThresholdKey} HieroProto.proto.IThresholdKey
|
|
50
|
+
* @typedef {import("@hiero-ledger/proto").proto.IContractID} HieroProto.proto.IContractID
|
|
51
51
|
*/
|
|
52
52
|
/**
|
|
53
53
|
* @namespace cryptography
|
|
54
|
-
* @typedef {import("@
|
|
55
|
-
* @typedef {import("@
|
|
54
|
+
* @typedef {import("@hiero-ledger/cryptography").PrivateKey} cryptography.PrivateKey
|
|
55
|
+
* @typedef {import("@hiero-ledger/cryptography").Mnemonic} cryptography.Mnemonic
|
|
56
56
|
*/
|
|
57
57
|
/**
|
|
58
58
|
* @template {object} ProtobufT
|
package/lib/Cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cache.js","sources":["../src/Cache.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * @typedef {import(\"./contract/ContractId.js\").default} ContractId\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./KeyList.js\").default} KeyList\n * @typedef {import(\"./PublicKey.js\").default} PublicKey\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n * @typedef {import(\"./Mnemonic.js\").default} Mnemonic\n * @typedef {import(\"./EvmAddress.js\").default} EvmAddress\n * @typedef {import(\"./EthereumTransactionData.js\").default} EthereumTransactionData\n * @typedef {import(\"./transaction/TransactionReceiptQuery.js\").default} TransactionReceiptQuery\n * @typedef {import(\"./transaction/TransactionRecordQuery.js\").default} TransactionRecordQuery\n * @typedef {import(\"./network/AddressBookQuery.js\").default} AddressBookQuery\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.IKey} HieroProto.proto.IKey\n * @typedef {import(\"@hashgraph/proto\").proto.IKeyList} HieroProto.proto.IKeyList\n * @typedef {import(\"@hashgraph/proto\").proto.IThresholdKey} HieroProto.proto.IThresholdKey\n * @typedef {import(\"@hashgraph/proto\").proto.IContractID} HieroProto.proto.IContractID\n */\n\n/**\n * @namespace cryptography\n * @typedef {import(\"@hashgraph/cryptography\").PrivateKey} cryptography.PrivateKey\n * @typedef {import(\"@hashgraph/cryptography\").Mnemonic} cryptography.Mnemonic\n */\n\n/**\n * @template {object} ProtobufT\n * @template {object} SdkT\n * @typedef {{ (proto: ProtobufT): SdkT }} FromProtobufKeyFuncT\n */\n\n/**\n * Cache class is designed to prevent cyclic dependencies in the Hiero JavaScript SDK.\n * It stores various conversion functions and configuration values that are used across\n * different parts of the SDK.\n */\nclass Cache {\n constructor() {\n /** @type {number} */\n this._timeDrift = 0;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId> | null} */\n this._contractId = null;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IKeyList, KeyList> | null} */\n this._keyList = null;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IThresholdKey, KeyList> | null} */\n this._thresholdKey = null;\n\n /** @type {FromProtobufKeyFuncT<Uint8Array, PublicKey> | null} */\n this._publicKeyED25519 = null;\n\n /** @type {FromProtobufKeyFuncT<Uint8Array, PublicKey> | null} */\n this._publicKeyECDSA = null;\n\n /** @type {((key: cryptography.PrivateKey) => PrivateKey) | null} */\n this._privateKeyConstructor = null;\n\n /** @type {((key: cryptography.Mnemonic) => Mnemonic) | null} */\n this._mnemonicFromString = null;\n\n /** @type {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId) | null} */\n this._accountIdConstructor = null;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId> | null} */\n this._delegateContractId = null;\n\n /** @type {FromProtobufKeyFuncT<Uint8Array, EvmAddress> | null} */\n this._evmAddress = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataLegacyFromBytes = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataEip1559FromBytes = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataEip2930FromBytes = null;\n\n /** @type {(() => TransactionReceiptQuery) | null} */\n this._transactionReceiptQueryConstructor = null;\n\n /** @type {(() => TransactionRecordQuery) | null} */\n this._transactionRecordQueryConstructor = null;\n }\n\n /**\n * @param {number} timeDrift\n */\n setTimeDrift(timeDrift) {\n this._timeDrift = timeDrift;\n }\n\n /**\n * @returns {number}\n */\n get timeDrift() {\n if (this._timeDrift == null) {\n throw new Error(\"Cache.timeDrift was used before it was set\");\n }\n\n return this._timeDrift;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>} contractId\n */\n setContractId(contractId) {\n this._contractId = contractId;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>}\n */\n get contractId() {\n if (this._contractId == null) {\n throw new Error(\"Cache.contractId was used before it was set\");\n }\n\n return this._contractId;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IKeyList, KeyList>} keyList\n */\n setKeyList(keyList) {\n this._keyList = keyList;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IKeyList, KeyList>}\n */\n get keyList() {\n if (this._keyList == null) {\n throw new Error(\"Cache.keyList was used before it was set\");\n }\n\n return this._keyList;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IThresholdKey, KeyList>} thresholdKey\n */\n setThresholdKey(thresholdKey) {\n this._thresholdKey = thresholdKey;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IThresholdKey, KeyList>}\n */\n get thresholdKey() {\n if (this._thresholdKey == null) {\n throw new Error(\"Cache.thresholdKey was used before it was set\");\n }\n\n return this._thresholdKey;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<Uint8Array, PublicKey>} publicKeyED25519\n */\n setPublicKeyED25519(publicKeyED25519) {\n this._publicKeyED25519 = publicKeyED25519;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<Uint8Array, PublicKey>}\n */\n get publicKeyED25519() {\n if (this._publicKeyED25519 == null) {\n throw new Error(\n \"Cache.publicKeyED25519 was used before it was set\",\n );\n }\n\n return this._publicKeyED25519;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<Uint8Array, PublicKey>} publicKeyECDSA\n */\n setPublicKeyECDSA(publicKeyECDSA) {\n this._publicKeyECDSA = publicKeyECDSA;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<Uint8Array, PublicKey>}\n */\n get publicKeyECDSA() {\n if (this._publicKeyECDSA == null) {\n throw new Error(\"Cache.publicKeyECDSA was used before it was set\");\n }\n\n return this._publicKeyECDSA;\n }\n\n /**\n * @param {((key: cryptography.PrivateKey) => PrivateKey)} privateKeyConstructor\n */\n setPrivateKeyConstructor(privateKeyConstructor) {\n this._privateKeyConstructor = privateKeyConstructor;\n }\n\n /**\n * @returns {((key: cryptography.PrivateKey) => PrivateKey)}\n */\n get privateKeyConstructor() {\n if (this._privateKeyConstructor == null) {\n throw new Error(\n \"Cache.privateKeyConstructor was used before it was set\",\n );\n }\n\n return this._privateKeyConstructor;\n }\n\n /**\n * @param {((key: cryptography.Mnemonic) => Mnemonic)} mnemonicFromString\n */\n setMnemonicFromString(mnemonicFromString) {\n this._mnemonicFromString = mnemonicFromString;\n }\n\n /**\n * @returns {((key: cryptography.PrivateKey) => PrivateKey)}\n */\n get mnemonicFromString() {\n if (this._mnemonicFromString == null) {\n throw new Error(\n \"Cache.mnemonicFromString was used before it was set\",\n );\n }\n\n return this.mnemonicFromString;\n }\n\n /**\n * @param {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)} accountIdConstructor\n */\n setAccountIdConstructor(accountIdConstructor) {\n this._accountIdConstructor = accountIdConstructor;\n }\n\n /**\n * @returns {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)}\n */\n get accountIdConstructor() {\n if (this._accountIdConstructor == null) {\n throw new Error(\n \"Cache.accountIdConstructor was used before it was set\",\n );\n }\n\n return this._accountIdConstructor;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>} delegateContractId\n */\n setDelegateContractId(delegateContractId) {\n this._delegateContractId = delegateContractId;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>}\n */\n get delegateContractId() {\n if (this._delegateContractId == null) {\n throw new Error(\n \"Cache.delegateContractId was used before it was set\",\n );\n }\n\n return this._delegateContractId;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<Uint8Array, EvmAddress>} evmAddress\n */\n setEvmAddress(evmAddress) {\n this._evmAddress = evmAddress;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<Uint8Array, EvmAddress>}\n */\n get evmAddress() {\n if (this._evmAddress == null) {\n throw new Error(\"Cache.evmAddress was used before it was set\");\n }\n\n return this._evmAddress;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataLegacyFromBytes\n */\n setEthereumTransactionDataLegacyFromBytes(\n ethereumTransactionDataLegacyFromBytes,\n ) {\n this._ethereumTransactionDataLegacyFromBytes =\n ethereumTransactionDataLegacyFromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataLegacyFromBytes() {\n if (this._ethereumTransactionDataLegacyFromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataLegacyFromBytes was used before it was set\",\n );\n }\n\n return this._ethereumTransactionDataLegacyFromBytes;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip1559FromBytes\n */\n setEthereumTransactionDataEip1559FromBytes(\n ethereumTransactionDataEip1559FromBytes,\n ) {\n this._ethereumTransactionDataEip1559FromBytes =\n ethereumTransactionDataEip1559FromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataEip1559FromBytes() {\n if (this._ethereumTransactionDataEip1559FromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataEip1559FromBytes was used before it was set\",\n );\n }\n\n return this._ethereumTransactionDataEip1559FromBytes;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip2930FromBytes\n */\n setEthereumTransactionDataEip2930FromBytes(\n ethereumTransactionDataEip2930FromBytes,\n ) {\n this._ethereumTransactionDataEip2930FromBytes =\n ethereumTransactionDataEip2930FromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataEip2930FromBytes() {\n if (this._ethereumTransactionDataEip2930FromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataEip2930FromBytes was used before it was set\",\n );\n }\n\n return this._ethereumTransactionDataEip2930FromBytes;\n }\n\n /**\n * @param {(() => TransactionReceiptQuery)} transactionReceiptQueryConstructor\n */\n setTransactionReceiptQueryConstructor(transactionReceiptQueryConstructor) {\n this._transactionReceiptQueryConstructor =\n transactionReceiptQueryConstructor;\n }\n\n /**\n * @returns {(() => TransactionReceiptQuery)}\n */\n get transactionReceiptQueryConstructor() {\n if (this._transactionReceiptQueryConstructor == null) {\n throw new Error(\n \"Cache.transactionReceiptQueryConstructor was used before it was set\",\n );\n }\n\n return this._transactionReceiptQueryConstructor;\n }\n\n /**\n * @param {(() => TransactionRecordQuery)} transactionRecordQueryConstructor\n */\n setTransactionRecordQueryConstructor(transactionRecordQueryConstructor) {\n this._transactionRecordQueryConstructor =\n transactionRecordQueryConstructor;\n }\n\n /**\n * @returns {(() => TransactionRecordQuery)}\n */\n get transactionRecordQueryConstructor() {\n if (this._transactionRecordQueryConstructor == null) {\n throw new Error(\n \"Cache.transactionRecordQueryConstructor was used before it was set\",\n );\n }\n\n return this._transactionRecordQueryConstructor;\n }\n}\n\n/**\n * This variable is strictly designed to prevent cyclic dependencies.\n */\nconst CACHE = new Cache();\n\nexport default CACHE;\n"],"names":["CACHE","constructor","this","_timeDrift","_contractId","_keyList","_thresholdKey","_publicKeyED25519","_publicKeyECDSA","_privateKeyConstructor","_mnemonicFromString","_accountIdConstructor","_delegateContractId","_evmAddress","_ethereumTransactionDataLegacyFromBytes","_ethereumTransactionDataEip1559FromBytes","_ethereumTransactionDataEip2930FromBytes","_transactionReceiptQueryConstructor","_transactionRecordQueryConstructor","setTimeDrift","timeDrift","Error","setContractId","contractId","setKeyList","keyList","setThresholdKey","thresholdKey","setPublicKeyED25519","publicKeyED25519","setPublicKeyECDSA","publicKeyECDSA","setPrivateKeyConstructor","privateKeyConstructor","setMnemonicFromString","mnemonicFromString","setAccountIdConstructor","accountIdConstructor","setDelegateContractId","delegateContractId","setEvmAddress","evmAddress","setEthereumTransactionDataLegacyFromBytes","ethereumTransactionDataLegacyFromBytes","setEthereumTransactionDataEip1559FromBytes","ethereumTransactionDataEip1559FromBytes","setEthereumTransactionDataEip2930FromBytes","ethereumTransactionDataEip2930FromBytes","setTransactionReceiptQueryConstructor","transactionReceiptQueryConstructor","setTransactionRecordQueryConstructor","transactionRecordQueryConstructor"],"mappings":"AA+ZK,MAACA,EAAQ,IAtXd,MACI,WAAAC,GAEIC,KAAKC,WAAa,EAGlBD,KAAKE,YAAc,KAGnBF,KAAKG,SAAW,KAGhBH,KAAKI,cAAgB,KAGrBJ,KAAKK,kBAAoB,KAGzBL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MAA5C/C,KAAKe,oCACL,MAAM,IAAII,MACN,uEAIR,OAAOnB,KAAKe,mCACpB,CAKI,oCAAAiC,CAAqCC,GACjCjD,KAAKgB,mCACDiC,CACZ,CAKI,qCAAIA,GACA,GAA+C,MAA3CjD,KAAKgB,mCACL,MAAM,IAAIG,MACN,sEAIR,OAAOnB,KAAKgB,kCACpB"}
|
|
1
|
+
{"version":3,"file":"Cache.js","sources":["../src/Cache.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\n/**\n * @typedef {import(\"./contract/ContractId.js\").default} ContractId\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./KeyList.js\").default} KeyList\n * @typedef {import(\"./PublicKey.js\").default} PublicKey\n * @typedef {import(\"./PrivateKey.js\").default} PrivateKey\n * @typedef {import(\"./Mnemonic.js\").default} Mnemonic\n * @typedef {import(\"./EvmAddress.js\").default} EvmAddress\n * @typedef {import(\"./EthereumTransactionData.js\").default} EthereumTransactionData\n * @typedef {import(\"./transaction/TransactionReceiptQuery.js\").default} TransactionReceiptQuery\n * @typedef {import(\"./transaction/TransactionRecordQuery.js\").default} TransactionRecordQuery\n * @typedef {import(\"./network/AddressBookQuery.js\").default} AddressBookQuery\n */\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IKey} HieroProto.proto.IKey\n * @typedef {import(\"@hiero-ledger/proto\").proto.IKeyList} HieroProto.proto.IKeyList\n * @typedef {import(\"@hiero-ledger/proto\").proto.IThresholdKey} HieroProto.proto.IThresholdKey\n * @typedef {import(\"@hiero-ledger/proto\").proto.IContractID} HieroProto.proto.IContractID\n */\n\n/**\n * @namespace cryptography\n * @typedef {import(\"@hiero-ledger/cryptography\").PrivateKey} cryptography.PrivateKey\n * @typedef {import(\"@hiero-ledger/cryptography\").Mnemonic} cryptography.Mnemonic\n */\n\n/**\n * @template {object} ProtobufT\n * @template {object} SdkT\n * @typedef {{ (proto: ProtobufT): SdkT }} FromProtobufKeyFuncT\n */\n\n/**\n * Cache class is designed to prevent cyclic dependencies in the Hiero JavaScript SDK.\n * It stores various conversion functions and configuration values that are used across\n * different parts of the SDK.\n */\nclass Cache {\n constructor() {\n /** @type {number} */\n this._timeDrift = 0;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId> | null} */\n this._contractId = null;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IKeyList, KeyList> | null} */\n this._keyList = null;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IThresholdKey, KeyList> | null} */\n this._thresholdKey = null;\n\n /** @type {FromProtobufKeyFuncT<Uint8Array, PublicKey> | null} */\n this._publicKeyED25519 = null;\n\n /** @type {FromProtobufKeyFuncT<Uint8Array, PublicKey> | null} */\n this._publicKeyECDSA = null;\n\n /** @type {((key: cryptography.PrivateKey) => PrivateKey) | null} */\n this._privateKeyConstructor = null;\n\n /** @type {((key: cryptography.Mnemonic) => Mnemonic) | null} */\n this._mnemonicFromString = null;\n\n /** @type {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId) | null} */\n this._accountIdConstructor = null;\n\n /** @type {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId> | null} */\n this._delegateContractId = null;\n\n /** @type {FromProtobufKeyFuncT<Uint8Array, EvmAddress> | null} */\n this._evmAddress = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataLegacyFromBytes = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataEip1559FromBytes = null;\n\n /** @type {((bytes: Uint8Array) => EthereumTransactionData) | null} */\n this._ethereumTransactionDataEip2930FromBytes = null;\n\n /** @type {(() => TransactionReceiptQuery) | null} */\n this._transactionReceiptQueryConstructor = null;\n\n /** @type {(() => TransactionRecordQuery) | null} */\n this._transactionRecordQueryConstructor = null;\n }\n\n /**\n * @param {number} timeDrift\n */\n setTimeDrift(timeDrift) {\n this._timeDrift = timeDrift;\n }\n\n /**\n * @returns {number}\n */\n get timeDrift() {\n if (this._timeDrift == null) {\n throw new Error(\"Cache.timeDrift was used before it was set\");\n }\n\n return this._timeDrift;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>} contractId\n */\n setContractId(contractId) {\n this._contractId = contractId;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>}\n */\n get contractId() {\n if (this._contractId == null) {\n throw new Error(\"Cache.contractId was used before it was set\");\n }\n\n return this._contractId;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IKeyList, KeyList>} keyList\n */\n setKeyList(keyList) {\n this._keyList = keyList;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IKeyList, KeyList>}\n */\n get keyList() {\n if (this._keyList == null) {\n throw new Error(\"Cache.keyList was used before it was set\");\n }\n\n return this._keyList;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IThresholdKey, KeyList>} thresholdKey\n */\n setThresholdKey(thresholdKey) {\n this._thresholdKey = thresholdKey;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IThresholdKey, KeyList>}\n */\n get thresholdKey() {\n if (this._thresholdKey == null) {\n throw new Error(\"Cache.thresholdKey was used before it was set\");\n }\n\n return this._thresholdKey;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<Uint8Array, PublicKey>} publicKeyED25519\n */\n setPublicKeyED25519(publicKeyED25519) {\n this._publicKeyED25519 = publicKeyED25519;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<Uint8Array, PublicKey>}\n */\n get publicKeyED25519() {\n if (this._publicKeyED25519 == null) {\n throw new Error(\n \"Cache.publicKeyED25519 was used before it was set\",\n );\n }\n\n return this._publicKeyED25519;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<Uint8Array, PublicKey>} publicKeyECDSA\n */\n setPublicKeyECDSA(publicKeyECDSA) {\n this._publicKeyECDSA = publicKeyECDSA;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<Uint8Array, PublicKey>}\n */\n get publicKeyECDSA() {\n if (this._publicKeyECDSA == null) {\n throw new Error(\"Cache.publicKeyECDSA was used before it was set\");\n }\n\n return this._publicKeyECDSA;\n }\n\n /**\n * @param {((key: cryptography.PrivateKey) => PrivateKey)} privateKeyConstructor\n */\n setPrivateKeyConstructor(privateKeyConstructor) {\n this._privateKeyConstructor = privateKeyConstructor;\n }\n\n /**\n * @returns {((key: cryptography.PrivateKey) => PrivateKey)}\n */\n get privateKeyConstructor() {\n if (this._privateKeyConstructor == null) {\n throw new Error(\n \"Cache.privateKeyConstructor was used before it was set\",\n );\n }\n\n return this._privateKeyConstructor;\n }\n\n /**\n * @param {((key: cryptography.Mnemonic) => Mnemonic)} mnemonicFromString\n */\n setMnemonicFromString(mnemonicFromString) {\n this._mnemonicFromString = mnemonicFromString;\n }\n\n /**\n * @returns {((key: cryptography.PrivateKey) => PrivateKey)}\n */\n get mnemonicFromString() {\n if (this._mnemonicFromString == null) {\n throw new Error(\n \"Cache.mnemonicFromString was used before it was set\",\n );\n }\n\n return this.mnemonicFromString;\n }\n\n /**\n * @param {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)} accountIdConstructor\n */\n setAccountIdConstructor(accountIdConstructor) {\n this._accountIdConstructor = accountIdConstructor;\n }\n\n /**\n * @returns {((shard: Long | number, realm: Long | number, key: PublicKey) => AccountId)}\n */\n get accountIdConstructor() {\n if (this._accountIdConstructor == null) {\n throw new Error(\n \"Cache.accountIdConstructor was used before it was set\",\n );\n }\n\n return this._accountIdConstructor;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>} delegateContractId\n */\n setDelegateContractId(delegateContractId) {\n this._delegateContractId = delegateContractId;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<HieroProto.proto.IContractID, ContractId>}\n */\n get delegateContractId() {\n if (this._delegateContractId == null) {\n throw new Error(\n \"Cache.delegateContractId was used before it was set\",\n );\n }\n\n return this._delegateContractId;\n }\n\n /**\n * @param {FromProtobufKeyFuncT<Uint8Array, EvmAddress>} evmAddress\n */\n setEvmAddress(evmAddress) {\n this._evmAddress = evmAddress;\n }\n\n /**\n * @returns {FromProtobufKeyFuncT<Uint8Array, EvmAddress>}\n */\n get evmAddress() {\n if (this._evmAddress == null) {\n throw new Error(\"Cache.evmAddress was used before it was set\");\n }\n\n return this._evmAddress;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataLegacyFromBytes\n */\n setEthereumTransactionDataLegacyFromBytes(\n ethereumTransactionDataLegacyFromBytes,\n ) {\n this._ethereumTransactionDataLegacyFromBytes =\n ethereumTransactionDataLegacyFromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataLegacyFromBytes() {\n if (this._ethereumTransactionDataLegacyFromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataLegacyFromBytes was used before it was set\",\n );\n }\n\n return this._ethereumTransactionDataLegacyFromBytes;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip1559FromBytes\n */\n setEthereumTransactionDataEip1559FromBytes(\n ethereumTransactionDataEip1559FromBytes,\n ) {\n this._ethereumTransactionDataEip1559FromBytes =\n ethereumTransactionDataEip1559FromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataEip1559FromBytes() {\n if (this._ethereumTransactionDataEip1559FromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataEip1559FromBytes was used before it was set\",\n );\n }\n\n return this._ethereumTransactionDataEip1559FromBytes;\n }\n\n /**\n * @param {((bytes: Uint8Array) => EthereumTransactionData)} ethereumTransactionDataEip2930FromBytes\n */\n setEthereumTransactionDataEip2930FromBytes(\n ethereumTransactionDataEip2930FromBytes,\n ) {\n this._ethereumTransactionDataEip2930FromBytes =\n ethereumTransactionDataEip2930FromBytes;\n }\n\n /**\n * @returns {((bytes: Uint8Array) => EthereumTransactionData)}\n */\n get ethereumTransactionDataEip2930FromBytes() {\n if (this._ethereumTransactionDataEip2930FromBytes == null) {\n throw new Error(\n \"Cache.ethereumTransactionDataEip2930FromBytes was used before it was set\",\n );\n }\n\n return this._ethereumTransactionDataEip2930FromBytes;\n }\n\n /**\n * @param {(() => TransactionReceiptQuery)} transactionReceiptQueryConstructor\n */\n setTransactionReceiptQueryConstructor(transactionReceiptQueryConstructor) {\n this._transactionReceiptQueryConstructor =\n transactionReceiptQueryConstructor;\n }\n\n /**\n * @returns {(() => TransactionReceiptQuery)}\n */\n get transactionReceiptQueryConstructor() {\n if (this._transactionReceiptQueryConstructor == null) {\n throw new Error(\n \"Cache.transactionReceiptQueryConstructor was used before it was set\",\n );\n }\n\n return this._transactionReceiptQueryConstructor;\n }\n\n /**\n * @param {(() => TransactionRecordQuery)} transactionRecordQueryConstructor\n */\n setTransactionRecordQueryConstructor(transactionRecordQueryConstructor) {\n this._transactionRecordQueryConstructor =\n transactionRecordQueryConstructor;\n }\n\n /**\n * @returns {(() => TransactionRecordQuery)}\n */\n get transactionRecordQueryConstructor() {\n if (this._transactionRecordQueryConstructor == null) {\n throw new Error(\n \"Cache.transactionRecordQueryConstructor was used before it was set\",\n );\n }\n\n return this._transactionRecordQueryConstructor;\n }\n}\n\n/**\n * This variable is strictly designed to prevent cyclic dependencies.\n */\nconst CACHE = new Cache();\n\nexport default CACHE;\n"],"names":["CACHE","constructor","this","_timeDrift","_contractId","_keyList","_thresholdKey","_publicKeyED25519","_publicKeyECDSA","_privateKeyConstructor","_mnemonicFromString","_accountIdConstructor","_delegateContractId","_evmAddress","_ethereumTransactionDataLegacyFromBytes","_ethereumTransactionDataEip1559FromBytes","_ethereumTransactionDataEip2930FromBytes","_transactionReceiptQueryConstructor","_transactionRecordQueryConstructor","setTimeDrift","timeDrift","Error","setContractId","contractId","setKeyList","keyList","setThresholdKey","thresholdKey","setPublicKeyED25519","publicKeyED25519","setPublicKeyECDSA","publicKeyECDSA","setPrivateKeyConstructor","privateKeyConstructor","setMnemonicFromString","mnemonicFromString","setAccountIdConstructor","accountIdConstructor","setDelegateContractId","delegateContractId","setEvmAddress","evmAddress","setEthereumTransactionDataLegacyFromBytes","ethereumTransactionDataLegacyFromBytes","setEthereumTransactionDataEip1559FromBytes","ethereumTransactionDataEip1559FromBytes","setEthereumTransactionDataEip2930FromBytes","ethereumTransactionDataEip2930FromBytes","setTransactionReceiptQueryConstructor","transactionReceiptQueryConstructor","setTransactionRecordQueryConstructor","transactionRecordQueryConstructor"],"mappings":"AA+ZK,MAACA,EAAQ,IAtXd,MACI,WAAAC,GAEIC,KAAKC,WAAa,EAGlBD,KAAKE,YAAc,KAGnBF,KAAKG,SAAW,KAGhBH,KAAKI,cAAgB,KAGrBJ,KAAKK,kBAAoB,KAGzBL,KAAKM,gBAAkB,KAGvBN,KAAKO,uBAAyB,KAG9BP,KAAKQ,oBAAsB,KAG3BR,KAAKS,sBAAwB,KAG7BT,KAAKU,oBAAsB,KAG3BV,KAAKW,YAAc,KAGnBX,KAAKY,wCAA0C,KAG/CZ,KAAKa,yCAA2C,KAGhDb,KAAKc,yCAA2C,KAGhDd,KAAKe,oCAAsC,KAG3Cf,KAAKgB,mCAAqC,IAClD,CAKI,YAAAC,CAAaC,GACTlB,KAAKC,WAAaiB,CAC1B,CAKI,aAAIA,GACA,GAAuB,MAAnBlB,KAAKC,WACL,MAAM,IAAIkB,MAAM,8CAGpB,OAAOnB,KAAKC,UACpB,CAKI,aAAAmB,CAAcC,GACVrB,KAAKE,YAAcmB,CAC3B,CAKI,cAAIA,GACA,GAAwB,MAApBrB,KAAKE,YACL,MAAM,IAAIiB,MAAM,+CAGpB,OAAOnB,KAAKE,WACpB,CAKI,UAAAoB,CAAWC,GACPvB,KAAKG,SAAWoB,CACxB,CAKI,WAAIA,GACA,GAAqB,MAAjBvB,KAAKG,SACL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,IAAIQ,MAAM,+CAGpB,OAAOnB,KAAKW,WACpB,CAKI,yCAAA6B,CACIC,GAEAzC,KAAKY,wCACD6B,CACZ,CAKI,0CAAIA,GACA,GAAoD,MAAhDzC,KAAKY,wCACL,MAAM,IAAIO,MACN,2EAIR,OAAOnB,KAAKY,uCACpB,CAKI,0CAAA8B,CACIC,GAEA3C,KAAKa,yCACD8B,CACZ,CAKI,2CAAIA,GACA,GAAqD,MAAjD3C,KAAKa,yCACL,MAAM,IAAIM,MACN,4EAIR,OAAOnB,KAAKa,wCACpB,CAKI,0CAAA+B,CACIC,GAEA7C,KAAKc,yCACD+B,CACZ,CAKI,2CAAIA,GACA,GAAqD,MAAjD7C,KAAKc,yCACL,MAAM,IAAIK,MACN,4EAIR,OAAOnB,KAAKc,wCACpB,CAKI,qCAAAgC,CAAsCC,GAClC/C,KAAKe,oCACDgC,CACZ,CAKI,sCAAIA,GACA,GAAgD,MAA5C/C,KAAKe,oCACL,MAAM,IAAII,MACN,uEAIR,OAAOnB,KAAKe,mCACpB,CAKI,oCAAAiC,CAAqCC,GACjCjD,KAAKgB,mCACDiC,CACZ,CAKI,qCAAIA,GACA,GAA+C,MAA3CjD,KAAKgB,mCACL,MAAM,IAAIG,MACN,sEAIR,OAAOnB,KAAKgB,kCACpB"}
|
package/lib/Duration.cjs
CHANGED
|
@@ -10,7 +10,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @namespace proto
|
|
13
|
-
* @typedef {import("@
|
|
13
|
+
* @typedef {import("@hiero-ledger/proto").proto.IDuration} HieroProto.proto.IDuration
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
package/lib/Duration.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @namespace proto
|
|
3
|
-
* @typedef {import("@
|
|
3
|
+
* @typedef {import("@hiero-ledger/proto").proto.IDuration} HieroProto.proto.IDuration
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* A duration type.
|
|
@@ -31,7 +31,7 @@ export default class Duration {
|
|
|
31
31
|
}
|
|
32
32
|
export namespace HieroProto {
|
|
33
33
|
namespace proto {
|
|
34
|
-
type IDuration = import("@
|
|
34
|
+
type IDuration = import("@hiero-ledger/proto").proto.IDuration;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
import Long from "long";
|
package/lib/Duration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Duration.js","sources":["../src/Duration.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Long from \"long\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@
|
|
1
|
+
{"version":3,"file":"Duration.js","sources":["../src/Duration.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Long from \"long\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.IDuration} HieroProto.proto.IDuration\n */\n\n/**\n * A duration type.\n *\n * The main point of this tyope is for encapsulating the `[to|from]Protobuf()` implementations\n */\nexport default class Duration {\n /**\n * @param {Long | number} seconds\n */\n constructor(seconds) {\n /**\n * @readonly\n * @type {Long}\n */\n this.seconds =\n seconds instanceof Long ? seconds : Long.fromNumber(seconds);\n\n Object.freeze(this);\n }\n\n /**\n * @internal\n * @returns {HieroProto.proto.IDuration}\n */\n _toProtobuf() {\n return {\n seconds: this.seconds,\n };\n }\n\n /**\n * @internal\n * @param {HieroProto.proto.IDuration} duration\n * @returns {Duration}\n */\n static _fromProtobuf(duration) {\n return new Duration(/** @type {Long} */ (duration.seconds));\n }\n}\n"],"names":["Duration","constructor","seconds","this","Long","fromNumber","Object","freeze","_toProtobuf","_fromProtobuf","duration"],"mappings":"oBAce,MAAMA,EAIjB,WAAAC,CAAYC,GAKRC,KAAKD,QACDA,aAAmBE,EAAOF,EAAUE,EAAKC,WAAWH,GAExDI,OAAOC,OAAOJ,KACtB,CAMI,WAAAK,GACI,MAAO,CACHN,QAASC,KAAKD,QAE1B,CAOI,oBAAOO,CAAcC,GACjB,OAAO,IAAIV,EAA8BU,EAAgB,QACjE"}
|
package/lib/EntityIdHelper.cjs
CHANGED
|
@@ -23,7 +23,7 @@ var hex = _interopRequireWildcard(require("./encoding/hex.cjs"));
|
|
|
23
23
|
var _BadEntityIdError = _interopRequireDefault(require("./BadEntityIdError.cjs"));
|
|
24
24
|
var util = _interopRequireWildcard(require("./util.cjs"));
|
|
25
25
|
var _base = _interopRequireDefault(require("./base32.cjs"));
|
|
26
|
-
var HieroProto = _interopRequireWildcard(require("@
|
|
26
|
+
var HieroProto = _interopRequireWildcard(require("@hiero-ledger/proto"));
|
|
27
27
|
var _PublicKey = _interopRequireDefault(require("./PublicKey.cjs"));
|
|
28
28
|
var _bytes = require("@ethersproject/bytes");
|
|
29
29
|
var _EvmAddress = _interopRequireDefault(require("./EvmAddress.cjs"));
|
package/lib/EntityIdHelper.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"long";import{isHexString as r,decode as t,encode as n}from"./encoding/hex.js";import o from"./BadEntityIdError.js";import{isLongZeroAddress as l,safeView as i,convertToNumber as s}from"./util.js";import
|
|
1
|
+
import e from"long";import{isHexString as r,decode as t,encode as n}from"./encoding/hex.js";import o from"./BadEntityIdError.js";import{isLongZeroAddress as l,safeView as i,convertToNumber as s}from"./util.js";import u from"./base32.js";import*as a from"@hiero-ledger/proto";import c from"./PublicKey.js";import{arrayify as m}from"@ethersproject/bytes";import f from"./EvmAddress.js";const h=/"^(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))\\.(0|(?:[1-9]\\d*))(?:-([a-z]{5}))?$/,d=/^(\d+)(?:\.(\d+)\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/;function g(r,t,n){if(null==t&&null!=n||null!=t&&null==n)throw new Error("invalid entity ID");const[o,l,i]="number"==typeof r||e.isLong(r)?[null!=n?e.fromValue(r):e.ZERO,null!=t?e.fromValue(t):e.ZERO,null!=n?e.fromValue(n):e.fromValue(r)]:[null!=r.shard?e.fromValue(r.shard):e.ZERO,null!=r.realm?e.fromValue(r.realm):e.ZERO,e.fromValue(r.num)];if(o.isNegative()||l.isNegative()||i.isNegative())throw new Error("negative numbers are not allowed in IDs");return{shard:o,realm:l,num:i}}function w(e,r){let t=e[0].compare(r[0]);return 0!=t?t:(t=e[1].compare(r[1]),0!=t?t:e[2].compare(r[2]))}function y(e){const r=d.exec(e);if(null==r)throw new Error(`failed to parse entity id: ${e}`);return null==r[2]&&null==r[3]?{shard:"0",realm:"0",numOrHex:r[1],checksum:r[4]}:{shard:r[1],realm:r[2],numOrHex:r[3],checksum:r[4]}}function E(r){const t=y(r);if(Number.isNaN(t.shard)||Number.isNaN(t.realm)||Number.isNaN(t.numOrHex))throw new Error("invalid format for entity ID");return{shard:null!=t.shard?e.fromString(t.shard):e.ZERO,realm:null!=t.realm?e.fromString(t.realm):e.ZERO,num:e.fromString(t.numOrHex),checksum:t.checksum}}function p(r){const n=r.startsWith("0x")?t(r.slice(2)):t(r);if(20!==n.length)throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${r.length}`);return[e.fromBytesBE([0,0,0,0,...n.slice(0,4)]),e.fromBytesBE(Array.from(n.slice(4,12))),e.fromBytesBE(Array.from(n.slice(12,20)))]}function S(n,o,i){if(!r(i))throw new Error(`Invalid EVM address hex string: ${i}`);const s=i.startsWith("0x")?t(i.slice(2)):t(i);if(20!==s.length)throw new Error(`Invalid hex encoded evm address length:\n expected length 20, got length ${i.length}`);let u=e.ZERO;return l(s)&&(u=e.fromBytesBE(Array.from(s.slice(12,20)))),[n instanceof e?n:e.fromNumber(n),o instanceof e?o:e.fromNumber(o),u,u.isZero()?f.fromBytes(s):null]}function x(e){const r=new Uint8Array(20),t=i(r),[o,l,u]=e;return t.setUint32(0,s(o)),t.setUint32(8,s(l)),t.setUint32(16,s(u)),n(r)}function k(e){if(e instanceof Uint8Array)return n(e);const r=e,t=new Uint8Array(20);return i(t).setUint32(16,s(r)),n(t)}function A(r,t){let n=h.exec(t);if(null===n){return{status:0}}let o=[e.fromString(n[1]),e.fromString(n[2]),e.fromString(n[3])],l=`${o[0].toString()}.${o[1].toString()}.${o[2].toString()}`,i=$(r,l);return{status:void 0===n[4]?2:i==n[4]?3:1,num1:o[0],num2:o[1],num3:o[2],givenChecksum:n[4],correctChecksum:i,noChecksumFormat:l,withChecksumFormat:`${l}-${i}`}}function $(e,r){let t="",n=[],o=0,l=0,i=0,s=0,u=0;const a=11881376,c="a".charCodeAt(0);let m=new Uint8Array(e.length+6);m.set(e,0),m.set([0,0,0,0,0,0],e.length);for(let e=0;e<r.length;e++)n.push("."===r[e]?10:parseInt(r[e],10));for(let e=0;e<n.length;e++)i=(31*i+n[e])%17576,e%2==0?o=(o+n[e])%11:l=(l+n[e])%11;for(let e=0;e<m.length;e++)s=(31*s+m[e])%a;u=(17576*(11*(r.length%5*11+o)+l)+i+s)%a,u=1000003*u%a;for(let e=0;e<5;e++)t=String.fromCharCode(c+u%26)+t,u/=26;return t}function b(e,r,t,n,l){if(null==l._network._ledgerId||null==n)return;const i=$(l._network._ledgerId._ledgerId,`${e.toString()}.${r.toString()}.${t.toString()}`);if(n!=i)throw new o(e,r,t,n,i)}function v(e,r){if(null==r)throw new Error("client cannot be null");if(null==r._network._ledgerId)throw new Error("cannot calculate checksum with a client that does not contain a recognzied ledger ID");return`${e}-${$(r._network._ledgerId._ledgerId,e)}`}function I(e){const r=u.decode(e);if(!r)return null;let t;try{t=a.proto.Key.decode(r)}catch(e){throw new Error("The alias is created with hollow account. Please use aliasToEvmAddress!")}return null!=t.ed25519&&t.ed25519.byteLength>0?c.fromBytes(t.ed25519):null!=t.ECDSASecp256k1&&t.ECDSASecp256k1.byteLength>0?c.fromBytes(t.ECDSASecp256k1):null}function N(e){const r=u.decode(e);if(!r)return null;try{throw a.proto.Key.decode(r),new Error("The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!")}catch(e){return function(e){var r="0x";return e.forEach(function(e){r+=("0"+(255&e).toString(16)).slice(-2)}),r}(r)}}function _(e){if("string"==typeof e&&(e.startsWith("0x")&&42==e.length||40==e.length)){e.startsWith("0x")||(e=`0x${e}`);const r=m(e);return r?u.encode(r):null}const r="string"==typeof e?c.fromString(e):e;let t=r.toStringRaw(),n="";"secp256k1"===r._key._type&&(n="0x3A21"),"ED25519"===r._key._type&&(n="0x1220"),t.startsWith("0x")||(t=`0x${t}`);const o=m(n),l=m(t),i=(s=o,a=l,(f=new Uint8Array(s.byteLength+a.byteLength)).set(new Uint8Array(s),0),f.set(new Uint8Array(a),s.byteLength),f);var s,a,f;return u.encode(i)}export{$ as _checksum,A as _parseAddress,N as aliasToEvmAddress,I as aliasToPublicKey,w as compare,g as constructor,S as fromEvmAddress,p as fromSolidityAddress,E as fromString,y as fromStringSplitter,_ as publicKeyToAlias,k as toEvmAddress,x as toSolidityAddress,v as toStringWithChecksum,b as validateChecksum};
|
|
2
2
|
//# sourceMappingURL=EntityIdHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityIdHelper.js","sources":["../src/EntityIdHelper.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Long from \"long\";\nimport * as hex from \"./encoding/hex.js\";\nimport BadEntityIdError from \"./BadEntityIdError.js\";\nimport * as util from \"./util.js\";\nimport base32 from \"./base32.js\";\nimport * as HieroProto from \"@hashgraph/proto\";\nimport PublicKey from \"./PublicKey.js\";\nimport { arrayify } from \"@ethersproject/bytes\";\nimport EvmAddress from \"./EvmAddress.js\";\n\n/**\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @typedef {object} IEntityId\n * @property {number | Long} num\n * @property {(number | Long)=} shard\n * @property {(number | Long)=} realm\n */\n\n/**\n * @typedef {object} IEntityIdResult\n * @property {Long} shard\n * @property {Long} realm\n * @property {Long} num\n */\n\n/**\n * @typedef {object} IEntityIdParts\n * @property {string?} shard\n * @property {string?} realm\n * @property {string} numOrHex\n * @property {string?} checksum\n */\n\n/**\n * @typedef {object} IEntityIdResultWithChecksum\n * @property {Long} shard\n * @property {Long} realm\n * @property {Long} num\n * @property {string | null} checksum\n */\n\nconst regex =\n /\"^(0|(?:[1-9]\\\\d*))\\\\.(0|(?:[1-9]\\\\d*))\\\\.(0|(?:[1-9]\\\\d*))(?:-([a-z]{5}))?$/;\n\n/**\n * This regex supports entity IDs\n * - as stand alone nubmers\n * - as shard.realm.num\n * - as shard.realm.hex\n * - can optionally provide checksum for any of the above\n */\nconst ENTITY_ID_REGEX = /^(\\d+)(?:\\.(\\d+)\\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/;\n\n/**\n * @description The length of an EVM address in bytes.\n */\nconst EVM_ADDRESS_LENGTH = 20;\n\n/**\n * @description The length of the long-zero prefix in bytes.\n */\nconst LONG_ZERO_PREFIX_LENGTH = 12;\n\n/**\n * @description The offset of the entity number in the EVM address.\n */\nconst ENTITY_NUM_OFFSET = 16;\n\n/**\n * This method is called by most entity ID constructors. It's purpose is to\n * deduplicate the constuctors.\n *\n * @param {number | Long | IEntityId} props\n * @param {(number | null | Long)=} realmOrNull\n * @param {(number | null | Long)=} numOrNull\n * @returns {IEntityIdResult}\n */\nexport function constructor(props, realmOrNull, numOrNull) {\n // Make sure either both the second and third parameter are\n // set or not set; we shouldn't have one set, but the other not set.\n //\n //NOSONAR\n if (\n (realmOrNull == null && numOrNull != null) ||\n (realmOrNull != null && numOrNull == null)\n ) {\n throw new Error(\"invalid entity ID\");\n }\n\n // If the first parameter is a number then we need to convert the\n // first, second, and third parameters into numbers. Otherwise,\n // we should look at the fields `shard`, `realm`, and `num` on\n // `props`\n const [shard, realm, num] =\n typeof props === \"number\" || Long.isLong(props)\n ? [\n numOrNull != null\n ? Long.fromValue(/** @type {Long | number} */ (props))\n : Long.ZERO,\n realmOrNull != null ? Long.fromValue(realmOrNull) : Long.ZERO,\n numOrNull != null\n ? Long.fromValue(numOrNull)\n : Long.fromValue(/** @type {Long | number} */ (props)),\n ]\n : [\n props.shard != null ? Long.fromValue(props.shard) : Long.ZERO,\n props.realm != null ? Long.fromValue(props.realm) : Long.ZERO,\n Long.fromValue(props.num),\n ];\n\n // Make sure none of the numbers are negative\n if (shard.isNegative() || realm.isNegative() || num.isNegative()) {\n throw new Error(\"negative numbers are not allowed in IDs\");\n }\n\n return {\n shard,\n realm,\n num,\n };\n}\n\n/**\n * A simple comparison function for comparing entity IDs\n *\n * @param {[Long, Long, Long]} a\n * @param {[Long, Long, Long]} b\n * @returns {number}\n */\nexport function compare(a, b) {\n let comparison = a[0].compare(b[0]);\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = a[1].compare(b[1]);\n if (comparison != 0) {\n return comparison;\n }\n\n return a[2].compare(b[2]);\n}\n\n/**\n * This type is part of the entity ID checksums feature which\n * is responsible for checking if an entity ID was created on\n * the same ledger ID as the client is currently using.\n *\n * @typedef {object} ParseAddressResult\n * @property {number} status\n * @property {Long} [num1]\n * @property {Long} [num2]\n * @property {Long} [num3]\n * @property {string} [correctChecksum]\n * @property {string} [givenChecksum]\n * @property {string} [noChecksumFormat]\n * @property {string} [withChecksumFormat]\n */\n\n/**\n * @param {string} text\n * @returns {IEntityIdParts}\n */\nexport function fromStringSplitter(text) {\n const match = ENTITY_ID_REGEX.exec(text);\n\n if (match == null) {\n throw new Error(`failed to parse entity id: ${text}`);\n }\n\n if (match[2] == null && match[3] == null) {\n return {\n shard: \"0\",\n realm: \"0\",\n numOrHex: match[1],\n checksum: match[4],\n };\n } else {\n return {\n shard: match[1],\n realm: match[2],\n numOrHex: match[3],\n checksum: match[4],\n };\n }\n}\n\n/**\n * @param {string} text\n * @returns {IEntityIdResultWithChecksum}\n */\nexport function fromString(text) {\n const result = fromStringSplitter(text);\n\n if (\n Number.isNaN(result.shard) ||\n Number.isNaN(result.realm) ||\n Number.isNaN(result.numOrHex)\n ) {\n throw new Error(\"invalid format for entity ID\");\n }\n\n return {\n shard: result.shard != null ? Long.fromString(result.shard) : Long.ZERO,\n realm: result.realm != null ? Long.fromString(result.realm) : Long.ZERO,\n num: Long.fromString(result.numOrHex),\n checksum: result.checksum,\n };\n}\n\n/**\n * Return the shard, realm, and num from a solidity address.\n *\n * Solidity addresses are 20 bytes long and hex encoded, where the first 4\n * bytes represent the shard, the next 8 bytes represent the realm, and\n * the last 8 bytes represent the num. All in Big Endian format\n *\n * @param {string} address\n * @returns {[Long, Long, Long]}\n */\nexport function fromSolidityAddress(address) {\n const addr = address.startsWith(\"0x\")\n ? hex.decode(address.slice(2))\n : hex.decode(address);\n\n if (addr.length !== EVM_ADDRESS_LENGTH) {\n throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${address.length}`);\n }\n\n const shard = Long.fromBytesBE([0, 0, 0, 0, ...addr.slice(0, 4)]);\n const realm = Long.fromBytesBE(Array.from(addr.slice(4, 12)));\n const num = Long.fromBytesBE(Array.from(addr.slice(12, 20)));\n\n return [shard, realm, num];\n}\n\n/**\n * Parse an EVM address and return shard, realm, entity num, and optional EVM address.\n *\n * For long zero addresses (first 12 bytes are zeros): returns [shard, realm, entityNum, null]\n * For regular EVM addresses: returns [shard, realm, 0, EvmAddress]\n *\n * @param {Long | number} shard - The shard number to use\n * @param {Long | number} realm - The realm number to use\n * @param {string} address - The EVM address to parse (with or without 0x prefix)\n * @returns {[Long, Long, Long, EvmAddress | null]} - [shard, realm, entityNum, evmAddressOrNull]\n */\nexport function fromEvmAddress(shard, realm, address) {\n if (!hex.isHexString(address)) {\n throw new Error(`Invalid EVM address hex string: ${address}`);\n }\n\n const addr = address.startsWith(\"0x\")\n ? hex.decode(address.slice(2))\n : hex.decode(address);\n\n if (addr.length !== EVM_ADDRESS_LENGTH) {\n throw new Error(`Invalid hex encoded evm address length:\n expected length ${EVM_ADDRESS_LENGTH}, got length ${address.length}`);\n }\n\n let num = Long.ZERO;\n\n if (util.isLongZeroAddress(addr)) {\n num = Long.fromBytesBE(\n Array.from(addr.slice(LONG_ZERO_PREFIX_LENGTH, EVM_ADDRESS_LENGTH)),\n );\n }\n\n let shardLong = shard instanceof Long ? shard : Long.fromNumber(shard);\n let realmLong = realm instanceof Long ? realm : Long.fromNumber(realm);\n\n return [\n shardLong,\n realmLong,\n num,\n num.isZero() ? EvmAddress.fromBytes(addr) : null,\n ];\n}\n\n/**\n * Convert shard, realm, and num into a solidity address.\n *\n * See `fromSolidityAddress()` for more documentation.\n *\n * @param {[Long,Long,Long] | [number,number,number]} address\n * @returns {string}\n */\nexport function toSolidityAddress(address) {\n const buffer = new Uint8Array(20);\n const view = util.safeView(buffer);\n const [shard, realm, num] = address;\n\n view.setUint32(0, util.convertToNumber(shard));\n view.setUint32(8, util.convertToNumber(realm));\n view.setUint32(16, util.convertToNumber(num));\n\n return hex.encode(buffer);\n}\n\n/**\n * @overload\n * @param {Uint8Array} evmAddressBytes - EVM address bytes to convert to hex\n * @returns {string}\n */\n\n/**\n * @overload\n * @param {Long} accountNum - Account number to convert to long-zero EVM address\n * @returns {string}\n */\n\n/**\n * Convert EVM address bytes to hex string or account num to long-zero EVM address.\n *\n * @param {Uint8Array | Long} evmAddressBytesOrAccountNum\n * @returns {string}\n */\nexport function toEvmAddress(evmAddressBytesOrAccountNum) {\n if (evmAddressBytesOrAccountNum instanceof Uint8Array) {\n return hex.encode(evmAddressBytesOrAccountNum);\n }\n\n const accountNum = evmAddressBytesOrAccountNum;\n const buffer = new Uint8Array(EVM_ADDRESS_LENGTH);\n const view = util.safeView(buffer);\n\n view.setUint32(ENTITY_NUM_OFFSET, util.convertToNumber(accountNum));\n\n return hex.encode(buffer);\n}\n\n/**\n * Parse the address string addr and return an object with the results (8 fields).\n * The first four fields are numbers, which could be implemented as signed 32 bit\n * integers, and the last four are strings.\n *\n * status; //the status of the parsed address\n * // 0 = syntax error\n * // 1 = an invalid with-checksum address (bad checksum)\n * // 2 = a valid no-checksum address\n * // 3 = a valid with-checksum address\n * num1; //the 3 numbers in the address, such as 1.2.3, with leading zeros removed\n * num2;\n * num3;\n * correctchecksum; //the correct checksum\n * givenChecksum; //the checksum in the address that was parsed\n * noChecksumFormat; //the address in no-checksum format\n * withChecksumFormat; //the address in with-checksum format\n *\n * @param {Uint8Array} ledgerId\n * @param {string} addr\n * @returns {ParseAddressResult}\n */\nexport function _parseAddress(ledgerId, addr) {\n let match = regex.exec(addr);\n if (match === null) {\n let result = { status: 0 }; // When status == 0, the rest of the fields should be ignored\n return result;\n }\n let a = [\n Long.fromString(match[1]),\n Long.fromString(match[2]),\n Long.fromString(match[3]),\n ];\n let ad = `${a[0].toString()}.${a[1].toString()}.${a[2].toString()}`;\n let c = _checksum(ledgerId, ad);\n let s = match[4] === undefined ? 2 : c == match[4] ? 3 : 1; //NOSONAR\n return {\n status: s,\n num1: a[0],\n num2: a[1],\n num3: a[2],\n givenChecksum: match[4],\n correctChecksum: c,\n noChecksumFormat: ad,\n withChecksumFormat: `${ad}-${c}`,\n };\n}\n\n/**\n * Given an address like \"0.0.123\", return a checksum like \"laujm\"\n *\n * @param {Uint8Array} ledgerId\n * @param {string} addr\n * @returns {string}\n */\nexport function _checksum(ledgerId, addr) {\n let answer = \"\";\n let d = []; // Digits with 10 for \".\", so if addr == \"0.0.123\" then d == [0, 10, 0, 10, 1, 2, 3]\n let s0 = 0; // Sum of even positions (mod 11)\n let s1 = 0; // Sum of odd positions (mod 11)\n let s = 0; // Weighted sum of all positions (mod p3)\n let sh = 0; // Hash of the ledger ID\n let c = 0; // The checksum, as a single number\n const p3 = 26 * 26 * 26; // 3 digits in base 26\n const p5 = 26 * 26 * 26 * 26 * 26; // 5 digits in base 26\n const ascii_a = \"a\".charCodeAt(0); // 97\n const m = 1000003; // Min prime greater than a million. Used for the final permutation.\n const w = 31; // Sum s of digit values weights them by powers of w. Should be coprime to p5.\n\n let h = new Uint8Array(ledgerId.length + 6);\n h.set(ledgerId, 0);\n h.set([0, 0, 0, 0, 0, 0], ledgerId.length);\n for (let i = 0; i < addr.length; i++) {\n //NOSONAR\n d.push(addr[i] === \".\" ? 10 : parseInt(addr[i], 10));\n }\n for (let i = 0; i < d.length; i++) {\n s = (w * s + d[i]) % p3;\n if (i % 2 === 0) {\n s0 = (s0 + d[i]) % 11;\n } else {\n s1 = (s1 + d[i]) % 11;\n }\n }\n for (let i = 0; i < h.length; i++) {\n sh = (w * sh + h[i]) % p5;\n }\n c = ((((addr.length % 5) * 11 + s0) * 11 + s1) * p3 + s + sh) % p5;\n c = (c * m) % p5;\n\n for (let i = 0; i < 5; i++) {\n answer = String.fromCharCode(ascii_a + (c % 26)) + answer;\n c /= 26;\n }\n\n return answer;\n}\n\n/**\n * Validate an entity ID checksum against a client\n *\n * @param {Long} shard\n * @param {Long} realm\n * @param {Long} num\n * @param {string | null} checksum\n * @param {Client} client\n */\nexport function validateChecksum(shard, realm, num, checksum, client) {\n if (client._network._ledgerId == null || checksum == null) {\n return;\n }\n\n const expectedChecksum = _checksum(\n client._network._ledgerId._ledgerId,\n `${shard.toString()}.${realm.toString()}.${num.toString()}`,\n );\n\n if (checksum != expectedChecksum) {\n throw new BadEntityIdError(\n shard,\n realm,\n num,\n checksum,\n expectedChecksum,\n );\n }\n}\n\n/**\n * Stringify the entity ID with a checksum.\n *\n * @param {string} string\n * @param {Client} client\n * @returns {string}\n */\nexport function toStringWithChecksum(string, client) {\n if (client == null) {\n throw new Error(\"client cannot be null\");\n }\n\n if (client._network._ledgerId == null) {\n throw new Error(\n \"cannot calculate checksum with a client that does not contain a recognzied ledger ID\",\n );\n }\n\n const checksum = _checksum(client._network._ledgerId._ledgerId, string);\n\n return `${string}-${checksum}`;\n}\n\n/**\n * Append Buffers.\n * @param {Uint8Array} buffer1\n * @param {Uint8Array} buffer2\n * @returns {Uint8Array}\n */\nfunction appendBuffer(buffer1, buffer2) {\n var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);\n tmp.set(new Uint8Array(buffer1), 0);\n tmp.set(new Uint8Array(buffer2), buffer1.byteLength);\n return tmp;\n}\n\n/**\n * Convert bytes to hex string.\n * @param {Uint8Array} bytes\n * @returns {string}\n */\nfunction toHexString(bytes) {\n var s = \"0x\";\n bytes.forEach(function (byte) {\n s += (\"0\" + (byte & 0xff).toString(16)).slice(-2);\n });\n return s;\n}\n\n/**\n * Deserialize the alias to public key.\n * Alias is created from ed25519 or ECDSASecp256k1 types of accounts. If hollow account is used, the alias is created from evm address.\n * For hollow accounts, please use aliasToEvmAddress.\n *\n * @param {string} alias\n * @returns {PublicKey | null}\n */\nexport function aliasToPublicKey(alias) {\n const bytes = base32.decode(alias);\n if (!bytes) {\n return null;\n }\n let key;\n try {\n key = HieroProto.proto.Key.decode(bytes);\n } catch (e) {\n throw new Error(\n \"The alias is created with hollow account. Please use aliasToEvmAddress!\",\n );\n }\n\n if (key.ed25519 != null && key.ed25519.byteLength > 0) {\n return PublicKey.fromBytes(key.ed25519);\n }\n\n if (key.ECDSASecp256k1 != null && key.ECDSASecp256k1.byteLength > 0) {\n return PublicKey.fromBytes(key.ECDSASecp256k1);\n }\n\n return null;\n}\n\n/**\n * Deserialize the alias to evm address.\n * Alias is created from hollow account.\n * For ed25519 or ECDSASecp256k1 accounts, please use aliasToPublicKey.\n *\n * @param {string} alias\n * @returns {string | null}\n */\nexport function aliasToEvmAddress(alias) {\n const bytes = base32.decode(alias);\n if (!bytes) {\n return null;\n }\n try {\n HieroProto.proto.Key.decode(bytes);\n throw new Error(\n \"The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!\",\n );\n } catch (e) {\n return toHexString(bytes);\n }\n}\n\n/**\n * Serialize the public key to alias.\n * Alias is created from ed25519 or ECDSASecp256k1 types of accounts. If hollow account is used, the alias is created from evm address.\n *\n * @param {string | PublicKey} publicKey\n * @returns {string | null}\n */\nexport function publicKeyToAlias(publicKey) {\n if (\n typeof publicKey === \"string\" &&\n ((publicKey.startsWith(\"0x\") && publicKey.length == 42) ||\n publicKey.length == 40)\n ) {\n if (!publicKey.startsWith(\"0x\")) {\n publicKey = `0x${publicKey}`;\n }\n\n const bytes = arrayify(publicKey);\n if (!bytes) {\n return null;\n }\n return base32.encode(bytes);\n }\n\n const publicKeyRaw =\n typeof publicKey === \"string\"\n ? PublicKey.fromString(publicKey)\n : publicKey;\n let publicKeyHex = publicKeyRaw.toStringRaw();\n let leadingHex = \"\";\n\n if (publicKeyRaw._key._type === \"secp256k1\") {\n leadingHex = \"0x3A21\"; // LEADING BYTES FROM PROTOBUFS\n }\n\n if (publicKeyRaw._key._type === \"ED25519\") {\n leadingHex = \"0x1220\"; // LEADING BYTES FROM PROTOBUFS\n }\n\n if (!publicKeyHex.startsWith(\"0x\")) {\n publicKeyHex = `0x${publicKeyHex}`;\n }\n\n const leadingBytes = arrayify(leadingHex);\n const publicKeyBytes = arrayify(publicKeyHex);\n const publicKeyInBytes = appendBuffer(leadingBytes, publicKeyBytes);\n const alias = base32.encode(publicKeyInBytes);\n return alias;\n}\n"],"names":["regex","ENTITY_ID_REGEX","constructor","props","realmOrNull","numOrNull","Error","shard","realm","num","Long","isLong","fromValue","ZERO","isNegative","compare","a","b","comparison","fromStringSplitter","text","match","exec","numOrHex","checksum","fromString","result","Number","isNaN","fromSolidityAddress","address","addr","startsWith","hex.decode","slice","length","fromBytesBE","Array","from","fromEvmAddress","hex.isHexString","util.isLongZeroAddress","fromNumber","isZero","EvmAddress","fromBytes","toSolidityAddress","buffer","Uint8Array","view","util.safeView","setUint32","util.convertToNumber","hex.encode","toEvmAddress","evmAddressBytesOrAccountNum","accountNum","_parseAddress","ledgerId","status","ad","toString","c","_checksum","undefined","num1","num2","num3","givenChecksum","correctChecksum","noChecksumFormat","withChecksumFormat","answer","d","s0","s1","s","sh","p5","ascii_a","charCodeAt","h","set","i","push","parseInt","String","fromCharCode","validateChecksum","client","_network","_ledgerId","expectedChecksum","BadEntityIdError","toStringWithChecksum","string","aliasToPublicKey","alias","bytes","base32","decode","key","HieroProto","proto","Key","e","ed25519","byteLength","PublicKey","ECDSASecp256k1","aliasToEvmAddress","forEach","byte","toHexString","publicKeyToAlias","publicKey","arrayify","encode","publicKeyRaw","publicKeyHex","toStringRaw","leadingHex","_key","_type","leadingBytes","publicKeyBytes","publicKeyInBytes","buffer1","buffer2","tmp"],"mappings":"6XA8CA,MAAMA,EACF,+EASEC,EAAkB,sDA0BjB,SAASC,EAAYC,EAAOC,EAAaC,GAK5C,GACoB,MAAfD,GAAoC,MAAbC,GACR,MAAfD,GAAoC,MAAbC,EAExB,MAAM,IAAIC,MAAM,qBAOpB,MAAOC,EAAOC,EAAOC,GACA,iBAAVN,GAAsBO,EAAKC,OAAOR,GACnC,CACiB,MAAbE,EACMK,EAAKE,UAAS,GACdF,EAAKG,KACI,MAAfT,EAAsBM,EAAKE,UAAUR,GAAeM,EAAKG,KAC5C,MAAbR,EACMK,EAAKE,UAAUP,GACfK,EAAKE,UAAS,IAExB,CACmB,MAAfT,EAAMI,MAAgBG,EAAKE,UAAUT,EAAMI,OAASG,EAAKG,KAC1C,MAAfV,EAAMK,MAAgBE,EAAKE,UAAUT,EAAMK,OAASE,EAAKG,KACzDH,EAAKE,UAAUT,EAAMM,MAInC,GAAIF,EAAMO,cAAgBN,EAAMM,cAAgBL,EAAIK,aAChD,MAAM,IAAIR,MAAM,2CAGpB,MAAO,CACHC,QACAC,QACAC,MAER,CASO,SAASM,EAAQC,EAAGC,GACvB,IAAIC,EAAaF,EAAE,GAAGD,QAAQE,EAAE,IAChC,OAAkB,GAAdC,EACOA,GAGXA,EAAaF,EAAE,GAAGD,QAAQE,EAAE,IACV,GAAdC,EACOA,EAGJF,EAAE,GAAGD,QAAQE,EAAE,IAC1B,CAsBO,SAASE,EAAmBC,GAC/B,MAAMC,EAAQpB,EAAgBqB,KAAKF,GAEnC,GAAa,MAATC,EACA,MAAM,IAAIf,MAAM,8BAA8Bc,KAGlD,OAAgB,MAAZC,EAAM,IAA0B,MAAZA,EAAM,GACnB,CACHd,MAAO,IACPC,MAAO,IACPe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B,GAFV,IAGnB,CAEI,MAAMoB,EACmB,iBAAdH,EACDP,EAAUnF,WAAW0F,GACrBA,EACV,IAAII,EAAeD,EAAaE,cAC5BC,EAAa,GAEe,cAA5BH,EAAaI,KAAKC,QAClBF,EAAa,UAGe,YAA5BH,EAAaI,KAAKC,QAClBF,EAAa,UAGZF,EAAavF,WAAW,QACzBuF,EAAe,KAAKA,KAGxB,MAAMK,EAAeR,EAASK,GACxBI,EAAiBT,EAASG,GAC1BO,GAzHYC,EAyHoBH,EAzHXI,EAyHyBH,GAxHhDI,EAAM,IAAIjF,WAAW+E,EAAQpB,WAAaqB,EAAQrB,aAClDzB,IAAI,IAAIlC,WAAW+E,GAAU,GACjCE,EAAI/C,IAAI,IAAIlC,WAAWgF,GAAUD,EAAQpB,YAClCsB,GAJX,IAAsBF,EAASC,EACvBC,EA0HJ,OADc9B,EAAOkB,OAAOS,EAEhC"}
|
|
1
|
+
{"version":3,"file":"EntityIdHelper.js","sources":["../src/EntityIdHelper.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Long from \"long\";\nimport * as hex from \"./encoding/hex.js\";\nimport BadEntityIdError from \"./BadEntityIdError.js\";\nimport * as util from \"./util.js\";\nimport base32 from \"./base32.js\";\nimport * as HieroProto from \"@hiero-ledger/proto\";\nimport PublicKey from \"./PublicKey.js\";\nimport { arrayify } from \"@ethersproject/bytes\";\nimport EvmAddress from \"./EvmAddress.js\";\n\n/**\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n */\n\n/**\n * @typedef {object} IEntityId\n * @property {number | Long} num\n * @property {(number | Long)=} shard\n * @property {(number | Long)=} realm\n */\n\n/**\n * @typedef {object} IEntityIdResult\n * @property {Long} shard\n * @property {Long} realm\n * @property {Long} num\n */\n\n/**\n * @typedef {object} IEntityIdParts\n * @property {string?} shard\n * @property {string?} realm\n * @property {string} numOrHex\n * @property {string?} checksum\n */\n\n/**\n * @typedef {object} IEntityIdResultWithChecksum\n * @property {Long} shard\n * @property {Long} realm\n * @property {Long} num\n * @property {string | null} checksum\n */\n\nconst regex =\n /\"^(0|(?:[1-9]\\\\d*))\\\\.(0|(?:[1-9]\\\\d*))\\\\.(0|(?:[1-9]\\\\d*))(?:-([a-z]{5}))?$/;\n\n/**\n * This regex supports entity IDs\n * - as stand alone nubmers\n * - as shard.realm.num\n * - as shard.realm.hex\n * - can optionally provide checksum for any of the above\n */\nconst ENTITY_ID_REGEX = /^(\\d+)(?:\\.(\\d+)\\.([a-fA-F0-9]+))?(?:-([a-z]{5}))?$/;\n\n/**\n * @description The length of an EVM address in bytes.\n */\nconst EVM_ADDRESS_LENGTH = 20;\n\n/**\n * @description The length of the long-zero prefix in bytes.\n */\nconst LONG_ZERO_PREFIX_LENGTH = 12;\n\n/**\n * @description The offset of the entity number in the EVM address.\n */\nconst ENTITY_NUM_OFFSET = 16;\n\n/**\n * This method is called by most entity ID constructors. It's purpose is to\n * deduplicate the constuctors.\n *\n * @param {number | Long | IEntityId} props\n * @param {(number | null | Long)=} realmOrNull\n * @param {(number | null | Long)=} numOrNull\n * @returns {IEntityIdResult}\n */\nexport function constructor(props, realmOrNull, numOrNull) {\n // Make sure either both the second and third parameter are\n // set or not set; we shouldn't have one set, but the other not set.\n //\n //NOSONAR\n if (\n (realmOrNull == null && numOrNull != null) ||\n (realmOrNull != null && numOrNull == null)\n ) {\n throw new Error(\"invalid entity ID\");\n }\n\n // If the first parameter is a number then we need to convert the\n // first, second, and third parameters into numbers. Otherwise,\n // we should look at the fields `shard`, `realm`, and `num` on\n // `props`\n const [shard, realm, num] =\n typeof props === \"number\" || Long.isLong(props)\n ? [\n numOrNull != null\n ? Long.fromValue(/** @type {Long | number} */ (props))\n : Long.ZERO,\n realmOrNull != null ? Long.fromValue(realmOrNull) : Long.ZERO,\n numOrNull != null\n ? Long.fromValue(numOrNull)\n : Long.fromValue(/** @type {Long | number} */ (props)),\n ]\n : [\n props.shard != null ? Long.fromValue(props.shard) : Long.ZERO,\n props.realm != null ? Long.fromValue(props.realm) : Long.ZERO,\n Long.fromValue(props.num),\n ];\n\n // Make sure none of the numbers are negative\n if (shard.isNegative() || realm.isNegative() || num.isNegative()) {\n throw new Error(\"negative numbers are not allowed in IDs\");\n }\n\n return {\n shard,\n realm,\n num,\n };\n}\n\n/**\n * A simple comparison function for comparing entity IDs\n *\n * @param {[Long, Long, Long]} a\n * @param {[Long, Long, Long]} b\n * @returns {number}\n */\nexport function compare(a, b) {\n let comparison = a[0].compare(b[0]);\n if (comparison != 0) {\n return comparison;\n }\n\n comparison = a[1].compare(b[1]);\n if (comparison != 0) {\n return comparison;\n }\n\n return a[2].compare(b[2]);\n}\n\n/**\n * This type is part of the entity ID checksums feature which\n * is responsible for checking if an entity ID was created on\n * the same ledger ID as the client is currently using.\n *\n * @typedef {object} ParseAddressResult\n * @property {number} status\n * @property {Long} [num1]\n * @property {Long} [num2]\n * @property {Long} [num3]\n * @property {string} [correctChecksum]\n * @property {string} [givenChecksum]\n * @property {string} [noChecksumFormat]\n * @property {string} [withChecksumFormat]\n */\n\n/**\n * @param {string} text\n * @returns {IEntityIdParts}\n */\nexport function fromStringSplitter(text) {\n const match = ENTITY_ID_REGEX.exec(text);\n\n if (match == null) {\n throw new Error(`failed to parse entity id: ${text}`);\n }\n\n if (match[2] == null && match[3] == null) {\n return {\n shard: \"0\",\n realm: \"0\",\n numOrHex: match[1],\n checksum: match[4],\n };\n } else {\n return {\n shard: match[1],\n realm: match[2],\n numOrHex: match[3],\n checksum: match[4],\n };\n }\n}\n\n/**\n * @param {string} text\n * @returns {IEntityIdResultWithChecksum}\n */\nexport function fromString(text) {\n const result = fromStringSplitter(text);\n\n if (\n Number.isNaN(result.shard) ||\n Number.isNaN(result.realm) ||\n Number.isNaN(result.numOrHex)\n ) {\n throw new Error(\"invalid format for entity ID\");\n }\n\n return {\n shard: result.shard != null ? Long.fromString(result.shard) : Long.ZERO,\n realm: result.realm != null ? Long.fromString(result.realm) : Long.ZERO,\n num: Long.fromString(result.numOrHex),\n checksum: result.checksum,\n };\n}\n\n/**\n * Return the shard, realm, and num from a solidity address.\n *\n * Solidity addresses are 20 bytes long and hex encoded, where the first 4\n * bytes represent the shard, the next 8 bytes represent the realm, and\n * the last 8 bytes represent the num. All in Big Endian format\n *\n * @param {string} address\n * @returns {[Long, Long, Long]}\n */\nexport function fromSolidityAddress(address) {\n const addr = address.startsWith(\"0x\")\n ? hex.decode(address.slice(2))\n : hex.decode(address);\n\n if (addr.length !== EVM_ADDRESS_LENGTH) {\n throw new Error(`Invalid hex encoded solidity address length:\n expected length 40, got length ${address.length}`);\n }\n\n const shard = Long.fromBytesBE([0, 0, 0, 0, ...addr.slice(0, 4)]);\n const realm = Long.fromBytesBE(Array.from(addr.slice(4, 12)));\n const num = Long.fromBytesBE(Array.from(addr.slice(12, 20)));\n\n return [shard, realm, num];\n}\n\n/**\n * Parse an EVM address and return shard, realm, entity num, and optional EVM address.\n *\n * For long zero addresses (first 12 bytes are zeros): returns [shard, realm, entityNum, null]\n * For regular EVM addresses: returns [shard, realm, 0, EvmAddress]\n *\n * @param {Long | number} shard - The shard number to use\n * @param {Long | number} realm - The realm number to use\n * @param {string} address - The EVM address to parse (with or without 0x prefix)\n * @returns {[Long, Long, Long, EvmAddress | null]} - [shard, realm, entityNum, evmAddressOrNull]\n */\nexport function fromEvmAddress(shard, realm, address) {\n if (!hex.isHexString(address)) {\n throw new Error(`Invalid EVM address hex string: ${address}`);\n }\n\n const addr = address.startsWith(\"0x\")\n ? hex.decode(address.slice(2))\n : hex.decode(address);\n\n if (addr.length !== EVM_ADDRESS_LENGTH) {\n throw new Error(`Invalid hex encoded evm address length:\n expected length ${EVM_ADDRESS_LENGTH}, got length ${address.length}`);\n }\n\n let num = Long.ZERO;\n\n if (util.isLongZeroAddress(addr)) {\n num = Long.fromBytesBE(\n Array.from(addr.slice(LONG_ZERO_PREFIX_LENGTH, EVM_ADDRESS_LENGTH)),\n );\n }\n\n let shardLong = shard instanceof Long ? shard : Long.fromNumber(shard);\n let realmLong = realm instanceof Long ? realm : Long.fromNumber(realm);\n\n return [\n shardLong,\n realmLong,\n num,\n num.isZero() ? EvmAddress.fromBytes(addr) : null,\n ];\n}\n\n/**\n * Convert shard, realm, and num into a solidity address.\n *\n * See `fromSolidityAddress()` for more documentation.\n *\n * @param {[Long,Long,Long] | [number,number,number]} address\n * @returns {string}\n */\nexport function toSolidityAddress(address) {\n const buffer = new Uint8Array(20);\n const view = util.safeView(buffer);\n const [shard, realm, num] = address;\n\n view.setUint32(0, util.convertToNumber(shard));\n view.setUint32(8, util.convertToNumber(realm));\n view.setUint32(16, util.convertToNumber(num));\n\n return hex.encode(buffer);\n}\n\n/**\n * @overload\n * @param {Uint8Array} evmAddressBytes - EVM address bytes to convert to hex\n * @returns {string}\n */\n\n/**\n * @overload\n * @param {Long} accountNum - Account number to convert to long-zero EVM address\n * @returns {string}\n */\n\n/**\n * Convert EVM address bytes to hex string or account num to long-zero EVM address.\n *\n * @param {Uint8Array | Long} evmAddressBytesOrAccountNum\n * @returns {string}\n */\nexport function toEvmAddress(evmAddressBytesOrAccountNum) {\n if (evmAddressBytesOrAccountNum instanceof Uint8Array) {\n return hex.encode(evmAddressBytesOrAccountNum);\n }\n\n const accountNum = evmAddressBytesOrAccountNum;\n const buffer = new Uint8Array(EVM_ADDRESS_LENGTH);\n const view = util.safeView(buffer);\n\n view.setUint32(ENTITY_NUM_OFFSET, util.convertToNumber(accountNum));\n\n return hex.encode(buffer);\n}\n\n/**\n * Parse the address string addr and return an object with the results (8 fields).\n * The first four fields are numbers, which could be implemented as signed 32 bit\n * integers, and the last four are strings.\n *\n * status; //the status of the parsed address\n * // 0 = syntax error\n * // 1 = an invalid with-checksum address (bad checksum)\n * // 2 = a valid no-checksum address\n * // 3 = a valid with-checksum address\n * num1; //the 3 numbers in the address, such as 1.2.3, with leading zeros removed\n * num2;\n * num3;\n * correctchecksum; //the correct checksum\n * givenChecksum; //the checksum in the address that was parsed\n * noChecksumFormat; //the address in no-checksum format\n * withChecksumFormat; //the address in with-checksum format\n *\n * @param {Uint8Array} ledgerId\n * @param {string} addr\n * @returns {ParseAddressResult}\n */\nexport function _parseAddress(ledgerId, addr) {\n let match = regex.exec(addr);\n if (match === null) {\n let result = { status: 0 }; // When status == 0, the rest of the fields should be ignored\n return result;\n }\n let a = [\n Long.fromString(match[1]),\n Long.fromString(match[2]),\n Long.fromString(match[3]),\n ];\n let ad = `${a[0].toString()}.${a[1].toString()}.${a[2].toString()}`;\n let c = _checksum(ledgerId, ad);\n let s = match[4] === undefined ? 2 : c == match[4] ? 3 : 1; //NOSONAR\n return {\n status: s,\n num1: a[0],\n num2: a[1],\n num3: a[2],\n givenChecksum: match[4],\n correctChecksum: c,\n noChecksumFormat: ad,\n withChecksumFormat: `${ad}-${c}`,\n };\n}\n\n/**\n * Given an address like \"0.0.123\", return a checksum like \"laujm\"\n *\n * @param {Uint8Array} ledgerId\n * @param {string} addr\n * @returns {string}\n */\nexport function _checksum(ledgerId, addr) {\n let answer = \"\";\n let d = []; // Digits with 10 for \".\", so if addr == \"0.0.123\" then d == [0, 10, 0, 10, 1, 2, 3]\n let s0 = 0; // Sum of even positions (mod 11)\n let s1 = 0; // Sum of odd positions (mod 11)\n let s = 0; // Weighted sum of all positions (mod p3)\n let sh = 0; // Hash of the ledger ID\n let c = 0; // The checksum, as a single number\n const p3 = 26 * 26 * 26; // 3 digits in base 26\n const p5 = 26 * 26 * 26 * 26 * 26; // 5 digits in base 26\n const ascii_a = \"a\".charCodeAt(0); // 97\n const m = 1000003; // Min prime greater than a million. Used for the final permutation.\n const w = 31; // Sum s of digit values weights them by powers of w. Should be coprime to p5.\n\n let h = new Uint8Array(ledgerId.length + 6);\n h.set(ledgerId, 0);\n h.set([0, 0, 0, 0, 0, 0], ledgerId.length);\n for (let i = 0; i < addr.length; i++) {\n //NOSONAR\n d.push(addr[i] === \".\" ? 10 : parseInt(addr[i], 10));\n }\n for (let i = 0; i < d.length; i++) {\n s = (w * s + d[i]) % p3;\n if (i % 2 === 0) {\n s0 = (s0 + d[i]) % 11;\n } else {\n s1 = (s1 + d[i]) % 11;\n }\n }\n for (let i = 0; i < h.length; i++) {\n sh = (w * sh + h[i]) % p5;\n }\n c = ((((addr.length % 5) * 11 + s0) * 11 + s1) * p3 + s + sh) % p5;\n c = (c * m) % p5;\n\n for (let i = 0; i < 5; i++) {\n answer = String.fromCharCode(ascii_a + (c % 26)) + answer;\n c /= 26;\n }\n\n return answer;\n}\n\n/**\n * Validate an entity ID checksum against a client\n *\n * @param {Long} shard\n * @param {Long} realm\n * @param {Long} num\n * @param {string | null} checksum\n * @param {Client} client\n */\nexport function validateChecksum(shard, realm, num, checksum, client) {\n if (client._network._ledgerId == null || checksum == null) {\n return;\n }\n\n const expectedChecksum = _checksum(\n client._network._ledgerId._ledgerId,\n `${shard.toString()}.${realm.toString()}.${num.toString()}`,\n );\n\n if (checksum != expectedChecksum) {\n throw new BadEntityIdError(\n shard,\n realm,\n num,\n checksum,\n expectedChecksum,\n );\n }\n}\n\n/**\n * Stringify the entity ID with a checksum.\n *\n * @param {string} string\n * @param {Client} client\n * @returns {string}\n */\nexport function toStringWithChecksum(string, client) {\n if (client == null) {\n throw new Error(\"client cannot be null\");\n }\n\n if (client._network._ledgerId == null) {\n throw new Error(\n \"cannot calculate checksum with a client that does not contain a recognzied ledger ID\",\n );\n }\n\n const checksum = _checksum(client._network._ledgerId._ledgerId, string);\n\n return `${string}-${checksum}`;\n}\n\n/**\n * Append Buffers.\n * @param {Uint8Array} buffer1\n * @param {Uint8Array} buffer2\n * @returns {Uint8Array}\n */\nfunction appendBuffer(buffer1, buffer2) {\n var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);\n tmp.set(new Uint8Array(buffer1), 0);\n tmp.set(new Uint8Array(buffer2), buffer1.byteLength);\n return tmp;\n}\n\n/**\n * Convert bytes to hex string.\n * @param {Uint8Array} bytes\n * @returns {string}\n */\nfunction toHexString(bytes) {\n var s = \"0x\";\n bytes.forEach(function (byte) {\n s += (\"0\" + (byte & 0xff).toString(16)).slice(-2);\n });\n return s;\n}\n\n/**\n * Deserialize the alias to public key.\n * Alias is created from ed25519 or ECDSASecp256k1 types of accounts. If hollow account is used, the alias is created from evm address.\n * For hollow accounts, please use aliasToEvmAddress.\n *\n * @param {string} alias\n * @returns {PublicKey | null}\n */\nexport function aliasToPublicKey(alias) {\n const bytes = base32.decode(alias);\n if (!bytes) {\n return null;\n }\n let key;\n try {\n key = HieroProto.proto.Key.decode(bytes);\n } catch (e) {\n throw new Error(\n \"The alias is created with hollow account. Please use aliasToEvmAddress!\",\n );\n }\n\n if (key.ed25519 != null && key.ed25519.byteLength > 0) {\n return PublicKey.fromBytes(key.ed25519);\n }\n\n if (key.ECDSASecp256k1 != null && key.ECDSASecp256k1.byteLength > 0) {\n return PublicKey.fromBytes(key.ECDSASecp256k1);\n }\n\n return null;\n}\n\n/**\n * Deserialize the alias to evm address.\n * Alias is created from hollow account.\n * For ed25519 or ECDSASecp256k1 accounts, please use aliasToPublicKey.\n *\n * @param {string} alias\n * @returns {string | null}\n */\nexport function aliasToEvmAddress(alias) {\n const bytes = base32.decode(alias);\n if (!bytes) {\n return null;\n }\n try {\n HieroProto.proto.Key.decode(bytes);\n throw new Error(\n \"The alias is created with ed25519 or ECDSASecp256k1 account. Please use aliasToPublicKey!\",\n );\n } catch (e) {\n return toHexString(bytes);\n }\n}\n\n/**\n * Serialize the public key to alias.\n * Alias is created from ed25519 or ECDSASecp256k1 types of accounts. If hollow account is used, the alias is created from evm address.\n *\n * @param {string | PublicKey} publicKey\n * @returns {string | null}\n */\nexport function publicKeyToAlias(publicKey) {\n if (\n typeof publicKey === \"string\" &&\n ((publicKey.startsWith(\"0x\") && publicKey.length == 42) ||\n publicKey.length == 40)\n ) {\n if (!publicKey.startsWith(\"0x\")) {\n publicKey = `0x${publicKey}`;\n }\n\n const bytes = arrayify(publicKey);\n if (!bytes) {\n return null;\n }\n return base32.encode(bytes);\n }\n\n const publicKeyRaw =\n typeof publicKey === \"string\"\n ? PublicKey.fromString(publicKey)\n : publicKey;\n let publicKeyHex = publicKeyRaw.toStringRaw();\n let leadingHex = \"\";\n\n if (publicKeyRaw._key._type === \"secp256k1\") {\n leadingHex = \"0x3A21\"; // LEADING BYTES FROM PROTOBUFS\n }\n\n if (publicKeyRaw._key._type === \"ED25519\") {\n leadingHex = \"0x1220\"; // LEADING BYTES FROM PROTOBUFS\n }\n\n if (!publicKeyHex.startsWith(\"0x\")) {\n publicKeyHex = `0x${publicKeyHex}`;\n }\n\n const leadingBytes = arrayify(leadingHex);\n const publicKeyBytes = arrayify(publicKeyHex);\n const publicKeyInBytes = appendBuffer(leadingBytes, publicKeyBytes);\n const alias = base32.encode(publicKeyInBytes);\n return alias;\n}\n"],"names":["regex","ENTITY_ID_REGEX","constructor","props","realmOrNull","numOrNull","Error","shard","realm","num","Long","isLong","fromValue","ZERO","isNegative","compare","a","b","comparison","fromStringSplitter","text","match","exec","numOrHex","checksum","fromString","result","Number","isNaN","fromSolidityAddress","address","addr","startsWith","hex.decode","slice","length","fromBytesBE","Array","from","fromEvmAddress","hex.isHexString","util.isLongZeroAddress","fromNumber","isZero","EvmAddress","fromBytes","toSolidityAddress","buffer","Uint8Array","view","util.safeView","setUint32","util.convertToNumber","hex.encode","toEvmAddress","evmAddressBytesOrAccountNum","accountNum","_parseAddress","ledgerId","status","ad","toString","c","_checksum","undefined","num1","num2","num3","givenChecksum","correctChecksum","noChecksumFormat","withChecksumFormat","answer","d","s0","s1","s","sh","p5","ascii_a","charCodeAt","h","set","i","push","parseInt","String","fromCharCode","validateChecksum","client","_network","_ledgerId","expectedChecksum","BadEntityIdError","toStringWithChecksum","string","aliasToPublicKey","alias","bytes","base32","decode","key","HieroProto","proto","Key","e","ed25519","byteLength","PublicKey","ECDSASecp256k1","aliasToEvmAddress","forEach","byte","toHexString","publicKeyToAlias","publicKey","arrayify","encode","publicKeyRaw","publicKeyHex","toStringRaw","leadingHex","_key","_type","leadingBytes","publicKeyBytes","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KC,QAClBF,EAAa,UAGe,YAA5BH,EAAaI,KAAKC,QAClBF,EAAa,UAGZF,EAAavF,WAAW,QACzBuF,EAAe,KAAKA,KAGxB,MAAMK,EAAeR,EAASK,GACxBI,EAAiBT,EAASG,GAC1BO,GAzHYC,EAyHoBH,EAzHXI,EAyHyBH,GAxHhDI,EAAM,IAAIjF,WAAW+E,EAAQpB,WAAaqB,EAAQrB,aAClDzB,IAAI,IAAIlC,WAAW+E,GAAU,GACjCE,EAAI/C,IAAI,IAAIlC,WAAWgF,GAAUD,EAAQpB,YAClCsB,GAJX,IAAsBF,EAASC,EACvBC,EA0HJ,OADc9B,EAAOkB,OAAOS,EAEhC"}
|
package/lib/EthereumFlow.cjs
CHANGED
|
@@ -16,13 +16,13 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
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.IEthereumTransactionBody} HieroProto.proto.IEthereumTransactionBody
|
|
25
|
+
* @typedef {import("@hiero-ledger/proto").proto.IAccountID} HieroProto.proto.IAccountID
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
/**
|
package/lib/EthereumFlow.d.ts
CHANGED
|
@@ -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.IEthereumTransactionBody} HieroProto.proto.IEthereumTransactionBody
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.IAccountID} HieroProto.proto.IAccountID
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {import("bignumber.js").default} BigNumber
|
|
@@ -111,13 +111,13 @@ export default class EthereumFlow {
|
|
|
111
111
|
}
|
|
112
112
|
export namespace HieroProto {
|
|
113
113
|
namespace proto {
|
|
114
|
-
type ITransaction = import("@
|
|
115
|
-
type ISignedTransaction = import("@
|
|
116
|
-
type TransactionBody = import("@
|
|
117
|
-
type ITransactionBody = import("@
|
|
118
|
-
type ITransactionResponse = import("@
|
|
119
|
-
type IEthereumTransactionBody = import("@
|
|
120
|
-
type IAccountID = import("@
|
|
114
|
+
type ITransaction = import("@hiero-ledger/proto").proto.ITransaction;
|
|
115
|
+
type ISignedTransaction = import("@hiero-ledger/proto").proto.ISignedTransaction;
|
|
116
|
+
type TransactionBody = import("@hiero-ledger/proto").proto.TransactionBody;
|
|
117
|
+
type ITransactionBody = import("@hiero-ledger/proto").proto.ITransactionBody;
|
|
118
|
+
type ITransactionResponse = import("@hiero-ledger/proto").proto.ITransactionResponse;
|
|
119
|
+
type IEthereumTransactionBody = import("@hiero-ledger/proto").proto.IEthereumTransactionBody;
|
|
120
|
+
type IAccountID = import("@hiero-ledger/proto").proto.IAccountID;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
export type BigNumber = import("bignumber.js").default;
|
package/lib/EthereumFlow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumFlow.js","sources":["../src/EthereumFlow.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Hbar from \"./Hbar.js\";\nimport EthereumTransaction from \"./EthereumTransaction.js\";\nimport EthereumTransactionData from \"./EthereumTransactionData.js\";\nimport FileCreateTransaction from \"./file/FileCreateTransaction.js\";\nimport FileAppendTransaction from \"./file/FileAppendTransaction.js\";\nimport * as hex from \"./encoding/hex.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hashgraph/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hashgraph/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hashgraph/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hashgraph/proto\").proto.IEthereumTransactionBody} HieroProto.proto.IEthereumTransactionBody\n * @typedef {import(\"@hashgraph/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./file/FileId.js\").default} FileId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./Timestamp.js\").default} Timestamp\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * Create a new Hedera™ transaction wrapped ethereum transaction.\n * @deprecated - use EthereumTransaction instead. With the introduction of jumbo transactions, it should always be less cost and more efficient to use EthereumTransaction instead.\n */\nexport default class EthereumFlow {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.ethereumData]\n * @param {FileId} [props.callData]\n * @param {number | string | Long | BigNumber | Hbar} [props.maxGasAllowance]\n */\n constructor(props = {}) {\n /**\n * @private\n * @type {?EthereumTransactionData}\n */\n this._ethereumData = null;\n\n /**\n * @private\n * @type {?FileId}\n */\n this._callDataFileId = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._maxGasAllowance = null;\n\n if (props.ethereumData != null) {\n this.setEthereumData(props.ethereumData);\n }\n\n if (props.maxGasAllowance != null) {\n this.setMaxGasAllowanceHbar(props.maxGasAllowance);\n }\n\n this._maxChunks = null;\n }\n\n /**\n * @returns {number | null}\n */\n get maxChunks() {\n return this._maxChunks;\n }\n\n /**\n * @param {number} maxChunks\n * @returns {this}\n */\n setMaxChunks(maxChunks) {\n this._maxChunks = maxChunks;\n return this;\n }\n\n /**\n * @returns {?EthereumTransactionData}\n */\n get ethereumData() {\n return this._ethereumData;\n }\n\n /**\n * The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete\n * unless the callData field is set.\n *\n * @param {EthereumTransactionData | Uint8Array} ethereumData\n * @returns {this}\n */\n setEthereumData(ethereumData) {\n this._ethereumData =\n ethereumData instanceof Uint8Array\n ? EthereumTransactionData.fromBytes(ethereumData)\n : ethereumData;\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get maxGasAllowance() {\n return this._maxGasAllowance;\n }\n\n /**\n * @deprecated - use masGasAllowanceHbar instead.\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowance(maxGasAllowance) {\n return this.setMaxGasAllowanceHbar(maxGasAllowance);\n }\n\n /**\n * The maximum amount, in hbars, that the payer of the hedera transaction\n * is willing to pay to complete the transaction.\n *\n * Ordinarily the account with the ECDSA alias corresponding to the public\n * key that is extracted from the ethereum_data signature is responsible for\n * fees that result from the execution of the transaction. If that amount of\n * authorized fees is not sufficient then the payer of the transaction can be\n * charged, up to but not exceeding this amount. If the ethereum_data\n * transaction authorized an amount that was insufficient then the payer will\n * only be charged the amount needed to make up the difference. If the gas\n * price in the transaction was set to zero then the payer will be assessed\n * the entire fee.\n *\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowanceHbar(maxGasAllowance) {\n this._maxGasAllowance =\n maxGasAllowance instanceof Hbar\n ? maxGasAllowance\n : new Hbar(maxGasAllowance);\n return this;\n }\n\n /**\n * @template {Channel} ChannelT\n * @template {MirrorChannel} MirrorChannelT\n * @param {import(\"./client/Client.js\").default<ChannelT, MirrorChannelT>} client\n * @returns {Promise<TransactionResponse>}\n */\n async execute(client) {\n if (this._ethereumData == null) {\n throw new Error(\n \"cannot submit ethereum transaction with no ethereum data\",\n );\n }\n\n const ethereumTransaction = new EthereumTransaction();\n const ethereumTransactionDataBytes = this._ethereumData.toBytes();\n\n if (this._maxGasAllowance != null) {\n ethereumTransaction.setMaxGasAllowanceHbar(this._maxGasAllowance);\n }\n\n if (this._callDataFileId != null) {\n if (this._ethereumData.callData.length === 0) {\n throw new Error(\n \"call data file ID provided, but ethereum data already contains call data\",\n );\n }\n\n ethereumTransaction\n .setEthereumData(ethereumTransactionDataBytes)\n .setCallDataFileId(this._callDataFileId);\n // in the consensus node config file, the maximum size of the call data file is 128000 bytes\n // so we need to check if the call data is less than or equal to 128000 bytes\n } else if (ethereumTransactionDataBytes.length <= 128000) {\n ethereumTransaction.setEthereumData(ethereumTransactionDataBytes);\n } else {\n const fileId = await createFile(\n this._ethereumData.callData,\n client,\n this._maxChunks,\n );\n\n this._ethereumData.callData = new Uint8Array();\n\n ethereumTransaction\n .setEthereumData(this._ethereumData.toBytes())\n .setCallDataFileId(fileId);\n }\n\n return ethereumTransaction.execute(client);\n }\n}\n\n/**\n * @template {Channel} ChannelT\n * @template {MirrorChannel} MirrorChannelT\n * @param {Uint8Array} callData\n * @param {import(\"./client/Client.js\").default<ChannelT, MirrorChannelT>} client\n * @param {?number} maxChunks\n * @returns {Promise<FileId>}\n */\nasync function createFile(callData, client, maxChunks) {\n const hexedCallData = hex.encode(callData);\n\n const fileId = /** @type {FileId} */ (\n (\n await (\n await new FileCreateTransaction()\n .setContents(hexedCallData.substring(0, 4096))\n .setKeys(\n client.operatorPublicKey\n ? [client.operatorPublicKey]\n : [],\n )\n .execute(client)\n ).getReceipt(client)\n ).fileId\n );\n\n if (callData.length > 4096) {\n let fileAppendTransaction = new FileAppendTransaction()\n .setFileId(fileId)\n .setContents(hexedCallData.substring(4096, hexedCallData.length));\n if (maxChunks != null) {\n fileAppendTransaction.setMaxChunks(maxChunks);\n }\n\n await (await fileAppendTransaction.execute(client)).getReceipt(client);\n }\n\n return fileId;\n}\n"],"names":["EthereumFlow","constructor","props","this","_ethereumData","_callDataFileId","_maxGasAllowance","ethereumData","setEthereumData","maxGasAllowance","setMaxGasAllowanceHbar","_maxChunks","maxChunks","setMaxChunks","Uint8Array","EthereumTransactionData","fromBytes","setMaxGasAllowance","Hbar","execute","client","Error","ethereumTransaction","EthereumTransaction","ethereumTransactionDataBytes","toBytes","callData","length","setCallDataFileId","fileId","async","hexedCallData","hex.encode","FileCreateTransaction","setContents","substring","setKeys","operatorPublicKey","getReceipt","fileAppendTransaction","FileAppendTransaction","setFileId","createFile"],"mappings":"sPAqCe,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G,OACvCC,QACGhB,EAAOiB,kBACD,CAACjB,EAAOiB,mBACR,IAETlB,QAAQC,IACfkB,WAAWlB,IAEpB,OAED,GAAIM,EAASC,OAAS,KAAM,CACxB,IAAIY,GAAwB,IAAIC,GAC3BC,UAAUZ,GACVK,YAAYH,EAAcI,UAAU,KAAMJ,EAAcJ,SAC5C,MAAbf,GACA2B,EAAsB1B,aAAaD,eAG1B2B,EAAsBpB,QAAQC,IAASkB,WAAWlB,EACvE,CAEI,OAAOS,CACX,CAvDiCa,CACjBvC,KAAKC,cAAcsB,SACnBN,EACAjB,KAAKQ,YAGTR,KAAKC,cAAcsB,SAAW,IAAIZ,WAElCQ,EACKd,gBAAgBL,KAAKC,cAAcqB,WACnCG,kBAAkBC,EACnC,CAEQ,OAAOP,EAAoBH,QAAQC,EAC3C"}
|
|
1
|
+
{"version":3,"file":"EthereumFlow.js","sources":["../src/EthereumFlow.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Hbar from \"./Hbar.js\";\nimport EthereumTransaction from \"./EthereumTransaction.js\";\nimport EthereumTransactionData from \"./EthereumTransactionData.js\";\nimport FileCreateTransaction from \"./file/FileCreateTransaction.js\";\nimport FileAppendTransaction from \"./file/FileAppendTransaction.js\";\nimport * as hex from \"./encoding/hex.js\";\n\n/**\n * @namespace proto\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransaction} HieroProto.proto.ITransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction\n * @typedef {import(\"@hiero-ledger/proto\").proto.TransactionBody} HieroProto.proto.TransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionBody} HieroProto.proto.ITransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse\n * @typedef {import(\"@hiero-ledger/proto\").proto.IEthereumTransactionBody} HieroProto.proto.IEthereumTransactionBody\n * @typedef {import(\"@hiero-ledger/proto\").proto.IAccountID} HieroProto.proto.IAccountID\n */\n\n/**\n * @typedef {import(\"bignumber.js\").default} BigNumber\n * @typedef {import(\"./account/AccountId.js\").default} AccountId\n * @typedef {import(\"./file/FileId.js\").default} FileId\n * @typedef {import(\"./channel/Channel.js\").default} Channel\n * @typedef {import(\"./channel/MirrorChannel.js\").default} MirrorChannel\n * @typedef {import(\"./client/Client.js\").default<*, *>} Client\n * @typedef {import(\"./Timestamp.js\").default} Timestamp\n * @typedef {import(\"./transaction/TransactionId.js\").default} TransactionId\n * @typedef {import(\"./transaction/TransactionResponse.js\").default} TransactionResponse\n * @typedef {import(\"long\")} Long\n */\n\n/**\n * Create a new Hedera™ transaction wrapped ethereum transaction.\n * @deprecated - use EthereumTransaction instead. With the introduction of jumbo transactions, it should always be less cost and more efficient to use EthereumTransaction instead.\n */\nexport default class EthereumFlow {\n /**\n * @param {object} [props]\n * @param {Uint8Array} [props.ethereumData]\n * @param {FileId} [props.callData]\n * @param {number | string | Long | BigNumber | Hbar} [props.maxGasAllowance]\n */\n constructor(props = {}) {\n /**\n * @private\n * @type {?EthereumTransactionData}\n */\n this._ethereumData = null;\n\n /**\n * @private\n * @type {?FileId}\n */\n this._callDataFileId = null;\n\n /**\n * @private\n * @type {?Hbar}\n */\n this._maxGasAllowance = null;\n\n if (props.ethereumData != null) {\n this.setEthereumData(props.ethereumData);\n }\n\n if (props.maxGasAllowance != null) {\n this.setMaxGasAllowanceHbar(props.maxGasAllowance);\n }\n\n this._maxChunks = null;\n }\n\n /**\n * @returns {number | null}\n */\n get maxChunks() {\n return this._maxChunks;\n }\n\n /**\n * @param {number} maxChunks\n * @returns {this}\n */\n setMaxChunks(maxChunks) {\n this._maxChunks = maxChunks;\n return this;\n }\n\n /**\n * @returns {?EthereumTransactionData}\n */\n get ethereumData() {\n return this._ethereumData;\n }\n\n /**\n * The raw Ethereum transaction (RLP encoded type 0, 1, and 2). Complete\n * unless the callData field is set.\n *\n * @param {EthereumTransactionData | Uint8Array} ethereumData\n * @returns {this}\n */\n setEthereumData(ethereumData) {\n this._ethereumData =\n ethereumData instanceof Uint8Array\n ? EthereumTransactionData.fromBytes(ethereumData)\n : ethereumData;\n return this;\n }\n\n /**\n * @returns {?Hbar}\n */\n get maxGasAllowance() {\n return this._maxGasAllowance;\n }\n\n /**\n * @deprecated - use masGasAllowanceHbar instead.\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowance(maxGasAllowance) {\n return this.setMaxGasAllowanceHbar(maxGasAllowance);\n }\n\n /**\n * The maximum amount, in hbars, that the payer of the hedera transaction\n * is willing to pay to complete the transaction.\n *\n * Ordinarily the account with the ECDSA alias corresponding to the public\n * key that is extracted from the ethereum_data signature is responsible for\n * fees that result from the execution of the transaction. If that amount of\n * authorized fees is not sufficient then the payer of the transaction can be\n * charged, up to but not exceeding this amount. If the ethereum_data\n * transaction authorized an amount that was insufficient then the payer will\n * only be charged the amount needed to make up the difference. If the gas\n * price in the transaction was set to zero then the payer will be assessed\n * the entire fee.\n *\n * @param {number | string | Long | BigNumber | Hbar} maxGasAllowance\n * @returns {this}\n */\n setMaxGasAllowanceHbar(maxGasAllowance) {\n this._maxGasAllowance =\n maxGasAllowance instanceof Hbar\n ? maxGasAllowance\n : new Hbar(maxGasAllowance);\n return this;\n }\n\n /**\n * @template {Channel} ChannelT\n * @template {MirrorChannel} MirrorChannelT\n * @param {import(\"./client/Client.js\").default<ChannelT, MirrorChannelT>} client\n * @returns {Promise<TransactionResponse>}\n */\n async execute(client) {\n if (this._ethereumData == null) {\n throw new Error(\n \"cannot submit ethereum transaction with no ethereum data\",\n );\n }\n\n const ethereumTransaction = new EthereumTransaction();\n const ethereumTransactionDataBytes = this._ethereumData.toBytes();\n\n if (this._maxGasAllowance != null) {\n ethereumTransaction.setMaxGasAllowanceHbar(this._maxGasAllowance);\n }\n\n if (this._callDataFileId != null) {\n if (this._ethereumData.callData.length === 0) {\n throw new Error(\n \"call data file ID provided, but ethereum data already contains call data\",\n );\n }\n\n ethereumTransaction\n .setEthereumData(ethereumTransactionDataBytes)\n .setCallDataFileId(this._callDataFileId);\n // in the consensus node config file, the maximum size of the call data file is 128000 bytes\n // so we need to check if the call data is less than or equal to 128000 bytes\n } else if (ethereumTransactionDataBytes.length <= 128000) {\n ethereumTransaction.setEthereumData(ethereumTransactionDataBytes);\n } else {\n const fileId = await createFile(\n this._ethereumData.callData,\n client,\n this._maxChunks,\n );\n\n this._ethereumData.callData = new Uint8Array();\n\n ethereumTransaction\n .setEthereumData(this._ethereumData.toBytes())\n .setCallDataFileId(fileId);\n }\n\n return ethereumTransaction.execute(client);\n }\n}\n\n/**\n * @template {Channel} ChannelT\n * @template {MirrorChannel} MirrorChannelT\n * @param {Uint8Array} callData\n * @param {import(\"./client/Client.js\").default<ChannelT, MirrorChannelT>} client\n * @param {?number} maxChunks\n * @returns {Promise<FileId>}\n */\nasync function createFile(callData, client, maxChunks) {\n const hexedCallData = hex.encode(callData);\n\n const fileId = /** @type {FileId} */ (\n (\n await (\n await new FileCreateTransaction()\n .setContents(hexedCallData.substring(0, 4096))\n .setKeys(\n client.operatorPublicKey\n ? [client.operatorPublicKey]\n : [],\n )\n .execute(client)\n ).getReceipt(client)\n ).fileId\n );\n\n if (callData.length > 4096) {\n let fileAppendTransaction = new FileAppendTransaction()\n .setFileId(fileId)\n .setContents(hexedCallData.substring(4096, hexedCallData.length));\n if (maxChunks != null) {\n fileAppendTransaction.setMaxChunks(maxChunks);\n }\n\n await (await fileAppendTransaction.execute(client)).getReceipt(client);\n }\n\n return fileId;\n}\n"],"names":["EthereumFlow","constructor","props","this","_ethereumData","_callDataFileId","_maxGasAllowance","ethereumData","setEthereumData","maxGasAllowance","setMaxGasAllowanceHbar","_maxChunks","maxChunks","setMaxChunks","Uint8Array","EthereumTransactionData","fromBytes","setMaxGasAllowance","Hbar","execute","client","Error","ethereumTransaction","EthereumTransaction","ethereumTransactionDataBytes","toBytes","callData","length","setCallDataFileId","fileId","async","hexedCallData","hex.encode","FileCreateTransaction","setContents","substring","setKeys","operatorPublicKey","getReceipt","fileAppendTransaction","FileAppendTransaction","setFileId","createFile"],"mappings":"sPAqCe,MAAMA,EAOjB,WAAAC,CAAYC,EAAQ,IAKhBC,KAAKC,cAAgB,KAMrBD,KAAKE,gBAAkB,KAMvBF,KAAKG,iBAAmB,KAEE,MAAtBJ,EAAMK,cACNJ,KAAKK,gBAAgBN,EAAMK,cAGF,MAAzBL,EAAMO,iBACNN,KAAKO,uBAAuBR,EAAMO,iBAGtCN,KAAKQ,WAAa,IAC1B,CAKI,aAAIC,GACA,OAAOT,KAAKQ,UACpB,CAMI,YAAAE,CAAaD,GAET,OADAT,KAAKQ,WAAaC,EACXT,IACf,CAKI,gBAAII,GACA,OAAOJ,KAAKC,aACpB,CASI,eAAAI,CAAgBD,GAKZ,OAJAJ,KAAKC,cACDG,aAAwBO,WAClBC,EAAwBC,UAAUT,GAClCA,EACHJ,IACf,CAKI,mBAAIM,GACA,OAAON,KAAKG,gBACpB,CAOI,kBAAAW,CAAmBR,GACf,OAAON,KAAKO,uBAAuBD,EAC3C,CAmBI,sBAAAC,CAAuBD,GAKnB,OAJAN,KAAKG,iBACDG,aAA2BS,EACrBT,EACA,IAAIS,EAAKT,GACZN,IACf,CAQI,aAAMgB,CAAQC,GACV,GAA0B,MAAtBjB,KAAKC,cACL,MAAM,IAAIiB,MACN,4DAIR,MAAMC,EAAsB,IAAIC,EAC1BC,EAA+BrB,KAAKC,cAAcqB,UAMxD,GAJ6B,MAAzBtB,KAAKG,kBACLgB,EAAoBZ,uBAAuBP,KAAKG,kBAGxB,MAAxBH,KAAKE,gBAAyB,CAC9B,GAA2C,IAAvCF,KAAKC,cAAcsB,SAASC,OAC5B,MAAM,IAAIN,MACN,4EAIRC,EACKd,gBAAgBgB,GAChBI,kBAAkBzB,KAAKE,gBAGxC,MAAe,GAAImB,EAA6BG,QAAU,MAC9CL,EAAoBd,gBAAgBgB,OACjC,CACH,MAAMK,QAyBlBC,eAA0BJ,EAAUN,EAAQR,GACxC,MAAMmB,EAAgBC,EAAWN,GAE3BG,eAGY,IAAII,GACLC,YAAYH,EAAcI,UAAU,EAAG,OACvCC,QACGhB,EAAOiB,kBACD,CAACjB,EAAOiB,mBACR,IAETlB,QAAQC,IACfkB,WAAWlB,IAEpB,OAED,GAAIM,EAASC,OAAS,KAAM,CACxB,IAAIY,GAAwB,IAAIC,GAC3BC,UAAUZ,GACVK,YAAYH,EAAcI,UAAU,KAAMJ,EAAcJ,SAC5C,MAAbf,GACA2B,EAAsB1B,aAAaD,eAG1B2B,EAAsBpB,QAAQC,IAASkB,WAAWlB,EACvE,CAEI,OAAOS,CACX,CAvDiCa,CACjBvC,KAAKC,cAAcsB,SACnBN,EACAjB,KAAKQ,YAGTR,KAAKC,cAAcsB,SAAW,IAAIZ,WAElCQ,EACKd,gBAAgBL,KAAKC,cAAcqB,WACnCG,kBAAkBC,EACnC,CAEQ,OAAOP,EAAoBH,QAAQC,EAC3C"}
|
|
@@ -13,13 +13,13 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
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.ITransaction} HieroProto.proto.ITransaction
|
|
17
|
+
* @typedef {import("@hiero-ledger/proto").proto.ISignedTransaction} HieroProto.proto.ISignedTransaction
|
|
18
|
+
* @typedef {import("@hiero-ledger/proto").proto.TransactionBody} HieroProto.proto.TransactionBody
|
|
19
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionBody} HieroProto.proto.ITransactionBody
|
|
20
|
+
* @typedef {import("@hiero-ledger/proto").proto.ITransactionResponse} HieroProto.proto.ITransactionResponse
|
|
21
|
+
* @typedef {import("@hiero-ledger/proto").proto.IEthereumTransactionBody} HieroProto.proto.IEthereumTransactionBody
|
|
22
|
+
* @typedef {import("@hiero-ledger/proto").proto.IAccountID} HieroProto.proto.IAccountID
|
|
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.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.IEthereumTransactionBody} HieroProto.proto.IEthereumTransactionBody
|
|
9
|
+
* @typedef {import("@hiero-ledger/proto").proto.IAccountID} HieroProto.proto.IAccountID
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {import("bignumber.js").default} BigNumber
|
|
@@ -140,13 +140,13 @@ export default class EthereumTransaction extends Transaction {
|
|
|
140
140
|
}
|
|
141
141
|
export namespace HieroProto {
|
|
142
142
|
namespace proto {
|
|
143
|
-
type ITransaction = import("@
|
|
144
|
-
type ISignedTransaction = import("@
|
|
145
|
-
type TransactionBody = import("@
|
|
146
|
-
type ITransactionBody = import("@
|
|
147
|
-
type ITransactionResponse = import("@
|
|
148
|
-
type IEthereumTransactionBody = import("@
|
|
149
|
-
type IAccountID = import("@
|
|
143
|
+
type ITransaction = import("@hiero-ledger/proto").proto.ITransaction;
|
|
144
|
+
type ISignedTransaction = import("@hiero-ledger/proto").proto.ISignedTransaction;
|
|
145
|
+
type TransactionBody = import("@hiero-ledger/proto").proto.TransactionBody;
|
|
146
|
+
type ITransactionBody = import("@hiero-ledger/proto").proto.ITransactionBody;
|
|
147
|
+
type ITransactionResponse = import("@hiero-ledger/proto").proto.ITransactionResponse;
|
|
148
|
+
type IEthereumTransactionBody = import("@hiero-ledger/proto").proto.IEthereumTransactionBody;
|
|
149
|
+
type IAccountID = import("@hiero-ledger/proto").proto.IAccountID;
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
export type BigNumber = import("bignumber.js").default;
|