mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
whisper: Update the shh.js part of web3.js
According to Fabian, the whole file could not be integrated (I confirm that it produces some errors with `eth.js`) so I decided to only update the part that I need, which has no impact outside of Whisper since it's just the part describing how the `shh` object should be built.
This commit is contained in:
parent
2c1a0977a1
commit
78cd11427c
2 changed files with 100 additions and 42 deletions
File diff suppressed because one or more lines are too long
|
|
@ -5608,12 +5608,12 @@ module.exports = Personal;
|
||||||
*/
|
*/
|
||||||
/** @file shh.js
|
/** @file shh.js
|
||||||
* @authors:
|
* @authors:
|
||||||
* Marek Kotewicz <marek@ethdev.com>
|
* Fabian Vogelsteller <fabian@ethereum.org>
|
||||||
* @date 2015
|
* Marek Kotewicz <marek@ethcore.io>
|
||||||
|
* @date 2017
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Method = require('../method');
|
var Method = require('../method');
|
||||||
var formatters = require('../formatters');
|
|
||||||
var Filter = require('../filter');
|
var Filter = require('../filter');
|
||||||
var watches = require('./watches');
|
var watches = require('./watches');
|
||||||
|
|
||||||
|
|
@ -5628,49 +5628,107 @@ var Shh = function (web3) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Shh.prototype.filter = function (fil, callback) {
|
Shh.prototype.newMessageFilter = function (options, callback, filterCreationErrorCallback) {
|
||||||
return new Filter(this._requestManager, fil, watches.shh(), formatters.outputPostFormatter, callback);
|
return new Filter(options, 'shh', this._requestManager, watches.shh(), null, callback, filterCreationErrorCallback);
|
||||||
};
|
};
|
||||||
|
|
||||||
var methods = function () {
|
var methods = function () {
|
||||||
|
|
||||||
var post = new Method({
|
|
||||||
name: 'post',
|
|
||||||
call: 'shh_post',
|
|
||||||
params: 1,
|
|
||||||
inputFormatter: [formatters.inputPostFormatter]
|
|
||||||
});
|
|
||||||
|
|
||||||
var newIdentity = new Method({
|
|
||||||
name: 'newIdentity',
|
|
||||||
call: 'shh_newIdentity',
|
|
||||||
params: 0
|
|
||||||
});
|
|
||||||
|
|
||||||
var hasIdentity = new Method({
|
|
||||||
name: 'hasIdentity',
|
|
||||||
call: 'shh_hasIdentity',
|
|
||||||
params: 1
|
|
||||||
});
|
|
||||||
|
|
||||||
var newGroup = new Method({
|
|
||||||
name: 'newGroup',
|
|
||||||
call: 'shh_newGroup',
|
|
||||||
params: 0
|
|
||||||
});
|
|
||||||
|
|
||||||
var addToGroup = new Method({
|
|
||||||
name: 'addToGroup',
|
|
||||||
call: 'shh_addToGroup',
|
|
||||||
params: 0
|
|
||||||
});
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
post,
|
new Method({
|
||||||
newIdentity,
|
name: 'version',
|
||||||
hasIdentity,
|
call: 'shh_version',
|
||||||
newGroup,
|
params: 0
|
||||||
addToGroup
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'info',
|
||||||
|
call: 'shh_info',
|
||||||
|
params: 0
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'setMaxMessageSize',
|
||||||
|
call: 'shh_setMaxMessageSize',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'setMinPoW',
|
||||||
|
call: 'shh_setMinPoW',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'markTrustedPeer',
|
||||||
|
call: 'shh_markTrustedPeer',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'newKeyPair',
|
||||||
|
call: 'shh_newKeyPair',
|
||||||
|
params: 0
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'addPrivateKey',
|
||||||
|
call: 'shh_addPrivateKey',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'deleteKeyPair',
|
||||||
|
call: 'shh_deleteKeyPair',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'hasKeyPair',
|
||||||
|
call: 'shh_hasKeyPair',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'getPublicKey',
|
||||||
|
call: 'shh_getPublicKey',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'getPrivateKey',
|
||||||
|
call: 'shh_getPrivateKey',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'newSymKey',
|
||||||
|
call: 'shh_newSymKey',
|
||||||
|
params: 0
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'addSymKey',
|
||||||
|
call: 'shh_addSymKey',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'generateSymKeyFromPassword',
|
||||||
|
call: 'shh_generateSymKeyFromPassword',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'hasSymKey',
|
||||||
|
call: 'shh_hasSymKey',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'getSymKey',
|
||||||
|
call: 'shh_getSymKey',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
new Method({
|
||||||
|
name: 'deleteSymKey',
|
||||||
|
call: 'shh_deleteSymKey',
|
||||||
|
params: 1
|
||||||
|
}),
|
||||||
|
|
||||||
|
// subscribe and unsubscribe are not implemented for whisper v5
|
||||||
|
|
||||||
|
new Method({
|
||||||
|
name: 'post',
|
||||||
|
call: 'shh_post',
|
||||||
|
params: 1,
|
||||||
|
inputFormatter: [null]
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue