@pwngh/economy-lab
    Preparing search index...

    Function handleWebhook

    • Maps a verified callback to the operation it applies (via toOperation), persists that to the inbox in one transaction, and returns. It does NOT post to the ledger inline; the apply worker (drainInbox) submits the stored Operation later, so invariants and idempotency apply there.

      Parameters

      Returns Promise<WebhookReceipt>

      const receipt = await handleWebhook(ports.store, ports, {
      provider: 'steam',
      eventId: 'evt_8123',
      userId: 'u_42',
      amount: toAmount('CREDIT', 12_000n), // a $100 credit pack
      source: 'steam',
      });
      // receipt.status is 'accepted' now, 'duplicate' on any redelivery of evt_8123
      • HTTP service for the verification gate the edge runs first.
      • Processor for how verified callbacks flow through the inbox.