diff --git a/crates/proto/src/gen/penumbra.view.v1.rs b/crates/proto/src/gen/penumbra.view.v1.rs index 5ec54bf491..662c7df3e8 100644 --- a/crates/proto/src/gen/penumbra.view.v1.rs +++ b/crates/proto/src/gen/penumbra.view.v1.rs @@ -1543,6 +1543,9 @@ pub struct OwnedPositionIdsRequest { pub trading_pair: ::core::option::Option< super::super::core::component::dex::v1::TradingPair, >, + /// If present, return only positions for this subaccount index. + #[prost(message, optional, tag = "3")] + pub subaccount: ::core::option::Option, } impl ::prost::Name for OwnedPositionIdsRequest { const NAME: &'static str = "OwnedPositionIdsRequest"; @@ -1558,6 +1561,9 @@ pub struct OwnedPositionIdsResponse { pub position_id: ::core::option::Option< super::super::core::component::dex::v1::PositionId, >, + /// The subaccount this position belongs to. + #[prost(message, optional, tag = "2")] + pub subaccount: ::core::option::Option, } impl ::prost::Name for OwnedPositionIdsResponse { const NAME: &'static str = "OwnedPositionIdsResponse"; diff --git a/crates/proto/src/gen/penumbra.view.v1.serde.rs b/crates/proto/src/gen/penumbra.view.v1.serde.rs index d5b11ff8db..44858b4f5f 100644 --- a/crates/proto/src/gen/penumbra.view.v1.serde.rs +++ b/crates/proto/src/gen/penumbra.view.v1.serde.rs @@ -4196,6 +4196,9 @@ impl serde::Serialize for OwnedPositionIdsRequest { if self.trading_pair.is_some() { len += 1; } + if self.subaccount.is_some() { + len += 1; + } let mut struct_ser = serializer.serialize_struct("penumbra.view.v1.OwnedPositionIdsRequest", len)?; if let Some(v) = self.position_state.as_ref() { struct_ser.serialize_field("positionState", v)?; @@ -4203,6 +4206,9 @@ impl serde::Serialize for OwnedPositionIdsRequest { if let Some(v) = self.trading_pair.as_ref() { struct_ser.serialize_field("tradingPair", v)?; } + if let Some(v) = self.subaccount.as_ref() { + struct_ser.serialize_field("subaccount", v)?; + } struct_ser.end() } } @@ -4217,12 +4223,14 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsRequest { "positionState", "trading_pair", "tradingPair", + "subaccount", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { PositionState, TradingPair, + Subaccount, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -4247,6 +4255,7 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsRequest { match value { "positionState" | "position_state" => Ok(GeneratedField::PositionState), "tradingPair" | "trading_pair" => Ok(GeneratedField::TradingPair), + "subaccount" => Ok(GeneratedField::Subaccount), _ => Ok(GeneratedField::__SkipField__), } } @@ -4268,6 +4277,7 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsRequest { { let mut position_state__ = None; let mut trading_pair__ = None; + let mut subaccount__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::PositionState => { @@ -4282,6 +4292,12 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsRequest { } trading_pair__ = map_.next_value()?; } + GeneratedField::Subaccount => { + if subaccount__.is_some() { + return Err(serde::de::Error::duplicate_field("subaccount")); + } + subaccount__ = map_.next_value()?; + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } @@ -4290,6 +4306,7 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsRequest { Ok(OwnedPositionIdsRequest { position_state: position_state__, trading_pair: trading_pair__, + subaccount: subaccount__, }) } } @@ -4307,10 +4324,16 @@ impl serde::Serialize for OwnedPositionIdsResponse { if self.position_id.is_some() { len += 1; } + if self.subaccount.is_some() { + len += 1; + } let mut struct_ser = serializer.serialize_struct("penumbra.view.v1.OwnedPositionIdsResponse", len)?; if let Some(v) = self.position_id.as_ref() { struct_ser.serialize_field("positionId", v)?; } + if let Some(v) = self.subaccount.as_ref() { + struct_ser.serialize_field("subaccount", v)?; + } struct_ser.end() } } @@ -4323,11 +4346,13 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsResponse { const FIELDS: &[&str] = &[ "position_id", "positionId", + "subaccount", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { PositionId, + Subaccount, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -4351,6 +4376,7 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsResponse { { match value { "positionId" | "position_id" => Ok(GeneratedField::PositionId), + "subaccount" => Ok(GeneratedField::Subaccount), _ => Ok(GeneratedField::__SkipField__), } } @@ -4371,6 +4397,7 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsResponse { V: serde::de::MapAccess<'de>, { let mut position_id__ = None; + let mut subaccount__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::PositionId => { @@ -4379,6 +4406,12 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsResponse { } position_id__ = map_.next_value()?; } + GeneratedField::Subaccount => { + if subaccount__.is_some() { + return Err(serde::de::Error::duplicate_field("subaccount")); + } + subaccount__ = map_.next_value()?; + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } @@ -4386,6 +4419,7 @@ impl<'de> serde::Deserialize<'de> for OwnedPositionIdsResponse { } Ok(OwnedPositionIdsResponse { position_id: position_id__, + subaccount: subaccount__, }) } } diff --git a/crates/proto/src/gen/proto_descriptor.bin.no_lfs b/crates/proto/src/gen/proto_descriptor.bin.no_lfs index 895f0f7259..4c9fd7802b 100644 Binary files a/crates/proto/src/gen/proto_descriptor.bin.no_lfs and b/crates/proto/src/gen/proto_descriptor.bin.no_lfs differ diff --git a/crates/view/src/client.rs b/crates/view/src/client.rs index be7edbccd8..18d3a11a25 100644 --- a/crates/view/src/client.rs +++ b/crates/view/src/client.rs @@ -709,6 +709,7 @@ where tonic::Request::new(pb::OwnedPositionIdsRequest { trading_pair: trading_pair.map(TryInto::try_into).transpose()?, position_state: position_state.map(TryInto::try_into).transpose()?, + subaccount: None, }), ); diff --git a/crates/view/src/service.rs b/crates/view/src/service.rs index 8e3c8ce26c..cd116b4cfa 100644 --- a/crates/view/src/service.rs +++ b/crates/view/src/service.rs @@ -1717,6 +1717,7 @@ impl ViewService for ViewServer { let pb::OwnedPositionIdsRequest { position_state, trading_pair, + subaccount: _, } = request.into_inner(); let position_state: Option = position_state @@ -1741,6 +1742,9 @@ impl ViewService for ViewServer { for id in ids { yield pb::OwnedPositionIdsResponse{ position_id: Some(id.into()), + // The rust view server does not index positions by subaccount, + // so this information is invisible to it. + subaccount: None, } } }; diff --git a/proto/penumbra/penumbra/view/v1/view.proto b/proto/penumbra/penumbra/view/v1/view.proto index 5f1ffb41b5..2af3e5cc52 100644 --- a/proto/penumbra/penumbra/view/v1/view.proto +++ b/proto/penumbra/penumbra/view/v1/view.proto @@ -153,8 +153,7 @@ service ViewService { // There's only one transparent address per wallet, so this request has no parameters; // the message exists to satisfy forward-compatibility properties. -message TransparentAddressRequest { -} +message TransparentAddressRequest {} message TransparentAddressResponse { // The raw (binary) transparent address @@ -700,10 +699,14 @@ message OwnedPositionIdsRequest { core.component.dex.v1.PositionState position_state = 1; // If present, return only positions for this trading pair. core.component.dex.v1.TradingPair trading_pair = 2; + // If present, return only positions for this subaccount index. + core.keys.v1.AddressIndex subaccount = 3; } message OwnedPositionIdsResponse { core.component.dex.v1.PositionId position_id = 1; + // The subaccount this position belongs to. + core.keys.v1.AddressIndex subaccount = 2; } // Requests information on an asset by asset id @@ -786,4 +789,4 @@ message UnbondingTokensByAddressIndexResponse { // `true` if the `unbonding_delay` (from `StakeParameters`) has passed or the // validator has unbonded. bool claimable = 2; -} \ No newline at end of file +}