How to call functions with another account?

I am new,maybe my problem is very simple.
In ganache,there are 10 accounts,
The system will interact with the contract by default using the first account.
I write some functions and want to test them.
How can i use others accounts?
thank you
:computer: Environment


:1234: Code to reproduce

1 Like

Hi @wangyuyue,

In our tests we can specify the from account. Which is the account that will send the transaction.

await, { from: owner });

For an example test see the Learn guides documentation:

If you get stuck, feel free to share your test and what testing environment you are using (e.g. Truffle Test, OpenZeppelin Test Environment etc)

I see , Thank you for your help :grinning:

1 Like

Hi @wangyuyue,

I hope that answered your question, if not, let me know what testing environment you are using and I can dig out an example of how to set the account.

A post was split to a new topic: Error installing @openzeppelin/test-environment