Skip to content

Commit

Permalink
unify currency pairs protobuf types
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser999 committed Jan 16, 2025
1 parent 04d93fd commit 1180e60
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 168 deletions.
25 changes: 5 additions & 20 deletions crates/astria-core/src/generated/astria.protocol.transaction.v1.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

183 changes: 46 additions & 137 deletions crates/astria-core/src/generated/astria.protocol.transaction.v1.serde.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions crates/astria-core/src/protocol/transaction/v1/action/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2192,12 +2192,12 @@ impl Protobuf for CurrencyPairsChange {
fn into_raw(self) -> Self::Raw {
let raw = match self {
CurrencyPairsChange::Addition(pairs) => {
raw::currency_pairs_change::Value::Addition(raw::CurrencyPairsToAdd {
raw::currency_pairs_change::Value::Addition(raw::CurrencyPairs {
pairs: pairs.into_iter().map(CurrencyPair::into_raw).collect(),
})
}
CurrencyPairsChange::Removal(pairs) => {
raw::currency_pairs_change::Value::Removal(raw::CurrencyPairsToRemove {
raw::currency_pairs_change::Value::Removal(raw::CurrencyPairs {
pairs: pairs.into_iter().map(CurrencyPair::into_raw).collect(),
})
}
Expand All @@ -2220,7 +2220,7 @@ impl Protobuf for CurrencyPairsChange {
/// - if any of the `pairs` field is invalid
fn try_from_raw(raw: raw::CurrencyPairsChange) -> Result<Self, Self::Error> {
match raw.value {
Some(raw::currency_pairs_change::Value::Addition(raw::CurrencyPairsToAdd {
Some(raw::currency_pairs_change::Value::Addition(raw::CurrencyPairs {
pairs,
})) => {
let pairs = pairs
Expand All @@ -2230,7 +2230,7 @@ impl Protobuf for CurrencyPairsChange {
.map_err(Self::Error::invalid_currency_pair)?;
Ok(Self::Addition(pairs))
}
Some(raw::currency_pairs_change::Value::Removal(raw::CurrencyPairsToRemove {
Some(raw::currency_pairs_change::Value::Removal(raw::CurrencyPairs {
pairs,
})) => {
let pairs = pairs
Expand Down
10 changes: 3 additions & 7 deletions proto/protocolapis/astria/protocol/transaction/v1/action.proto
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,11 @@ message PriceFeed {
// Add or remove currency pairs to/from the price feed oracle.
message CurrencyPairsChange {
oneof value {
CurrencyPairsToAdd addition = 1;
CurrencyPairsToRemove removal = 2;
CurrencyPairs addition = 1;
CurrencyPairs removal = 2;
}
}

message CurrencyPairsToAdd {
repeated connect.types.v2.CurrencyPair pairs = 1;
}

message CurrencyPairsToRemove {
message CurrencyPairs {
repeated connect.types.v2.CurrencyPair pairs = 1;
}

0 comments on commit 1180e60

Please sign in to comment.