Skip to content

Commit 36b305a

Browse files
committed
Add typescript definitions
1 parent 2a26ada commit 36b305a

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"dist/esm/*",
88
"dist/cjs/*"
99
],
10+
"types": "./types.d.ts",
1011
"devDependencies": {
1112
"rollup": "^1.12.0",
1213
"rollup-plugin-commonjs": "^10.0.0",

types.d.ts

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
export as namespace onboard
2+
3+
interface onboardApi {
4+
walletSelect: (autoSelectWallet?: string) => any
5+
walletReady: () => any
6+
config: configOptions
7+
getState: () => any
8+
}
9+
10+
interface configOptions {
11+
darkMode: boolean
12+
}
13+
14+
interface selectDefaultsOptions {
15+
heading?: string
16+
description?: string
17+
networkId: number
18+
fortmaticInit?: any
19+
portisInit?: any
20+
walletConnectInit?: any
21+
}
22+
23+
interface select {
24+
defaults: (options: selectDefaultsOptions) => any
25+
metamask: () => any
26+
dapper: () => any
27+
walletConnect: (options: { infuraKey: string }) => any
28+
coinbase: () => any
29+
trust: () => any
30+
portis: (options: { apiKey: string; network: string }) => any
31+
fortmatic: (options: { apiKey: string; network: string }) => any
32+
}
33+
34+
interface ready {
35+
defaults: (options: { networkId: number; minimumBalance: string }) => any
36+
connect: () => any
37+
network: (correctNetwork: number) => any
38+
balance: (minimumBalance: string) => any
39+
}
40+
41+
export function init(initialization: initializationObject): onboardApi
42+
43+
export namespace modules {
44+
let select: select
45+
let ready: ready
46+
}
47+
48+
interface wallet {
49+
provider: any
50+
name: string
51+
}
52+
53+
interface subscriptions {
54+
address: (address: string) => void
55+
network: (network: number) => void
56+
balance: (balance: string) => void
57+
wallet: (wallet: wallet) => void
58+
}
59+
60+
interface modulesInit {
61+
walletSelect: any
62+
walletReady: any
63+
}
64+
65+
interface initializationObject {
66+
networkId: number
67+
dappId: string
68+
subscriptions?: subscriptions
69+
modules: modulesInit
70+
}

0 commit comments

Comments
 (0)