protected override TransactionForRpc Handle(BlockParameter block, int positionIndex, IWeb3EthApi api)
        {
            if (api.TryGetDeltaWithCid(block, out var delta))
            {
                return(api.ToTransactionForRpc(delta, positionIndex));
            }

            return(default);
Exemple #2
0
        protected override long?Handle(BlockParameter block, IWeb3EthApi api)
        {
            if (api.TryGetDeltaWithCid(block, out var delta))
            {
                return(delta.Delta.PublicEntries.Count);
            }

            return(default);
Exemple #3
0
        protected override byte[] Handle(TransactionForRpc transactionCall, BlockParameter block, IWeb3EthApi api)
        {
            if (api.TryGetDeltaWithCid(block, out var deltaWithCid))
            {
                var callOutputTracer = api.CallAndRestore(transactionCall, deltaWithCid);

                return(callOutputTracer.ReturnValue);
            }

            throw new InvalidOperationException($"Delta not found: '{block}'");
        }
        protected override UInt256 Handle(Address address, BlockParameter block, IWeb3EthApi api)
        {
            if (api.TryGetDeltaWithCid(block, out var deltaWithCid))
            {
                Keccak  stateRoot = deltaWithCid.Delta.StateRoot.ToKeccak();
                Account account   = api.StateReader.GetAccount(stateRoot, address);
                return(account?.Nonce ?? 0);
            }

            throw new InvalidOperationException($"Delta not found: '{block}'");
        }
        protected override byte[] Handle(Address address, UInt256 index, BlockParameter block, IWeb3EthApi api)
        {
            if (api.TryGetDeltaWithCid(block, out var deltaWithCid))
            {
                var stateRoot = deltaWithCid.Delta.StateRoot.ToKeccak();

                if (api.StateReader.GetAccount(stateRoot, address) == null)
                {
                    return(new byte[0]);
                }

                api.StateProvider.StateRoot = stateRoot;
                return(api.StorageProvider.Get(new StorageCell(address, index)));
            }

            throw new InvalidOperationException($"Delta not found: '{block}'");
        }