Open eatruffle opened 2 years ago
The closes we have is crate::api::accounts::Transaction
, but currently it only implements RLP encoding and is not exposed (see code) . A decoding counterpart implementation would be required for this. Happy to accept a PR.
Hi, thank you. Maybe it will be helpful
impl<'a> rlp::Decodable for NewSignedTransaction { fn decode(d: &rlp::Rlp) -> Result<Self, rlp::DecoderError> {
Ok(NewSignedTransaction {
transaction: NewTransaction {
chainId: d.val_at(0)?,//.map_err(|e| debug("nonce", e))?,
nonce: d.val_at(1)?,//.map_err(|e| debug("nonce", e))?,
maxPriorityFeePerGas: d.val_at(2)?,//.map_err(|e| debug("gas_price", e))?,
maxFeePerGas: d.val_at(3)?,//.map_err(|e| debug("gas", e))?,
gas_price: d.val_at(4)?,
gas_limit: d.val_at(4)?,
to: d.val_at(5)?,
value: d.val_at(6)?,//.map_err(|e| debug("value", e))?,
data: d.val_at::<Vec<u8>>(7)?.into(),//.map_err(|e| debug("data", e))?.into(),
},
v: Default::default(),//.map_err(|e| debug("v", e))?,
r: Default::default(),//.map_err(|e| debug("r", e))?,
s: Default::default(),//.map_err(|e| debug("s", e))?,
})
}
}
pub struct NewTransaction {
pub chainId: U256,
pub nonce: U256,
pub maxPriorityFeePerGas: U256,
pub maxFeePerGas: U256,
pub gas_price: U256,
pub gas_limit: U256,
pub to: Address,
pub value: U256,
pub data: Bytes,
// pub accessList: Vec
And in pleace of the NewTransaction object, sugested Transaction will be OK.
Hi, if I put up a PR that includes this, how quickly can this get merged and released? Need it for prod asap or I need to switch to ethers
@jakehemmerle I'd recommend switching to ethers, this package is barely maintained.
Hi, Is possible to deserialize a hex of a raw transaction ? I checked the web3-rust's source code and did not find function where I can put hex of raw_transaction and as return will be the RawTransaction object.
Best regards,