web3.personal.signAndSendTransaction como método de contrato?

Como web3.personal.signAndSendTransactionmétodo, ¿hay algún método disponible para funciones de contrato? por ejemplo:

MyContract.storeName.signAndSendTransaction("name",
    {from:web3.eth.accounts[0]},"passphrase");

Respuestas (1)

No Desafortunadamente.

Lo que tienes que hacer es codificar la firma del contrato y los parámetros en el formato de interfaz binaria de la aplicación (ABI), luego enviar estos datos en el dataparámetro de la web3.personal.signAndSendTransactionfunción.

Vea el parámetro de datos en la API de JavaScript - web3.eth.sendTransaction :

Parámetros

Object - The transaction object to send:
* from: String - The address for the sending account. Uses the web3.eth.defaultAccount property, if not specified.
* to: String - (optional) The destination address of the message, left undefined for a contract-creation transaction.
* value: Number|String|BigNumber - (optional) The value transferred for the transaction in Wei, also the endowment if it's a contract-creation transaction.
* gas: Number|String|BigNumber - (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded).
* gasPrice: Number|String|BigNumber - (optional, default: To-Be-Determined) The price of gas for this transaction in wei, defaults to the mean network gas price.
* data: String - (optional) Either a byte string containing the associated data of the message, or in the case of a contract-creation transaction, the initialisation code.
* nonce: Number - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.

Para averiguar qué datos enviar, consulte el ejemplo paso a paso bajo el encabezado Use su contrato usando curl y JSON-RPC en Cómo llamar a un método de contrato usando la API eth_call JSON-RPC , busque "ABI" en este sitio, y echa un vistazo a Ethereum Contract ABI .