-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(gateway): user transaction improvements - hex serialization & query-only removal #436
Conversation
tip
as hex in UserTransaction3dd1a16
to
1e78f22
Compare
1e78f22
to
539063c
Compare
let string_reader = std::io::Cursor::new(compressed_sierra_class.sierra_program); | ||
let base64_decoder = | ||
base64::read::DecoderReader::new(string_reader, &base64::engine::general_purpose::STANDARD); | ||
let gzip_decoder = flate2::read::GzDecoder::new(base64_decoder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaaaaah
you should look at
#459
also I had no idea compressed sierra was a thing? i thought only legacy classes were compressed
that's new right?
/// Marker trait to restrict which types can be used as transaction results. | ||
/// Only valid Starknet transaction responses implement this trait. | ||
pub trait ValidTransactionResult {} | ||
|
||
// Implement the marker trait for the three valid transaction result types | ||
impl<T> ValidTransactionResult for AddInvokeTransactionResult<T> {} | ||
impl<T> ValidTransactionResult for AddDeclareTransactionResult<T> {} | ||
impl<T> ValidTransactionResult for AddDeployAccountTransactionResult<T> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider sealing this trait by either making it private if does not need to be accessed outside of this crate, or a sub-trait of a private trait if it does.
/// Marker trait to restrict which types can be used as transaction results. | |
/// Only valid Starknet transaction responses implement this trait. | |
pub trait ValidTransactionResult {} | |
// Implement the marker trait for the three valid transaction result types | |
impl<T> ValidTransactionResult for AddInvokeTransactionResult<T> {} | |
impl<T> ValidTransactionResult for AddDeclareTransactionResult<T> {} | |
impl<T> ValidTransactionResult for AddDeployAccountTransactionResult<T> {} | |
/// Ensures [ValidTransactionResult] is accessible from outside the crate but cannot be implemented on any new structs | |
trait Sealed {} | |
/// Marker trait to restrict which types can be used as transaction results. | |
/// Only valid Starknet transaction responses implement this trait. | |
pub trait ValidTransactionResult: Sealed {} | |
// Implement the marker trait for the three valid transaction result types | |
impl<T> Sealed for AddInvokeTransactionResult<T> {} | |
impl<T> Sealed for AddDeclareTransactionResult<T> {} | |
impl<T> Sealed for AddDeployAccountTransactionResult<T> {} | |
impl<T> ValidTransactionResult for AddInvokeTransactionResult<T> {} | |
impl<T> ValidTransactionResult for AddDeclareTransactionResult<T> {} | |
impl<T> ValidTransactionResult for AddDeployAccountTransactionResult<T> {} |
Pull Request type
Please add the labels corresponding to the type of changes your PR introduces:
What is the current behavior?
Resolves: #NA
What is the new behavior?
Does this introduce a breaking change?
Yes: gateway API
Other information