-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.ts
78 lines (60 loc) · 1.82 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React, { ReactNode, ElementType } from 'react'
import { Web3 } from '@tesseractjs/ethereum-web3'
export type ExampleName = 'showBalance' | 'sendEther' | 'showCuties' | 'getToken'
export type ExampleInfo = {
component: JSX.Element
code: string
}
export type Examples = Record<ExampleName, ExampleInfo>
export type ExampleText = {
title: string
description: string
tag: string
}
export type ExamplesText = Record<ExampleName, ExampleText>
export type NetworkType = 'main' | 'ropsten' | 'kovan' | 'rinkeby'
export type NetworkInfo = {
name: string
endpoint: string
}
export type Account = { pubKey: string; balance?: number }
export type NetworksInfo = Record<NetworkType, NetworkInfo>
export type Connections = Partial<Record<NetworkType, Web3>>
export type AppContextType = {
initialized: boolean
connections: Connections
accounts: Account[]
accountIndex?: number
activeNetwork?: NetworkType
ethUsdRate?: number
isTablet: boolean
setBalance: (accountIndex: number, balance: number) => void
setEthUsdRate: (rate: number) => void
isCodeOpened: boolean
setIsCodeOpened: (isCodeOpened: boolean) => void
}
export type HighlightProps = {
languages?: string[]
children?: ReactNode
className?: string
innerHTML?: boolean
}
export type HighlightComponent = ElementType<HighlightProps>
export type FreeTokenType = 'weenus' | 'xeenus' | 'yeenus' | 'zeenus'
export type FreeTokenInfo = {
title: string
logo: string
addresses: Record<NetworkType, string>
}
export type FreeTokens = Record<FreeTokenType, FreeTokenInfo>
export { Web3 }
export const AppContext = React.createContext<AppContextType>({
initialized: false,
connections: {},
accounts: [],
isTablet: false,
setBalance: () => {return},
setEthUsdRate: () => {return},
isCodeOpened: false,
setIsCodeOpened: () => {return}
})