Bump deps (#264)
* Bump deps * Add appropriate .skip-*'s * Fix linting * Format test * typo :)
This commit is contained in:
parent
0fca577343
commit
326ba2c1b6
22
package.json
22
package.json
@ -7,17 +7,17 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^1.5.0-beta.28",
|
||||
"@polkadot/keyring": "^2.6.1",
|
||||
"@polkadot/types": "^1.5.0-beta.28",
|
||||
"@polkadot/util": "^2.6.1",
|
||||
"@polkadot/util-crypto": "^2.6.1",
|
||||
"@polkadot/api": "^1.7.0-beta.10",
|
||||
"@polkadot/keyring": "^2.6.2",
|
||||
"@polkadot/types": "^1.7.0-beta.10",
|
||||
"@polkadot/util": "^2.6.2",
|
||||
"@polkadot/util-crypto": "^2.6.2",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
"typescript": "^3.8.3"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production polkadot-dev-build-ts",
|
||||
"build:zip": "(rm -rf ./master-build.zip && yarn build && cd packages/extension/build && zip -r -FS ../../../master-build.zip *) && (rm -rf ./master-src.zip && zip -r -x '*build*' -x '*node_modules*' -FS ./master-src.zip packages .babelrc.js .editorconfig .eslintignore .eslintrc.js babel.config.js CHANGELOG.md CONTRIBUTING.md jest.config.js lerna.json LICENSE package.json README.md tsconfig.json yarn.lock)",
|
||||
"build:zip": "(rm -rf ./master-build.zip && yarn build && cd packages/extension/build && zip -r -FS ../../../master-build.zip . -i *) && (rm -rf ./master-src.zip && zip -r -x '*build*' -x '*node_modules*' -FS ./master-src.zip packages .babelrc.js .editorconfig .eslintignore .eslintrc.js babel.config.js CHANGELOG.md CONTRIBUTING.md jest.config.js lerna.json LICENSE package.json README.md tsconfig.json yarn.lock)",
|
||||
"lint": "polkadot-dev-run-lint",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"postinstall": "polkadot-dev-yarn-only",
|
||||
@ -26,9 +26,11 @@
|
||||
"watch": "cd packages/extension && webpack --config webpack.config.js --watch"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.6",
|
||||
"@polkadot/dev": "^0.50.16",
|
||||
"@polkadot/ts": "^0.3.6",
|
||||
"sinon-chrome": "^3.0.1"
|
||||
"@babel/core": "^7.8.7",
|
||||
"@polkadot/dev": "^0.50.31",
|
||||
"@polkadot/ts": "^0.3.8",
|
||||
"copy-webpack-plugin": "^5.1.1",
|
||||
"sinon-chrome": "^3.0.1",
|
||||
"url-loader": "^3.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
0
packages/extension-chains/.skip-build
Normal file
0
packages/extension-chains/.skip-build
Normal file
0
packages/extension-chains/.skip-npm
Normal file
0
packages/extension-chains/.skip-npm
Normal file
@ -5,7 +5,7 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"edgeware-node-types": "^1.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -1,90 +0,0 @@
|
||||
/* eslint-disable comma-dangle */
|
||||
/* eslint-disable lines-between-class-members */
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
import { Bytes, Text, u32, Null } from '@polkadot/types';
|
||||
import { Option, Struct, Enum } from '@polkadot/types/codec';
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
|
||||
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 };
|
||||
@ -1,11 +0,0 @@
|
||||
import { IdentityTypes } from './identity';
|
||||
import { SignalingTypes } from './signaling';
|
||||
import { TreasuryRewardTypes } from './treasuryReward';
|
||||
import { VotingTypes } from './voting';
|
||||
|
||||
export const EdgewareTypes = {
|
||||
...IdentityTypes,
|
||||
...SignalingTypes,
|
||||
...TreasuryRewardTypes,
|
||||
...VotingTypes
|
||||
};
|
||||
@ -1,54 +0,0 @@
|
||||
/* eslint-disable comma-dangle */
|
||||
/* eslint-disable lines-between-class-members */
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
import { u32, Text, u64, Bytes } from '@polkadot/types';
|
||||
import { Struct } from '@polkadot/types/codec';
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
import { Registry } from '@polkadot/types/types';
|
||||
import { VotingTypes, VoteStage } from './voting';
|
||||
|
||||
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,
|
||||
};
|
||||
@ -1,7 +0,0 @@
|
||||
import { u128 } from '@polkadot/types';
|
||||
|
||||
export class Balance2 extends u128 { }
|
||||
|
||||
export const TreasuryRewardTypes = {
|
||||
Balance2
|
||||
};
|
||||
@ -1,134 +0,0 @@
|
||||
/* eslint-disable comma-dangle */
|
||||
/* eslint-disable lines-between-class-members */
|
||||
/* eslint-disable @typescript-eslint/camelcase */
|
||||
import { Null, bool, u64, Enum, Struct, Vec, Tuple, Option, u128 } from '@polkadot/types';
|
||||
import U8aFixed from '@polkadot/types/codec/U8aFixed';
|
||||
import { AccountId } from '@polkadot/types/interfaces';
|
||||
import { AnyU8a, Registry } from '@polkadot/types/types';
|
||||
|
||||
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,8 +4,7 @@
|
||||
|
||||
// Generated via (in api) `yarn chain:info --ws wss://mainnet1.edgewa.re`
|
||||
|
||||
// import { EdgewareTypes } from 'edgeware-node-types/dist';
|
||||
import { EdgewareTypes } from './edgeware-node-types';
|
||||
import { EdgewareTypes } from 'edgeware-node-types/dist';
|
||||
|
||||
export default {
|
||||
chain: 'Edgeware',
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"@polkadot/extension-inject": "0.22.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4"
|
||||
"@babel/runtime": "^7.8.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@polkadot/api": "*"
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
import { Injected, InjectedWindow, InjectOptions } from './types';
|
||||
|
||||
// It is recomemender to always use the function below to shield the extension and dapp from
|
||||
// It is recommended to always use the function below to shield the extension and dapp from
|
||||
// any future changes. The exposed interface will manage access between the 2 environments,
|
||||
// be it via window (current), postMessage (under consideration) or any other mechanism
|
||||
export function injectExtension (enable: (origin: string) => Promise<Injected>, { name, version }: InjectOptions): void {
|
||||
|
||||
0
packages/extension-ui/.skip-build
Normal file
0
packages/extension-ui/.skip-build
Normal file
0
packages/extension-ui/.skip-npm
Normal file
0
packages/extension-ui/.skip-npm
Normal file
@ -5,15 +5,15 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@polkadot/keyring": "^2.6.1",
|
||||
"@polkadot/react-identicon": "^0.52.0-beta.5",
|
||||
"@polkadot/react-qr": "^0.52.0-beta.5",
|
||||
"@polkadot/util": "^2.6.1",
|
||||
"@polkadot/util-crypto": "^2.6.1",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"react-is": "^16.12.0",
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"@polkadot/keyring": "^2.6.2",
|
||||
"@polkadot/react-identicon": "^0.52.0-beta.7",
|
||||
"@polkadot/react-qr": "^0.52.0-beta.7",
|
||||
"@polkadot/util": "^2.6.2",
|
||||
"@polkadot/util-crypto": "^2.6.2",
|
||||
"react": "^16.13.0",
|
||||
"react-dom": "^16.13.0",
|
||||
"react-is": "^16.13.0",
|
||||
"react-router": "^5.1.2",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"styled-components": "^5.0.1"
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
import Adapter from 'enzyme-adapter-react-16';
|
||||
import { configure } from 'enzyme';
|
||||
import extensionizer from 'extensionizer';
|
||||
|
||||
import { exportAccount } from './messaging';
|
||||
|
||||
configure({ adapter: new Adapter() });
|
||||
@ -12,13 +13,15 @@ configure({ adapter: new Adapter() });
|
||||
describe('messaging sends message to background via extension port for', () => {
|
||||
test('exportAccount', () => {
|
||||
const callback = jest.fn();
|
||||
extensionizer.runtime.connect().onMessage.addListener(callback);
|
||||
|
||||
extensionizer.runtime.connect().onMessage.addListener(callback);
|
||||
exportAccount('HjoBp62cvsWDA3vtNMWxz6c9q13ReEHi9UGHK7JbZweH5g5', 'passw0rd');
|
||||
|
||||
expect(callback).toHaveBeenCalledWith(expect.objectContaining({
|
||||
message: 'pri(accounts.export)',
|
||||
request: { address: 'HjoBp62cvsWDA3vtNMWxz6c9q13ReEHi9UGHK7JbZweH5g5', password: 'passw0rd' }
|
||||
}));
|
||||
expect(callback).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
message: 'pri(accounts.export)',
|
||||
request: { address: 'HjoBp62cvsWDA3vtNMWxz6c9q13ReEHi9UGHK7JbZweH5g5', password: 'passw0rd' }
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
0
packages/extension/.skip-npm
Normal file
0
packages/extension/.skip-npm
Normal file
@ -5,15 +5,16 @@
|
||||
"author": "Jaco Greeff <jacogr@gmail.com>",
|
||||
"license": "Apache-2",
|
||||
"dependencies": {
|
||||
"@polkadot/api": "^1.5.0-beta.28",
|
||||
"@polkadot/api": "^1.7.0-beta.10",
|
||||
"@polkadot/extension-ui": "0.22.1",
|
||||
"@polkadot/keyring": "^2.6.1",
|
||||
"@polkadot/ui-keyring": "^0.52.0-beta.5",
|
||||
"@polkadot/keyring": "^2.6.2",
|
||||
"@polkadot/ui-keyring": "^0.52.0-beta.7",
|
||||
"extensionizer": "^1.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@types/chrome": "^0.0.98",
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"@polkadot/dev": "^0.50.31",
|
||||
"@types/chrome": "^0.0.100",
|
||||
"@types/firefox-webext-browser": "^70.0.1",
|
||||
"babel-loader": "^8.0.6",
|
||||
"extract-loader": "^4.0.3",
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
import Extension from '@polkadot/extension/background/handlers/Extension';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import { cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
import State from '@polkadot/extension/background/handlers/State';
|
||||
// Copyright 2019-2020 @polkadot/extension authors & contributors
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { ResponseAccountExport } from '@polkadot/extension/background/types';
|
||||
|
||||
import Extension from '@polkadot/extension/background/handlers/Extension';
|
||||
import State from '@polkadot/extension/background/handlers/State';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import ExtensionStore from '@polkadot/ui-keyring/stores/Extension';
|
||||
import { cryptoWaitReady } from '@polkadot/util-crypto';
|
||||
|
||||
describe('Extension', () => {
|
||||
async function createExtension (): Promise<Extension> {
|
||||
|
||||
@ -35,7 +35,7 @@ export default function handler<TMessageType extends MessageTypes> ({ id, messag
|
||||
|
||||
// between the start and the end of the promise, the user may have closed
|
||||
// the tab, in which case port will be undefined
|
||||
assert(port, `Port has been disconnected`);
|
||||
assert(port, 'Port has been disconnected');
|
||||
|
||||
port.postMessage({ id, response });
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user