wormhole-explorer/contract-watcher
agodnic a0475ab17e
Add endpoint `GET /api/v1/transactions` (#388)
### Summary
Tracking issue: https://github.com/wormhole-foundation/wormhole-explorer/issues/385

This pull request implements a new endpoint, `GET /api/v1/transactions`, which will be consumed by the wormhole explorer UI.

The endpoint returns a paginated list of transactions, in which each element contains a brief overview of the transaction (ID, txHash, status, etc.).

It exposes offset-based pagination via the parameters `page` and `pageSize`. Also, results can be obtained for a specific address by using the `address` query parameter.

The response model looks like this:
```json
{
  "transactions": [
   {
    "id": "1/5ec18c34b47c63d17ab43b07b9b2319ea5ee2d163bce2e467000174e238c8e7f/12965",
    "timestamp": "2023-06-08T19:30:19Z",
    "txHash": "a302c4ab2d6b9a6003951d2e91f8fdbb83cfa20f6ffb588b95ef0290aab37066",
    "originChain": 1,
    "status": "ongoing"
  },
  {
    "id": "22/0000000000000000000000000000000000000000000000000000000000000001/18308",
    "timestamp": "2023-06-08T19:17:14Z",
    "txHash": "00000000000000000000000000000000000000000000000000000000000047e7",
    "originChain": 22,
    "destinationAddress": "0x00000000000000000000000067e8a40816a983fbe3294aaebd0cc2391815b86b",
    "destinationChain": 5,
    "tokenAmount": "0.12",
    "usdAmount": "0.12012",
    "symbol": "USDC",
    "status": "completed"
  },
  ...
  ]
}
```

### Limitations of the current implementation
1. Doesn't return the total number of results (this may result in a performance issue when we filter by address)
2. Can only filter by receiver address (we don't have sender information in the database yet)
2023-06-12 11:43:48 -03:00
..
builder Add celo to contract-watcher(token bridge, wormhole connect contracts) (#393) 2023-06-09 17:57:22 -03:00
cmd Add celo to contract-watcher(token bridge, wormhole connect contracts) (#393) 2023-06-09 17:57:22 -03:00
config Add celo to contract-watcher(token bridge, wormhole connect contracts) (#393) 2023-06-09 17:57:22 -03:00
http/infrastructure Add contract watcher component (#190) 2023-03-15 16:52:50 -03:00
internal Contract-watcher add support wormhole connect wrapper contract (#391) 2023-06-08 17:53:51 -03:00
processor Add contract watcher component (#190) 2023-03-15 16:52:50 -03:00
storage Fix global tx to keep successful status (#294) 2023-05-08 12:55:09 -03:00
support Add oasis support to contract watcher (#258) 2023-04-25 14:48:26 -03:00
watcher Add endpoint `GET /api/v1/transactions` (#388) 2023-06-12 11:43:48 -03:00
.gitignore Add contract watcher component (#190) 2023-03-15 16:52:50 -03:00
Dockerfile Add aptos support to contract watcher (#255) 2023-04-24 12:02:19 -03:00
Makefile Add aptos support to contract watcher (#255) 2023-04-24 12:02:19 -03:00
README.md Add backfiller command to process a chain (#364) 2023-05-31 10:29:47 -03:00
go.mod Fix status for aptos blockchain (#386) 2023-06-06 18:04:34 -03:00
go.sum Fix status for aptos blockchain (#386) 2023-06-06 18:04:34 -03:00

README.md

contract-watcher

This component is in charge of obtaining the redeemed vaa's to obtain information from the target chain. .

Usage

Service

contract-watcher service

Backfiller

contract-watcher backfiller [flags]

Command-line arguments

  • --chain-name string chain name
  • --chain-url string chain URL
  • --from uint first block to be processed
  • --log-level string log level (default "INFO")
  • --mongo-database string mongo database
  • --mongo-uri string mongo connection
  • --network string network (mainnet or testnet)
  • --page-size int maximum number to process at one time (default 100)
  • --persist-blocks persist processed blocks in storage
  • --rate-limit int rate limit per second (default 3)
  • --to uint last block to be processed (included)