Pull in @polkadot/extension-dapp (#1207)
* Pull in @polkadot/extension-dapp * State updates via callback * Remove extra : tags * Small formatting cleanups
This commit is contained in:
parent
fc59f53869
commit
9d5188cea2
@ -10,9 +10,9 @@
|
||||
"packages/*"
|
||||
],
|
||||
"resolutions": {
|
||||
"@polkadot/api": "^0.79.1",
|
||||
"@polkadot/api": "^0.80.0-beta.2",
|
||||
"@polkadot/keyring": "^0.91.1",
|
||||
"@polkadot/types": "^0.79.1",
|
||||
"@polkadot/types": "^0.80.0-beta.2",
|
||||
"@polkadot/util": "^0.91.1",
|
||||
"@polkadot/util-crypto": "^0.91.1",
|
||||
"babel-core": "^7.0.0-bridge.0",
|
||||
|
||||
@ -31,7 +31,8 @@
|
||||
"homepage": "https://github.com/polkadot-js/ui/tree/master/packages/ui-reactive#readme",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.4.5",
|
||||
"@polkadot/api": "^0.79.1",
|
||||
"@polkadot/api": "^0.80.0-beta.2",
|
||||
"@polkadot/extension-dapp": "^0.1.1-beta.4",
|
||||
"rxjs-compat": "^6.4.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,10 +4,11 @@
|
||||
|
||||
import { ProviderInterface } from '@polkadot/rpc-provider/types';
|
||||
import { QueueTx$ExtrinsicAdd, QueueTx$MessageSetStatus } from '@polkadot/ui-app/Status/types';
|
||||
import { ApiProps, ApiInjectedProps } from './types';
|
||||
import { ApiProps } from './types';
|
||||
|
||||
import React from 'react';
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
import { isWeb3Injected, web3Accounts, web3Enable } from '@polkadot/extension-dapp';
|
||||
import defaults from '@polkadot/rpc-provider/defaults';
|
||||
import { WsProvider } from '@polkadot/rpc-provider';
|
||||
import { InputNumber } from '@polkadot/ui-app/InputNumber';
|
||||
@ -17,11 +18,10 @@ import { ChainProperties } from '@polkadot/types';
|
||||
import { formatBalance, isTestChain } from '@polkadot/util';
|
||||
|
||||
import ApiContext from './ApiContext';
|
||||
import { withInjected } from './Injected';
|
||||
|
||||
let api: ApiPromise;
|
||||
|
||||
type Props = ApiInjectedProps & {
|
||||
type Props = {
|
||||
children: React.ReactNode,
|
||||
queueExtrinsic: QueueTx$ExtrinsicAdd,
|
||||
queueSetTxStatus: QueueTx$MessageSetStatus,
|
||||
@ -32,17 +32,17 @@ type State = ApiProps & {
|
||||
chain?: string
|
||||
};
|
||||
|
||||
type InjectedAccount = { address: string, meta: { name: string } };
|
||||
|
||||
export { api };
|
||||
|
||||
class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
const injectedPromise = web3Enable('polkadot-js/apps');
|
||||
|
||||
export default class Api extends React.PureComponent<Props, State> {
|
||||
state: State = {} as State;
|
||||
|
||||
constructor (props: Props) {
|
||||
super(props);
|
||||
|
||||
const { injectedAvailable, queueExtrinsic, queueSetTxStatus, url } = props;
|
||||
const { queueExtrinsic, queueSetTxStatus, url } = props;
|
||||
const provider = new WsProvider(url);
|
||||
const signer = new ApiSigner(queueExtrinsic, queueSetTxStatus);
|
||||
|
||||
@ -61,15 +61,13 @@ class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
this.state = {
|
||||
isApiConnected: false,
|
||||
isApiReady: false,
|
||||
isWaitingInjected: injectedAvailable,
|
||||
isWaitingInjected: isWeb3Injected,
|
||||
api,
|
||||
setApiUrl
|
||||
} as State;
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
const { injectedPromise } = this.props;
|
||||
|
||||
this.subscribeEvents();
|
||||
|
||||
injectedPromise
|
||||
@ -97,42 +95,6 @@ class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
private async retrieveInjected (): Promise<Array<InjectedAccount>> {
|
||||
const { injectedPromise } = this.props;
|
||||
const injected: Array<InjectedAccount> = [];
|
||||
const result = await injectedPromise;
|
||||
|
||||
if (result.length) {
|
||||
const providers = result.map(({ name, version }) => `${name}/${version}`);
|
||||
|
||||
console.log(`api: found injectedWeb3: ${providers.join(', ')}`);
|
||||
|
||||
const rerieved = await Promise.all(
|
||||
result.map(({ accounts, name: source }) =>
|
||||
accounts.get().then((accounts) =>
|
||||
accounts.map(({ address, name }) => ({
|
||||
address,
|
||||
meta: {
|
||||
name: `${name} (${source === 'polkadot-js' ? 'extension' : source})`,
|
||||
source
|
||||
}
|
||||
}))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
rerieved.forEach((accounts) =>
|
||||
accounts.forEach((account) =>
|
||||
injected.push(account)
|
||||
)
|
||||
);
|
||||
|
||||
console.log(`api: injected ${injected.length} accounts`);
|
||||
}
|
||||
|
||||
return injected;
|
||||
}
|
||||
|
||||
private async loadOnReady (api: ApiPromise) {
|
||||
const [properties = new ChainProperties(), value] = await Promise.all([
|
||||
api.rpc.system.properties() as Promise<ChainProperties | undefined>,
|
||||
@ -144,7 +106,15 @@ class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
? value.toString()
|
||||
: null;
|
||||
const isDevelopment = isTestChain(chain);
|
||||
const injected = await this.retrieveInjected();
|
||||
const injectedAccounts = await web3Accounts().then((accounts) =>
|
||||
accounts.map(({ address, meta }) => ({
|
||||
address,
|
||||
meta: {
|
||||
...meta,
|
||||
name: `${meta.name} (${meta.source === 'polkadot-js' ? 'extension' : meta.source})`
|
||||
}
|
||||
}))
|
||||
);
|
||||
|
||||
console.log('api: found chain', chain, JSON.stringify(properties));
|
||||
|
||||
@ -160,7 +130,7 @@ class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
addressPrefix: properties.get('networkId'),
|
||||
isDevelopment,
|
||||
type: 'ed25519'
|
||||
}, injected);
|
||||
}, injectedAccounts);
|
||||
|
||||
this.setState({
|
||||
isApiReady: true,
|
||||
@ -190,5 +160,3 @@ class ApiWrapper extends React.PureComponent<Props, State> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default withInjected(ApiWrapper);
|
||||
|
||||
@ -1,45 +0,0 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-api 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 { ApiInjected, ApiInjectedProps, Subtract, WindowInjected } from './types';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
const objmap = (window as WindowInjected).injectedWeb3;
|
||||
const injectedAvailable = !!objmap && Object.keys(objmap).length !== 0;
|
||||
const injectedPromise = !injectedAvailable
|
||||
? Promise.resolve([] as Array<ApiInjected>)
|
||||
: Promise.all(Object.values(objmap).map(({ name, version, enable }) =>
|
||||
Promise.all([
|
||||
Promise.resolve({ name, version }),
|
||||
enable('polkadot-js/apps').catch(() => null)
|
||||
])))
|
||||
.then((values) => values.filter(([, result]) => result !== null))
|
||||
.then((values) => values.map(([info, result]) => ({ ...info, ...result })))
|
||||
.catch(() => [] as Array<ApiInjected>);
|
||||
|
||||
const InjectedContext = React.createContext({ injectedAvailable, injectedPromise });
|
||||
const InjectedConsumer = InjectedContext.Consumer;
|
||||
|
||||
export {
|
||||
InjectedConsumer
|
||||
};
|
||||
|
||||
export function withInjected<P extends ApiInjectedProps> (Component: React.ComponentType<P>): React.ComponentType<Subtract<P, ApiInjectedProps>> {
|
||||
return class extends React.PureComponent<Subtract<P, ApiInjectedProps>> {
|
||||
render () {
|
||||
return (
|
||||
<InjectedContext.Consumer>
|
||||
{(injected) => (
|
||||
// @ts-ignore Something here with the props are going wonky
|
||||
<Component
|
||||
{...this.props}
|
||||
{...injected}
|
||||
/>
|
||||
)}
|
||||
</InjectedContext.Consumer>
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -5,7 +5,6 @@
|
||||
import Api, { api } from './Api';
|
||||
import ApiContext from './ApiContext';
|
||||
|
||||
export * from './Injected';
|
||||
export * from './with';
|
||||
|
||||
export {
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// This software may be modified and distributed under the terms
|
||||
// of the Apache-2.0 license. See the LICENSE file for details.
|
||||
|
||||
import { Signer } from '@polkadot/api/types';
|
||||
import { SubmittableExtrinsicFunction } from '@polkadot/api/promise/types';
|
||||
|
||||
import ApiPromise from '@polkadot/api/promise';
|
||||
|
||||
// helpers for HOC props
|
||||
@ -25,41 +25,14 @@ export type ApiProps = {
|
||||
setApiUrl: (url?: string) => void
|
||||
};
|
||||
|
||||
export type WindowInjectedInfo = {
|
||||
name: string,
|
||||
version: string
|
||||
};
|
||||
|
||||
export type WindowInjectedResult = {
|
||||
accounts: {
|
||||
get: () => Promise<Array<{ address: string, name: string }>>
|
||||
},
|
||||
signer: Signer
|
||||
};
|
||||
|
||||
export type WindowInjected = Window & {
|
||||
injectedWeb3: {
|
||||
[index: string]: WindowInjectedInfo & {
|
||||
enable: (origin: string) => Promise<WindowInjectedResult>
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export type ApiInjected = WindowInjectedInfo & WindowInjectedResult;
|
||||
|
||||
export type ApiInjectedProps = {
|
||||
injectedAvailable: boolean,
|
||||
injectedPromise: Promise<Array<ApiInjected>>
|
||||
};
|
||||
|
||||
export type OnChangeCb$Obs = { next: (value?: any) => any };
|
||||
export type OnChangeCb$Fn = (value?: any) => any;
|
||||
|
||||
export type OnChangeCb = OnChangeCb$Obs | OnChangeCb$Fn;
|
||||
|
||||
export type ChangeProps = {
|
||||
callOnResult?: OnChangeCb
|
||||
};
|
||||
|
||||
export type CallState = {
|
||||
callResult?: any;
|
||||
callUpdated?: boolean;
|
||||
|
||||
@ -16,7 +16,7 @@ import { withCalls } from '@polkadot/ui-api';
|
||||
import AvailableDisplay from './Available';
|
||||
import BalanceDisplay from './Balance';
|
||||
import BondedDisplay from './Bonded';
|
||||
import { classes, getAddrName, toShortAddress } from './util';
|
||||
import { classes, getAddrName, getAddrTags, toShortAddress } from './util';
|
||||
import CopyButton from './CopyButton';
|
||||
import IdentityIcon from './IdentityIcon';
|
||||
import NonceDisplay from './Nonce';
|
||||
@ -47,9 +47,9 @@ export type Props = I18nProps & {
|
||||
};
|
||||
|
||||
type State = {
|
||||
isEditingName: boolean
|
||||
isEditingTags: boolean
|
||||
name: string
|
||||
isEditingName: boolean,
|
||||
isEditingTags: boolean,
|
||||
name: string,
|
||||
tags: string[]
|
||||
};
|
||||
|
||||
@ -60,25 +60,20 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
|
||||
constructor (props: Props) {
|
||||
super(props);
|
||||
|
||||
this.state = this.createState();
|
||||
}
|
||||
|
||||
createState () {
|
||||
const { accounts_idAndIndex = [], defaultName, value } = this.props;
|
||||
static getDerivedStateFromProps ({ accounts_idAndIndex = [], defaultName, value }: Props): State | null {
|
||||
const [_accountId] = accounts_idAndIndex;
|
||||
const accountId = _accountId || value;
|
||||
const address = accountId
|
||||
? accountId.toString()
|
||||
: DEFAULT_ADDR;
|
||||
? accountId.toString()
|
||||
: DEFAULT_ADDR;
|
||||
const name = getAddrName(address, false, defaultName) || '';
|
||||
const tags = this.getAddressTags(address);
|
||||
const tags = getAddrTags(address);
|
||||
|
||||
return {
|
||||
isEditingName: false,
|
||||
isEditingTags: false,
|
||||
name,
|
||||
tags: tags
|
||||
};
|
||||
return { name, tags } as State;
|
||||
}
|
||||
|
||||
render () {
|
||||
@ -112,17 +107,22 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
protected getAddressTags (address: string): Array<string> {
|
||||
try {
|
||||
if (keyring.getAccount(address).isValid()) {
|
||||
const addressKeyring = address && keyring.getPair(address);
|
||||
return addressKeyring && addressKeyring.getMeta().tags || [];
|
||||
}
|
||||
} catch (error) {
|
||||
// all-ok, we have empty fallbacks
|
||||
}
|
||||
private createState () {
|
||||
const { accounts_idAndIndex = [], defaultName, value } = this.props;
|
||||
const [_accountId] = accounts_idAndIndex;
|
||||
const accountId = _accountId || value;
|
||||
const address = accountId
|
||||
? accountId.toString()
|
||||
: DEFAULT_ADDR;
|
||||
const name = getAddrName(address, false, defaultName) || '';
|
||||
const tags = getAddrTags(address);
|
||||
|
||||
return [];
|
||||
return {
|
||||
isEditingName: false,
|
||||
isEditingTags: false,
|
||||
name,
|
||||
tags
|
||||
};
|
||||
}
|
||||
|
||||
protected renderAddress () {
|
||||
@ -133,15 +133,15 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
: DEFAULT_ADDR;
|
||||
|
||||
const addrElem = isShort
|
||||
? (
|
||||
<CopyButton
|
||||
isAddress
|
||||
value={address}
|
||||
>
|
||||
<span>{toShortAddress(address)}</span>
|
||||
</CopyButton>
|
||||
)
|
||||
: address;
|
||||
? (
|
||||
<CopyButton
|
||||
isAddress
|
||||
value={address}
|
||||
>
|
||||
<span>{toShortAddress(address)}</span>
|
||||
</CopyButton>
|
||||
)
|
||||
: address;
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -159,8 +159,8 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
const { isEditable } = this.props;
|
||||
const { isEditingName, name } = this.state;
|
||||
|
||||
const resultingDom = isEditingName ?
|
||||
<>
|
||||
return isEditingName
|
||||
? (
|
||||
<Input
|
||||
autoFocus
|
||||
defaultValue={name}
|
||||
@ -170,17 +170,16 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
onEnter={this.saveName}
|
||||
withLabel={false}
|
||||
/>
|
||||
</>
|
||||
:
|
||||
)
|
||||
: (
|
||||
<div
|
||||
className={classes('ui--AddressSummary-name', isEditable && 'editable')}
|
||||
onClick={isEditable ? this.toggleNameEditor : undefined}
|
||||
>
|
||||
{name}
|
||||
{isEditable && this.renderEditIcon(this.toggleNameEditor)}
|
||||
</div>;
|
||||
|
||||
return resultingDom;
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
protected onChangeName = (name: string) => {
|
||||
@ -188,7 +187,7 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
protected onChangeTags = (tags: string[]) => {
|
||||
this.setState({ tags : tags });
|
||||
this.setState({ tags });
|
||||
}
|
||||
|
||||
protected renderAvailable () {
|
||||
@ -417,6 +416,7 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
if (trimmedName && value) {
|
||||
const currentKeyring = keyring.getPair(value.toString());
|
||||
currentKeyring && keyring.saveAccountMeta(currentKeyring, { name: trimmedName, whenEdited: Date.now() });
|
||||
|
||||
this.toggleNameEditor();
|
||||
}
|
||||
}
|
||||
@ -428,6 +428,7 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
if (value) {
|
||||
const currentKeyring = keyring.getPair(value.toString());
|
||||
currentKeyring && keyring.saveAccountMeta(currentKeyring, { tags, whenEdited: Date.now() });
|
||||
|
||||
this.toggleTagsEditor();
|
||||
}
|
||||
}
|
||||
@ -436,12 +437,16 @@ class AddressSummary extends React.PureComponent<Props, State> {
|
||||
const { value } = this.props;
|
||||
|
||||
if (value && keyring.getPair(value.toString())) {
|
||||
this.setState({ isEditingName : !this.state.isEditingName });
|
||||
this.setState(({ isEditingName }) => ({
|
||||
isEditingName: !isEditingName
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
protected toggleTagsEditor = () => {
|
||||
this.setState({ isEditingTags : !this.state.isEditingTags });
|
||||
this.setState(({ isEditingTags }) => ({
|
||||
isEditingTags: !isEditingTags
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,6 +47,7 @@ const Wrapper = styled.div`
|
||||
|
||||
.desc {
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
padding: 0.5rem 1rem;
|
||||
|
||||
.status {
|
||||
|
||||
@ -46,6 +46,7 @@ header .ui--Button-Group {
|
||||
.ui--AddressMini {
|
||||
display: inline-block;
|
||||
padding: 0 0.25rem 0 1rem;
|
||||
white-space: nowrap;
|
||||
|
||||
&.padded {
|
||||
display: inline-block;
|
||||
@ -113,12 +114,12 @@ button.ui.icon.withDrawUnbonded {
|
||||
|
||||
.overview--Account:hover button.ui.icon.editButton,
|
||||
.overview--Account:hover button.ui.icon.editButton {
|
||||
visibility: visible;
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.overview--Account button.ui.icon.editButton,
|
||||
.overview--Account button.ui.icon.editButton {
|
||||
visibility: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.ui--AddressSummary-name.editable > button.ui.icon.editButton,
|
||||
@ -179,6 +180,12 @@ button.ui.icon.withDrawUnbonded {
|
||||
.ui--AddressRow-details {
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
|
||||
.ui--AddressSummary-data,
|
||||
.ui--AddressSummary-name {
|
||||
margin: 0;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.ui--AddressSummary-balances>span {
|
||||
@ -256,9 +263,14 @@ button.ui.icon.withDrawUnbonded {
|
||||
|
||||
.ui--AddressSummary-data {
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
|
||||
.ui--AddressSummary-name {
|
||||
width: 15rem;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
}
|
||||
|
||||
19
packages/ui-app/src/util/getAddrTags.ts
Normal file
19
packages/ui-app/src/util/getAddrTags.ts
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2017-2019 @polkadot/ui-app 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 keyring from '@polkadot/ui-keyring';
|
||||
|
||||
export default function getAddrAtgs (address: string): Array<string> {
|
||||
let pair;
|
||||
|
||||
try {
|
||||
pair = keyring.getAccount(address).isValid()
|
||||
? keyring.getAccount(address)
|
||||
: keyring.getAddress(address);
|
||||
} catch (error) {
|
||||
// all-ok, we have empty fallbacks
|
||||
}
|
||||
|
||||
return (pair && pair.isValid() && pair.getMeta().tags) || [];
|
||||
}
|
||||
@ -4,5 +4,6 @@
|
||||
|
||||
export { default as classes } from './classes';
|
||||
export { default as getAddrName } from './getAddrName';
|
||||
export { default as getAddrTags } from './getAddrTags';
|
||||
export { default as toAddress } from './toAddress';
|
||||
export { default as toShortAddress } from './toShortAddress';
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
import { SubmittableResult } from '@polkadot/api/SubmittableExtrinsic';
|
||||
import { SubmittableExtrinsic } from '@polkadot/api/promise/types';
|
||||
import { ApiProps, ApiInjectedProps } from '@polkadot/ui-api/types';
|
||||
import { ApiProps } from '@polkadot/ui-api/types';
|
||||
import { I18nProps, BareProps } from '@polkadot/ui-app/types';
|
||||
import { RpcMethod } from '@polkadot/jsonrpc/types';
|
||||
import { KeyringPair } from '@polkadot/keyring/types';
|
||||
@ -12,8 +12,9 @@ import { SubjectInfo } from '@polkadot/ui-keyring/observable/types';
|
||||
import { QueueTx, QueueTx$MessageSetStatus, QueueTx$Result, QueueTx$Status } from '@polkadot/ui-app/Status/types';
|
||||
|
||||
import React from 'react';
|
||||
import { web3FromSource } from '@polkadot/extension-dapp';
|
||||
import { Button, Modal } from '@polkadot/ui-app';
|
||||
import { withApi, withInjected, withMulti, withObservable } from '@polkadot/ui-api';
|
||||
import { withApi, withMulti, withObservable } from '@polkadot/ui-api';
|
||||
import keyring from '@polkadot/ui-keyring';
|
||||
import accountObservable from '@polkadot/ui-keyring/observable/accounts';
|
||||
import { assert, isFunction } from '@polkadot/util';
|
||||
@ -28,7 +29,7 @@ type BaseProps = BareProps & {
|
||||
queueSetTxStatus: QueueTx$MessageSetStatus
|
||||
};
|
||||
|
||||
type Props = I18nProps & ApiProps & ApiInjectedProps & BaseProps & {
|
||||
type Props = I18nProps & ApiProps & BaseProps & {
|
||||
allAccounts?: SubjectInfo
|
||||
};
|
||||
|
||||
@ -313,7 +314,7 @@ class Signer extends React.PureComponent<Props, State> {
|
||||
}
|
||||
|
||||
private async makeExtrinsicCall (extrinsic: SubmittableExtrinsic, { id, txFailedCb, txSuccessCb, txStartCb, txUpdateCb }: QueueTx, extrinsicCall: (...params: Array<any>) => any, pair?: KeyringPair): Promise<void> {
|
||||
const { api, injectedPromise, queueSetTxStatus } = this.props;
|
||||
const { api, queueSetTxStatus } = this.props;
|
||||
|
||||
console.log('makeExtrinsicCall: extrinsic ::', extrinsic.toHex());
|
||||
|
||||
@ -323,14 +324,14 @@ class Signer extends React.PureComponent<Props, State> {
|
||||
// set the signer
|
||||
if (pair.getMeta().isInjected) {
|
||||
const source = pair.getMeta().source;
|
||||
const sources = await injectedPromise;
|
||||
const injected = source && sources.find(({ name }) => name === source);
|
||||
const address = pair.address();
|
||||
const injected = await web3FromSource(source);
|
||||
|
||||
assert(injected, 'Unable to find a signer');
|
||||
assert(injected, `Unable to find a signer for ${address}`);
|
||||
|
||||
api.setSigner((injected as any).signer);
|
||||
api.setSigner(injected.signer);
|
||||
|
||||
params.push(pair.address());
|
||||
params.push(address);
|
||||
} else {
|
||||
params.push(pair);
|
||||
}
|
||||
@ -398,6 +399,5 @@ export default withMulti(
|
||||
Signer,
|
||||
translate,
|
||||
withApi,
|
||||
withInjected,
|
||||
withObservable(accountObservable.subject, { propName: 'allAccounts' })
|
||||
);
|
||||
|
||||
109
yarn.lock
109
yarn.lock
@ -1761,29 +1761,29 @@
|
||||
universal-user-agent "^2.0.0"
|
||||
url-template "^2.0.8"
|
||||
|
||||
"@polkadot/api-derive@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.79.1.tgz#0c91bc1450849fad092fd8c201066a4c0fc38bcd"
|
||||
integrity sha512-VHIClyj9+7d32JfCI5JH6pPLIPT1gQMJiPsRtxmVdmvtySWE4njcJYVdcw/vvclCnljoNzvSAXp/fICSBnmkdA==
|
||||
"@polkadot/api-derive@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api-derive/-/api-derive-0.80.0-beta.2.tgz#4bf7500971cd687c7f30ac3bde29324b1de9bbe2"
|
||||
integrity sha512-xrfnFTyP+wjy98kdbhR+RB4FT9FrunKXot2NolqZu2zSVgpNCO/o8Ssiw7OVeRNdP5XNvCDiGO1bh6GvvNuECA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/api" "^0.79.1"
|
||||
"@polkadot/types" "^0.79.1"
|
||||
"@polkadot/api" "^0.80.0-beta.2"
|
||||
"@polkadot/types" "^0.80.0-beta.2"
|
||||
"@types/memoizee" "^0.4.2"
|
||||
memoizee "^0.4.14"
|
||||
|
||||
"@polkadot/api@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.79.1.tgz#3cf2d4212dd21d5f7b54560d7d025e57e877a127"
|
||||
integrity sha512-AXNT55vm8p93oVC8eXF0HMr5DHQsK+rOEbOUCAwgdfewz0aHUmyXDl7PjFRW2dLSQPj3gG4MHoj4Lw6F88lUBQ==
|
||||
"@polkadot/api@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/api/-/api-0.80.0-beta.2.tgz#6183300aaacbd8935d9837ef6442abf31c15153f"
|
||||
integrity sha512-pPLyhiV5QIGvMUIojP2m4zw+6cx1T16phG2Z+jxmV3X28ujT5QWm260jrfCx+nnbQM/z6GJgDlD/C7wJx61xuA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/api-derive" "^0.79.1"
|
||||
"@polkadot/extrinsics" "^0.79.1"
|
||||
"@polkadot/rpc-provider" "^0.79.1"
|
||||
"@polkadot/rpc-rx" "^0.79.1"
|
||||
"@polkadot/storage" "^0.79.1"
|
||||
"@polkadot/types" "^0.79.1"
|
||||
"@polkadot/api-derive" "^0.80.0-beta.2"
|
||||
"@polkadot/extrinsics" "^0.80.0-beta.2"
|
||||
"@polkadot/rpc-provider" "^0.80.0-beta.2"
|
||||
"@polkadot/rpc-rx" "^0.80.0-beta.2"
|
||||
"@polkadot/storage" "^0.80.0-beta.2"
|
||||
"@polkadot/types" "^0.80.0-beta.2"
|
||||
"@polkadot/util-crypto" "^0.91.1"
|
||||
|
||||
"@polkadot/dev-react@^0.30.0-beta.5":
|
||||
@ -1859,19 +1859,24 @@
|
||||
typescript "^3.4.5"
|
||||
vuepress "^1.0.0-alpha.47"
|
||||
|
||||
"@polkadot/extrinsics@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.79.1.tgz#d515b70869a604fc02e106f94c53e1f72eaf9c44"
|
||||
integrity sha512-4OlVp8Crvnx8t4LimZFLOIexu54MA1quMr3YVwf8Kv7kbRCkeAScNaFg9mKnl7DHasTPRI4LR+bTEvfSqypxCA==
|
||||
"@polkadot/extension-dapp@^0.1.1-beta.4":
|
||||
version "0.1.1-beta.4"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extension-dapp/-/extension-dapp-0.1.1-beta.4.tgz#9ef6c7da1a0bc76519de9926b59a4ac66267b62a"
|
||||
integrity sha512-LMNnwRKSZ/D6e7sQcCbVOYEx88TiJqrQaEwV6nNmg5YB+ep2iIag7wJRelhLrnmx2O8693INjjNiWxtGi4VJBQ==
|
||||
|
||||
"@polkadot/extrinsics@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/extrinsics/-/extrinsics-0.80.0-beta.2.tgz#55d0b6bdfbf297d353fe1017f479be76cf7ea68f"
|
||||
integrity sha512-4QYQeTU8nSqZA+E4OXLglQqEiTXI76dNFjTmOUF8RJtb3V8A5pLafA71PoanRuJAh2PtmlNJIl+PqXfOU18+WA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/types" "^0.79.1"
|
||||
"@polkadot/types" "^0.80.0-beta.2"
|
||||
"@polkadot/util" "^0.91.1"
|
||||
|
||||
"@polkadot/jsonrpc@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.79.1.tgz#f92ab4fdd536e0595c82b80edfd3f5f162e41053"
|
||||
integrity sha512-J7FhDQgcfii+1WG8wkBPa19BbwqmT5YRXGwrL+ZLelGnp9ypXJ4KJNMTspsmqIeoP9JE+6NIAS3vHoWM814cFw==
|
||||
"@polkadot/jsonrpc@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/jsonrpc/-/jsonrpc-0.80.0-beta.2.tgz#0b241f3b00b3ad176bef674fb7386dce336de36e"
|
||||
integrity sha512-BpmY3pGuzFf9RNHEuPVlHQG3cSy0NyfmEnah/GlbRtkpOKJgx14hpGEdas4YGCmntwmB33vGjxLV48CD16q6+A==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
|
||||
@ -1886,25 +1891,25 @@
|
||||
"@types/bs58" "^4.0.0"
|
||||
bs58 "^4.0.1"
|
||||
|
||||
"@polkadot/rpc-core@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.79.1.tgz#d423ff38846f4189d288dc3cfc43d3c8fd539bc3"
|
||||
integrity sha512-jWwwPbihGUwTUR48w9ootK/mpS/2aBsG4KUsSuLgmBSyVNPUA/U19VW7yD3BgMF6GdURAZFCBk3tqKIEjZox9w==
|
||||
"@polkadot/rpc-core@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-core/-/rpc-core-0.80.0-beta.2.tgz#19a7acfc2505bc1cc94a6d22445ec44124117d1b"
|
||||
integrity sha512-0rz+Y1BG88puwOJV7HgCnJtIRUgvmAjDcC0rcllT6+DPjmM0uPASK85hgMQn72D5USEOEX0J0JR41d8RtORhLQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/jsonrpc" "^0.79.1"
|
||||
"@polkadot/rpc-provider" "^0.79.1"
|
||||
"@polkadot/types" "^0.79.1"
|
||||
"@polkadot/jsonrpc" "^0.80.0-beta.2"
|
||||
"@polkadot/rpc-provider" "^0.80.0-beta.2"
|
||||
"@polkadot/types" "^0.80.0-beta.2"
|
||||
"@polkadot/util" "^0.91.1"
|
||||
|
||||
"@polkadot/rpc-provider@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.79.1.tgz#ab538f9bcdccd06ed7d199df9732802675c117ef"
|
||||
integrity sha512-ZRY9S9Mqk9aQyJKBeHzrgpL02SZkH/fHwcmIDZGWI8kJuAP3Yn7LO761K82HMsehkbNCBnxdWB5oJKQ+qlYFrw==
|
||||
"@polkadot/rpc-provider@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-provider/-/rpc-provider-0.80.0-beta.2.tgz#69cce892adf3a99fbe69355e90ec624421212ab8"
|
||||
integrity sha512-ON0TjZvMU5ZLGMa6NCN6tdn0fbRdk8audU6L0lmHKouhG8h/sDOzD3j54vnaXSScqHt1Bv6bN8V1F6aUgUEseg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/keyring" "^0.91.1"
|
||||
"@polkadot/storage" "^0.79.1"
|
||||
"@polkadot/storage" "^0.80.0-beta.2"
|
||||
"@polkadot/util" "^0.91.1"
|
||||
"@polkadot/util-crypto" "^0.91.1"
|
||||
"@types/nock" "^10.0.3"
|
||||
@ -1912,27 +1917,27 @@
|
||||
isomorphic-fetch "^2.2.1"
|
||||
websocket "^1.0.28"
|
||||
|
||||
"@polkadot/rpc-rx@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.79.1.tgz#e212324e94035985909f046e985179908e01d655"
|
||||
integrity sha512-lf0Z5VUrdvddnw+XcFcdcmmsExO5h+wMN2ILgAm9fZZUC+y+8dxMxFE3vFL2N7CSecFznf0FRr8GMiRJzZTt8w==
|
||||
"@polkadot/rpc-rx@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/rpc-rx/-/rpc-rx-0.80.0-beta.2.tgz#aa8ad4fc5e8f96678842247ae82c395f77821d48"
|
||||
integrity sha512-MlHIHUxJ+pD9nMUqZFQjuKQDzWlZGkD8vjvwNqSrqedncqBflZbkSNbpPib9vWctFZX7DgLbdO5FP9bFY2aXsQ==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/rpc-core" "^0.79.1"
|
||||
"@polkadot/rpc-provider" "^0.79.1"
|
||||
"@polkadot/rpc-core" "^0.80.0-beta.2"
|
||||
"@polkadot/rpc-provider" "^0.80.0-beta.2"
|
||||
"@types/memoizee" "^0.4.2"
|
||||
"@types/rx" "^4.1.1"
|
||||
memoizee "^0.4.14"
|
||||
rxjs "^6.5.2"
|
||||
|
||||
"@polkadot/storage@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.79.1.tgz#e07f1fa5b935e1f47a229993a2aca6c826d3ef78"
|
||||
integrity sha512-hyr8n83XFSm0tm5v8XSW8ul3VPfC9ekesjtzgc95jzqQHs3J4ntbyh8rjAOX+IB3EP0W8nI6mvMvHP5MdS7ltQ==
|
||||
"@polkadot/storage@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/storage/-/storage-0.80.0-beta.2.tgz#dac82682eaf7dc48cd3763aa7bc52615d7c8ba87"
|
||||
integrity sha512-lNYl77JEovBND7c/viglBSpQDMYkDGPqocPxa7P3+3mzha+Nb4ZT6UHNctRKvqc6PM9pPC0R634NdFCgH9N0dA==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/keyring" "^0.91.1"
|
||||
"@polkadot/types" "^0.79.1"
|
||||
"@polkadot/types" "^0.80.0-beta.2"
|
||||
"@polkadot/util" "^0.91.1"
|
||||
"@polkadot/util-crypto" "^0.91.1"
|
||||
|
||||
@ -1941,10 +1946,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/ts/-/ts-0.1.56.tgz#ffd6e9c95704a7fb90b918193b9dc5c440114b27"
|
||||
integrity sha512-wnt4zXxZXyz6WaubTO/I+nUElwV2DogFzdl6CrKfVn2PTWp8uHN06W9s40FH57ORtmQfDr9rLRP8Nq+oIyElbg==
|
||||
|
||||
"@polkadot/types@^0.79.1":
|
||||
version "0.79.1"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.79.1.tgz#491a53dd23d5ac645d58a8467c1b919d4bb00c09"
|
||||
integrity sha512-u7hcubX5Kl3m3IM+YXyORXlgHUJSb+a/YyzalERF7yRxEUW1fPMRE6935cUQT5kHdRme0aANncjHFGbE6Qn0vg==
|
||||
"@polkadot/types@^0.80.0-beta.2":
|
||||
version "0.80.0-beta.2"
|
||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.80.0-beta.2.tgz#450baa6b86cd864aba5b49a00c4fcaf1cb2eecb3"
|
||||
integrity sha512-BcWjUYyDm6KgAl+LyVqvmVp7GGfIJtiJDLpZJ9gyc2m3fpqZxqp2ektEpA8bGrxUyQcyqIBGpb0y8ibe1flcPg==
|
||||
dependencies:
|
||||
"@babel/runtime" "^7.4.5"
|
||||
"@polkadot/keyring" "^0.91.1"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user