diff --git a/.changeset/ninety-snails-type.md b/.changeset/ninety-snails-type.md new file mode 100644 index 00000000..a74d653e --- /dev/null +++ b/.changeset/ninety-snails-type.md @@ -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). diff --git a/packages/core/src/wallets/injected/provider.ts b/packages/core/src/wallets/injected/provider.ts index c764b00d..582f628f 100644 --- a/packages/core/src/wallets/injected/provider.ts +++ b/packages/core/src/wallets/injected/provider.ts @@ -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), );