Example #1
0
        public UserOperationWithEntryPoint Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            rlpStream.SkipLength();

            UserOperationRpc userOperationRpc = new UserOperationRpc
            {
                Sender               = rlpStream.DecodeAddress() ?? Address.Zero,
                Nonce                = rlpStream.DecodeUInt256(),
                InitCode             = rlpStream.DecodeByteArray(),
                CallData             = rlpStream.DecodeByteArray(),
                CallGas              = rlpStream.DecodeUInt256(),
                VerificationGas      = rlpStream.DecodeUInt256(),
                PreVerificationGas   = rlpStream.DecodeUInt256(),
                MaxFeePerGas         = rlpStream.DecodeUInt256(),
                MaxPriorityFeePerGas = rlpStream.DecodeUInt256(),
                Paymaster            = rlpStream.DecodeAddress() ?? Address.Zero,
                PaymasterData        = rlpStream.DecodeByteArray(),
                Signature            = rlpStream.DecodeByteArray()
            };

            Address entryPoint = rlpStream.DecodeAddress() ?? Address.Zero;

            // TODO: Make instantiation simpler?
            return(new UserOperationWithEntryPoint(new UserOperation(userOperationRpc), entryPoint));
        }
        public UserOperation Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            rlpStream.SkipLength();

            UserOperationRpc userOperationRpc = new UserOperationRpc
            {
                Sender               = rlpStream.DecodeAddress() ?? Address.Zero,
                Nonce                = rlpStream.DecodeUInt256(),
                InitCode             = rlpStream.DecodeByteArray(),
                CallData             = rlpStream.DecodeByteArray(),
                CallGas              = rlpStream.DecodeUInt256(),
                VerificationGas      = rlpStream.DecodeUInt256(),
                PreVerificationGas   = rlpStream.DecodeUInt256(),
                MaxFeePerGas         = rlpStream.DecodeUInt256(),
                MaxPriorityFeePerGas = rlpStream.DecodeUInt256(),
                Paymaster            = rlpStream.DecodeAddress() ?? Address.Zero,
                PaymasterData        = rlpStream.DecodeByteArray(),
                Signature            = rlpStream.DecodeByteArray()
            };

            return(new UserOperation(userOperationRpc));
        }