forked from DA0-DA0/dao-dao-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathchain.ts
115 lines (102 loc) · 2.89 KB
/
chain.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import { Chain } from '@chain-registry/types'
import { Coin } from './contracts'
import { ContractVersion } from './features'
import { GenericToken } from './token'
import { CodeIdConfig, PolytoneConfig } from './utils'
export type IChainContext = {
chainId: string
chain: Chain
// Chain may not have a native token.
nativeToken?: GenericToken
// If defined, this is a configured chain, which means it is supported (DAO
// DAO is deployed on it) or it has a governance interface.
base?: BaseChainConfig
// If defined, this is a supported chain, which means DAO DAO is deployed.
config?: SupportedChainConfig
}
// Require base chain config.
export type ConfiguredChainContext = Omit<IChainContext, 'base' | 'config'> & {
config: BaseChainConfig
}
// Require supported chain config.
export type SupportedChainContext = Omit<ConfiguredChainContext, 'config'> & {
config: SupportedChainConfig
}
export interface Validator {
address: string
moniker: string
website: string
details: string
commission: number
status: string
tokens: number
}
export interface Delegation {
validator: Validator
delegated: Coin
pendingReward: Coin
}
export interface UnbondingDelegation {
validator: Validator
balance: Coin
startedAtHeight: number
finishesAt: Date
}
export interface NativeDelegationInfo {
delegations: Delegation[]
unbondingDelegations: UnbondingDelegation[]
}
export enum ChainId {
CosmosHubMainnet = 'cosmoshub-4',
CosmosHubTestnet = 'theta-testnet-001',
JunoMainnet = 'juno-1',
JunoTestnet = 'uni-6',
OsmosisMainnet = 'osmosis-1',
OsmosisTestnet = 'osmo-test-5',
StargazeMainnet = 'stargaze-1',
StargazeTestnet = 'elgafar-1',
NeutronMainnet = 'neutron-1',
TerraMainnet = 'phoenix-1',
MigalooMainnet = 'migaloo-1',
QuasarTestnet = 'quasar-test-1',
QuasarMainnet = 'quasar-1',
}
export type BaseChainConfig = {
chainId: string
// Unique name among chain configs with the same `mainnet` flag. This is used
// to identify the chain in the native governance UI.
name: string
mainnet: boolean
accentColor: string
// Set to true if the chain does not support CosmWasm. If undefined, assumed
// to be false.
noCosmWasm?: boolean
explorerUrlTemplates: {
tx: string
gov: string
govProp: string
wallet: string
}
}
export type ConfiguredChain = BaseChainConfig & {
chain: Chain
}
export type SupportedChainConfig = BaseChainConfig & {
factoryContractAddress: string
// If defined, it means Kado supports fiat deposit on this chain.
kado?: {
network: string
}
indexes: {
search: string
featured: string
}
codeIds: CodeIdConfig
// Store code IDs for past versions of contracts, in case DAOs need a
// particular version of a contract.
historicalCodeIds?: Partial<Record<ContractVersion, Partial<CodeIdConfig>>>
polytone?: PolytoneConfig
}
export type SupportedChain = SupportedChainConfig & {
chain: Chain
}