tusdt-cli 0.2.1__tar.gz → 0.2.3__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.
Files changed (26) hide show
  1. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/PKG-INFO +1 -1
  2. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/pyproject.toml +1 -1
  3. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/__init__.py +1 -1
  4. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/client.py +87 -0
  5. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/.gitignore +0 -0
  6. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/LICENSE +0 -0
  7. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/README.md +0 -0
  8. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/requirements.txt +0 -0
  9. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/abi/tusdt_auction.json +0 -0
  10. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/abi/tusdt_erc20.json +0 -0
  11. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/abi/tusdt_governance.json +0 -0
  12. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/abi/tusdt_oracle.json +0 -0
  13. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/abi/tusdt_treasury.json +0 -0
  14. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/abi/tusdt_vault.json +0 -0
  15. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/cli.py +0 -0
  16. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/commands/__init__.py +0 -0
  17. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/commands/auction.py +0 -0
  18. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/commands/governance.py +0 -0
  19. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/commands/oracle.py +0 -0
  20. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/commands/token.py +0 -0
  21. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/commands/treasury.py +0 -0
  22. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/commands/vault.py +0 -0
  23. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/config.py +0 -0
  24. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/utils.py +0 -0
  25. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/src/tusdt_cli/wallet.py +0 -0
  26. {tusdt_cli-0.2.1 → tusdt_cli-0.2.3}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tusdt-cli
3
- Version: 0.2.1
3
+ Version: 0.2.3
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "tusdt-cli"
7
- version = "0.2.1"
7
+ version = "0.2.3"
8
8
  description = "CLI for interacting with the TUSDT ink! smart contract system on subtensor(bittensor)"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -1,3 +1,3 @@
1
1
  """TUSDT CLI - Command-line interface for the TUSDT ink! smart contract system."""
2
2
 
3
- __version__ = "0.2.1"
3
+ __version__ = "0.2.3"
@@ -9,6 +9,7 @@ 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
12
13
  from substrateinterface.exceptions import ContractReadFailedException
13
14
 
14
15
  from tusdt_cli.utils import (
@@ -20,6 +21,92 @@ from tusdt_cli.utils import (
20
21
  )
21
22
 
22
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
+
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
+ if "V0" in self.metadata_dict and tuple(
85
+ int(x) for x in self.metadata_dict["metadataVersion"].split(".")
86
+ ) < (0, 7, 0):
87
+ self._ContractMetadata__type_offset = 1
88
+
89
+ self.type_string_prefix = f"ink::{self.metadata_dict['source']['hash']}"
90
+
91
+ if self.metadata_version == 0:
92
+ for idx, _ in enumerate(self.metadata_dict["types"]):
93
+ idx += self._ContractMetadata__type_offset
94
+ if idx not in self.type_registry:
95
+ self.type_registry[idx] = self.get_type_string_for_metadata_type(idx)
96
+ else:
97
+ self.substrate.init_runtime()
98
+ portable_registry = self.substrate.runtime_config.create_scale_object("PortableRegistry")
99
+ portable_registry.encode({"types": self.metadata_dict["types"]})
100
+ # --- FIX: extract plain Python list from SCALE-decoded Vec ---
101
+ raw_types = portable_registry["types"]
102
+ if hasattr(raw_types, "value_object"):
103
+ raw_types = raw_types.value_object
104
+ self.substrate.runtime_config.update_from_scale_info_types(raw_types, prefix=self.type_string_prefix)
105
+
106
+
107
+ _ContractMetadata._ContractMetadata__convert_to_latest_metadata = _fixed_convert
108
+
109
+
23
110
  def _decode_dispatch_error(err: Any) -> str:
24
111
  """Best-effort human-readable description of a DispatchError dict."""
25
112
  if isinstance(err, dict):
File without changes
File without changes
File without changes
File without changes
File without changes