Skip to content

Commit 3bcf2b0

Browse files
authored
Merge pull request #189 from hyperweb-io/solana-refactor-new
Solana refactor new
2 parents 31055b8 + b424a32 commit 3bcf2b0

File tree

233 files changed

+22242
-3194
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+22242
-3194
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: Run Solana Unit Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- solana
7+
workflow_dispatch:
8+
9+
jobs:
10+
networks-solana:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Repository 📝
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: "20.x"
21+
cache: "yarn"
22+
23+
- name: Install Dependencies
24+
run: yarn install --frozen-lockfile
25+
26+
- name: Build Project
27+
run: yarn build
28+
29+
- name: Set Up Starship Infrastructure
30+
id: starship-infra
31+
uses: hyperweb-io/[email protected]
32+
with:
33+
config: networks/solana/starship/configs/config.yaml
34+
35+
- name: Port-forward and run Solana unit tests
36+
run: |
37+
set -euxo pipefail
38+
# Discover namespace
39+
NS="${{ steps.starship-infra.outputs.namespace }}"
40+
if [ -z "${NS}" ]; then
41+
NS=$(kubectl get pods -A -o jsonpath='{range .items[*]}{.metadata.namespace}{" "}{.metadata.name}{"\n"}{end}' | awk '/solana-genesis/{print $1; exit}' || true)
42+
fi
43+
echo "Using namespace: ${NS:-<unknown>}"
44+
45+
echo "Checking pods status..."
46+
kubectl get pods -A -o wide || true
47+
if [ -n "${NS}" ]; then
48+
kubectl get pods -n "$NS" -o wide || true
49+
(kubectl wait --for=condition=Ready pod -l app=solana-genesis -n "$NS" --timeout=300s || \
50+
kubectl wait --for=condition=Ready pod -l app.kubernetes.io/name=solana-genesis -n "$NS" --timeout=300s) || true
51+
fi
52+
53+
# Start port-forward and keep this step alive while tests run
54+
if [ -n "${NS}" ]; then
55+
echo "Starting port-forward process..."
56+
PORTS_ENV_FILE="networks/solana/starship/.pf-env" NS="$NS" bash networks/solana/starship/port-forward.sh &
57+
PF_SUPERVISOR_PID=$!
58+
# Clean up on exit
59+
trap 'echo "Stopping port-forward"; kill -9 ${PF_SUPERVISOR_PID} >/dev/null 2>&1 || true; pkill -f "kubectl -n ${NS} port-forward" || true' EXIT
60+
61+
# Give port-forward script time to start
62+
echo "Allowing port-forward script time to initialize..."
63+
sleep 5
64+
else
65+
echo "Could not determine namespace for port-forward" >&2
66+
exit 1
67+
fi
68+
69+
# Load dynamic ports from port-forward script if provided
70+
PF_ENV="networks/solana/starship/.pf-env"
71+
echo "Waiting for port-forward setup to complete..."
72+
for i in $(seq 1 100); do
73+
if [ -f "$PF_ENV" ]; then
74+
# shellcheck disable=SC1090
75+
. "$PF_ENV" || true
76+
echo "Port-forward environment loaded from $PF_ENV"
77+
cat "$PF_ENV" || true
78+
break
79+
fi
80+
if [ $((i % 25)) -eq 0 ]; then
81+
echo "Still waiting for port-forward setup... (${i}/100)"
82+
fi
83+
sleep 0.2
84+
done
85+
86+
RPC_PORT="${SOLANA_RPC_PORT:-8899}"
87+
WS_PORT="${SOLANA_WS_PORT:-8900}"
88+
export SOLANA_RPC_PORT="$RPC_PORT"
89+
export SOLANA_WS_PORT="$WS_PORT"
90+
export SOLANA_RPC_ENDPOINT="http://127.0.0.1:${RPC_PORT}"
91+
export SOLANA_WS_ENDPOINT="ws://127.0.0.1:${WS_PORT}"
92+
93+
echo "Waiting for RPC health on 127.0.0.1:${RPC_PORT} ..."
94+
ok=0
95+
for i in $(seq 1 60); do
96+
if curl -fsS "http://127.0.0.1:${RPC_PORT}/health" | grep -qi ok; then
97+
ok=1; break
98+
fi
99+
sleep 5
100+
done
101+
102+
if [ "$ok" -ne 1 ]; then
103+
echo "RPC not healthy; dumping diagnostics" >&2
104+
kubectl get pods -A -o wide || true
105+
if [ -n "${NS}" ]; then kubectl describe pods -n "$NS" || true; fi
106+
exit 1
107+
fi
108+
109+
echo "Waiting for WS port on 127.0.0.1:${WS_PORT} ..."
110+
ws_ok=0
111+
for i in $(seq 1 60); do
112+
if command -v nc >/dev/null 2>&1; then
113+
if nc -z 127.0.0.1 "${WS_PORT}" >/dev/null 2>&1; then ws_ok=1; break; fi
114+
else
115+
if (exec 3<>/dev/tcp/127.0.0.1/"${WS_PORT}") 2>/dev/null; then exec 3>&- 3<&-; ws_ok=1; break; fi
116+
fi
117+
sleep 2
118+
done
119+
if [ "$ws_ok" -ne 1 ]; then
120+
echo "WebSocket port ${WS_PORT} not reachable; dumping diagnostics" >&2
121+
echo "=== Current listening ports ==="
122+
if command -v ss >/dev/null 2>&1; then ss -ltnp || true; fi
123+
if command -v lsof >/dev/null 2>&1; then lsof -iTCP -sTCP:LISTEN || true; fi
124+
echo "=== Port-forward environment file ==="
125+
if [ -f "$PF_ENV" ]; then cat "$PF_ENV" || true; else echo "No $PF_ENV file found"; fi
126+
echo "=== Port-forward log files ==="
127+
ls -la networks/solana/starship/pf_*.log 2>/dev/null || echo "No port-forward log files found"
128+
for log in networks/solana/starship/pf_*.log; do
129+
if [ -f "$log" ]; then
130+
echo "=== Contents of $log ==="
131+
cat "$log" || true
132+
fi
133+
done
134+
echo "=== Kubernetes services ==="
135+
kubectl get svc -A -o wide || true
136+
if [ -n "${NS}" ]; then
137+
echo "=== Pods in namespace $NS ==="
138+
kubectl get pods -n "$NS" -o wide || true
139+
echo "=== Pod descriptions ==="
140+
(kubectl describe pods -l app=solana-genesis -n "$NS" || \
141+
kubectl describe pods -l app.kubernetes.io/name=solana-genesis -n "$NS") || true
142+
fi
143+
exit 1
144+
fi
145+
146+
cd ./networks/solana
147+
yarn test --runInBand

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,9 @@ CLAUDE.md
1313
AGENTS.md
1414

1515
.cert/
16+
debug/
17+
18+
# Runtime-generated port-forward environment files
19+
**/.pf-env
1620

1721
.augment/

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ A single, universal signing interface for any network. Birthed from the intercha
4646
- [Supported Networks](#supported-networks)
4747
- [Cosmos Network](#cosmos-network)
4848
- [Injective Network](#injective-network)
49+
- [Solana Network](#solana-network)
4950
- [Ethereum Network](#ethereum-network)
5051
- [Interchain JavaScript Stack ⚛️](#interchain-javascript-stack-️)
5152
- [Credits](#credits)
@@ -61,7 +62,7 @@ At its core, InterchainJS provides a **flexible adapter pattern** that abstracts
6162

6263
InterchainJS sits at the foundation of the **[Interchain JavaScript Stack](https://hyperweb.io/stack)**, a set of tools that work together like nested building blocks:
6364

64-
- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Ethereum (EIP-712), and beyond.
65+
- **[InterchainJS](https://hyperweb.io/stack/interchainjs)** → Powers signing across Cosmos, Solana, Ethereum (EIP-712), and beyond.
6566
- **[Interchain Kit](https://hyperweb.io/stack/interchain-kit)** → Wallet adapters that connect dApps to multiple blockchain networks.
6667
- **[Interchain UI](https://hyperweb.io/stack/interchain-ui)** → A flexible UI component library for seamless app design.
6768
- **[Create Interchain App](https://hyperweb.io/stack/create-interchain-app)** → A developer-friendly starter kit for cross-chain applications.
@@ -76,6 +77,7 @@ The diagram below illustrates how InterchainJS connects different signer types t
7677
graph LR
7778
signers --> cosmos_signer["Cosmos Network"]
7879
signers --> injective_signer["Injective Network"]
80+
signers --> solana_signer["Solana Network"]
7981
signers --> ethereum_signer["Ethereum Network"]
8082
signers --> implement_signer["ANY Network"]
8183
@@ -88,6 +90,8 @@ graph LR
8890
injective_signer --> injective_amino["Amino Signer"]
8991
injective_signer --> injective_direct["Direct Signer"]
9092
93+
solana_signer --> solana_std["Standard Signer"]
94+
9195
implement_signer --> any_signer["Any Signer"]
9296
9397
style signers fill:#f9f,stroke:#333,stroke-width:2px
@@ -236,6 +240,17 @@ Then an authz example website will be created and users can take a look how sign
236240

237241
---
238242

243+
### Solana Network
244+
245+
Build on the request-object query client with automatic protocol detection and wallet-aware workflows.
246+
247+
| Feature | Package |
248+
| ---------------------------- | -------------------------------------------------------- |
249+
| **Query & Transactions** | [@interchainjs/solana](https://docs.hyperweb.io/interchain-js/networks/solana) |
250+
| **Standard Signer (`solana_std`)** | [Solana Signer Guide](./libs/interchainjs/README.md#solana-signers-solana_std) |
251+
252+
---
253+
239254
### Ethereum Network
240255

241256
| Feature | Package |

0 commit comments

Comments
 (0)