pub fn promise_create(
account_id: AccountId,
function_name: &str,
arguments: impl AsRef<[u8]>,
amount: NearToken,
gas: Gas,
) -> PromiseIndexExpand description
Creates a promise that will execute a method on account with given arguments and attaches the given amount and gas.
ยงExamples
use near_sdk::env::promise_create;
use near_sdk::serde_json;
use near_sdk::{AccountId, NearToken, Gas};
use std::str::FromStr;
let promise = promise_create(
"counter.near".parse::<AccountId>().unwrap(),
"increment",
serde_json::json!({
"value": 5
}).to_string(),
NearToken::from_yoctonear(0),
Gas::from_tgas(30)
);More info about promises in NEAR documentation
More low-level info here: near_vm_runner::logic::VMLogic::promise_create
Example usages of this low-level api are https://github.com/near/near-sdk-rs/blob/c2a2d36b2a83ad8fe110c3b21046064f581dc458/examples/factory-contract/low-level/src/lib.rs?plain=1#L28 and https://github.com/near/near-sdk-rs/blob/c2a2d36b2a83ad8fe110c3b21046064f581dc458/examples/cross-contract-calls/low-level/src/lib.rs?plain=1#L23