Initial new UI source code import (#2607)

* address -> name mappings

* expanding, loading all coin details

* send use only actual BasicCoin tokens registered (any reg)

* sending token & accounts

* form styling updates

* send form layout in place

* coin send working as expected

* api subscriptions on multiple addresses

* bring in events

* simplify

* basic events display in-place, functionally complete

* basic functionality in-place

* fix horrible event address issue

* rwork display of events slightly

* test TLA availability

* table for owner -> tokens

* fix signature lookup address

* fix signature lookup address

* basic overview styling

* txhash links

* page layout adjustments

* background import

* adjust colors

* no global registration, simplify color selection

* updated styling

* connection dialog for "busy connecting"

* initial token connection - WIP

* init token updates take place

* basic test for manual token

* rework connection display

* allow updates of the secure token

* first stab at making the build build

* update runner tags

* fix linting issues

* skip tests requiring network (should be e2e, TODO)

* re-enable javascript tag/runner

* release push does the trick

* push to any branch, CI name

* javscript-test runner as well

* swap dependencies build requires test

* revert stages swap

* retrieve images associated with tokens

* remove js build deps order

* null image when hash = 0x0

* 6x64 images (hashes for registries)

* don't pass tokens as prop to IdentityIcon

* check images against content hash pictures

* cleanup signer after connection changes

* fix naming typo

* display unknownImages for balances (not available as content hash)

* unknownImage for transfer dialog

* basic githubhint layout

* single input for commit/filename

* ethcore_hashContent call

* lookup hash

* registration in place

* fixes

* events is using a proper table

* pass value through as-is

* stop wrongly using main app IdentityIcon

* NEVER export class instance functions

* alignment back to normal

* typo  in definition

* set & get images working (mostly)

* show content retrieval info

* set exitcode via ||

* use javascript:latest images

* disable npm progress bar

* rename phase I

* rename phase II

* only send build output to GitHub on major branches

* also run the build step as part of the test (until comprehensive)

* ci-specific build (no webpack progress)

* allow for account creation via recovery phrase

* display account uuid (where available), closes #2546

* connection dialog now shows up in dapps as well, closes #2538

* token images show up as expected

* IdentityName component added and deployed

* fix padding tests

* adjust tests to map to stricter 0x-prefixed hex

* render names via common component for the address -> name

* split lint into seperate script (early exit)

* test phases changed to lint, test & pack

* pack part of test phase

* remove files marked for deletion (cleanup)

* Signer cleanups, start moving in the direction of the rest

* add personal signer methods

* basic signer request subscription

* don't poll blockNumber when not connected

* missing return, creating massive ws queue backlogs

* ΞTH -> ETH

* fix failing tests

* registry uses setAddress to actually set addresses now

* bytes mapping operates on lowerCase hex strings

* sha3 ids for each application

* add dappreg to list of contracts

* adjust alignment of queries

* show gas estimation log

* abi with payable for register function

* add key as required

* image retrieval from dappreg

* use proper Image urls

* embed and link apps from Parity, retrieved via /api/apps

* filter apps that has been replaced

* proxy entry for parity-utils

* add basiccoin abi

* add support for fallback abi type

* capture constructor paramaters

* merge master into js

* move images to assets/images/

* add font assets

* import fonts as part of build

* don't inline woff files

* Revert "merge master into js"

This reverts commit cfcfa81bd26f1b3cbc748d3afa1eb5c670b363fe.

* remove unused npm packages

* information on gas estimates (like almost everywhere else)

* don't pass gas & gasPrice to estimation

* display account passwordhint when available

* signer subscriptions based on polling & function trapping

* pending requests retrieved via jsapi

* update signer middleware

* remove all web3 instances

* remove web3 package

* last web3 dependencies removed

* no need to toChecksumAddress - api takes care of it

* expand description for personal_confirmRequest

* Signer conversion from web3 -> parity.js completed

* explicit in no return

* green circle background

* remove generated background

* convert /api/* paths to localhost:8080/api/* paths (hard-coded, temporary)

* change dapps to load from localhost:8080/ui/*

* remove dangling web3 files

* update manager test for signer

* /api/ping -> /

* additional token images

* additional token images

* add missing styles.css for 8180 error pages

* cater for txhash returning null/empty object

* adjust output directories

* Release merge with origin with ours strategy

* additional token images

* cater for development server

* s/localhost/127.0.0.1/ (cater for origin)

* Fix address selection for contract deployment

* Adjust z-index for error overlay

* better text on unique background pattern

* fix signer rejections

* Don't allow gavcoin transfer with no balance

* fix txhash rendering in signer

* remove unnecessary ParityBackground

* script to update js-precompiled

* Redirect from :8080 to :8180

* Remove extra return

* Dapp logo images
This commit is contained in:
Jaco Greeff
2016-10-18 11:52:56 +02:00
committed by Gav Wood
parent 6c7af57529
commit 1e6a2cb378
969 changed files with 57315 additions and 0 deletions

20
js/src/jsonrpc/README.md Normal file
View File

@@ -0,0 +1,20 @@
# jsonrpc
JSON file of all ethereum's rpc methods supported by parity
## interfaces
[interfaces.md](release/interfaces.md) contains the auto-generated list of interfaces exposed, along with their relevant documentation
## contributing
0. Clone the repo
0. Branch
0. Add the missing interfaces only into `src/interfaces/*.js`
0. Parameters (array) & Returns take objects of type
- `{ type: [Array|Boolean|Object|String|...], desc: 'some description' }`
- Types are built-in JS types or those defined in `src/types.js` (e.g. `BlockNumber`, `Quantity`, etc.)
- If a formatter is required, add it as `format: 'string-type'`
0. Run the lint & tests, `npm run lint && npm run testOnce`
0. Generate via `npm run build` which outputs `index.js`, `index.json` & `interfaces.md` (Only required until Travis is fully in-place)
0. Check-in and make a PR

View File

@@ -0,0 +1,67 @@
// Copyright 2015, 2016 Ethcore (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/>.
import fs from 'fs';
import path from 'path';
import interfaces from '../';
const INDEX_JSON = path.join(__dirname, '../../release/index.json');
const methods = [];
function formatDescription (obj) {
const optional = obj.optional ? '(optional) ' : '';
const defaults = obj.default ? `(default: ${obj.default}) ` : '';
return `${obj.type.name} - ${optional}${defaults}${obj.desc}`;
}
function formatType (obj) {
if (obj.type === Object && obj.details) {
const formatted = {};
Object.keys(obj.details).sort().forEach((key) => {
formatted[key] = formatType(obj.details[key]);
});
return {
desc: formatDescription(obj),
details: formatted
};
} else if (obj.type && obj.type.name) {
return formatDescription(obj);
}
return obj;
}
Object.keys(interfaces).sort().forEach((group) => {
Object.keys(interfaces[group]).sort().forEach((name) => {
const method = interfaces[group][name];
const deprecated = method.deprecated ? ' (Deprecated and not supported, to be removed in a future version)' : '';
methods.push({
name: `${group}_${name}`,
desc: `${method.desc}${deprecated}`,
params: method.params.map(formatType),
returns: formatType(method.returns),
inputFormatters: method.params.map((param) => param.format || null),
outputFormatter: method.returns.format || null
});
});
});
fs.writeFileSync(INDEX_JSON, JSON.stringify({ methods: methods }, null, 2), 'utf8');

View File

@@ -0,0 +1,69 @@
// Copyright 2015, 2016 Ethcore (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/>.
import fs from 'fs';
import path from 'path';
import interfaces from '../';
const MARKDOWN = path.join(__dirname, '../../release/interfaces.md');
let preamble = '# interfaces\n';
let markdown = '';
function formatDescription (obj, prefix = '', indent = '') {
const optional = obj.optional ? '(optional) ' : '';
const defaults = obj.default ? `(default: ${obj.default}) ` : '';
return `${indent}- ${prefix}\`${obj.type.name}\` - ${optional}${defaults}${obj.desc}`;
}
function formatType (obj) {
if (obj.type === Object && obj.details) {
const sub = Object.keys(obj.details).sort().map((key) => {
return formatDescription(obj.details[key], `\`${key}\`/`, ' ');
}).join('\n');
return `${formatDescription(obj)}\n${sub}`;
} else if (obj.type && obj.type.name) {
return formatDescription(obj);
}
return obj;
}
Object.keys(interfaces).sort().forEach((group) => {
let content = '';
preamble = `${preamble}\n- [${group}](#${group})`;
markdown = `${markdown}\n## ${group}\n`;
Object.keys(interfaces[group]).sort().forEach((iname) => {
const method = interfaces[group][iname];
const name = `${group}_${iname}`;
const deprecated = method.deprecated ? ' (Deprecated and not supported, to be removed in a future version)' : '';
const desc = `${method.desc}${deprecated}`;
const params = method.params.map(formatType).join('\n');
const returns = formatType(method.returns);
markdown = `${markdown}\n- [${name}](#${name})`;
content = `${content}### ${name}\n\n${desc}\n\n#### parameters\n\n${params || 'none'}\n\n#### returns\n\n${returns || 'none'}\n\n`;
});
markdown = `${markdown}\n\n${content}`;
});
fs.writeFileSync(MARKDOWN, `${preamble}\n\n${markdown}`, 'utf8');

35
js/src/jsonrpc/index.js Normal file
View File

@@ -0,0 +1,35 @@
// Copyright 2015, 2016 Ethcore (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/>.
import db from './interfaces/db';
import eth from './interfaces/eth';
import ethcore from './interfaces/ethcore';
import net from './interfaces/net';
import personal from './interfaces/personal';
import shh from './interfaces/shh';
import trace from './interfaces/trace';
import web3 from './interfaces/web3';
export default {
db: db,
eth: eth,
ethcore: ethcore,
net: net,
personal: personal,
shh: shh,
trace: trace,
web3: web3
};

View File

@@ -0,0 +1,62 @@
// Copyright 2015, 2016 Ethcore (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/>.
import interfaces from './';
import { Address, BlockNumber, Data, Hash, Integer, Quantity } from './types';
const flatlist = {};
function verifyType (obj) {
if (typeof obj !== 'string') {
expect(obj).to.satisfy(() => {
return obj.type === Array ||
obj.type === Boolean ||
obj.type === Object ||
obj.type === String ||
obj.type === Address ||
obj.type === BlockNumber ||
obj.type === Data ||
obj.type === Hash ||
obj.type === Integer ||
obj.type === Quantity;
});
}
}
describe('jsonrpc/interfaces', () => {
Object.keys(interfaces).forEach((group) => {
describe(group, () => {
Object.keys(interfaces[group]).forEach((name) => {
const method = interfaces[group][name];
flatlist[`${group}_${name}`] = true;
describe(name, () => {
it('has the correct interface', () => {
expect(method.desc).to.be.a('string');
expect(method.params).to.be.an('array');
expect(method.returns).to.satisfy((returns) => {
return typeof returns === 'string' || typeof returns === 'object';
});
method.params.forEach(verifyType);
verifyType(method.returns);
});
});
});
});
});
});

View File

@@ -0,0 +1,103 @@
// Copyright 2015, 2016 Ethcore (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/>.
import { Data } from '../types';
export default {
getHex: {
desc: 'Returns binary data from the local database.',
params: [
{
type: String,
desc: 'Database name'
},
{
type: String,
desc: 'Key name'
}
],
returns: {
type: Data,
desc: 'The previously stored data'
},
deprecated: true
},
getString: {
desc: 'Returns string from the local database.',
params: [
{
type: String,
desc: 'Database name'
},
{
type: String,
desc: 'Key name'
}
],
returns: {
type: String,
desc: 'The previously stored string'
},
deprecated: true
},
putHex: {
desc: 'Stores binary data in the local database.',
params: [
{
type: String,
desc: 'Database name'
},
{
type: String,
desc: 'Key name'
},
{
type: Data,
desc: 'The data to store'
}
],
returns: {
type: Boolean,
desc: '`true` if the value was stored, otherwise `false`'
},
deprecated: true
},
putString: {
desc: 'Stores a string in the local database.',
params: [
{
type: String,
desc: 'Database name'
},
{
type: String,
desc: 'Key name'
},
{
type: String,
desc: 'The string to store'
}
],
returns: {
type: Boolean,
desc: '`true` if the value was stored, otherwise `false`'
},
deprecated: true
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,315 @@
// Copyright 2015, 2016 Ethcore (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/>.
import { Address, Data, Hash, Quantity } from '../types';
export default {
acceptNonReservedPeers: {
desc: '?',
params: [],
returns: {
type: Boolean,
desc: '?'
}
},
addReservedPeer: {
desc: '?',
params: [
{
type: String,
desc: 'Enode'
}
],
returns: {
type: Boolean,
desc: '?'
}
},
defaultExtraData: {
desc: 'Returns the default extra data',
params: [],
returns: {
type: Data,
desc: 'Extra data'
}
},
devLogs: {
desc: 'Returns latest logs of your node',
params: [],
returns: {
type: Array,
desc: 'Development logs'
}
},
devLogsLevels: {
desc: 'Returns current log level settings',
params: [],
returns: {
type: String,
decs: 'Current log level'
}
},
dropNonReservedPeers: {
desc: '?',
params: [],
returns: {
type: Boolean,
desc: '?'
}
},
extraData: {
desc: 'Returns currently set extra data',
params: [],
returns: {
type: Data,
desc: 'Extra data'
}
},
gasFloorTarget: {
desc: 'Returns current target for gas floor',
params: [],
returns: {
type: Quantity,
desc: 'Gas Floor Target',
format: 'outputBigNumberFormatter'
}
},
generateSecretPhrase: {
desc: 'Creates a secret phrase that can be associated with an account',
params: [],
returns: {
type: String,
desc: 'The secret phrase'
}
},
hashContent: {
desc: 'Creates a hash of the file as retrieved',
params: [
{
type: String,
desc: 'The url of the content'
}
],
returns: {
type: Hash,
desc: 'The hash of the content'
}
},
minGasPrice: {
desc: 'Returns currently set minimal gas price',
params: [],
returns: {
type: Quantity,
desc: 'Minimal Gas Price',
format: 'outputBigNumberFormatter'
}
},
netChain: {
desc: 'Returns the name of the connected chain.',
params: [],
returns: {
type: String,
desc: 'chain name'
}
},
netPeers: {
desc: 'Returns number of peers.',
params: [],
returns: {
type: Quantity,
desc: 'Number of peers'
}
},
netMaxPeers: {
desc: 'Returns maximal number of peers.',
params: [],
returns: {
type: Quantity,
desc: 'Maximal number of peers'
}
},
netPort: {
desc: 'Returns network port the node is listening on.',
params: [],
returns: {
type: Quantity,
desc: 'Port Number'
}
},
nodeName: {
desc: 'Returns node name (identity)',
params: [],
returns: {
type: String,
desc: 'Node name'
}
},
phraseToAddress: {
desc: 'Converts a secret phrase into the corresponting address',
params: [
{
type: String,
desc: 'The secret'
}
],
returns: {
type: Address,
desc: 'Corresponding address'
}
},
removeReservedPeer: {
desc: '?',
params: [
{
type: String,
desc: 'Encode'
}
],
returns: {
type: Boolean,
desc: '?'
}
},
registryAddress: {
desc: 'The address for the global registry',
params: [],
returns: {
type: Address,
desc: 'The registry address'
}
},
rpcSettings: {
desc: 'Returns basic settings of rpc (enabled, port, interface).',
params: [],
returns: {
type: Object,
desc: 'JSON object containing rpc settings'
}
},
setAuthor: {
desc: 'Changes author (coinbase) for mined blocks.',
params: [
{
type: Address,
desc: '20 Bytes - Address',
format: 'inputAddressFormatter'
}
],
returns: {
type: Boolean,
desc: 'whether the call was successful'
}
},
setExtraData: {
desc: 'Changes extra data for newly mined blocks',
params: [
{
type: Data,
desc: 'Extra Data',
format: 'utils.toHex'
}
],
returns: {
type: Boolean,
desc: 'whether the call was successful'
}
},
setGasFloorTarget: {
desc: 'Changes current gas floor target.',
params: [
{
type: Quantity,
desc: 'Gas Floor Target',
format: 'utils.toHex'
}
],
returns: {
type: Boolean,
desc: 'whether the call was successful'
}
},
setMinGasPrice: {
desc: 'Changes minimal gas price for transaction to be accepted to the queue.',
params: [
{
type: Quantity,
desc: 'Minimal gas price',
format: 'utils.toHex'
}
],
returns: {
type: Boolean,
desc: 'whether the call was successful'
}
},
setTransactionsLimit: {
desc: 'Changes limit for transactions in queue.',
params: [
{
type: Quantity,
desc: 'New Limit',
format: 'utils.toHex'
}
],
returns: {
type: Boolean,
desc: 'whether the call was successful'
}
},
transactionsLimit: {
desc: 'Changes limit for transactions in queue.',
params: [],
returns: {
type: Quantity,
desc: 'Current max number of transactions in queue',
format: 'outputBigNumberFormatter'
}
},
unsignedTransactionsCount: {
desc: 'Returns number of unsigned transactions when running with Trusted Signer. Error otherwise',
params: [],
returns: {
type: Quantity,
desc: 'Number of unsigned transactions'
}
}
};

View File

@@ -0,0 +1,47 @@
// Copyright 2015, 2016 Ethcore (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/>.
import { Quantity } from '../types';
export default {
listening: {
desc: 'Returns `true` if client is actively listening for network connections.',
params: [],
returns: {
type: Boolean,
desc: '`true` when listening, otherwise `false`.'
}
},
peerCount: {
desc: 'Returns number of peers currenly connected to the client.',
params: [],
returns: {
type: Quantity,
desc: 'Integer of the number of connected peers',
format: 'utils.toDecimal'
}
},
version: {
desc: 'Returns the current network protocol version.',
params: [],
returns: {
type: String,
desc: 'The current network protocol version'
}
}
};

View File

@@ -0,0 +1,288 @@
// Copyright 2015, 2016 Ethcore (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/>.
import { Address, Data, Quantity } from '../types';
export default {
accountsInfo: {
desc: 'returns a map of accounts as an object',
params: [],
returns: {
type: Array,
desc: 'Account metadata',
details: {
name: {
type: String,
desc: 'Account name'
},
meta: {
type: String,
desc: 'Encoded JSON string the defines additional account metadata'
},
uuid: {
type: String,
desc: 'The account UUID, or null if not available/unknown/not applicable.'
}
}
}
},
generateAuthorizationToken: {
desc: 'Generates a new authorization token',
params: [],
returns: {
type: String,
desc: 'The new authorization token'
}
},
requestsToConfirm: {
desc: 'Returns a list of the transactions requiring authorization',
params: [],
returns: {
type: Array,
desc: 'A list of the outstanding transactions'
}
},
confirmRequest: {
desc: 'Confirm a request in the signer queue',
params: [
{
type: Quantity,
desc: 'The request id'
},
{
type: Object,
desc: 'The request options'
},
{
type: String,
desc: 'The account password'
}
],
returns: {
type: Boolean,
desc: 'The status of the confirmation'
}
},
rejectRequest: {
desc: 'Rejects a request in the signer queue',
params: [
{
type: Quantity,
desc: 'The request id'
}
],
returns: {
type: Boolean,
desc: 'The status of the rejection'
}
},
listAccounts: {
desc: 'Returns a list of addresses owned by client.',
params: [],
returns: {
type: Array,
desc: '20 Bytes addresses owned by the client.'
}
},
listGethAccounts: {
desc: 'Returns a list of the accounts available from Geth',
params: [],
returns: {
type: Array,
desc: '20 Bytes addresses owned by the client.'
}
},
importGethAccounts: {
desc: 'Imports a list of accounts from geth',
params: [
{
type: Array,
desc: 'List of the geth addresses to import'
}
],
returns: {
type: Array,
desc: 'Array of the imported addresses'
}
},
newAccount: {
desc: 'Creates new account',
params: [
{
type: String,
desc: 'Password'
}
],
returns: {
type: Address,
desc: 'The created address'
}
},
newAccountFromPhrase: {
desc: 'Creates a new account from a brainwallet passphrase',
params: [
{
type: String,
desc: 'Phrase'
},
{
type: String,
desc: 'Password'
}
],
returns: {
type: Address,
desc: 'The created address'
}
},
newAccountFromWallet: {
desc: 'Creates a new account from a JSON import',
params: [
{
type: String,
desc: 'JSON'
},
{
type: String,
desc: 'Password'
}
],
returns: {
type: Address,
desc: 'The created address'
}
},
setAccountName: {
desc: 'Sets a name for the account',
params: [
{
type: Address,
desc: 'Address'
},
{
type: String,
desc: 'Name'
}
],
returns: {
type: Object,
desc: 'Returns null in all cases'
}
},
setAccountMeta: {
desc: 'Sets metadata for the account',
params: [
{
type: Address,
desc: 'Address'
},
{
type: String,
desc: 'Metadata (JSON encoded)'
}
],
returns: {
type: Object,
desc: 'Returns null in all cases'
}
},
signAndSendTransaction: {
desc: 'Sends and signs a transaction given account passphrase. Does not require the account to be unlocked nor unlocks the account for future transactions. ',
params: [
{
type: Object,
desc: 'The transaction object',
details: {
from: {
type: Address,
desc: '20 Bytes - The address the transaction is send from'
},
to: {
type: Address,
desc: '20 Bytes - (optional when creating new contract) The address the transaction is directed to'
},
gas: {
type: Quantity,
desc: 'Integer of the gas provided for the transaction execution. It will return unused gas',
optional: true,
default: 90000
},
gasPrice: {
type: Quantity,
desc: 'Integer of the gasPrice used for each paid gas',
optional: true,
default: 'To-Be-Determined'
},
value: {
type: Quantity,
desc: 'Integer of the value send with this transaction',
optional: true
},
data: {
type: Data,
desc: 'The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see [Ethereum Contract ABI](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI)'
},
nonce: {
type: Quantity,
desc: 'Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.',
optional: true
}
}
},
{
type: String,
desc: 'Passphrase to unlock `from` account.'
}
],
returns: {
type: Data,
desc: '32 Bytes - the transaction hash, or the zero hash if the transaction is not yet available'
}
},
signerEnabled: {
desc: 'Returns whether signer is enabled/disabled.',
params: [],
returns: {
type: Boolean,
desc: 'true when enabled, false when disabled'
}
},
unlockAccount: {
desc: '?',
params: [
'?', '?', '?'
],
returns: {
type: Boolean,
desc: 'whether the call was successful'
}
}
};

View File

@@ -0,0 +1,169 @@
// Copyright 2015, 2016 Ethcore (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/>.
import { Data, Quantity } from '../types';
export default {
version: {
desc: 'Returns the current whisper protocol version.',
params: [],
returns: {
type: String,
desc: 'The current whisper protocol version'
}
},
post: {
desc: 'Sends a whisper message.',
params: [
{
type: Object, desc: 'The whisper post object:', format: 'inputPostFormatter',
details: {
from: {
type: Data, desc: '60 Bytes - The identity of the sender',
optional: true
},
to: {
type: Data, desc: '60 Bytes - The identity of the receiver. When present whisper will encrypt the message so that only the receiver can decrypt it',
optional: true
},
topics: {
type: Array, desc: 'Array of `DATA` topics, for the receiver to identify messages'
},
payload: {
type: Data, desc: 'The payload of the message'
},
priority: {
type: Quantity, desc: 'The integer of the priority in a rang from ... (?)'
},
ttl: {
type: Quantity, desc: 'Integer of the time to live in seconds.'
}
}
}
],
returns: {
type: Boolean,
desc: '`true` if the message was send, otherwise `false`'
}
},
newIdentity: {
desc: 'Creates new whisper identity in the client.',
params: [],
returns: {
type: Data,
desc: '60 Bytes - the address of the new identiy'
}
},
hasIdentity: {
desc: 'Checks if the client hold the private keys for a given identity.',
params: [
{
type: Data,
desc: '60 Bytes - The identity address to check'
}
],
returns: {
type: Boolean,
desc: '`true` if the client holds the privatekey for that identity, otherwise `false`'
}
},
newGroup: {
desc: '(?)',
params: [],
returns: {
type: Data, desc: '60 Bytes - the address of the new group. (?)'
}
},
addToGroup: {
desc: '(?)',
params: [
{
type: Data,
desc: '60 Bytes - The identity address to add to a group (?)'
}
],
returns: {
type: Boolean,
desc: '`true` if the identity was successfully added to the group, otherwise `false` (?)'
}
},
newFilter: {
desc: 'Creates filter to notify, when client receives whisper message matching the filter options.',
params: [
{
type: Object, desc: 'The filter options:',
details: {
to: {
type: Data, desc: '60 Bytes - Identity of the receiver. *When present it will try to decrypt any incoming message if the client holds the private key to this identity.*',
optional: true
},
topics: {
type: Array, desc: 'Array of `DATA` topics which the incoming message\'s topics should match. You can use the following combinations'
}
}
}
],
returns: {
type: Quantity,
desc: 'The newly created filter'
}
},
uninstallFilter: {
desc: 'Uninstalls a filter with given id. Should always be called when watch is no longer needed.\nAdditonally Filters timeout when they aren\'t requested with [shh_getFilterChanges](#shh_getfilterchanges) for a period of time.',
params: [
{
type: Quantity,
desc: 'The filter id'
}
],
returns: {
type: Boolean,
desc: '`true` if the filter was successfully uninstalled, otherwise `false`'
}
},
getFilterChanges: {
desc: 'Polling method for whisper filters. Returns new messages since the last call of this method.\n**Note** calling the [shh_getMessages](#shh_getmessages) method, will reset the buffer for this method, so that you won\'t receive duplicate messages.',
params: [
{
type: Quantity,
desc: 'The filter id'
}
],
returns: {
type: Array,
desc: 'Array of messages received since last poll'
}
},
getMessages: {
desc: 'Get all messages matching a filter. Unlike `shh_getFilterChanges` this returns all messages.',
params: [
{
type: Quantity,
desc: 'The filter id'
}
],
returns: 'See [shh_getFilterChanges](#shh_getfilterchanges)'
}
};

View File

@@ -0,0 +1,79 @@
// Copyright 2015, 2016 Ethcore (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/>.
import { BlockNumber, Hash, Integer } from '../types';
export default {
filter: {
desc: 'Returns traces matching given filter',
params: [
{
type: Object,
desc: 'The filter object'
}
],
returns: {
type: Array,
desc: 'Traces matching given filter'
}
},
get: {
desc: 'Returns trace at given position.',
params: [
{
type: Hash,
desc: 'Transaction hash'
},
{
type: Integer,
desc: 'Trace position witing transaction'
}
],
returns: {
type: Object,
desc: 'Trace object'
}
},
transaction: {
desc: 'Returns all traces of given transaction',
params: [
{
type: Hash,
desc: 'Transaction hash'
}
],
returns: {
type: Array,
desc: 'Traces of given transaction'
}
},
block: {
desc: 'Returns traces created at given block',
params: [
{
type: BlockNumber,
desc: 'Integer block number, or \'latest\' for the last mined block or \'pending\', \'earliest\' for not yet mined transactions'
}
],
returns: {
type: Array,
desc: 'Block traces'
}
}
};

View File

@@ -0,0 +1,42 @@
// Copyright 2015, 2016 Ethcore (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/>.
import { Data } from '../types';
export default {
clientVersion: {
desc: 'Returns the current client version.',
params: [],
returns: {
type: String,
desc: 'The current client version'
}
},
sha3: {
desc: 'Returns Keccak-256 (*not* the standardized SHA3-256) of the given data.',
params: [
{
type: String,
desc: 'The data to convert into a SHA3 hash'
}
],
returns: {
type: Data,
desc: 'The SHA3 result of the given string'
}
}
};

View File

@@ -0,0 +1,12 @@
import babel from 'rollup-plugin-babel';
export default {
entry: 'src/index.js',
dest: 'release/index.js',
format: 'cjs',
plugins: [babel({
babelrc: false,
presets: ['es2015-rollup', 'stage-0'],
runtimeHelpers: true
})]
};

27
js/src/jsonrpc/types.js Normal file
View File

@@ -0,0 +1,27 @@
// Copyright 2015, 2016 Ethcore (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/>.
export class Address {}
export class BlockNumber {}
export class Data {}
export class Hash {}
export class Integer {}
export class Quantity {}