CoinAlpha / gateway-api

Apache License 2.0
47 stars 25 forks source link

(feat) poll for eth tx #20

Closed fengtality closed 3 years ago

fengtality commented 3 years ago

This PR changes changes the buy and sell functions for Uniswap and Balancer so that they only return the transaction hash txHash. Afterwards, the client poll for status by passing txHash as param in a POST request to /eth/get-receipt, which returns the transaction status.

If transaction has not been confirmed, output is:

confirmed: false,
receipt: {}

If transaction has been confirmed, output is:

confirmed: true,
receipt: {
  gasUsed: int,
  blockNumber: int,
  confirmations: int,
  status: 1, // 0 = fail, 1 = success
}