From 4615661d1c9518b3fb7d69069d4891d80da9ea96 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Mon, 8 Oct 2018 12:12:45 +0200 Subject: [PATCH] Revert "Proposal only has method information" This reverts commit e8b12259106e5ad6cb0415ef6ff934d9498891cb. --- packages/types/src/Extrinsic.ts | 3 ++ packages/types/src/Proposal.ts | 55 +++------------------------------ 2 files changed, 7 insertions(+), 51 deletions(-) diff --git a/packages/types/src/Extrinsic.ts b/packages/types/src/Extrinsic.ts index babd16ae85..5705af00e9 100644 --- a/packages/types/src/Extrinsic.ts +++ b/packages/types/src/Extrinsic.ts @@ -22,6 +22,9 @@ type ExtrinsicValue = { signature?: ExtrinsicSignature }; +// console.error('ExtrinsicSignature', ExtrinsicSignature); +// console.error('Method', Method); + /** * Representation of an Extrinsic in the system. It contains the actual call, * (optional) signature and encodes with an actual length prefix diff --git a/packages/types/src/Proposal.ts b/packages/types/src/Proposal.ts index de107c2b91..832644aa46 100644 --- a/packages/types/src/Proposal.ts +++ b/packages/types/src/Proposal.ts @@ -2,56 +2,9 @@ // This software may be modified and distributed under the terms // of the ISC license. See the LICENSE file for details. -import hexToU8a from '@polkadot/util/hex/toU8a'; -import u8aConcat from '@polkadot/util/u8a/concat'; -import u8aToHex from '@polkadot/util/u8a/toHex'; +import Extrinsic from './Extrinsic'; -import Compact from './codec/Compact'; -import Method from './Method'; - -// A proposal in the system. It contains the same data as an extrinsic, but the encoding -// does not allow for signatures or versions, only the callindex & parameters required -export default class Proposal extends Method { - get length (): number { - return this.toU8a(true).length; - } - - byteLength (): number { - const length = this.length; - - return length + Compact.encode(length).length; - } - - fromJSON (input: any): Proposal { - super.fromU8a(hexToU8a(input)); - - return this; - } - - fromU8a (input: Uint8Array): Proposal { - const [offset, length] = Compact.decode(input); - - super.fromU8a(input.subarray(offset, offset + length.toNumber())); - - return this; - } - - toU8a (isBare?: boolean): Uint8Array { - const encoded = super.toU8a(); - - return isBare - ? encoded - : u8aConcat( - Compact.encode(encoded.length), - encoded - ); - } - - toHex (): string { - return u8aToHex(this.toU8a()); - } - - toJSON (): any { - return this.toHex(); - } +// The Nonce or number of transactiosn sent by a specific account. Generally used +// with extrinsics to determine the order of execution. +export default class Proposal extends Extrinsic { }