We assume that the contract has already been deployed on Veda using the 'deploy' instruction. Now, our goal is to call the 'mint' method to mint 100 tokens to a specific address.
The contract address in Veda instructions differs slightly from ETH. In Veda instructions stored on Ordinals, the contract's address is represented by the Ordinals id of the contract 'deploy' instruction (even though it's stored as a 20-byte hex string in veda-bvm). This means the 'contract' attribute will be represented in the form of ${deploy_tx_hash}i${offset}. The method for generating the 20-byte hex string in Veda-bvm can be referenced in BVM Address.
Constructing execution data
Encode function call data
import axios from'axios'import Web3 from'web3'import { toWei } from'web3-utils'constgetABIItemByName= (abi:string, functionName:string) => {returnJSON.parse(abi).find((item:any) =>item.type ==='function'&&item.name === functionName) ||null}constweb3=newWeb3()constabi:string=""// You should store abi on your app.(Just like other evm application)constcallParams= { func:'mint', args: ['TARGET ADDRESS HERE',toWei(100,'ether'), ],}constdata=web3.eth.abi.encodeFunctionCall(getABIItemByName(abi,callParams.func),callParams.args)