@parity/api
Version:
The Parity Promise-based API library for interfacing with Ethereum over RPC
56 lines (55 loc) • 2.56 kB
JavaScript
;
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
var _a = require('../../format/input'), inData = _a.inData, inNumber16 = _a.inNumber16, inOptions = _a.inOptions;
var outSignerRequest = require('../../format/output').outSignerRequest;
var Signer = /** @class */ (function () {
function Signer(provider) {
this._provider = provider;
}
Signer.prototype.confirmRequest = function (requestId, options, password) {
return this._provider
.send('signer_confirmRequest', inNumber16(requestId), inOptions(options), password);
};
Signer.prototype.confirmRequestRaw = function (requestId, data) {
return this._provider
.send('signer_confirmRequestRaw', inNumber16(requestId), inData(data));
};
Signer.prototype.confirmRequestWithToken = function (requestId, options, password) {
return this._provider
.send('signer_confirmRequestWithToken', inNumber16(requestId), inOptions(options), password);
};
Signer.prototype.generateAuthorizationToken = function () {
return this._provider
.send('signer_generateAuthorizationToken');
};
Signer.prototype.generateWebProxyAccessToken = function (domain) {
return this._provider
.execute('signer_generateWebProxyAccessToken', domain);
};
Signer.prototype.rejectRequest = function (requestId) {
return this._provider
.send('signer_rejectRequest', inNumber16(requestId));
};
Signer.prototype.requestsToConfirm = function () {
return this._provider
.send('signer_requestsToConfirm')
.then(function (requests) { return (requests || []).map(outSignerRequest); });
};
Signer.prototype.signerEnabled = function () {
return this._provider
.send('signer_signerEnabled');
};
return Signer;
}());
module.exports = Signer;