Browse Source

Add prove to js api.

master
Thomas Kerber 2 years ago
parent
commit
16d7f05965
2 changed files with 39 additions and 1 deletions
  1. 1
    1
      internal/jsre/deps/bindata.go
  2. 38
    0
      internal/jsre/deps/web3.js

+ 1
- 1
internal/jsre/deps/bindata.go
File diff suppressed because it is too large
View File


+ 38
- 0
internal/jsre/deps/web3.js View File

@@ -4043,6 +4043,35 @@ SolidityFunction.prototype.call = function () {
});
};

/**
* Generates a proof for a contract function.
*
* @method prove
* @param {...Object} Contract function arguments
* @param {function} If the last argument is a function, the proof generation
* call will be asynchronous, and the callback will be passed the
* error and result.
* @return {String} output bytes
*/
SolidityFunction.prototype.prove = function () {
var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });
var callback = this.extractCallback(args);
var defaultBlock = this.extractDefaultBlock(args);
var payload = this.toPayload(args);


if (!callback) {
return this._eth.prove(payload, defaultBlock);
}

var self = this;
this._eth.prove(payload, defaultBlock, function (error, output) {
if (error) return callback(error, null);

callback(error, output);
});
};

/**
* Should be used to sendTransaction to solidity function
*
@@ -4161,6 +4190,7 @@ SolidityFunction.prototype.attachToContract = function (contract) {
var execute = this.execute.bind(this);
execute.request = this.request.bind(this);
execute.call = this.call.bind(this);
execute.prove = this.prove.bind(this);
execute.sendTransaction = this.sendTransaction.bind(this);
execute.estimateGas = this.estimateGas.bind(this);
execute.getData = this.getData.bind(this);
@@ -5310,6 +5340,13 @@ var methods = function () {
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
});

var prove = new Method({
name: 'prove',
call: 'eth_prove',
params: 2,
inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
});

var estimateGas = new Method({
name: 'estimateGas',
call: 'eth_estimateGas',
@@ -5362,6 +5399,7 @@ var methods = function () {
getTransactionReceipt,
getTransactionCount,
call,
prove,
estimateGas,
sendRawTransaction,
sendTransaction,

Loading…
Cancel
Save