Documentation - AtrauraBlockchain/liquium-mobilelib GitHub Wiki
This wiki page documents the Liquium Mobile Library, its functions and attributes.
Account
liquiumMobileLib.account
This attribute contains the hash of the Ethereum account of the user which will be the used for interacting with the contract.
Private Key
liquiumMobileLib.privKey
This attribute contains the private key of the Ethereum account of the user which will be used for interacting with the contract.
Set Delegates
liquiumMobileLib.setDelegates(organizationAddr, categoryIds, delegates, cb)
This function sets the delegation of votes both for voters and delegates.
Parameters
organizationAddr - The Ethereum address of the Organization Smart Contract.
categoryIds - Array of integers which represent the ids of every one of the categories in which we want to delegate our vote.
delegates - Array of Ethereum addresses of the Delegates Smart Contracts which represent the delegate chosen for every category id.
cb - Callback function.
Return
txID - The transaction hash of the Ethereum transaction invoked.
Vote
liquiumMobileLib.vote(organizationAddr, idPoll, ballots, amounts, motivation, cb)
This function allows voters and delegates to vote.
Parameters
organizationAddr - The Ethereum address of the Organization Smart Contract.
idPoll- The id of the poll in which we want to vote.
ballots - Array of option ids which represent every one of the options in which we want to vote (for range voting purposes). If range voting is not needed ballots can be an array with only one option id.
amounts - Array of amounts of vote that we want to apply in every one of the selected options. If range voting is not needed amounts should be: [web3.toWei(1)].
motivation - String that gives a motivation for the vote by a delegate. It should be an empty string for a reguar voter.
cb - Callback function.
Return
txID - The transaction hash of the Ethereum transaction invoked.