Skip to content

Commit

Permalink
ManagedBufferReadToEnd to ManagedBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
alyn509 committed Jul 31, 2024
1 parent b5ae1f5 commit ad1d799
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,15 @@
"mutability": "readonly",
"inputs": [
{
"name": "_arg",
"name": "arg",
"type": "AbiWithManagedBufferReadToEnd"
}
],
"outputs": []
"outputs": [
{
"type": "bytes"
}
]
},
{
"name": "payable_egld",
Expand Down
5 changes: 3 additions & 2 deletions contracts/feature-tests/abi-tester/src/abi_tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ pub trait AbiTester {
#[view]
fn takes_object_with_managed_buffer_read_to_end(
&self,
_arg: AbiWithManagedBufferReadToEnd<Self::Api>,
) {
arg: AbiWithManagedBufferReadToEnd<Self::Api>,
) -> ManagedBuffer {
arg.flush.to_managed_buffer()
}

#[endpoint]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ impl<M: ManagedTypeApi> ManagedBufferReadToEnd<M> {
pub fn new_from_buf(buf: ManagedBuffer<M>) -> Self {
Self { buffer: buf }
}

#[inline]
pub fn to_managed_buffer(&self) -> ManagedBuffer<M> {
self.buffer.clone()
}
}

impl<M: ManagedTypeApi> PartialEq for ManagedBufferReadToEnd<M> {
Expand Down

0 comments on commit ad1d799

Please sign in to comment.