Skip to content

Commit

Permalink
chore: open plugin missing alert
Browse files Browse the repository at this point in the history
  • Loading branch information
sxlwar committed Feb 23, 2022
1 parent a797434 commit d2e6b37
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/account/AssetOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function AssetOverview({ asset, refresh }: AssetOverviewProps) {
}}
onFail={() => setIsVisible(false)}
onCancel={() => setIsVisible(false)}
initialValues={{ from: account, to: accounts[0].address, amount: 0 }}
initialValues={{ from: account, to: accounts[0]?.address, amount: 0 }}
extrinsic={(values) => {
const { to, amount } = values;
const moduleName = isRing(asset.token?.symbol) ? 'balances' : 'kton';
Expand Down
2 changes: 1 addition & 1 deletion src/components/toolbox/withdraw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function Withdraw() {

if (status === 'success' && accountHex !== EMPTY_ADDRESS) {
getSendTransactionObs({
from: accounts[0].address,
from: accounts[0]?.address,
to: DVM_WITHDRAW_ADDRESS,
data: accountHex,
value: web3.utils.toWei(amount, 'ether'),
Expand Down
15 changes: 11 additions & 4 deletions src/utils/network/connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export const LOCAL = 'local';

export const getPolkadotConnection: (network: ChainConfig) => Observable<PolkadotConnection> = (network) =>
from(web3Enable('polkadot-js/apps')).pipe(
concatMap((extensions) =>
combineLatest([from(web3Accounts()), accountsObs.subject.asObservable()], (injected, data) => {
concatMap((extensions) => {
const result = combineLatest([from(web3Accounts()), accountsObs.subject.asObservable()], (injected, data) => {
const keys = Object.keys(data);
const injectedAddress = injected.map((item) => item.address);
const source = keys.filter((key) => !injectedAddress.includes(key));
Expand All @@ -71,8 +71,15 @@ export const getPolkadotConnection: (network: ChainConfig) => Observable<Polkado
status: 'pending',
} as Exclude<PolkadotConnection, 'api'>)
)
)
),
);

if (!extensions.length) {
showWarning('Polkadot', 'https://polkadot.js.org/extension/');
return EMPTY;
}

return result;
}),
switchMap((envelop: Exclude<PolkadotConnection, 'api'>) => {
const subject = new BehaviorSubject<PolkadotConnection>(envelop);
const url = network.provider.rpc;
Expand Down

0 comments on commit d2e6b37

Please sign in to comment.