Metadata-Version: 2.4
Name: v_cloud_market_cli_user
Version: 0.12.0
Summary: V Cloud Market Command Tool For User.
Home-page: https://github.com/virtualeconomy/v-cloud-market-cli-user
Author: hvoid-build-block
License: MIT
Keywords: vcloud-market-cli-user
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Requires-Python: >=3.9,<3.13
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: attrs==20.3.0
Requires-Dist: base58==2.0.1
Requires-Dist: certifi==2020.12.5
Requires-Dist: cffi<2.0,>=1.14.5
Requires-Dist: chardet==4.0.0
Requires-Dist: click==7.1.2
Requires-Dist: click-option-group==0.5.2
Requires-Dist: colorama==0.4.4
Requires-Dist: commonmark==0.9.1
Requires-Dist: ecdsa==0.16.1
Requires-Dist: idna==2.10
Requires-Dist: iniconfig==1.1.1
Requires-Dist: packaging==20.9
Requires-Dist: pluggy==0.13.1
Requires-Dist: py==1.10.0
Requires-Dist: pycparser==2.20
Requires-Dist: pycryptodome<4.0,>=3.9.9
Requires-Dist: pyfiglet<2.0,>=1.0.4
Requires-Dist: Pygments==2.7.3
Requires-Dist: PyNaCl<2.0,>=1.4.0
Requires-Dist: pyparsing==2.4.7
Requires-Dist: PyQRCode==1.2.1
Requires-Dist: pytest==6.2.1
Requires-Dist: xeddsa<1.2.0,>=1.0.0
Requires-Dist: PyYAML<7.0,>=5.3.1
Requires-Dist: Random-Word-Generator==1.2
Requires-Dist: requests==2.25.1
Requires-Dist: requests-mock==1.8.0
Requires-Dist: requests-toolbelt==0.9.1
Requires-Dist: rich==9.5.1
Requires-Dist: six==1.15.0
Requires-Dist: texttable==1.6.3
Requires-Dist: toml==0.10.2
Requires-Dist: typing-extensions==3.7.4.3
Requires-Dist: urllib3<2.0,>=1.26.20
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# V Cloud Market Command Tool For User

## Install

```
pip install v-cloud-market-cli-user
```

## Usage

### Interactive Mode

Run with no arguments to start the interactive TUI:

```
vcloud            # mainnet
vcloud -t         # testnet
```

### Non-Interactive CLI

All subcommands output JSON to stdout for scripting and automation.

```bash
# Browse the marketplace (no wallet needed)
vcloud market list-providers
vcloud market list-categories --provider v-kube-service
vcloud market list-services --provider v-kube-service --category Container-Service
vcloud market get-service <SERVICE_ID>
vcloud market get-provider <PROVIDER_NAME>

# Order management (wallet needed)
vcloud order list [--status OrderPending|OrderPaid|OrderFiled]
vcloud order get <ORDER_ID>
vcloud order create --service-id <ID> --duration <HOURS> --options '{"key":"val"}'
vcloud order pay <ORDER_ID> --amount <N> [--currency-index <N>]
vcloud order currencies

# Wallet operations (wallet needed)
vcloud wallet info [--balance-detail]
vcloud wallet balance
vcloud wallet pay --recipient <ADDR> --amount <N> [--attachment <TEXT>]

# Service management (wallet needed)
vcloud service list [--status ServiceRunning|ServicePending|ServiceDone|ServiceAbort]
vcloud service get <USER_SERVICE_ID> --provider <NAME>
vcloud service status <USER_SERVICE_ID> --provider <NAME>
vcloud service deploy <USER_SERVICE_ID> --provider <NAME> --config-file <PATH>
vcloud service restart <USER_SERVICE_ID> --provider <NAME>
vcloud service renew <USER_SERVICE_ID> [<ID>...] --duration <HOURS> --amount <N>
vcloud service refund <USER_SERVICE_ID> [<ID>...]
```

#### Global Options

| Option | Description |
|--------|-------------|
| `-t, --testnet` | Use testnet instead of mainnet |
| `--address-index N` | Wallet address index (1-based, default 1) |

#### Authentication

For password-protected wallets, set the `VCLOUD_PASSWORD` environment variable:

```bash
export VCLOUD_PASSWORD=yourpassword
vcloud order list
```

If the wallet has no password, no environment variable is needed.

#### Piping and Scripting

Output is JSON, so it works with `jq` and other tools:

```bash
# Get the first provider's name
vcloud market list-providers | jq '.list[0].name'

# Create an order and capture the order ID
ORDER_ID=$(vcloud order create --service-id <ID> --duration 1 --options '{}' | jq -r '.id')

# Pay for it
vcloud order pay "$ORDER_ID" --amount 1.76 --currency-index 1
```

#### Deployment Config File

The `service deploy` command takes a JSON config file. Example for deploying nginx:

```json
{
  "containers": [
    {
      "name": "nginx",
      "imageName": "nginx:latest",
      "resourceUnit": 1,
      "ports": [{"containerPort": 80, "protocol": "TCP"}],
      "envs": [],
      "mountPath": "",
      "command": [],
      "args": [],
      "configMountPath": "",
      "config": ""
    }
  ],
  "pvtLogin": [{"username": "", "password": ""}]
}
```

## Wallet Functions

- Create new wallet
- Reset wallet
- Recover wallet with seed
- Check balance of address in the wallet
- Export wallet addresses to csv file

## Market Services

- Explore service provider information
- Explore service category information
- Explore service type information
- Make order with service type id

## Order Services

- Pay the order with VSYS
- Check the status of order
- View order list
- View specific order information
- Refund an order
- View refundable order list

## User Service

- Explore running user services
- Explore usable user services
    - The status of usable user services are: ServicePending or ServiceRunning.
    - This function is to get secret information from service provider.
- Explore expired user services

## Run CLI in Local

Install dependencies with `uv` (preferred):

```shell
uv venv && source .venv/bin/activate
uv pip install -r requirements.txt && uv pip install -e .
```

Or with `virtualenv`:

```shell
pip3 install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt && pip install -e .
```

Run in mainnet:

```
python3 market_place_cli/use_main_interface.py
```

Run in testnet:

```
python3 market_place_cli/use_main_interface.py -t
```

Exit virtual environment:

```
deactivate
```
