Swap Edgeware types to published (#2173)

This commit is contained in:
Jaco Greeff 2020-01-23 11:24:37 +01:00 committed by GitHub
parent c03c51cee3
commit 0aa6c99a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 5 additions and 291 deletions

View File

@ -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"
}
}

View File

@ -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<Text> {
return this.get('proof') as Option<Text>;
}
get metadata (): Option<MetadataRecord> {
return this.get('metadata') as Option<MetadataRecord>;
}
}
// 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 };

View File

@ -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,
};

View File

@ -1,8 +0,0 @@
/* eslint-disable */
import { u128 } from '@polkadot/types';
export class Balance2 extends u128 { }
export const TreasuryRewardTypes = {
Balance2
};

View File

@ -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<VoteOutcome> {
return this.get('outcomes') as Vec<VoteOutcome>;
}
}
export const VotingTypes = {
PreVoting,
Commit,
Voting,
Completed,
VoteStage,
Binary,
MultiOption,
VoteType,
OnePerson,
OneCoin,
TallyType,
VoteOutcome,
Tally,
VoteData,
VoteRecord,
'voting::VoteType': VoteType,
'voting::TallyType': TallyType,
};

View File

@ -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'
};

View File

@ -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: