Skip to content
Closed
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ jobs:
- run: npm run lint
- run: npm run build
- run: npm run docker:test
- run: npm run docker:test:deposit-webhook
55 changes: 55 additions & 0 deletions compose.test.deposit-webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
services:
test-deposit-webhook:
image: node:22-alpine
command: sh -c "npm install && npm run test:deposit-webhook:e2e"
working_dir: /usr/src/app
volumes:
- .:/usr/src/app
environment:
NODE_ENV: test
INTEGRATION_TESTS: true
DEPOSIT_WEBHOOK_E2E: true
CONFIG_FILE: xion-test.config.json
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
xion:
condition: service_healthy
tty: true

db:
image: timescale/timescaledb:2.18.1-pg17
environment:
POSTGRES_DB: test
POSTGRES_USER: test
POSTGRES_PASSWORD: test
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U test']
interval: 1s
timeout: 3s
retries: 20

redis:
image: redis:7-alpine
healthcheck:
test: ['CMD-SHELL', 'redis-cli ping']
interval: 1s
timeout: 3s
retries: 20

xion:
build:
context: .
dockerfile: docker/xiond-local/Dockerfile
healthcheck:
test:
[
'CMD-SHELL',
'curl -fsS http://127.0.0.1:26657/status >/dev/null || exit 1',
]
interval: 1s
timeout: 3s
retries: 40

2 changes: 2 additions & 0 deletions config.json.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"chainId": "juno-testnet",
"home": "~/.juno/indexer",
"localRpc": "http://localhost:26657",
"remoteRpc": "https://juno-testnet-rpc.polkachu.com",
Expand Down Expand Up @@ -48,6 +49,7 @@
"inboxSecret": "secret",
"notifierSecret": "secret",
"websocketsSecret": "secret",
"webhookTimeoutMs": 15000,
"accountsJwtSecret": "secret",
"rbamWebhookBaseUrl": "",
"rbamWebhookSecret": ""
Expand Down
28 changes: 28 additions & 0 deletions docker/xiond-local/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM debian:bookworm-slim

ARG XIOND_VERSION=28.1.0-rc1

RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl tar \
&& rm -rf /var/lib/apt/lists/*

RUN arch="$(dpkg --print-architecture)" \
&& case "$arch" in \
amd64) xion_arch="amd64" ;; \
arm64) xion_arch="arm64" ;; \
*) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \
esac \
&& curl -fsSL \
"https://github.com/burnt-labs/xion/releases/download/v${XIOND_VERSION}/xiond_${XIOND_VERSION}_linux_${xion_arch}.tar.gz" \
-o /tmp/xiond.tar.gz \
&& tar -xzf /tmp/xiond.tar.gz -C /usr/local/bin xiond \
&& chmod +x /usr/local/bin/xiond \
&& rm -f /tmp/xiond.tar.gz

COPY docker/xiond-local/start.sh /usr/local/bin/start-xiond

RUN chmod +x /usr/local/bin/start-xiond

EXPOSE 26657

CMD ["start-xiond"]
52 changes: 52 additions & 0 deletions docker/xiond-local/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/sh

set -eu

XION_HOME="${XION_HOME:-/xion}"
CHAIN_ID="${CHAIN_ID:-localxion-1}"
DENOM="${DENOM:-uxion}"
MONIKER="${MONIKER:-local-validator}"
VALIDATOR_MNEMONIC="${VALIDATOR_MNEMONIC:-decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry}"

mkdir -p "$XION_HOME"

if [ ! -f "$XION_HOME/config/genesis.json" ]; then
xiond init "$MONIKER" \
--chain-id "$CHAIN_ID" \
--default-denom "$DENOM" \
--home "$XION_HOME" \
--overwrite >/dev/null

printf '%s\n' "$VALIDATOR_MNEMONIC" | xiond keys add validator \
--recover \
--keyring-backend test \
--home "$XION_HOME" >/dev/null

xiond genesis add-genesis-account validator "100000000000${DENOM}" \
--keyring-backend test \
--home "$XION_HOME" >/dev/null

xiond genesis gentx validator "100000000${DENOM}" \
--chain-id "$CHAIN_ID" \
--keyring-backend test \
--home "$XION_HOME" >/dev/null

xiond genesis collect-gentxs --home "$XION_HOME" >/dev/null

sed -i "s/^minimum-gas-prices = .*/minimum-gas-prices = \"0${DENOM}\"/" \
"$XION_HOME/config/app.toml"
sed -i 's/^timeout_commit = .*/timeout_commit = "1s"/' \
"$XION_HOME/config/config.toml"
sed -i 's/^timeout_propose = .*/timeout_propose = "1s"/' \
"$XION_HOME/config/config.toml"
sed -i 's/^timeout_prevote = .*/timeout_prevote = "500ms"/' \
"$XION_HOME/config/config.toml"
sed -i 's/^timeout_precommit = .*/timeout_precommit = "500ms"/' \
"$XION_HOME/config/config.toml"
fi

exec xiond start \
--home "$XION_HOME" \
--minimum-gas-prices "0${DENOM}" \
--rpc.laddr tcp://0.0.0.0:26657 \
--log_level warn
173 changes: 173 additions & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,179 @@ On error:
}
```

#### GET `/deposit-webhook-registrations`

List deposit webhook registrations for the authenticated account.

Response:

```ts
{
"registrations": {
"id": number
"description": string | null
"endpointUrl": string
"authHeader": string | null
"authToken": string | null
"watchedWallets": string[]
"allowedNativeDenoms": string[]
"allowedCw20Contracts": string[]
"enabled": boolean
}[]
}
```

#### POST `/deposit-webhook-registrations`

Create a new deposit webhook registration.

This registers a deposit-detection listener for matching inbound transfers to
the supplied watched wallets and asset filters. It is not a generic
balance-change subscription.

Request:

```ts
{
"description": string | null
"endpointUrl": string
"authHeader": string | null
"authToken": string | null
"watchedWallets": string[]
"allowedNativeDenoms": string[]
"allowedCw20Contracts": string[]
"enabled": boolean | undefined
}
```

Response:

```ts
{
"registration": {
"id": number
"description": string | null
"endpointUrl": string
"authHeader": string | null
"authToken": string | null
"watchedWallets": string[]
"allowedNativeDenoms": string[]
"allowedCw20Contracts": string[]
"enabled": boolean
}
}
```

Registered destinations receive the outbound deposit payload documented in
[webhooks.md](./webhooks.md), including the stable `txHash` field for downstream
on-chain verification.

or error:

```ts
{
"error": string
}
```

Example:

```sh
curl -X POST https://daodaoindexer.burnt.com/deposit-webhook-registrations \
-H 'Authorization: Bearer <account-jwt>' \
-H 'Content-Type: application/json' \
-d '{
"description": "Production deposit listener",
"endpointUrl": "https://partner.example/deposits",
"authHeader": "Authorization",
"authToken": "secret-token",
"watchedWallets": ["xion1watchedwallet", "xion1secondwallet"],
"allowedNativeDenoms": ["uxion"],
"allowedCw20Contracts": ["xion1stablecoincontract"],
"enabled": true
}'
```

#### PATCH `/deposit-webhook-registrations/:id`

Update an existing deposit webhook registration.

Request:

```ts
{
"description": string | null | undefined
"endpointUrl": string | undefined
"authHeader": string | null | undefined
"authToken": string | null | undefined
"watchedWallets": string[] | undefined
"allowedNativeDenoms": string[] | undefined
"allowedCw20Contracts": string[] | undefined
"enabled": boolean | undefined
}
```

Response:

```ts
{
"registration": {
"id": number
"description": string | null
"endpointUrl": string
"authHeader": string | null
"authToken": string | null
"watchedWallets": string[]
"allowedNativeDenoms": string[]
"allowedCw20Contracts": string[]
"enabled": boolean
}
}
```

or error:

```ts
{
"error": string
}
```

Example:

```sh
curl -X PATCH https://daodaoindexer.burnt.com/deposit-webhook-registrations/7 \
-H 'Authorization: Bearer <account-jwt>' \
-H 'Content-Type: application/json' \
-d '{
"watchedWallets": ["xion1watchedwallet", "xion1thirdwallet"],
"allowedNativeDenoms": [],
"allowedCw20Contracts": ["xion1stablecoincontract"],
"enabled": true
}'
```

#### DELETE `/deposit-webhook-registrations/:id`

Delete a deposit webhook registration.

Empty response on success.

On error:

```ts
{
"error": string
}
```

Example:

```sh
curl -X DELETE https://daodaoindexer.burnt.com/deposit-webhook-registrations/7 \
-H 'Authorization: Bearer <account-jwt>'
```

#### GET `/webhooks`

List webhooks.
Expand Down
Loading
Loading