dequanto 0.2.37 → 0.2.40
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/hardhat.config.js +10 -1
- package/lib/cjs/abi/$abiCoder.js +1 -1
- package/lib/cjs/abi/$abiCoder.js.map +1 -1
- package/lib/cjs/abi/Logger.js +1 -1
- package/lib/cjs/abi/abi-coder-packed.js +3 -3
- package/lib/cjs/abi/abi-coder.js +16 -16
- package/lib/cjs/abi/coders/abstract-coder.js +31 -31
- package/lib/cjs/abi/coders/abstract-coder.js.map +1 -1
- package/lib/cjs/abi/fragments.js +90 -90
- package/lib/cjs/abi/fragments.js.map +1 -1
- package/lib/cjs/blocks/BlockDateResolver.js +9 -9
- package/lib/cjs/blocks/BlockDateResolver.js.map +1 -1
- package/lib/cjs/class/PackedRanges.js +46 -46
- package/lib/cjs/class/PackedRanges.js.map +1 -1
- package/lib/cjs/clients/ClientEventsStream.js +1 -1
- package/lib/cjs/clients/ClientEventsStream.js.map +1 -1
- package/lib/cjs/clients/ClientPool.js +23 -23
- package/lib/cjs/clients/ClientPool.js.map +1 -1
- package/lib/cjs/clients/WalletClient.js +3 -3
- package/lib/cjs/clients/WalletClient.js.map +1 -1
- package/lib/cjs/clients/Web3Client.js +14 -14
- package/lib/cjs/clients/Web3Client.js.map +1 -1
- package/lib/cjs/clients/Web3ClientFactory.js +1 -1
- package/lib/cjs/clients/Web3ClientFactory.js.map +1 -1
- package/lib/cjs/clients/compatibility/Web3.js +2 -2
- package/lib/cjs/clients/compatibility/Web3.js.map +1 -1
- package/lib/cjs/clients/handlers/RateLimitGuard.js +16 -16
- package/lib/cjs/clients/handlers/RateLimitGuard.js.map +1 -1
- package/lib/cjs/clients/model/PromiEventWrap.js +1 -1
- package/lib/cjs/clients/model/PromiEventWrap.js.map +1 -1
- package/lib/cjs/clients/utils/$web3Abi.js +2 -2
- package/lib/cjs/clients/utils/$web3Abi.js.map +1 -1
- package/lib/cjs/clients/utils/ClientErrorUtil.js +4 -0
- package/lib/cjs/clients/utils/ClientErrorUtil.js.map +1 -1
- package/lib/cjs/config/Config.js.map +1 -1
- package/lib/cjs/contracts/Contract.js +1 -1
- package/lib/cjs/contracts/Contract.js.map +1 -1
- package/lib/cjs/contracts/ContractAbiProvider.js +6 -6
- package/lib/cjs/contracts/ContractAbiProvider.js.map +1 -1
- package/lib/cjs/contracts/ContractBase.js +10 -10
- package/lib/cjs/contracts/ContractBase.js.map +1 -1
- package/lib/cjs/contracts/ContractProvider.js +1 -1
- package/lib/cjs/contracts/ContractProvider.js.map +1 -1
- package/lib/cjs/contracts/ContractReader.js +5 -5
- package/lib/cjs/contracts/ContractReader.js.map +1 -1
- package/lib/cjs/contracts/ContractWriter.js +4 -4
- package/lib/cjs/contracts/ContractWriter.js.map +1 -1
- package/lib/cjs/contracts/deploy/ContractDeployer.js +4 -4
- package/lib/cjs/contracts/deploy/ContractDeployer.js.map +1 -1
- package/lib/cjs/contracts/deploy/Deployments.js +68 -26
- package/lib/cjs/contracts/deploy/Deployments.js.map +1 -1
- package/lib/cjs/contracts/deploy/proxy/$proxyDeploy.js +13 -13
- package/lib/cjs/contracts/deploy/proxy/$proxyDeploy.js.map +1 -1
- package/lib/cjs/contracts/deploy/proxy/ProxyDeployment.js +58 -25
- package/lib/cjs/contracts/deploy/proxy/ProxyDeployment.js.map +1 -1
- package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js +15 -14
- package/lib/cjs/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
- package/lib/cjs/contracts/utils/AbiDeserializer.js +4 -4
- package/lib/cjs/contracts/utils/AbiDeserializer.js.map +1 -1
- package/lib/cjs/contracts/utils/ContractBaseUtils.js +3 -3
- package/lib/cjs/contracts/utils/ContractBaseUtils.js.map +1 -1
- package/lib/cjs/evm/OpcodesWalker.js +1 -1
- package/lib/cjs/evm/OpcodesWalker.js.map +1 -1
- package/lib/cjs/explorer/BlockchainExplorer.js +1 -1
- package/lib/cjs/explorer/BlockchainExplorer.js.map +1 -1
- package/lib/cjs/explorer/BlockchainExplorerFactory.js +1 -1
- package/lib/cjs/explorer/BlockchainExplorerStorage.js +12 -12
- package/lib/cjs/explorer/BlockchainExplorerStorage.js.map +1 -1
- package/lib/cjs/explorer/Evmscan.js +1 -1
- package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js +7 -7
- package/lib/cjs/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
- package/lib/cjs/flashbots/FlashbotWeb3Client.js +1 -1
- package/lib/cjs/flashbots/FlashbotWeb3Client.js.map +1 -1
- package/lib/cjs/gen/Generator.js +15 -0
- package/lib/cjs/gen/Generator.js.map +1 -1
- package/lib/cjs/hardhat/HardhatProvider.js +7 -7
- package/lib/cjs/hardhat/HardhatProvider.js.map +1 -1
- package/lib/cjs/indexer/BlocksTxIndexer.js +2 -2
- package/lib/cjs/indexer/BlocksTxIndexer.js.map +1 -1
- package/lib/cjs/indexer/EventsIndexer.js +11 -11
- package/lib/cjs/indexer/EventsIndexer.js.map +1 -1
- package/lib/cjs/indexer/PendingTxIndexer.js +2 -2
- package/lib/cjs/indexer/PendingTxIndexer.js.map +1 -1
- package/lib/cjs/indexer/handlers/BlocksWalker.js +9 -9
- package/lib/cjs/indexer/handlers/BlocksWalker.js.map +1 -1
- package/lib/cjs/indexer/handlers/TxQueueLoader.js +1 -1
- package/lib/cjs/indexer/storage/FsEventsIndexerStore.js +3 -3
- package/lib/cjs/indexer/storage/FsEventsIndexerStore.js.map +1 -1
- package/lib/cjs/indexer/storage/FsEventsStoreUtils.js +1 -1
- package/lib/cjs/indexer/storage/FsEventsStoreUtils.js.map +1 -1
- package/lib/cjs/json/JsonArrayMultiStore.js +1 -1
- package/lib/cjs/json/JsonArrayMultiStore.js.map +1 -1
- package/lib/cjs/json/JsonStoreFs.js +1 -1
- package/lib/cjs/json/JsonStoreFs.js.map +1 -1
- package/lib/cjs/rpc/$rpc.js +2 -2
- package/lib/cjs/rpc/$rpc.js.map +1 -1
- package/lib/cjs/rpc/Rpc.js +2 -2
- package/lib/cjs/rpc/RpcBase.js +2 -2
- package/lib/cjs/rpc/RpcBase.js.map +1 -1
- package/lib/cjs/rpc/RpcContract.js +4 -3
- package/lib/cjs/rpc/RpcContract.js.map +1 -1
- package/lib/cjs/rpc/RpcSubscription.js +1 -1
- package/lib/cjs/rpc/RpcSubscription.js.map +1 -1
- package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js +4 -4
- package/lib/cjs/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
- package/lib/cjs/rpc/transports/compatibility/Web3Transport.js +1 -1
- package/lib/cjs/rpc/transports/compatibility/Web3Transport.js.map +1 -1
- package/lib/cjs/services/TimelockService/TimelockService.js +2 -2
- package/lib/cjs/services/TimelockService/TimelockServiceFallbackSafe.js +2 -2
- package/lib/cjs/solidity/SlotsDump.js +1 -1
- package/lib/cjs/solidity/SlotsDump.js.map +1 -1
- package/lib/cjs/solidity/SlotsParser/MappingSettersResolver.js +3 -3
- package/lib/cjs/solidity/SlotsParser/MappingSettersResolver.js.map +1 -1
- package/lib/cjs/solidity/SlotsParser/SourceFile.js +3 -3
- package/lib/cjs/solidity/SlotsParser/SourceFile.js.map +1 -1
- package/lib/cjs/solidity/SolidityParser.js +1 -1
- package/lib/cjs/solidity/SolidityParser.js.map +1 -1
- package/lib/cjs/solidity/SourceCodeProvider.js +1 -1
- package/lib/cjs/solidity/SourceCodeProvider.js.map +1 -1
- package/lib/cjs/solidity/storage/Accessor.js +1 -1
- package/lib/cjs/solidity/storage/Accessor.js.map +1 -1
- package/lib/cjs/solidity/storage/SlotFixedArray.js +1 -1
- package/lib/cjs/solidity/storage/SlotFixedArray.js.map +1 -1
- package/lib/cjs/solidity/storage/SlotsStorageTransport.js +3 -3
- package/lib/cjs/solidity/storage/SlotsStorageTransport.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotBytesHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotBytesHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotDynamicArrayHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotDynamicArrayHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotFixedArrayHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotFixedArrayHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueConstantHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueConstantHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueHandler.js +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueHandler.js.map +1 -1
- package/lib/cjs/solidity/storage/handlers/SlotValueImmutableHandler.js +4 -4
- package/lib/cjs/solidity/storage/handlers/SlotValueImmutableHandler.js.map +1 -1
- package/lib/cjs/tokens/TokenDataProvider.js +2 -2
- package/lib/cjs/tokens/TokenDataProvider.js.map +1 -1
- package/lib/cjs/tokens/TokenExchangeService.js +1 -1
- package/lib/cjs/tokens/TokenExchangeService.js.map +1 -1
- package/lib/cjs/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js +2 -2
- package/lib/cjs/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js.map +1 -1
- package/lib/cjs/tokens/TokenExchanges/AmmV2PriceQuote.js +2 -2
- package/lib/cjs/tokens/TokenExchanges/AmmV2PriceQuote.js.map +1 -1
- package/lib/cjs/tokens/TokenOracles/amm/AmmV1Oracle.js +2 -2
- package/lib/cjs/tokens/TokenOracles/amm/AmmV1Oracle.js.map +1 -1
- package/lib/cjs/tokens/TokenTransferService.js +2 -2
- package/lib/cjs/tokens/TokenTransferService.js.map +1 -1
- package/lib/cjs/tokens/TokensService.js +1 -1
- package/lib/cjs/tokens/TokensService.js.map +1 -1
- package/lib/cjs/txs/TxNonceManager.js +1 -1
- package/lib/cjs/txs/TxWriter.js +9 -0
- package/lib/cjs/txs/TxWriter.js.map +1 -1
- package/lib/cjs/txs/conditional/GasWatcherTx.js +1 -1
- package/lib/cjs/txs/conditional/GasWatcherTx.js.map +1 -1
- package/lib/cjs/txs/receipt/TxLogParser.js +1 -1
- package/lib/cjs/utils/$crypto.js +1 -1
- package/lib/cjs/utils/$crypto.js.map +1 -1
- package/lib/cjs/utils/$date.js +1 -1
- package/lib/cjs/utils/$date.js.map +1 -1
- package/lib/cjs/utils/$hex.js +1 -1
- package/lib/cjs/utils/$logger.js +1 -1
- package/lib/cjs/utils/$logger.js.map +1 -1
- package/lib/cjs/utils/$machine.js +2 -2
- package/lib/cjs/utils/$machine.js.map +1 -1
- package/lib/cjs/utils/$traces.js +1 -1
- package/lib/cjs/utils/$traces.js.map +1 -1
- package/lib/esm/abi/$abiCoder.js.map +1 -1
- package/lib/esm/abi/$abiCoder.mjs +1 -1
- package/lib/esm/abi/Logger.mjs +1 -1
- package/lib/esm/abi/abi-coder-packed.mjs +3 -3
- package/lib/esm/abi/abi-coder.mjs +16 -16
- package/lib/esm/abi/coders/abstract-coder.js.map +1 -1
- package/lib/esm/abi/coders/abstract-coder.mjs +31 -31
- package/lib/esm/abi/fragments.js.map +1 -1
- package/lib/esm/abi/fragments.mjs +90 -90
- package/lib/esm/blocks/BlockDateResolver.js.map +1 -1
- package/lib/esm/blocks/BlockDateResolver.mjs +9 -9
- package/lib/esm/class/PackedRanges.js.map +1 -1
- package/lib/esm/class/PackedRanges.mjs +46 -46
- package/lib/esm/clients/ClientEventsStream.js.map +1 -1
- package/lib/esm/clients/ClientEventsStream.mjs +1 -1
- package/lib/esm/clients/ClientPool.js.map +1 -1
- package/lib/esm/clients/ClientPool.mjs +23 -23
- package/lib/esm/clients/WalletClient.js.map +1 -1
- package/lib/esm/clients/WalletClient.mjs +3 -3
- package/lib/esm/clients/Web3Client.js.map +1 -1
- package/lib/esm/clients/Web3Client.mjs +14 -14
- package/lib/esm/clients/Web3ClientFactory.js.map +1 -1
- package/lib/esm/clients/Web3ClientFactory.mjs +1 -1
- package/lib/esm/clients/compatibility/Web3.js.map +1 -1
- package/lib/esm/clients/compatibility/Web3.mjs +2 -2
- package/lib/esm/clients/handlers/RateLimitGuard.js.map +1 -1
- package/lib/esm/clients/handlers/RateLimitGuard.mjs +16 -16
- package/lib/esm/clients/model/PromiEventWrap.js.map +1 -1
- package/lib/esm/clients/model/PromiEventWrap.mjs +1 -1
- package/lib/esm/clients/utils/$web3Abi.js.map +1 -1
- package/lib/esm/clients/utils/$web3Abi.mjs +2 -2
- package/lib/esm/clients/utils/ClientErrorUtil.js.map +1 -1
- package/lib/esm/clients/utils/ClientErrorUtil.mjs +4 -0
- package/lib/esm/config/Config.js.map +1 -1
- package/lib/esm/contracts/Contract.js.map +1 -1
- package/lib/esm/contracts/Contract.mjs +1 -1
- package/lib/esm/contracts/ContractAbiProvider.js.map +1 -1
- package/lib/esm/contracts/ContractAbiProvider.mjs +6 -6
- package/lib/esm/contracts/ContractBase.js.map +1 -1
- package/lib/esm/contracts/ContractBase.mjs +10 -10
- package/lib/esm/contracts/ContractProvider.js.map +1 -1
- package/lib/esm/contracts/ContractProvider.mjs +1 -1
- package/lib/esm/contracts/ContractReader.js.map +1 -1
- package/lib/esm/contracts/ContractReader.mjs +5 -5
- package/lib/esm/contracts/ContractWriter.js.map +1 -1
- package/lib/esm/contracts/ContractWriter.mjs +4 -4
- package/lib/esm/contracts/deploy/ContractDeployer.js.map +1 -1
- package/lib/esm/contracts/deploy/ContractDeployer.mjs +4 -4
- package/lib/esm/contracts/deploy/Deployments.js.map +1 -1
- package/lib/esm/contracts/deploy/Deployments.mjs +68 -26
- package/lib/esm/contracts/deploy/proxy/$proxyDeploy.js.map +1 -1
- package/lib/esm/contracts/deploy/proxy/$proxyDeploy.mjs +13 -13
- package/lib/esm/contracts/deploy/proxy/ProxyDeployment.js.map +1 -1
- package/lib/esm/contracts/deploy/proxy/ProxyDeployment.mjs +58 -25
- package/lib/esm/contracts/deploy/storage/DeploymentsStorage.js.map +1 -1
- package/lib/esm/contracts/deploy/storage/DeploymentsStorage.mjs +15 -14
- package/lib/esm/contracts/utils/AbiDeserializer.js.map +1 -1
- package/lib/esm/contracts/utils/AbiDeserializer.mjs +4 -4
- package/lib/esm/contracts/utils/ContractBaseUtils.js.map +1 -1
- package/lib/esm/contracts/utils/ContractBaseUtils.mjs +3 -3
- package/lib/esm/evm/OpcodesWalker.js.map +1 -1
- package/lib/esm/evm/OpcodesWalker.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorer.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorer.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorerFactory.mjs +1 -1
- package/lib/esm/explorer/BlockchainExplorerStorage.js.map +1 -1
- package/lib/esm/explorer/BlockchainExplorerStorage.mjs +12 -12
- package/lib/esm/explorer/Evmscan.mjs +1 -1
- package/lib/esm/explorer/verifiers/FsHtmlVerifier.js.map +1 -1
- package/lib/esm/explorer/verifiers/FsHtmlVerifier.mjs +7 -7
- package/lib/esm/flashbots/FlashbotWeb3Client.js.map +1 -1
- package/lib/esm/flashbots/FlashbotWeb3Client.mjs +1 -1
- package/lib/esm/gen/Generator.js.map +1 -1
- package/lib/esm/gen/Generator.mjs +15 -0
- package/lib/esm/hardhat/HardhatProvider.js.map +1 -1
- package/lib/esm/hardhat/HardhatProvider.mjs +7 -7
- package/lib/esm/indexer/BlocksTxIndexer.js.map +1 -1
- package/lib/esm/indexer/BlocksTxIndexer.mjs +2 -2
- package/lib/esm/indexer/EventsIndexer.js.map +1 -1
- package/lib/esm/indexer/EventsIndexer.mjs +11 -11
- package/lib/esm/indexer/PendingTxIndexer.js.map +1 -1
- package/lib/esm/indexer/PendingTxIndexer.mjs +2 -2
- package/lib/esm/indexer/handlers/BlocksWalker.js.map +1 -1
- package/lib/esm/indexer/handlers/BlocksWalker.mjs +9 -9
- package/lib/esm/indexer/handlers/TxQueueLoader.mjs +1 -1
- package/lib/esm/indexer/storage/FsEventsIndexerStore.js.map +1 -1
- package/lib/esm/indexer/storage/FsEventsIndexerStore.mjs +3 -3
- package/lib/esm/indexer/storage/FsEventsStoreUtils.js.map +1 -1
- package/lib/esm/indexer/storage/FsEventsStoreUtils.mjs +1 -1
- package/lib/esm/json/JsonArrayMultiStore.js.map +1 -1
- package/lib/esm/json/JsonArrayMultiStore.mjs +1 -1
- package/lib/esm/json/JsonStoreFs.js.map +1 -1
- package/lib/esm/json/JsonStoreFs.mjs +1 -1
- package/lib/esm/rpc/$rpc.js.map +1 -1
- package/lib/esm/rpc/$rpc.mjs +2 -2
- package/lib/esm/rpc/Rpc.mjs +2 -2
- package/lib/esm/rpc/RpcBase.js.map +1 -1
- package/lib/esm/rpc/RpcBase.mjs +2 -2
- package/lib/esm/rpc/RpcContract.js.map +1 -1
- package/lib/esm/rpc/RpcContract.mjs +4 -3
- package/lib/esm/rpc/RpcSubscription.js.map +1 -1
- package/lib/esm/rpc/RpcSubscription.mjs +1 -1
- package/lib/esm/rpc/transports/compatibility/EIP1193Transport.js.map +1 -1
- package/lib/esm/rpc/transports/compatibility/EIP1193Transport.mjs +4 -4
- package/lib/esm/rpc/transports/compatibility/Web3Transport.js.map +1 -1
- package/lib/esm/rpc/transports/compatibility/Web3Transport.mjs +1 -1
- package/lib/esm/services/TimelockService/TimelockService.mjs +2 -2
- package/lib/esm/services/TimelockService/TimelockServiceFallbackSafe.mjs +2 -2
- package/lib/esm/solidity/SlotsDump.js.map +1 -1
- package/lib/esm/solidity/SlotsDump.mjs +1 -1
- package/lib/esm/solidity/SlotsParser/MappingSettersResolver.js.map +1 -1
- package/lib/esm/solidity/SlotsParser/MappingSettersResolver.mjs +3 -3
- package/lib/esm/solidity/SlotsParser/SourceFile.js.map +1 -1
- package/lib/esm/solidity/SlotsParser/SourceFile.mjs +3 -3
- package/lib/esm/solidity/SolidityParser.js.map +1 -1
- package/lib/esm/solidity/SolidityParser.mjs +1 -1
- package/lib/esm/solidity/SourceCodeProvider.js.map +1 -1
- package/lib/esm/solidity/SourceCodeProvider.mjs +1 -1
- package/lib/esm/solidity/storage/Accessor.js.map +1 -1
- package/lib/esm/solidity/storage/Accessor.mjs +1 -1
- package/lib/esm/solidity/storage/SlotFixedArray.js.map +1 -1
- package/lib/esm/solidity/storage/SlotFixedArray.mjs +1 -1
- package/lib/esm/solidity/storage/SlotsStorageTransport.js.map +1 -1
- package/lib/esm/solidity/storage/SlotsStorageTransport.mjs +3 -3
- package/lib/esm/solidity/storage/handlers/SlotBytesHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotBytesHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotDynamicArrayHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotDynamicArrayHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotFixedArrayHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotFixedArrayHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueConstantHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueConstantHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueHandler.mjs +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueImmutableHandler.js.map +1 -1
- package/lib/esm/solidity/storage/handlers/SlotValueImmutableHandler.mjs +4 -4
- package/lib/esm/tokens/TokenDataProvider.js.map +1 -1
- package/lib/esm/tokens/TokenDataProvider.mjs +2 -2
- package/lib/esm/tokens/TokenExchangeService.js.map +1 -1
- package/lib/esm/tokens/TokenExchangeService.mjs +1 -1
- package/lib/esm/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.js.map +1 -1
- package/lib/esm/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.mjs +2 -2
- package/lib/esm/tokens/TokenExchanges/AmmV2PriceQuote.js.map +1 -1
- package/lib/esm/tokens/TokenExchanges/AmmV2PriceQuote.mjs +2 -2
- package/lib/esm/tokens/TokenOracles/amm/AmmV1Oracle.js.map +1 -1
- package/lib/esm/tokens/TokenOracles/amm/AmmV1Oracle.mjs +2 -2
- package/lib/esm/tokens/TokenTransferService.js.map +1 -1
- package/lib/esm/tokens/TokenTransferService.mjs +2 -2
- package/lib/esm/tokens/TokensService.js.map +1 -1
- package/lib/esm/tokens/TokensService.mjs +1 -1
- package/lib/esm/txs/TxNonceManager.mjs +1 -1
- package/lib/esm/txs/TxWriter.js.map +1 -1
- package/lib/esm/txs/TxWriter.mjs +9 -0
- package/lib/esm/txs/conditional/GasWatcherTx.js.map +1 -1
- package/lib/esm/txs/conditional/GasWatcherTx.mjs +1 -1
- package/lib/esm/txs/receipt/TxLogParser.mjs +1 -1
- package/lib/esm/utils/$crypto.js.map +1 -1
- package/lib/esm/utils/$crypto.mjs +1 -1
- package/lib/esm/utils/$date.js.map +1 -1
- package/lib/esm/utils/$date.mjs +1 -1
- package/lib/esm/utils/$hex.mjs +1 -1
- package/lib/esm/utils/$logger.js.map +1 -1
- package/lib/esm/utils/$logger.mjs +1 -1
- package/lib/esm/utils/$machine.js.map +1 -1
- package/lib/esm/utils/$machine.mjs +2 -2
- package/lib/esm/utils/$traces.js.map +1 -1
- package/lib/esm/utils/$traces.mjs +1 -1
- package/lib/types/abi/abi-coder-packed.d.ts +1 -1
- package/lib/types/abi/abi-coder.d.ts +13 -13
- package/lib/types/abi/coders/abstract-coder.d.ts +14 -14
- package/lib/types/abi/fragments.d.ts +95 -95
- package/lib/types/blocks/BlockDateResolver.d.ts +7 -7
- package/lib/types/class/PackedRanges.d.ts +44 -44
- package/lib/types/clients/ClientPool.d.ts +10 -10
- package/lib/types/clients/WalletClient.d.ts +2 -2
- package/lib/types/clients/Web3Client.d.ts +6 -6
- package/lib/types/clients/Web3ClientFactory.d.ts +1 -1
- package/lib/types/clients/handlers/RateLimitGuard.d.ts +5 -5
- package/lib/types/clients/model/PromiEventWrap.d.ts +1 -1
- package/lib/types/clients/utils/$web3Abi.d.ts +1 -1
- package/lib/types/clients/utils/ClientErrorUtil.d.ts +1 -0
- package/lib/types/config/Config.d.ts +3 -2
- package/lib/types/contracts/ContractBase.d.ts +4 -4
- package/lib/types/contracts/ContractReader.d.ts +2 -2
- package/lib/types/contracts/ContractWriter.d.ts +3 -3
- package/lib/types/contracts/deploy/Deployments.d.ts +20 -15
- package/lib/types/contracts/deploy/proxy/ProxyDeployment.d.ts +2 -0
- package/lib/types/contracts/deploy/storage/DeploymentsStorage.d.ts +2 -0
- package/lib/types/explorer/BlockchainExplorerFactory.d.ts +1 -1
- package/lib/types/explorer/Evmscan.d.ts +1 -1
- package/lib/types/gen/Generator.d.ts +8 -0
- package/lib/types/indexer/BlocksTxIndexer.d.ts +4 -4
- package/lib/types/indexer/EventsIndexer.d.ts +4 -4
- package/lib/types/indexer/PendingTxIndexer.d.ts +1 -1
- package/lib/types/indexer/handlers/BlocksWalker.d.ts +2 -2
- package/lib/types/indexer/storage/FsEventsIndexerStore.d.ts +4 -4
- package/lib/types/ns/providers/INsProvider.d.ts +1 -1
- package/lib/types/rpc/Rpc.d.ts +2 -2
- package/lib/types/services/TimelockService/ITimelockService.d.ts +2 -2
- package/lib/types/services/TimelockService/TimelockService.d.ts +2 -2
- package/lib/types/services/TimelockService/TimelockServiceFallbackSafe.d.ts +2 -2
- package/lib/types/solidity/SlotsParser/SourceFile.d.ts +1 -1
- package/lib/types/solidity/storage/SlotFixedArray.d.ts +1 -1
- package/lib/types/tokens/TokenDataProvider.d.ts +2 -2
- package/lib/types/tokens/TokensService.d.ts +1 -1
- package/lib/types/txs/ITxBuilderOptions.d.ts +1 -1
- package/lib/types/txs/TxNonceManager.d.ts +1 -1
- package/lib/types/txs/TxWriter.d.ts +4 -4
- package/lib/types/txs/receipt/TxLogParser.d.ts +1 -1
- package/lib/types/utils/$date.d.ts +1 -1
- package/lib/types/utils/$hex.d.ts +1 -1
- package/package.json +1 -1
- package/readme.md +105 -83
- package/src/abi/$abiCoder.ts +1 -1
- package/src/abi/Logger.ts +1 -1
- package/src/abi/abi-coder-packed.ts +3 -3
- package/src/abi/abi-coder.ts +16 -16
- package/src/abi/coders/abstract-coder.ts +36 -36
- package/src/abi/fragments.ts +137 -137
- package/src/blocks/BlockDateResolver.ts +9 -9
- package/src/bridges/hop/HopBridge.ts +1 -1
- package/src/class/PackedRanges.ts +46 -46
- package/src/clients/ClientEventsStream.ts +1 -1
- package/src/clients/ClientPool.ts +38 -38
- package/src/clients/WalletClient.ts +3 -3
- package/src/clients/Web3BatchRequests.ts +3 -3
- package/src/clients/Web3Client.ts +21 -21
- package/src/clients/Web3ClientFactory.ts +1 -1
- package/src/clients/compatibility/Web3.ts +2 -2
- package/src/clients/handlers/RateLimitGuard.ts +16 -16
- package/src/clients/interfaces/IWeb3Client.ts +2 -2
- package/src/clients/model/PromiEventWrap.ts +1 -1
- package/src/clients/utils/$web3Abi.ts +2 -2
- package/src/clients/utils/ClientErrorUtil.ts +4 -0
- package/src/config/Config.ts +4 -3
- package/src/contracts/Contract.ts +1 -1
- package/src/contracts/ContractAbiProvider.ts +6 -6
- package/src/contracts/ContractBase.ts +14 -14
- package/src/contracts/ContractProvider.ts +1 -1
- package/src/contracts/ContractReader.ts +7 -7
- package/src/contracts/ContractWriter.ts +4 -4
- package/src/contracts/deploy/ContractDeployer.ts +4 -4
- package/src/contracts/deploy/ContractDeployment.ts +1 -1
- package/src/contracts/deploy/Deployments.ts +110 -53
- package/src/contracts/deploy/proxy/$proxyDeploy.ts +14 -14
- package/src/contracts/deploy/proxy/ProxyDeployment.ts +82 -37
- package/src/contracts/deploy/storage/DeploymentsStorage.ts +21 -18
- package/src/contracts/utils/AbiDeserializer.ts +4 -4
- package/src/contracts/utils/ContractBaseUtils.ts +3 -3
- package/src/erc4337/models/UserOperation.ts +2 -2
- package/src/evm/OpcodesWalker.ts +1 -1
- package/src/explorer/BlockchainExplorer.ts +1 -1
- package/src/explorer/BlockchainExplorerFactory.ts +1 -1
- package/src/explorer/BlockchainExplorerStorage.ts +12 -12
- package/src/explorer/Evmscan.ts +1 -1
- package/src/explorer/verifiers/FsHtmlVerifier.ts +7 -7
- package/src/flashbots/FlashbotWeb3Client.ts +1 -1
- package/src/gen/Generator.ts +17 -0
- package/src/hardhat/HardhatProvider.ts +7 -7
- package/src/indexer/BlocksTxIndexer.ts +6 -6
- package/src/indexer/EventsIndexer.ts +20 -20
- package/src/indexer/PendingTxIndexer.ts +3 -3
- package/src/indexer/handlers/BlocksWalker.ts +9 -9
- package/src/indexer/handlers/TxQueueLoader.ts +1 -1
- package/src/indexer/storage/FsEventsIndexerStore.ts +9 -9
- package/src/indexer/storage/FsEventsMetaStore.ts +1 -1
- package/src/indexer/storage/FsEventsStoreUtils.ts +1 -1
- package/src/json/JsonArrayMultiStore.ts +1 -1
- package/src/json/JsonStoreFs.ts +1 -1
- package/src/ns/providers/INsProvider.ts +1 -1
- package/src/rpc/$rpc.ts +2 -2
- package/src/rpc/Rpc.ts +2 -2
- package/src/rpc/RpcBase.ts +2 -2
- package/src/rpc/RpcContract.ts +6 -6
- package/src/rpc/RpcSubscription.ts +1 -1
- package/src/rpc/transports/compatibility/EIP1193Transport.ts +4 -4
- package/src/rpc/transports/compatibility/Web3Transport.ts +1 -1
- package/src/services/TimelockService/ITimelockService.ts +2 -2
- package/src/services/TimelockService/TimelockService.ts +2 -2
- package/src/services/TimelockService/TimelockServiceFallbackSafe.ts +2 -2
- package/src/solidity/SlotsDump.ts +1 -1
- package/src/solidity/SlotsParser/MappingSettersResolver.ts +3 -3
- package/src/solidity/SlotsParser/SourceFile.ts +3 -3
- package/src/solidity/SolidityParser.ts +1 -1
- package/src/solidity/SourceCodeProvider.ts +1 -1
- package/src/solidity/storage/Accessor.spec.ts +1 -1
- package/src/solidity/storage/Accessor.ts +1 -1
- package/src/solidity/storage/SlotDynamicArray.ts +1 -1
- package/src/solidity/storage/SlotFixedArray.ts +1 -1
- package/src/solidity/storage/SlotsStorageTransport.ts +3 -3
- package/src/solidity/storage/handlers/SlotBytesHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotDynamicArrayHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotFixedArrayHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotValueConstantHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotValueHandler.ts +1 -1
- package/src/solidity/storage/handlers/SlotValueImmutableHandler.ts +4 -4
- package/src/tokens/TokenDataProvider.ts +2 -2
- package/src/tokens/TokenExchangeService.ts +1 -1
- package/src/tokens/TokenExchanges/AmmBase/V2/AmmPairV2Service.ts +2 -2
- package/src/tokens/TokenExchanges/AmmV2PriceQuote.ts +2 -2
- package/src/tokens/TokenOracles/amm/AmmV1Oracle.ts +2 -2
- package/src/tokens/TokenTransferService.ts +2 -2
- package/src/tokens/TokensService.ts +1 -1
- package/src/txs/ITxBuilderOptions.ts +1 -1
- package/src/txs/TxNonceManager.ts +1 -1
- package/src/txs/TxWriter.ts +15 -4
- package/src/txs/agents/BatchAgent.ts +1 -1
- package/src/txs/conditional/GasWatcherTx.ts +1 -1
- package/src/txs/receipt/TxLogParser.ts +1 -1
- package/src/utils/$crypto.ts +1 -1
- package/src/utils/$date.ts +1 -1
- package/src/utils/$hex.ts +1 -1
- package/src/utils/$logger.ts +1 -1
- package/src/utils/$machine.ts +2 -2
- package/src/utils/$traces.ts +1 -1
- package/src/wallets/EIP6963ProviderFactory.ts +4 -4
package/src/abi/fragments.ts
CHANGED
|
@@ -18,41 +18,41 @@ import { $require } from '@dequanto/utils/$require';
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* A Type description in a [JSON ABI format](link-solc-jsonabi)
|
|
21
|
+
* A Type description in a [JSON ABI format](link-solc-jsonabi)
|
|
22
22
|
*/
|
|
23
23
|
export interface JsonFragmentType {
|
|
24
24
|
/**
|
|
25
|
-
* The parameter name
|
|
25
|
+
* The parameter name
|
|
26
26
|
*/
|
|
27
27
|
readonly name?: string;
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* If the parameter is indexed
|
|
30
|
+
* If the parameter is indexed
|
|
31
31
|
*/
|
|
32
32
|
readonly indexed?: boolean;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* The type of the parameter
|
|
35
|
+
* The type of the parameter
|
|
36
36
|
*/
|
|
37
37
|
readonly type?: string;
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* The internal Solidity type
|
|
40
|
+
* The internal Solidity type
|
|
41
41
|
*/
|
|
42
42
|
readonly internalType?: string;
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
|
-
* The components for a tuple
|
|
45
|
+
* The components for a tuple
|
|
46
46
|
*/
|
|
47
47
|
readonly components?: ReadonlyArray<JsonFragmentType>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi)
|
|
51
|
+
* A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi)
|
|
52
52
|
*/
|
|
53
53
|
export interface JsonFragment {
|
|
54
54
|
/**
|
|
55
|
-
* The name of the error, event, function, etc
|
|
55
|
+
* The name of the error, event, function, etc
|
|
56
56
|
*/
|
|
57
57
|
readonly name?: string;
|
|
58
58
|
|
|
@@ -62,56 +62,56 @@ export interface JsonFragment {
|
|
|
62
62
|
readonly type?: string;
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* If the event is anonymous
|
|
65
|
+
* If the event is anonymous
|
|
66
66
|
*/
|
|
67
67
|
readonly anonymous?: boolean;
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
|
-
* If the function is payable
|
|
70
|
+
* If the function is payable
|
|
71
71
|
*/
|
|
72
72
|
readonly payable?: boolean;
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
|
-
* If the function is constant
|
|
75
|
+
* If the function is constant
|
|
76
76
|
*/
|
|
77
77
|
readonly constant?: boolean;
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* The mutability state of the function
|
|
80
|
+
* The mutability state of the function
|
|
81
81
|
*/
|
|
82
82
|
readonly stateMutability?: string;
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* The input parameters
|
|
85
|
+
* The input parameters
|
|
86
86
|
*/
|
|
87
87
|
readonly inputs?: ReadonlyArray<JsonFragmentType>;
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* The output parameters
|
|
90
|
+
* The output parameters
|
|
91
91
|
*/
|
|
92
92
|
readonly outputs?: ReadonlyArray<JsonFragmentType>;
|
|
93
93
|
|
|
94
94
|
/**
|
|
95
|
-
* The gas limit to use when sending a transaction for this function
|
|
95
|
+
* The gas limit to use when sending a transaction for this function
|
|
96
96
|
*/
|
|
97
97
|
readonly gas?: string;
|
|
98
98
|
};
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
|
-
* The format to serialize the output as
|
|
101
|
+
* The format to serialize the output as
|
|
102
102
|
*
|
|
103
103
|
* **``"sighash"``** - the bare formatting, used to compute the selector
|
|
104
104
|
* or topic hash; this format cannot be reversed (as it discards ``indexed``)
|
|
105
|
-
* so cannot
|
|
105
|
+
* so it cannot be used to export an [[Interface]]
|
|
106
106
|
*
|
|
107
107
|
* **``"minimal"``** - Human-Readable ABI with minimal spacing and without
|
|
108
108
|
* names, so it is compact, but will result in Result objects that cannot
|
|
109
|
-
* be accessed by name
|
|
109
|
+
* be accessed by name
|
|
110
110
|
*
|
|
111
111
|
* **``"full"``** - Full Human-Readable ABI, with readable spacing and names
|
|
112
|
-
* intact; this is generally the recommended format
|
|
112
|
+
* intact; this is generally the recommended format
|
|
113
113
|
*
|
|
114
|
-
* **``"json"``** - The [JSON ABI format](link-solc-jsonabi)
|
|
114
|
+
* **``"json"``** - The [JSON ABI format](link-solc-jsonabi)
|
|
115
115
|
*/
|
|
116
116
|
export type FormatType = "sighash" | "minimal" | "full" | "json";
|
|
117
117
|
|
|
@@ -125,7 +125,7 @@ function setify(items: Array<string>): ReadonlySet<string> {
|
|
|
125
125
|
const _kwVisibDeploy = "external public payable";
|
|
126
126
|
const KwVisibDeploy = setify(_kwVisibDeploy.split(" "));
|
|
127
127
|
|
|
128
|
-
// Visibility
|
|
128
|
+
// Visibility keywords
|
|
129
129
|
const _kwVisib = "constant external internal payable private public pure view";
|
|
130
130
|
const KwVisib = setify(_kwVisib.split(" "));
|
|
131
131
|
|
|
@@ -137,11 +137,11 @@ const KwModifiers = setify(_kwModifiers.split(" "));
|
|
|
137
137
|
|
|
138
138
|
const _kwOther = "tuple returns";
|
|
139
139
|
|
|
140
|
-
// All
|
|
140
|
+
// All keywords
|
|
141
141
|
const _keywords = [ _kwTypes, _kwModifiers, _kwOther, _kwVisib ].join(" ");
|
|
142
142
|
const Keywords = setify(_keywords.split(" "));
|
|
143
143
|
|
|
144
|
-
// Single
|
|
144
|
+
// Single-character tokens
|
|
145
145
|
const SimpleTokens: Record<string, string> = {
|
|
146
146
|
"(": "OPEN_PAREN", ")": "CLOSE_PAREN",
|
|
147
147
|
"[": "OPEN_BRACKET", "]": "CLOSE_BRACKET",
|
|
@@ -153,7 +153,7 @@ const regexWhitespacePrefix = new RegExp("^(\\s*)");
|
|
|
153
153
|
const regexNumberPrefix = new RegExp("^([0-9]+)");
|
|
154
154
|
const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)");
|
|
155
155
|
|
|
156
|
-
// Parser
|
|
156
|
+
// Parser regexes to check validity
|
|
157
157
|
const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$");
|
|
158
158
|
const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$");
|
|
159
159
|
|
|
@@ -161,7 +161,7 @@ const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))
|
|
|
161
161
|
* @ignore:
|
|
162
162
|
*/
|
|
163
163
|
type Token = Readonly<{
|
|
164
|
-
// Type of token (e.g. TYPE, KEYWORD, NUMBER, etc)
|
|
164
|
+
// Type of token (e.g. TYPE, KEYWORD, NUMBER, etc.)
|
|
165
165
|
type: string;
|
|
166
166
|
|
|
167
167
|
// Offset into the original source code
|
|
@@ -173,15 +173,15 @@ type Token = Readonly<{
|
|
|
173
173
|
// The parenthesis depth
|
|
174
174
|
depth: number;
|
|
175
175
|
|
|
176
|
-
// If a parenthesis, the offset (in tokens) that balances it
|
|
176
|
+
// If this is a parenthesis, the offset (in tokens) that balances it
|
|
177
177
|
match: number;
|
|
178
178
|
|
|
179
|
-
// For
|
|
179
|
+
// For parentheses and commas, the offset (in tokens) to the
|
|
180
180
|
// previous/next parenthesis or comma in the list
|
|
181
181
|
linkBack: number;
|
|
182
182
|
linkNext: number;
|
|
183
183
|
|
|
184
|
-
// If a BRACKET, the value inside
|
|
184
|
+
// If this is a BRACKET, the value inside
|
|
185
185
|
value: number;
|
|
186
186
|
}>;
|
|
187
187
|
|
|
@@ -210,7 +210,7 @@ class TokenString {
|
|
|
210
210
|
}));
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
// Pops and returns the value of the next token
|
|
213
|
+
// Pops and returns the value of the next token if it is a keyword in `allowed`; throws if out of tokens
|
|
214
214
|
popKeyword(allowed: ReadonlySet<string>): string {
|
|
215
215
|
const top = this.peek();
|
|
216
216
|
if (top.type !== "KEYWORD" || !allowed.has(top.text)) { throw new Error(`expected keyword ${ top.text }`); }
|
|
@@ -223,7 +223,7 @@ class TokenString {
|
|
|
223
223
|
return this.pop().text;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
// Pops and returns
|
|
226
|
+
// Pops and returns "(" TOKENS ")"
|
|
227
227
|
popParen(): TokenString {
|
|
228
228
|
const top = this.peek();
|
|
229
229
|
if (top.type !== "OPEN_PAREN") { throw new Error("bad start"); }
|
|
@@ -251,7 +251,7 @@ class TokenString {
|
|
|
251
251
|
return result;
|
|
252
252
|
}
|
|
253
253
|
|
|
254
|
-
// Returns the top
|
|
254
|
+
// Returns the top token, throwing if out of tokens
|
|
255
255
|
peek(): Token {
|
|
256
256
|
if (this.#offset >= this.#tokens.length) {
|
|
257
257
|
throw new Error("out-of-bounds");
|
|
@@ -259,7 +259,7 @@ class TokenString {
|
|
|
259
259
|
return this.#tokens[this.#offset];
|
|
260
260
|
}
|
|
261
261
|
|
|
262
|
-
// Returns the next value
|
|
262
|
+
// Returns the next value if it is a keyword in `allowed`
|
|
263
263
|
peekKeyword(allowed: ReadonlySet<string>): null | string {
|
|
264
264
|
const top = this.peekType("KEYWORD");
|
|
265
265
|
return (top != null && allowed.has(top)) ? top: null;
|
|
@@ -394,7 +394,7 @@ function lex(text: string): TokenString {
|
|
|
394
394
|
return new TokenString(tokens.map((t) => Object.freeze(t)));
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
// Check only one
|
|
397
|
+
// Check that only one item from `allowed` is in `set`
|
|
398
398
|
function allowSingle(set: ReadonlySet<string>, allowed: ReadonlySet<string>): void {
|
|
399
399
|
let included: Array<string> = [ ];
|
|
400
400
|
for (const key in allowed.keys()) {
|
|
@@ -403,7 +403,7 @@ function allowSingle(set: ReadonlySet<string>, allowed: ReadonlySet<string>): vo
|
|
|
403
403
|
if (included.length > 1) { throw new Error(`conflicting types: ${ included.join(", ") }`); }
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
// Functions to process a Solidity
|
|
406
|
+
// Functions to process a Solidity signature TokenString from left to right for..
|
|
407
407
|
|
|
408
408
|
// ...the name with an optional type, returning the name
|
|
409
409
|
function consumeName(type: string, tokens: TokenString): string {
|
|
@@ -417,7 +417,7 @@ function consumeName(type: string, tokens: TokenString): string {
|
|
|
417
417
|
return tokens.popType("ID");
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
// ...all keywords matching allowed
|
|
420
|
+
// ...all keywords matching `allowed`, returning the keywords
|
|
421
421
|
function consumeKeywords(tokens: TokenString, allowed?: ReadonlySet<string>): ReadonlySet<string> {
|
|
422
422
|
const keywords: Set<string> = new Set();
|
|
423
423
|
while (true) {
|
|
@@ -465,7 +465,7 @@ function consumeGas(tokens: TokenString): null | bigint {
|
|
|
465
465
|
if (tokens.peekType("NUMBER")) {
|
|
466
466
|
return $bigint.toBigInt(tokens.pop().text);
|
|
467
467
|
}
|
|
468
|
-
throw new Error("
|
|
468
|
+
throw new Error("Invalid gas");
|
|
469
469
|
}
|
|
470
470
|
return null;
|
|
471
471
|
}
|
|
@@ -480,19 +480,19 @@ const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/);
|
|
|
480
480
|
|
|
481
481
|
function verifyBasicType(type: string): string {
|
|
482
482
|
const match = type.match(regexType);
|
|
483
|
-
$require.notNull(match, `
|
|
483
|
+
$require.notNull(match, `Invalid type ${type}`);
|
|
484
484
|
if (type === "uint") { return "uint256"; }
|
|
485
485
|
if (type === "int") { return "int256"; }
|
|
486
486
|
|
|
487
487
|
if (match[2]) {
|
|
488
488
|
// bytesXX
|
|
489
489
|
const length = parseInt(match[2]);
|
|
490
|
-
$require.True(length !== 0 && length <= 32, "
|
|
490
|
+
$require.True(length !== 0 && length <= 32, "Invalid bytes length" + type);
|
|
491
491
|
|
|
492
492
|
} else if (match[3]) {
|
|
493
493
|
// intXX or uintXX
|
|
494
494
|
const size = parseInt(match[3] as string);
|
|
495
|
-
$require.True(size !== 0 && size <= 256 && (size % 8) === 0, "
|
|
495
|
+
$require.True(size !== 0 && size <= 256 && (size % 8) === 0, "Invalid numeric width" + type);
|
|
496
496
|
}
|
|
497
497
|
|
|
498
498
|
return type;
|
|
@@ -504,13 +504,13 @@ const _guard = { };
|
|
|
504
504
|
|
|
505
505
|
/**
|
|
506
506
|
* When [walking](ParamType-walk) a [[ParamType]], this is called
|
|
507
|
-
* on each component
|
|
507
|
+
* on each component
|
|
508
508
|
*/
|
|
509
509
|
export type ParamTypeWalkFunc = (type: string, value: any) => any;
|
|
510
510
|
|
|
511
511
|
/**
|
|
512
512
|
* When [walking asynchronously](ParamType-walkAsync) a [[ParamType]],
|
|
513
|
-
* this is called on each component
|
|
513
|
+
* this is called on each component
|
|
514
514
|
*/
|
|
515
515
|
export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;
|
|
516
516
|
|
|
@@ -524,7 +524,7 @@ export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise
|
|
|
524
524
|
// const StructFragmentInternal = "_StructInternal";
|
|
525
525
|
|
|
526
526
|
/**
|
|
527
|
-
* Each input and output of a [[Fragment]] is an Array of **ParamType
|
|
527
|
+
* Each input and output of a [[Fragment]] is an Array of **ParamType**
|
|
528
528
|
*/
|
|
529
529
|
export class ParamType {
|
|
530
530
|
|
|
@@ -545,30 +545,30 @@ export class ParamType {
|
|
|
545
545
|
readonly baseType!: string;
|
|
546
546
|
|
|
547
547
|
/**
|
|
548
|
-
* True if the
|
|
548
|
+
* True if the parameter is indexed
|
|
549
549
|
*
|
|
550
|
-
* For non-indexable types this is ``null
|
|
550
|
+
* For non-indexable types this is ``null``
|
|
551
551
|
*/
|
|
552
552
|
readonly indexed!: null | boolean;
|
|
553
553
|
|
|
554
554
|
/**
|
|
555
|
-
* The components for the tuple
|
|
555
|
+
* The components for the tuple
|
|
556
556
|
*
|
|
557
|
-
* For non-tuple types this is ``null
|
|
557
|
+
* For non-tuple types this is ``null``
|
|
558
558
|
*/
|
|
559
559
|
readonly components?: ReadonlyArray<ParamType>;
|
|
560
560
|
|
|
561
561
|
/**
|
|
562
|
-
* The array length, or ``-1`` for dynamic-
|
|
562
|
+
* The array length, or ``-1`` for dynamic-length arrays
|
|
563
563
|
*
|
|
564
|
-
* For non-array types this is ``null
|
|
564
|
+
* For non-array types this is ``null``
|
|
565
565
|
*/
|
|
566
566
|
readonly arrayLength?: number;
|
|
567
567
|
|
|
568
568
|
/**
|
|
569
|
-
* The type of each child in the array
|
|
569
|
+
* The type of each child in the array
|
|
570
570
|
*
|
|
571
|
-
* For non-array types this is ``null
|
|
571
|
+
* For non-array types this is ``null``
|
|
572
572
|
*/
|
|
573
573
|
readonly arrayChildren?: ParamType;
|
|
574
574
|
|
|
@@ -616,7 +616,7 @@ export class ParamType {
|
|
|
616
616
|
}
|
|
617
617
|
|
|
618
618
|
/**
|
|
619
|
-
* Return a string representation of this type
|
|
619
|
+
* Return a string representation of this type
|
|
620
620
|
*
|
|
621
621
|
* For example,
|
|
622
622
|
*
|
|
@@ -680,30 +680,30 @@ export class ParamType {
|
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
/**
|
|
683
|
-
* Returns true if %%this%% is an Array type
|
|
683
|
+
* Returns true if %%this%% is an Array type
|
|
684
684
|
*
|
|
685
685
|
* This provides a type gaurd ensuring that [[arrayChildren]]
|
|
686
|
-
* and [[arrayLength]] are non-null
|
|
686
|
+
* and [[arrayLength]] are non-null
|
|
687
687
|
*/
|
|
688
688
|
isArray(): this is (ParamType & { arrayChildren: ParamType, arrayLength: number }) {
|
|
689
689
|
return (this.baseType === "array")
|
|
690
690
|
}
|
|
691
691
|
|
|
692
692
|
/**
|
|
693
|
-
* Returns true if %%this%% is a Tuple type
|
|
693
|
+
* Returns true if %%this%% is a Tuple type
|
|
694
694
|
*
|
|
695
695
|
* This provides a type gaurd ensuring that [[components]]
|
|
696
|
-
* is non-null
|
|
696
|
+
* is non-null
|
|
697
697
|
*/
|
|
698
698
|
isTuple(): this is (ParamType & { components: ReadonlyArray<ParamType> }) {
|
|
699
699
|
return (this.baseType === "tuple");
|
|
700
700
|
}
|
|
701
701
|
|
|
702
702
|
/**
|
|
703
|
-
* Returns true if %%this%% is an Indexable type
|
|
703
|
+
* Returns true if %%this%% is an Indexable type
|
|
704
704
|
*
|
|
705
705
|
* This provides a type gaurd ensuring that [[indexed]]
|
|
706
|
-
* is non-null
|
|
706
|
+
* is non-null
|
|
707
707
|
*/
|
|
708
708
|
isIndexable(): this is (ParamType & { indexed: boolean }) {
|
|
709
709
|
return (this.indexed != null);
|
|
@@ -711,22 +711,22 @@ export class ParamType {
|
|
|
711
711
|
|
|
712
712
|
/**
|
|
713
713
|
* Walks the **ParamType** with %%value%%, calling %%process%%
|
|
714
|
-
* on each type, destructing the %%value%% recursively
|
|
714
|
+
* on each type, destructing the %%value%% recursively
|
|
715
715
|
*/
|
|
716
716
|
walk(value: any, process: ParamTypeWalkFunc): any {
|
|
717
717
|
if (this.isArray()) {
|
|
718
|
-
if (!Array.isArray(value)) { throw new Error("
|
|
718
|
+
if (!Array.isArray(value)) { throw new Error("Invalid array value"); }
|
|
719
719
|
if (this.arrayLength !== -1 && value.length !== this.arrayLength) {
|
|
720
|
-
throw new Error("
|
|
720
|
+
throw new Error("Array has the wrong length");
|
|
721
721
|
}
|
|
722
722
|
const _this = this;
|
|
723
723
|
return value.map((v) => (_this.arrayChildren.walk(v, process)));
|
|
724
724
|
}
|
|
725
725
|
|
|
726
726
|
if (this.isTuple()) {
|
|
727
|
-
if (!Array.isArray(value)) { throw new Error("
|
|
727
|
+
if (!Array.isArray(value)) { throw new Error("Invalid tuple value"); }
|
|
728
728
|
if (value.length !== this.components.length) {
|
|
729
|
-
throw new Error("
|
|
729
|
+
throw new Error("Array has the wrong length");
|
|
730
730
|
}
|
|
731
731
|
const _this = this;
|
|
732
732
|
return value.map((v, i) => (_this.components[i].walk(v, process)));
|
|
@@ -738,9 +738,9 @@ export class ParamType {
|
|
|
738
738
|
#walkAsync(promises: Array<Promise<void>>, value: any, process: ParamTypeWalkAsyncFunc, setValue: (value: any) => void): void {
|
|
739
739
|
|
|
740
740
|
if (this.isArray()) {
|
|
741
|
-
if (!Array.isArray(value)) { throw new Error("
|
|
741
|
+
if (!Array.isArray(value)) { throw new Error("Invalid array value"); }
|
|
742
742
|
if (this.arrayLength !== -1 && value.length !== this.arrayLength) {
|
|
743
|
-
throw new Error("
|
|
743
|
+
throw new Error("Array has the wrong length");
|
|
744
744
|
}
|
|
745
745
|
const childType = this.arrayChildren;
|
|
746
746
|
|
|
@@ -764,20 +764,20 @@ export class ParamType {
|
|
|
764
764
|
|
|
765
765
|
} else {
|
|
766
766
|
if (value == null || typeof(value) !== "object") {
|
|
767
|
-
throw new Error("
|
|
767
|
+
throw new Error("Invalid tuple value");
|
|
768
768
|
}
|
|
769
769
|
|
|
770
770
|
result = components.map((param) => {
|
|
771
|
-
if (!param.name) { throw new Error("
|
|
771
|
+
if (!param.name) { throw new Error("Cannot use object value with unnamed components"); }
|
|
772
772
|
if (!(param.name in value)) {
|
|
773
|
-
throw new Error(`
|
|
773
|
+
throw new Error(`Missing value for component ${ param.name }`);
|
|
774
774
|
}
|
|
775
775
|
return value[param.name];
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
778
|
|
|
779
779
|
if (result.length !== this.components.length) {
|
|
780
|
-
throw new Error("
|
|
780
|
+
throw new Error("Array has the wrong length");
|
|
781
781
|
}
|
|
782
782
|
|
|
783
783
|
result.forEach((value, index) => {
|
|
@@ -799,10 +799,10 @@ export class ParamType {
|
|
|
799
799
|
|
|
800
800
|
/**
|
|
801
801
|
* Walks the **ParamType** with %%value%%, asynchronously calling
|
|
802
|
-
* %%process%% on each type, destructing the %%value%% recursively
|
|
802
|
+
* %%process%% on each type, destructing the %%value%% recursively
|
|
803
803
|
*
|
|
804
804
|
* This can be used to resolve ENS naes by walking and resolving each
|
|
805
|
-
* ``"address"`` type
|
|
805
|
+
* ``"address"`` type
|
|
806
806
|
*/
|
|
807
807
|
async walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise<any> {
|
|
808
808
|
const promises: Array<Promise<void>> = [ ];
|
|
@@ -815,10 +815,10 @@ export class ParamType {
|
|
|
815
815
|
}
|
|
816
816
|
|
|
817
817
|
/**
|
|
818
|
-
* Creates a new **ParamType** for %%obj
|
|
818
|
+
* Creates a new **ParamType** for %%obj%%
|
|
819
819
|
*
|
|
820
820
|
* If %%allowIndexed%% then the ``indexed`` keyword is permitted,
|
|
821
|
-
* otherwise the ``indexed`` keyword will throw an error
|
|
821
|
+
* otherwise the ``indexed`` keyword will throw an error
|
|
822
822
|
*/
|
|
823
823
|
static from(obj: any, allowIndexed?: boolean): ParamType {
|
|
824
824
|
if (ParamType.isParamType(obj)) { return obj; }
|
|
@@ -827,7 +827,7 @@ export class ParamType {
|
|
|
827
827
|
try {
|
|
828
828
|
return ParamType.from(lex(obj), allowIndexed);
|
|
829
829
|
} catch (error) {
|
|
830
|
-
throw new Error(`
|
|
830
|
+
throw new Error(`Invalid parameter type: ${ error.message }`);
|
|
831
831
|
}
|
|
832
832
|
|
|
833
833
|
} else if (obj instanceof TokenString) {
|
|
@@ -867,17 +867,17 @@ export class ParamType {
|
|
|
867
867
|
|
|
868
868
|
const name = (obj.peekType("ID") ? obj.pop().text: "");
|
|
869
869
|
|
|
870
|
-
if (obj.length) { throw new Error("
|
|
870
|
+
if (obj.length) { throw new Error("Leftover tokens"); }
|
|
871
871
|
|
|
872
872
|
return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
const name = obj.name;
|
|
876
|
-
$require.True(!name || (typeof(name) === "string" && regexId.test(name)), "
|
|
876
|
+
$require.True(!name || (typeof(name) === "string" && regexId.test(name)), "Invalid name" + name);
|
|
877
877
|
|
|
878
878
|
let indexed = obj.indexed;
|
|
879
879
|
if (indexed != null) {
|
|
880
|
-
$require.True(allowIndexed ?? true, `
|
|
880
|
+
$require.True(allowIndexed ?? true, `Parameter cannot be indexed: ${obj.indexed}`);
|
|
881
881
|
indexed = !!indexed;
|
|
882
882
|
}
|
|
883
883
|
|
|
@@ -897,7 +897,7 @@ export class ParamType {
|
|
|
897
897
|
if (type === "tuple" || type.startsWith("tuple("/* fix: ) */) || type.startsWith("(" /* fix: ) */)) {
|
|
898
898
|
const comps = (obj.components != null) ? obj.components.map((c: any) => ParamType.from(c)): null;
|
|
899
899
|
const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null);
|
|
900
|
-
// @TODO:
|
|
900
|
+
// @TODO: Use the lexer to validate and normalize type
|
|
901
901
|
return tuple;
|
|
902
902
|
}
|
|
903
903
|
|
|
@@ -907,7 +907,7 @@ export class ParamType {
|
|
|
907
907
|
}
|
|
908
908
|
|
|
909
909
|
/**
|
|
910
|
-
* Returns true if %%value%% is a **ParamType
|
|
910
|
+
* Returns true if %%value%% is a **ParamType**
|
|
911
911
|
*/
|
|
912
912
|
static isParamType(value: any): value is ParamType {
|
|
913
913
|
return (value instanceof ParamType)//value[internal] === ParamTypeInternal);
|
|
@@ -915,21 +915,21 @@ export class ParamType {
|
|
|
915
915
|
}
|
|
916
916
|
|
|
917
917
|
/**
|
|
918
|
-
* The type of a [[Fragment]]
|
|
918
|
+
* The type of a [[Fragment]]
|
|
919
919
|
*/
|
|
920
920
|
export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct";
|
|
921
921
|
|
|
922
922
|
/**
|
|
923
|
-
* An abstract class to represent An individual fragment from a parse ABI
|
|
923
|
+
* An abstract class to represent An individual fragment from a parse ABI
|
|
924
924
|
*/
|
|
925
925
|
export abstract class Fragment {
|
|
926
926
|
/**
|
|
927
|
-
* The type of the fragment
|
|
927
|
+
* The type of the fragment
|
|
928
928
|
*/
|
|
929
929
|
readonly type!: FragmentType;
|
|
930
930
|
|
|
931
931
|
/**
|
|
932
|
-
* The inputs for the fragment
|
|
932
|
+
* The inputs for the fragment
|
|
933
933
|
*/
|
|
934
934
|
readonly inputs!: ReadonlyArray<ParamType>;
|
|
935
935
|
|
|
@@ -945,18 +945,18 @@ export abstract class Fragment {
|
|
|
945
945
|
}
|
|
946
946
|
|
|
947
947
|
/**
|
|
948
|
-
* Returns a string representation of this fragment as %%format
|
|
948
|
+
* Returns a string representation of this fragment as %%format%%
|
|
949
949
|
*/
|
|
950
950
|
abstract format(format?: FormatType): string;
|
|
951
951
|
|
|
952
952
|
/**
|
|
953
|
-
* Creates a new **Fragment** for %%obj%%,
|
|
954
|
-
* ABI
|
|
953
|
+
* Creates a new **Fragment** for %%obj%%, which can be any supported
|
|
954
|
+
* ABI fragment type
|
|
955
955
|
*/
|
|
956
956
|
static from(obj: any): Fragment {
|
|
957
957
|
if (typeof(obj) === "string") {
|
|
958
958
|
|
|
959
|
-
// Try parsing JSON
|
|
959
|
+
// Try parsing JSON..
|
|
960
960
|
try {
|
|
961
961
|
Fragment.from(JSON.parse(obj));
|
|
962
962
|
} catch (e) { }
|
|
@@ -995,39 +995,39 @@ export abstract class Fragment {
|
|
|
995
995
|
|
|
996
996
|
throw new Error(`UNSUPPORTED_OPERATION: unsupported type: ${ obj.type }`);
|
|
997
997
|
}
|
|
998
|
-
throw new Error("unsupported
|
|
998
|
+
throw new Error("unsupported fragment object: " + JSON.stringify(obj));
|
|
999
999
|
}
|
|
1000
1000
|
|
|
1001
1001
|
/**
|
|
1002
|
-
* Returns true if %%value%% is a [[ConstructorFragment]]
|
|
1002
|
+
* Returns true if %%value%% is a [[ConstructorFragment]]
|
|
1003
1003
|
*/
|
|
1004
1004
|
static isConstructor(value: any): value is ConstructorFragment {
|
|
1005
1005
|
return ConstructorFragment.isFragment(value);
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
1008
|
/**
|
|
1009
|
-
* Returns true if %%value%% is an [[ErrorFragment]]
|
|
1009
|
+
* Returns true if %%value%% is an [[ErrorFragment]]
|
|
1010
1010
|
*/
|
|
1011
1011
|
static isError(value: any): value is ErrorFragment {
|
|
1012
1012
|
return ErrorFragment.isFragment(value);
|
|
1013
1013
|
}
|
|
1014
1014
|
|
|
1015
1015
|
/**
|
|
1016
|
-
* Returns true if %%value%% is an [[EventFragment]]
|
|
1016
|
+
* Returns true if %%value%% is an [[EventFragment]]
|
|
1017
1017
|
*/
|
|
1018
1018
|
static isEvent(value: any): value is EventFragment {
|
|
1019
1019
|
return EventFragment.isFragment(value);
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
/**
|
|
1023
|
-
* Returns true if %%value%% is a [[FunctionFragment]]
|
|
1023
|
+
* Returns true if %%value%% is a [[FunctionFragment]]
|
|
1024
1024
|
*/
|
|
1025
1025
|
static isFunction(value: any): value is FunctionFragment {
|
|
1026
1026
|
return FunctionFragment.isFragment(value);
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
/**
|
|
1030
|
-
* Returns true if %%value%% is a [[StructFragment]]
|
|
1030
|
+
* Returns true if %%value%% is a [[StructFragment]]
|
|
1031
1031
|
*/
|
|
1032
1032
|
static isStruct(value: any): value is StructFragment {
|
|
1033
1033
|
return StructFragment.isFragment(value);
|
|
@@ -1036,11 +1036,11 @@ export abstract class Fragment {
|
|
|
1036
1036
|
|
|
1037
1037
|
/**
|
|
1038
1038
|
* An abstract class to represent An individual fragment
|
|
1039
|
-
* which has a name from a parse ABI
|
|
1039
|
+
* which has a name from a parse ABI
|
|
1040
1040
|
*/
|
|
1041
1041
|
export abstract class NamedFragment extends Fragment {
|
|
1042
1042
|
/**
|
|
1043
|
-
* The name of the fragment
|
|
1043
|
+
* The name of the fragment
|
|
1044
1044
|
*/
|
|
1045
1045
|
readonly name!: string;
|
|
1046
1046
|
|
|
@@ -1049,7 +1049,7 @@ export abstract class NamedFragment extends Fragment {
|
|
|
1049
1049
|
*/
|
|
1050
1050
|
constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray<ParamType>) {
|
|
1051
1051
|
super(guard, type, inputs);
|
|
1052
|
-
$require.True(typeof(name) === "string" && regexId.test(name), "
|
|
1052
|
+
$require.True(typeof(name) === "string" && regexId.test(name), "Invalid identifier " + name);
|
|
1053
1053
|
//-inputs = Object.freeze(inputs.slice());
|
|
1054
1054
|
this.name = name;
|
|
1055
1055
|
}
|
|
@@ -1060,7 +1060,7 @@ function joinParams(format: FormatType, params: ReadonlyArray<ParamType>): strin
|
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
1062
|
/**
|
|
1063
|
-
* A Fragment which represents a //Custom Error
|
|
1063
|
+
* A Fragment which represents a //Custom Error//
|
|
1064
1064
|
*/
|
|
1065
1065
|
export class ErrorFragment extends NamedFragment {
|
|
1066
1066
|
/**
|
|
@@ -1072,14 +1072,14 @@ export class ErrorFragment extends NamedFragment {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
|
|
1074
1074
|
/**
|
|
1075
|
-
* The Custom Error selector
|
|
1075
|
+
* The Custom Error selector
|
|
1076
1076
|
*/
|
|
1077
1077
|
get selector(): string {
|
|
1078
1078
|
return $contract.keccak256(this.format("sighash")).substring(0, 10);
|
|
1079
1079
|
}
|
|
1080
1080
|
|
|
1081
1081
|
/**
|
|
1082
|
-
* Returns a string representation of this fragment as %%format
|
|
1082
|
+
* Returns a string representation of this fragment as %%format%%
|
|
1083
1083
|
*/
|
|
1084
1084
|
format(format?: FormatType): string {
|
|
1085
1085
|
if (format == null) { format = "sighash"; }
|
|
@@ -1098,7 +1098,7 @@ export class ErrorFragment extends NamedFragment {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
|
|
1100
1100
|
/**
|
|
1101
|
-
* Returns a new **ErrorFragment** for %%obj
|
|
1101
|
+
* Returns a new **ErrorFragment** for %%obj%%
|
|
1102
1102
|
*/
|
|
1103
1103
|
static from(obj: any): ErrorFragment {
|
|
1104
1104
|
if (ErrorFragment.isFragment(obj)) { return obj; }
|
|
@@ -1120,7 +1120,7 @@ export class ErrorFragment extends NamedFragment {
|
|
|
1120
1120
|
|
|
1121
1121
|
/**
|
|
1122
1122
|
* Returns ``true`` and provides a type guard if %%value%% is an
|
|
1123
|
-
* **ErrorFragment
|
|
1123
|
+
* **ErrorFragment**
|
|
1124
1124
|
*/
|
|
1125
1125
|
static isFragment(value: any): value is ErrorFragment {
|
|
1126
1126
|
return (value instanceof ErrorFragment); //[internal] === ErrorFragmentInternal);
|
|
@@ -1128,11 +1128,11 @@ export class ErrorFragment extends NamedFragment {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
1130
1130
|
/**
|
|
1131
|
-
* A Fragment which represents an Event
|
|
1131
|
+
* A Fragment which represents an Event
|
|
1132
1132
|
*/
|
|
1133
1133
|
export class EventFragment extends NamedFragment {
|
|
1134
1134
|
/**
|
|
1135
|
-
* Whether this event is anonymous
|
|
1135
|
+
* Whether this event is anonymous
|
|
1136
1136
|
*/
|
|
1137
1137
|
readonly anonymous!: boolean;
|
|
1138
1138
|
|
|
@@ -1146,14 +1146,14 @@ export class EventFragment extends NamedFragment {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
|
|
1148
1148
|
/**
|
|
1149
|
-
* The Event topic hash
|
|
1149
|
+
* The Event topic hash
|
|
1150
1150
|
*/
|
|
1151
1151
|
get topicHash(): string {
|
|
1152
1152
|
return $contract.keccak256(this.format("sighash"));
|
|
1153
1153
|
}
|
|
1154
1154
|
|
|
1155
1155
|
/**
|
|
1156
|
-
* Returns a string representation of this event as %%format
|
|
1156
|
+
* Returns a string representation of this event as %%format%%
|
|
1157
1157
|
*/
|
|
1158
1158
|
format(format?: FormatType): string {
|
|
1159
1159
|
if (format == null) { format = "sighash"; }
|
|
@@ -1174,7 +1174,7 @@ export class EventFragment extends NamedFragment {
|
|
|
1174
1174
|
}
|
|
1175
1175
|
|
|
1176
1176
|
/**
|
|
1177
|
-
* Return the topic hash for an event with %%name%% and %%params
|
|
1177
|
+
* Return the topic hash for an event with %%name%% and %%params%%
|
|
1178
1178
|
*/
|
|
1179
1179
|
static getTopicHash(name: string, params?: Array<any>): string {
|
|
1180
1180
|
params = (params || []).map((p) => ParamType.from(p));
|
|
@@ -1183,7 +1183,7 @@ export class EventFragment extends NamedFragment {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
1185
|
/**
|
|
1186
|
-
* Returns a new **EventFragment** for %%obj
|
|
1186
|
+
* Returns a new **EventFragment** for %%obj%%
|
|
1187
1187
|
*/
|
|
1188
1188
|
static from(obj: any): EventFragment {
|
|
1189
1189
|
if (EventFragment.isFragment(obj)) { return obj; }
|
|
@@ -1192,7 +1192,7 @@ export class EventFragment extends NamedFragment {
|
|
|
1192
1192
|
try {
|
|
1193
1193
|
return EventFragment.from(lex(obj));
|
|
1194
1194
|
} catch (error) {
|
|
1195
|
-
throw new Error("
|
|
1195
|
+
throw new Error("Invalid event fragment: " + JSON.stringify(obj));
|
|
1196
1196
|
}
|
|
1197
1197
|
|
|
1198
1198
|
} else if (obj instanceof TokenString) {
|
|
@@ -1210,7 +1210,7 @@ export class EventFragment extends NamedFragment {
|
|
|
1210
1210
|
|
|
1211
1211
|
/**
|
|
1212
1212
|
* Returns ``true`` and provides a type guard if %%value%% is an
|
|
1213
|
-
* **EventFragment
|
|
1213
|
+
* **EventFragment**
|
|
1214
1214
|
*/
|
|
1215
1215
|
static isFragment(value: any): value is EventFragment {
|
|
1216
1216
|
return (value instanceof EventFragment); //[internal] === EventFragmentInternal);
|
|
@@ -1218,17 +1218,17 @@ export class EventFragment extends NamedFragment {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
1220
1220
|
/**
|
|
1221
|
-
* A Fragment which represents a constructor
|
|
1221
|
+
* A Fragment which represents a constructor
|
|
1222
1222
|
*/
|
|
1223
1223
|
export class ConstructorFragment extends Fragment {
|
|
1224
1224
|
|
|
1225
1225
|
/**
|
|
1226
|
-
* Whether the constructor can receive an endowment
|
|
1226
|
+
* Whether the constructor can receive an endowment
|
|
1227
1227
|
*/
|
|
1228
1228
|
readonly payable!: boolean;
|
|
1229
1229
|
|
|
1230
1230
|
/**
|
|
1231
|
-
* The recommended gas limit for deployment or ``null
|
|
1231
|
+
* The recommended gas limit for deployment or ``null``
|
|
1232
1232
|
*/
|
|
1233
1233
|
readonly gas!: null | bigint;
|
|
1234
1234
|
|
|
@@ -1243,7 +1243,7 @@ export class ConstructorFragment extends Fragment {
|
|
|
1243
1243
|
}
|
|
1244
1244
|
|
|
1245
1245
|
/**
|
|
1246
|
-
* Returns a string representation of this constructor as %%format
|
|
1246
|
+
* Returns a string representation of this constructor as %%format%%
|
|
1247
1247
|
*/
|
|
1248
1248
|
format(format?: FormatType): string {
|
|
1249
1249
|
$require.True(format != null && format !== "sighash", "UNSUPPORTED_OPERATION: cannot format a constructor for sighash");
|
|
@@ -1265,7 +1265,7 @@ export class ConstructorFragment extends Fragment {
|
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
1267
|
/**
|
|
1268
|
-
* Returns a new **ConstructorFragment** for %%obj
|
|
1268
|
+
* Returns a new **ConstructorFragment** for %%obj%%
|
|
1269
1269
|
*/
|
|
1270
1270
|
static from(obj: any): ConstructorFragment {
|
|
1271
1271
|
if (ConstructorFragment.isFragment(obj)) { return obj; }
|
|
@@ -1274,7 +1274,7 @@ export class ConstructorFragment extends Fragment {
|
|
|
1274
1274
|
try {
|
|
1275
1275
|
return ConstructorFragment.from(lex(obj));
|
|
1276
1276
|
} catch (error) {
|
|
1277
|
-
throw new Error("
|
|
1277
|
+
throw new Error("Invalid constructor fragment: " + JSON.stringify(obj));
|
|
1278
1278
|
}
|
|
1279
1279
|
|
|
1280
1280
|
} else if (obj instanceof TokenString) {
|
|
@@ -1294,7 +1294,7 @@ export class ConstructorFragment extends Fragment {
|
|
|
1294
1294
|
|
|
1295
1295
|
/**
|
|
1296
1296
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
|
1297
|
-
* **ConstructorFragment
|
|
1297
|
+
* **ConstructorFragment**
|
|
1298
1298
|
*/
|
|
1299
1299
|
static isFragment(value: any): value is ConstructorFragment {
|
|
1300
1300
|
return (value instanceof ConstructorFragment); //[internal] === ConstructorFragmentInternal);
|
|
@@ -1302,12 +1302,12 @@ export class ConstructorFragment extends Fragment {
|
|
|
1302
1302
|
}
|
|
1303
1303
|
|
|
1304
1304
|
/**
|
|
1305
|
-
* A Fragment which represents a method
|
|
1305
|
+
* A Fragment which represents a method
|
|
1306
1306
|
*/
|
|
1307
1307
|
export class FallbackFragment extends Fragment {
|
|
1308
1308
|
|
|
1309
1309
|
/**
|
|
1310
|
-
* If the function can be sent value during invocation
|
|
1310
|
+
* If the function can be sent value during invocation
|
|
1311
1311
|
*/
|
|
1312
1312
|
readonly payable!: boolean;
|
|
1313
1313
|
|
|
@@ -1318,7 +1318,7 @@ export class FallbackFragment extends Fragment {
|
|
|
1318
1318
|
}
|
|
1319
1319
|
|
|
1320
1320
|
/**
|
|
1321
|
-
* Returns a string representation of this fallback as %%format
|
|
1321
|
+
* Returns a string representation of this fallback as %%format%%
|
|
1322
1322
|
*/
|
|
1323
1323
|
format(format?: FormatType): string {
|
|
1324
1324
|
const type = ((this.inputs.length === 0) ? "receive": "fallback");
|
|
@@ -1332,7 +1332,7 @@ export class FallbackFragment extends Fragment {
|
|
|
1332
1332
|
}
|
|
1333
1333
|
|
|
1334
1334
|
/**
|
|
1335
|
-
* Returns a new **FallbackFragment** for %%obj
|
|
1335
|
+
* Returns a new **FallbackFragment** for %%obj%%
|
|
1336
1336
|
*/
|
|
1337
1337
|
static from(obj: any): FallbackFragment {
|
|
1338
1338
|
if (FallbackFragment.isFragment(obj)) { return obj; }
|
|
@@ -1341,14 +1341,14 @@ export class FallbackFragment extends Fragment {
|
|
|
1341
1341
|
try {
|
|
1342
1342
|
return FallbackFragment.from(lex(obj));
|
|
1343
1343
|
} catch (error) {
|
|
1344
|
-
throw new Error("
|
|
1344
|
+
throw new Error("Invalid fallback fragment: " + JSON.stringify(obj));
|
|
1345
1345
|
}
|
|
1346
1346
|
|
|
1347
1347
|
} else if (obj instanceof TokenString) {
|
|
1348
1348
|
const errorObj = obj.toString();
|
|
1349
1349
|
|
|
1350
1350
|
const topIsValid = obj.peekKeyword(setify([ "fallback", "receive" ]));
|
|
1351
|
-
$require.notNull(topIsValid, "
|
|
1351
|
+
$require.notNull(topIsValid, "Type must be fallback or receive " + errorObj);
|
|
1352
1352
|
|
|
1353
1353
|
const type = obj.popKeyword(setify([ "fallback", "receive" ]));
|
|
1354
1354
|
|
|
@@ -1397,12 +1397,12 @@ export class FallbackFragment extends Fragment {
|
|
|
1397
1397
|
return new FallbackFragment(_guard, inputs, payable);
|
|
1398
1398
|
}
|
|
1399
1399
|
|
|
1400
|
-
throw new Error("
|
|
1400
|
+
throw new Error("Invalid fallback fragment: " + JSON.stringify(obj));
|
|
1401
1401
|
}
|
|
1402
1402
|
|
|
1403
1403
|
/**
|
|
1404
1404
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
|
1405
|
-
* **FallbackFragment
|
|
1405
|
+
* **FallbackFragment**
|
|
1406
1406
|
*/
|
|
1407
1407
|
static isFragment(value: any): value is FallbackFragment {
|
|
1408
1408
|
return (value instanceof FallbackFragment); //[internal] === FallbackFragmentInternal);
|
|
@@ -1411,16 +1411,16 @@ export class FallbackFragment extends Fragment {
|
|
|
1411
1411
|
|
|
1412
1412
|
|
|
1413
1413
|
/**
|
|
1414
|
-
* A Fragment which represents a method
|
|
1414
|
+
* A Fragment which represents a method
|
|
1415
1415
|
*/
|
|
1416
1416
|
export class FunctionFragment extends NamedFragment {
|
|
1417
1417
|
/**
|
|
1418
|
-
* If the function is constant (e.g. ``pure`` or ``view`` functions)
|
|
1418
|
+
* If the function is constant (e.g. ``pure`` or ``view`` functions)
|
|
1419
1419
|
*/
|
|
1420
1420
|
readonly constant!: boolean;
|
|
1421
1421
|
|
|
1422
1422
|
/**
|
|
1423
|
-
* The returned types for the result of calling this function
|
|
1423
|
+
* The returned types for the result of calling this function
|
|
1424
1424
|
*/
|
|
1425
1425
|
readonly outputs!: ReadonlyArray<ParamType>;
|
|
1426
1426
|
|
|
@@ -1431,12 +1431,12 @@ export class FunctionFragment extends NamedFragment {
|
|
|
1431
1431
|
readonly stateMutability!: "payable" | "nonpayable" | "view" | "pure";
|
|
1432
1432
|
|
|
1433
1433
|
/**
|
|
1434
|
-
* If the function can be sent value during invocation
|
|
1434
|
+
* If the function can be sent value during invocation
|
|
1435
1435
|
*/
|
|
1436
1436
|
readonly payable!: boolean;
|
|
1437
1437
|
|
|
1438
1438
|
/**
|
|
1439
|
-
* The recommended gas limit to send when calling this function
|
|
1439
|
+
* The recommended gas limit to send when calling this function
|
|
1440
1440
|
*/
|
|
1441
1441
|
readonly gas!: null | bigint;
|
|
1442
1442
|
|
|
@@ -1458,14 +1458,14 @@ export class FunctionFragment extends NamedFragment {
|
|
|
1458
1458
|
}
|
|
1459
1459
|
|
|
1460
1460
|
/**
|
|
1461
|
-
* The Function selector
|
|
1461
|
+
* The Function selector
|
|
1462
1462
|
*/
|
|
1463
1463
|
get selector(): string {
|
|
1464
1464
|
return $contract.keccak256(this.format("sighash")).substring(0, 10);
|
|
1465
1465
|
}
|
|
1466
1466
|
|
|
1467
1467
|
/**
|
|
1468
|
-
* Returns a string representation of this function as %%format
|
|
1468
|
+
* Returns a string representation of this function as %%format%%
|
|
1469
1469
|
*/
|
|
1470
1470
|
format(format?: FormatType): string {
|
|
1471
1471
|
if (format == null) { format = "sighash"; }
|
|
@@ -1504,7 +1504,7 @@ export class FunctionFragment extends NamedFragment {
|
|
|
1504
1504
|
}
|
|
1505
1505
|
|
|
1506
1506
|
/**
|
|
1507
|
-
* Return the selector for a function with %%name%% and %%params
|
|
1507
|
+
* Return the selector for a function with %%name%% and %%params%%
|
|
1508
1508
|
*/
|
|
1509
1509
|
static getSelector(name: string, params?: Array<any>): string {
|
|
1510
1510
|
params = (params || []).map((p) => ParamType.from(p));
|
|
@@ -1513,7 +1513,7 @@ export class FunctionFragment extends NamedFragment {
|
|
|
1513
1513
|
}
|
|
1514
1514
|
|
|
1515
1515
|
/**
|
|
1516
|
-
* Returns a new **FunctionFragment** for %%obj
|
|
1516
|
+
* Returns a new **FunctionFragment** for %%obj%%
|
|
1517
1517
|
*/
|
|
1518
1518
|
static from(obj: any): FunctionFragment {
|
|
1519
1519
|
if (FunctionFragment.isFragment(obj)) { return obj; }
|
|
@@ -1572,7 +1572,7 @@ export class FunctionFragment extends NamedFragment {
|
|
|
1572
1572
|
|
|
1573
1573
|
/**
|
|
1574
1574
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
|
1575
|
-
* **FunctionFragment
|
|
1575
|
+
* **FunctionFragment**
|
|
1576
1576
|
*/
|
|
1577
1577
|
static isFragment(value: any): value is FunctionFragment {
|
|
1578
1578
|
return (value instanceof FunctionFragment); //[internal] === FunctionFragmentInternal);
|
|
@@ -1580,7 +1580,7 @@ export class FunctionFragment extends NamedFragment {
|
|
|
1580
1580
|
}
|
|
1581
1581
|
|
|
1582
1582
|
/**
|
|
1583
|
-
* A Fragment which represents a structure
|
|
1583
|
+
* A Fragment which represents a structure
|
|
1584
1584
|
*/
|
|
1585
1585
|
export class StructFragment extends NamedFragment {
|
|
1586
1586
|
|
|
@@ -1593,14 +1593,14 @@ export class StructFragment extends NamedFragment {
|
|
|
1593
1593
|
}
|
|
1594
1594
|
|
|
1595
1595
|
/**
|
|
1596
|
-
* Returns a string representation of this struct as %%format
|
|
1596
|
+
* Returns a string representation of this struct as %%format%%
|
|
1597
1597
|
*/
|
|
1598
1598
|
format(): string {
|
|
1599
1599
|
throw new Error("@TODO");
|
|
1600
1600
|
}
|
|
1601
1601
|
|
|
1602
1602
|
/**
|
|
1603
|
-
* Returns a new **StructFragment** for %%obj
|
|
1603
|
+
* Returns a new **StructFragment** for %%obj%%
|
|
1604
1604
|
*/
|
|
1605
1605
|
static from(obj: any): StructFragment {
|
|
1606
1606
|
if (typeof(obj) === "string") {
|
|
@@ -1623,7 +1623,7 @@ export class StructFragment extends NamedFragment {
|
|
|
1623
1623
|
// @TODO: fix this return type
|
|
1624
1624
|
/**
|
|
1625
1625
|
* Returns ``true`` and provides a type guard if %%value%% is a
|
|
1626
|
-
* **StructFragment
|
|
1626
|
+
* **StructFragment**
|
|
1627
1627
|
*/
|
|
1628
1628
|
static isFragment(value: any): value is FunctionFragment {
|
|
1629
1629
|
return (value instanceof StructFragment) //[internal] === StructFragmentInternal);
|