Skip to content

Commit

Permalink
Merge pull request #2978 from getAlby/fix-provider-overriding
Browse files Browse the repository at this point in the history
feat: use separate instances to avoid provider being invaded by other wallets
  • Loading branch information
bumi authored Jan 8, 2024
2 parents ca254e2 + f15e765 commit e1f3b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
7 changes: 1 addition & 6 deletions src/extension/inpage-script/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,7 @@ function init() {
window.nostr = new NostrProvider();
window.webbtc = new WebBTCProvider();
window.webln = new WebLNProvider();
window.alby = new AlbyProvider(
window.liquid,
window.nostr,
window.webbtc,
window.webln
);
window.alby = new AlbyProvider();
const readyEvent = new Event("webln:ready");
window.dispatchEvent(readyEvent);

Expand Down
19 changes: 5 additions & 14 deletions src/extension/providers/alby/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@ import WebBTCProvider from "~/extension/providers/webbtc";
import WebLNProvider from "~/extension/providers/webln";

export default class AlbyProvider extends ProviderBase {
liquid: LiquidProvider;
nostr: NostrProvider;
webbtc: WebBTCProvider;
webln: WebLNProvider;
webln = new WebLNProvider();
nostr = new NostrProvider();
webbtc = new WebBTCProvider();
liquid = new LiquidProvider();

constructor(
liquid: LiquidProvider,
nostr: NostrProvider,
webbtc: WebBTCProvider,
webln: WebLNProvider
) {
constructor() {
super("alby");
this.liquid = liquid;
this.nostr = nostr;
this.webbtc = webbtc;
this.webln = webln;
}

/**
Expand Down

0 comments on commit e1f3b56

Please sign in to comment.