-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,10 @@ | |
# mdBook | ||
build/ | ||
|
||
# Python | ||
__pycache__/ | ||
*.pyc | ||
|
||
# Misc | ||
*.key | ||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
system_pkg: 0x17108fb344dbea0d315e6f44cdd3af12a028cd568bafcbfb7f7a7b152719d15d | ||
system_object: 0x3fb18e675ad41158f59acbdb7f574136a198cbd83be9b968c0fdeaa139c312f9 | ||
wallet_config: null | ||
|
||
# Default values for the client are commented out. | ||
# | ||
# There is no risk in playing aroud with these values. | ||
# Worst case, you may not be able to store/read from Walrus. | ||
|
||
# communication_config: | ||
# max_concurrent_writes: null | ||
# max_concurrent_sliver_reads: null | ||
# max_concurrent_metadata_reads: 3 | ||
# reqwest_config: | ||
# total_timeout: | ||
# secs: 180 | ||
# nanos: 0 | ||
# pool_idle_timeout: null | ||
# http2_keep_alive_timeout: | ||
# secs: 5 | ||
# nanos: 0 | ||
# http2_keep_alive_interval: | ||
# secs: 30 | ||
# nanos: 0 | ||
# http2_keep_alive_while_idle: true | ||
# request_rate_config: | ||
# max_node_connections: 10 | ||
# max_retries: 5 | ||
# min_backoff: | ||
# secs: 2 | ||
# nanos: 0 | ||
# max_backoff: | ||
# secs: 60 | ||
# nanos: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Example of querying the Walrus system object on Sui | ||
# | ||
# Prerequisites: | ||
# | ||
# - Configure Walrus | ||
# see: TODO | ||
# | ||
# - Update the paths PATH_TO_WALRUS_CONFIG below | ||
# | ||
|
||
# Std lib imports | ||
import requests | ||
import re | ||
|
||
PATH_TO_WALRUS_CONFIG = "../CONFIG/config_dir/client_config.yaml" | ||
|
||
system_object_id = re.findall(r"system_object:[ ]*(.*)", open(PATH_TO_WALRUS_CONFIG).read())[0] | ||
print(f'System object ID: {system_object_id}') | ||
# Part 3. Check the availability of the blob | ||
request = { | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"method": "sui_getObject", | ||
"params": [ | ||
system_object_id, | ||
{ | ||
"showType": True, | ||
"showOwner": False, | ||
"showPreviousTransaction": True, | ||
"showDisplay": False, | ||
"showContent": True, | ||
"showBcs": False, | ||
"showStorageRebate": False | ||
} | ||
] | ||
} | ||
response = requests.post("https://fullnode.testnet.sui.io:443", json=request) | ||
system_object_content = response.json()["result"]["data"]["content"]["fields"] | ||
committee = system_object_content["current_committee"]["fields"]["bls_committee"]["fields"] | ||
|
||
print(f'Current walrus epoch: {system_object_content["current_committee"]["fields"]["epoch"]}') | ||
print(f'Number of members: {len(committee["members"])} Number of shards: {committee["n_shards"]}') | ||
print(f'Price per unit size: {system_object_content["price_per_unit_size"]} MIST') | ||
print(f'Total capacity size: {system_object_content["total_capacity_size"]} bytes') | ||
print(f'Used capacity size: {system_object_content["used_capacity_size"]} bytes') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters