Skip to content

Commit

Permalink
Add new flag for coinbase dapp browsers (#491)
Browse files Browse the repository at this point in the history
* Add new flag for coinbase dapp browsers
* run prettier
* fix default value
* prettier
  • Loading branch information
cb-jake authored Apr 27, 2022
1 parent e2105e0 commit fc8fc7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/CoinbaseWalletSDK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export interface CoinbaseWalletSDKOptions {
overrideIsMetaMask?: boolean;
/** @optional whether wallet link provider should override the isCoinbaseWallet property. */
overrideIsCoinbaseWallet?: boolean;
/** @optional whether coinbase wallet provider should override the isCoinbaseBrowser property. */
overrideIsCoinbaseBrowser?: boolean;
/** @optional whether or not onboarding overlay popup should be displayed */
headlessMode?: boolean;
}
Expand All @@ -46,6 +48,7 @@ export class CoinbaseWalletSDK {
private _storage: ScopedLocalStorage;
private _overrideIsMetaMask: boolean;
private _overrideIsCoinbaseWallet: boolean;
private _overrideIsCoinbaseBrowser: boolean;
private _eventListener?: EventListener;

/**
Expand All @@ -68,6 +71,8 @@ export class CoinbaseWalletSDK {
}

this._overrideIsCoinbaseWallet = options.overrideIsCoinbaseWallet ?? true;
this._overrideIsCoinbaseBrowser =
options.overrideIsCoinbaseBrowser ?? false;

this._eventListener = options.eventListener;

Expand Down Expand Up @@ -134,7 +139,8 @@ export class CoinbaseWalletSDK {
qrUrl: this.getQrUrl(),
eventListener: this._eventListener,
overrideIsMetaMask: this._overrideIsMetaMask,
overrideIsCoinbaseWallet: this._overrideIsCoinbaseWallet
overrideIsCoinbaseWallet: this._overrideIsCoinbaseWallet,
overrideIsCoinbaseBrowser: this._overrideIsCoinbaseBrowser
});
}

Expand Down
5 changes: 5 additions & 0 deletions src/provider/CoinbaseWalletProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface CoinbaseWalletProviderOptions {
jsonRpcUrl: string;
qrUrl?: string | null;
overrideIsCoinbaseWallet?: boolean;
overrideIsCoinbaseBrowser?: boolean;
overrideIsMetaMask: boolean;
relayEventManager: WalletSDKRelayEventManager;
relayProvider: () => Promise<WalletSDKRelayAbstract>;
Expand All @@ -66,6 +67,9 @@ export class CoinbaseWalletProvider
{
// So dapps can easily identify Coinbase Wallet for enabling features like 3085 network switcher menus
public readonly isCoinbaseWallet: boolean;
// So dapps can easily identify Coinbase Dapp Browser for enabling dapp browser specific features
public readonly isCoinbaseBrowser: boolean;

public readonly qrUrl?: string | null;

private readonly _filterPolyfill = new FilterPolyfill(this);
Expand Down Expand Up @@ -110,6 +114,7 @@ export class CoinbaseWalletProvider
this._eventListener = options.eventListener;

this.isCoinbaseWallet = options.overrideIsCoinbaseWallet ?? true;
this.isCoinbaseBrowser = options.overrideIsCoinbaseBrowser ?? false;

this.qrUrl = options.qrUrl;

Expand Down

0 comments on commit fc8fc7d

Please sign in to comment.