ABI functions calling

hi there. anybody can tell me how to call ABI functions from JavasCript with moralis?
image
like this kind of functions

Hi
Please refer to the below docs for example. You can use Moralis.executeFunction function to call the smart contract read/write functions.
https://docs.moralis.io/moralis-dapp/web3/web3#executefunction

yes. but this docs for abi which created themselves. but i want to call function which is created from other side.(creator not me)… how to connect there and how to call them?

If the contract is verified on the block explorer then you can get the function abi from there.
I am not sure if there is a way to call the contract function without abi.

abi have, [{“inputs”:[],“stateMutability”:“nonpayable”,“type”:“constructor”},{“inputs”:[{“internalType”:“bool”,“name”:"_autoReinvest",“type”:“bool”}],“name”:“autoReinvest”,“outputs”:[],“stateMutability”:“nonpayable”,“type”:“function”},{“inputs”:[],“name”:“owner”,“outputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“stateMutability”:“view”,“type”:“function”},{“inputs”:[{“internalType”:“bool”,“name”:"_autoRein",“type”:“bool”},{“internalType”:“address”,“name”:"_sponsorRef",“type”:“address”}],“name”:“payForCellWithSponsor”,“outputs”:[],“stateMutability”:“payable”,“type”:“function”},{“inputs”:[{“internalType”:“bool”,“name”:"_autoRein",“type”:“bool”}],“name”:“payForCellWithoutSponsor”,“outputs”:[],“stateMutability”:“payable”,“type”:“function”},{“inputs”:[{“internalType”:“address”,“name”:"",“type”:“address”}],“name”:“payments”,“outputs”:[{“internalType”:“uint256”,“name”:"",“type”:“uint256”}],“stateMutability”:“view”,“type”:“function”}]

here abi… can you help me to write calling function for example
with this abi

For example:

// This is the ABI of payable function payForCellWithoutSponsor which takes one bool input `_autoRein` with no Outputs.
ABI  = [{"inputs":[{"internalType":"bool","name":"_autoRein","type":"bool"}],"name":"payForCellWithoutSponsor","outputs":[],"stateMutability":"payable","type":"function"}];

//These will be the contract parameters and contract call.

const sendOptions = {
  contractAddress: "0x......",
  functionName: "payForCellWithoutSponsor",
  abi: ABI,
  params: {
    _autoRein: true,
  },
};

const transaction = await Moralis.executeFunction(sendOptions);
await transaction.wait();

thanks a lot this working but how to send tokens with this transactions? here in function have place “payableAmount”

image

To send native tokens with a function, the function should be a payable function, then you can have msgValue: Moralis.Units.ETH("0.1") where 0.1 is the amount of BNB to be paid which you can change

here i did this but not working

You need to add msgValue to your options rather: msgValue: Moralis.Units.ETH("0.1")

thanks a lot this also works… but one else problem… every time when i call this function must re-connect to network… otherwise gives this error…
image

You can call Moralis.enableWeb3() before calling the function incase that breaks

i add here, but useless… must reconnect … otherwise if connected giving this kine of error

You can await rather await Moralis.enableWeb3()