Skip to main content
code formattings
Source Link
Achala Dissanayake
  • 5.8k
  • 15
  • 29
  • 38

Let's say the abi of my contract is 'abi' and the variable I am using to interact with my contract is 'agreem'. The address of deployed contract is 'contract_address'contract_address.

let agreem = new web3.eth.Contract(abi, contract_address);

let agreem =  new web3.eth.Contract(abi, contract_address);

Now, I will say my function's name is retrieve and it returns two values. My function takes two parameters as well. To call my function-

const bal=await agreem.methods.retrieve(uname,ps).call({from:accounts[0]});

const bal=await agreem.methods.retrieve(uname,ps).call({from:accounts[0]});

The variable bal will store both the return values returned by my function.To access them you can use bal[0] and bal[1].bal[0] and bal[1] .

Hope it helps.

Let's say the abi of my contract is 'abi' and the variable I am using to interact with my contract is 'agreem'. The address of deployed contract is 'contract_address'.

let agreem = new web3.eth.Contract(abi, contract_address);

Now, I will say my function's name is retrieve and it returns two values. My function takes two parameters as well. To call my function-

const bal=await agreem.methods.retrieve(uname,ps).call({from:accounts[0]});

The variable bal will store both the return values returned by my function.To access them you can use bal[0] and bal[1].

Hope it helps.

Let's say the abi of my contract is 'abi' and the variable I am using to interact with my contract is 'agreem'. The address of deployed contract is contract_address.

let agreem =  new web3.eth.Contract(abi, contract_address);

Now, I will say my function's name is retrieve and it returns two values. My function takes two parameters as well. To call my function-

const bal=await agreem.methods.retrieve(uname,ps).call({from:accounts[0]});

The variable bal will store both the return values returned by my function.To access them you can use bal[0] and bal[1] .

Hope it helps.

Source Link

Let's say the abi of my contract is 'abi' and the variable I am using to interact with my contract is 'agreem'. The address of deployed contract is 'contract_address'.

let agreem = new web3.eth.Contract(abi, contract_address);

Now, I will say my function's name is retrieve and it returns two values. My function takes two parameters as well. To call my function-

const bal=await agreem.methods.retrieve(uname,ps).call({from:accounts[0]});

The variable bal will store both the return values returned by my function.To access them you can use bal[0] and bal[1].

Hope it helps.