Extra signedExtensions retrieved via specVersion (#2268)

* Extra signedExtensions retrieved via  specVersion

* Fix tests
This commit is contained in:
Jaco Greeff
2020-05-12 20:20:24 +02:00
committed by GitHub
parent 7b3f24b1f5
commit 0c5b69bea1
4 changed files with 2 additions and 24 deletions
@@ -22,10 +22,8 @@ describe('SignerPayload', (): void => {
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
nonce: '0x00001234',
signedExtensions: ['CheckEra', 'CheckNonce'],
specVersion: '0x00000006',
tip: '0x00000000000000000000000000005678',
txVersion: '0x00000007',
version: 3
};
@@ -39,9 +37,7 @@ describe('SignerPayload', (): void => {
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
method: registry.createType('Call', '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c'),
nonce: 0x1234,
signedExtensions: ['CheckEra', 'CheckNonce'],
tip: 0x5678,
txVersion: 0x07,
version: 3
}).toPayload()
).toEqual({
@@ -52,10 +48,8 @@ describe('SignerPayload', (): void => {
genesisHash: '0xdcd1346701ca8396496e52aa2785b1748deb6db09551b72159dcb3e08991025b',
method: '0x0600ffd7568e5f0a7eda67a82691ff379ac4bba4f9c9b859fe779b5d46363b61ad2db9e56c',
nonce: '0x00001234',
signedExtensions: ['CheckEra', 'CheckNonce'],
specVersion: '0x00000000',
tip: '0x00000000000000000000000000005678',
txVersion: '0x00000000',
version: 3
});
});
@@ -9,8 +9,6 @@ import { u8aToHex } from '@polkadot/util';
import Compact from '../codec/Compact';
import Struct from '../codec/Struct';
import Vec from '../codec/Vec';
import Text from '../primitive/Text';
import u8 from '../primitive/U8';
export interface SignerPayloadType extends Codec {
@@ -22,7 +20,6 @@ export interface SignerPayloadType extends Codec {
method: Call;
nonce: Compact<Index>;
runtimeVersion: RuntimeVersion;
signedExtensions: Vec<Text>;
tip: Compact<Balance>;
version: u8;
}
@@ -38,7 +35,6 @@ const _Payload: Constructor<SignerPayloadType> = Struct.with({
method: 'Call',
nonce: 'Compact<Index>',
runtimeVersion: 'RuntimeVersion',
signedExtensions: 'Vec<Text>',
tip: 'Compact<Balance>',
version: 'u8'
}) as any;
@@ -53,7 +49,7 @@ export default class SignerPayload extends _Payload implements ISignerPayload {
* @description Creates an representation of the structure as an ISignerPayload JSON
*/
public toPayload (): SignerPayloadJSON {
const { address, blockHash, blockNumber, era, genesisHash, method, nonce, runtimeVersion: { specVersion, transactionVersion }, signedExtensions, tip, version } = this;
const { address, blockHash, blockNumber, era, genesisHash, method, nonce, runtimeVersion: { specVersion }, tip, version } = this;
return {
address: address.toString(),
@@ -63,10 +59,8 @@ export default class SignerPayload extends _Payload implements ISignerPayload {
genesisHash: genesisHash.toHex(),
method: method.toHex(),
nonce: nonce.toHex(),
signedExtensions: signedExtensions.map((ext) => ext.toString()),
specVersion: specVersion.toHex(),
tip: tip.toHex(),
txVersion: transactionVersion.toHex(),
version: version.toNumber()
};
}
-10
View File
@@ -155,11 +155,6 @@ export interface SignerPayloadJSON {
*/
nonce: string;
/**
* @description The current signed extensions for the network
*/
signedExtensions: string[];
/**
* @description The current spec version for the runtime
*/
@@ -170,11 +165,6 @@ export interface SignerPayloadJSON {
*/
tip: string;
/**
* @description The current transaction version for the runtime
*/
txVersion: string;
/**
* @description The version of the extrinsic we are dealing with
*/