Function promise_create

Source
pub fn promise_create(
    account_id: AccountId,
    function_name: &str,
    arguments: &[u8],
    amount: NearToken,
    gas: Gas,
) -> PromiseIndex
Expand 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().into_bytes().as_slice(),
    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/tree/master/examples/factory-contract/low-level/src/lib.rs and https://github.com/near/near-sdk-rs/blob/master/examples/cross-contract-calls/low-level/src/lib.rs