Using dynamic calls
If you find yourself needing more expressive power than the references have to offer, you can use the dynamically constructed calls.
Building and executing the call
use ink::env::{
call::{build_call, ExecutionInput, Selector},
DefaultEnvironment,
};
// contract-specific imports:
use highlighted_posts::{HighlightedPostsError, HIGHLIGHT_POST_SELECTOR};let call_result: Result<Result<(), HighlightedPostsError>, ink::LangError> =
build_call::<DefaultEnvironment>()
.call(highlight_board)
.exec_input(
ExecutionInput::new(
Selector::new(HIGHLIGHT_POST_SELECTOR)
).push_arg(author).push_arg(id),
)
.transferred_value(cost)
.returns::<Result<Result<(), HighlightedPostsError>, ink::LangError>>()
.invoke();Selectors
Closing remarks
Last updated