On NEARprotocol, I want to call another contract from within a contract (Rust).
I tried env::Promise
but could not retrieve the call answer. What is the right approach here? Also, the near-sdk
crate docs give the example &"bob_near".to_string()
, is that equivalent to the id bob.near
or a typo?
Here are the relevant excerpts of my code:
near_sdk::setup_alloc!();
#[ext_contract]
pub trait AEXToken {
fn collect_premie(&mut self, account_id: ValidAccountId) -> bool;
fn get_min_balance(&self) -> u128;
}
#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize, PanicOnDefault)]
pub struct Contract {
tokens: NonFungibleToken,
metadata: LazyOption<NFTContractMetadata>,
aex_tokenId: ValidAccountId,
}
#[near_bindgen]
impl Contract {
pub fn nft_mint(&mut self) -> Token {
let amount: Balance = env::attached_deposit();
aex_token::get_min_balance(&self.aex_tokenId.to_string(), 0, 1_000);
let min_balance: u128 = env::promise_return(1);
assert!(min_balance < amount);