@coinbase/wallet-sdk
Advanced tools
Comparing version 3.9.0-canary.2 to 3.9.0-canary.3
@@ -20,4 +20,2 @@ import { EventEmitter } from 'eventemitter3'; | ||
diagnosticLogger?: DiagnosticLogger; | ||
supportsAddressSwitching?: boolean; | ||
isLedger?: boolean; | ||
} | ||
@@ -41,4 +39,2 @@ export declare class CoinbaseWalletProvider extends EventEmitter implements Web3Provider { | ||
private hasMadeFirstChainChangedEmission; | ||
private supportsAddressSwitching?; | ||
private isLedger?; | ||
constructor(options: Readonly<CoinbaseWalletProviderOptions>); | ||
@@ -63,6 +59,2 @@ /** @deprecated Use `.request({ method: 'eth_accounts' })` instead. */ | ||
disableReloadOnDisconnect(): void; | ||
/** | ||
* this function is called when coinbase provider is being injected to a dapp | ||
* standalone + walletlinked extension, ledger, in-app browser using cipher-web-view | ||
*/ | ||
setProviderInfo(jsonRpcUrl: string, chainId: number): void; | ||
@@ -128,3 +120,3 @@ private updateProviderInfo; | ||
private _sendRequest; | ||
private _setAddresses; | ||
protected _setAddresses(addresses: string[], _?: boolean): void; | ||
private _sendRequestAsync; | ||
@@ -139,3 +131,3 @@ private _sendMultipleRequestsAsync; | ||
private _prepareTransactionParams; | ||
private _isAuthorized; | ||
protected _isAuthorized(): boolean; | ||
private _requireAuthorization; | ||
@@ -142,0 +134,0 @@ private _throwUnsupportedMethodError; |
@@ -57,4 +57,2 @@ "use strict"; | ||
this.qrUrl = options.qrUrl; | ||
this.supportsAddressSwitching = options.supportsAddressSwitching; | ||
this.isLedger = options.isLedger; | ||
const chainId = this.getChainId(); | ||
@@ -78,3 +76,3 @@ const chainIdStr = (0, util_1.prepend0x)(chainId.toString(16)); | ||
}); | ||
if (this._addresses.length > 0) { | ||
if (this._isAuthorized()) { | ||
void this.initializeRelay(); | ||
@@ -90,4 +88,3 @@ } | ||
return; // compatibility with CBW extension | ||
if (event.data.data.action === 'defaultChainChanged' || | ||
event.data.data.action === 'dappChainSwitched') { | ||
if (event.data.data.action === 'dappChainSwitched') { | ||
const _chainId = event.data.data.chainId; | ||
@@ -144,9 +141,4 @@ const jsonRpcUrl = (_a = event.data.data.jsonRpcUrl) !== null && _a !== void 0 ? _a : this.jsonRpcUrl; | ||
} | ||
/** | ||
* this function is called when coinbase provider is being injected to a dapp | ||
* standalone + walletlinked extension, ledger, in-app browser using cipher-web-view | ||
*/ | ||
setProviderInfo(jsonRpcUrl, chainId) { | ||
// extension tend to use the chianId from the dapp, while in-app browser and ledger overrides the default network | ||
if (!(this.isLedger || this.isCoinbaseBrowser)) { | ||
if (!this.isCoinbaseBrowser) { | ||
this._chainIdFromOpts = chainId; | ||
@@ -220,3 +212,3 @@ this._jsonRpcUrlFromOpts = jsonRpcUrl; | ||
}); | ||
if (this._addresses.length > 0) { | ||
if (this._isAuthorized()) { | ||
return [...this._addresses]; | ||
@@ -413,3 +405,3 @@ } | ||
this._setAddresses(accounts); | ||
if (!(this.isLedger || this.isCoinbaseBrowser)) { | ||
if (!this.isCoinbaseBrowser) { | ||
await this.switchEthereumChain(this.getChainId()); | ||
@@ -454,3 +446,3 @@ } | ||
} | ||
_setAddresses(addresses, isDisconnect) { | ||
_setAddresses(addresses, _) { | ||
if (!Array.isArray(addresses)) { | ||
@@ -463,9 +455,2 @@ throw new Error('addresses is not an array'); | ||
} | ||
if (this._addresses.length > 0 && this.supportsAddressSwitching === false && !isDisconnect) { | ||
/** | ||
* The extension currently doesn't support switching selected wallet index | ||
* make sure walletlink doesn't update it's address in this case | ||
*/ | ||
return; | ||
} | ||
this._addresses = newAddresses; | ||
@@ -704,3 +689,3 @@ this.emit('accountsChanged', this._addresses); | ||
}); | ||
if (this._addresses.length > 0) { | ||
if (this._isAuthorized()) { | ||
return Promise.resolve({ | ||
@@ -727,3 +712,3 @@ jsonrpc: '2.0', | ||
this._setAddresses(res.result); | ||
if (!(this.isLedger || this.isCoinbaseBrowser)) { | ||
if (!this.isCoinbaseBrowser) { | ||
await this.switchEthereumChain(this.getChainId()); | ||
@@ -730,0 +715,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export declare const LIB_VERSION = "3.9.0-canary.2"; | ||
export declare const LIB_VERSION = "3.9.0-canary.3"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LIB_VERSION = void 0; | ||
exports.LIB_VERSION = '3.9.0-canary.2'; | ||
exports.LIB_VERSION = '3.9.0-canary.3'; |
{ | ||
"name": "@coinbase/wallet-sdk", | ||
"version": "3.9.0-canary.2", | ||
"version": "3.9.0-canary.3", | ||
"description": "Coinbase Wallet JavaScript SDK", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
422758
8550