Skip to content

Commit

Permalink
fix: pjs-extension wallet detection (#382)
Browse files Browse the repository at this point in the history
  • Loading branch information
tien authored Dec 3, 2024
1 parent 159e0af commit aeef030
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/ninety-snails-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reactive-dot/core": patch
---

Fixed PJS wallet detection, this is a workaround for the following [issue](https://github.com/polkadot-js/extension/issues/1475).
7 changes: 6 additions & 1 deletion packages/core/src/wallets/injected/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ import { WalletProvider } from "../provider.js";
import { InjectedWallet, type InjectedWalletOptions } from "./wallet.js";
import { getInjectedExtensions } from "polkadot-api/pjs-signer";

// TODO: remove once https://github.com/polkadot-js/extension/issues/1475 is fixed
const artificialDelay = new Promise((resolve) => setTimeout(resolve, 500));

export class InjectedWalletProvider extends WalletProvider {
constructor(private readonly options?: InjectedWalletOptions) {
super();
}

getWallets() {
async getWallets() {
await artificialDelay;

return getInjectedExtensions().map(
(name) => new InjectedWallet(name, this.options),
);
Expand Down

0 comments on commit aeef030

Please sign in to comment.