Skip to content

Commit

Permalink
feat: replace node:events with eventemitter3 (#792)
Browse files Browse the repository at this point in the history
  • Loading branch information
grabbou authored Apr 4, 2023
1 parent de97c00 commit 615494c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion packages/eip1193/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"start": "tsc --watch"
},
"dependencies": {
"@web3-react/types": "^8.1.2-beta.0"
"@web3-react/types": "^8.1.2-beta.0",
"eventemitter3": "^4.0.7"
},
"devDependencies": {
"@ethersproject/experimental": "^5.6.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/eip1193/src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Eip1193Bridge } from '@ethersproject/experimental'
import { Web3Provider } from '@ethersproject/providers'
import { createWeb3ReactStoreAndActions } from '@web3-react/store'
import type { Actions, ProviderRpcError, RequestArguments, Web3ReactStore } from '@web3-react/types'
import { EventEmitter } from 'node:events'
import type { Actions, Web3ReactStore } from '@web3-react/types'
import { EIP1193 } from '.'
import { MockEIP1193Provider } from './mock'

Expand Down
3 changes: 1 addition & 2 deletions packages/eip1193/src/mock.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { EventEmitter } from 'node:events'

import type { ProviderRpcError, RequestArguments } from '@web3-react/types'
import { EventEmitter } from 'eventemitter3'

export class MockEIP1193Provider extends EventEmitter {
public chainId?: string
Expand Down
2 changes: 1 addition & 1 deletion packages/walletconnect/src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createWeb3ReactStoreAndActions } from '@web3-react/store'
import type { Actions, RequestArguments, Web3ReactStore } from '@web3-react/types'
import EventEmitter from 'node:events'
import EventEmitter from 'eventemitter3'
import { WalletConnect } from '.'
import { MockEIP1193Provider } from '../../eip1193/src/mock'

Expand Down
6 changes: 2 additions & 4 deletions packages/walletconnect/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import type { EventEmitter } from 'node:events'

import type WalletConnectProvider from '@walletconnect/ethereum-provider'
import type { IWCEthRpcConnectionOptions } from '@walletconnect/types'
import type { Actions, ProviderRpcError } from '@web3-react/types'
import { Connector } from '@web3-react/types'
import EventEmitter3 from 'eventemitter3'
import EventEmitter from 'eventemitter3'

import { getBestUrl } from './utils'

Expand Down Expand Up @@ -47,7 +45,7 @@ export interface ActivateOptions {
export class WalletConnect extends Connector {
/** {@inheritdoc Connector.provider} */
public provider?: MockWalletConnectProvider
public readonly events = new EventEmitter3()
public readonly events = new EventEmitter()

private readonly options: Omit<WalletConnectOptions, 'rpc'>
private readonly rpc: { [chainId: number]: string[] }
Expand Down

0 comments on commit 615494c

Please sign in to comment.