tusdt-cli 0.2.3__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/PKG-INFO +1 -1
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/pyproject.toml +1 -1
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/__init__.py +1 -1
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/client.py +21 -66
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/commands/governance.py +20 -11
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/.gitignore +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/LICENSE +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/README.md +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/requirements.txt +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/abi/tusdt_auction.json +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/abi/tusdt_erc20.json +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/abi/tusdt_governance.json +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/abi/tusdt_oracle.json +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/abi/tusdt_treasury.json +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/abi/tusdt_vault.json +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/cli.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/commands/__init__.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/commands/auction.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/commands/oracle.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/commands/token.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/commands/treasury.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/commands/vault.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/config.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/utils.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/src/tusdt_cli/wallet.py +0 -0
- {tusdt_cli-0.2.3 → tusdt_cli-0.2.5}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tusdt-cli
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.5
|
|
4
4
|
Summary: CLI for interacting with the TUSDT ink! smart contract system on subtensor(bittensor)
|
|
5
5
|
Project-URL: Homepage, https://github.com/tensorusd/tusdt-cli
|
|
6
6
|
Project-URL: Repository, https://github.com/tensorusd/tusdt-cli
|
|
@@ -9,7 +9,6 @@ from typing import Any
|
|
|
9
9
|
|
|
10
10
|
from substrateinterface import Keypair, SubstrateInterface
|
|
11
11
|
from substrateinterface.contracts import ContractInstance, ContractMetadata
|
|
12
|
-
from substrateinterface.contracts import ContractMetadata as _ContractMetadata
|
|
13
12
|
from substrateinterface.exceptions import ContractReadFailedException
|
|
14
13
|
|
|
15
14
|
from tusdt_cli.utils import (
|
|
@@ -20,67 +19,24 @@ from tusdt_cli.utils import (
|
|
|
20
19
|
unwrap_result,
|
|
21
20
|
)
|
|
22
21
|
|
|
22
|
+
_ContractMetadata__parse_metadata = ContractMetadata._ContractMetadata__parse_metadata
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _patched_parse_metadata(self: ContractMetadata) -> None:
|
|
26
|
+
self._ContractMetadata__convert_to_latest_metadata()
|
|
27
|
+
|
|
28
|
+
# -- original checks (lines 140-154) --
|
|
29
|
+
if "types" not in self.metadata_dict:
|
|
30
|
+
raise ValueError("No 'types' directive present in metadata file")
|
|
31
|
+
if "spec" not in self.metadata_dict:
|
|
32
|
+
raise ValueError("'spec' directive not present in metadata file")
|
|
33
|
+
if "constructors" not in self.metadata_dict["spec"]:
|
|
34
|
+
raise ValueError("No constructors present in metadata file")
|
|
35
|
+
if "messages" not in self.metadata_dict["spec"]:
|
|
36
|
+
raise ValueError("No messages present in metadata file")
|
|
37
|
+
if "source" not in self.metadata_dict:
|
|
38
|
+
raise ValueError("'source' directive not present in metadata file")
|
|
23
39
|
|
|
24
|
-
# ---------------------------------------------------------------------------
|
|
25
|
-
# Patch: fix substrate-interface 1.8.1 V5 metadata loading bug
|
|
26
|
-
#
|
|
27
|
-
# In ink! V5 metadata, the `else` branch of __convert_to_latest_metadata()
|
|
28
|
-
# passes `portable_registry['types']` (a SCALE-decoded Vec<PortableType>) to
|
|
29
|
-
# `update_from_scale_info_types()`, which expects a plain Python `list`.
|
|
30
|
-
# This replacement extracts `.value_object` to get the plain list.
|
|
31
|
-
# ---------------------------------------------------------------------------
|
|
32
|
-
def _fixed_convert(self: _ContractMetadata) -> None:
|
|
33
|
-
"""Drop-in replacement for __convert_to_latest_metadata with V5 fix."""
|
|
34
|
-
# -- determine version (same as original) --
|
|
35
|
-
if "metadataVersion" in self.metadata_dict:
|
|
36
|
-
self.metadata_version = 0
|
|
37
|
-
elif "V1" in self.metadata_dict:
|
|
38
|
-
self.metadata_version = 1
|
|
39
|
-
elif "V2" in self.metadata_dict:
|
|
40
|
-
self.metadata_version = 2
|
|
41
|
-
elif "V3" in self.metadata_dict:
|
|
42
|
-
self.metadata_version = 3
|
|
43
|
-
elif "version" in self.metadata_dict:
|
|
44
|
-
self.metadata_version = int(self.metadata_dict["version"])
|
|
45
|
-
|
|
46
|
-
if self.metadata_version is None or self.metadata_version > 5:
|
|
47
|
-
raise ValueError("Unsupported metadata version")
|
|
48
|
-
|
|
49
|
-
if 1 <= self.metadata_version <= 3:
|
|
50
|
-
version_key = f"V{self.metadata_version}"
|
|
51
|
-
self.metadata_dict["spec"] = self.metadata_dict[version_key]["spec"]
|
|
52
|
-
self.metadata_dict["storage"] = self.metadata_dict[version_key]["storage"]
|
|
53
|
-
self.metadata_dict["types"] = self.metadata_dict[version_key]["types"]
|
|
54
|
-
del self.metadata_dict[version_key]
|
|
55
|
-
|
|
56
|
-
# V1 -> V2: name -> label
|
|
57
|
-
if self.metadata_version <= 1:
|
|
58
|
-
|
|
59
|
-
def _replace_name(obj: dict) -> dict:
|
|
60
|
-
if "name" in obj:
|
|
61
|
-
obj["label"] = (
|
|
62
|
-
"::".join(obj.pop("name")) if isinstance(obj["name"], list) else obj.pop("name")
|
|
63
|
-
)
|
|
64
|
-
return obj
|
|
65
|
-
|
|
66
|
-
for section in ("constructors", "events", "messages"):
|
|
67
|
-
for idx, c in enumerate(self.metadata_dict["spec"][section]):
|
|
68
|
-
self.metadata_dict["spec"][section][idx]["args"] = [_replace_name(a) for a in c["args"]]
|
|
69
|
-
_replace_name(c)
|
|
70
|
-
|
|
71
|
-
# V2 -> V3: default payable=True for constructors
|
|
72
|
-
if self.metadata_version <= 2:
|
|
73
|
-
for _idx, c in enumerate(self.metadata_dict["spec"]["constructors"]):
|
|
74
|
-
c["payable"] = True
|
|
75
|
-
|
|
76
|
-
# V4 -> V5: add module_path and signature_topic to events
|
|
77
|
-
if self.metadata_version <= 4:
|
|
78
|
-
for _idx, event in enumerate(self.metadata_dict["spec"]["events"]):
|
|
79
|
-
event["module_path"] = event.get("module_path", "")
|
|
80
|
-
event["signature_topic"] = event.get("signature_topic", "")
|
|
81
|
-
|
|
82
|
-
# Set type offset and prefix
|
|
83
|
-
self._ContractMetadata__type_offset = 0
|
|
84
40
|
if "V0" in self.metadata_dict and tuple(
|
|
85
41
|
int(x) for x in self.metadata_dict["metadataVersion"].split(".")
|
|
86
42
|
) < (0, 7, 0):
|
|
@@ -95,16 +51,15 @@ def _fixed_convert(self: _ContractMetadata) -> None:
|
|
|
95
51
|
self.type_registry[idx] = self.get_type_string_for_metadata_type(idx)
|
|
96
52
|
else:
|
|
97
53
|
self.substrate.init_runtime()
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
raw_types = portable_registry["types"]
|
|
54
|
+
pr = self.substrate.runtime_config.create_scale_object("PortableRegistry")
|
|
55
|
+
pr.encode({"types": self.metadata_dict["types"]})
|
|
56
|
+
raw_types = pr["types"]
|
|
102
57
|
if hasattr(raw_types, "value_object"):
|
|
103
58
|
raw_types = raw_types.value_object
|
|
104
59
|
self.substrate.runtime_config.update_from_scale_info_types(raw_types, prefix=self.type_string_prefix)
|
|
105
60
|
|
|
106
61
|
|
|
107
|
-
|
|
62
|
+
ContractMetadata._ContractMetadata__parse_metadata = _patched_parse_metadata
|
|
108
63
|
|
|
109
64
|
|
|
110
65
|
def _decode_dispatch_error(err: Any) -> str:
|
|
@@ -1257,10 +1257,11 @@ def submit_proposal_cmd(
|
|
|
1257
1257
|
)
|
|
1258
1258
|
@click.option(
|
|
1259
1259
|
"--proof",
|
|
1260
|
-
|
|
1260
|
+
"proofs",
|
|
1261
|
+
multiple=True,
|
|
1261
1262
|
required=True,
|
|
1262
1263
|
metavar="<hex-string>",
|
|
1263
|
-
help="Merkle proof as hex-encoded bytes (e.g.
|
|
1264
|
+
help="Merkle proof hash as hex-encoded 32 bytes (repeatable, e.g. --proof 0xabc... --proof 0xdef...)",
|
|
1264
1265
|
)
|
|
1265
1266
|
@_wallet_option
|
|
1266
1267
|
@_network_option
|
|
@@ -1272,7 +1273,7 @@ def vote_cmd(
|
|
|
1272
1273
|
support: bool,
|
|
1273
1274
|
balance: str,
|
|
1274
1275
|
multiplier_bps: int,
|
|
1275
|
-
|
|
1276
|
+
proofs: tuple[str, ...],
|
|
1276
1277
|
wallet_name: str | None,
|
|
1277
1278
|
network: str | None,
|
|
1278
1279
|
) -> None:
|
|
@@ -1280,9 +1281,10 @@ def vote_cmd(
|
|
|
1280
1281
|
|
|
1281
1282
|
\b
|
|
1282
1283
|
PROPOSAL_ID is the numeric proposal ID (integer).
|
|
1284
|
+
Each --proof is a hex-encoded 32-byte Merkle proof hash; repeat for multiple proof nodes.
|
|
1283
1285
|
Examples:
|
|
1284
|
-
tusdt governance vote 0 --hotkey 5GrwvaEF... --support --balance 1000 --multiplier-bps 10000 --proof
|
|
1285
|
-
tusdt governance vote 0 --hotkey 5GrwvaEF... --oppose --balance 500 --multiplier-bps 10000 --proof
|
|
1286
|
+
tusdt governance vote 0 --hotkey 5GrwvaEF... --support --balance 1000 --multiplier-bps 10000 --proof 0x5637... --wallet-name MyWallet
|
|
1287
|
+
tusdt governance vote 0 --hotkey 5GrwvaEF... --oppose --balance 500 --multiplier-bps 10000 --proof 0x5637... --proof 0x8087... --wallet-name MyWallet
|
|
1286
1288
|
"""
|
|
1287
1289
|
config = load_config(network=network)
|
|
1288
1290
|
if wallet_name:
|
|
@@ -1290,12 +1292,19 @@ def vote_cmd(
|
|
|
1290
1292
|
decimals = config.get("decimals", 9)
|
|
1291
1293
|
raw_balance = parse_balance(balance, decimals)
|
|
1292
1294
|
|
|
1293
|
-
# Convert hex proof to list of
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1295
|
+
# Convert each hex proof hash to a list of 32 bytes (MerkleHash = [u8; 32])
|
|
1296
|
+
proof_list = []
|
|
1297
|
+
for proof_hex in proofs:
|
|
1298
|
+
ph = proof_hex.strip()
|
|
1299
|
+
if ph.startswith("0x"):
|
|
1300
|
+
ph = ph[2:]
|
|
1301
|
+
proof_bytes = bytes.fromhex(ph)
|
|
1302
|
+
if len(proof_bytes) != 32:
|
|
1303
|
+
print_error(
|
|
1304
|
+
f"Each --proof must be exactly 32 bytes (64 hex chars), got {len(proof_bytes)} bytes"
|
|
1305
|
+
)
|
|
1306
|
+
return
|
|
1307
|
+
proof_list.append(list(proof_bytes))
|
|
1299
1308
|
|
|
1300
1309
|
try:
|
|
1301
1310
|
keypair = get_signer_keypair(config)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|