Skip to content

Commit

Permalink
feat: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
abretonc7s committed Oct 8, 2024
1 parent 226aa91 commit b88db8e
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions packages/connectors/src/metaMask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export function metaMask(parameters: MetaMaskParameters = {}) {
let sdk: MetaMaskSDK
let provider: Provider | undefined
let providerPromise: Promise<typeof provider>
let cachedDisplayUri: string | undefined

let accountsChanged: Connector['onAccountsChanged'] | undefined
let chainChanged: Connector['onChainChanged'] | undefined
Expand Down Expand Up @@ -97,10 +96,6 @@ export function metaMask(parameters: MetaMaskParameters = {}) {
let signResponse: string | undefined
let connectWithResponse: unknown | undefined
if (!accounts?.length) {
if (cachedDisplayUri) {
provider.emit('display_uri', cachedDisplayUri)
}

let requestedAccounts: `0x${string}`[]
if (parameters.connectAndSign) {
signResponse = await sdk.connectAndSign({
Expand Down Expand Up @@ -430,9 +425,6 @@ export function metaMask(parameters: MetaMaskParameters = {}) {

config.emitter.emit('disconnect')

// Remove cached display URI
cachedDisplayUri = undefined

// Manage EIP-1193 event listeners
if (!accountsChanged) {
accountsChanged = this.onAccountsChanged.bind(this)
Expand All @@ -452,13 +444,7 @@ export function metaMask(parameters: MetaMaskParameters = {}) {
}
},
onDisplayUri(uri) {
// Cache display uri
cachedDisplayUri = uri

config.emitter.emit('message', {
type: 'display_uri',
data: uri,
})
config.emitter.emit('message', { type: 'display_uri', data: uri })
},
}))
}

0 comments on commit b88db8e

Please sign in to comment.