-
Notifications
You must be signed in to change notification settings - Fork 22
/
account.ts
103 lines (90 loc) · 2.08 KB
/
account.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
import { ComponentType } from 'react'
import { ActionKeyAndData } from './actions'
import { Threshold } from './contracts/DaoProposalSingle.common'
/**
* The type of account given whatever the relevant context is.
*/
export enum AccountType {
/**
* Wallet/smart contract/module address on the current chain given the
* context.
*/
Native = 'native',
/**
* A Polytone account controlled by an account on another chain.
*/
Polytone = 'polytone',
/**
* An ICA controlled by an account on another chain.
*/
Ica = 'ica',
}
export type NativeAccountTypeConfig = {
type: AccountType.Native
config?: undefined
}
export type PolytoneAccountTypeConfig = {
type: AccountType.Polytone
config?: undefined
}
export type IcaAccountTypeConfig = {
type: AccountType.Ica
config?: undefined
}
export type BaseAccount = {
chainId: string
address: string
}
export type NativeAccount = BaseAccount & NativeAccountTypeConfig
export type PolytoneAccount = BaseAccount & PolytoneAccountTypeConfig
export type IcaAccount = BaseAccount & IcaAccountTypeConfig
export type Account = NativeAccount | PolytoneAccount | IcaAccount
/**
* Unique identifier for account tabs, which is used in the URL path.
*/
export enum AccountTabId {
Wallet = 'wallet',
Daos = 'daos',
Actions = 'actions',
}
export type AccountTab = {
id: AccountTabId
label: string
Icon: ComponentType<{ className: string }>
Component: ComponentType
}
export type AccountTxForm = {
actions: ActionKeyAndData[]
}
export type AccountTxSave = AccountTxForm & {
name: string
description?: string
}
/**
* The details that describe a multisig membership and threshold.
*/
export type MultisigDetails = {
/**
* The multisig's chain ID.
*/
chainId: string
/**
* The multisig's address.
*/
address: string
/**
* The members of the multisig.
*/
members: {
address: string
weight: number
}[]
/**
* The threshold of members that must sign a transaction for it to be valid.
*/
threshold: Threshold
/**
* The sum of all members' weights.
*/
totalWeight: number
}