Skip to content

Commit

Permalink
add staking delegations v2 endpoint (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-babylonlabs authored Nov 7, 2024
1 parent c511db2 commit 1956e12
Show file tree
Hide file tree
Showing 9 changed files with 239 additions and 243 deletions.
121 changes: 45 additions & 76 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,6 @@ const docTemplate = `{
"name": "pagination_key",
"in": "query"
},
{
"type": "string",
"description": "Search by moniker, finality provider PK",
"name": "search",
"in": "query"
},
{
"enum": [
"active",
Expand Down Expand Up @@ -449,47 +443,6 @@ const docTemplate = `{
}
}
},
"/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": [
{
"type": "string",
"description": "Finality provider public key",
"name": "pk",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Finality provider details",
"schema": {
"$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"
}
}
}
}
},
"/v2/global-params": {
"get": {
"description": "Fetches global parameters for babylon chain and BTC chain",
Expand Down Expand Up @@ -523,8 +476,8 @@ const docTemplate = `{
"parameters": [
{
"type": "string",
"description": "Staking transaction hash in hex format",
"name": "staking_tx_hash_hex",
"description": "Staker public key in hex format",
"name": "staker_pk_hex",
"in": "query",
"required": true
},
Expand Down Expand Up @@ -827,6 +780,27 @@ const docTemplate = `{
}
}
},
"indexertypes.DelegationState": {
"type": "string",
"enum": [
"PENDING",
"VERIFIED",
"ACTIVE",
"UNBONDING",
"WITHDRAWABLE",
"WITHDRAWN",
"SLASHED"
],
"x-enum-varnames": [
"StatePending",
"StateVerified",
"StateActive",
"StateUnbonding",
"StateWithdrawable",
"StateWithdrawn",
"StateSlashed"
]
},
"types.ErrorCode": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -868,7 +842,7 @@ const docTemplate = `{
}
}
},
"types.FinalityProviderState": {
"types.FinalityProviderQueryingState": {
"type": "string",
"enum": [
"active",
Expand All @@ -879,17 +853,6 @@ 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 @@ -1139,7 +1102,7 @@ const docTemplate = `{
"$ref": "#/definitions/types.FinalityProviderDescription"
},
"state": {
"$ref": "#/definitions/types.FinalityProviderState"
"$ref": "#/definitions/types.FinalityProviderQueryingState"
},
"total_delegations": {
"type": "integer"
Expand Down Expand Up @@ -1198,35 +1161,41 @@ const docTemplate = `{
"v2service.StakerDelegationPublic": {
"type": "object",
"properties": {
"finality_provider_pk_hex": {
"end_height": {
"type": "integer"
},
"finality_provider_btc_pks_hex": {
"type": "array",
"items": {
"type": "string"
}
},
"params_version": {
"type": "string"
},
"staker_pk_hex": {
"staker_btc_pk_hex": {
"type": "string"
},
"staking_start_height": {
"type": "integer"
"staking_amount": {
"type": "string"
},
"staking_tx": {
"$ref": "#/definitions/types.TransactionInfo"
"staking_time": {
"type": "string"
},
"staking_tx_hash_hex": {
"type": "string"
},
"staking_value": {
"start_height": {
"type": "integer"
},
"state": {
"type": "string"
},
"timelock": {
"type": "integer"
"$ref": "#/definitions/indexertypes.DelegationState"
},
"unbonding_start_height": {
"type": "integer"
"unbonding_time": {
"type": "string"
},
"unbonding_tx": {
"$ref": "#/definitions/types.TransactionInfo"
"type": "string"
}
}
},
Expand Down
121 changes: 45 additions & 76 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,6 @@
"name": "pagination_key",
"in": "query"
},
{
"type": "string",
"description": "Search by moniker, finality provider PK",
"name": "search",
"in": "query"
},
{
"enum": [
"active",
Expand Down Expand Up @@ -441,47 +435,6 @@
}
}
},
"/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": [
{
"type": "string",
"description": "Finality provider public key",
"name": "pk",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Finality provider details",
"schema": {
"$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"
}
}
}
}
},
"/v2/global-params": {
"get": {
"description": "Fetches global parameters for babylon chain and BTC chain",
Expand Down Expand Up @@ -515,8 +468,8 @@
"parameters": [
{
"type": "string",
"description": "Staking transaction hash in hex format",
"name": "staking_tx_hash_hex",
"description": "Staker public key in hex format",
"name": "staker_pk_hex",
"in": "query",
"required": true
},
Expand Down Expand Up @@ -819,6 +772,27 @@
}
}
},
"indexertypes.DelegationState": {
"type": "string",
"enum": [
"PENDING",
"VERIFIED",
"ACTIVE",
"UNBONDING",
"WITHDRAWABLE",
"WITHDRAWN",
"SLASHED"
],
"x-enum-varnames": [
"StatePending",
"StateVerified",
"StateActive",
"StateUnbonding",
"StateWithdrawable",
"StateWithdrawn",
"StateSlashed"
]
},
"types.ErrorCode": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -860,7 +834,7 @@
}
}
},
"types.FinalityProviderState": {
"types.FinalityProviderQueryingState": {
"type": "string",
"enum": [
"active",
Expand All @@ -871,17 +845,6 @@
"FinalityProviderStateStandby"
]
},
"types.TransactionInfo": {
"type": "object",
"properties": {
"output_index": {
"type": "integer"
},
"tx_hex": {
"type": "string"
}
}
},
"v1handlers.DelegationCheckPublicResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1131,7 +1094,7 @@
"$ref": "#/definitions/types.FinalityProviderDescription"
},
"state": {
"$ref": "#/definitions/types.FinalityProviderState"
"$ref": "#/definitions/types.FinalityProviderQueryingState"
},
"total_delegations": {
"type": "integer"
Expand Down Expand Up @@ -1190,35 +1153,41 @@
"v2service.StakerDelegationPublic": {
"type": "object",
"properties": {
"finality_provider_pk_hex": {
"end_height": {
"type": "integer"
},
"finality_provider_btc_pks_hex": {
"type": "array",
"items": {
"type": "string"
}
},
"params_version": {
"type": "string"
},
"staker_pk_hex": {
"staker_btc_pk_hex": {
"type": "string"
},
"staking_start_height": {
"type": "integer"
"staking_amount": {
"type": "string"
},
"staking_tx": {
"$ref": "#/definitions/types.TransactionInfo"
"staking_time": {
"type": "string"
},
"staking_tx_hash_hex": {
"type": "string"
},
"staking_value": {
"start_height": {
"type": "integer"
},
"state": {
"type": "string"
},
"timelock": {
"type": "integer"
"$ref": "#/definitions/indexertypes.DelegationState"
},
"unbonding_start_height": {
"type": "integer"
"unbonding_time": {
"type": "string"
},
"unbonding_tx": {
"$ref": "#/definitions/types.TransactionInfo"
"type": "string"
}
}
},
Expand Down
Loading

0 comments on commit 1956e12

Please sign in to comment.