lib/eth/tx/eip1559.rb
# Encodes a raw transaction object, wraps it in an EIP-2718 envelope
# with an EIP-1559 type prefix.
#
# @return [String] a raw, RLP-encoded EIP-1559 type transaction object.
# @raise [Signature::SignatureError] if the transaction is not yet signed.
Encodes a raw transaction object, wraps it in an EIP-2718 envelope
with an EIP-1559 type prefix.
Encodes a raw transaction object wraps it in an EIP - 2718 envelope with an EIP - 1559 type prefix .
def encoded
        unless Tx.is_signed? self
          raise Signature::SignatureError, "Transaction is not signed!"
        end
        tx_data = []
        tx_data.push Util.serialize_int_to_big_endian @chain_id
        tx_data.push Util.serialize_int_to_big_endian @signer_nonce
        tx_data.push Util.serialize_int_to_big_endian @max_priority_fee_per_gas
        tx_data.push Util.serialize_int_to_big_endian @max_fee_per_gas
        tx_data.push Util.serialize_int_to_big_endian @gas_limit
        tx_data.push Util.hex_to_bin @destination
        tx_data.push Util.serialize_int_to_big_endian @amount
        tx_data.push Rlp::Sedes.binary.serialize @payload
        tx_data.push Rlp::Sedes.infer(@access_list).serialize @access_list
        tx_data.push Util.serialize_int_to_big_endian @signature_y_parity
        tx_data.push Util.serialize_int_to_big_endian @signature_r
        tx_data.push Util.serialize_int_to_big_endian @signature_s
        tx_encoded = Rlp.encode tx_data
        tx_type = Util.serialize_int_to_big_endian @type
        return "#{tx_type}#{tx_encoded}"
      end
def encoded unless Tx . is_signed? self raise Signature :: SignatureError , "Transaction is not signed!" end tx_data = [ ] tx_data . push Util . serialize_int_to_big_endian @chain_id tx_data . push Util . serialize_int_to_big_endian @signer_nonce tx_data . push Util . serialize_int_to_big_endian @max_priority_fee_per_gas tx_data . push Util . serialize_int_to_big_endian @max_fee_per_gas tx_data . push Util . serialize_int_to_big_endian @gas_limit tx_data . push Util . hex_to_bin @destination tx_data . push Util . serialize_int_to_big_endian @amount tx_data . push Rlp :: Sedes . binary . serialize @payload tx_data . push Rlp :: Sedes . infer ( @access_list ) . serialize @access_list tx_data . push Util . serialize_int_to_big_endian @signature_y_parity tx_data . push Util . serialize_int_to_big_endian @signature_r tx_data . push Util . serialize_int_to_big_endian @signature_s tx_encoded = Rlp . encode tx_data tx_type = Util . serialize_int_to_big_endian @type return "#{tx_type}#{tx_encoded}" end
Encodes a raw transaction object, wraps it in an EIP-2718 envelope
with an EIP-1559 type prefix.
Encodes a raw transaction object wraps it in an EIP - 2718 envelope with an EIP - 1559 type prefix .
# create an EIP-2718 envelope with EIP-1559 type payload
a raw, RLP-encoded EIP-1559 type transaction object.
a raw RLP - encoded EIP - 1559 type transaction object .
String
[Signature::SignatureError] if the transaction is not yet signed.
[ Signature :: SignatureError ] if the transaction is not yet signed .