Skip to content

Conversation

Thoralf-M
Copy link
Member

Also added tx_command_results examples for #233

@Thoralf-M Thoralf-M force-pushed the feat/tx-command-results-example branch from 7459299 to ad484b4 Compare October 9, 2025 11:19
Comment on lines +58 to +60
pub fn split_coins(coin: Arc<PTBArgument>, amounts: Vec<Arc<PTBArgument>>) -> Self {
Self(PTBCommandKind::SplitCoins { coin, amounts })
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These probably need a new prefix, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I don't really like that named_command is exposed at all. Why would you do this rather than just calling the builder methods?

Copy link
Member Author

@Thoralf-M Thoralf-M Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The builder methods currently doesn't allow to provide results from previous commands
We could change the params to make use of the PTBArgument trait, but not sure if that's better, because just providing numbers like this .split_coins(coin, [1000, 2000, 3000]) wouldn't work anymore, you would have to specify them as u64 .split_coins(coin, [1000u64, 2000, 3000]) and if you read the fn signature it's not clear at all

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would look like this, and we probably should adjust all the builder methods to that then 8ec9483
What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I see. This is definitely a bit of a weird case. And using PTBArgument means you can pass a lot of stuff that would be invalid :c Still, I guess the system allows you to make mistakes in any command if you don't know what you're doing, so maybe it's not such a big issue 🤷‍♀️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you prefer the params with the PTBArgument trait?

@Thoralf-M Thoralf-M marked this pull request as draft October 10, 2025 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants