Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
feat(network): add conversion from DeclareTransactionV3 to protobuf D…
Browse files Browse the repository at this point in the history
…eclareV3 (#2028)
  • Loading branch information
asmaastarkware authored May 22, 2024
1 parent 49db37c commit e15a3aa
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -888,3 +888,37 @@ impl TryFrom<protobuf::transaction::DeclareV3> for DeclareTransactionV3 {
})
}
}

impl From<DeclareTransactionV3> for protobuf::transaction::DeclareV3 {
fn from(value: DeclareTransactionV3) -> Self {
Self {
resource_bounds: Some(protobuf::ResourceBounds::from(value.resource_bounds)),
tip: value.tip.0,
signature: Some(protobuf::AccountSignature {
parts: value.signature.0.into_iter().map(|signature| signature.into()).collect(),
}),
nonce: Some(value.nonce.0.into()),
class_hash: Some(value.class_hash.0.into()),
compiled_class_hash: Some(value.compiled_class_hash.0.into()),
sender: Some(value.sender_address.into()),
nonce_data_availability_mode: volition_domain_to_enum_int(
value.nonce_data_availability_mode,
),
fee_data_availability_mode: volition_domain_to_enum_int(
value.fee_data_availability_mode,
),
paymaster_data: value
.paymaster_data
.0
.iter()
.map(|paymaster_data| (*paymaster_data).into())
.collect(),
account_deployment_data: value
.account_deployment_data
.0
.iter()
.map(|account_deployment_data| (*account_deployment_data).into())
.collect(),
}
}
}

0 comments on commit e15a3aa

Please sign in to comment.