mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-utils.git
synced 2026-04-21 23:48:06 +00:00
feat: implement Nova Base + Pezkuwi Overlay architecture
- Add Nova utils as git submodule (nova-base/) - Create pezkuwi-overlay/ for Pezkuwi-specific configs - Add merge-chains.py script to combine Nova + Pezkuwi - Add update-all.sh for easy syncing - Add ARCHITECTURE.md documentation This architecture allows automatic sync with Nova's Polkadot ecosystem updates while maintaining Pezkuwi customizations. Pezkuwi chains: 3 (priority) Nova chains: 98 (auto-synced)
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[submodule "nova-base"]
|
||||
path = nova-base
|
||||
url = https://github.com/novasamatech/nova-utils.git
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
# Pezkuwi Wallet Utils - Architecture
|
||||
|
||||
## Nova Base + Pezkuwi Overlay
|
||||
|
||||
This repository uses a **layered architecture** that automatically syncs with Nova Wallet's chain configurations while maintaining Pezkuwi-specific customizations.
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ pezkuwi-wallet-utils │
|
||||
├─────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ nova-base/ (Git Submodule - AUTO SYNC) │
|
||||
│ ├── chains/v22/chains.json → 98+ Polkadot chains │
|
||||
│ ├── icons/ → Chain icons │
|
||||
│ └── ... → Other Nova configs │
|
||||
│ │
|
||||
│ pezkuwi-overlay/ (Manual - Pezkuwi Team) │
|
||||
│ ├── chains/pezkuwi-chains.json → 3 Pezkuwi chains │
|
||||
│ ├── icons/ → Pezkuwi icons │
|
||||
│ ├── types/ → Custom type defs │
|
||||
│ └── config/ → Overrides │
|
||||
│ │
|
||||
│ chains/v22/chains.json (Generated - DO NOT EDIT) │
|
||||
│ └── Merged: Pezkuwi (first) + Nova chains │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
pezkuwi-wallet-utils/
|
||||
├── nova-base/ # Git submodule (READ-ONLY)
|
||||
│ └── chains/v22/chains.json # Nova's official chain configs
|
||||
│
|
||||
├── pezkuwi-overlay/ # Pezkuwi-specific configs
|
||||
│ ├── chains/
|
||||
│ │ └── pezkuwi-chains.json # Pezkuwi, Asset Hub, People
|
||||
│ ├── icons/ # Pezkuwi chain/token icons
|
||||
│ ├── types/ # pezsp_* type definitions
|
||||
│ └── config/ # API overrides, settings
|
||||
│
|
||||
├── chains/ # GENERATED (merged output)
|
||||
│ ├── v22/chains.json # Combined chains
|
||||
│ └── chains.json # Root copy for compatibility
|
||||
│
|
||||
├── scripts/
|
||||
│ ├── merge-chains.py # Merge script
|
||||
│ └── update-all.sh # Full update script
|
||||
│
|
||||
└── icons/, global/, etc. # Other wallet configs
|
||||
```
|
||||
|
||||
## How It Works
|
||||
|
||||
### 1. Nova Base (Automatic)
|
||||
- Nova's `nova-utils` repo is added as a git submodule
|
||||
- Contains all Polkadot ecosystem chains (DOT, KSM, Acala, Moonbeam, etc.)
|
||||
- Updates pulled automatically with `git submodule update --remote`
|
||||
|
||||
### 2. Pezkuwi Overlay (Manual)
|
||||
- Contains ONLY Pezkuwi-specific configurations
|
||||
- Managed by Pezkuwi team
|
||||
- Files here override or extend Nova configs
|
||||
|
||||
### 3. Merge Process
|
||||
- `scripts/merge-chains.py` combines both sources
|
||||
- Pezkuwi chains are placed FIRST (appear at top of wallet)
|
||||
- Nova chains follow after
|
||||
- Output goes to `chains/v22/chains.json`
|
||||
|
||||
## Usage
|
||||
|
||||
### Update Everything (Recommended)
|
||||
```bash
|
||||
./scripts/update-all.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Pull latest Nova changes
|
||||
2. Re-merge chain configs
|
||||
3. Show summary
|
||||
|
||||
### Manual Merge
|
||||
```bash
|
||||
python3 scripts/merge-chains.py --version v22
|
||||
```
|
||||
|
||||
### Update Nova Only
|
||||
```bash
|
||||
git submodule update --remote nova-base
|
||||
```
|
||||
|
||||
## Adding/Modifying Pezkuwi Chains
|
||||
|
||||
Edit `pezkuwi-overlay/chains/pezkuwi-chains.json`:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"chainId": "bb4a61ab...",
|
||||
"name": "Pezkuwi",
|
||||
"nodes": [...],
|
||||
"assets": [...]
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
Then run the merge script.
|
||||
|
||||
## Benefits
|
||||
|
||||
| Aspect | Before | After |
|
||||
|--------|--------|-------|
|
||||
| Chain maintenance | Manual (102 chains) | Auto (3 chains) |
|
||||
| Nova updates | Manual copy-paste | `git submodule update` |
|
||||
| Security patches | Manual tracking | Automatic |
|
||||
| Pezkuwi focus | Diluted | Clear separation |
|
||||
|
||||
## Important Notes
|
||||
|
||||
1. **Never edit `chains/v22/chains.json` directly** - it's auto-generated
|
||||
2. **Pezkuwi changes go in `pezkuwi-overlay/`**
|
||||
3. **Run merge after any changes**
|
||||
4. **Commit submodule updates** to track Nova version
|
||||
|
||||
## CI/CD Integration
|
||||
|
||||
Add to your build pipeline:
|
||||
```yaml
|
||||
- name: Update Nova & Merge
|
||||
run: |
|
||||
git submodule update --init --remote
|
||||
python3 scripts/merge-chains.py --version v22
|
||||
```
|
||||
+9181
-610
File diff suppressed because it is too large
Load Diff
+2305
-2423
File diff suppressed because it is too large
Load Diff
+4
-1
@@ -1,7 +1,10 @@
|
||||
{
|
||||
"popular": [
|
||||
{
|
||||
"url": "https://app.hydration.net/NOVA"
|
||||
"url": "https://explorer.pezkuwichain.io/"
|
||||
},
|
||||
{
|
||||
"url": "https://app.hydration.net/"
|
||||
},
|
||||
{
|
||||
"url": "https://app.bifrost.io/"
|
||||
|
||||
Submodule
+1
Submodule nova-base added at 33f6b9170d
@@ -0,0 +1,186 @@
|
||||
[
|
||||
{
|
||||
"chainId": "bb4a61ab0c4b8c12f5eab71d0c86c482e03a275ecdafee678dea712474d33d75",
|
||||
"name": "Pezkuwi",
|
||||
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/master/icons/chains/Pezkuwi.png",
|
||||
"addressPrefix": 42,
|
||||
"options": [
|
||||
"governance-v2",
|
||||
"proxy",
|
||||
"multisig",
|
||||
"pushSupport"
|
||||
],
|
||||
"nodeSelectionStrategy": "roundRobin",
|
||||
"nodes": [
|
||||
{
|
||||
"url": "wss://rpc.pezkuwichain.io",
|
||||
"name": "Pezkuwi Mainnet"
|
||||
},
|
||||
{
|
||||
"url": "wss://mainnet.pezkuwichain.io",
|
||||
"name": "Pezkuwi Mainnet (Alt)"
|
||||
}
|
||||
],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Pezkuwi Explorer",
|
||||
"extrinsic": "https://explorer.pezkuwichain.io/extrinsic/{value}",
|
||||
"account": "https://explorer.pezkuwichain.io/account/{value}",
|
||||
"event": "https://explorer.pezkuwichain.io/event/{value}"
|
||||
}
|
||||
],
|
||||
"externalApi": {
|
||||
"history": [],
|
||||
"staking": []
|
||||
},
|
||||
"assets": [
|
||||
{
|
||||
"assetId": 0,
|
||||
"symbol": "HEZ",
|
||||
"precision": 12,
|
||||
"name": "Hezkurd",
|
||||
"priceId": null,
|
||||
"staking": [
|
||||
"relaychain",
|
||||
"nomination-pools"
|
||||
],
|
||||
"type": "Native",
|
||||
"icon": "https://pezkuwichain.io/tokens/HEZ.png",
|
||||
"buyProviders": {},
|
||||
"sellProviders": {},
|
||||
"typeExtras": null
|
||||
}
|
||||
],
|
||||
"types": null,
|
||||
"additional": {
|
||||
"themeColor": "#009639",
|
||||
"defaultBlockTimeMillis": 6000
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": "b40985810ab834baaa6a2de423e299d73c675bee874c73a715309996b08828cc",
|
||||
"parentId": "bb4a61ab0c4b8c12f5eab71d0c86c482e03a275ecdafee678dea712474d33d75",
|
||||
"name": "Pezkuwi Asset Hub",
|
||||
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/master/icons/chains/PezkuwiAssetHub.png",
|
||||
"addressPrefix": 42,
|
||||
"options": [
|
||||
"swap-hub",
|
||||
"assethub-fees",
|
||||
"proxy",
|
||||
"multisig"
|
||||
],
|
||||
"nodeSelectionStrategy": "roundRobin",
|
||||
"nodes": [
|
||||
{
|
||||
"url": "wss://asset-hub-rpc.pezkuwichain.io",
|
||||
"name": "Pezkuwi Asset Hub"
|
||||
}
|
||||
],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Pezkuwi Explorer",
|
||||
"extrinsic": "https://explorer.pezkuwichain.io/asset-hub/extrinsic/{value}",
|
||||
"account": "https://explorer.pezkuwichain.io/asset-hub/account/{value}",
|
||||
"event": "https://explorer.pezkuwichain.io/asset-hub/event/{value}"
|
||||
}
|
||||
],
|
||||
"externalApi": {},
|
||||
"assets": [
|
||||
{
|
||||
"assetId": 0,
|
||||
"symbol": "HEZ",
|
||||
"precision": 12,
|
||||
"name": "Hezkurd",
|
||||
"priceId": null,
|
||||
"staking": null,
|
||||
"type": "Native",
|
||||
"icon": "https://pezkuwichain.io/tokens/HEZ.png",
|
||||
"buyProviders": {},
|
||||
"sellProviders": {},
|
||||
"typeExtras": null
|
||||
},
|
||||
{
|
||||
"assetId": 1,
|
||||
"symbol": "PEZ",
|
||||
"precision": 12,
|
||||
"name": "Pezkuwi",
|
||||
"priceId": null,
|
||||
"staking": null,
|
||||
"type": "Statemine",
|
||||
"icon": "https://pezkuwichain.io/tokens/PEZ.png",
|
||||
"buyProviders": {},
|
||||
"sellProviders": {},
|
||||
"typeExtras": {
|
||||
"assetId": "1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"assetId": 1000,
|
||||
"symbol": "USDT",
|
||||
"precision": 6,
|
||||
"name": "Tether USD",
|
||||
"priceId": "tether",
|
||||
"staking": null,
|
||||
"type": "Statemine",
|
||||
"icon": "https://pezkuwichain.io/tokens/wUSDT.png",
|
||||
"buyProviders": {},
|
||||
"sellProviders": {},
|
||||
"typeExtras": {
|
||||
"assetId": "1000"
|
||||
}
|
||||
}
|
||||
],
|
||||
"types": null,
|
||||
"additional": {
|
||||
"themeColor": "#009639",
|
||||
"defaultBlockTimeMillis": 6000
|
||||
}
|
||||
},
|
||||
{
|
||||
"chainId": "3d766dd2530ffb9b530d797c76732ed0b38f2a78f89f75a5c6f0e9232a0bd268",
|
||||
"parentId": "bb4a61ab0c4b8c12f5eab71d0c86c482e03a275ecdafee678dea712474d33d75",
|
||||
"name": "Pezkuwi People",
|
||||
"icon": "https://raw.githubusercontent.com/pezkuwichain/pezkuwi-wallet-utils/master/icons/chains/PezkuwiPeople.png",
|
||||
"addressPrefix": 42,
|
||||
"options": [
|
||||
"proxy",
|
||||
"multisig"
|
||||
],
|
||||
"nodeSelectionStrategy": "roundRobin",
|
||||
"nodes": [
|
||||
{
|
||||
"url": "wss://people-rpc.pezkuwichain.io",
|
||||
"name": "Pezkuwi People Chain"
|
||||
}
|
||||
],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Pezkuwi Explorer",
|
||||
"extrinsic": "https://explorer.pezkuwichain.io/people/extrinsic/{value}",
|
||||
"account": "https://explorer.pezkuwichain.io/people/account/{value}",
|
||||
"event": "https://explorer.pezkuwichain.io/people/event/{value}"
|
||||
}
|
||||
],
|
||||
"externalApi": {},
|
||||
"assets": [
|
||||
{
|
||||
"assetId": 0,
|
||||
"symbol": "HEZ",
|
||||
"precision": 12,
|
||||
"name": "Hezkurd",
|
||||
"priceId": null,
|
||||
"staking": null,
|
||||
"type": "Native",
|
||||
"icon": "https://pezkuwichain.io/tokens/HEZ.png",
|
||||
"buyProviders": {},
|
||||
"sellProviders": {},
|
||||
"typeExtras": null
|
||||
}
|
||||
],
|
||||
"types": null,
|
||||
"additional": {
|
||||
"themeColor": "#009639",
|
||||
"defaultBlockTimeMillis": 6000
|
||||
}
|
||||
}
|
||||
]
|
||||
Executable
+155
@@ -0,0 +1,155 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Pezkuwi Wallet Chain Config Merger
|
||||
|
||||
This script merges Nova's chain configurations with Pezkuwi-specific chains.
|
||||
Nova configs are used as the base, Pezkuwi chains are prepended (priority).
|
||||
|
||||
Usage:
|
||||
python3 merge-chains.py [--version v22] [--output chains/v22/chains.json]
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
# Base paths
|
||||
SCRIPT_DIR = Path(__file__).parent
|
||||
ROOT_DIR = SCRIPT_DIR.parent
|
||||
NOVA_BASE = ROOT_DIR / "nova-base"
|
||||
PEZKUWI_OVERLAY = ROOT_DIR / "pezkuwi-overlay"
|
||||
OUTPUT_DIR = ROOT_DIR / "chains"
|
||||
|
||||
|
||||
def load_json(path: Path) -> list | dict:
|
||||
"""Load JSON file."""
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def save_json(path: Path, data: list | dict, indent: int = 2):
|
||||
"""Save JSON file."""
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, indent=indent, ensure_ascii=False)
|
||||
print(f"✓ Saved: {path}")
|
||||
|
||||
|
||||
def merge_chains(nova_chains: list, pezkuwi_chains: list) -> list:
|
||||
"""
|
||||
Merge Nova and Pezkuwi chains.
|
||||
Pezkuwi chains are prepended to appear first in the wallet.
|
||||
Duplicate chainIds are handled (Pezkuwi takes priority).
|
||||
"""
|
||||
# Create a set of Pezkuwi chain IDs to avoid duplicates
|
||||
pezkuwi_chain_ids = {c['chainId'] for c in pezkuwi_chains}
|
||||
|
||||
# Filter out any Nova chains that might conflict with Pezkuwi
|
||||
nova_filtered = [c for c in nova_chains if c['chainId'] not in pezkuwi_chain_ids]
|
||||
|
||||
# Pezkuwi first, then Nova
|
||||
merged = pezkuwi_chains + nova_filtered
|
||||
|
||||
return merged
|
||||
|
||||
|
||||
def merge_version(version: str = "v22"):
|
||||
"""Merge chains for a specific version."""
|
||||
print(f"\n{'='*50}")
|
||||
print(f"Merging chains for {version}")
|
||||
print(f"{'='*50}")
|
||||
|
||||
# Paths
|
||||
nova_chains_path = NOVA_BASE / "chains" / version / "chains.json"
|
||||
pezkuwi_chains_path = PEZKUWI_OVERLAY / "chains" / "pezkuwi-chains.json"
|
||||
output_path = OUTPUT_DIR / version / "chains.json"
|
||||
|
||||
# Check if Nova chains exist
|
||||
if not nova_chains_path.exists():
|
||||
print(f"⚠ Nova chains not found: {nova_chains_path}")
|
||||
# Try root level chains.json
|
||||
nova_chains_path = NOVA_BASE / "chains" / "chains.json"
|
||||
if not nova_chains_path.exists():
|
||||
print(f"✗ Nova chains not found at root level either")
|
||||
return False
|
||||
|
||||
# Load Nova chains
|
||||
print(f"Loading Nova chains from: {nova_chains_path}")
|
||||
nova_chains = load_json(nova_chains_path)
|
||||
print(f" → {len(nova_chains)} Nova chains loaded")
|
||||
|
||||
# Load Pezkuwi chains
|
||||
if not pezkuwi_chains_path.exists():
|
||||
print(f"⚠ Pezkuwi chains not found: {pezkuwi_chains_path}")
|
||||
pezkuwi_chains = []
|
||||
else:
|
||||
print(f"Loading Pezkuwi chains from: {pezkuwi_chains_path}")
|
||||
pezkuwi_chains = load_json(pezkuwi_chains_path)
|
||||
print(f" → {len(pezkuwi_chains)} Pezkuwi chains loaded")
|
||||
|
||||
# Merge
|
||||
merged = merge_chains(nova_chains, pezkuwi_chains)
|
||||
print(f"\nMerged result: {len(merged)} total chains")
|
||||
print(f" - Pezkuwi chains: {len(pezkuwi_chains)} (priority)")
|
||||
print(f" - Nova chains: {len(merged) - len(pezkuwi_chains)}")
|
||||
|
||||
# Save
|
||||
save_json(output_path, merged)
|
||||
|
||||
# Also copy to root chains.json for compatibility
|
||||
root_output = OUTPUT_DIR / "chains.json"
|
||||
save_json(root_output, merged)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def update_nova_submodule():
|
||||
"""Pull latest Nova changes."""
|
||||
import subprocess
|
||||
print("\nUpdating Nova submodule...")
|
||||
try:
|
||||
result = subprocess.run(
|
||||
["git", "submodule", "update", "--remote", "nova-base"],
|
||||
cwd=ROOT_DIR,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
if result.returncode == 0:
|
||||
print("✓ Nova submodule updated")
|
||||
else:
|
||||
print(f"⚠ Update warning: {result.stderr}")
|
||||
except Exception as e:
|
||||
print(f"✗ Failed to update submodule: {e}")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Merge Nova and Pezkuwi chain configs")
|
||||
parser.add_argument("--version", "-v", default="v22", help="Chain config version (default: v22)")
|
||||
parser.add_argument("--update", "-u", action="store_true", help="Update Nova submodule first")
|
||||
parser.add_argument("--all", "-a", action="store_true", help="Merge all versions")
|
||||
args = parser.parse_args()
|
||||
|
||||
print("╔══════════════════════════════════════════════════╗")
|
||||
print("║ Pezkuwi Wallet Chain Config Merger ║")
|
||||
print("╚══════════════════════════════════════════════════╝")
|
||||
|
||||
# Update Nova if requested
|
||||
if args.update:
|
||||
update_nova_submodule()
|
||||
|
||||
# Merge
|
||||
if args.all:
|
||||
versions = ["v21", "v22"]
|
||||
for v in versions:
|
||||
merge_version(v)
|
||||
else:
|
||||
merge_version(args.version)
|
||||
|
||||
print("\n✓ Merge complete!")
|
||||
print("\nPezkuwi chains will appear FIRST in the wallet.")
|
||||
print("Nova ecosystem chains follow after Pezkuwi.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# Pezkuwi Wallet Utils - Update Script
|
||||
# Updates Nova submodule and re-merges all chain configs
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
echo "╔══════════════════════════════════════════════════╗"
|
||||
echo "║ Pezkuwi Wallet Utils - Full Update ║"
|
||||
echo "╚══════════════════════════════════════════════════╝"
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
# Step 1: Update Nova submodule
|
||||
echo ""
|
||||
echo "Step 1: Updating Nova submodule..."
|
||||
git submodule update --remote nova-base
|
||||
echo "✓ Nova updated to latest"
|
||||
|
||||
# Step 2: Show Nova version info
|
||||
echo ""
|
||||
echo "Step 2: Nova version info..."
|
||||
cd nova-base
|
||||
NOVA_COMMIT=$(git rev-parse --short HEAD)
|
||||
NOVA_DATE=$(git log -1 --format=%ci)
|
||||
echo " Commit: $NOVA_COMMIT"
|
||||
echo " Date: $NOVA_DATE"
|
||||
cd ..
|
||||
|
||||
# Step 3: Merge chains
|
||||
echo ""
|
||||
echo "Step 3: Merging chain configs..."
|
||||
python3 scripts/merge-chains.py --version v22
|
||||
|
||||
# Step 4: Summary
|
||||
echo ""
|
||||
echo "╔══════════════════════════════════════════════════╗"
|
||||
echo "║ Update Complete! ║"
|
||||
echo "╚══════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "Nova version: $NOVA_COMMIT ($NOVA_DATE)"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Review changes: git diff chains/"
|
||||
echo " 2. Test the wallet"
|
||||
echo " 3. Commit: git add -A && git commit -m 'chore: sync with Nova $NOVA_COMMIT'"
|
||||
Reference in New Issue
Block a user