Parcourir la source

Types - move AccountId back to "common"

Leszek Wiesner il y a 3 ans
Parent
commit
6c96213ab9

+ 1 - 2
cli/src/Api.ts

@@ -29,7 +29,7 @@ import {
   Opening,
 } from '@joystream/types/working-group'
 import { Membership, StakingAccountMemberBinding } from '@joystream/types/members'
-import { MemberId, ChannelId } from '@joystream/types/common'
+import { MemberId, ChannelId, AccountId } from '@joystream/types/common'
 import {
   Channel,
   Video,
@@ -52,7 +52,6 @@ import {
   GetMemberByIdQueryVariables,
   MembershipFieldsFragment,
 } from './graphql/generated/queries'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
 
 export const DEFAULT_API_URI = 'ws://localhost:9944/'
 

+ 1 - 2
cli/src/base/AccountsCommandBase.ts

@@ -9,7 +9,7 @@ import { formatBalance } from '@polkadot/util'
 import { MemberDetails, NamedKeyringPair } from '../Types'
 import { DeriveBalancesAll } from '@polkadot/api-derive/types'
 import { memberHandle, toFixedLength } from '../helpers/display'
-import { MemberId } from '@joystream/types/common'
+import { MemberId, AccountId } from '@joystream/types/common'
 import { KeyringPair, KeyringInstance, KeyringOptions } from '@polkadot/keyring/types'
 import { KeypairType } from '@polkadot/util-crypto/types'
 import { createTestKeyring } from '@polkadot/keyring/testing'
@@ -18,7 +18,6 @@ import { mnemonicGenerate } from '@polkadot/util-crypto'
 import { validateAddress } from '../helpers/validation'
 import slug from 'slug'
 import { Membership } from '@joystream/types/members'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
 import BN from 'bn.js'
 
 const ACCOUNTS_DIRNAME = 'accounts'

+ 28 - 28
types/augment/all/defs.json

@@ -35,8 +35,8 @@
     "Url": "Text",
     "Membership": {
         "handle_hash": "Bytes",
-        "root_account": "GenericAccountId",
-        "controller_account": "GenericAccountId",
+        "root_account": "AccountId",
+        "controller_account": "AccountId",
         "verified": "bool",
         "invites": "u32"
     },
@@ -45,16 +45,16 @@
         "confirmed": "bool"
     },
     "BuyMembershipParameters": {
-        "root_account": "GenericAccountId",
-        "controller_account": "GenericAccountId",
+        "root_account": "AccountId",
+        "controller_account": "AccountId",
         "handle": "Option<Text>",
         "metadata": "Bytes",
         "referrer_id": "Option<MemberId>"
     },
     "InviteMembershipParameters": {
         "inviting_member_id": "MemberId",
-        "root_account": "GenericAccountId",
-        "controller_account": "GenericAccountId",
+        "root_account": "AccountId",
+        "controller_account": "AccountId",
         "handle": "Option<Text>",
         "metadata": "Bytes"
     },
@@ -76,16 +76,16 @@
         }
     },
     "Candidate": {
-        "staking_account_id": "GenericAccountId",
-        "reward_account_id": "GenericAccountId",
+        "staking_account_id": "AccountId",
+        "reward_account_id": "AccountId",
         "cycle_id": "u64",
         "stake": "u32",
         "vote_power": "VotePower",
         "note_hash": "Option<Hash>"
     },
     "CouncilMemberOf": {
-        "staking_account_id": "GenericAccountId",
-        "reward_account_id": "GenericAccountId",
+        "staking_account_id": "AccountId",
+        "reward_account_id": "AccountId",
         "membership_id": "MemberId",
         "stake": "u128",
         "last_payment_block": "u32",
@@ -149,9 +149,9 @@
     },
     "ApplicationId": "u64",
     "Application": {
-        "role_account_id": "GenericAccountId",
-        "reward_account_id": "GenericAccountId",
-        "staking_account_id": "GenericAccountId",
+        "role_account_id": "AccountId",
+        "reward_account_id": "AccountId",
+        "staking_account_id": "AccountId",
         "member_id": "MemberId",
         "description_hash": "Bytes",
         "opening_id": "OpeningId"
@@ -165,9 +165,9 @@
     "WorkerId": "u64",
     "Worker": {
         "member_id": "MemberId",
-        "role_account_id": "GenericAccountId",
-        "staking_account_id": "GenericAccountId",
-        "reward_account_id": "GenericAccountId",
+        "role_account_id": "AccountId",
+        "staking_account_id": "AccountId",
+        "reward_account_id": "AccountId",
         "started_leaving_at": "Option<u32>",
         "job_unstaking_period": "u32",
         "reward_per_block": "Option<u128>",
@@ -192,7 +192,7 @@
     },
     "StakeParameters": {
         "stake": "u128",
-        "staking_account_id": "GenericAccountId"
+        "staking_account_id": "AccountId"
     },
     "StorageProviderId": "u64",
     "OpeningType": {
@@ -204,8 +204,8 @@
     "ApplyOnOpeningParameters": {
         "member_id": "MemberId",
         "opening_id": "OpeningId",
-        "role_account_id": "GenericAccountId",
-        "reward_account_id": "GenericAccountId",
+        "role_account_id": "AccountId",
+        "reward_account_id": "AccountId",
         "description": "Bytes",
         "stake_parameters": "StakeParameters"
     },
@@ -310,7 +310,7 @@
         "votingResults": "VotingResults",
         "exactExecutionBlock": "Option<u32>",
         "nrOfCouncilConfirmations": "u32",
-        "stakingAccountId": "Option<GenericAccountId>"
+        "stakingAccountId": "Option<AccountId>"
     },
     "ProposalDetails": {
         "_enum": {
@@ -390,7 +390,7 @@
         "member_id": "MemberId",
         "title": "Text",
         "description": "Text",
-        "staking_account_id": "Option<GenericAccountId>",
+        "staking_account_id": "Option<AccountId>",
         "exact_execution_block": "Option<u32>"
     },
     "VoteKind": {
@@ -445,7 +445,7 @@
             "PendingConstitutionality"
         ]
     },
-    "SetLeadParams": "(MemberId,GenericAccountId)",
+    "SetLeadParams": "(MemberId,AccountId)",
     "ThreadMode": {
         "_enum": {
             "Open": "Null",
@@ -459,7 +459,7 @@
         }
     },
     "FundingRequestParameters": {
-        "account": "GenericAccountId",
+        "account": "AccountId",
         "amount": "u128"
     },
     "ReferendumStageVoting": {
@@ -537,7 +537,7 @@
     },
     "Entry": {
         "member_id": "MemberId",
-        "staking_account_id": "GenericAccountId",
+        "staking_account_id": "AccountId",
         "submitted_at": "u32",
         "work_submitted": "bool",
         "oracle_judgment_result": "Option<OracleJudgment>"
@@ -567,7 +567,7 @@
         "playlists": "Vec<PlaylistId>",
         "series": "Vec<SeriesId>",
         "is_censored": "bool",
-        "reward_account": "Option<GenericAccountId>"
+        "reward_account": "Option<AccountId>"
     },
     "ChannelOwner": {
         "_enum": {
@@ -587,19 +587,19 @@
     "ChannelCreationParameters": {
         "assets": "Vec<NewAsset>",
         "meta": "Bytes",
-        "reward_account": "Option<GenericAccountId>"
+        "reward_account": "Option<AccountId>"
     },
     "ChannelUpdateParameters": {
         "assets": "Option<Vec<NewAsset>>",
         "new_meta": "Option<Bytes>",
-        "reward_account": "Option<Option<GenericAccountId>>"
+        "reward_account": "Option<Option<AccountId>>"
     },
     "ChannelOwnershipTransferRequestId": "u64",
     "ChannelOwnershipTransferRequest": {
         "channel_id": "ChannelId",
         "new_owner": "ChannelOwner",
         "payment": "u128",
-        "new_reward_account": "Option<GenericAccountId>"
+        "new_reward_account": "Option<AccountId>"
     },
     "Video": {
         "in_channel": "ChannelId",

+ 29 - 29
types/augment/all/types.ts

@@ -1,7 +1,7 @@
 // Auto-generated via `yarn polkadot-types-from-defs`, do not edit
 /* eslint-disable */
 
-import type { BTreeMap, BTreeSet, Bytes, Enum, GenericAccountId, Option, Struct, Text, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
+import type { BTreeMap, BTreeSet, Bytes, Enum, Option, Struct, Text, U8aFixed, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types';
 import type { ITuple } from '@polkadot/types/types';
 import type { AccountId, Balance, Hash } from '@polkadot/types/interfaces/runtime';
 
@@ -13,9 +13,9 @@ export interface Address extends AccountId {}
 
 /** @name Application */
 export interface Application extends Struct {
-  readonly role_account_id: GenericAccountId;
-  readonly reward_account_id: GenericAccountId;
-  readonly staking_account_id: GenericAccountId;
+  readonly role_account_id: AccountId;
+  readonly reward_account_id: AccountId;
+  readonly staking_account_id: AccountId;
   readonly member_id: MemberId;
   readonly description_hash: Bytes;
   readonly opening_id: OpeningId;
@@ -40,8 +40,8 @@ export interface ApplicationInfo extends Struct {
 export interface ApplyOnOpeningParameters extends Struct {
   readonly member_id: MemberId;
   readonly opening_id: OpeningId;
-  readonly role_account_id: GenericAccountId;
-  readonly reward_account_id: GenericAccountId;
+  readonly role_account_id: AccountId;
+  readonly reward_account_id: AccountId;
   readonly description: Bytes;
   readonly stake_parameters: StakeParameters;
 }
@@ -95,8 +95,8 @@ export interface BountyId extends u32 {}
 
 /** @name BuyMembershipParameters */
 export interface BuyMembershipParameters extends Struct {
-  readonly root_account: GenericAccountId;
-  readonly controller_account: GenericAccountId;
+  readonly root_account: AccountId;
+  readonly controller_account: AccountId;
   readonly handle: Option<Text>;
   readonly metadata: Bytes;
   readonly referrer_id: Option<MemberId>;
@@ -104,8 +104,8 @@ export interface BuyMembershipParameters extends Struct {
 
 /** @name Candidate */
 export interface Candidate extends Struct {
-  readonly staking_account_id: GenericAccountId;
-  readonly reward_account_id: GenericAccountId;
+  readonly staking_account_id: AccountId;
+  readonly reward_account_id: AccountId;
   readonly cycle_id: u64;
   readonly stake: u32;
   readonly vote_power: VotePower;
@@ -142,7 +142,7 @@ export interface Channel extends Struct {
   readonly playlists: Vec<PlaylistId>;
   readonly series: Vec<SeriesId>;
   readonly is_censored: bool;
-  readonly reward_account: Option<GenericAccountId>;
+  readonly reward_account: Option<AccountId>;
 }
 
 /** @name ChannelCategory */
@@ -165,7 +165,7 @@ export interface ChannelCategoryUpdateParameters extends Struct {
 export interface ChannelCreationParameters extends Struct {
   readonly assets: Vec<NewAsset>;
   readonly meta: Bytes;
-  readonly reward_account: Option<GenericAccountId>;
+  readonly reward_account: Option<AccountId>;
 }
 
 /** @name ChannelId */
@@ -186,7 +186,7 @@ export interface ChannelOwnershipTransferRequest extends Struct {
   readonly channel_id: ChannelId;
   readonly new_owner: ChannelOwner;
   readonly payment: u128;
-  readonly new_reward_account: Option<GenericAccountId>;
+  readonly new_reward_account: Option<AccountId>;
 }
 
 /** @name ChannelOwnershipTransferRequestId */
@@ -196,7 +196,7 @@ export interface ChannelOwnershipTransferRequestId extends u64 {}
 export interface ChannelUpdateParameters extends Struct {
   readonly assets: Option<Vec<NewAsset>>;
   readonly new_meta: Option<Bytes>;
-  readonly reward_account: Option<Option<GenericAccountId>>;
+  readonly reward_account: Option<Option<AccountId>>;
 }
 
 /** @name ConstitutionInfo */
@@ -225,8 +225,8 @@ export interface ContentParameters extends Struct {
 
 /** @name CouncilMemberOf */
 export interface CouncilMemberOf extends Struct {
-  readonly staking_account_id: GenericAccountId;
-  readonly reward_account_id: GenericAccountId;
+  readonly staking_account_id: AccountId;
+  readonly reward_account_id: AccountId;
   readonly membership_id: MemberId;
   readonly stake: u128;
   readonly last_payment_block: u32;
@@ -328,7 +328,7 @@ export interface DiscussionThread extends Struct {
 /** @name Entry */
 export interface Entry extends Struct {
   readonly member_id: MemberId;
-  readonly staking_account_id: GenericAccountId;
+  readonly staking_account_id: AccountId;
   readonly submitted_at: u32;
   readonly work_submitted: bool;
   readonly oracle_judgment_result: Option<OracleJudgment>;
@@ -369,7 +369,7 @@ export interface ForumUserId extends u64 {}
 
 /** @name FundingRequestParameters */
 export interface FundingRequestParameters extends Struct {
-  readonly account: GenericAccountId;
+  readonly account: AccountId;
   readonly amount: u128;
 }
 
@@ -398,7 +398,7 @@ export interface GeneralProposalParameters extends Struct {
   readonly member_id: MemberId;
   readonly title: Text;
   readonly description: Text;
-  readonly staking_account_id: Option<GenericAccountId>;
+  readonly staking_account_id: Option<AccountId>;
   readonly exact_execution_block: Option<u32>;
 }
 
@@ -411,8 +411,8 @@ export interface InputValidationLengthConstraint extends Struct {
 /** @name InviteMembershipParameters */
 export interface InviteMembershipParameters extends Struct {
   readonly inviting_member_id: MemberId;
-  readonly root_account: GenericAccountId;
-  readonly controller_account: GenericAccountId;
+  readonly root_account: AccountId;
+  readonly controller_account: AccountId;
   readonly handle: Option<Text>;
   readonly metadata: Bytes;
 }
@@ -438,8 +438,8 @@ export interface MemberId extends u64 {}
 /** @name Membership */
 export interface Membership extends Struct {
   readonly handle_hash: Bytes;
-  readonly root_account: GenericAccountId;
-  readonly controller_account: GenericAccountId;
+  readonly root_account: AccountId;
+  readonly controller_account: AccountId;
   readonly verified: bool;
   readonly invites: u32;
 }
@@ -734,7 +734,7 @@ export interface ProposalOf extends Struct {
   readonly votingResults: VotingResults;
   readonly exactExecutionBlock: Option<u32>;
   readonly nrOfCouncilConfirmations: u32;
-  readonly stakingAccountId: Option<GenericAccountId>;
+  readonly stakingAccountId: Option<AccountId>;
 }
 
 /** @name ProposalParameters */
@@ -833,12 +833,12 @@ export interface SeriesParameters extends Struct {
 }
 
 /** @name SetLeadParams */
-export interface SetLeadParams extends ITuple<[MemberId, GenericAccountId]> {}
+export interface SetLeadParams extends ITuple<[MemberId, AccountId]> {}
 
 /** @name StakeParameters */
 export interface StakeParameters extends Struct {
   readonly stake: u128;
-  readonly staking_account_id: GenericAccountId;
+  readonly staking_account_id: AccountId;
 }
 
 /** @name StakePolicy */
@@ -992,9 +992,9 @@ export interface VoucherLimit extends u64 {}
 /** @name Worker */
 export interface Worker extends Struct {
   readonly member_id: MemberId;
-  readonly role_account_id: GenericAccountId;
-  readonly staking_account_id: GenericAccountId;
-  readonly reward_account_id: GenericAccountId;
+  readonly role_account_id: AccountId;
+  readonly staking_account_id: AccountId;
+  readonly reward_account_id: AccountId;
   readonly started_leaving_at: Option<u32>;
   readonly job_unstaking_period: u32;
   readonly reward_per_block: Option<u128>;

+ 1 - 2
types/src/bounty.ts

@@ -1,6 +1,5 @@
 import { Null, u32, u128, bool, Option } from '@polkadot/types'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
-import { JoyEnum, JoyStructDecorated, JoyBTreeSet, MemberId } from './common'
+import { JoyEnum, JoyStructDecorated, JoyBTreeSet, MemberId, AccountId } from './common'
 
 export class BountyId extends u32 {}
 export class EntryId extends u32 {}

+ 2 - 1
types/src/common.ts

@@ -5,7 +5,7 @@ import { Codec, Constructor, RegistryTypes } from '@polkadot/types/types'
 import moment from 'moment'
 import { JoyStructCustom, JoyStructDecorated } from './JoyStruct'
 import { JoyEnum } from './JoyEnum'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
+import { GenericAccountId } from '@polkadot/types/generic/AccountId'
 
 export { JoyEnum, JoyStructCustom, JoyStructDecorated }
 
@@ -118,6 +118,7 @@ export class BalanceKind extends JoyEnum({
 
 // @polkadot/types overrides required since migration to Substrate 2.0,
 // see: https://polkadot.js.org/docs/api/FAQ#i-cannot-send-transactions-sending-yields-address-decoding-failures
+export class AccountId extends GenericAccountId {}
 export class Address extends AccountId {}
 export class LookupSource extends AccountId {}
 

+ 1 - 2
types/src/content/index.ts

@@ -1,8 +1,7 @@
 import { Vec, Option, Tuple } from '@polkadot/types'
 import { bool, u64, u32, u128, Null, Bytes } from '@polkadot/types/primitive'
-import { JoyStructDecorated, JoyEnum, ChannelId, JoyBTreeSet, DAOId, Url, MemberId } from '../common'
+import { JoyStructDecorated, JoyEnum, ChannelId, JoyBTreeSet, DAOId, Url, MemberId, AccountId } from '../common'
 import { ContentParameters } from '../storage'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
 
 export class CuratorId extends u64 {}
 export class CuratorGroupId extends u64 {}

+ 1 - 2
types/src/council/index.ts

@@ -4,9 +4,8 @@ import { u32, u64, u128, Null } from '@polkadot/types'
 import { RegistryTypes } from '@polkadot/types/types'
 import { JoyStructDecorated } from '../JoyStruct'
 import { JoyEnum } from '../JoyEnum'
-import { MemberId, Hash } from '../common'
+import { MemberId, Hash, AccountId } from '../common'
 import { VotePower, CastVote } from '../referendum'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
 
 export type ICouncilStageAnnouncing = {
   candidatesCount: u64

+ 1 - 2
types/src/members.ts

@@ -1,7 +1,6 @@
 import { Option, bool, u32, Text, Bytes } from '@polkadot/types'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
 import { RegistryTypes } from '@polkadot/types/types'
-import { MemberId, JoyStructDecorated } from './common'
+import { MemberId, JoyStructDecorated, AccountId } from './common'
 
 export type IMembership = {
   handle_hash: Bytes

+ 1 - 2
types/src/proposals.ts

@@ -1,9 +1,8 @@
 import { Text, u32, Tuple, u8, u128, Vec, Option, Null, Bytes } from '@polkadot/types'
 import { BlockNumber, Balance } from '@polkadot/types/interfaces'
 import { Constructor, ITuple } from '@polkadot/types/types'
-import { MemberId, WorkingGroup, JoyEnum, JoyStructDecorated, BalanceKind, PostId } from './common'
+import { MemberId, WorkingGroup, JoyEnum, JoyStructDecorated, BalanceKind, PostId, AccountId } from './common'
 import { ApplicationId, OpeningId, StakePolicy, WorkerId } from './working-group'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
 
 export type IVotingResults = {
   abstensions: u32

+ 1 - 2
types/src/working-group/index.ts

@@ -1,8 +1,7 @@
 import { Bytes, BTreeMap, Option, Text } from '@polkadot/types'
 import { Null, u32, u64, u128 } from '@polkadot/types/primitive'
-import { GenericAccountId as AccountId } from '@polkadot/types/generic/AccountId'
 import { BlockNumber, Balance } from '@polkadot/types/interfaces'
-import { ActorId, MemberId, JoyEnum, JoyStructDecorated, JoyBTreeSet } from '../common'
+import { ActorId, MemberId, JoyEnum, JoyStructDecorated, JoyBTreeSet, AccountId } from '../common'
 import { RegistryTypes } from '@polkadot/types/types'
 
 export class ApplicationId extends u64 {}