in rust, nft_mint()
declaration
#[payable]
pub fn nft_mint(&mut self, token_id: TokenId, receiver_id: AccountId) -> Self {
// ...
}
using the nft_mint()
method in javascript
await contract.nft_mint({}, GAS_AMOUNT, ATTACHED_DEPOSIT);
I see that nft_mint
in javascript has three arguments which are different from the rust
code.
Is it because of that payable
macro?
The contract function arguments are passed in the first argument (object) on JS side, so it should be:
await contract.nft_mint({ token_id: "my_kitten", receiver_id: "frol.near" }, GAS_AMOUNT, ATTACHED_DEPOSIT);
“payable” attribute just adds a single assert at the beginning of the function body that checks that the attached deposit is non-zero. It does not alter the function arguments.