forked from Chia-Network/chia-blockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wallet_types.py
65 lines (49 loc) · 1.25 KB
/
wallet_types.py
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
from __future__ import annotations
from dataclasses import dataclass
from enum import IntEnum
from typing import TYPE_CHECKING, TypeVar
from chik.util.ints import uint8, uint32
from chik.util.streamable import Streamable, streamable
if TYPE_CHECKING:
from chik.wallet.wallet_protocol import WalletProtocol
class WalletType(IntEnum):
# Wallet Types
STANDARD_WALLET = 0
ATOMIC_SWAP = 2
AUTHORIZED_PAYEE = 3
MULTI_SIG = 4
CUSTODY = 5
CAT = 6
RECOVERABLE = 7
DECENTRALIZED_ID = 8
POOLING_WALLET = 9
NFT = 10
DATA_LAYER = 11
DATA_LAYER_OFFER = 12
VC = 13
DAO = 14
DAO_CAT = 15
CRCAT = 57
class CoinType(IntEnum):
NORMAL = 0
CLAWBACK = 1
CRCAT_PENDING = 2
CRCAT = 3
class RemarkDataType(IntEnum):
NORMAL = 0
CUSTODY = 1
CLAWBACK = 2
T = TypeVar("T", contravariant=True)
@dataclass(frozen=True)
class WalletIdentifier:
id: uint32
type: WalletType
@classmethod
def create(cls, wallet: WalletProtocol[T]) -> WalletIdentifier:
return cls(wallet.id(), wallet.type())
# TODO, Can be replaced with WalletIdentifier if we have streamable enums
@streamable
@dataclass(frozen=True)
class StreamableWalletIdentifier(Streamable):
id: uint32
type: uint8