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
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"imports": {
"@colibri/core": "jsr:@colibri/core@^0.22.0",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.9.1",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.10.0",
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
"stellar-sdk": "npm:@stellar/stellar-sdk@^15.1.0",
"postgres": "npm:postgres@3.4.7"
Expand Down
8 changes: 4 additions & 4 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 28 additions & 24 deletions docker-compose.multi-asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ services:
volumes:
- ./.traces/multi-asset:/badger
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:16686/api/services || exit 1"]
test: [
"CMD-SHELL",
"wget -qO- http://localhost:16686/api/services || exit 1",
]
interval: 2s
timeout: 3s
retries: 15
Expand All @@ -61,7 +64,7 @@ services:
- sh
- -c
- |
cp test/setup-multi-asset.ts setup.ts && deno run --allow-all setup.ts
cp test/setup-multi-asset.ts setup.ts && deno run --allow-all setup.ts
environment:
STELLAR_RPC_URL: http://stellar:8000/soroban/rpc
STELLAR_NETWORK_PASSPHRASE: "Standalone Network ; February 2017"
Expand Down Expand Up @@ -153,28 +156,28 @@ services:
- sh
- -c
- |
mkdir -p multi-asset lib
cp /multi-asset-src/*.ts multi-asset/ && cp /multi-asset-src/deno.json multi-asset/ 2>/dev/null || true
cp /lib-src/*.ts lib/
cp -r /lib-src/client lib/
cd multi-asset && deno install && cd ..
echo "Waiting for provider and Stellar..."
for i in $$(seq 1 60); do
provider_ok=false stellar_ok=false
PROBE_URL="$$PROVIDER_URL" deno eval "try { await fetch(Deno.env.get('PROBE_URL')); Deno.exit(0) } catch { Deno.exit(1) }" 2>/dev/null && provider_ok=true
PROBE_URL="$$STELLAR_RPC_URL" deno eval "
const url = Deno.env.get('PROBE_URL');
const r = await fetch(url, {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({jsonrpc:'2.0',id:1,method:'getHealth'})});
const d = await r.json(); Deno.exit(d.result?.status==='healthy'?0:1)
" 2>/dev/null && stellar_ok=true
if [ "$$provider_ok" = true ] && [ "$$stellar_ok" = true ]; then
echo "Provider and Stellar are ready."
break
fi
if [ "$$i" -eq 60 ]; then echo "Services not ready after 120s"; exit 1; fi
sleep 2
done
exec deno run --allow-all multi-asset/main.ts
mkdir -p multi-asset lib
cp /multi-asset-src/*.ts multi-asset/ && cp /multi-asset-src/deno.json multi-asset/ 2>/dev/null || true
cp /lib-src/*.ts lib/
cp -r /lib-src/client lib/
cd multi-asset && deno install && cd ..
echo "Waiting for provider and Stellar..."
for i in $$(seq 1 60); do
provider_ok=false stellar_ok=false
PROBE_URL="$$PROVIDER_URL" deno eval "try { await fetch(Deno.env.get('PROBE_URL')); Deno.exit(0) } catch { Deno.exit(1) }" 2>/dev/null && provider_ok=true
PROBE_URL="$$STELLAR_RPC_URL" deno eval "
const url = Deno.env.get('PROBE_URL');
const r = await fetch(url, {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({jsonrpc:'2.0',id:1,method:'getHealth'})});
const d = await r.json(); Deno.exit(d.result?.status==='healthy'?0:1)
" 2>/dev/null && stellar_ok=true
if [ "$$provider_ok" = true ] && [ "$$stellar_ok" = true ]; then
echo "Provider and Stellar are ready."
break
fi
if [ "$$i" -eq 60 ]; then echo "Services not ready after 120s"; exit 1; fi
sleep 2
done
exec deno run --allow-all multi-asset/main.ts
environment:
NETWORK: local
PROVIDER_URL: http://provider:3000
Expand All @@ -186,6 +189,7 @@ services:
FRIENDBOT_URL: http://stellar:8000/friendbot
JAEGER_QUERY_URL: http://jaeger:16686
DATABASE_URL: postgresql://admin:devpass@db:5432/provider_platform_db
COUNCIL_DATABASE_URL: postgresql://admin:devpass@db:5432/council_platform_db
WASM_DIR: /wasms
OTEL_DENO: "true"
OTEL_SERVICE_NAME: "moonlight-e2e"
Expand Down
4 changes: 2 additions & 2 deletions e2e/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"verify-otel": "deno run --allow-all verify-otel.ts"
},
"imports": {
"@colibri/core": "jsr:@colibri/core@^0.20.2",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.9.1",
"@colibri/core": "jsr:@colibri/core@^0.22.0",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.10.0",
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
"buffer": "npm:buffer@6.0.3",
"stellar-sdk": "npm:@stellar/stellar-sdk@^15.0.1"
Expand Down
22 changes: 6 additions & 16 deletions e2e/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions e2e/pos-instant/deno.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"nodeModulesDir": "auto",
"imports": {
"@colibri/core": "jsr:@colibri/core@^0.20.2",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.9.1",
"@colibri/core": "jsr:@colibri/core@^0.22.0",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.10.0",
"@noble/curves": "jsr:@noble/curves@^1.8.0",
"@noble/curves/p256": "jsr:@noble/curves@^1.8.0/p256",
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
Expand Down
54 changes: 54 additions & 0 deletions lib/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,57 @@ export async function removeProvider(
console.log(" Provider removed");
return result;
}

/**
* Disable an asset channel on the Channel Auth contract.
* Calls disable_channel(channel, asset) — quorum/admin authorized. Emits a
* channel_state_changed event (enabled=false). The contract stores no state.
*/
export async function disableChannel(
server: rpc.Server,
admin: Keypair,
networkPassphrase: string,
channelAuthId: string,
channelContractId: string,
assetContractId: string,
): Promise<rpc.Api.GetSuccessfulTransactionResponse> {
console.log(` Disabling channel ${channelContractId.slice(0, 8)}...`);

const contract = new Contract(channelAuthId);
const op = contract.call(
"disable_channel",
new Address(channelContractId).toScVal(),
new Address(assetContractId).toScVal(),
);

const result = await submitTx(server, admin, networkPassphrase, op);
console.log(" Channel disabled");
return result;
}

/**
* Enable (or re-enable) an asset channel on the Channel Auth contract.
* Calls enable_channel(channel, asset) — quorum/admin authorized. Emits a
* channel_state_changed event (enabled=true). Re-enable reuses this call.
*/
export async function enableChannel(
server: rpc.Server,
admin: Keypair,
networkPassphrase: string,
channelAuthId: string,
channelContractId: string,
assetContractId: string,
): Promise<rpc.Api.GetSuccessfulTransactionResponse> {
console.log(` Enabling channel ${channelContractId.slice(0, 8)}...`);

const contract = new Contract(channelAuthId);
const op = contract.call(
"enable_channel",
new Address(channelContractId).toScVal(),
new Address(assetContractId).toScVal(),
);

const result = await submitTx(server, admin, networkPassphrase, op);
console.log(" Channel enabled");
return result;
}
4 changes: 2 additions & 2 deletions lib/client/deno.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"nodeModulesDir": "auto",
"imports": {
"@colibri/core": "jsr:@colibri/core@^0.20.2",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.9.1",
"@colibri/core": "jsr:@colibri/core@^0.22.0",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.10.0",
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
"stellar-sdk": "npm:@stellar/stellar-sdk@^15.0.1"
}
Expand Down
4 changes: 2 additions & 2 deletions lifecycle/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"testnet-verify": "OTEL_DENO=true OTEL_SERVICE_NAME=moonlight-e2e OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf deno run --allow-all testnet-verify.ts"
},
"imports": {
"@colibri/core": "jsr:@colibri/core@^0.20.2",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.9.1",
"@colibri/core": "jsr:@colibri/core@^0.22.0",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.10.0",
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
"stellar-sdk": "npm:@stellar/stellar-sdk@^15.0.1",
"buffer": "npm:buffer@6.0.3",
Expand Down
22 changes: 6 additions & 16 deletions lifecycle/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions multi-asset/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"multi-asset:testnet": "NETWORK=testnet deno run --allow-all main.ts"
},
"imports": {
"@colibri/core": "jsr:@colibri/core@^0.20.2",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.9.1",
"@colibri/core": "jsr:@colibri/core@^0.22.0",
"@moonlight/moonlight-sdk": "jsr:@moonlight/moonlight-sdk@^0.10.0",
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
"stellar-sdk": "npm:@stellar/stellar-sdk@^15.0.1",
"buffer": "npm:buffer@6.0.3",
Expand Down
1 change: 1 addition & 0 deletions multi-asset/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ services:
STELLAR_NETWORK_PASSPHRASE: "Standalone Network ; February 2017"
FRIENDBOT_URL: http://stellar:8000/friendbot
DATABASE_URL: postgresql://admin:devpass@db:5432/multi_asset_db
COUNCIL_DATABASE_URL: postgresql://admin:devpass@council-db:5432/council_multi_asset_db
WASM_DIR: /wasms
entrypoint:
- sh
Expand Down
Loading
Loading