add swagger doc, makefile and readme (#53)
Co-authored-by: gipsh <gipsh@gmail.com>
This commit is contained in:
parent
7255b214ca
commit
085d5ecd03
|
@ -0,0 +1,21 @@
|
||||||
|
SHELL := /bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
## help: print this help message
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo 'Usage:'
|
||||||
|
@sed -n 's/^##//p' ${MAKEFILE_LIST} | column -t -s ':' | sed -e 's/^/ /'
|
||||||
|
|
||||||
|
build:
|
||||||
|
go build -o api main.go
|
||||||
|
|
||||||
|
doc:
|
||||||
|
swag init -pd
|
||||||
|
|
||||||
|
|
||||||
|
test:
|
||||||
|
go test -v -cover ./...
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY: build doc test
|
|
@ -0,0 +1,38 @@
|
||||||
|
# API
|
||||||
|
|
||||||
|
## How to build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
To generate or update the doc run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make doc
|
||||||
|
```
|
|
@ -0,0 +1,559 @@
|
||||||
|
// Package docs GENERATED BY SWAG; DO NOT EDIT
|
||||||
|
// This file was generated by swaggo/swag
|
||||||
|
package docs
|
||||||
|
|
||||||
|
import "github.com/swaggo/swag"
|
||||||
|
|
||||||
|
const docTemplate = `{
|
||||||
|
"schemes": {{ marshal .Schemes }},
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "{{escape .Description}}",
|
||||||
|
"title": "{{.Title}}",
|
||||||
|
"termsOfService": "https://wormhole.com/",
|
||||||
|
"contact": {
|
||||||
|
"name": "API Support",
|
||||||
|
"url": "http://www.swagger.io/support",
|
||||||
|
"email": "support@swagger.io"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "Apache 2.0",
|
||||||
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
|
},
|
||||||
|
"version": "{{.Version}}"
|
||||||
|
},
|
||||||
|
"host": "{{.Host}}",
|
||||||
|
"basePath": "{{.BasePath}}",
|
||||||
|
"paths": {
|
||||||
|
"/v1/governor/available_notional_by_chain": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get available notional by chainID\nSince from the wormhole-explorer point of view it is not a node, but has the information of all nodes,\nin order to build the endpoints it was assumed:\nThere are N number of remainingAvailableNotional values in the GovernorConfig collection. N = number of guardians\nfor a chainID. The smallest remainingAvailableNotional value for a chainID is used for the endpoint response.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "governor-available-notional-by-chain",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/governor.AvailableNotionalResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/governor/enqueued_vaas": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get enqueued vaa's",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-enqueued-vaas",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/governor.EnqueuedVaaResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/governor/is_vaa_enqueued/{chain_id}/{emitter}/{seq}": {
|
||||||
|
"get": {
|
||||||
|
"description": "Check if vaa is enqueued",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-is-vaa-enqueued",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id of the blockchain",
|
||||||
|
"name": "chain_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "address of the emitter",
|
||||||
|
"name": "emitter",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "sequence of the vaa",
|
||||||
|
"name": "seq",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/governor.EnqueuedVaaResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/governor/token_list": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get token list\nSince from the wormhole-explorer point of view it is not a node, but has the information of all nodes,\nin order to build the endpoints it was assumed:\nFor tokens with the same originChainId and originAddress and different price values for each node,\nthe price that has most occurrences in all the nodes for an originChainId and originAddress is returned.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-token-list",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/governor.TokenList"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/guardianset/current": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get current guardian set.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardian-set",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/guardian.GuardianSetResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/heartbeats": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get heartbeats for guardians",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-hearbeats",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/heartbeats.HeartbeatsResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/signed_batch_vaa/{chain_id}/{emitter}/sequence/{seq}": {
|
||||||
|
"get": {
|
||||||
|
"description": "get a batch of VAA []byte from a chainID, emitter address and sequence.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-find-signed-batch-vaa",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id of the blockchain",
|
||||||
|
"name": "chain_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "address of the emitter",
|
||||||
|
"name": "emitter",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "sequence of the vaa",
|
||||||
|
"name": "seq",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"vaaBytes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/signed_vaa/{chain_id}/{emitter}/{seq}": {
|
||||||
|
"get": {
|
||||||
|
"description": "get a VAA []byte from a chainID, emitter address and sequence.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-find-signed-vaa",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id of the blockchain",
|
||||||
|
"name": "chain_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "address of the emitter",
|
||||||
|
"name": "emitter",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "sequence of the vaa",
|
||||||
|
"name": "seq",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"vaaBytes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"governor.AvailableNotionalItemResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bigTransactionSize": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"chainId": {
|
||||||
|
"$ref": "#/definitions/vaa.ChainID"
|
||||||
|
},
|
||||||
|
"notionalLimit": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"remainingAvailableNotional": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.AvailableNotionalResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/governor.AvailableNotionalItemResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.EnqueuedVaaItemResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"emitterAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"emitterChain": {
|
||||||
|
"$ref": "#/definitions/vaa.ChainID"
|
||||||
|
},
|
||||||
|
"notionalValue": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"releaseTime": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"sequence": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"txHash": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.EnqueuedVaaResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/governor.EnqueuedVaaItemResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.TokenList": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"originAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"originChainId": {
|
||||||
|
"$ref": "#/definitions/vaa.ChainID"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"guardian.GuardianSet": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"addresses": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"index": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"guardian.GuardianSetResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"guardianSet": {
|
||||||
|
"$ref": "#/definitions/guardian.GuardianSet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.HeartbeatNetworkResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"contractAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"errorCount": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.HeartbeatResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"p2pNodeAddr": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"rawHeartbeat": {
|
||||||
|
"$ref": "#/definitions/heartbeats.RawHeartbeat"
|
||||||
|
},
|
||||||
|
"verifiedGuardianAddr": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.HeartbeatsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/heartbeats.HeartbeatResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.RawHeartbeat": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bootTimestamp": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"counter": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"guardianAddr": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"networks": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/heartbeats.HeartbeatNetworkResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nodeName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"version": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vaa.ChainID": {
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
14,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
17,
|
||||||
|
18,
|
||||||
|
19,
|
||||||
|
26,
|
||||||
|
10001
|
||||||
|
],
|
||||||
|
"x-enum-varnames": [
|
||||||
|
"ChainIDUnset",
|
||||||
|
"ChainIDSolana",
|
||||||
|
"ChainIDEthereum",
|
||||||
|
"ChainIDTerra",
|
||||||
|
"ChainIDBSC",
|
||||||
|
"ChainIDPolygon",
|
||||||
|
"ChainIDAvalanche",
|
||||||
|
"ChainIDOasis",
|
||||||
|
"ChainIDAlgorand",
|
||||||
|
"ChainIDAurora",
|
||||||
|
"ChainIDFantom",
|
||||||
|
"ChainIDKarura",
|
||||||
|
"ChainIDAcala",
|
||||||
|
"ChainIDKlaytn",
|
||||||
|
"ChainIDCelo",
|
||||||
|
"ChainIDNear",
|
||||||
|
"ChainIDMoonbeam",
|
||||||
|
"ChainIDNeon",
|
||||||
|
"ChainIDTerra2",
|
||||||
|
"ChainIDInjective",
|
||||||
|
"ChainIDPythNet",
|
||||||
|
"ChainIDEthereumRopsten"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}`
|
||||||
|
|
||||||
|
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||||
|
var SwaggerInfo = &swag.Spec{
|
||||||
|
Version: "1.0",
|
||||||
|
Host: "",
|
||||||
|
BasePath: "/v1",
|
||||||
|
Schemes: []string{},
|
||||||
|
Title: "Wormhole Guardian API",
|
||||||
|
Description: "Wormhole Guardian API\n\nIt is used to provide a way to interact with the Wormhole Network.\nCheck each endpoint documentation for more information.",
|
||||||
|
InfoInstanceName: "swagger",
|
||||||
|
SwaggerTemplate: docTemplate,
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||||
|
}
|
|
@ -0,0 +1,535 @@
|
||||||
|
{
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "Wormhole Guardian API\n\nIt is used to provide a way to interact with the Wormhole Network.\nCheck each endpoint documentation for more information.",
|
||||||
|
"title": "Wormhole Guardian API",
|
||||||
|
"termsOfService": "https://wormhole.com/",
|
||||||
|
"contact": {
|
||||||
|
"name": "API Support",
|
||||||
|
"url": "http://www.swagger.io/support",
|
||||||
|
"email": "support@swagger.io"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "Apache 2.0",
|
||||||
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
|
},
|
||||||
|
"version": "1.0"
|
||||||
|
},
|
||||||
|
"basePath": "/v1",
|
||||||
|
"paths": {
|
||||||
|
"/v1/governor/available_notional_by_chain": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get available notional by chainID\nSince from the wormhole-explorer point of view it is not a node, but has the information of all nodes,\nin order to build the endpoints it was assumed:\nThere are N number of remainingAvailableNotional values in the GovernorConfig collection. N = number of guardians\nfor a chainID. The smallest remainingAvailableNotional value for a chainID is used for the endpoint response.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "governor-available-notional-by-chain",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/governor.AvailableNotionalResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/governor/enqueued_vaas": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get enqueued vaa's",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-enqueued-vaas",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/governor.EnqueuedVaaResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/governor/is_vaa_enqueued/{chain_id}/{emitter}/{seq}": {
|
||||||
|
"get": {
|
||||||
|
"description": "Check if vaa is enqueued",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-is-vaa-enqueued",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id of the blockchain",
|
||||||
|
"name": "chain_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "address of the emitter",
|
||||||
|
"name": "emitter",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "sequence of the vaa",
|
||||||
|
"name": "seq",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/governor.EnqueuedVaaResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/governor/token_list": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get token list\nSince from the wormhole-explorer point of view it is not a node, but has the information of all nodes,\nin order to build the endpoints it was assumed:\nFor tokens with the same originChainId and originAddress and different price values for each node,\nthe price that has most occurrences in all the nodes for an originChainId and originAddress is returned.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-token-list",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/governor.TokenList"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/guardianset/current": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get current guardian set.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardian-set",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/guardian.GuardianSetResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/heartbeats": {
|
||||||
|
"get": {
|
||||||
|
"description": "Get heartbeats for guardians",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-hearbeats",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/heartbeats.HeartbeatsResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/signed_batch_vaa/{chain_id}/{emitter}/sequence/{seq}": {
|
||||||
|
"get": {
|
||||||
|
"description": "get a batch of VAA []byte from a chainID, emitter address and sequence.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-find-signed-batch-vaa",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id of the blockchain",
|
||||||
|
"name": "chain_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "address of the emitter",
|
||||||
|
"name": "emitter",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "sequence of the vaa",
|
||||||
|
"name": "seq",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"vaaBytes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/signed_vaa/{chain_id}/{emitter}/{seq}": {
|
||||||
|
"get": {
|
||||||
|
"description": "get a VAA []byte from a chainID, emitter address and sequence.",
|
||||||
|
"tags": [
|
||||||
|
"Guardian"
|
||||||
|
],
|
||||||
|
"operationId": "guardians-find-signed-vaa",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "id of the blockchain",
|
||||||
|
"name": "chain_id",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "address of the emitter",
|
||||||
|
"name": "emitter",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "integer",
|
||||||
|
"description": "sequence of the vaa",
|
||||||
|
"name": "seq",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"vaaBytes": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Bad Request"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal Server Error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"governor.AvailableNotionalItemResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bigTransactionSize": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"chainId": {
|
||||||
|
"$ref": "#/definitions/vaa.ChainID"
|
||||||
|
},
|
||||||
|
"notionalLimit": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"remainingAvailableNotional": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.AvailableNotionalResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/governor.AvailableNotionalItemResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.EnqueuedVaaItemResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"emitterAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"emitterChain": {
|
||||||
|
"$ref": "#/definitions/vaa.ChainID"
|
||||||
|
},
|
||||||
|
"notionalValue": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"releaseTime": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"sequence": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"txHash": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.EnqueuedVaaResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/governor.EnqueuedVaaItemResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"governor.TokenList": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"originAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"originChainId": {
|
||||||
|
"$ref": "#/definitions/vaa.ChainID"
|
||||||
|
},
|
||||||
|
"price": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"guardian.GuardianSet": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"addresses": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"index": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"guardian.GuardianSetResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"guardianSet": {
|
||||||
|
"$ref": "#/definitions/guardian.GuardianSet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.HeartbeatNetworkResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"contractAddress": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"errorCount": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"height": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"id": {
|
||||||
|
"type": "integer"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.HeartbeatResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"p2pNodeAddr": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"rawHeartbeat": {
|
||||||
|
"$ref": "#/definitions/heartbeats.RawHeartbeat"
|
||||||
|
},
|
||||||
|
"verifiedGuardianAddr": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.HeartbeatsResponse": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"entries": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/heartbeats.HeartbeatResponse"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"heartbeats.RawHeartbeat": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"bootTimestamp": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"counter": {
|
||||||
|
"type": "integer"
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"guardianAddr": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"networks": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/heartbeats.HeartbeatNetworkResponse"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nodeName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"version": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vaa.ChainID": {
|
||||||
|
"type": "integer",
|
||||||
|
"enum": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4,
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8,
|
||||||
|
9,
|
||||||
|
10,
|
||||||
|
11,
|
||||||
|
12,
|
||||||
|
13,
|
||||||
|
14,
|
||||||
|
15,
|
||||||
|
16,
|
||||||
|
17,
|
||||||
|
18,
|
||||||
|
19,
|
||||||
|
26,
|
||||||
|
10001
|
||||||
|
],
|
||||||
|
"x-enum-varnames": [
|
||||||
|
"ChainIDUnset",
|
||||||
|
"ChainIDSolana",
|
||||||
|
"ChainIDEthereum",
|
||||||
|
"ChainIDTerra",
|
||||||
|
"ChainIDBSC",
|
||||||
|
"ChainIDPolygon",
|
||||||
|
"ChainIDAvalanche",
|
||||||
|
"ChainIDOasis",
|
||||||
|
"ChainIDAlgorand",
|
||||||
|
"ChainIDAurora",
|
||||||
|
"ChainIDFantom",
|
||||||
|
"ChainIDKarura",
|
||||||
|
"ChainIDAcala",
|
||||||
|
"ChainIDKlaytn",
|
||||||
|
"ChainIDCelo",
|
||||||
|
"ChainIDNear",
|
||||||
|
"ChainIDMoonbeam",
|
||||||
|
"ChainIDNeon",
|
||||||
|
"ChainIDTerra2",
|
||||||
|
"ChainIDInjective",
|
||||||
|
"ChainIDPythNet",
|
||||||
|
"ChainIDEthereumRopsten"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,375 @@
|
||||||
|
basePath: /v1
|
||||||
|
definitions:
|
||||||
|
governor.AvailableNotionalItemResponse:
|
||||||
|
properties:
|
||||||
|
bigTransactionSize:
|
||||||
|
type: string
|
||||||
|
chainId:
|
||||||
|
$ref: '#/definitions/vaa.ChainID'
|
||||||
|
notionalLimit:
|
||||||
|
type: string
|
||||||
|
remainingAvailableNotional:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
governor.AvailableNotionalResponse:
|
||||||
|
properties:
|
||||||
|
entries:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/governor.AvailableNotionalItemResponse'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
governor.EnqueuedVaaItemResponse:
|
||||||
|
properties:
|
||||||
|
emitterAddress:
|
||||||
|
type: string
|
||||||
|
emitterChain:
|
||||||
|
$ref: '#/definitions/vaa.ChainID'
|
||||||
|
notionalValue:
|
||||||
|
type: string
|
||||||
|
releaseTime:
|
||||||
|
type: integer
|
||||||
|
sequence:
|
||||||
|
type: integer
|
||||||
|
txHash:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
governor.EnqueuedVaaResponse:
|
||||||
|
properties:
|
||||||
|
entries:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/governor.EnqueuedVaaItemResponse'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
governor.TokenList:
|
||||||
|
properties:
|
||||||
|
originAddress:
|
||||||
|
type: string
|
||||||
|
originChainId:
|
||||||
|
$ref: '#/definitions/vaa.ChainID'
|
||||||
|
price:
|
||||||
|
type: number
|
||||||
|
type: object
|
||||||
|
guardian.GuardianSet:
|
||||||
|
properties:
|
||||||
|
addresses:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
index:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
|
guardian.GuardianSetResponse:
|
||||||
|
properties:
|
||||||
|
guardianSet:
|
||||||
|
$ref: '#/definitions/guardian.GuardianSet'
|
||||||
|
type: object
|
||||||
|
heartbeats.HeartbeatNetworkResponse:
|
||||||
|
properties:
|
||||||
|
contractAddress:
|
||||||
|
type: string
|
||||||
|
errorCount:
|
||||||
|
type: string
|
||||||
|
height:
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
type: object
|
||||||
|
heartbeats.HeartbeatResponse:
|
||||||
|
properties:
|
||||||
|
p2pNodeAddr:
|
||||||
|
type: string
|
||||||
|
rawHeartbeat:
|
||||||
|
$ref: '#/definitions/heartbeats.RawHeartbeat'
|
||||||
|
verifiedGuardianAddr:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
heartbeats.HeartbeatsResponse:
|
||||||
|
properties:
|
||||||
|
entries:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/heartbeats.HeartbeatResponse'
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
heartbeats.RawHeartbeat:
|
||||||
|
properties:
|
||||||
|
bootTimestamp:
|
||||||
|
type: string
|
||||||
|
counter:
|
||||||
|
type: integer
|
||||||
|
features:
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
type: array
|
||||||
|
guardianAddr:
|
||||||
|
type: string
|
||||||
|
networks:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/heartbeats.HeartbeatNetworkResponse'
|
||||||
|
type: array
|
||||||
|
nodeName:
|
||||||
|
type: string
|
||||||
|
timestamp:
|
||||||
|
type: string
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
|
vaa.ChainID:
|
||||||
|
enum:
|
||||||
|
- 0
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
- 3
|
||||||
|
- 4
|
||||||
|
- 5
|
||||||
|
- 6
|
||||||
|
- 7
|
||||||
|
- 8
|
||||||
|
- 9
|
||||||
|
- 10
|
||||||
|
- 11
|
||||||
|
- 12
|
||||||
|
- 13
|
||||||
|
- 14
|
||||||
|
- 15
|
||||||
|
- 16
|
||||||
|
- 17
|
||||||
|
- 18
|
||||||
|
- 19
|
||||||
|
- 26
|
||||||
|
- 10001
|
||||||
|
type: integer
|
||||||
|
x-enum-varnames:
|
||||||
|
- ChainIDUnset
|
||||||
|
- ChainIDSolana
|
||||||
|
- ChainIDEthereum
|
||||||
|
- ChainIDTerra
|
||||||
|
- ChainIDBSC
|
||||||
|
- ChainIDPolygon
|
||||||
|
- ChainIDAvalanche
|
||||||
|
- ChainIDOasis
|
||||||
|
- ChainIDAlgorand
|
||||||
|
- ChainIDAurora
|
||||||
|
- ChainIDFantom
|
||||||
|
- ChainIDKarura
|
||||||
|
- ChainIDAcala
|
||||||
|
- ChainIDKlaytn
|
||||||
|
- ChainIDCelo
|
||||||
|
- ChainIDNear
|
||||||
|
- ChainIDMoonbeam
|
||||||
|
- ChainIDNeon
|
||||||
|
- ChainIDTerra2
|
||||||
|
- ChainIDInjective
|
||||||
|
- ChainIDPythNet
|
||||||
|
- ChainIDEthereumRopsten
|
||||||
|
info:
|
||||||
|
contact:
|
||||||
|
email: support@swagger.io
|
||||||
|
name: API Support
|
||||||
|
url: http://www.swagger.io/support
|
||||||
|
description: |-
|
||||||
|
Wormhole Guardian API
|
||||||
|
|
||||||
|
It is used to provide a way to interact with the Wormhole Network.
|
||||||
|
Check each endpoint documentation for more information.
|
||||||
|
license:
|
||||||
|
name: Apache 2.0
|
||||||
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
termsOfService: https://wormhole.com/
|
||||||
|
title: Wormhole Guardian API
|
||||||
|
version: "1.0"
|
||||||
|
paths:
|
||||||
|
/v1/governor/available_notional_by_chain:
|
||||||
|
get:
|
||||||
|
description: |-
|
||||||
|
Get available notional by chainID
|
||||||
|
Since from the wormhole-explorer point of view it is not a node, but has the information of all nodes,
|
||||||
|
in order to build the endpoints it was assumed:
|
||||||
|
There are N number of remainingAvailableNotional values in the GovernorConfig collection. N = number of guardians
|
||||||
|
for a chainID. The smallest remainingAvailableNotional value for a chainID is used for the endpoint response.
|
||||||
|
operationId: governor-available-notional-by-chain
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/governor.AvailableNotionalResponse'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
/v1/governor/enqueued_vaas:
|
||||||
|
get:
|
||||||
|
description: Get enqueued vaa's
|
||||||
|
operationId: guardians-enqueued-vaas
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/governor.EnqueuedVaaResponse'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
/v1/governor/is_vaa_enqueued/{chain_id}/{emitter}/{seq}:
|
||||||
|
get:
|
||||||
|
description: Check if vaa is enqueued
|
||||||
|
operationId: guardians-is-vaa-enqueued
|
||||||
|
parameters:
|
||||||
|
- description: id of the blockchain
|
||||||
|
in: path
|
||||||
|
name: chain_id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: address of the emitter
|
||||||
|
in: path
|
||||||
|
name: emitter
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: sequence of the vaa
|
||||||
|
in: path
|
||||||
|
name: seq
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/governor.EnqueuedVaaResponse'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
/v1/governor/token_list:
|
||||||
|
get:
|
||||||
|
description: |-
|
||||||
|
Get token list
|
||||||
|
Since from the wormhole-explorer point of view it is not a node, but has the information of all nodes,
|
||||||
|
in order to build the endpoints it was assumed:
|
||||||
|
For tokens with the same originChainId and originAddress and different price values for each node,
|
||||||
|
the price that has most occurrences in all the nodes for an originChainId and originAddress is returned.
|
||||||
|
operationId: guardians-token-list
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/governor.TokenList'
|
||||||
|
type: array
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
/v1/guardianset/current:
|
||||||
|
get:
|
||||||
|
description: Get current guardian set.
|
||||||
|
operationId: guardian-set
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/guardian.GuardianSetResponse'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
/v1/heartbeats:
|
||||||
|
get:
|
||||||
|
description: Get heartbeats for guardians
|
||||||
|
operationId: guardians-hearbeats
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/heartbeats.HeartbeatsResponse'
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
/v1/signed_batch_vaa/{chain_id}/{emitter}/sequence/{seq}:
|
||||||
|
get:
|
||||||
|
description: get a batch of VAA []byte from a chainID, emitter address and sequence.
|
||||||
|
operationId: guardians-find-signed-batch-vaa
|
||||||
|
parameters:
|
||||||
|
- description: id of the blockchain
|
||||||
|
in: path
|
||||||
|
name: chain_id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: address of the emitter
|
||||||
|
in: path
|
||||||
|
name: emitter
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: sequence of the vaa
|
||||||
|
in: path
|
||||||
|
name: seq
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- type: object
|
||||||
|
- properties:
|
||||||
|
vaaBytes:
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
/v1/signed_vaa/{chain_id}/{emitter}/{seq}:
|
||||||
|
get:
|
||||||
|
description: get a VAA []byte from a chainID, emitter address and sequence.
|
||||||
|
operationId: guardians-find-signed-vaa
|
||||||
|
parameters:
|
||||||
|
- description: id of the blockchain
|
||||||
|
in: path
|
||||||
|
name: chain_id
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
- description: address of the emitter
|
||||||
|
in: path
|
||||||
|
name: emitter
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
- description: sequence of the vaa
|
||||||
|
in: path
|
||||||
|
name: seq
|
||||||
|
required: true
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- type: object
|
||||||
|
- properties:
|
||||||
|
vaaBytes:
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
type: array
|
||||||
|
type: object
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
|
"500":
|
||||||
|
description: Internal Server Error
|
||||||
|
tags:
|
||||||
|
- Guardian
|
||||||
|
swagger: "2.0"
|
|
@ -177,12 +177,18 @@ type AvailableNotionalItemResponse struct {
|
||||||
MaxTransactionSize string `json:"bigTransactionSize"`
|
MaxTransactionSize string `json:"bigTransactionSize"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAvailNotionByChain handler for the endpoint /guardian_public_api/v1/governor/available_notional_by_chain
|
// GetAvailNotionByChain godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description Get available notional by chainID
|
||||||
// Since from the wormhole-explorer point of view it is not a node, but has the information of all nodes,
|
// @Description Since from the wormhole-explorer point of view it is not a node, but has the information of all nodes,
|
||||||
// in order to build the endpoints it was assumed:
|
// @Description in order to build the endpoints it was assumed:
|
||||||
// There are N number of remainingAvailableNotional values in the GovernorConfig collection. N = number of guardians
|
// @Description There are N number of remainingAvailableNotional values in the GovernorConfig collection. N = number of guardians
|
||||||
// for a chainID. The smallest remainingAvailableNotional value for a chainID is used for the endpoint response.
|
// @Description for a chainID. The smallest remainingAvailableNotional value for a chainID is used for the endpoint response.
|
||||||
|
// @Tags Guardian
|
||||||
|
// @ID governor-available-notional-by-chain
|
||||||
|
// @Success 200 {object} AvailableNotionalResponse
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/governor/available_notional_by_chain [get]
|
||||||
func (c *Controller) GetAvailNotionByChain(ctx *fiber.Ctx) error {
|
func (c *Controller) GetAvailNotionByChain(ctx *fiber.Ctx) error {
|
||||||
// call service to get available notional by chainID
|
// call service to get available notional by chainID
|
||||||
availableNotional, err := c.srv.GetAvailNotionByChain(ctx.Context())
|
availableNotional, err := c.srv.GetAvailNotionByChain(ctx.Context())
|
||||||
|
@ -221,9 +227,14 @@ type EnqueuedVaaItemResponse struct {
|
||||||
TxHash string `json:"txHash"`
|
TxHash string `json:"txHash"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetEnqueuedVaas handler for the endpoint /guardian_public_api/v1/governor/enqueued_vaas
|
// GetEnqueuedVaas godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description Get enqueued vaa's
|
||||||
// The endpoint returns the enqueued VAA for all guardian nodes.
|
// @Tags Guardian
|
||||||
|
// @ID guardians-enqueued-vaas
|
||||||
|
// @Success 200 {object} EnqueuedVaaResponse
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/governor/enqueued_vaas [get]
|
||||||
func (c *Controller) GetEnqueuedVaas(ctx *fiber.Ctx) error {
|
func (c *Controller) GetEnqueuedVaas(ctx *fiber.Ctx) error {
|
||||||
enqueuedVaa, err := c.srv.GetEnqueuedVaas(ctx.Context())
|
enqueuedVaa, err := c.srv.GetEnqueuedVaas(ctx.Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -254,8 +265,17 @@ func (c *Controller) GetEnqueuedVaas(ctx *fiber.Ctx) error {
|
||||||
return ctx.JSON(response)
|
return ctx.JSON(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsVaaEnqueued handler for the endpoint /guardian_public_api/v1/governor/is_vaa_enqueued
|
// IsVaaEnqueued godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description Check if vaa is enqueued
|
||||||
|
// @Tags Guardian
|
||||||
|
// @ID guardians-is-vaa-enqueued
|
||||||
|
// @Param chain_id path integer true "id of the blockchain"
|
||||||
|
// @Param emitter path string true "address of the emitter"
|
||||||
|
// @Param seq path integer true "sequence of the vaa"
|
||||||
|
// @Success 200 {object} EnqueuedVaaResponse
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/governor/is_vaa_enqueued/{chain_id}/{emitter}/{seq} [get]
|
||||||
func (c *Controller) IsVaaEnqueued(ctx *fiber.Ctx) error {
|
func (c *Controller) IsVaaEnqueued(ctx *fiber.Ctx) error {
|
||||||
chainID, emitter, seq, err := middleware.ExtractVAAParams(ctx, c.logger)
|
chainID, emitter, seq, err := middleware.ExtractVAAParams(ctx, c.logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -275,12 +295,18 @@ func (c *Controller) IsVaaEnqueued(ctx *fiber.Ctx) error {
|
||||||
return ctx.JSON(response)
|
return ctx.JSON(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTokenList handler for the endpoint /guardian_public_api/v1/governor/token_list
|
// GetTokenList godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description Get token list
|
||||||
// Since from the wormhole-explorer point of view it is not a node, but has the information of all nodes,
|
// @Description Since from the wormhole-explorer point of view it is not a node, but has the information of all nodes,
|
||||||
// in order to build the endpoints it was assumed:
|
// @Description in order to build the endpoints it was assumed:
|
||||||
// For tokens with the same originChainId and originAddress and different price values for each node,
|
// @Description For tokens with the same originChainId and originAddress and different price values for each node,
|
||||||
// the price that has most occurrences in all the nodes for an originChainId and originAddress is returned.
|
// @Description the price that has most occurrences in all the nodes for an originChainId and originAddress is returned.
|
||||||
|
// @Tags Guardian
|
||||||
|
// @ID guardians-token-list
|
||||||
|
// @Success 200 {object} []TokenList
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/governor/token_list [get]
|
||||||
func (c *Controller) GetTokenList(ctx *fiber.Ctx) error {
|
func (c *Controller) GetTokenList(ctx *fiber.Ctx) error {
|
||||||
tokenList, err := c.srv.GetTokenList(ctx.Context())
|
tokenList, err := c.srv.GetTokenList(ctx.Context())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -27,8 +27,14 @@ type GuardianSet struct {
|
||||||
Addresses []string `json:"addresses"`
|
Addresses []string `json:"addresses"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetGuardianSet handler for the endpoint /guardian_public_api/v1/guardianset/current
|
// GetGuardianSet godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description Get current guardian set.
|
||||||
|
// @Tags Guardian
|
||||||
|
// @ID guardian-set
|
||||||
|
// @Success 200 {object} GuardianSetResponse
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/guardianset/current [get]
|
||||||
func (c *Controller) GetGuardianSet(ctx *fiber.Ctx) error {
|
func (c *Controller) GetGuardianSet(ctx *fiber.Ctx) error {
|
||||||
// check guardianSet exists.
|
// check guardianSet exists.
|
||||||
if len(ByIndex) == 0 {
|
if len(ByIndex) == 0 {
|
||||||
|
|
|
@ -53,8 +53,14 @@ type HeartbeatNetworkResponse struct {
|
||||||
ErrorCount string `bson:"errorcount" json:"errorCount"`
|
ErrorCount string `bson:"errorcount" json:"errorCount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetLastHeartbeats handler for the endpoint /guardian_public_api/v1/heartbeats
|
// GetGuardianSet godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description Get heartbeats for guardians
|
||||||
|
// @Tags Guardian
|
||||||
|
// @ID guardians-hearbeats
|
||||||
|
// @Success 200 {object} HeartbeatsResponse
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/heartbeats [get]
|
||||||
func (c *Controller) GetLastHeartbeats(ctx *fiber.Ctx) error {
|
func (c *Controller) GetLastHeartbeats(ctx *fiber.Ctx) error {
|
||||||
// check guardianSet exists.
|
// check guardianSet exists.
|
||||||
if len(guardian.ByIndex) == 0 {
|
if len(guardian.ByIndex) == 0 {
|
||||||
|
|
|
@ -73,8 +73,17 @@ func (c *Controller) FindById(ctx *fiber.Ctx) error {
|
||||||
return ctx.JSON(vaa)
|
return ctx.JSON(vaa)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindSignedVAAByID get a VAA []byte from a chainID, emitter address and sequence.
|
// FindSignedVAAByID godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description get a VAA []byte from a chainID, emitter address and sequence.
|
||||||
|
// @Tags Guardian
|
||||||
|
// @ID guardians-find-signed-vaa
|
||||||
|
// @Param chain_id path integer true "id of the blockchain"
|
||||||
|
// @Param emitter path string true "address of the emitter"
|
||||||
|
// @Param seq path integer true "sequence of the vaa"
|
||||||
|
// @Success 200 {object} object{vaaBytes=[]byte}
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/signed_vaa/{chain_id}/{emitter}/{seq} [get]
|
||||||
func (c *Controller) FindSignedVAAByID(ctx *fiber.Ctx) error {
|
func (c *Controller) FindSignedVAAByID(ctx *fiber.Ctx) error {
|
||||||
chainID, emitter, seq, err := middleware.ExtractVAAParams(ctx, c.logger)
|
chainID, emitter, seq, err := middleware.ExtractVAAParams(ctx, c.logger)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -99,8 +108,17 @@ func (c *Controller) FindSignedVAAByID(ctx *fiber.Ctx) error {
|
||||||
return ctx.JSON(response)
|
return ctx.JSON(response)
|
||||||
}
|
}
|
||||||
|
|
||||||
// FindSignedBatchVAAByID get a Batch VAA from a chainID, emitter address and sequence.
|
// FindSignedBatchVAAByID godoc
|
||||||
// This endpoint has been migrated from the guardian grpc api.
|
// @Description get a batch of VAA []byte from a chainID, emitter address and sequence.
|
||||||
|
// @Tags Guardian
|
||||||
|
// @ID guardians-find-signed-batch-vaa
|
||||||
|
// @Param chain_id path integer true "id of the blockchain"
|
||||||
|
// @Param emitter path string true "address of the emitter"
|
||||||
|
// @Param seq path integer true "sequence of the vaa"
|
||||||
|
// @Success 200 {object} object{vaaBytes=[]byte}
|
||||||
|
// @Failure 400
|
||||||
|
// @Failure 500
|
||||||
|
// @Router /v1/signed_batch_vaa/{chain_id}/{emitter}/sequence/{seq} [get]
|
||||||
func (c *Controller) FindSignedBatchVAAByID(ctx *fiber.Ctx) error {
|
func (c *Controller) FindSignedBatchVAAByID(ctx *fiber.Ctx) error {
|
||||||
return response.NewApiError(ctx, fiber.StatusNotImplemented, response.Unimplemented, "not yet implemented", nil)
|
return response.NewApiError(ctx, fiber.StatusNotImplemented, response.Unimplemented, "not yet implemented", nil)
|
||||||
}
|
}
|
||||||
|
|
12
api/main.go
12
api/main.go
|
@ -42,6 +42,18 @@ func healthOk(ctx *fiber.Ctx) error {
|
||||||
return ctx.SendString("Ok")
|
return ctx.SendString("Ok")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @title Wormhole Guardian API
|
||||||
|
// @version 1.0
|
||||||
|
// @description Wormhole Guardian API
|
||||||
|
// @description To get information from the Wormhole Network.
|
||||||
|
// @description Check each endpoint documentation for more information.
|
||||||
|
// @termsOfService https://wormhole.com/
|
||||||
|
// @contact.name API Support
|
||||||
|
// @contact.url http://wormhole.com/support
|
||||||
|
// @contact.email info@wormhole.com
|
||||||
|
// @license.name Apache 2.0
|
||||||
|
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
// @BasePath /v1
|
||||||
func main() {
|
func main() {
|
||||||
appCtx, cancel := context.WithCancel(context.Background())
|
appCtx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
Loading…
Reference in New Issue