wormhole-explorer/api
agodnic 1f47f887da
[API/TX-TRACKER] Add support for Solana tx hashes (#218)
### Summary
This pull request adds the functionality to search for VAAs using Solana tx hashes, e.g.:

`GET /api/v1/vaas?txHash=2qnNNBQQQ152sGkQ1Rnq2Kdr48LvdN4oXwnTWyEmJqYYWFusLWxbwhpGS5KTXH1bKKx9gg9BLZMKd3g1cXiy7QMz`.

Also, the VAA objects returned by the API now have a new field `nativeTxHash`, which contains the tx hash that generated the VAA in the native format of the emitter chain.

Tracking issues: https://github.com/wormhole-foundation/wormhole-explorer/issues/212, https://github.com/wormhole-foundation/wormhole-explorer/issues/214

### Testing guidelines

Endpoints affected:
* `GET /api/v1/vaas` now supports Solana tx hashes by using the `?txHash=` query parameter. This search is limited to VAAs created by the portal token bridge.
* Some VAAs returned by the API should have a new field `nativeTxHash`. All VAAs related to the portal token bridge should have this field set.
*  An internal refactoring affected pretty much all routes under `GET /api/v1/vaas*`, which should be re-tested.
* In the response of `/api/v1/global-tx/`, the field `originTx.signer` has been renamed to `originTx.from`
2023-04-05 10:33:28 -03:00
..
docs fix: use of decimal for huge numbers (#203) 2023-03-22 13:38:43 -03:00
handlers [API/TX-TRACKER] Add support for Solana tx hashes (#218) 2023-04-05 10:33:28 -03:00
internal [API/PARSER] Chain activity and last transaction endpoints (#175) 2023-03-07 16:25:42 -03:00
middleware [API/TX-TRACKER] Add support for Solana tx hashes (#218) 2023-04-05 10:33:28 -03:00
response
routes Add start_date, end_date validation controller (#216) 2023-04-04 10:49:27 -03:00
rpc Add contract watcher component (#190) 2023-03-15 16:52:50 -03:00
types [API/TX-TRACKER] Add support for Solana tx hashes (#218) 2023-04-05 10:33:28 -03:00
.gitignore
Dockerfile [API/PARSER] Chain activity and last transaction endpoints (#175) 2023-03-07 16:25:42 -03:00
Makefile
README.md
go.mod logging as json (#208) 2023-03-23 15:36:50 -03:00
go.sum logging as json (#208) 2023-03-23 15:36:50 -03:00
main.go logging as json (#208) 2023-03-23 15:36:50 -03:00

README.md

API

How to build

make build

Config

You will need to set some env variables with the prefix WORMSCAN

  • WORMSCAN_DB_MONGO
  • WORMSCAN_DB_NAME
  • WORMSCAN_PORT

for example:

WORMSCAN_DB_URL=mongodb://localhost:27017/wormhole WORMSCAN_PORT=5555 ./api

API Documentation

Documentation is automagically generated via swaggo using annotations on code and placed inside doc/ folder.

To install swag tool run this

go install github.com/swaggo/swag/cmd/swag@latest

To generate or update the doc run:

make doc