Browse Source

Add prove to js api.

Thomas Kerber 1 year 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 () {
4043 4043
     });
4044 4044
 };
4045 4045
 
4046
+/**
4047
+ * Generates a proof for a contract function.
4048
+ *
4049
+ * @method prove
4050
+ * @param {...Object} Contract function arguments
4051
+ * @param {function} If the last argument is a function, the proof generation
4052
+ *   call will be asynchronous, and the callback will be passed the
4053
+ *   error and result.
4054
+ * @return {String} output bytes
4055
+ */
4056
+SolidityFunction.prototype.prove = function () {
4057
+    var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });
4058
+    var callback = this.extractCallback(args);
4059
+    var defaultBlock = this.extractDefaultBlock(args);
4060
+    var payload = this.toPayload(args);
4061
+
4062
+
4063
+    if (!callback) {
4064
+        return this._eth.prove(payload, defaultBlock);
4065
+    }
4066
+
4067
+    var self = this;
4068
+    this._eth.prove(payload, defaultBlock, function (error, output) {
4069
+        if (error) return callback(error, null);
4070
+
4071
+        callback(error, output);
4072
+    });
4073
+};
4074
+
4046 4075
 /**
4047 4076
  * Should be used to sendTransaction to solidity function
4048 4077
  *
@@ -4161,6 +4190,7 @@ SolidityFunction.prototype.attachToContract = function (contract) {
4161 4190
     var execute = this.execute.bind(this);
4162 4191
     execute.request = this.request.bind(this);
4163 4192
     execute.call = this.call.bind(this);
4193
+    execute.prove = this.prove.bind(this);
4164 4194
     execute.sendTransaction = this.sendTransaction.bind(this);
4165 4195
     execute.estimateGas = this.estimateGas.bind(this);
4166 4196
     execute.getData = this.getData.bind(this);
@@ -5310,6 +5340,13 @@ var methods = function () {
5310 5340
         inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
5311 5341
     });
5312 5342
 
5343
+    var prove = new Method({
5344
+        name: 'prove',
5345
+        call: 'eth_prove',
5346
+        params: 2,
5347
+        inputFormatter: [formatters.inputCallFormatter, formatters.inputDefaultBlockNumberFormatter]
5348
+    });
5349
+
5313 5350
     var estimateGas = new Method({
5314 5351
         name: 'estimateGas',
5315 5352
         call: 'eth_estimateGas',
@@ -5362,6 +5399,7 @@ var methods = function () {
5362 5399
         getTransactionReceipt,
5363 5400
         getTransactionCount,
5364 5401
         call,
5402
+        prove,
5365 5403
         estimateGas,
5366 5404
         sendRawTransaction,
5367 5405
         sendTransaction,

Loading…
Cancel
Save