tusdt-cli 0.1.0__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.
@@ -0,0 +1,5 @@
1
+ .venv/
2
+ __pycache__/
3
+ dist/
4
+ build/
5
+ *.egg-info/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 tensorusd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,223 @@
1
+ Metadata-Version: 2.4
2
+ Name: tusdt-cli
3
+ Version: 0.1.0
4
+ Summary: CLI for interacting with the TUSDT ink! smart contract system on subtensor(bittensor)
5
+ Project-URL: Homepage, https://github.com/tensorusd/tusdt-cli
6
+ Project-URL: Repository, https://github.com/tensorusd/tusdt-cli
7
+ Project-URL: Issues, https://github.com/tensorusd/tusdt-cli/issues
8
+ Author-email: tensorusd <admin@tensorusd.com>, benup <benup211@gmail.com>
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Classifier: Environment :: Console
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: click>=8.1.0
17
+ Requires-Dist: pynacl>=1.5.0
18
+ Requires-Dist: rich>=13.0.0
19
+ Requires-Dist: substrate-interface>=1.7.0
20
+ Description-Content-Type: text/markdown
21
+
22
+ # tusdt-cli
23
+
24
+ Command-line interface for interacting with the **TUSDT** ink! smart-contract
25
+ system (Vault, Auction, ERC-20 Token, Oracle) on the Bittensor network.
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ cd tusdt-cli
31
+ python3 -m venv .venv
32
+ source .venv/bin/activate
33
+ pip install -e .
34
+ ```
35
+
36
+ ## Quickstart
37
+
38
+ The CLI comes pre-configured with the Finney RPC endpoint, contract addresses,
39
+ and bundled ABI metadata. No upfront configuration is required — pass
40
+ `--wallet-name` on any command that needs signing.
41
+
42
+ ### 1. List wallets
43
+
44
+ ```bash
45
+ tusdt wallet list
46
+ ```
47
+
48
+ ### 2. Vault operations
49
+
50
+ Anywhere an address is expected you can pass a **wallet name** instead and the
51
+ CLI resolves the SS58 address from `coldkeypub.txt` automatically.
52
+
53
+ ```bash
54
+ # Create a vault (prompts for coldkey password)
55
+ tusdt vault create --amount 10 --wallet-name MyWallet
56
+
57
+ # View your vault (no password needed – reads coldkeypub.txt)
58
+ tusdt vault info MyWallet 0
59
+ # …or via --wallet-name
60
+ tusdt vault info --wallet-name MyWallet 0
61
+
62
+ # List all vaults for a wallet
63
+ tusdt vault list MyWallet
64
+ # …or via --wallet-name
65
+ tusdt vault list --wallet-name MyWallet
66
+
67
+ # Add more collateral
68
+ tusdt vault add-collateral 0 --amount 5 --wallet-name MyWallet
69
+
70
+ # Borrow against collateral
71
+ tusdt vault borrow 0 100 --wallet-name MyWallet
72
+
73
+ # Repay borrowed tokens
74
+ tusdt vault repay 0 50 --wallet-name MyWallet
75
+
76
+ # Release collateral
77
+ tusdt vault release-collateral 0 2 --wallet-name MyWallet
78
+
79
+ # Check max borrow capacity
80
+ tusdt vault max-borrow MyWallet 0
81
+ tusdt vault max-borrow --wallet-name MyWallet 0
82
+
83
+ # Check collateral value
84
+ tusdt vault collateral-value MyWallet 0
85
+ tusdt vault collateral-value --wallet-name MyWallet 0
86
+ ```
87
+
88
+ ### 3. Token operations
89
+
90
+ ```bash
91
+ # Check balance (wallet name or SS58 address)
92
+ tusdt token balance MyWallet
93
+ tusdt token balance --wallet-name MyWallet
94
+
95
+ # Transfer tokens
96
+ tusdt token transfer RecipientWallet 100 --wallet-name MyWallet
97
+
98
+ # Approve spender
99
+ tusdt token approve SpenderWallet 1000 --wallet-name MyWallet
100
+
101
+ # Check allowance (both args accept wallet names)
102
+ tusdt token allowance MyWallet SpenderWallet
103
+ ```
104
+
105
+ ### 4. Auction operations
106
+
107
+ ```bash
108
+ # List active liquidation auctions
109
+ tusdt auction list-active
110
+
111
+ # View auction details
112
+ tusdt auction info 0
113
+
114
+ # Place a bid (with optional hotkey for metadata)
115
+ tusdt auction bid 0 500 --wallet-name MyWallet --wallet-hotkey default
116
+
117
+ # Finalize a completed auction
118
+ tusdt auction finalize 0 --wallet-name MyWallet
119
+
120
+ # Withdraw refund for a non-winning bid
121
+ tusdt auction withdraw-refund 0 1 --wallet-name MyWallet
122
+
123
+ # Check your bid (resolves address from coldkeypub.txt, no password)
124
+ tusdt auction my-bid 0 --wallet-name MyWallet
125
+ ```
126
+
127
+ ### 5. Oracle operations
128
+
129
+ ```bash
130
+ # View latest price
131
+ tusdt oracle price
132
+
133
+ # View current round
134
+ tusdt oracle round
135
+ ```
136
+
137
+ ## Network selection
138
+
139
+ Two networks are available: **finney** (mainnet, default) and **testnet**.
140
+
141
+ ```bash
142
+ # Per-command override (not saved)
143
+ tusdt vault list MyWallet --network testnet
144
+ tusdt oracle price --network testnet
145
+
146
+ # Save as default
147
+ tusdt config set --network testnet
148
+
149
+ # Switch back
150
+ tusdt config set --network finney
151
+ ```
152
+
153
+ ## Configuration
154
+
155
+ Configuration is stored in `~/.tusdt-cli/config.json`.
156
+ Most users won't need to edit it — `--wallet-name` and `--network` on
157
+ each command cover the common cases.
158
+
159
+ ```bash
160
+ # View current config
161
+ tusdt config show
162
+
163
+ # Pre-configure a wallet (avoids passing --wallet-name every time)
164
+ tusdt config set --wallet-name MyWallet
165
+
166
+ # Use a mnemonic seed phrase instead
167
+ tusdt config set --signer "word1 word2 word3 ... word12"
168
+
169
+ # Override contract addresses or RPC
170
+ tusdt config set --rpc wss://custom-endpoint:443
171
+ tusdt config set --vault 5Hh...
172
+ ```
173
+
174
+ | Key | Description | Default |
175
+ |--------------------|--------------------------------------|------------------------------------------------------|
176
+ | `network` | Active network preset | `finney` |
177
+ | `rpc` | WebSocket RPC endpoint | `wss://entrypoint-finney.opentensor.ai:443` |
178
+ | `vault_address` | Vault contract SS58 address | `5HhJKNf7XjmppAyPeBKN5xQk6joNMWHTnEgup4msxfcKcYKp` |
179
+ | `token_address` | Token (ERC-20) contract SS58 address | `5GGqBAYWW84wvdTeZGM68dHng1UaWTxxc4ZzFhuQXF9zqK9J` |
180
+ | `auction_address` | Auction contract SS58 address | `5Cninzamn4GVi1J1St578ENyNEDrMi5hXucY7rUj1WzREgAt` |
181
+ | `oracle_address` | Oracle contract SS58 address | `5FqciR795agP8wEojv2TRegwN757EJURyzjDREUvzCX3cqZS` |
182
+ | `vault_metadata` | Path to vault ABI JSON | bundled |
183
+ | `token_metadata` | Path to token ABI JSON | bundled |
184
+ | `auction_metadata` | Path to auction ABI JSON | bundled |
185
+ | `oracle_metadata` | Path to oracle ABI JSON | bundled |
186
+ | `signer` | Mnemonic seed phrase or keyfile path | — |
187
+ | `wallet_name` | Default bittensor wallet name | — |
188
+ | `wallet_path` | Path to wallets directory | `~/.bittensor/wallets` |
189
+ | `decimals` | Decimal places for balance display | `9` |
190
+
191
+ ## Networks
192
+
193
+ | Network | RPC endpoint |
194
+ |-----------|---------------------------------------------|
195
+ | `finney` | `wss://entrypoint-finney.opentensor.ai:443` |
196
+ | `testnet` | `wss://test.finney.opentensor.ai:443` |
197
+
198
+ ## Transaction output
199
+
200
+ All write operations (create vault, borrow, transfer, bid, etc.) display a
201
+ progress spinner and, on success, print the extrinsic hash with a
202
+ [Taostats](https://taostats.io) explorer link:
203
+
204
+ ```
205
+ Finalized
206
+ ┌─ Transaction ──────────────────────────────────────────────────┐
207
+ │ Extrinsic: 0xabc123… │
208
+ │ Block: 0xdef456… │
209
+ │ Explorer: https://taostats.io/hash/0xabc…?network=finney │
210
+ └────────────────────────────────────────────────────────────────┘
211
+ ```
212
+
213
+ The `network` parameter in the URL matches the `--network` flag (or the
214
+ configured default).
215
+
216
+ ## Repositories
217
+
218
+ - TUSDT smart contracts: https://github.com/TensorUSD/TUSDT-SmartContract.git
219
+ - tusdt-cli repository: https://github.com/TensorUSD/tusdt-cli
220
+
221
+ ## License
222
+
223
+ MIT
@@ -0,0 +1,202 @@
1
+ # tusdt-cli
2
+
3
+ Command-line interface for interacting with the **TUSDT** ink! smart-contract
4
+ system (Vault, Auction, ERC-20 Token, Oracle) on the Bittensor network.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ cd tusdt-cli
10
+ python3 -m venv .venv
11
+ source .venv/bin/activate
12
+ pip install -e .
13
+ ```
14
+
15
+ ## Quickstart
16
+
17
+ The CLI comes pre-configured with the Finney RPC endpoint, contract addresses,
18
+ and bundled ABI metadata. No upfront configuration is required — pass
19
+ `--wallet-name` on any command that needs signing.
20
+
21
+ ### 1. List wallets
22
+
23
+ ```bash
24
+ tusdt wallet list
25
+ ```
26
+
27
+ ### 2. Vault operations
28
+
29
+ Anywhere an address is expected you can pass a **wallet name** instead and the
30
+ CLI resolves the SS58 address from `coldkeypub.txt` automatically.
31
+
32
+ ```bash
33
+ # Create a vault (prompts for coldkey password)
34
+ tusdt vault create --amount 10 --wallet-name MyWallet
35
+
36
+ # View your vault (no password needed – reads coldkeypub.txt)
37
+ tusdt vault info MyWallet 0
38
+ # …or via --wallet-name
39
+ tusdt vault info --wallet-name MyWallet 0
40
+
41
+ # List all vaults for a wallet
42
+ tusdt vault list MyWallet
43
+ # …or via --wallet-name
44
+ tusdt vault list --wallet-name MyWallet
45
+
46
+ # Add more collateral
47
+ tusdt vault add-collateral 0 --amount 5 --wallet-name MyWallet
48
+
49
+ # Borrow against collateral
50
+ tusdt vault borrow 0 100 --wallet-name MyWallet
51
+
52
+ # Repay borrowed tokens
53
+ tusdt vault repay 0 50 --wallet-name MyWallet
54
+
55
+ # Release collateral
56
+ tusdt vault release-collateral 0 2 --wallet-name MyWallet
57
+
58
+ # Check max borrow capacity
59
+ tusdt vault max-borrow MyWallet 0
60
+ tusdt vault max-borrow --wallet-name MyWallet 0
61
+
62
+ # Check collateral value
63
+ tusdt vault collateral-value MyWallet 0
64
+ tusdt vault collateral-value --wallet-name MyWallet 0
65
+ ```
66
+
67
+ ### 3. Token operations
68
+
69
+ ```bash
70
+ # Check balance (wallet name or SS58 address)
71
+ tusdt token balance MyWallet
72
+ tusdt token balance --wallet-name MyWallet
73
+
74
+ # Transfer tokens
75
+ tusdt token transfer RecipientWallet 100 --wallet-name MyWallet
76
+
77
+ # Approve spender
78
+ tusdt token approve SpenderWallet 1000 --wallet-name MyWallet
79
+
80
+ # Check allowance (both args accept wallet names)
81
+ tusdt token allowance MyWallet SpenderWallet
82
+ ```
83
+
84
+ ### 4. Auction operations
85
+
86
+ ```bash
87
+ # List active liquidation auctions
88
+ tusdt auction list-active
89
+
90
+ # View auction details
91
+ tusdt auction info 0
92
+
93
+ # Place a bid (with optional hotkey for metadata)
94
+ tusdt auction bid 0 500 --wallet-name MyWallet --wallet-hotkey default
95
+
96
+ # Finalize a completed auction
97
+ tusdt auction finalize 0 --wallet-name MyWallet
98
+
99
+ # Withdraw refund for a non-winning bid
100
+ tusdt auction withdraw-refund 0 1 --wallet-name MyWallet
101
+
102
+ # Check your bid (resolves address from coldkeypub.txt, no password)
103
+ tusdt auction my-bid 0 --wallet-name MyWallet
104
+ ```
105
+
106
+ ### 5. Oracle operations
107
+
108
+ ```bash
109
+ # View latest price
110
+ tusdt oracle price
111
+
112
+ # View current round
113
+ tusdt oracle round
114
+ ```
115
+
116
+ ## Network selection
117
+
118
+ Two networks are available: **finney** (mainnet, default) and **testnet**.
119
+
120
+ ```bash
121
+ # Per-command override (not saved)
122
+ tusdt vault list MyWallet --network testnet
123
+ tusdt oracle price --network testnet
124
+
125
+ # Save as default
126
+ tusdt config set --network testnet
127
+
128
+ # Switch back
129
+ tusdt config set --network finney
130
+ ```
131
+
132
+ ## Configuration
133
+
134
+ Configuration is stored in `~/.tusdt-cli/config.json`.
135
+ Most users won't need to edit it — `--wallet-name` and `--network` on
136
+ each command cover the common cases.
137
+
138
+ ```bash
139
+ # View current config
140
+ tusdt config show
141
+
142
+ # Pre-configure a wallet (avoids passing --wallet-name every time)
143
+ tusdt config set --wallet-name MyWallet
144
+
145
+ # Use a mnemonic seed phrase instead
146
+ tusdt config set --signer "word1 word2 word3 ... word12"
147
+
148
+ # Override contract addresses or RPC
149
+ tusdt config set --rpc wss://custom-endpoint:443
150
+ tusdt config set --vault 5Hh...
151
+ ```
152
+
153
+ | Key | Description | Default |
154
+ |--------------------|--------------------------------------|------------------------------------------------------|
155
+ | `network` | Active network preset | `finney` |
156
+ | `rpc` | WebSocket RPC endpoint | `wss://entrypoint-finney.opentensor.ai:443` |
157
+ | `vault_address` | Vault contract SS58 address | `5HhJKNf7XjmppAyPeBKN5xQk6joNMWHTnEgup4msxfcKcYKp` |
158
+ | `token_address` | Token (ERC-20) contract SS58 address | `5GGqBAYWW84wvdTeZGM68dHng1UaWTxxc4ZzFhuQXF9zqK9J` |
159
+ | `auction_address` | Auction contract SS58 address | `5Cninzamn4GVi1J1St578ENyNEDrMi5hXucY7rUj1WzREgAt` |
160
+ | `oracle_address` | Oracle contract SS58 address | `5FqciR795agP8wEojv2TRegwN757EJURyzjDREUvzCX3cqZS` |
161
+ | `vault_metadata` | Path to vault ABI JSON | bundled |
162
+ | `token_metadata` | Path to token ABI JSON | bundled |
163
+ | `auction_metadata` | Path to auction ABI JSON | bundled |
164
+ | `oracle_metadata` | Path to oracle ABI JSON | bundled |
165
+ | `signer` | Mnemonic seed phrase or keyfile path | — |
166
+ | `wallet_name` | Default bittensor wallet name | — |
167
+ | `wallet_path` | Path to wallets directory | `~/.bittensor/wallets` |
168
+ | `decimals` | Decimal places for balance display | `9` |
169
+
170
+ ## Networks
171
+
172
+ | Network | RPC endpoint |
173
+ |-----------|---------------------------------------------|
174
+ | `finney` | `wss://entrypoint-finney.opentensor.ai:443` |
175
+ | `testnet` | `wss://test.finney.opentensor.ai:443` |
176
+
177
+ ## Transaction output
178
+
179
+ All write operations (create vault, borrow, transfer, bid, etc.) display a
180
+ progress spinner and, on success, print the extrinsic hash with a
181
+ [Taostats](https://taostats.io) explorer link:
182
+
183
+ ```
184
+ Finalized
185
+ ┌─ Transaction ──────────────────────────────────────────────────┐
186
+ │ Extrinsic: 0xabc123… │
187
+ │ Block: 0xdef456… │
188
+ │ Explorer: https://taostats.io/hash/0xabc…?network=finney │
189
+ └────────────────────────────────────────────────────────────────┘
190
+ ```
191
+
192
+ The `network` parameter in the URL matches the `--network` flag (or the
193
+ configured default).
194
+
195
+ ## Repositories
196
+
197
+ - TUSDT smart contracts: https://github.com/TensorUSD/TUSDT-SmartContract.git
198
+ - tusdt-cli repository: https://github.com/TensorUSD/tusdt-cli
199
+
200
+ ## License
201
+
202
+ MIT
@@ -0,0 +1,40 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "tusdt-cli"
7
+ version = "0.1.0"
8
+ description = "CLI for interacting with the TUSDT ink! smart contract system on subtensor(bittensor)"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.10"
12
+ authors = [
13
+ { name = "tensorusd", email = "admin@tensorusd.com" },
14
+ { name = "benup", email = "benup211@gmail.com" }
15
+ ]
16
+
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Operating System :: OS Independent",
21
+ "Environment :: Console",
22
+ ]
23
+
24
+ dependencies = [
25
+ "click>=8.1.0",
26
+ "substrate-interface>=1.7.0",
27
+ "rich>=13.0.0",
28
+ "pynacl>=1.5.0",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/tensorusd/tusdt-cli"
33
+ Repository = "https://github.com/tensorusd/tusdt-cli"
34
+ Issues = "https://github.com/tensorusd/tusdt-cli/issues"
35
+
36
+ [project.scripts]
37
+ tusdt = "tusdt_cli.cli:main"
38
+
39
+ [tool.hatch.build.targets.wheel]
40
+ packages = ["src/tusdt_cli"]
@@ -0,0 +1,3 @@
1
+ """TUSDT CLI - Command-line interface for the TUSDT ink! smart contract system."""
2
+
3
+ __version__ = "0.1.0"