Skip to content

Webhook

Bcode API has a webhook system to allow user backend to send transaction execution. When a user send a executeAsyncTransaction a requestId is return but if a webhook url has been specified in the params, that endpoint receive a object of this type when transaction has been completed.

interface Webhook {
  tx: object;
  txStatus: "success" | "failed";
  requestId: string;
  metadata: object | {};
  receiptTimestamp: number;
  network: string;
}

The tx object can be a complete Ethers receipt object or, if verbose mode is setted as false in the request:

{
  from: string;
  to: string;
  transactionHash: string;
  blockHash: string;
  blockNumber: number;
}

The metadata field contains the same value provided in executeAsyncTransaction with no changes.