Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
121 changes: 96 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,30 +132,105 @@ Note: Cosmos network configurations are now automatically fetched from the [Cosm
- Infura: https://infura.io/
- Or other RPC providers

## CI/CD
## Sample Output

The project uses GitHub Actions for continuous integration and deployment:
Running `cosmoscope` produces a detailed breakdown of your portfolio across different networks and asset types:

- Automated testing and code coverage reporting
- Linting with golangci-lint
- Multi-platform builds (Linux, macOS, Windows)
- Automatic releases on tags
- Coverage reporting with Codecov

### Release Process

To create a new release:

```bash
git tag v1.0.0
git push origin v1.0.0
```
╔════════════════════════════════════════════════════════════╗
║ ║
║ BALANCES REPORT - 2024-03-12 15:04:05 ║
║ ║
╚════════════════════════════════════════════════════════════╝

Detailed Balance View:
+----------------------+-----------------+----------+---------------+--------------+
| ACCOUNT | NETWORK | TOKEN | AMOUNT | USD VALUE |
+----------------------+-----------------+----------+---------------+--------------+
| cosmos1abc...def | cosmos-bank | ATOM | 520.4530 | $5,204.53 |
| cosmos1abc...def | cosmos-staking | ATOM | 2500.0000 | $25,000.00 |
| cosmos1abc...def | cosmos-rewards | ATOM | 3.4520 | $34.52 |
| osmo1xyz...789 | osmosis-bank | OSMO | 1200.0000 | $2,400.00 |
| osmo1xyz...789 | osmosis-bank | ATOM | 150.0000 | $1,500.00 |
| osmo1xyz...789 | osmosis-staking | OSMO | 5000.0000 | $10,000.00 |
| stars1pqr...456 | stargaze-bank | STARS | 15000.0000 | $1,500.00 |
| evmos1mno...123 | evmos-staking | EVMOS | 1000.0000 | $2,500.00 |
| 0x123...789 | ethereum | ETH | 1.5000 | $4,500.00 |
| 0x123...789 | polygon | MATIC | 10000.0000 | $10,000.00 |
| Cold Storage | Fixed Balance | BTC | 0.7500 | $30,000.00 |
| Exchange | Fixed Balance | ETH | 2.0000 | $6,000.00 |
+----------------------+-----------------+----------+---------------+--------------+

Portfolio Summary:
+----------+---------------+--------------+----------+
| TOKEN | AMOUNT | USD VALUE | SHARE % |
+----------+---------------+--------------+----------+
| ATOM | 3173.9050 | $31,739.05 | 31.74% |
| OSMO | 6200.0000 | $12,400.00 | 12.40% |
| ETH | 3.5000 | $10,500.00 | 10.50% |
| MATIC | 10000.0000 | $10,000.00 | 10.00% |
| BTC | 0.7500 | $30,000.00 | 30.00% |
| EVMOS | 1000.0000 | $2,500.00 | 2.50% |
| STARS | 15000.0000 | $1,500.00 | 1.50% |
+----------+---------------+--------------+----------+
Total Portfolio Value: $98,639.05

Network Distribution:
+-------------------+--------------+----------+
| NETWORK | USD VALUE | SHARE % |
+-------------------+--------------+----------+
| Cosmos Hub | $31,739.05 | 32.18% |
| Osmosis | $12,400.00 | 12.57% |
| Ethereum | $10,500.00 | 10.64% |
| Polygon | $10,000.00 | 10.14% |
| Fixed Balance | $36,000.00 | 36.50% |
| Evmos | $2,500.00 | 2.53% |
| Stargaze | $1,500.00 | 1.52% |
+-------------------+--------------+----------+

Asset Types:
+------------+--------------+----------+
| TYPE | USD VALUE | SHARE % |
+------------+--------------+----------+
| Bank | $15,104.53 | 15.31% |
| Staking | $47,500.00 | 48.15% |
| Rewards | $34.52 | 0.04% |
| Fixed | $36,000.00 | 36.50% |
+------------+--------------+----------+
```

## Features & Roadmap

### Current Features ✅
- **Cosmos Ecosystem**
- Auto-configuration using Chain Registry
- Bank, staking, and reward balances
- IBC token resolution
- **EVM Networks**
- Ethereum & compatible chains
- Native token balances
- Custom RPC support
- **Portfolio Analytics**
- Real-time USD values
- Network distribution
- Asset type breakdown

### Coming Soon 🚧
- **Solana Integration**
- Native SOL & SPL tokens
- Stake accounts
- Program-owned accounts
- **Enhancements**
- NFT tracking
- DeFi positions

### Future Plans 📋
- Additional L1 blockchains
- CSV export
- Custom grouping
- Database support for snapshots
- Historical snapshots

This will trigger the CI pipeline to:
1. Run tests and coverage
2. Build binaries for all platforms
3. Create a GitHub release
4. Upload binaries to the release

## Contributing

Expand All @@ -164,8 +239,4 @@ This will trigger the CI pipeline to:
3. Run tests and linting (`make test lint`)
4. Commit your changes (`git commit -m 'Add amazing feature'`)
5. Push to the branch (`git push origin feature/amazing-feature`)
6. Open a Pull Request

## License

This project is licensed under the MIT License - see the LICENSE file for details
6. Open a Pull Request
17 changes: 0 additions & 17 deletions internal/cosmos/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,20 +348,3 @@ func getActiveEndpoint(endpoints []RestEndpoint) string {

return ""
}

func isValidJSONResponse(resp *http.Response, body []byte) bool {
contentType := resp.Header.Get("Content-Type")
if !strings.Contains(strings.ToLower(contentType), "application/json") {
return false
}

// Check if the response looks like HTML
if strings.Contains(strings.ToLower(string(body)), "<!doctype html") ||
strings.Contains(strings.ToLower(string(body)), "<html") {
return false
}

// Try to parse as JSON
var js json.RawMessage
return json.Unmarshal(body, &js) == nil
}
6 changes: 4 additions & 2 deletions internal/portfolio/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ func PrintHeader() {
headerColor.Printf(" ║\n")
headerColor.Printf("║ %s", strings.Repeat(" ", 59))
headerColor.Println("║")
headerColor.Println("╚════════════════════════════════════════════════════════════╝\n")
headerColor.Println("╚════════════════════════════════════════════════════════════╝")
fmt.Println("")
}

func PrintFooter(balances []Balance) {
Expand All @@ -66,7 +67,8 @@ func PrintFooter(balances []Balance) {
headerColor.Printf(" ║\n")
headerColor.Printf("║ %s", strings.Repeat(" ", 59))
headerColor.Println("║")
headerColor.Println("╚════════════════════════════════════════════════════════════╝\n")
headerColor.Println("╚════════════════════════════════════════════════════════════╝")
fmt.Println("")
}

func printDetailedView(balances []Balance) {
Expand Down
Loading