-
Notifications
You must be signed in to change notification settings - Fork 40
/
pgql_s_example.py
760 lines (627 loc) · 24 KB
/
pgql_s_example.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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
# Copyright Frank V. Castellucci
# SPDX-License-Identifier: Apache-2.0
# -*- coding: utf-8 -*-
"""Sample module for incremental buildout of Sui GraphQL RPC for Pysui 1.0.0."""
import base64
from pysui import PysuiConfiguration, SuiRpcResult, SyncGqlClient
from pysui.sui.sui_pgql.pgql_sync_txn import SuiTransaction
import pysui.sui.sui_pgql.pgql_query as qn
import pysui.sui.sui_pgql.pgql_types as ptypes
def handle_result(result: SuiRpcResult) -> SuiRpcResult:
"""."""
if result.is_ok():
if hasattr(result.result_data, "to_json"):
print(result.result_data.to_json(indent=2))
else:
print(result.result_data)
else:
print(result.result_string)
if result.result_data and hasattr(result.result_data, "to_json"):
print(result.result_data.to_json(indent=2))
else:
print(result.result_data)
return result
def do_coin_meta(client: SyncGqlClient):
"""Fetch meta data about coins, includes supply."""
# Defaults to 0x2::sui::SUI
handle_result(client.execute_query_node(with_node=qn.GetCoinMetaData()))
def do_coins_for_type(client: SyncGqlClient):
"""Fetch coins of specific type for owner."""
handle_result(
client.execute_query_node(
with_node=qn.GetCoins(
owner=client.config.active_address,
coin_type="0x2::sui::SUI",
)
)
)
def do_gas(client: SyncGqlClient):
"""Fetch 0x2::sui::SUI (default) for owner."""
coins_node = qn.GetCoins(owner=client.config.active_address)
result = handle_result(client.execute_query_node(with_node=coins_node))
if result.is_ok():
print(
f"Total coins in page: {len(result.result_data.data)} \nhas more: {result.result_data.next_cursor.hasNextPage}"
)
def do_all_gas(client: SyncGqlClient):
"""Fetch all coins for owner."""
result = handle_result(
client.execute_query_node(
with_node=qn.GetCoins(owner=client.config.active_address)
)
)
tcoins = 0
tbalance = 0
while result.is_ok():
coins: ptypes.SuiCoinObjectsGQL = result.result_data
tcoins += len(coins.data)
tbalance += sum([int(x.balance) for x in coins.data])
if result.result_data.next_cursor.hasNextPage:
result = handle_result(
client.execute_query_node(
with_node=qn.GetCoins(
owner=client.config.active_address,
next_page=result.result_data.next_cursor,
)
)
)
else:
break
print(f"Total coins: {tcoins}")
print(f"Total mists: {tbalance}")
def do_gas_ids(client: SyncGqlClient):
"""Fetch coins by the ids."""
# Use coins found for active address to use to validate
# fetching by coin ids
result = client.execute_query_node(
with_node=qn.GetCoins(owner=client.config.active_address)
)
if result.is_ok() and result.result_data.data:
cids = [x.coin_object_id for x in result.result_data.data]
result = handle_result(
client.execute_query_node(
with_node=qn.GetMultipleGasObjects(coin_object_ids=cids)
)
)
elif result.is_err():
print(f"Error calling GraphQL {result.result_string}")
else:
print(f"Data return from call is empty {result.result_data.data}")
def do_sysstate(client: SyncGqlClient):
"""Fetch the most current system state summary."""
handle_result(client.execute_query_node(with_node=qn.GetLatestSuiSystemState()))
def do_all_balances(client: SyncGqlClient):
"""Fetch all coin types for active address and total balances.
Demonstrates paging as well
"""
result = client.execute_query_node(
with_node=qn.GetAllCoinBalances(owner=client.config.active_address)
)
handle_result(result)
if result.is_ok():
while result.result_data.next_cursor.hasNextPage:
result = client.execute_query_node(
with_node=qn.GetAllCoinBalances(
owner=client.config.active_address,
next_page=result.result_data.next_cursor,
)
)
handle_result(result)
print("DONE")
def do_object(client: SyncGqlClient):
"""Fetch specific object data.
To run, replace object_id with object you are interested in.
"""
gobj = qn.GetObject(
object_id="0x04cc525490ed375c21d1ec17841cb3b8363b463613b8673ce4620c4b885acb02"
)
# print(client.query_node_to_string(query_node=gobj))
handle_result(client.execute_query_node(with_node=gobj))
def do_past_object(client: SyncGqlClient):
"""Fetch a past object.
To run, change the objectID str and version int.
"""
handle_result(
client.execute_query_node(
with_node=qn.GetPastObject(
object_id="0x04cc525490ed375c21d1ec17841cb3b8363b463613b8673ce4620c4b885acb02",
version=17078252,
)
)
)
def do_multiple_past_object(client: SyncGqlClient):
"""Fetch a past object.
To run, change the objectID str and version int and add more dicts to the list.
"""
past_objects = [
{
"objectId": "0xdfa764b29d303acecc801828839108ea81a45e93c3b9ccbe05b0d9a697a2a9ed",
"version": 17078252,
}
]
handle_result(
client.execute_query_node(
with_node=qn.GetMultiplePastObjects(for_versions=past_objects)
)
)
def do_objects(client: SyncGqlClient):
"""Fetch all objects held by owner."""
handle_result(
client.execute_query_node(
with_node=qn.GetObjectsOwnedByAddress(owner=client.config.active_address)
)
)
def do_objects_for(client: SyncGqlClient):
"""Fetch specific objects by their ids.
These are test IDs, replace to run.
"""
handle_result(
client.execute_query_node(
with_node=qn.GetMultipleObjects(
object_ids=[
"0x0847e1e02965e3f6a8b237152877a829755fd2f7cfb7da5a859f203a8d4316f0",
"0x68e961e3af906b160e1ff21137304537fa6b31f5a4591ef3acf9664eb6e3cd2b",
"0x77851d73e7c1227c048fc7cbf21ff9053faa872950dd33f5d0cb5b40a79d9d99",
]
)
)
)
def do_dynamics(client: SyncGqlClient):
"""Get objects dynamic field and dynamic object fields.
This is test ID, replace to run.
"""
handle_result(
client.execute_query_node(
with_node=qn.GetDynamicFields(
object_id="0xdfa764b29d303acecc801828839108ea81a45e93c3b9ccbe05b0d9a697a2a9ed"
)
)
)
def do_event(client: SyncGqlClient):
"""."""
res = client.execute_query_node(
with_node=qn.GetEvents(
event_filter={"eventType": "0x3::validator::StakingRequestEvent"}
)
)
if res.is_ok():
handle_result(res)
max_page = 3
in_page = 0
while True:
in_page += 1
if in_page < max_page and res.result_data.next_cursor:
res = client.execute_query_node(
with_node=qn.GetEvents(
event_filter={"sender": "0x0"},
next_page=res.result_data.next_cursor,
)
)
handle_result(res)
else:
break
print("DONE")
def do_configs(client: SyncGqlClient):
"""Fetch the GraphQL, Protocol and System configurations."""
print(client.rpc_config().to_json(indent=2))
def do_service_config(client: SyncGqlClient):
"""Fetch the GraphQL, Protocol and System configurations."""
print(client.rpc_config().serviceConfig.to_json(indent=2))
def do_chain_id(client: SyncGqlClient):
"""Fetch the current environment chain_id.
Demonstrates overriding serialization
"""
print(client.chain_id())
def do_tx(client: SyncGqlClient):
"""Fetch specific transaction by it's digest.
To run, replace digest value with a valid one for network you are working with
"""
handle_result(
client.execute_query_node(
with_node=qn.GetTx(digest="CqKm8efZcFJAFkfsygHmE8kHzWQJNPygSz8zmMginmHa")
)
)
def do_txs(client: SyncGqlClient):
"""Fetch transactions.
We loop through 3 pages.
"""
result = client.execute_query_node(with_node=qn.GetMultipleTx())
handle_result(result)
if result.is_ok():
max_page = 3
in_page = 0
while True:
in_page += 1
if in_page < max_page and result.result_data.next_cursor:
result = client.execute_query_node(
with_node=qn.GetMultipleTx(next_page=result.result_data.next_cursor)
)
handle_result(result)
else:
break
print("DONE")
def do_filter_txs(client: SyncGqlClient):
"""Fetch all transactions matching filter.
See Sui GraphQL schema for TransactionBlockFilter options.
"""
obj_filter = {"changedObject": "ENTER OBJECT_ID HERE"}
result = client.execute_query_node(with_node=qn.GetFilteredTx(tx_filter=obj_filter))
while result.is_ok():
txs: ptypes.TransactionSummariesGQL = result.result_data
for tx in txs.data:
print(f"Kind: {tx.tx_kind} Digest: {tx.digest} timestamp: {tx.timestamp}")
if txs.next_cursor.hasNextPage:
result = client.execute_query_node(
with_node=qn.GetFilteredTx(
tx_filter=obj_filter,
next_page=txs.next_cursor,
)
)
else:
break
def do_tx_kind(client: SyncGqlClient):
"""Fetch the PTB details from transaction."""
qnode = qn.GetTxKind(digest="ENTER TRANSACTION DIGESST HERE")
handle_result(client.execute_query_node(with_node=qnode))
def do_staked_sui(client: SyncGqlClient):
"""Retreive Staked Coins."""
owner = client.config.active_address
handle_result(
client.execute_query_node(with_node=qn.GetDelegatedStakes(owner=owner))
)
def do_latest_cp(client: SyncGqlClient):
"""."""
qnode = qn.GetLatestCheckpointSequence()
# print(qnode.query_as_string())
handle_result(client.execute_query_node(with_node=qnode))
def do_sequence_cp(client: SyncGqlClient):
"""Fetch a checkpoint by checkpoint sequence number.
Uses the most recent checkpoint's sequence id (inefficient for example only)
"""
result = client.execute_query_node(with_node=qn.GetLatestCheckpointSequence())
if result.is_ok():
cp: ptypes.CheckpointGQL = result.result_data
handle_result(
client.execute_query_node(
with_node=qn.GetCheckpointBySequence(sequence_number=cp.sequence_number)
)
)
else:
print(result.result_string)
def do_digest_cp(client: SyncGqlClient):
"""Fetch a checkpoint by checkpoint digest.
Uses the most recent checkpoint's digest (inefficient for example only)
"""
result = client.execute_query_node(with_node=qn.GetLatestCheckpointSequence())
if result.is_ok():
cp: ptypes.CheckpointGQL = result.result_data
handle_result(
client.execute_query_node(
with_node=qn.GetCheckpointByDigest(digest=cp.digest)
)
)
else:
print(result.result_string)
def do_checkpoints(client: SyncGqlClient):
"""Get a batch of checkpoints."""
handle_result(client.execute_query_node(with_node=qn.GetCheckpoints()))
def do_refgas(client: SyncGqlClient):
"""Fetch the most current system state summary."""
handle_result(client.execute_query_node(with_node=qn.GetReferenceGasPrice()))
def do_nameservice(client: SyncGqlClient):
"""Fetch the most current system state summary."""
handle_result(
client.execute_query_node(
with_node=qn.GetNameServiceAddress(name="example.sui")
)
)
def do_owned_nameservice(client: SyncGqlClient):
"""Fetch the most current system state summary."""
handle_result(
client.execute_query_node(
with_node=qn.GetNameServiceNames(owner=client.config.active_address)
)
)
def do_validators_apy(client: SyncGqlClient):
"""Fetch the most current validators apy and identity."""
handle_result(client.execute_query_node(with_node=qn.GetValidatorsApy()))
def do_validators(client: SyncGqlClient):
"""Fetch the most current validator detail."""
handle_result(client.execute_query_node(with_node=qn.GetCurrentValidators()))
def do_all_validators(client: SyncGqlClient):
"""Fetch all validators and show name and data."""
all_vals: list[ptypes.ValidatorFullGQL] = []
valres = client.execute_query_node(with_node=qn.GetCurrentValidators())
while valres.is_ok():
all_vals.extend(valres.result_data.validators)
if valres.result_data.next_cursor.hasNextPage:
valres = client.execute_query_node(
with_node=qn.GetCurrentValidators(
next_page=valres.result_data.next_cursor,
)
)
else:
break
print(f"Total validators {len(all_vals)}")
for val in all_vals:
print(
f"Address: {val.validator_address} Apy: {val.apy} Name: {val.validator_name}"
)
def do_protcfg(client: SyncGqlClient):
"""Fetch the most current system state summary."""
handle_result(client.execute_query_node(with_node=qn.GetProtocolConfig(version=30)))
def do_struct(client: SyncGqlClient):
"""Fetch structure by package::module::struct_name.
This is a testnet object!!!
"""
result = client.execute_query_node(
with_node=qn.GetStructure(
package="0x2",
module_name="coin",
structure_name="CoinMetadata",
)
)
if result.is_ok():
print(result.result_data.to_json(indent=2))
def do_structs(client: SyncGqlClient):
"""Fetch structures by package::module."""
result = client.execute_query_node(
with_node=qn.GetStructures(
package="0x2",
module_name="coin",
)
)
if result.is_ok():
print(result.result_data.to_json(indent=2))
def do_func(client: SyncGqlClient):
"""Fetch structures by package::module."""
result = client.execute_query_node(
with_node=qn.GetFunction(
package="0x2",
module_name="pay",
function_name="divide_and_keep",
)
)
if result.is_ok():
mv_fn: ptypes.MoveFunctionGQL = result.result_data
print(mv_fn.to_json(indent=2))
print(mv_fn.arg_summary().to_json(indent=2))
def do_funcs(client: SyncGqlClient):
"""Fetch structures by package::module."""
result = client.execute_query_node(
with_node=qn.GetFunctions(
package="0x1",
module_name="ascii",
)
)
if result.is_ok():
print(result.result_data.to_json(indent=2))
def do_module(client: SyncGqlClient):
"""Fetch a module from package."""
result = client.execute_query_node(
with_node=qn.GetModule(
package="0x2",
module_name="prover",
)
)
if result.is_ok():
print(result.result_data.to_json(indent=2))
def do_package(client: SyncGqlClient):
"""Fetch a module from package.
The cursor, if used, applies to the modules listing
"""
result = client.execute_query_node(
with_node=qn.GetPackage(
package="0x2",
)
)
while result.is_ok():
sui_package: ptypes.MovePackageGQL = handle_result(result).result_data
if sui_package.next_cursor.hasNextPage:
result = client.execute_query_node(
with_node=qn.GetPackage(
package=sui_package.package_id, next_page=sui_package.next_cursor
)
)
else:
break
def do_dry_run_kind_new(client: SyncGqlClient):
"""Execute a dry run with TransactionKind where meta data is set by caller.
This uses the new SuiTransaction (GraphQL RPC based)
"""
txer = SuiTransaction(client=client)
scres = txer.split_coin(coin=txer.gas, amounts=[1000000, 1000000])
txer.transfer_objects(transfers=scres, recipient=client.config.active_address)
tx_b64 = base64.b64encode(txer.raw_kind().serialize()).decode()
handle_result(
client.execute_query_node(with_node=qn.DryRunTransactionKind(tx_bytestr=tx_b64))
)
def do_dry_run_new(client: SyncGqlClient):
"""Execute a dry run with TransactionData where gas and budget set by txer.
This uses the new SuiTransaction (GraphQL RPC based)
"""
txer = SuiTransaction(client=client)
scres = txer.split_coin(coin=txer.gas, amounts=[1000000000])
txer.transfer_objects(transfers=scres, recipient=client.config.active_address)
tx_b64 = base64.b64encode(txer.transaction_data().serialize()).decode()
print(tx_b64)
handle_result(
client.execute_query_node(with_node=qn.DryRunTransaction(tx_bytestr=tx_b64))
)
def do_execute_new(client: SyncGqlClient):
"""Execute a transaction.
The result contains the digest of the transaction which can then be queried
for details
This uses the new SuiTransaction (GraphQL RPC based)
"""
txer: SuiTransaction = SuiTransaction(client=client)
scres = txer.split_coin(coin=txer.gas, amounts=[1000000, 1000000])
txer.transfer_objects(transfers=scres, recipient=client.config.active_address)
txdict = txer.build_and_sign()
handle_result(client.execute_query_node(with_node=qn.ExecuteTransaction(**txdict)))
def merge_some(client: SyncGqlClient):
"""Merge some coins in wallet.
To merge all coins, ensure to use paging to gather all coins first and
combine them into a single list, then perform the merge.
"""
result = client.execute_query_node(
with_node=qn.GetCoins(owner=client.config.active_address)
)
if result.is_ok() and len(result.result_data.data) > 1:
txer: SuiTransaction = SuiTransaction(client=client)
txer.merge_coins(merge_to=txer.gas, merge_from=result.result_data.data[1:])
txdict = txer.build_and_sign()
handle_result(
client.execute_query_node(with_node=qn.ExecuteTransaction(**txdict))
)
def split_1_half(client: SyncGqlClient):
"""Split the 1 coin into 2 (or more) in wallet.
If there is more than 1 coin for the address, this transaction won't be
submitted.
"""
result = client.execute_query_node(
with_node=qn.GetCoins(owner=client.config.active_address)
)
if result.is_ok() and len(result.result_data.data) == 1:
amount = int(int(result.result_data.data[0].balance) / 2)
txer: SuiTransaction = SuiTransaction(client=client)
scres = txer.split_coin(coin=txer.gas, amounts=[amount])
txer.transfer_objects(transfers=scres, recipient=client.config.active_address)
txdict = txer.build_and_sign()
handle_result(
client.execute_query_node(with_node=qn.ExecuteTransaction(**txdict))
)
def split_any_half(client: SyncGqlClient):
"""Split the 1st coin in wallet to another another equal to 1/2 in wallet.
This will only run if there is more than 1 coin in wallet.
"""
result = client.execute_query_node(
with_node=qn.GetCoins(owner=client.config.active_address)
)
if result.is_ok() and len(result.result_data.data) > 1:
amount = int(int(result.result_data.data[0].balance) / 2)
txer: SuiTransaction = SuiTransaction(client=client)
scres = txer.split_coin(coin=result.result_data.data[0], amounts=[amount])
txer.transfer_objects(transfers=scres, recipient=client.config.active_address)
txdict = txer.build_and_sign()
handle_result(
client.execute_query_node(with_node=qn.ExecuteTransaction(**txdict))
)
def do_stake(client: SyncGqlClient):
"""Stake some coinage.
This uses a testnet validator (Blockscope.net). For different environment
or different validator change the vaddress
"""
vaddress = "0xdfed72a46fa7899fd80edf960bb4e05d6852f74a628d55b8dba69064f0ca07d4"
txer: SuiTransaction = SuiTransaction(client=client)
# Take 1 Sui from gas
stake_coin_split = txer.split_coin(coin=txer.gas, amounts=[1000000000])
# Stake the coin
txer.stake_coin(
coins=[stake_coin_split],
validator_address=vaddress,
)
# Uncomment to dry run
handle_result(
client.execute_query_node(
with_node=qn.DryRunTransaction(tx_bytestr=txer.build())
)
)
# Uncomment to Execute the unstake
# txdict = txer.build_and_sign()
# handle_result(
# client.execute_query_node(
# with_node=qn.ExecuteTransaction(**txdict)
# )
# )
def do_unstake(client: SyncGqlClient):
"""Unstake first Staked Sui if address has any."""
owner = client.config.active_address
result = client.execute_query_node(with_node=qn.GetDelegatedStakes(owner=owner))
if result.is_ok() and result.result_data.staked_coins:
txer: SuiTransaction = SuiTransaction(client=client)
# Unstake the first staked coin
txer.unstake_coin(staked_coin=result.result_data.staked_coins[0])
# Uncomment to dry run
handle_result(
client.execute_query_node(
with_node=qn.DryRunTransaction(tx_bytestr=txer.build())
)
)
# Uncomment to Execute the unstake
# txdict = txer.build_and_sign()
# handle_result(
# client.execute_query_node(
# with_node=qn.ExecuteTransaction(**txdict)
# )
# )
else:
print(f"No staked Sui for {owner}")
if __name__ == "__main__":
client_init: SyncGqlClient = None
try:
cfg = PysuiConfiguration(
group_name=PysuiConfiguration.SUI_GQL_RPC_GROUP,
# profile_name="testnet",
# persist=True,
)
client_init = SyncGqlClient(write_schema=False, pysui_config=cfg)
print(f"Active chain profile '{client_init.chain_environment}'")
print(f"Default schema base version '{client_init.base_schema_version}'")
print(f"Default schema build version '{client_init.schema_version()}'")
print()
# for pname in cfg.profile_names():
# print(pname)
## QueryNodes (fetch)
# do_coin_meta(client_init)
# do_coins_for_type(client_init)
do_gas(client_init)
# do_all_gas(client_init)
# do_gas_ids(client_init)
# do_sysstate(client_init)
# do_all_balances(client_init)
# do_object(client_init)
# do_objects(client_init)
# do_past_object(client_init)
# do_multiple_past_object(client_init)
# do_objects_for(client_init)
# do_dynamics(client_init)
# do_event(client_init)
# do_tx(client_init)
# do_txs(client_init)
# do_filter_txs(client_init)
# do_tx_kind(client_init)
# do_staked_sui(client_init)
# do_latest_cp(client_init)
# do_sequence_cp(client_init)
# do_digest_cp(client_init)
# do_checkpoints(client_init)
# do_nameservice(client_init)
# do_owned_nameservice(client_init)
# do_validators_apy(client_init)
# do_validators(client_init)
# do_all_validators(client_init)
# do_refgas(client_init)
# do_struct(client_init)
# do_structs(client_init)
# do_func(client_init)
# do_funcs(client_init)
# do_module(client_init)
# do_package(client_init)
# do_dry_run_new(client_init)
# do_dry_run_kind_new(client_init)
# do_execute_new(client_init)
# merge_some(client_init)
# split_any_half(client_init)
# split_1_half(client_init)
# do_stake(client_init)
# do_unstake(client_init)
## Config
# do_chain_id(client_init)
# do_configs(client_init)
# do_service_config(client_init)
# do_protcfg(client_init)
except Exception as ex:
print(ex.args)
if client_init:
client_init.client().close_sync()