Bump deps (incl. API with registry) (#201)
* Bump deps (incl. API with registry) * Use sigle registry per chain * Localized registries * Linting cleanups
This commit is contained in:
parent
04d044eae3
commit
8ff647bb4d
12
.github/workflows/push-master.yml
vendored
12
.github/workflows/push-master.yml
vendored
@ -30,3 +30,15 @@ jobs:
|
||||
run: |
|
||||
yarn install --frozen-lockfile
|
||||
yarn polkadot-dev-ghact-build
|
||||
|
||||
dummy:
|
||||
name: Dummy
|
||||
if: "contains(github.event.head_commit.message, '[CI Skip]')"
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
steps:
|
||||
- name: dummy
|
||||
run: |
|
||||
echo "Dummy skip step"
|
||||
|
||||
16
package.json
16
package.json
@ -12,11 +12,11 @@
|
||||
"yarn": "^1.10.1"
|
||||
},
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^0.97.0-beta.4",
|
||||
"@polkadot/keyring": "^1.7.0-beta.7",
|
||||
"@polkadot/types": "^0.97.0-beta.4",
|
||||
"@polkadot/util": "^1.7.0-beta.7",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.7",
|
||||
"@polkadot/api": "^0.97.0-beta.33",
|
||||
"@polkadot/keyring": "^1.7.0-beta.8",
|
||||
"@polkadot/types": "^0.97.0-beta.33",
|
||||
"@polkadot/util": "^1.7.0-beta.8",
|
||||
"@polkadot/util-crypto": "^1.7.0-beta.8",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"typescript": "^3.7.2"
|
||||
},
|
||||
@ -31,8 +31,8 @@
|
||||
"watch": "cd packages/extension && webpack --config webpack.config.js --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.7.2",
|
||||
"@polkadot/dev-react": "^0.32.0-beta.14",
|
||||
"@polkadot/ts": "^0.1.85"
|
||||
"@babel/core": "^7.7.4",
|
||||
"@polkadot/dev-react": "^0.32.0-beta.15",
|
||||
"@polkadot/ts": "^0.1.86"
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"@babel/runtime": "^7.7.4",
|
||||
"edgeware-node-types": "^1.0.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
88
packages/extension-chains/src/edgeware-node-types/dist/identity.ts
vendored
Normal file
88
packages/extension-chains/src/edgeware-node-types/dist/identity.ts
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/* 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 };
|
||||
52
packages/extension-chains/src/edgeware-node-types/dist/signaling.ts
vendored
Normal file
52
packages/extension-chains/src/edgeware-node-types/dist/signaling.ts
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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,
|
||||
};
|
||||
8
packages/extension-chains/src/edgeware-node-types/dist/treasuryReward.ts
vendored
Normal file
8
packages/extension-chains/src/edgeware-node-types/dist/treasuryReward.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/* eslint-disable */
|
||||
import { u128 } from '@polkadot/types';
|
||||
|
||||
export class Balance2 extends u128 { }
|
||||
|
||||
export const TreasuryRewardTypes = {
|
||||
Balance2
|
||||
};
|
||||
132
packages/extension-chains/src/edgeware-node-types/dist/voting.ts
vendored
Normal file
132
packages/extension-chains/src/edgeware-node-types/dist/voting.ts
vendored
Normal file
@ -0,0 +1,132 @@
|
||||
/* 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,
|
||||
};
|
||||
@ -4,10 +4,10 @@
|
||||
|
||||
// Generated via (in api) `yarn chain:info --ws wss://mainnet1.edgewa.re`
|
||||
|
||||
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 { 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';
|
||||
|
||||
export default {
|
||||
chain: 'Edgeware',
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Metadata } from '@polkadot/types';
|
||||
import { Chain } from './types';
|
||||
|
||||
import { Metadata, TypeRegistry } from '@polkadot/types';
|
||||
|
||||
// imports chain details, generally metadata. For the generation of these,
|
||||
// inside the api, run `yarn chain:info --ws <url>`
|
||||
import alexander from './alexander';
|
||||
@ -12,37 +13,40 @@ import edgeware from './edgeware';
|
||||
import kusamaCC2 from './kusama-cc2';
|
||||
|
||||
const chains: Map<string, Chain> = new Map(
|
||||
[alexander, edgeware, kusamaCC2].map(
|
||||
({ chain, genesisHash, icon, metaCalls, specVersion, ss58Format, tokenDecimals, tokenSymbol, types }): [string, Chain] => [
|
||||
[alexander, edgeware, kusamaCC2].map(({ chain, genesisHash, icon, metaCalls, specVersion, ss58Format, tokenDecimals, tokenSymbol, types }): [string, Chain] => {
|
||||
let metadata: Metadata | undefined;
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
registry.register(types || {});
|
||||
|
||||
if (metaCalls) {
|
||||
metadata = new Metadata(registry, Buffer.from(metaCalls, 'base64'));
|
||||
}
|
||||
|
||||
return [genesisHash, {
|
||||
genesisHash,
|
||||
{
|
||||
genesisHash,
|
||||
icon,
|
||||
meta: metaCalls
|
||||
? new Metadata(Buffer.from(metaCalls, 'base64'))
|
||||
: undefined,
|
||||
name: chain,
|
||||
specVersion,
|
||||
ss58Format,
|
||||
tokenDecimals,
|
||||
tokenSymbol,
|
||||
types: types || {}
|
||||
}
|
||||
]
|
||||
)
|
||||
hasMetadata: !!metadata,
|
||||
icon,
|
||||
name: chain,
|
||||
registry,
|
||||
specVersion,
|
||||
ss58Format,
|
||||
tokenDecimals,
|
||||
tokenSymbol
|
||||
}];
|
||||
})
|
||||
);
|
||||
|
||||
const UNKNOWN_CHAIN: Chain = {
|
||||
hasMetadata: false,
|
||||
icon: 'polkadot',
|
||||
isUnknown: true,
|
||||
name: 'Unknown chain',
|
||||
registry: new TypeRegistry(),
|
||||
specVersion: 0,
|
||||
ss58Format: 42,
|
||||
tokenDecimals: 0,
|
||||
tokenSymbol: 'UNIT',
|
||||
types: {
|
||||
Keys: 'SessionKeysSubstrate'
|
||||
}
|
||||
tokenSymbol: 'UNIT'
|
||||
};
|
||||
|
||||
export default function findChain (genesisHash?: string | null): Chain {
|
||||
|
||||
@ -2,18 +2,17 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Metadata } from '@polkadot/types';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
export interface Chain {
|
||||
genesisHash?: string;
|
||||
hasMetadata: boolean;
|
||||
icon: string;
|
||||
isUnknown?: boolean;
|
||||
meta?: Metadata;
|
||||
name: string;
|
||||
registry: Registry;
|
||||
specVersion: number;
|
||||
ss58Format: number;
|
||||
tokenDecimals: number;
|
||||
tokenSymbol: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
types: Record<string, any>;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"@babel/runtime": "^7.7.4",
|
||||
"@polkadot/extension-inject": "^0.14.0-beta.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.2"
|
||||
"@babel/runtime": "^7.7.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/api": "*"
|
||||
|
||||
@ -5,11 +5,11 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"@polkadot/react-identicon": "^0.47.0-beta.6",
|
||||
"@polkadot/react-qr": "^0.47.0-beta.6",
|
||||
"@types/react-router": "^5.1.2",
|
||||
"@types/react-router-dom": "^5.1.2",
|
||||
"@babel/runtime": "^7.7.4",
|
||||
"@polkadot/react-identicon": "^0.47.0-beta.11",
|
||||
"@polkadot/react-qr": "^0.47.0-beta.11",
|
||||
"@types/react-router": "^5.1.3",
|
||||
"@types/react-router-dom": "^5.1.3",
|
||||
"react-router": "^5.1.2",
|
||||
"react-router-dom": "^5.1.2"
|
||||
},
|
||||
|
||||
@ -10,7 +10,7 @@ import BN from 'bn.js';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import findChain from '@polkadot/extension-chains';
|
||||
import { GenericCall, getTypeRegistry } from '@polkadot/types';
|
||||
import { GenericCall } from '@polkadot/types';
|
||||
import { formatNumber, bnToBn } from '@polkadot/util';
|
||||
|
||||
interface Decoded {
|
||||
@ -35,11 +35,8 @@ function decodeMethod (data: string, isDecoded: boolean, chain: Chain, specVersi
|
||||
let method: GenericCall | null = null;
|
||||
|
||||
try {
|
||||
if (isDecoded && chain.meta && specVersion.eqn(chain.specVersion)) {
|
||||
getTypeRegistry().register(chain.types);
|
||||
GenericCall.injectMetadata(chain.meta);
|
||||
|
||||
method = new GenericCall(data);
|
||||
if (isDecoded && chain.hasMetadata && specVersion.eqn(chain.specVersion)) {
|
||||
method = new GenericCall(chain.registry, data);
|
||||
json = method.toJSON() as unknown as MethodJson;
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@ -6,7 +6,7 @@ import { ExtrinsicPayload } from '@polkadot/types/interfaces';
|
||||
import { AccountJson, RequestExtrinsicSign } from '@polkadot/extension/background/types';
|
||||
|
||||
import React, { useContext, useState, useEffect } from 'react';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { TypeRegistry, createType } from '@polkadot/types';
|
||||
|
||||
import { ActionBar, ActionContext, Address, Link } from '../../components';
|
||||
import { approveSignPassword, approveSignSignature, cancelSignRequest } from '../../messaging';
|
||||
@ -22,12 +22,15 @@ interface Props {
|
||||
url: string;
|
||||
}
|
||||
|
||||
// keep it global, we can and will re-use this across requests
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
export default function Request ({ account: { isExternal }, isFirst, request, signId, url }: Props): React.ReactElement<Props> | null {
|
||||
const onAction = useContext(ActionContext);
|
||||
const [payload, setPayload] = useState<ExtrinsicPayload | null>(null);
|
||||
|
||||
useEffect((): void => {
|
||||
setPayload(createType('ExtrinsicPayload', request, { version: request.version }));
|
||||
setPayload(createType(registry, 'ExtrinsicPayload', request, { version: request.version }));
|
||||
}, [request]);
|
||||
|
||||
if (!payload) {
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^0.97.0-beta.4",
|
||||
"@polkadot/api": "^0.97.0-beta.33",
|
||||
"@polkadot/extension-ui": "^0.14.0-beta.5",
|
||||
"@polkadot/ui-keyring": "^0.47.0-beta.6"
|
||||
"@polkadot/ui-keyring": "^0.47.0-beta.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "^7.7.2",
|
||||
"@polkadot/keyring": "^1.7.0-beta.7",
|
||||
"@babel/runtime": "^7.7.4",
|
||||
"@polkadot/keyring": "^1.7.0-beta.8",
|
||||
"@types/chrome": "^0.0.91",
|
||||
"@types/firefox-webext-browser": "^70.0.1",
|
||||
"extensionizer": "^1.0.1",
|
||||
|
||||
@ -8,7 +8,7 @@ import { AccountJson, AuthorizeRequest, MessageTypes, RequestAccountCreateExtern
|
||||
import extension from 'extensionizer';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import accountsObservable from '@polkadot/ui-keyring/observable/accounts';
|
||||
import { createType } from '@polkadot/types';
|
||||
import { TypeRegistry, createType } from '@polkadot/types';
|
||||
import { assert, isHex } from '@polkadot/util';
|
||||
import { keyExtractSuri, mnemonicGenerate, mnemonicValidate } from '@polkadot/util-crypto';
|
||||
|
||||
@ -18,6 +18,9 @@ import { createSubscription, unsubscribe } from './subscriptions';
|
||||
const SEED_DEFAULT_LENGTH = 12;
|
||||
const SEED_LENGTHS = [12, 24];
|
||||
|
||||
// a global registry to use internally
|
||||
const registry = new TypeRegistry();
|
||||
|
||||
function transformAccounts (accounts: SubjectInfo): AccountJson[] {
|
||||
return Object.values(accounts).map(({ json: { address, meta } }): AccountJson => ({
|
||||
address,
|
||||
@ -160,7 +163,7 @@ export default class Extension {
|
||||
|
||||
pair.decodePkcs8(password);
|
||||
|
||||
const payload = createType('ExtrinsicPayload', request, { version: request.version });
|
||||
const payload = createType(registry, 'ExtrinsicPayload', request, { version: request.version });
|
||||
const result = payload.sign(pair);
|
||||
|
||||
pair.lock();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user