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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pid
*.log
e2e/.env
7 changes: 4 additions & 3 deletions e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,16 @@ function loadEnvFile(path: string): Record<string, string> {
}

export function loadConfig(): Config {
// In Docker: env vars are set by docker-compose, contract IDs come from /config/contracts.env
// Locally: everything comes from the provider-platform .env file
// Priority: Docker contracts.env > local e2e/.env > provider-platform .env
const contractsEnv = loadEnvFile("/config/contracts.env");

const localEnv = loadEnvFile(new URL("./.env", import.meta.url).pathname);

const providerPlatformPath = Deno.env.get("PROVIDER_PLATFORM_PATH") ??
`${Deno.env.get("HOME")}/repos/provider-platform`;
const providerEnv = loadEnvFile(`${providerPlatformPath}/.env`);

const env = { ...providerEnv, ...contractsEnv };
const env = { ...providerEnv, ...localEnv, ...contractsEnv };

const networkPassphrase = Deno.env.get("STELLAR_NETWORK_PASSPHRASE") ??
"Standalone Network ; February 2017";
Expand Down
23 changes: 20 additions & 3 deletions up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,16 @@ WASM_DIR="target/wasm32v1-none/release"
[ -f "$WASM_DIR/privacy_channel.wasm" ] || error "privacy_channel.wasm not found"

info "Deploying native XLM SAC (Stellar Asset Contract)..."
TOKEN_ID=$(stellar contract asset deploy \
if TOKEN_ID=$(stellar contract asset deploy \
--asset native \
--network local \
--source-account "$ACCT_ADMIN") || {
--source-account "$ACCT_ADMIN" 2>/dev/null); then
info "SAC deployed"
else
# SAC may already be deployed (shared network) — fetch its ID
TOKEN_ID=$(stellar contract asset id --asset native --network local)
warn "SAC already deployed: $TOKEN_ID"
}
fi
info "XLM SAC: $TOKEN_ID"

info "Deploying channel-auth contract..."
Expand Down Expand Up @@ -408,6 +410,21 @@ for i in $(seq 1 10); do
sleep 1
done

# ============================================================
# Generate E2E config
# ============================================================

cat > "$SCRIPT_DIR/e2e/.env" <<EOF
# Generated by local-dev/up.sh on $(date -u +%Y-%m-%dT%H:%M:%SZ)
CHANNEL_CONTRACT_ID=$CHANNEL_ID
CHANNEL_AUTH_ID=$AUTH_ID
CHANNEL_ASSET_CONTRACT_ID=$TOKEN_ID
PROVIDER_URL=http://localhost:$PROVIDER_PORT
PROVIDER_SK=$PROVIDER_SK
STELLAR_RPC_URL=http://localhost:${STELLAR_RPC_PORT}/soroban/rpc
EOF
info "E2E config written to e2e/.env"

# ============================================================
echo ""
echo "========================================"
Expand Down
Loading