@web3-react/types
Advanced tools
Comparing version 8.0.4-alpha.0 to 8.0.4-beta.0
/// <reference types="node" /> | ||
import type { EventEmitter } from 'node:events'; | ||
import type { State, StoreApi } from 'zustand/vanilla'; | ||
import type { EventEmitter } from 'node:events'; | ||
export interface Web3ReactState extends State { | ||
@@ -11,6 +11,16 @@ chainId: number | undefined; | ||
export declare type Web3ReactStore = StoreApi<Web3ReactState>; | ||
export declare type Web3ReactStateUpdate = { | ||
chainId: number; | ||
accounts: string[]; | ||
} | { | ||
chainId: number; | ||
accounts?: never; | ||
} | { | ||
chainId?: never; | ||
accounts: string[]; | ||
}; | ||
export interface Actions { | ||
startActivation: () => void; | ||
update: (state: Partial<Pick<Web3ReactState, 'chainId' | 'accounts'>>) => void; | ||
reportError: (error: Error) => void; | ||
startActivation: () => () => void; | ||
update: (stateUpdate: Web3ReactStateUpdate) => void; | ||
reportError: (error: Error | undefined) => void; | ||
} | ||
@@ -24,8 +34,45 @@ export interface RequestArguments { | ||
} | ||
export interface ProviderConnectInfo { | ||
readonly chainId: string; | ||
} | ||
export interface ProviderRpcError extends Error { | ||
message: string; | ||
code: number; | ||
data?: unknown; | ||
} | ||
export interface AddEthereumChainParameter { | ||
chainId: number; | ||
chainName: string; | ||
nativeCurrency: { | ||
name: string; | ||
symbol: string; | ||
decimals: 18; | ||
}; | ||
rpcUrls: string[]; | ||
blockExplorerUrls?: string[]; | ||
iconUrls?: string[]; | ||
} | ||
export declare abstract class Connector { | ||
/** | ||
* An | ||
* EIP-1193 ({@link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md}) and | ||
* EIP-1102 ({@link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1102.md}) compliant provider. | ||
* May also comply with EIP-3085 ({@link https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3085.md}). | ||
* This property must be defined while the connector is active. | ||
*/ | ||
provider: Provider | undefined; | ||
protected readonly actions: Actions; | ||
provider: Provider | undefined; | ||
deactivate?(): Promise<void>; | ||
/** | ||
* @param actions - Methods bound to a zustand store that tracks the state of the connector. | ||
* Actions are used by the connector to report changes in connection status. | ||
*/ | ||
constructor(actions: Actions); | ||
abstract activate(): Promise<void>; | ||
/** | ||
* Initiate a connection. | ||
*/ | ||
abstract activate(...args: unknown[]): Promise<void> | void; | ||
/** | ||
* Initiate a disconnect. | ||
*/ | ||
deactivate(...args: unknown[]): Promise<void> | void; | ||
} |
export class Connector { | ||
/** | ||
* @param actions - Methods bound to a zustand store that tracks the state of the connector. | ||
* Actions are used by the connector to report changes in connection status. | ||
*/ | ||
constructor(actions) { | ||
this.actions = actions; | ||
} | ||
/** | ||
* Initiate a disconnect. | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
deactivate(...args) { | ||
this.actions.reportError(undefined); | ||
} | ||
} |
{ | ||
"name": "@web3-react/types", | ||
"keywords": [ | ||
"web3-react" | ||
], | ||
"author": "Noah Zinsmeister <noahwz@gmail.com>", | ||
"license": "GPL-3.0-or-later", | ||
"repository": "github:NoahZinsmeister/web3-react", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"version": "8.0.4-alpha.0", | ||
"version": "8.0.4-beta.0", | ||
"type": "module", | ||
"exports": "./dist/index.js", | ||
"files": [ | ||
"dist/*" | ||
], | ||
"exports": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js", | ||
"require": "./dist/cjs/index.js" | ||
}, | ||
"types": "./dist/index.d.ts", | ||
"module": "./dist/index.js", | ||
"main": "./dist/cjs/index.js", | ||
"scripts": { | ||
"prebuild": "rm -rf dist", | ||
"build": "tsc", | ||
"build": "tsc && tsc --project tsconfig.cjs.json && find ./dist/cjs/ -depth -name \"*.js\" -exec sh -c 'mv \"$1\" \"${1%.js}.cjs\"' _ {} \\;", | ||
"start": "tsc --watch" | ||
}, | ||
"peerDependencies": { | ||
"zustand": "^3.5.10" | ||
"dependencies": { | ||
"zustand": "^4.0.0-beta.0" | ||
}, | ||
"gitHead": "002652f883ab79f86c47c4336e7ef165cd39838d" | ||
"gitHead": "aba55673f396cf8163e7265b9a5bc4c118f2a353" | ||
} |
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
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
39532
112
1
0
2
3
1
+ Addedzustand@^4.0.0-beta.0
+ Addedjs-tokens@4.0.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addedreact@18.3.1(transitive)
+ Addeduse-sync-external-store@1.2.2(transitive)
+ Addedzustand@4.5.5(transitive)
- Removedzustand@3.7.2(transitive)