Drop V1 support in derive (#1718)
* Drop V1 support in derive * Re-do staking with multi * Re-bump deps * Adjusts tests (no alice_session) * CC
This commit is contained in:
@@ -28,14 +28,14 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.7",
|
||||
"@polkadot/api-derive": "^1.0.0-beta.4",
|
||||
"@polkadot/keyring": "^2.0.0-beta.1",
|
||||
"@polkadot/keyring": "^2.0.0-beta.2",
|
||||
"@polkadot/metadata": "^1.0.0-beta.4",
|
||||
"@polkadot/rpc-core": "^1.0.0-beta.4",
|
||||
"@polkadot/rpc-provider": "^1.0.0-beta.4",
|
||||
"@polkadot/types": "^1.0.0-beta.4",
|
||||
"@polkadot/util-crypto": "^2.0.0-beta.1"
|
||||
"@polkadot/util-crypto": "^2.0.0-beta.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^2.0.0-beta.1"
|
||||
"@polkadot/keyring": "^2.0.0-beta.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,16 +4,24 @@
|
||||
|
||||
import { ApiOptions } from '../types';
|
||||
|
||||
import testingPairs from '@polkadot/keyring/testingPairs';
|
||||
import createPair from '@polkadot/keyring/pair';
|
||||
import testKeyring from '@polkadot/keyring/testing';
|
||||
import Mock from '@polkadot/rpc-provider/mock/index';
|
||||
import { createType, TypeRegistry } from '@polkadot/types';
|
||||
import { hexToU8a } from '@polkadot/util';
|
||||
|
||||
import { SingleAccountSigner } from '../../test/util';
|
||||
import ApiPromise from './Api';
|
||||
|
||||
describe('ApiPromise', (): void => {
|
||||
const registry = new TypeRegistry();
|
||||
const keyring = testingPairs({ type: 'ed25519' });
|
||||
const keyring = testKeyring({ type: 'ed25519' });
|
||||
const aliceEd = keyring.addPair(
|
||||
createPair('ed25519', {
|
||||
secretKey: hexToU8a('0xabf8e5bdbe30c65656c0a3cbd181ff8a56294a69dfedd27982aace4a7690911588dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee'),
|
||||
publicKey: hexToU8a('0x88dc3417d5058ec4b4503e0c12ea1a0a89be200fe98922423d4334014fa6b0ee')
|
||||
})
|
||||
);
|
||||
let provider: Mock;
|
||||
|
||||
beforeEach((): void => {
|
||||
@@ -63,7 +71,7 @@ describe('ApiPromise', (): void => {
|
||||
const api = new ApiPromise({ provider, registry });
|
||||
|
||||
expect(
|
||||
await api.sign(keyring.alice_session, TEST)
|
||||
await api.sign(aliceEd, TEST)
|
||||
).toEqual(SIG);
|
||||
});
|
||||
|
||||
@@ -71,7 +79,7 @@ describe('ApiPromise', (): void => {
|
||||
const api = new ApiPromise({
|
||||
provider,
|
||||
registry,
|
||||
signer: new SingleAccountSigner(registry, keyring.alice_session)
|
||||
signer: new SingleAccountSigner(registry, aliceEd)
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -82,11 +90,11 @@ describe('ApiPromise', (): void => {
|
||||
|
||||
describe('decorator.signAsync', (): void => {
|
||||
it('signs a transfer using an external signer', async (): Promise<void> => {
|
||||
const signer = new SingleAccountSigner(registry, keyring.alice_session);
|
||||
const signer = new SingleAccountSigner(registry, aliceEd);
|
||||
const api = await ApiPromise.create({ provider, registry, signer });
|
||||
const transfer = api.tx.balances.transfer(keyring.eve.address, 12345);
|
||||
const transfer = api.tx.balances.transfer(keyring.getPair('0xe659a7a1628cdd93febc04a4e0646ea20e9f5f0ce097d9a05290d4a9e054df4e').address, 12345);
|
||||
|
||||
await transfer.signAsync(keyring.alice_session, {});
|
||||
await transfer.signAsync(aliceEd, {});
|
||||
|
||||
expect(transfer.signature.toHex()).toEqual(
|
||||
'0x97f3cfe5088fcd575313e983f45d02b0f630e7b94ff9a3ac50e20cd096a8f554fda73d42ead891b5a1d3ce5607d83f20b0c6570b555e949cfb5763d0abcd590b'
|
||||
|
||||
Reference in New Issue
Block a user