Skip to content

Commit

Permalink
finality providers v2 endpoint (#95)
Browse files Browse the repository at this point in the history
* add finality provider

* add filters

* resolve comments

* resolve comments
  • Loading branch information
jeremy-babylonlabs authored Nov 7, 2024
1 parent 19a7fbe commit c511db2
Show file tree
Hide file tree
Showing 16 changed files with 608 additions and 222 deletions.
2 changes: 1 addition & 1 deletion config/config-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ indexer-db:
username: root
password: example
address: "mongodb://localhost:27019/?directConnection=true"
db-name: indexer-db
db-name: babylon-staking-indexer
max-pagination-limit: 10
db-batch-size-limit: 100
queue:
Expand Down
143 changes: 87 additions & 56 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ const docTemplate = `{
"tags": [
"v1"
],
"deprecated": true,
"parameters": [
{
"type": "string",
Expand Down Expand Up @@ -400,61 +401,91 @@ const docTemplate = `{
},
"/v2/finality-providers": {
"get": {
"description": "Fetches finality providers including their public keys, active tvl, total tvl, descriptions, commission, active delegations and total delegations etc",
"description": "Fetches finality providers with optional filtering and pagination",
"produces": [
"application/json"
],
"tags": [
"v2"
],
"summary": "Get Finality Providers",
"summary": "List Finality Providers",
"parameters": [
{
"type": "string",
"description": "Pagination key to fetch the next page of finality providers",
"description": "Pagination key to fetch the next page",
"name": "pagination_key",
"in": "query"
},
{
"type": "string",
"description": "Filter by finality provider public key",
"name": "finality_provider_pk",
"description": "Search by moniker, finality provider PK",
"name": "search",
"in": "query"
},
{
"enum": [
"active_tvl",
"name",
"commission"
"active",
"standby"
],
"type": "string",
"description": "Sort by field",
"name": "sort_by",
"description": "Filter by state",
"name": "state",
"in": "query"
}
],
"responses": {
"200": {
"description": "List of finality providers and pagination token",
"schema": {
"$ref": "#/definitions/handler.PublicResponse-array_v2service_FinalityProviderPublic"
}
},
"400": {
"description": "Error: Bad Request",
"schema": {
"$ref": "#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error"
}
}
}
}
},
"/v2/finality-providers/{pk}": {
"get": {
"description": "Fetches a specific finality provider by their public key",
"produces": [
"application/json"
],
"tags": [
"v2"
],
"summary": "Get Finality Provider by PK",
"parameters": [
{
"enum": [
"asc",
"desc"
],
"type": "string",
"description": "Order",
"name": "order",
"in": "query"
"description": "Finality provider public key",
"name": "pk",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "List of finality providers and pagination token",
"description": "Finality provider details",
"schema": {
"$ref": "#/definitions/handler.PublicResponse-array_v2service_FinalityProviderPublic"
"$ref": "#/definitions/v2service.FinalityProviderPublic"
}
},
"400": {
"description": "Error: Bad Request",
"schema": {
"$ref": "#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error"
}
},
"404": {
"description": "Error: Not Found",
"schema": {
"$ref": "#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.Error"
}
}
}
}
Expand Down Expand Up @@ -579,17 +610,6 @@ const docTemplate = `{
}
}
},
"github_com_babylonlabs-io_staking-api-service_internal_shared_types.TransactionInfo": {
"type": "object",
"properties": {
"output_index": {
"type": "integer"
},
"tx_hex": {
"type": "string"
}
}
},
"handler.PublicResponse-array_v1service_DelegationPublic": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -743,18 +763,7 @@ const docTemplate = `{
}
}
},
"types.BTCParams": {
"type": "object",
"properties": {
"btc_confirmation_depth": {
"type": "integer"
},
"version": {
"type": "integer"
}
}
},
"types.BabylonParams": {
"indexertypes.BbnStakingParams": {
"type": "object",
"properties": {
"covenant_pks": {
Expand All @@ -772,34 +781,45 @@ const docTemplate = `{
"max_active_finality_providers": {
"type": "integer"
},
"max_staking_amount": {
"max_staking_time_blocks": {
"type": "integer"
},
"max_staking_time": {
"max_staking_value_sat": {
"type": "integer"
},
"min_commission_rate": {
"type": "number"
"type": "string"
},
"min_slashing_tx_fee": {
"min_slashing_tx_fee_sat": {
"type": "integer"
},
"min_staking_amount": {
"min_staking_time_blocks": {
"type": "integer"
},
"min_staking_time": {
"min_staking_value_sat": {
"type": "integer"
},
"min_unbonding_time": {
"min_unbonding_time_blocks": {
"type": "integer"
},
"slashing_pk_script": {
"type": "string"
},
"slashing_rate": {
"type": "number"
"type": "string"
},
"unbonding_fee": {
"unbonding_fee_sat": {
"type": "integer"
},
"version": {
"type": "integer"
}
}
},
"indexertypes.BtcCheckpointParams": {
"type": "object",
"properties": {
"btc_confirmation_depth": {
"type": "integer"
},
"version": {
Expand Down Expand Up @@ -859,6 +879,17 @@ const docTemplate = `{
"FinalityProviderStateStandby"
]
},
"types.TransactionInfo": {
"type": "object",
"properties": {
"output_index": {
"type": "integer"
},
"tx_hex": {
"type": "string"
}
}
},
"v1handlers.DelegationCheckPublicResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1121,16 +1152,16 @@ const docTemplate = `{
"v2service.GlobalParamsPublic": {
"type": "object",
"properties": {
"babylon": {
"bbn": {
"type": "array",
"items": {
"$ref": "#/definitions/types.BabylonParams"
"$ref": "#/definitions/indexertypes.BbnStakingParams"
}
},
"btc": {
"type": "array",
"items": {
"$ref": "#/definitions/types.BTCParams"
"$ref": "#/definitions/indexertypes.BtcCheckpointParams"
}
}
}
Expand Down Expand Up @@ -1177,7 +1208,7 @@ const docTemplate = `{
"type": "integer"
},
"staking_tx": {
"$ref": "#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.TransactionInfo"
"$ref": "#/definitions/types.TransactionInfo"
},
"staking_tx_hash_hex": {
"type": "string"
Expand All @@ -1195,7 +1226,7 @@ const docTemplate = `{
"type": "integer"
},
"unbonding_tx": {
"$ref": "#/definitions/github_com_babylonlabs-io_staking-api-service_internal_shared_types.TransactionInfo"
"$ref": "#/definitions/types.TransactionInfo"
}
}
},
Expand Down
Loading

0 comments on commit c511db2

Please sign in to comment.