diff --git a/crates/astria-core/src/generated/astria.protocol.transactions.v1alpha1.rs b/crates/astria-core/src/generated/astria.protocol.transactions.v1alpha1.rs index a0f5ef75c5..ada37c8002 100644 --- a/crates/astria-core/src/generated/astria.protocol.transactions.v1alpha1.rs +++ b/crates/astria-core/src/generated/astria.protocol.transactions.v1alpha1.rs @@ -214,6 +214,9 @@ pub struct Ics20Withdrawal { /// the asset used to pay the transaction fee #[prost(bytes = "vec", tag = "8")] pub fee_asset_id: ::prost::alloc::vec::Vec, + /// a memo to include with the transfer + #[prost(string, tag = "9")] + pub memo: ::prost::alloc::string::String, } impl ::prost::Name for Ics20Withdrawal { const NAME: &'static str = "Ics20Withdrawal"; diff --git a/crates/astria-core/src/protocol/transaction/v1alpha1/action.rs b/crates/astria-core/src/protocol/transaction/v1alpha1/action.rs index ad8253f62d..dd6d350a6a 100644 --- a/crates/astria-core/src/protocol/transaction/v1alpha1/action.rs +++ b/crates/astria-core/src/protocol/transaction/v1alpha1/action.rs @@ -676,6 +676,8 @@ pub struct Ics20Withdrawal { source_channel: ChannelId, // the asset to use for fee payment. fee_asset_id: asset::Id, + // a memo to include with the transfer + memo: String, } impl Ics20Withdrawal { @@ -719,6 +721,11 @@ impl Ics20Withdrawal { &self.fee_asset_id } + #[must_use] + pub fn memo(&self) -> &str { + &self.memo + } + #[must_use] pub fn to_fungible_token_packet_data(&self) -> FungibleTokenPacketData { FungibleTokenPacketData { @@ -726,7 +733,7 @@ impl Ics20Withdrawal { denom: self.denom.to_string(), sender: self.return_address.to_string(), receiver: self.destination_chain_address.clone(), - memo: String::new(), + memo: self.memo.clone(), } } @@ -741,6 +748,7 @@ impl Ics20Withdrawal { timeout_time: self.timeout_time, source_channel: self.source_channel.to_string(), fee_asset_id: self.fee_asset_id.get().to_vec(), + memo: self.memo.clone(), } } @@ -755,6 +763,7 @@ impl Ics20Withdrawal { timeout_time: self.timeout_time, source_channel: self.source_channel.to_string(), fee_asset_id: self.fee_asset_id.get().to_vec(), + memo: self.memo, } } @@ -789,6 +798,7 @@ impl Ics20Withdrawal { .map_err(Ics20WithdrawalError::invalid_source_channel)?, fee_asset_id: asset::Id::try_from_slice(&proto.fee_asset_id) .map_err(Ics20WithdrawalError::invalid_fee_asset_id)?, + memo: proto.memo, }) } } diff --git a/proto/protocolapis/astria/protocol/transactions/v1alpha1/types.proto b/proto/protocolapis/astria/protocol/transactions/v1alpha1/types.proto index 391c9f9ed9..51a2984727 100644 --- a/proto/protocolapis/astria/protocol/transactions/v1alpha1/types.proto +++ b/proto/protocolapis/astria/protocol/transactions/v1alpha1/types.proto @@ -120,6 +120,8 @@ message Ics20Withdrawal { string source_channel = 7; // the asset used to pay the transaction fee bytes fee_asset_id = 8; + // a memo to include with the transfer + string memo = 9; } message IbcHeight {