mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
more typings for window.ethereum
This commit is contained in:
parent
ffb049b1c3
commit
8a5fc36436
@ -8,12 +8,36 @@ import { nodeHost, nodePort, nodeScheme } from '../config'
|
|||||||
const POLL_ACCOUNTS = 1000 // every 1s
|
const POLL_ACCOUNTS = 1000 // every 1s
|
||||||
const POLL_NETWORK = POLL_ACCOUNTS * 60 // every 1 min
|
const POLL_NETWORK = POLL_ACCOUNTS * 60 // every 1 min
|
||||||
|
|
||||||
|
// taken from
|
||||||
|
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/web3/providers.d.ts
|
||||||
|
interface JsonRPCRequest {
|
||||||
|
jsonrpc: string
|
||||||
|
method: string
|
||||||
|
params: any[]
|
||||||
|
id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
interface JsonRPCResponse {
|
||||||
|
jsonrpc: string
|
||||||
|
id: number
|
||||||
|
result?: any
|
||||||
|
error?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Callback<ResultType> {
|
||||||
|
(error: Error): void
|
||||||
|
(error: null, val: ResultType): void
|
||||||
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
web3: Web3
|
web3: Web3
|
||||||
ethereum: {
|
ethereum: {
|
||||||
enable(): void
|
enable(): void
|
||||||
send(payload: any, callback: any): any
|
send(
|
||||||
|
payload: JsonRPCRequest,
|
||||||
|
callback: Callback<JsonRPCResponse>
|
||||||
|
): any
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user