-
Notifications
You must be signed in to change notification settings - Fork 3
feat(tx-builder): improve TransactionBuilder::make_move_vec() docs
#336
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
Changes from all commits
deafd34
bad7fb9
1ad0dfd
2e68322
81076b8
e6323a6
b934b86
09886d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -538,6 +538,41 @@ impl<C, L> TransactionBuilder<C, L> { | |
| } | ||
|
|
||
| /// Make a move vector from a list of elements. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we should also mention something like:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, makes sense to add this comment, Can you come up with a valid use-case? Then I'ld add another example just for that, because currently
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know of a valid use-case other than if there's something we can't do with the normal syntax that I'm not thinking of |
||
| /// | ||
| /// Often it is possible (and more efficient) to pass a rust slice or `Vec` | ||
| /// instead of calling this function, which will serialize the bytes into a | ||
| /// move vector pure argument. | ||
| /// | ||
| /// # Example | ||
| /// | ||
| /// ``` | ||
| /// # use std::str::FromStr; | ||
| /// # use iota_transaction_builder::{TransactionBuilder, res}; | ||
| /// # use iota_types::{Address, Transaction}; | ||
| /// | ||
| /// # #[tokio::main(flavor = "current_thread")] | ||
| /// # async fn main() -> eyre::Result<()> { | ||
| /// let client = iota_graphql_client::Client::new_devnet(); | ||
| /// let sender = "0x71b4b4f171b4355ff691b7c470579cf1a926f96f724e5f9a30efc4b5f75d085e".parse()?; | ||
| /// | ||
| /// let mut builder = TransactionBuilder::new(sender).with_client(client); | ||
| /// | ||
| /// let address1 = | ||
| /// Address::from_str("0xde49ea53fbadee67d3e35a097cdbea210b659676fc680a0b0c5f11d0763d375e")?; | ||
| /// let address2 = | ||
| /// Address::from_str("0xe512234aa4ef6184c52663f09612b68f040dd0c45de037d96190a071ca5525b3")?; | ||
| /// | ||
| /// builder | ||
| /// .make_move_vec([address1, address2]) | ||
| /// .name("addresses") | ||
| /// .move_call(Address::FRAMEWORK, "vec_map", "from_keys_values") | ||
| /// .generics::<(Address, u64)>() | ||
| /// .arguments((res("addresses"), [10000000u64, 20000000u64])); | ||
| /// | ||
| /// let txn: Transaction = builder.finish().await?; | ||
| /// # Ok(()) | ||
| /// # } | ||
| /// ``` | ||
| pub fn make_move_vec<T: PTBArgument + MoveType>( | ||
| &mut self, | ||
| elements: impl IntoIterator<Item = 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.
This example isn't about make_move_vec and tbh it's a worse way to use the builder so I say revert this
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.
okay, do you think we should have a separate example about
.make_move_vecthen?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.
yeah, maybe