2017-01-25 18:51:41 +01:00
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
2016-11-06 12:51:53 +01:00
// 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/>.
2017-04-08 11:28:04 +02:00
import { Quantity , Data } from '../types' ;
2017-02-01 10:58:09 +01:00
import { fromDecimal , Dummy } from '../helpers' ;
2016-11-06 12:51:53 +01:00
export default {
generateAuthorizationToken : {
2017-01-24 22:02:52 +01:00
desc : 'Generates a new authorization token.' ,
2016-11-06 12:51:53 +01:00
params : [ ] ,
returns : {
type : String ,
2017-01-24 22:02:52 +01:00
desc : 'The new authorization token.' ,
example : 'bNGY-iIPB-j7zK-RSYZ'
2016-11-06 12:51:53 +01:00
}
} ,
2016-12-27 11:15:02 +01:00
generateWebProxyAccessToken : {
2017-01-24 22:02:52 +01:00
desc : 'Generates a new web proxy access token.' ,
2017-06-22 20:05:40 +02:00
params : [ {
type : String ,
desc : 'Domain for which the token is valid. Only requests to this domain will be allowed.' ,
example : 'https://parity.io'
} ] ,
2016-12-27 11:15:02 +01:00
returns : {
type : String ,
2017-01-24 22:02:52 +01:00
desc : 'The new web proxy access token.' ,
example : 'MOWm0tEJjwthDiTU'
2016-12-27 11:15:02 +01:00
}
} ,
2016-11-06 12:51:53 +01:00
requestsToConfirm : {
2017-01-24 22:02:52 +01:00
desc : 'Returns a list of the transactions awaiting authorization.' ,
2016-11-06 12:51:53 +01:00
params : [ ] ,
returns : {
2017-01-24 22:02:52 +01:00
// TODO: Types of the fields of transaction objects? Link to a transaction object in another page?
2016-11-06 12:51:53 +01:00
type : Array ,
2017-01-24 22:02:52 +01:00
desc : 'A list of the outstanding transactions.' ,
2017-02-01 10:58:09 +01:00
example : new Dummy ( '[ ... ]' )
2016-11-06 12:51:53 +01:00
}
} ,
confirmRequest : {
desc : 'Confirm a request in the signer queue' ,
params : [
{
type : Quantity ,
2017-01-24 22:02:52 +01:00
desc : 'The request id.' ,
example : fromDecimal ( 1 )
2016-11-06 12:51:53 +01:00
} ,
{
type : Object ,
2017-01-24 22:02:52 +01:00
desc : 'Modify the transaction before confirmation.' ,
details : {
gasPrice : {
type : Quantity ,
desc : 'Modify the gas price provided by the sender in Wei.' ,
optional : true
} ,
gas : {
type : Quantity ,
desc : 'Gas provided by the sender in Wei.' ,
optional : true
} ,
2017-04-08 11:28:04 +02:00
condition : {
type : Object ,
desc : 'Condition for scheduled transaction. Can be either an integer block number `{ block: 1 }` or UTC timestamp (in seconds) `{ timestamp: 1491290692 }`.' ,
2017-01-24 22:02:52 +01:00
optional : true
}
} ,
example : { }
2016-11-06 12:51:53 +01:00
} ,
{
type : String ,
2017-01-24 22:02:52 +01:00
desc : 'The account password' ,
example : 'hunter2'
2016-11-06 12:51:53 +01:00
}
] ,
returns : {
2017-02-01 10:58:09 +01:00
type : Object ,
desc : 'The status of the confirmation, depending on the request type.' ,
example : { }
2016-11-06 12:51:53 +01:00
}
} ,
2016-11-10 11:27:05 +01:00
confirmRequestRaw : {
desc : 'Confirm a request in the signer queue providing signed request.' ,
params : [
{
type : Quantity ,
2017-01-24 22:02:52 +01:00
desc : 'Integer - The request id' ,
example : fromDecimal ( 1 )
2016-11-10 11:27:05 +01:00
} ,
{
type : Data ,
2017-01-24 22:02:52 +01:00
desc : 'Signed request (RLP encoded transaction)' ,
example : '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675'
2016-11-10 11:27:05 +01:00
}
] ,
returns : {
2017-02-01 10:58:09 +01:00
type : Object ,
desc : 'The status of the confirmation, depending on the request type.' ,
example : { }
}
} ,
confirmRequestWithToken : {
2017-04-08 11:28:04 +02:00
desc : 'Confirm specific request with rolling token.' ,
2017-02-01 10:58:09 +01:00
params : [
{
type : Quantity ,
desc : 'The request id.' ,
example : fromDecimal ( 1 )
} ,
{
type : Object ,
desc : 'Modify the transaction before confirmation.' ,
details : {
gasPrice : {
type : Quantity ,
desc : 'Modify the gas price provided by the sender in Wei.' ,
optional : true
} ,
gas : {
type : Quantity ,
desc : 'Gas provided by the sender in Wei.' ,
optional : true
} ,
2017-04-08 11:28:04 +02:00
condition : {
type : Object ,
desc : 'Conditional submission of the transaction. Can be either an integer block number `{ block: 1 }` or UTC timestamp (in seconds) `{ time: 1491290692 }` or `null`.' ,
2017-02-01 10:58:09 +01:00
optional : true
}
} ,
example : { }
} ,
{
type : String ,
2017-04-08 11:28:04 +02:00
desc : 'Password (initially) or a token returned by the previous call.' ,
2017-02-01 10:58:09 +01:00
example : 'hunter2'
}
] ,
returns : {
type : Object ,
desc : 'Status.' ,
details : {
result : {
type : Object ,
desc : 'The status of the confirmation, depending on the request type.'
} ,
token : {
type : String ,
2017-04-08 11:28:04 +02:00
desc : 'Token used to authenticate the next request.'
2017-02-01 10:58:09 +01:00
}
} ,
example : {
result : new Dummy ( '{ ... }' ) ,
token : 'cAF2w5LE7XUZ3v3N'
}
2016-11-10 11:27:05 +01:00
}
} ,
2016-11-06 12:51:53 +01:00
rejectRequest : {
desc : 'Rejects a request in the signer queue' ,
params : [
{
type : Quantity ,
2017-01-24 22:02:52 +01:00
desc : 'Integer - The request id' ,
example : fromDecimal ( 1 )
2016-11-06 12:51:53 +01:00
}
] ,
returns : {
type : Boolean ,
2017-01-24 22:02:52 +01:00
desc : 'The status of the rejection' ,
example : true
2016-11-06 12:51:53 +01:00
}
} ,
signerEnabled : {
2017-02-01 10:58:09 +01:00
nodoc : 'Not present in Rust code' ,
2016-11-06 12:51:53 +01:00
desc : 'Returns whether signer is enabled/disabled.' ,
params : [ ] ,
returns : {
type : Boolean ,
2017-01-24 22:02:52 +01:00
desc : '`true` when enabled, `false` when disabled.' ,
example : true
2016-11-06 12:51:53 +01:00
}
2017-06-13 14:07:39 +02:00
} ,
// Pub-Sub
subscribePending : {
desc : `
Starts a subscription for transactions in the confirmation queue .
Each event contains all transactions currently in the queue .
An example notification received by subscribing to this event :
\ ` \` \`
{ "jsonrpc" : "2.0" , "method" : "signer_pending" , "params" : { "subscription" : "0x416d77337e24399d" , "result" : [ ] } }
\ ` \` \`
You can unsubscribe using \ ` signer_unsubscribePending \` RPC method. Subscriptions are also tied to a transport
connection , disconnecting causes all subscriptions to be canceled .
` ,
params : [ ] ,
returns : {
type : String ,
desc : 'Assigned subscription ID' ,
example : '0x416d77337e24399d'
}
} ,
unsubscribePending : {
desc : 'Unsubscribes from pending transactions subscription.' ,
params : [ {
type : String ,
desc : 'Subscription ID' ,
example : '0x416d77337e24399d'
} ] ,
returns : {
type : Boolean ,
2017-06-14 11:45:44 +02:00
desc : 'whether the call was successful' ,
example : true
2017-06-13 14:07:39 +02:00
}
2016-11-06 12:51:53 +01:00
}
} ;