-
Notifications
You must be signed in to change notification settings - Fork 0
How to pass parameters to Contract Method? #3
Comments
Have the same issue here. Could you please update example and show how to send arguments to contract function w/params that changes state. |
Hello everyone. I'm preparing a cleanup to simplify and streamline sending transactions to smart contracts, will be committed soon. In a meantime you should follow the same way as in example, where sending ETH to wallet is done by providing an ABI and calling a contract methond. You should not need to set nonce manually, it's done under the hood.
If you attached a keystore manager to the web3 instance you just need to provide a password and sender address, although public methods exist to sign a "transactionIntermediate" or just a plain transaction after it's assembled. Sincerely, Alex |
Hello there! I'm glad I can join the party. I think that what previous commenters pointed out is correct, I just stumbled upon a very similar problem: THIS WORKS:
Straight forward to call in web3swift:
THIS DOES NOT WORK:
Now, using web3swift my first instinct, (like I believe the other commenters did), was to pass the function argument in the parameters: param of the function:
This returns the error the original commenter posted. How would you call the method above using web3swift? it has this 'piece' of ABI:
Regardless, This is fantastic work! |
@jlstr Thank you for a great feedback. I'll look closer on this issue and provide better example as soon as it's fixed. Hope to be done on Monday. Sincerely, Alex |
@shamatar current version does not allow passing arguments to contract func? is this correct? Kindly, |
The purpose of this library is to support everything web3js supports. I've found a problem with uint8, uint16, etc encoding (less than uint256), should be fixed in 0.2.9 Here is an example
The contract itself is simple
deployed in Rinkeby at
|
Much grateful for this Alex. I will test.
will it be correct? |
Hello Johana. Yes, parameters are encoded in order of their appearance in array and it should correspond to their order in Solidity function (no support for named parameters yet), so if you need to pass only one parameter to the function - your way is correct. Please check an example of obtaining ERC20 balance for particular address in Example. Sincerely, Alex |
Much Grateful for this, Alex. It's working as expected! 👌😃 I hope I can continue asking question as you make progress with this cool library. Kind Regards, |
Hello, I would like to know how to correctly pass parameters to a Contract method:
If I have a Contract method that looks like this (Solidity):
How can I pass the parameters for _to and _value params?
I'm trying something like this:
But apparently there's something wrong, because the Transaction won't go through, and I get error:
This didn't happen with contract method with no params.
How can I send the params array correctly?
Thank you guys!
The text was updated successfully, but these errors were encountered: