Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

calling a payable function with parameters #214

Closed
ungaro opened this issue Aug 23, 2018 · 3 comments
Closed

calling a payable function with parameters #214

ungaro opened this issue Aug 23, 2018 · 3 comments

Comments

@ungaro
Copy link

ungaro commented Aug 23, 2018

i'm struggling to find an example to use a payable function with parameters.

let's say i've an function in my Smart Contract:

    function doSomething(address[] _adresses, address[] _groups, uint[] _percentages)
        public
        payable
        returns(address) {

How do i call this SC and send ethers to it & pass parameters and get the return value?

Thanks.

@shamatar
Copy link
Contributor

I’m no longer maintaining this repo, please move such questions to the new one.

@skywinder
Copy link
Contributor

This issue was moved to web3swift-team/web3swift#8

@v57
Copy link
Contributor

v57 commented Oct 29, 2018

In web3swift 2.0 you can do it using:

let contract: EthereumAddress = "0xb957280ba7235319aec2fc91b94d47fd8193c47f"
var options = Web3Options.default
options.value = BigUInt("1.0", units: .eth)
options.from = "0xDf2bC70175311A6807F085e54881Fc4931359dBF"
let address1: [EthereumAddress] = []
let address2: [EthereumAddress] = []
let some: [BigUInt] = []
contract.send("doSomething(address[],address[],uint[])", address1, address2, some, options: options)
    .done { result in
        /// do something
    }.catch { error in
        
}

@v57 v57 closed this as completed Oct 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants