tusdt-cli 0.2.0__tar.gz → 0.2.2__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.0 → tusdt_cli-0.2.2}/PKG-INFO +1 -1
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/pyproject.toml +1 -1
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/__init__.py +1 -1
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/client.py +80 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/config.py +6 -6
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/utils.py +4 -4
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/.gitignore +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/LICENSE +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/README.md +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/requirements.txt +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/abi/tusdt_auction.json +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/abi/tusdt_erc20.json +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/abi/tusdt_governance.json +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/abi/tusdt_oracle.json +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/abi/tusdt_treasury.json +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/abi/tusdt_vault.json +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/cli.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/commands/__init__.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/commands/auction.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/commands/governance.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/commands/oracle.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/commands/token.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/commands/treasury.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/commands/vault.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/src/tusdt_cli/wallet.py +0 -0
- {tusdt_cli-0.2.0 → tusdt_cli-0.2.2}/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.2
|
|
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
|
|
@@ -11,6 +11,8 @@ from substrateinterface import Keypair, SubstrateInterface
|
|
|
11
11
|
from substrateinterface.contracts import ContractInstance, ContractMetadata
|
|
12
12
|
from substrateinterface.exceptions import ContractReadFailedException
|
|
13
13
|
|
|
14
|
+
from substrateinterface.contracts import ContractMetadata as _ContractMetadata
|
|
15
|
+
|
|
14
16
|
from tusdt_cli.utils import (
|
|
15
17
|
ContractError,
|
|
16
18
|
console,
|
|
@@ -19,6 +21,84 @@ from tusdt_cli.utils import (
|
|
|
19
21
|
unwrap_result,
|
|
20
22
|
)
|
|
21
23
|
|
|
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
|
+
def _replace_name(obj: dict) -> dict:
|
|
59
|
+
if "name" in obj:
|
|
60
|
+
obj["label"] = "::".join(obj.pop("name")) if isinstance(obj["name"], list) else obj.pop("name")
|
|
61
|
+
return obj
|
|
62
|
+
for section in ("constructors", "events", "messages"):
|
|
63
|
+
for idx, c in enumerate(self.metadata_dict["spec"][section]):
|
|
64
|
+
self.metadata_dict["spec"][section][idx]["args"] = [_replace_name(a) for a in c["args"]]
|
|
65
|
+
_replace_name(c)
|
|
66
|
+
|
|
67
|
+
# V2 -> V3: default payable=True for constructors
|
|
68
|
+
if self.metadata_version <= 2:
|
|
69
|
+
for idx, c in enumerate(self.metadata_dict["spec"]["constructors"]):
|
|
70
|
+
c["payable"] = True
|
|
71
|
+
|
|
72
|
+
# V4 -> V5: add module_path and signature_topic to events
|
|
73
|
+
if self.metadata_version <= 4:
|
|
74
|
+
for idx, event in enumerate(self.metadata_dict["spec"]["events"]):
|
|
75
|
+
event["module_path"] = event.get("module_path", "")
|
|
76
|
+
event["signature_topic"] = event.get("signature_topic", "")
|
|
77
|
+
|
|
78
|
+
# Set type offset and prefix
|
|
79
|
+
self._ContractMetadata__type_offset = 0
|
|
80
|
+
if "V0" in self.metadata_dict and tuple(int(x) for x in self.metadata_dict["metadataVersion"].split(".")) < (0, 7, 0):
|
|
81
|
+
self._ContractMetadata__type_offset = 1
|
|
82
|
+
|
|
83
|
+
self.type_string_prefix = f"ink::{self.metadata_dict['source']['hash']}"
|
|
84
|
+
|
|
85
|
+
if self.metadata_version == 0:
|
|
86
|
+
for idx, _ in enumerate(self.metadata_dict["types"]):
|
|
87
|
+
idx += self._ContractMetadata__type_offset
|
|
88
|
+
if idx not in self.type_registry:
|
|
89
|
+
self.type_registry[idx] = self.get_type_string_for_metadata_type(idx)
|
|
90
|
+
else:
|
|
91
|
+
self.substrate.init_runtime()
|
|
92
|
+
portable_registry = self.substrate.runtime_config.create_scale_object("PortableRegistry")
|
|
93
|
+
portable_registry.encode({"types": self.metadata_dict["types"]})
|
|
94
|
+
# --- FIX: extract plain Python list from SCALE-decoded Vec ---
|
|
95
|
+
raw_types = portable_registry["types"]
|
|
96
|
+
if hasattr(raw_types, "value_object"):
|
|
97
|
+
raw_types = raw_types.value_object
|
|
98
|
+
self.substrate.runtime_config.update_from_scale_info_types(raw_types, prefix=self.type_string_prefix)
|
|
99
|
+
|
|
100
|
+
_ContractMetadata._ContractMetadata__convert_to_latest_metadata = _fixed_convert
|
|
101
|
+
|
|
22
102
|
|
|
23
103
|
def _decode_dispatch_error(err: Any) -> str:
|
|
24
104
|
"""Best-effort human-readable description of a DispatchError dict."""
|
|
@@ -25,12 +25,12 @@ NETWORKS: dict[str, dict[str, str]] = {
|
|
|
25
25
|
},
|
|
26
26
|
"testnet": {
|
|
27
27
|
"rpc": "wss://test.finney.opentensor.ai:443",
|
|
28
|
-
"vault_address": "
|
|
29
|
-
"token_address": "
|
|
30
|
-
"auction_address": "
|
|
31
|
-
"oracle_address": "
|
|
32
|
-
"governance_address": "
|
|
33
|
-
"treasury_address": "
|
|
28
|
+
"vault_address": "5FAACG9R4o2mcstDbqTkvm6MdqNdUgg2jtNbLkGsVrmcLnsf",
|
|
29
|
+
"token_address": "5CxK7Xzb7rPFJhpNrgrKGGPCJhUoqK5K5HXBzZvxSe33Aubc",
|
|
30
|
+
"auction_address": "5ELFbobLdXJymCeQAoy4mw78rHBjyzT9Z62K432vFtXkxhBc",
|
|
31
|
+
"oracle_address": "5G2SetMrYwiJHjDobgHVkMM2jcGsNsjABUWU2hxp8JFYQqaj",
|
|
32
|
+
"governance_address": "5EbtC6BFLSfwu9rLdRyjJ8KVuG8TdCeLXmmywqoVLYnTW9Tm",
|
|
33
|
+
"treasury_address": "5FAkjZdGRcpapaE9AYmdcLiBky7fYDFsRmHue6y33jiXaiMh",
|
|
34
34
|
},
|
|
35
35
|
}
|
|
36
36
|
DEFAULT_CONFIG: dict[str, Any] = {
|
|
@@ -138,15 +138,15 @@ def print_info(msg: str) -> None:
|
|
|
138
138
|
console.print(f"[dim]{msg}[/dim]")
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
def
|
|
142
|
-
"""Build a
|
|
143
|
-
return f"https://
|
|
141
|
+
def viewpallet_url(extrinsic_hash: str, network: str = "finney") -> str:
|
|
142
|
+
"""Build a ViewPallet explorer URL for a given extrinsic hash."""
|
|
143
|
+
return f"https://dev-node.tensorusd.com/explorer/transactions/{extrinsic_hash}"
|
|
144
144
|
|
|
145
145
|
|
|
146
146
|
def print_tx_result(result: dict[str, Any], network: str = "finney") -> None:
|
|
147
147
|
"""Print transaction result with taostats explorer link."""
|
|
148
148
|
ex_hash = result.get("extrinsic_hash", "")
|
|
149
|
-
url =
|
|
149
|
+
url = viewpallet_url(ex_hash, network)
|
|
150
150
|
print_dict(
|
|
151
151
|
"Transaction",
|
|
152
152
|
{
|
|
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
|