diff --git a/packages/react-api/package.json b/packages/react-api/package.json index c3cd8cf255c3..f09a179dacf5 100644 --- a/packages/react-api/package.json +++ b/packages/react-api/package.json @@ -33,7 +33,7 @@ "@babel/runtime": "^7.7.6", "@polkadot/api": "^1.0.0-beta.16", "@polkadot/extension-dapp": "^0.15.0-beta.1", - "edgeware-node-types": "^1.0.10", + "edgeware-node-types": "^1.1.0", "rxjs-compat": "^6.5.3" } } diff --git a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/identity.ts b/packages/react-api/src/overrides/spec/edgeware-node-types/dist/identity.ts deleted file mode 100644 index 3315442fb8c2..000000000000 --- a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/identity.ts +++ /dev/null @@ -1,88 +0,0 @@ -/* eslint-disable */ -import { Bytes, Text, u32, Null } from '@polkadot/types'; -import { Option, Struct, Enum } from '@polkadot/types/codec'; -import { Registry } from '@polkadot/types/types'; -import AccountId from '@polkadot/types/primitive/Generic/AccountId'; - -export class MetadataRecord extends Struct { - constructor (registry: Registry, value: any) { - super(registry, { - avatar: Text, - display_name: Text, - tagline: Text, - }, value); - } - get avatar (): Text { - return this.get('avatar') as Text; - } - get display_name (): Text { - return this.get('display_name') as Text; - } - get tagline (): Text { - return this.get('tagline') as Text; - } -} - -export class Registered extends Null { } -export class Attested extends Null { } -export class Verified extends Null { } - -export class IdentityStage extends Enum { - constructor (registry: Registry, value?: string, index?: number) { - super(registry, { - registered: Registered, - attested: Attested, - verified: Verified, - }, value, index); - } -} - -export class IdentityRecord extends Struct { - constructor (registry: Registry, value: any) { - super(registry, { - account: AccountId, - identity_type: Text, - identity: Bytes, - stage: IdentityStage, - expiration_time: u32, - proof: Option.with(Text), - metadata: Option.with(MetadataRecord), - }, value); - } - get account (): AccountId { - return this.get('account') as AccountId; - } - get identity (): Bytes { - return this.get('identity') as Bytes; - } - get stage (): IdentityStage { - return this.get('stage') as IdentityStage; - } - get expiration_time(): u32 { - return this.get('expiration_time') as u32; - } - get proof (): Option { - return this.get('proof') as Option; - } - get metadata (): Option { - return this.get('metadata') as Option; - } -} - -// Old types that aren't used anymore (kept for backwards compatability) -const ArchivedTypes = { - IdentityIndex: u32, - Claim: Bytes, -}; - -// Current types -const CurrentTypes = { - IdentityStage, - IdentityRecord, - MetadataRecord, - IdentityType: Text, - Attestation: Bytes, - Identity: Bytes, -}; - -export const IdentityTypes = { ...ArchivedTypes, ...CurrentTypes }; diff --git a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/signaling.ts b/packages/react-api/src/overrides/spec/edgeware-node-types/dist/signaling.ts deleted file mode 100644 index ff4d7ef40ac1..000000000000 --- a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/signaling.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* eslint-disable */ -import { u32, Text, u64, Bytes } from '@polkadot/types'; -import { Struct } from '@polkadot/types/codec'; -import { Registry } from '@polkadot/types/types'; -import { VotingTypes, VoteStage } from './voting'; -import AccountId from '@polkadot/types/primitive/Generic/AccountId'; - -export class ProposalRecord extends Struct { - constructor (registry: Registry, value: any) { - super(registry, { - index: u32, - author: AccountId, - stage: VoteStage, - transition_time: u32, - title: Text, - contents: Text, - vote_id: u64, - }, value); - } - get index (): u32 { - return this.get('index') as u32; - } - get author (): AccountId { - return this.get('author') as AccountId; - } - get stage (): VoteStage { - return this.get('stage') as VoteStage; - } - get transition_time (): u32 { - return this.get('transition_time') as u32; - } - get title () : Text { - return this.get('title') as Text; - } - get contents () : Text { - return this.get('contents') as Text; - } - get vote_id () : u64 { - return this.get('vote_id') as u64; - } -} - -export const SignalingTypes = { - PreVoting: VotingTypes.PreVoting, - Voting: VotingTypes.Voting, - Completed: VotingTypes.Completed, - Commit: VotingTypes.Commit, - VoteStage, - ProposalRecord, - ProposalContents: Bytes, - ProposalTitle: Bytes, -}; diff --git a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/treasuryReward.ts b/packages/react-api/src/overrides/spec/edgeware-node-types/dist/treasuryReward.ts deleted file mode 100644 index 7e88d6cb46ff..000000000000 --- a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/treasuryReward.ts +++ /dev/null @@ -1,8 +0,0 @@ -/* eslint-disable */ -import { u128 } from '@polkadot/types'; - -export class Balance2 extends u128 { } - -export const TreasuryRewardTypes = { - Balance2 -}; diff --git a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/voting.ts b/packages/react-api/src/overrides/spec/edgeware-node-types/dist/voting.ts deleted file mode 100644 index 3643d4c6cae5..000000000000 --- a/packages/react-api/src/overrides/spec/edgeware-node-types/dist/voting.ts +++ /dev/null @@ -1,132 +0,0 @@ -/* eslint-disable */ -import { Null, bool, u64, Enum, Struct, Vec, Tuple, Option, u128 } from '@polkadot/types'; -import U8aFixed from '@polkadot/types/codec/U8aFixed'; -import { AnyU8a, Registry } from '@polkadot/types/types'; -import AccountId from '@polkadot/types/primitive/Generic/AccountId'; - -export class PreVoting extends Null { } -export class Commit extends Null { } -export class Voting extends Null { } -export class Completed extends Null { } - -export class VoteStage extends Enum { - constructor (registry: Registry, value?: string, index?: number) { - super(registry, { - prevoting: PreVoting, - commit: Commit, - voting: Voting, - completed: Completed, - }, value, index); - } -} - -export class Binary extends Null { } -export class MultiOption extends Null { } -export class RankedChoice extends Null { } - -export class VoteType extends Enum { - constructor (registry: Registry, value?: string, index?: number) { - super(registry, { - binary: Binary, - multioption: MultiOption, - rankedchoice: RankedChoice, - }, value, index); - } -} - -export class OnePerson extends Null { } -export class OneCoin extends Null { } - -export class TallyType extends Enum { - constructor (registry: Registry, value?: string, index?: number) { - super(registry, { - oneperson: OnePerson, - onecoin: OneCoin, - }, value, index); - } -} - -export class VoteOutcome extends U8aFixed { - constructor (registry: Registry, value?: AnyU8a) { - super(registry, value, 256); - } -} - -export class Tally extends Option.with(Vec.with(Tuple.with([VoteOutcome, u128]))) { } - -export class VoteData extends Struct { - constructor (registry: Registry, value: any) { - super(registry, { - initiator: AccountId, - stage: VoteStage, - vote_type: VoteType, - tally_type: TallyType, - is_commit_reveal: bool, - }, value); - } - get initiator (): AccountId { - return this.get('initiator') as AccountId; - } - get stage (): VoteStage { - return this.get('stage') as VoteStage; - } - get vote_type (): VoteType { - return this.get('vote_type') as VoteType; - } - get tally_type (): TallyType { - return this.get('tally_type') as TallyType; - } - get is_commit_reveal (): bool { - return this.get('is_commit_reveal') as bool; - } -} - -export class Commitments extends Vec.with(Tuple.with([AccountId, VoteOutcome])) { } -export class Reveals extends Vec.with(Tuple.with([AccountId, Vec.with(VoteOutcome)])) { } - -export class VoteRecord extends Struct { - constructor (registry: Registry, value: any) { - super(registry, { - id: u64, - commitments: Commitments, - reveals: Reveals, - data: VoteData, - outcomes: Vec.with(VoteOutcome), - }, value); - } - get id (): u64 { - return this.get('id') as u64; - } - get commitments (): Commitments { - return this.get('commits') as Commitments; - } - get reveals (): Reveals { - return this.get('reveals') as Reveals; - } - get data () : VoteData { - return this.get('data') as VoteData; - } - get outcomes () : Vec { - return this.get('outcomes') as Vec; - } -} - -export const VotingTypes = { - PreVoting, - Commit, - Voting, - Completed, - VoteStage, - Binary, - MultiOption, - VoteType, - OnePerson, - OneCoin, - TallyType, - VoteOutcome, - Tally, - VoteData, - VoteRecord, - 'voting::VoteType': VoteType, - 'voting::TallyType': TallyType, -}; diff --git a/packages/react-api/src/overrides/spec/edgeware.ts b/packages/react-api/src/overrides/spec/edgeware.ts index a250cd0bc9c2..b02bd0d2b868 100644 --- a/packages/react-api/src/overrides/spec/edgeware.ts +++ b/packages/react-api/src/overrides/spec/edgeware.ts @@ -2,15 +2,9 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { IdentityTypes } from './edgeware-node-types/dist/identity'; -import { SignalingTypes } from './edgeware-node-types/dist/signaling'; -import { TreasuryRewardTypes } from './edgeware-node-types/dist/treasuryReward'; -import { VotingTypes } from './edgeware-node-types/dist/voting'; +import { EdgewareTypes } from 'edgeware-node-types/dist'; export default { - ...IdentityTypes, - ...SignalingTypes, - ...TreasuryRewardTypes, - ...VotingTypes, + ...EdgewareTypes, Keys: 'SessionKeys4' }; diff --git a/yarn.lock b/yarn.lock index 418196dfb8bf..5504320063cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6164,9 +6164,9 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" -edgeware-node-types@^1.0.10: +edgeware-node-types@^1.1.0: version "1.1.0" - resolved "https://registry.npmjs.org/edgeware-node-types/-/edgeware-node-types-1.1.0.tgz#ce6f773d6907fde929395347d997e21bc37afa87" + resolved "https://registry.yarnpkg.com/edgeware-node-types/-/edgeware-node-types-1.1.0.tgz#ce6f773d6907fde929395347d997e21bc37afa87" integrity sha512-0e56OWLDowEvEj30mJ+Sp72WlaGayRobxE7q3vSBTH1wNiPTafLQ53NMCO68j6V0aTycMzC373VR08iGKoDf5g== editions@^2.2.0: