1
0
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:
Matthias Kretschmann 2019-04-23 13:13:10 +02:00
parent ffb049b1c3
commit 8a5fc36436
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -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
} }
} }
} }