Integrate new keyring (#693)

* Integrate new keyring

* Bump

* Bump version

* ed25519 dusl-support
This commit is contained in:
Jaco Greeff
2019-02-14 23:17:02 +01:00
committed by GitHub
parent e75040daac
commit ead67ec9d6
22 changed files with 150 additions and 66 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/api-derive",
"version": "0.42.19",
"version": "0.43.0",
"description": "Common functions used across Polkadot, derived from RPC calls and storage queries.",
"main": "index.js",
"keywords": [
@@ -31,8 +31,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-derive#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/api": "^0.42.19",
"@polkadot/types": "^0.42.19",
"@polkadot/api": "^0.43.0",
"@polkadot/types": "^0.43.0",
"@types/memoizee": "^0.4.2",
"@types/rx": "^4.1.1",
"memoizee": "^0.4.14",
+8 -8
View File
@@ -1,7 +1,7 @@
{
"name": "@polkadot/api",
"version": "0.42.19",
"description": "An RxJS wrapper around the Polkadot JS RPC",
"version": "0.43.0",
"description": "Promise and RxJS wrappers around the Polkadot JS RPC",
"main": "index.js",
"keywords": [
"Polkadot",
@@ -30,12 +30,12 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/api#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/api-derive": "^0.42.19",
"@polkadot/extrinsics": "^0.42.19",
"@polkadot/rpc-provider": "^0.42.19",
"@polkadot/rpc-rx": "^0.42.19",
"@polkadot/storage": "^0.42.19",
"@polkadot/types": "^0.42.19",
"@polkadot/api-derive": "^0.43.0",
"@polkadot/extrinsics": "^0.43.0",
"@polkadot/rpc-provider": "^0.43.0",
"@polkadot/rpc-rx": "^0.43.0",
"@polkadot/storage": "^0.43.0",
"@polkadot/types": "^0.43.0",
"@types/rx": "^4.1.1",
"rxjs": "^6.3.3"
}
@@ -7,7 +7,7 @@ import testingPairs from '@polkadot/keyring/testingPairs';
import Api from '../../src/promise';
const keyring = testingPairs();
const keyring = testingPairs({ type: 'ed25519' });
describe.skip('e2e queries', () => {
let api;
+54 -2
View File
@@ -3,19 +3,24 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import testingPairs from '@polkadot/keyring/testingPairs';
import createPair from '@polkadot/keyring/pair';
import { randomAsHex } from '@polkadot/util-crypto';
import { stringToU8a } from '@polkadot/util';
import Api from '../../src/promise';
import WsProvider from '../../../rpc-provider/src/ws';
import SingleAccountSigner from "../util/SingleAccountSigner";
const keyring = testingPairs();
const keyring = testingPairs({ type: 'ed25519' });
describe.skip('e2e transactions', () => {
let api;
beforeEach(async (done) => {
if (!api) {
api = await Api.create();
api = await Api.create({
provider: new WsProvider('ws://127.0.0.1:9944')
});
}
jest.setTimeout(30000);
@@ -154,4 +159,51 @@ describe.skip('e2e transactions', () => {
expect(hash.toHex()).toHaveLength(66);
});
it('makes a transfer, swaps types and then another one', async (done) => {
const pair = createPair('sr25519', { seed: stringToU8a('testing123'.padEnd(32)) });
function doOne (cb) {
return api.tx.balances
.transfer(pair.address(), 123456)
.signAndSend(keyring.dave, ({ events, status, type }) => {
console.log('One: Transaction status:', type);
if (type === 'Finalised') {
console.log('Completed at block hash', status.value.toHex());
console.log('Events:');
events.forEach(({ phase, event: { data, method, section } }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
cb()
}
});
};
function doTwo (cb) {
return api.tx.balances
.transfer(keyring.alice.address(), 12345)
.signAndSend(pair, ({ events, status, type }) => {
console.log('One: Transaction status:', type);
if (type === 'Finalised') {
console.log('Completed at block hash', status.value.toHex());
console.log('Events:');
events.forEach(({ phase, event: { data, method, section } }) => {
console.log('\t', phase.toString(), `: ${section}.${method}`, data.toString());
});
cb()
}
});
}
// return doTwo(done);
return doOne(() => {
doTwo(done)
});
});
});
+1 -1
View File
@@ -7,7 +7,7 @@ import testingPairs from '@polkadot/keyring/testingPairs';
import Api from '../../src/rx';
const keyring = testingPairs();
const keyring = testingPairs({ type: 'ed25519' });
describe.skip('e2e queries', () => {
let api;
+1 -1
View File
@@ -7,7 +7,7 @@ import testingPairs from '@polkadot/keyring/testingPairs';
import Api from '../../src/rx';
const keyring = testingPairs();
const keyring = testingPairs({ type: 'ed25519' });
describe.skip('e2e transactions', () => {
let api;
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-core",
"version": "0.42.19",
"version": "0.43.0",
"description": "A JavaScript wrapper for the Polkadot JsonRPC interface",
"main": "index.js",
"keywords": [
@@ -30,9 +30,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-core#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/jsonrpc": "^0.42.19",
"@polkadot/rpc-provider": "^0.42.19",
"@polkadot/types": "^0.42.19",
"@polkadot/util": "^0.33.36"
"@polkadot/jsonrpc": "^0.43.0",
"@polkadot/rpc-provider": "^0.43.0",
"@polkadot/types": "^0.43.0",
"@polkadot/util": "^0.34.6"
}
}
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-provider",
"version": "0.42.19",
"version": "0.43.0",
"description": "Transport providers for the API",
"main": "index.js",
"keywords": [
@@ -30,10 +30,10 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-provider#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/keyring": "^0.33.36",
"@polkadot/storage": "^0.42.19",
"@polkadot/util": "^0.33.36",
"@polkadot/util-crypto": "^0.33.36",
"@polkadot/keyring": "^0.34.6",
"@polkadot/storage": "^0.43.0",
"@polkadot/util": "^0.34.6",
"@polkadot/util-crypto": "^0.34.6",
"@types/nock": "^9.3.0",
"eventemitter3": "^3.1.0",
"isomorphic-fetch": "^2.2.1",
+1 -1
View File
@@ -30,7 +30,7 @@ const SUBSCRIPTIONS: string[] = Array.prototype.concat.apply(
)
);
const keyring = testKeyring();
const keyring = testKeyring({ type: 'sr25519' });
const l = logger('api-mock');
/**
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/rpc-rx",
"version": "0.42.19",
"version": "0.43.0",
"description": "An RxJs wrapper around the Polkadot JS API",
"main": "index.js",
"keywords": [
@@ -30,8 +30,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/rpc-rx#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/rpc-core": "^0.42.19",
"@polkadot/rpc-provider": "^0.42.19",
"@polkadot/rpc-core": "^0.43.0",
"@polkadot/rpc-provider": "^0.43.0",
"@types/memoizee": "^0.4.2",
"@types/rx": "^4.1.1",
"memoizee": "^0.4.14",
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/extrinsics",
"version": "0.42.19",
"version": "0.43.0",
"main": "index.js",
"repository": "https://github.com/polkadot-js/api.git",
"author": "Jaco Greeff <jacogr@gmail.com>",
@@ -11,7 +11,7 @@
"license": "Apache-2.0",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/types": "^0.42.19",
"@polkadot/util": "^0.33.36"
"@polkadot/types": "^0.43.0",
"@polkadot/util": "^0.34.6"
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ import { Extrinsic } from '@polkadot/types/index';
import extrinsics from './static';
const keyring = testingPairs();
const keyring = testingPairs({ type: 'ed25519' });
describe('extrinsics', () => {
it('encodes extrinsic correctly (nobody)', () => {
@@ -8,7 +8,7 @@ import testingPairs from '@polkadot/keyring/testingPairs';
import extrinsics from '../../src/static';
const keyring = testingPairs();
const keyring = testingPairs({ type: 'ed25519' });
describe.skip('e2e transfer', () => {
let api;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/jsonrpc",
"version": "0.42.19",
"version": "0.43.0",
"description": "Method definitions for the Polkadot RPC layer",
"main": "index.js",
"engines": {
+5 -5
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/storage",
"version": "0.42.19",
"version": "0.43.0",
"description": "Generic wrapper wrapper around state storage",
"main": "index.js",
"engines": {
@@ -30,9 +30,9 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/type-storage#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/keyring": "^0.33.36",
"@polkadot/types": "^0.42.19",
"@polkadot/util": "^0.33.36",
"@polkadot/util-crypto": "^0.33.36"
"@polkadot/keyring": "^0.34.6",
"@polkadot/types": "^0.43.0",
"@polkadot/util": "^0.34.6",
"@polkadot/util-crypto": "^0.34.6"
}
}
+3 -3
View File
@@ -1,6 +1,6 @@
{
"name": "@polkadot/types",
"version": "0.42.19",
"version": "0.43.0",
"description": "Implementation of the Parity codec",
"main": "index.js",
"keywords": [
@@ -30,8 +30,8 @@
"homepage": "https://github.com/polkadot-js/api/tree/master/packages/types#readme",
"dependencies": {
"@babel/runtime": "^7.2.0",
"@polkadot/keyring": "^0.33.36",
"@polkadot/util": "^0.33.36",
"@polkadot/keyring": "^0.34.6",
"@polkadot/util": "^0.34.6",
"core-js": "^2.6.2"
}
}
+16
View File
@@ -12,3 +12,19 @@ import H512 from './H512';
*/
export default class Signature extends H512 {
}
/**
* @name Ed25519Signature
* @description
* The default Ed25519 that is used accross the system. It is currectly defined
* as a 512-bit value, represented by a [[H512]].
*/
export class Ed25519Signature extends Signature {}
/**
* @name Sr25519Signature
* @description
* The default Sr25519 signature that is used accross the system. It is currectly defined
* as a 512-bit value, represented by a [[H512]].
*/
export class Sr25519Signature extends Signature {}
+1 -1
View File
@@ -73,7 +73,7 @@ export { default as RuntimeVersion } from './RuntimeVersion';
export { default as Schedule } from './Schedule';
export { default as SeedOf } from './SeedOf';
export { default as SessionKey } from './SessionKey';
export { default as Signature } from './Signature';
export { default as Signature, Ed25519Signature, Sr25519Signature } from './Signature';
export { default as SignedBlock } from './SignedBlock';
export { default as StorageChangeSet } from './StorageChangeSet';
export { default as StorageData } from './StorageData';