WebhooksEvent from Wallet Service (TOPUP)

Event from Wallet Service (TOPUP)

Accepts incoming on-chain events. Currently only TOPUP is processed. NO auth/signature (demo; HMAC will be added in production). Body validation is done manually inside the handler (external contract, no strict schema is enforced).

The token is resolved from the registry by contract address (preferred) or by code (fallback with a warning); an unknown token is ignored.

Crediting is a topup ledger entry in an atomic batch: address:available ← vault:external. For the address's primary token, the balance comes from the ledger; for a "non-primary" token (asset_mismatch), funds are tracked in a separate ledger account and visible in GET /vaults/{code}/balances.

Idempotency: unique(network, txHash) and unique(webhookEventId); a duplicate returns 200 {duplicate: true}. TRX events and unknown addresses are ignored (200 {ignored: true}).

curl -X POST "https://policy-engine-rest.ezig.workers.dev/webhooks/wallet" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -d '{
  "tx": {
    "network": "TRON",
    "asset": "USDT",
    "contract": "example_string",
    "type": "example_string",
    "id": "example_string",
    "block": 42,
    "timestamp": 3.14,
    "from": "example_string",
    "to": "example_string",
    "value": "example_string"
  }
}'
{
  "ok": true,
  "incomingId": "example_string",
  "balanceUpdated": true,
  "newBalance": "example_string"
}
POST
/webhooks/wallet
POST
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Session token. Mobile/services. The web uses a cookie.

Session token. Mobile/services. The web uses a cookie.
API Key (cookie: session_token)
session_tokenstring
Required

API key (sent in cookie)

Content-Typestring
Required

The media type of the request body

Options: application/json
Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Session token. Mobile/services. The web uses a cookie.

path
parameterstring
Required

API Key for authentication. Provide your API key in the cookie.

Body

application/json
txobject
Required

Responses

okboolean
Required
incomingIdstring
Required
balanceUpdatedboolean
Required
newBalancestring
Required