-
Notifications
You must be signed in to change notification settings - Fork 505
Expand file tree
/
Copy pathc_validator.py
More file actions
64 lines (56 loc) · 1.84 KB
/
c_validator.py
File metadata and controls
64 lines (56 loc) · 1.84 KB
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
# Example script to register a validator
# See https://github.com/hyperliquid-dex/node?tab=readme-ov-file#join-network for spec
#
# IMPORTANT: Replace any arguments for the exchange calls below to match your deployment requirements.
import example_utils
from hyperliquid.utils import constants
# Change to one of "Register", "ChangeProfile", or "Unregister"
ACTION = ""
DUMMY_SIGNER = "0x0000000000000000000000000000000000000001"
def main():
address, info, exchange = example_utils.setup(constants.TESTNET_API_URL, skip_ws=True)
if ACTION == "Register":
node_ip = "1.2.3.4"
name = "..."
description = "..."
delegations_disabled = True
commission_bps = 5
signer = DUMMY_SIGNER
unjailed = False
initial_wei = 100000
register_result = exchange.c_validator_register(
node_ip,
name,
description,
delegations_disabled,
commission_bps,
signer,
unjailed,
initial_wei,
)
print("register result", register_result)
elif ACTION == "ChangeProfile":
node_ip = None
name = None
description = None
unjailed = False
disable_delegations = None
commission_bps = None
signer = None
change_profile_result = exchange.c_validator_change_profile(
node_ip,
name,
description,
unjailed,
disable_delegations,
commission_bps,
signer,
)
print("change profile result", change_profile_result)
elif ACTION == "Unregister":
unregister_result = exchange.c_validator_unregister()
print("unregister result", unregister_result)
else:
raise ValueError("Invalid action specified")
if __name__ == "__main__":
main()