@0xsequence/provider 0.36.7 → 0.36.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2692,7 +2692,7 @@ class WindowMessageProvider extends BaseProviderTransport {
2692
2692
  if (!isBrowserExtension()) {
2693
2693
  intent.options.origin = window.location.origin;
2694
2694
  }
2695
- } // encode intent as base6 url-encoded param
2695
+ } // encode intent as base64 url-encoded param
2696
2696
 
2697
2697
 
2698
2698
  windowSessionParams.set('intent', utils.base64EncodeObject(intent));
@@ -2963,7 +2963,7 @@ class ExtensionMessageHandler extends BaseWalletTransport {
2963
2963
  }
2964
2964
 
2965
2965
  sendMessage(message) {
2966
- console.log('[ExtensionMessageHandler send]', message);
2966
+ utils.logger.info('[ExtensionMessageHandler send]', message);
2967
2967
  this.port.postMessage(message);
2968
2968
  }
2969
2969
 
@@ -3019,7 +3019,7 @@ class BaseInjectedTransport extends eventemitter2.EventEmitter2 {
3019
3019
  return;
3020
3020
  }
3021
3021
 
3022
- console.log('[received message]', message);
3022
+ utils.logger.info('[received message]', message);
3023
3023
  const requestIdx = message.idx;
3024
3024
  const responseCallback = this.responseCallbacks.get(requestIdx);
3025
3025
 
@@ -2692,7 +2692,7 @@ class WindowMessageProvider extends BaseProviderTransport {
2692
2692
  if (!isBrowserExtension()) {
2693
2693
  intent.options.origin = window.location.origin;
2694
2694
  }
2695
- } // encode intent as base6 url-encoded param
2695
+ } // encode intent as base64 url-encoded param
2696
2696
 
2697
2697
 
2698
2698
  windowSessionParams.set('intent', utils.base64EncodeObject(intent));
@@ -2963,7 +2963,7 @@ class ExtensionMessageHandler extends BaseWalletTransport {
2963
2963
  }
2964
2964
 
2965
2965
  sendMessage(message) {
2966
- console.log('[ExtensionMessageHandler send]', message);
2966
+ utils.logger.info('[ExtensionMessageHandler send]', message);
2967
2967
  this.port.postMessage(message);
2968
2968
  }
2969
2969
 
@@ -3019,7 +3019,7 @@ class BaseInjectedTransport extends eventemitter2.EventEmitter2 {
3019
3019
  return;
3020
3020
  }
3021
3021
 
3022
- console.log('[received message]', message);
3022
+ utils.logger.info('[received message]', message);
3023
3023
  const requestIdx = message.idx;
3024
3024
  const responseCallback = this.responseCallbacks.get(requestIdx);
3025
3025
 
@@ -2688,7 +2688,7 @@ class WindowMessageProvider extends BaseProviderTransport {
2688
2688
  if (!isBrowserExtension()) {
2689
2689
  intent.options.origin = window.location.origin;
2690
2690
  }
2691
- } // encode intent as base6 url-encoded param
2691
+ } // encode intent as base64 url-encoded param
2692
2692
 
2693
2693
 
2694
2694
  windowSessionParams.set('intent', base64EncodeObject(intent));
@@ -2959,7 +2959,7 @@ class ExtensionMessageHandler extends BaseWalletTransport {
2959
2959
  }
2960
2960
 
2961
2961
  sendMessage(message) {
2962
- console.log('[ExtensionMessageHandler send]', message);
2962
+ logger.info('[ExtensionMessageHandler send]', message);
2963
2963
  this.port.postMessage(message);
2964
2964
  }
2965
2965
 
@@ -3015,7 +3015,7 @@ class BaseInjectedTransport extends EventEmitter2 {
3015
3015
  return;
3016
3016
  }
3017
3017
 
3018
- console.log('[received message]', message);
3018
+ logger.info('[received message]', message);
3019
3019
  const requestIdx = message.idx;
3020
3020
  const responseCallback = this.responseCallbacks.get(requestIdx);
3021
3021
 
@@ -78,22 +78,22 @@ export declare enum EventType {
78
78
  DEBUG = "_debug"
79
79
  }
80
80
  export interface WalletEventTypes {
81
- 'open': (openInfo: {
81
+ open: (openInfo: {
82
82
  chainId?: string;
83
83
  sessionId?: string;
84
84
  session?: WalletSession;
85
85
  error?: string;
86
86
  }) => void;
87
- 'close': (error?: ProviderRpcError) => void;
88
- 'connect': (connectDetails: ConnectDetails) => void;
89
- 'disconnect': (error?: ProviderRpcError) => void;
90
- 'accountsChanged': (accounts: string[]) => void;
91
- 'chainChanged': (chainIdHex: string) => void;
92
- 'networks': (networks: NetworkConfig[]) => void;
93
- 'walletContext': (walletContext: WalletContext) => void;
87
+ close: (error?: ProviderRpcError) => void;
88
+ connect: (connectDetails: ConnectDetails) => void;
89
+ disconnect: (error?: ProviderRpcError) => void;
90
+ accountsChanged: (accounts: string[]) => void;
91
+ chainChanged: (chainIdHex: string) => void;
92
+ networks: (networks: NetworkConfig[]) => void;
93
+ walletContext: (walletContext: WalletContext) => void;
94
94
  }
95
95
  export interface ProviderEventTypes extends WalletEventTypes {
96
- 'message': (message: ProviderMessageResponse) => void;
96
+ message: (message: ProviderMessageResponse) => void;
97
97
  }
98
98
  export declare enum OpenState {
99
99
  CLOSED = 0,
@@ -106,15 +106,66 @@ export declare enum InitState {
106
106
  OK = 2
107
107
  }
108
108
  export interface ConnectOptions {
109
+ /** Specifies the default network a dapp would like to connect to. This field
110
+ * is optional as it can be provided a number of different ways. */
109
111
  networkId?: string | number;
112
+ /** app name of the dapp which will be announced to user on connect screen */
110
113
  app?: string;
114
+ /** origin hint of the dapp's host opening the wallet. This value will automatically
115
+ * be determined and verified for integrity, and can be omitted. */
111
116
  origin?: string;
117
+ /** expiry number (in seconds) to expire connect session. default is 1 week of seconds. */
112
118
  expiry?: number;
119
+ /** authorize will perform an ETHAuth eip712 signing and return the proof to the dapp. */
113
120
  authorize?: boolean;
121
+ /** *Currently not used* askForEmail will prompt to give permission to the dapp to access email address */
114
122
  askForEmail?: boolean;
123
+ /** refresh flag will force a full re-connect (ie. disconnect then connect again) */
115
124
  refresh?: boolean;
125
+ /** keepWalletOpened will keep the wallet window opened after connecting. The default
126
+ * is to automatically close the wallet after connecting. */
116
127
  keepWalletOpened?: boolean;
117
- }
128
+ /** Options to further customize the wallet experience. */
129
+ settings?: Settings;
130
+ }
131
+ /** Options to further customize the wallet experience. */
132
+ export interface Settings {
133
+ /** Specify a wallet theme. `light` and `dark` are the main themes, to use other available
134
+ * themes, you can use the camel case version of the theme names in the wallet settings.
135
+ * For example: "Blue Dark" on wallet UI can be passed as "blueDark".
136
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
137
+ * to set when you open the wallet for user. */
138
+ theme?: ThemeOption;
139
+ /** Specify a banner image. This image, if provided, will be displayed on the wallet during
140
+ * the connect/authorize process */
141
+ bannerUrl?: string;
142
+ /** Specify payment providers to use. If not specified,
143
+ * all available payment providers will be enabled.
144
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
145
+ * to set when you open the wallet for user. */
146
+ includedPaymentProviders?: PaymentProviderOption[];
147
+ /** Specify a default currency to use with payment providers.
148
+ * If not specified, the default is USDC.
149
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
150
+ * to set when you open the wallet for user. */
151
+ defaultFundingCurrency?: CurrencyOption;
152
+ /** If true, lockFundingCurrencyToDefault disables picking any currency provided by payment
153
+ * providers other than the defaultFundingCurrency.
154
+ * If false, it allows picking any currency provided by payment providers.
155
+ * The default is true.
156
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
157
+ * to set when you open the wallet for user. */
158
+ lockFundingCurrencyToDefault?: boolean;
159
+ /** Specify auxiliary data
160
+ */
161
+ aux?: any;
162
+ }
163
+ /** light and dark are the main themes, to use other themes in wallet settings,
164
+ * you can use the camel case version of the name in the wallet settings.
165
+ * For example: "Blue Dark" on wallet UI can be passed as "blueDark" */
166
+ export declare type ThemeOption = 'light' | 'dark' | string;
167
+ export declare type PaymentProviderOption = 'moonpay' | 'wyre' | 'ramp';
168
+ export declare type CurrencyOption = 'usdc' | 'eth' | 'matic';
118
169
  export interface ConnectDetails {
119
170
  chainId?: string;
120
171
  error?: string;
@@ -127,6 +178,9 @@ export declare type PromptConnectDetails = Pick<ConnectDetails, 'chainId' | 'err
127
178
  export declare type OpenWalletIntent = {
128
179
  type: 'connect';
129
180
  options?: ConnectOptions;
181
+ } | {
182
+ type: 'openWithOptions';
183
+ options?: ConnectOptions;
130
184
  } | {
131
185
  type: 'jsonRpcRequest';
132
186
  method: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/provider",
3
- "version": "0.36.7",
3
+ "version": "0.36.10",
4
4
  "description": "provider sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/provider",
6
6
  "source": "src/index.ts",
@@ -13,13 +13,13 @@
13
13
  "typecheck": "tsc --noEmit"
14
14
  },
15
15
  "dependencies": {
16
- "@0xsequence/abi": "^0.36.7",
17
- "@0xsequence/auth": "^0.36.7",
18
- "@0xsequence/config": "^0.36.7",
19
- "@0xsequence/network": "^0.36.7",
20
- "@0xsequence/transactions": "^0.36.7",
21
- "@0xsequence/utils": "^0.36.7",
22
- "@0xsequence/wallet": "^0.36.7",
16
+ "@0xsequence/abi": "^0.36.10",
17
+ "@0xsequence/auth": "^0.36.10",
18
+ "@0xsequence/config": "^0.36.10",
19
+ "@0xsequence/network": "^0.36.10",
20
+ "@0xsequence/transactions": "^0.36.10",
21
+ "@0xsequence/utils": "^0.36.10",
22
+ "@0xsequence/wallet": "^0.36.10",
23
23
  "@ethersproject/abstract-signer": "^5.5.0",
24
24
  "@ethersproject/hash": "^5.5.0",
25
25
  "@ethersproject/providers": "^5.5.1",
@@ -1,4 +1,5 @@
1
1
  import { JsonRpcRequest, JsonRpcResponse } from '@0xsequence/network'
2
+ import { logger } from '@0xsequence/utils'
2
3
  import { EventEmitter2 as EventEmitter } from 'eventemitter2'
3
4
  import {
4
5
  ProviderMessageResponseCallback,
@@ -32,7 +33,7 @@ export abstract class BaseInjectedTransport extends EventEmitter {
32
33
  return
33
34
  }
34
35
 
35
- console.log('[received message]', message)
36
+ logger.info('[received message]', message)
36
37
 
37
38
  const requestIdx = message.idx
38
39
  const responseCallback = this.responseCallbacks.get(requestIdx)
@@ -2,6 +2,7 @@ import { WalletRequestHandler } from '../wallet-request-handler'
2
2
  import { BaseWalletTransport } from '../base-wallet-transport'
3
3
  import { InitState, ProviderMessage } from '../../types'
4
4
  import { Runtime } from 'webextension-polyfill-ts'
5
+ import { logger } from '@0xsequence/utils'
5
6
 
6
7
  export const CHANNEL_ID = 'sequence-extension-message-handler'
7
8
 
@@ -19,7 +20,7 @@ export class ExtensionMessageHandler extends BaseWalletTransport {
19
20
  }
20
21
 
21
22
  sendMessage(message: ProviderMessage<any>) {
22
- console.log('[ExtensionMessageHandler send]', message)
23
+ logger.info('[ExtensionMessageHandler send]', message)
23
24
  this.port.postMessage(message)
24
25
  }
25
26
  }
@@ -82,7 +82,7 @@ export class WindowMessageProvider extends BaseProviderTransport {
82
82
  this._init = InitState.NIL
83
83
  this._sessionId = `${performance.now()}`
84
84
  windowSessionParams.set('sid', this._sessionId)
85
-
85
+
86
86
  if (intent) {
87
87
  // for the window-transport, we eagerly/optimistically set the origin host
88
88
  // when connecting to the wallet, however, this will be verified and enforced
@@ -96,7 +96,7 @@ export class WindowMessageProvider extends BaseProviderTransport {
96
96
  intent.options.origin = window.location.origin
97
97
  }
98
98
  }
99
- // encode intent as base6 url-encoded param
99
+ // encode intent as base64 url-encoded param
100
100
  windowSessionParams.set('intent', base64EncodeObject(intent))
101
101
  }
102
102
  if (networkId) {
@@ -109,16 +109,13 @@ export class WindowMessageProvider extends BaseProviderTransport {
109
109
 
110
110
  if (isBrowserExtension()) {
111
111
  windowSize = [450, 750]
112
- windowPos = [
113
- Math.abs(window.screen.width / 2 - windowSize[0] / 2),
114
- Math.abs(window.screen.height / 2 - windowSize[1] / 2)
115
- ]
112
+ windowPos = [Math.abs(window.screen.width / 2 - windowSize[0] / 2), Math.abs(window.screen.height / 2 - windowSize[1] / 2)]
116
113
  } else {
117
114
  windowSize = [450, 750]
118
115
  windowPos = [
119
116
  Math.abs(window.screenX + window.innerWidth / 2 - windowSize[0] / 2),
120
117
  Math.abs(window.screenY + window.innerHeight / 2 - windowSize[1] / 2)
121
- ]
118
+ ]
122
119
  }
123
120
 
124
121
  const windowFeatures =
package/src/types.ts CHANGED
@@ -23,7 +23,7 @@ export interface WalletTransport extends JsonRpcHandler, ProviderMessageTranspor
23
23
  register(): void
24
24
  unregister(): void
25
25
 
26
- notifyOpen(openInfo: { chainId?: string, sessionId?: string, session?: WalletSession, error?: string }): void
26
+ notifyOpen(openInfo: { chainId?: string; sessionId?: string; session?: WalletSession; error?: string }): void
27
27
  notifyClose(error?: ProviderRpcError): void
28
28
 
29
29
  notifyConnect(connectDetails: ConnectDetails): void
@@ -33,10 +33,10 @@ export interface WalletTransport extends JsonRpcHandler, ProviderMessageTranspor
33
33
  }
34
34
 
35
35
  export interface ProviderMessage<T> {
36
- idx: number // message id number
37
- type: string // message type
38
- data: T // the ethereum json-rpc payload
39
- chainId?: number // chain id which the message is intended
36
+ idx: number // message id number
37
+ type: string // message type
38
+ data: T // the ethereum json-rpc payload
39
+ chainId?: number // chain id which the message is intended
40
40
  }
41
41
 
42
42
  export type ProviderMessageRequest = ProviderMessage<JsonRpcRequest>
@@ -83,8 +83,8 @@ export class WindowSessionParams extends URLSearchParams {
83
83
 
84
84
  export interface TransportSession {
85
85
  sessionId?: string | null
86
- networkId?: string | number | null,
87
- intent?: OpenWalletIntent,
86
+ networkId?: string | number | null
87
+ intent?: OpenWalletIntent
88
88
  }
89
89
 
90
90
  export enum EventType {
@@ -105,21 +105,21 @@ export enum EventType {
105
105
  }
106
106
 
107
107
  export interface WalletEventTypes {
108
- 'open': (openInfo: { chainId?: string, sessionId?: string, session?: WalletSession, error?: string }) => void
109
- 'close': (error?: ProviderRpcError) => void
108
+ open: (openInfo: { chainId?: string; sessionId?: string; session?: WalletSession; error?: string }) => void
109
+ close: (error?: ProviderRpcError) => void
110
110
 
111
- 'connect': (connectDetails: ConnectDetails) => void
112
- 'disconnect': (error?: ProviderRpcError) => void
111
+ connect: (connectDetails: ConnectDetails) => void
112
+ disconnect: (error?: ProviderRpcError) => void
113
113
 
114
- 'accountsChanged': (accounts: string[]) => void
115
- 'chainChanged': (chainIdHex: string) => void
114
+ accountsChanged: (accounts: string[]) => void
115
+ chainChanged: (chainIdHex: string) => void
116
116
 
117
- 'networks': (networks: NetworkConfig[]) => void
118
- 'walletContext': (walletContext: WalletContext) => void
117
+ networks: (networks: NetworkConfig[]) => void
118
+ walletContext: (walletContext: WalletContext) => void
119
119
  }
120
120
 
121
121
  export interface ProviderEventTypes extends WalletEventTypes {
122
- 'message': (message: ProviderMessageResponse) => void
122
+ message: (message: ProviderMessageResponse) => void
123
123
  }
124
124
 
125
125
  export enum OpenState {
@@ -135,35 +135,83 @@ export enum InitState {
135
135
  }
136
136
 
137
137
  export interface ConnectOptions {
138
- // networkId specifics the default network a dapp would like to connect to. This field
139
- // is optional as it can be provided a number of different ways.
138
+ /** Specifies the default network a dapp would like to connect to. This field
139
+ * is optional as it can be provided a number of different ways. */
140
140
  networkId?: string | number
141
141
 
142
- // app name of the dapp which will be announced to user on connect screen
142
+ /** app name of the dapp which will be announced to user on connect screen */
143
143
  app?: string
144
144
 
145
- // origin hint of the dapp's host opening the wallet. This value will automatically
146
- // be determined and verified for integrity, and can be omitted.
145
+ /** origin hint of the dapp's host opening the wallet. This value will automatically
146
+ * be determined and verified for integrity, and can be omitted. */
147
147
  origin?: string
148
148
 
149
- // expiry number (in seconds) to expire connect session. default is 1 week of seconds.
149
+ /** expiry number (in seconds) to expire connect session. default is 1 week of seconds. */
150
150
  expiry?: number
151
151
 
152
- // authorize will perform an ETHAuth eip712 signing and return the proof to the dapp.
152
+ /** authorize will perform an ETHAuth eip712 signing and return the proof to the dapp. */
153
153
  authorize?: boolean
154
154
 
155
- // askForEmail will prompt to give permission to the dapp to access email address
155
+ /** *Currently not used* askForEmail will prompt to give permission to the dapp to access email address */
156
156
  // TODO: this feature is currently not used as the wallet does not report emails yet
157
157
  askForEmail?: boolean
158
158
 
159
- // refresh flag will force a full re-connect (ie. disconnect then connect again)
159
+ /** refresh flag will force a full re-connect (ie. disconnect then connect again) */
160
160
  refresh?: boolean
161
161
 
162
- // keepWalletOpened will keep the wallet window opened after connecting. The default
163
- // is to automatically close the wallet after connecting.
162
+ /** keepWalletOpened will keep the wallet window opened after connecting. The default
163
+ * is to automatically close the wallet after connecting. */
164
164
  keepWalletOpened?: boolean
165
+
166
+ /** Options to further customize the wallet experience. */
167
+ settings?: Settings
168
+ }
169
+
170
+ /** Options to further customize the wallet experience. */
171
+ export interface Settings {
172
+ /** Specify a wallet theme. `light` and `dark` are the main themes, to use other available
173
+ * themes, you can use the camel case version of the theme names in the wallet settings.
174
+ * For example: "Blue Dark" on wallet UI can be passed as "blueDark".
175
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
176
+ * to set when you open the wallet for user. */
177
+ theme?: ThemeOption
178
+
179
+ /** Specify a banner image. This image, if provided, will be displayed on the wallet during
180
+ * the connect/authorize process */
181
+ bannerUrl?: string
182
+
183
+ /** Specify payment providers to use. If not specified,
184
+ * all available payment providers will be enabled.
185
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
186
+ * to set when you open the wallet for user. */
187
+ includedPaymentProviders?: PaymentProviderOption[]
188
+
189
+ /** Specify a default currency to use with payment providers.
190
+ * If not specified, the default is USDC.
191
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
192
+ * to set when you open the wallet for user. */
193
+ defaultFundingCurrency?: CurrencyOption
194
+
195
+ /** If true, lockFundingCurrencyToDefault disables picking any currency provided by payment
196
+ * providers other than the defaultFundingCurrency.
197
+ * If false, it allows picking any currency provided by payment providers.
198
+ * The default is true.
199
+ * Note that this setting will not be persisted, use wallet.open with 'openWithOptions' intent
200
+ * to set when you open the wallet for user. */
201
+ lockFundingCurrencyToDefault?: boolean
202
+
203
+ /** Specify auxiliary data
204
+ */
205
+ aux?: any
165
206
  }
166
207
 
208
+ /** light and dark are the main themes, to use other themes in wallet settings,
209
+ * you can use the camel case version of the name in the wallet settings.
210
+ * For example: "Blue Dark" on wallet UI can be passed as "blueDark" */
211
+ export type ThemeOption = 'light' | 'dark' | string
212
+ export type PaymentProviderOption = 'moonpay' | 'wyre' | 'ramp'
213
+ export type CurrencyOption = 'usdc' | 'eth' | 'matic'
214
+
167
215
  export interface ConnectDetails {
168
216
  // chainId (in hex) and error are defined by EIP-1193 expected fields
169
217
  chainId?: string
@@ -187,8 +235,9 @@ export interface ConnectDetails {
187
235
  export type PromptConnectDetails = Pick<ConnectDetails, 'chainId' | 'error' | 'connected' | 'proof' | 'email'>
188
236
 
189
237
  export type OpenWalletIntent =
190
- { type: 'connect'; options?: ConnectOptions } |
191
- { type: 'jsonRpcRequest'; method: string }
238
+ | { type: 'connect'; options?: ConnectOptions }
239
+ | { type: 'openWithOptions'; options?: ConnectOptions }
240
+ | { type: 'jsonRpcRequest'; method: string }
192
241
 
193
242
  export interface MessageToSign {
194
243
  message?: string
@@ -230,23 +279,21 @@ export const ErrSignedInRequired = new ProviderError('Wallet is not signed in. C
230
279
 
231
280
  // TODO: lets build some nice error handling tools, prob in /utils ...
232
281
 
233
- export interface TypedEventEmitter<Events>{
234
- addListener<E extends keyof Events> (event: E, listener: Events[E]): this
235
- on<E extends keyof Events> (event: E, listener: Events[E]): this
236
- once<E extends keyof Events> (event: E, listener: Events[E]): this
237
- prependListener<E extends keyof Events> (event: E, listener: Events[E]): this
238
- prependOnceListener<E extends keyof Events> (event: E, listener: Events[E]): this
282
+ export interface TypedEventEmitter<Events> {
283
+ addListener<E extends keyof Events>(event: E, listener: Events[E]): this
284
+ on<E extends keyof Events>(event: E, listener: Events[E]): this
285
+ once<E extends keyof Events>(event: E, listener: Events[E]): this
286
+ prependListener<E extends keyof Events>(event: E, listener: Events[E]): this
287
+ prependOnceListener<E extends keyof Events>(event: E, listener: Events[E]): this
239
288
 
240
289
  off<E extends keyof Events>(event: E, listener: Events[E]): this
241
- removeAllListeners<E extends keyof Events> (event?: E): this
242
- removeListener<E extends keyof Events> (event: E, listener: Events[E]): this
290
+ removeAllListeners<E extends keyof Events>(event?: E): this
291
+ removeListener<E extends keyof Events>(event: E, listener: Events[E]): this
243
292
 
244
- emit<E extends keyof Events> (event: E, ...args: Arguments<Events[E]>): boolean
245
- eventNames (): (keyof Events | string | symbol)[]
246
- listeners<E extends keyof Events> (event: E): Function[]
247
- listenerCount<E extends keyof Events> (event: E): number
293
+ emit<E extends keyof Events>(event: E, ...args: Arguments<Events[E]>): boolean
294
+ eventNames(): (keyof Events | string | symbol)[]
295
+ listeners<E extends keyof Events>(event: E): Function[]
296
+ listenerCount<E extends keyof Events>(event: E): number
248
297
  }
249
298
 
250
- type Arguments<T> = [T] extends [(...args: infer U) => any]
251
- ? U
252
- : [T] extends [void] ? [] : [T]
299
+ type Arguments<T> = [T] extends [(...args: infer U) => any] ? U : [T] extends [void] ? [] : [T]