- Typescript integration Code :
let contractId = '0x7d2d67a0a91ed9fcd48a2cce15466e39ca213bbbf419e77ea10af2d73ff22579'
// Create a provider, with the Latest Testnet URL.
const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
const contract = new Contract(contractId, abi, provider);
const { value } = await contract.functions.total_assets().get();
console.log("value of Total assets",Number(value))
const amount = BigInt(1e7);
const subId = '0x2000000000000000000000000000000000000000000000000000000000000000';
const recipient = '0xdfa99328085d21926deac89364045a6ebc84da04a051b7c70e2c368eee494b3b'
const result = await contract.functions.mint(recipient,subId,amount).txParams({gasPrice:1}).call();
}
Correct me if i am wrong while calling the mint function is correct or not .
getting this error
_FuelError: Only one field must be provided.
mint function I have written in the contract
#[storage(read, write)]
fn mint(recipient: Identity, sub_id: SubId, amount: u64) {
require(sub_id == +, "Incorrect Sub Id");
// Initialize total supply if not already initialized
if !storage.is_initialized.read() {
storage.total_supply.write(TOTAL_SUPPLY);
storage.is_initialized.write(true);
}
// Increment total supply of the asset and mint to the recipient.
storage
.total_supply
.write(amount + storage.total_supply.read());
mint_to(recipient, DEFAULT_SUB_ID, amount);
}