From cd8a23d863b86abdc2f012b1729a97ed7e57bfcb Mon Sep 17 00:00:00 2001 From: Rayden Ge Date: Thu, 19 Dec 2024 13:36:47 +0100 Subject: [PATCH] chore(staking): api and error codes (#445) remove useless api and enhance event processing error codes issue: none --------- Signed-off-by: lutty Co-authored-by: haodi Co-authored-by: lutty --- client/server/README.md | 2023 +++++++++-------- client/server/api.swagger.yaml | 1381 +++++++---- client/server/bank.go | 2 +- client/server/distribution.go | 46 +- client/server/payload.go | 14 - client/x/evmstaking/keeper/redelegation.go | 18 +- client/x/evmstaking/keeper/unjail.go | 12 +- .../x/evmstaking/keeper/update_commission.go | 4 +- client/x/evmstaking/keeper/validator.go | 11 +- client/x/evmstaking/keeper/withdraw.go | 6 +- contracts/script/GenerateAlloc.s.sol | 10 +- lib/errors/codes.go | 64 +- 12 files changed, 2190 insertions(+), 1401 deletions(-) diff --git a/client/server/README.md b/client/server/README.md index 698754f3..eb184643 100644 --- a/client/server/README.md +++ b/client/server/README.md @@ -1,214 +1,556 @@ -## GetValidators - -URL: [GET] /staking/validators +## GetStakingParams -### Query Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| status | string | | ✔ | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +URL: [GET] /staking/params ### Response Example ```json { "code": 200, "msg": { - "validators": [ - { - "operator_address": "storyvaloper1l43wgqtf825k4qwx4lt6xremu0jjptv7w6q0ak", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "Avihb1CqLW0pX2YJ6ru0/N7sr5MWnk5JCy/U5ezQ9axo" - }, - "jailed": true, - "status": 1, - "tokens": "4750000000000", - "delegator_shares": "5000000000000.000000000000000000", - "description": { - "moniker": "validator-test104-21" + "params": { + "unbonding_time": "10000000000", + "max_validators": 32, + "max_entries": 14, + "historical_entries": 10000, + "bond_denom": "stake", + "min_commission_rate": "0.000000000000000000", + "min_delegation": "1024", + "periods": [ + { + "duration": "0", + "rewards_multiplier": "1.000000000000000000" }, - "unbonding_height": "4351", - "unbonding_time": "2024-10-21T14:12:46.362852882Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "update_time": "2024-10-21T13:37:04.758645464Z" + { + "period_type": 1, + "duration": "60000000000", + "rewards_multiplier": "1.051000000000000000" }, - "min_self_delegation": "1024", - "unbonding_ids": [ - "245" - ], - "rewards_tokens": "2375000000000.000000000000000000", - "delegator_rewards_shares": "2500000000000.000000000000000000" - }, - { - "operator_address": "storyvaloper17mmqx2r9d5zq8z9jcajxpc64tkhh5tuxzl5rdl", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "AxnWLFO8LIeRpbnrKFVY2P+vPzG6bI5tpkivg/F+0XM6" + { + "period_type": 2, + "duration": "120000000000", + "rewards_multiplier": "1.160000000000000000" }, - "jailed": true, - "status": 1, - "tokens": "4750000000000", - "delegator_shares": "5000000000000.000000000000000000", - "description": { - "moniker": "validator-test104-24" + { + "period_type": 3, + "duration": "180000000000", + "rewards_multiplier": "1.340000000000000000" + } + ], + "token_types": [ + { + "rewards_multiplier": "0.500000000000000000" }, - "unbonding_height": "4351", - "unbonding_time": "2024-10-21T14:12:46.362852882Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "update_time": "2024-10-21T13:38:30.541469298Z" + { + "token_type": 1, + "rewards_multiplier": "1.000000000000000000" + } + ] + } + }, + "error": "" +} +``` + +--- + +## GetStakingPool + +URL: [GET] /staking/pool + +### Response Example +```json +{ + "code": 200, + "msg": { + "pool": { + "not_bonded_tokens": "76461600000000", + "bonded_tokens": "80110471008000000" + } + }, + "error": "" +} +``` + +--- + +## GetHistoricalInfoByHeight + +URL: [GET] /staking/historical_info/{height} + +### Path Params +| Name | Type | Example | Require | +| --- | --- | --- | --- | +| height | integer | 1 | ✔ | + +### Response Example +```json +{ + "code": 200, + "msg": { + "hist": { + "header": { + "version": {}, + "chain_id": "odyssey-devnet-1", + "height": "6666", + "time": "2024-10-22T14:09:17.546670477Z", + "last_block_id": { + "part_set_header": {} }, - "min_self_delegation": "1024", - "unbonding_ids": [ - "244" - ], - "rewards_tokens": "2375000000000.000000000000000000", - "delegator_rewards_shares": "2500000000000.000000000000000000" + "next_validators_hash": "bHIf/wtJa7OBLolGYkRxgiAr72c708itMxqPhAwC0O4=", + "app_hash": "UDRmZ+Tg6ZMW0ZIuErfYXE1VS+QnWbAj8BVm9p07f3c=", + "proposer_address": "Y/nE5kiyRMMZVjDDr0YiArKC4w4=" }, - { - "operator_address": "storyvaloper17myx8sae0dxyd50je73j5fx9e7gemffefe5hey", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "Ak1HAUyvr5iPJztkNrISe7G06p244pnfzZXJqhFMUO7a" - }, - "jailed": true, - "status": 1, - "tokens": "4750000000000", - "delegator_shares": "5000000000000.000000000000000000", - "description": { - "moniker": "validator-test104-16" - }, - "unbonding_height": "4344", - "unbonding_time": "2024-10-21T14:12:24.142758147Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" + "valset": [ + { + "operator_address": "storyvaloper1w69rjypm25h84etxxhw5ax64jg42l3gyhr0j42", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A9mdRUGE+sv2oD6jfrNvalDGmELqOtQgOKjVU3vRWyWU" }, - "update_time": "2024-10-21T13:34:51.559498051Z" - }, - "min_self_delegation": "1024", - "unbonding_ids": [ - "181", - "243" - ], - "rewards_tokens": "2375000000000.000000000000000000", - "delegator_rewards_shares": "2500000000000.000000000000000000" - }, - { - "operator_address": "storyvaloper17z6fh2fqdqpa9am3a8m7c024r954j7hwgzdu0z", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "AgFUP1Y/JMO0GR4KvOxNRmYzzU1VThmVkEORPpvsaGk0" - }, - "jailed": true, - "status": 1, - "tokens": "1024000000000", - "delegator_shares": "1024000000000.000000000000000000", - "description": { - "moniker": "test-0x8F51B4fA7C60016A8e1Db1caE312E0dF63F21E00" - }, - "unbonding_height": "1166", - "unbonding_time": "2024-10-21T11:24:12.073004276Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" + "status": 3, + "tokens": "10104447001000000", + "delegator_shares": "10104447001000000.000000000000000000", + "description": { + "moniker": "0x768A39103B552E7AE56635DD4E9B55922AAFC504" }, - "update_time": "2024-10-21T11:22:55.156217405Z" - }, - "min_self_delegation": "1024", - "unbonding_ids": [ - "29" - ], - "support_token_type": 1, - "rewards_tokens": "1076224000000.000000000000000000", - "delegator_rewards_shares": "1076224000000.000000000000000000" - }, - { - "operator_address": "storyvaloper1amf8h5xfrh2hz0zweke42t6m86zrl7ycyzgd60", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "AooAFKj/AvQhjSgyylAeebrb8RgsbtMZxN3fefzjy2hf" - }, - "jailed": true, - "status": 1, - "tokens": "4750000000000", - "delegator_shares": "5000000000000.000000000000000000", - "description": { - "moniker": "validator-test104-13" - }, - "unbonding_height": "4318", - "unbonding_time": "2024-10-21T14:11:01.350669293Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" }, - "update_time": "2024-10-21T13:33:25.868660453Z" + "min_self_delegation": "1024", + "rewards_tokens": "5052223500500000.000000000000000000", + "delegator_rewards_shares": "5052223500500000.000000000000000000" }, - "min_self_delegation": "1024", - "unbonding_ids": [ - "180", - "242" - ], - "rewards_tokens": "2375000000000.000000000000000000", - "delegator_rewards_shares": "2500000000000.000000000000000000" - }, + { + "operator_address": "storyvaloper1q9vn6g9fj96rw2anyklt56v96rf20ap5z7zha7", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A3e5PxDT1PEstFxhGtoUShU32oIKCnnXtBp3IBi9bM/2" + }, + "status": 3, + "tokens": "10000000001000000", + "delegator_shares": "10000000001000000.000000000000000000", + "description": { + "moniker": "0x01593D20A99174372BB325BEBA6985D0D2A7F434" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" + }, + "min_self_delegation": "1024", + "support_token_type": 1, + "rewards_tokens": "10000000001000000.000000000000000000", + "delegator_rewards_shares": "10000000001000000.000000000000000000" + }, + { + "operator_address": "storyvaloper1plzprxwwtzy53ps63k5x6uj6tgrn46g6c8w4xv", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "AqBVHHkyOfiie29Wrez6hMvC644kbZfPgXA1jFEs7Uwq" + }, + "status": 3, + "tokens": "10000000001000000", + "delegator_shares": "10000000001000000.000000000000000000", + "description": { + "moniker": "0x0FC41199CE588948861A8DA86D725A5A073AE91A" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" + }, + "min_self_delegation": "1024", + "rewards_tokens": "5000000000500000.000000000000000000", + "delegator_rewards_shares": "5000000000500000.000000000000000000" + }, + { + "operator_address": "storyvaloper1v0uufejgkfzvxx2kxrp6733zq2eg9ccwgx5emd", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "AtJpE37ydCffhJT0NNkFm/8CEB64cYu5xBVs/btKqjWh" + }, + "status": 3, + "tokens": "10000000001000000", + "delegator_shares": "10000000001000000.000000000000000000", + "description": { + "moniker": "0x63F9C4E648B244C3195630C3AF462202B282E30E" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" + }, + "min_self_delegation": "1024", + "support_token_type": 1, + "rewards_tokens": "10000000001000000.000000000000000000", + "delegator_rewards_shares": "10000000001000000.000000000000000000" + }, + { + "operator_address": "storyvaloper106cyk87evdmf3z2rmkj5m9aut5xcchpwsrlrs7", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A+wUiPhFG58EShf9w6v6BDmdey3rsst5S17jR14fezbz" + }, + "status": 3, + "tokens": "10000000001000000", + "delegator_shares": "10000000001000000.000000000000000000", + "description": { + "moniker": "0x7EB04B1FD96376988943DDA54D97BC5D0D8C5C2E" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" + }, + "min_self_delegation": "1024", + "support_token_type": 1, + "rewards_tokens": "10000000001000000.000000000000000000", + "delegator_rewards_shares": "10000000001000000.000000000000000000" + }, + { + "operator_address": "storyvaloper1n8pg4ccvhml07a0fr3nxjtlqhkf8nwrpc6a2t5", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A/9SMxZTnh3Rq96Eygg9MfB6g82euMXhjT5nMWrhLlyf" + }, + "status": 3, + "tokens": "10000000001000000", + "delegator_shares": "10000000001000000.000000000000000000", + "description": { + "moniker": "0x99C28AE30CBEFEFF75E91C66692FE0BD9279B861" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" + }, + "min_self_delegation": "1024", + "rewards_tokens": "5000000000500000.000000000000000000", + "delegator_rewards_shares": "5000000000500000.000000000000000000" + }, + { + "operator_address": "storyvaloper1nh7zdfmxyyrwamz7s7eqewmfpn7wwws9gyue2t", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A6KRGirXFYsv5oVQz8d8YIl0Nj23bXo2jLHui72y12Bi" + }, + "status": 3, + "tokens": "10000000001000000", + "delegator_shares": "10000000001000000.000000000000000000", + "description": { + "moniker": "0x9DFC26A7662106EEEC5E87B20CBB690CFCE73A05" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" + }, + "min_self_delegation": "1024", + "rewards_tokens": "5000000000500000.000000000000000000", + "delegator_rewards_shares": "5000000000500000.000000000000000000" + }, + { + "operator_address": "storyvaloper1u60eyhv44w578au4lv982wjkcuhhhyss2ukqj9", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A9cvfpWD3qASAFaCzavpbSd7E+IRKKTDZkYBvxY5gRk7" + }, + "status": 3, + "tokens": "10000000001000000", + "delegator_shares": "10000000001000000.000000000000000000", + "description": { + "moniker": "0xE69F925D95ABA9E3F795FB0A753A56C72F7B9210" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.000000000000000000", + "max_rate": "0.000000000000000000", + "max_change_rate": "0.000000000000000000" + }, + "update_time": "2024-04-16T11:04:40.60280319Z" + }, + "min_self_delegation": "1024", + "support_token_type": 1, + "rewards_tokens": "10000000001000000.000000000000000000", + "delegator_rewards_shares": "10000000001000000.000000000000000000" + }, + { + "operator_address": "storyvaloper1rg0vphgl9nzy8njgkclxkr9wu9tvh4raly2eex", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "AgSPN1XgoqtMqu0JJb5SC76FXvKO70Y+KXh3xjfqMalw" + }, + "status": 3, + "tokens": "6024000000000", + "delegator_shares": "6024000000000.000000000000000000", + "description": { + "moniker": "validator-test" + }, + "unbonding_time": "1970-01-01T00:00:00Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "update_time": "2024-10-22T13:54:22.256319155Z" + }, + "min_self_delegation": "1024", + "support_token_type": 1, + "rewards_tokens": "6024000000000.000000000000000000", + "delegator_rewards_shares": "6024000000000.000000000000000000" + } + ] + } + }, + "error": "" +} +``` + +--- + +## GetValidators + +URL: [GET] /staking/validators + +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | +| status | string | | | + +### Response Example +```json +{ + "code": 200, + "msg": { + "validators": [ { - "operator_address": "storyvaloper1awyv4u5pknxpjayqs50sm5p6yq8p4xy7awavph", + "operator_address": "storyvaloper1l43wgqtf825k4qwx4lt6xremu0jjptv7w6q0ak", "consensus_pubkey": { "type": "tendermint/PubKeySecp256k1", - "value": "A32c3gy91iNyQ2BRSWz7gIusPWG0JI3Qp3D6k85p/W9J" + "value": "Avihb1CqLW0pX2YJ6ru0/N7sr5MWnk5JCy/U5ezQ9axo" }, "jailed": true, "status": 1, - "tokens": "972800000000", - "delegator_shares": "1024000000000.000000000000000000", + "tokens": "4750000000000", + "delegator_shares": "5000000000000.000000000000000000", "description": { - "moniker": "test-0x8D83d84315B98ACbA32A364Ae841635d650CD6Ab" + "moniker": "validator-test104-21" }, - "unbonding_height": "1598", - "unbonding_time": "2024-10-21T11:47:02.079884724Z", + "unbonding_height": "4351", + "unbonding_time": "2024-10-21T14:12:46.362852882Z", "commission": { "commission_rates": { "rate": "0.100000000000000000", "max_rate": "0.500000000000000000", "max_change_rate": "0.010000000000000000" }, - "update_time": "2024-10-21T11:30:57.629535295Z" + "update_time": "2024-10-21T13:37:04.758645464Z" }, "min_self_delegation": "1024", "unbonding_ids": [ - "60" + "245" ], - "rewards_tokens": "486400000000.000000000000000000", - "delegator_rewards_shares": "512000000000.000000000000000000" + "rewards_tokens": "2375000000000.000000000000000000", + "delegator_rewards_shares": "2500000000000.000000000000000000" }, { - "operator_address": "storyvaloper1af4dyn4q27a460lxqnynp3zp8lgahsvl0gt6v8", + "operator_address": "storyvaloper17mmqx2r9d5zq8z9jcajxpc64tkhh5tuxzl5rdl", "consensus_pubkey": { "type": "tendermint/PubKeySecp256k1", - "value": "Ag9YT4iMqthseWCDZPU81ZNyAbIu6kRZKk3WafTXisyP" + "value": "AxnWLFO8LIeRpbnrKFVY2P+vPzG6bI5tpkivg/F+0XM6" }, - "status": 3, - "tokens": "6024000000000", + "jailed": true, + "status": 1, + "tokens": "4750000000000", + "delegator_shares": "5000000000000.000000000000000000", + "description": { + "moniker": "validator-test104-24" + }, + "unbonding_height": "4351", + "unbonding_time": "2024-10-21T14:12:46.362852882Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "update_time": "2024-10-21T13:38:30.541469298Z" + }, + "min_self_delegation": "1024", + "unbonding_ids": [ + "244" + ], + "rewards_tokens": "2375000000000.000000000000000000", + "delegator_rewards_shares": "2500000000000.000000000000000000" + }, + { + "operator_address": "storyvaloper17myx8sae0dxyd50je73j5fx9e7gemffefe5hey", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "Ak1HAUyvr5iPJztkNrISe7G06p244pnfzZXJqhFMUO7a" + }, + "jailed": true, + "status": 1, + "tokens": "4750000000000", + "delegator_shares": "5000000000000.000000000000000000", + "description": { + "moniker": "validator-test104-16" + }, + "unbonding_height": "4344", + "unbonding_time": "2024-10-21T14:12:24.142758147Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "update_time": "2024-10-21T13:34:51.559498051Z" + }, + "min_self_delegation": "1024", + "unbonding_ids": [ + "181", + "243" + ], + "rewards_tokens": "2375000000000.000000000000000000", + "delegator_rewards_shares": "2500000000000.000000000000000000" + }, + { + "operator_address": "storyvaloper17z6fh2fqdqpa9am3a8m7c024r954j7hwgzdu0z", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "AgFUP1Y/JMO0GR4KvOxNRmYzzU1VThmVkEORPpvsaGk0" + }, + "jailed": true, + "status": 1, + "tokens": "1024000000000", + "delegator_shares": "1024000000000.000000000000000000", + "description": { + "moniker": "test-0x8F51B4fA7C60016A8e1Db1caE312E0dF63F21E00" + }, + "unbonding_height": "1166", + "unbonding_time": "2024-10-21T11:24:12.073004276Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "update_time": "2024-10-21T11:22:55.156217405Z" + }, + "min_self_delegation": "1024", + "unbonding_ids": [ + "29" + ], + "support_token_type": 1, + "rewards_tokens": "1076224000000.000000000000000000", + "delegator_rewards_shares": "1076224000000.000000000000000000" + }, + { + "operator_address": "storyvaloper1amf8h5xfrh2hz0zweke42t6m86zrl7ycyzgd60", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "AooAFKj/AvQhjSgyylAeebrb8RgsbtMZxN3fefzjy2hf" + }, + "jailed": true, + "status": 1, + "tokens": "4750000000000", + "delegator_shares": "5000000000000.000000000000000000", + "description": { + "moniker": "validator-test104-13" + }, + "unbonding_height": "4318", + "unbonding_time": "2024-10-21T14:11:01.350669293Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "update_time": "2024-10-21T13:33:25.868660453Z" + }, + "min_self_delegation": "1024", + "unbonding_ids": [ + "180", + "242" + ], + "rewards_tokens": "2375000000000.000000000000000000", + "delegator_rewards_shares": "2500000000000.000000000000000000" + }, + { + "operator_address": "storyvaloper1awyv4u5pknxpjayqs50sm5p6yq8p4xy7awavph", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A32c3gy91iNyQ2BRSWz7gIusPWG0JI3Qp3D6k85p/W9J" + }, + "jailed": true, + "status": 1, + "tokens": "972800000000", + "delegator_shares": "1024000000000.000000000000000000", + "description": { + "moniker": "test-0x8D83d84315B98ACbA32A364Ae841635d650CD6Ab" + }, + "unbonding_height": "1598", + "unbonding_time": "2024-10-21T11:47:02.079884724Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "update_time": "2024-10-21T11:30:57.629535295Z" + }, + "min_self_delegation": "1024", + "unbonding_ids": [ + "60" + ], + "rewards_tokens": "486400000000.000000000000000000", + "delegator_rewards_shares": "512000000000.000000000000000000" + }, + { + "operator_address": "storyvaloper1af4dyn4q27a460lxqnynp3zp8lgahsvl0gt6v8", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "Ag9YT4iMqthseWCDZPU81ZNyAbIu6kRZKk3WafTXisyP" + }, + "status": 3, + "tokens": "6024000000000", "delegator_shares": "6024000000000.000000000000000000", "description": { "moniker": "validator-01-create" @@ -324,6 +666,7 @@ URL: [GET] /staking/validators } ``` +--- ## GetValidatorByValidatorAddress @@ -375,30 +718,81 @@ URL: [GET] /staking/validators/{validator_addr} } ``` +--- -## GetDelegatorByDelegatorAddress +## GetValidatorUnbondingDelegations -URL: [GET] /staking/delegators/{delegator_addr} +URL: [GET] /staking/validators/{validator_addr}/unbonding_delegations ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | +| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | + +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | ### Response Example ```json { "code": 200, "msg": { - "delegator_addr": "story1l3ewm920n34gj2cam7lcfangyutn84574cpnl2", - "withdraw_address": "0x6E5e0eFC2961ed81e663E53395C51b4154855e77", - "reward_address": "0x6E5e0eFC2961ed81e663E53395C51b4154855e77", - "operator_address": "0x6E5e0eFC2961ed81e663E53395C51b4154855e77" + "unbonding_responses": [ + { + "delegator_address": "story178djghd2a0x3khnussy3npmy99fnf3spguuml2", + "validator_address": "storyvaloper1pdj0z84lau0l7vf2jl4qs7yggv48p3avy82spr", + "entries": [ + { + "creation_height": "525632", + "completion_time": "2024-11-27T08:26:13.41935718Z", + "initial_balance": "1024000000000", + "balance": "1024000000000", + "unbonding_id": "53" + } + ] + }, + { + "delegator_address": "story1f2p80ew7l6x2ltj5crnq2774l8zjpl7f6pp7ee", + "validator_address": "storyvaloper1pdj0z84lau0l7vf2jl4qs7yggv48p3avy82spr", + "entries": [ + { + "creation_height": "510607", + "completion_time": "2024-11-26T17:31:04.69653005Z", + "initial_balance": "19500000000000000", + "balance": "19500000000000000", + "unbonding_id": "39" + } + ] + }, + { + "delegator_address": "story1qsrhn46pf8z6wfqdjgautrzzua9fyxv8dmtmdx", + "validator_address": "storyvaloper1pdj0z84lau0l7vf2jl4qs7yggv48p3avy82spr", + "entries": [ + { + "creation_height": "525364", + "completion_time": "2024-11-27T08:09:40.081635694Z", + "initial_balance": "1024000000000", + "balance": "1024000000000", + "unbonding_id": "51" + } + ] + } + ], + "pagination": { + "total": "3" + } }, "error": "" } ``` +--- ## GetValidatorDelegationsByValidatorAddress @@ -409,6 +803,15 @@ URL: [GET] /staking/validators/{validator_addr}/delegations | --- | --- | --- | --- | | validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | + ### Response Example ```json { @@ -448,14 +851,29 @@ URL: [GET] /staking/validators/{validator_addr}/delegations } ``` +--- -## GetDelegationsByDelegatorAddress +## GetDelegatorUnbondingDelegation + +URL: [GET] /staking/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation + +### Path Params +| Name | Type | Example | Require | +| --- | --- | --- | --- | +| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | -URL: [GET] /staking/delegations/{delegator_addr} + +--- + +## GetDelegationByValidatorAddressDelegatorAddress + +URL: [GET] /staking/validators/{validator_addr}/delegations/{delegator_addr} ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | +| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | | delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Response Example @@ -463,125 +881,49 @@ URL: [GET] /staking/delegations/{delegator_addr} { "code": 200, "msg": { - "delegation_responses": [ - { - "delegation": { - "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", - "validator_address": "storyvaloper1rk277ak9enq422sevnf2yjjc6mhdv44wl8u30p", - "shares": "1024000000000.000000000000000000", - "rewards_shares": "1187840000000.000000000000000000" - }, - "balance": { - "denom": "stake", - "amount": "1024000000000" - } + "delegation_response": { + "delegation": { + "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", + "validator_address": "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw", + "shares": "1024000000000.000000000000000000", + "rewards_shares": "1076224000000.000000000000000000" }, - { - "delegation": { - "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", - "validator_address": "storyvaloper1wk04lv2e2egfdt25e94xvwszny2ww8znancs5z", - "shares": "4096000000000.000000000000000000", - "rewards_shares": "2048000000000.000000000000000000" - }, - "balance": { - "denom": "stake", - "amount": "4096000000000" - } - }, - { - "delegation": { - "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", - "validator_address": "storyvaloper137yg6cc4gpvhdx5wt0q3g5pcjeljuqvs4eu8y2", - "shares": "1024000000000.000000000000000000", - "rewards_shares": "1076224000000.000000000000000000" - }, - "balance": { - "denom": "stake", - "amount": "972800000000" - } - }, - { - "delegation": { - "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", - "validator_address": "storyvaloper1hcx6v7887r7r7498ge3kxqxrmkt3ekpk7jj5c2", - "shares": "2048000000000.000000000000000000", - "rewards_shares": "2375680000000.000000000000000000" - }, - "balance": { - "denom": "stake", - "amount": "2048000000000" - } - }, - { - "delegation": { - "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", - "validator_address": "storyvaloper1mwgwgn6x5waumhg4tgnuhkezhamnaq4385mrgv", - "shares": "2048000000000.000000000000000000", - "rewards_shares": "1024000000000.000000000000000000" - }, - "balance": { - "denom": "stake", - "amount": "1945600000000" - } - }, - { - "delegation": { - "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", - "validator_address": "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw", - "shares": "1024000000000.000000000000000000", - "rewards_shares": "1076224000000.000000000000000000" - }, - "balance": { - "denom": "stake", - "amount": "972800000000" - } - } - ], - "pagination": { - "total": "6" - } - }, - "error": "" -} -``` - - -## GetRedelegationsByDelegatorAddress - -URL: [GET] /staking/delegators/{delegator_addr}/redelegations - -### Path Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | - -### Query Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| status | string | | ✔ | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | - - - -## GetValidatorsByDelegatorAddress - -URL: [GET] /staking/delegators/{delegator_addr}/validators - -### Path Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | - -### Response Example -```json -{ - "code": 200, - "msg": { - "validators": [ + "balance": { + "denom": "stake", + "amount": "972800000000" + } + } + }, + "error": "" +} +``` + +--- + +## GetValidatorsByDelegatorAddress + +URL: [GET] /staking/delegators/{delegator_addr}/validators + +### Path Params +| Name | Type | Example | Require | +| --- | --- | --- | --- | +| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | + +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | + +### Response Example +```json +{ + "code": 200, + "msg": { + "validators": [ { "operator_address": "storyvaloper1rk277ak9enq422sevnf2yjjc6mhdv44wl8u30p", "consensus_pubkey": { @@ -750,580 +1092,273 @@ URL: [GET] /staking/delegators/{delegator_addr}/validators "moniker": "validator-04-create" }, "unbonding_height": "4859", - "unbonding_time": "2024-10-22T12:32:13.342436482Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "update_time": "2024-10-22T12:16:08.070117612Z" - }, - "min_self_delegation": "1024", - "unbonding_ids": [ - "147" - ], - "support_token_type": 1, - "rewards_tokens": "5772412800000.000000000000000000", - "delegator_rewards_shares": "6076224000000.000000000000000000" - } - ], - "pagination": { - "total": "6" - } - }, - "error": "" -} -``` - - -## GetValidatorsByDelegatorAddressValidatorAddress - -URL: [GET] /staking/delegators/{delegator_addr}/validators/{validator_addr} - -### Path Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | -| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | - -### Response Example -```json -{ - "code": 200, - "msg": { - "validator": { - "operator_address": "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "A3ljgjHsCTGAxbqOtMjkQ66DudEruUyCrXFgYkYI4geh" - }, - "jailed": true, - "status": 1, - "tokens": "5722800000000", - "delegator_shares": "6024000000000.000000000000000000", - "description": { - "moniker": "validator-04-create" - }, - "unbonding_height": "4859", - "unbonding_time": "2024-10-22T12:32:13.342436482Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "update_time": "2024-10-22T12:16:08.070117612Z" - }, - "min_self_delegation": "1024", - "unbonding_ids": [ - "147" - ], - "support_token_type": 1, - "rewards_tokens": "5772412800000.000000000000000000", - "delegator_rewards_shares": "6076224000000.000000000000000000" - } - }, - "error": "" -} -``` - - -## GetUnbondingDelegationsByDelegatorAddress - -URL: [GET] /staking/delegators/{delegator_addr}/unbonding_delegations - -### Path Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | - -### Query Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| status | string | | ✔ | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | - - - -## GetStakingParams - -URL: [GET] /staking/params - -### Response Example -```json -{ - "code": 200, - "msg": { - "params": { - "unbonding_time": "10000000000", - "max_validators": 32, - "max_entries": 14, - "historical_entries": 10000, - "bond_denom": "stake", - "min_commission_rate": "0.000000000000000000", - "min_delegation": "1024", - "periods": [ - { - "duration": "0", - "rewards_multiplier": "1.000000000000000000" - }, - { - "period_type": 1, - "duration": "60000000000", - "rewards_multiplier": "1.051000000000000000" - }, - { - "period_type": 2, - "duration": "120000000000", - "rewards_multiplier": "1.160000000000000000" - }, - { - "period_type": 3, - "duration": "180000000000", - "rewards_multiplier": "1.340000000000000000" - } - ], - "token_types": [ - { - "rewards_multiplier": "0.500000000000000000" - }, - { - "token_type": 1, - "rewards_multiplier": "1.000000000000000000" - } - ] - } - }, - "error": "" -} -``` - - -## GetStakingPool - -URL: [GET] /staking/pool - -### Response Example -```json -{ - "code": 200, - "msg": { - "pool": { - "not_bonded_tokens": "76461600000000", - "bonded_tokens": "80110471008000000" - } - }, - "error": "" -} -``` - - -## GetHistoricalInfoByHeight - -URL: [GET] /staking/historical_info/{height} - -### Path Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| height | integer | | ✔ | - -### Response Example -```json -{ - "code": 200, - "msg": { - "hist": { - "header": { - "version": {}, - "chain_id": "odyssey-devnet-1", - "height": "6666", - "time": "2024-10-22T14:09:17.546670477Z", - "last_block_id": { - "part_set_header": {} - }, - "next_validators_hash": "bHIf/wtJa7OBLolGYkRxgiAr72c708itMxqPhAwC0O4=", - "app_hash": "UDRmZ+Tg6ZMW0ZIuErfYXE1VS+QnWbAj8BVm9p07f3c=", - "proposer_address": "Y/nE5kiyRMMZVjDDr0YiArKC4w4=" - }, - "valset": [ - { - "operator_address": "storyvaloper1w69rjypm25h84etxxhw5ax64jg42l3gyhr0j42", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "A9mdRUGE+sv2oD6jfrNvalDGmELqOtQgOKjVU3vRWyWU" - }, - "status": 3, - "tokens": "10104447001000000", - "delegator_shares": "10104447001000000.000000000000000000", - "description": { - "moniker": "0x768A39103B552E7AE56635DD4E9B55922AAFC504" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "rewards_tokens": "5052223500500000.000000000000000000", - "delegator_rewards_shares": "5052223500500000.000000000000000000" - }, - { - "operator_address": "storyvaloper1q9vn6g9fj96rw2anyklt56v96rf20ap5z7zha7", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "A3e5PxDT1PEstFxhGtoUShU32oIKCnnXtBp3IBi9bM/2" - }, - "status": 3, - "tokens": "10000000001000000", - "delegator_shares": "10000000001000000.000000000000000000", - "description": { - "moniker": "0x01593D20A99174372BB325BEBA6985D0D2A7F434" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "support_token_type": 1, - "rewards_tokens": "10000000001000000.000000000000000000", - "delegator_rewards_shares": "10000000001000000.000000000000000000" - }, - { - "operator_address": "storyvaloper1plzprxwwtzy53ps63k5x6uj6tgrn46g6c8w4xv", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "AqBVHHkyOfiie29Wrez6hMvC644kbZfPgXA1jFEs7Uwq" - }, - "status": 3, - "tokens": "10000000001000000", - "delegator_shares": "10000000001000000.000000000000000000", - "description": { - "moniker": "0x0FC41199CE588948861A8DA86D725A5A073AE91A" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "rewards_tokens": "5000000000500000.000000000000000000", - "delegator_rewards_shares": "5000000000500000.000000000000000000" - }, - { - "operator_address": "storyvaloper1v0uufejgkfzvxx2kxrp6733zq2eg9ccwgx5emd", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "AtJpE37ydCffhJT0NNkFm/8CEB64cYu5xBVs/btKqjWh" - }, - "status": 3, - "tokens": "10000000001000000", - "delegator_shares": "10000000001000000.000000000000000000", - "description": { - "moniker": "0x63F9C4E648B244C3195630C3AF462202B282E30E" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "support_token_type": 1, - "rewards_tokens": "10000000001000000.000000000000000000", - "delegator_rewards_shares": "10000000001000000.000000000000000000" - }, - { - "operator_address": "storyvaloper106cyk87evdmf3z2rmkj5m9aut5xcchpwsrlrs7", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "A+wUiPhFG58EShf9w6v6BDmdey3rsst5S17jR14fezbz" - }, - "status": 3, - "tokens": "10000000001000000", - "delegator_shares": "10000000001000000.000000000000000000", - "description": { - "moniker": "0x7EB04B1FD96376988943DDA54D97BC5D0D8C5C2E" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "support_token_type": 1, - "rewards_tokens": "10000000001000000.000000000000000000", - "delegator_rewards_shares": "10000000001000000.000000000000000000" - }, - { - "operator_address": "storyvaloper1n8pg4ccvhml07a0fr3nxjtlqhkf8nwrpc6a2t5", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "A/9SMxZTnh3Rq96Eygg9MfB6g82euMXhjT5nMWrhLlyf" - }, - "status": 3, - "tokens": "10000000001000000", - "delegator_shares": "10000000001000000.000000000000000000", - "description": { - "moniker": "0x99C28AE30CBEFEFF75E91C66692FE0BD9279B861" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "rewards_tokens": "5000000000500000.000000000000000000", - "delegator_rewards_shares": "5000000000500000.000000000000000000" - }, - { - "operator_address": "storyvaloper1nh7zdfmxyyrwamz7s7eqewmfpn7wwws9gyue2t", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "A6KRGirXFYsv5oVQz8d8YIl0Nj23bXo2jLHui72y12Bi" - }, - "status": 3, - "tokens": "10000000001000000", - "delegator_shares": "10000000001000000.000000000000000000", - "description": { - "moniker": "0x9DFC26A7662106EEEC5E87B20CBB690CFCE73A05" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "rewards_tokens": "5000000000500000.000000000000000000", - "delegator_rewards_shares": "5000000000500000.000000000000000000" - }, - { - "operator_address": "storyvaloper1u60eyhv44w578au4lv982wjkcuhhhyss2ukqj9", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "A9cvfpWD3qASAFaCzavpbSd7E+IRKKTDZkYBvxY5gRk7" - }, - "status": 3, - "tokens": "10000000001000000", - "delegator_shares": "10000000001000000.000000000000000000", - "description": { - "moniker": "0xE69F925D95ABA9E3F795FB0A753A56C72F7B9210" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.000000000000000000", - "max_rate": "0.000000000000000000", - "max_change_rate": "0.000000000000000000" - }, - "update_time": "2024-04-16T11:04:40.60280319Z" - }, - "min_self_delegation": "1024", - "support_token_type": 1, - "rewards_tokens": "10000000001000000.000000000000000000", - "delegator_rewards_shares": "10000000001000000.000000000000000000" - }, - { - "operator_address": "storyvaloper1rg0vphgl9nzy8njgkclxkr9wu9tvh4raly2eex", - "consensus_pubkey": { - "type": "tendermint/PubKeySecp256k1", - "value": "AgSPN1XgoqtMqu0JJb5SC76FXvKO70Y+KXh3xjfqMalw" - }, - "status": 3, - "tokens": "6024000000000", - "delegator_shares": "6024000000000.000000000000000000", - "description": { - "moniker": "validator-test" - }, - "unbonding_time": "1970-01-01T00:00:00Z", - "commission": { - "commission_rates": { - "rate": "0.100000000000000000", - "max_rate": "0.500000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "update_time": "2024-10-22T13:54:22.256319155Z" + "unbonding_time": "2024-10-22T12:32:13.342436482Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" }, - "min_self_delegation": "1024", - "support_token_type": 1, - "rewards_tokens": "6024000000000.000000000000000000", - "delegator_rewards_shares": "6024000000000.000000000000000000" - } - ] + "update_time": "2024-10-22T12:16:08.070117612Z" + }, + "min_self_delegation": "1024", + "unbonding_ids": [ + "147" + ], + "support_token_type": 1, + "rewards_tokens": "5772412800000.000000000000000000", + "delegator_rewards_shares": "6076224000000.000000000000000000" + } + ], + "pagination": { + "total": "6" } }, "error": "" } ``` +--- -## GetDelegationByValidatorAddressDelegatorAddress +## GetDelegationsByDelegatorAddress -URL: [GET] /staking/validators/{validator_addr}/delegations/{delegator_addr} +URL: [GET] /staking/delegations/{delegator_addr} ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | | delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | + ### Response Example ```json { "code": 200, "msg": { - "delegation_response": { - "delegation": { - "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", - "validator_address": "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw", - "shares": "1024000000000.000000000000000000", - "rewards_shares": "1076224000000.000000000000000000" + "delegation_responses": [ + { + "delegation": { + "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", + "validator_address": "storyvaloper1rk277ak9enq422sevnf2yjjc6mhdv44wl8u30p", + "shares": "1024000000000.000000000000000000", + "rewards_shares": "1187840000000.000000000000000000" + }, + "balance": { + "denom": "stake", + "amount": "1024000000000" + } }, - "balance": { - "denom": "stake", - "amount": "972800000000" + { + "delegation": { + "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", + "validator_address": "storyvaloper1wk04lv2e2egfdt25e94xvwszny2ww8znancs5z", + "shares": "4096000000000.000000000000000000", + "rewards_shares": "2048000000000.000000000000000000" + }, + "balance": { + "denom": "stake", + "amount": "4096000000000" + } + }, + { + "delegation": { + "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", + "validator_address": "storyvaloper137yg6cc4gpvhdx5wt0q3g5pcjeljuqvs4eu8y2", + "shares": "1024000000000.000000000000000000", + "rewards_shares": "1076224000000.000000000000000000" + }, + "balance": { + "denom": "stake", + "amount": "972800000000" + } + }, + { + "delegation": { + "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", + "validator_address": "storyvaloper1hcx6v7887r7r7498ge3kxqxrmkt3ekpk7jj5c2", + "shares": "2048000000000.000000000000000000", + "rewards_shares": "2375680000000.000000000000000000" + }, + "balance": { + "denom": "stake", + "amount": "2048000000000" + } + }, + { + "delegation": { + "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", + "validator_address": "storyvaloper1mwgwgn6x5waumhg4tgnuhkezhamnaq4385mrgv", + "shares": "2048000000000.000000000000000000", + "rewards_shares": "1024000000000.000000000000000000" + }, + "balance": { + "denom": "stake", + "amount": "1945600000000" + } + }, + { + "delegation": { + "delegator_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3", + "validator_address": "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw", + "shares": "1024000000000.000000000000000000", + "rewards_shares": "1076224000000.000000000000000000" + }, + "balance": { + "denom": "stake", + "amount": "972800000000" + } } + ], + "pagination": { + "total": "6" } }, "error": "" } ``` +--- -## GetValidatorUnbondingDelegations +## GetRedelegationsByDelegatorAddress -URL: [GET] /staking/validators/{validator_addr}/unbonding_delegations +URL: [GET] /staking/delegators/{delegator_addr}/redelegations ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Query Params -| Name | Type | Example | Require | +| Name | Type | Exampe | Require | | --- | --- | --- | --- | -| status | string | | ✔ | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | +| src_validator_addr | string | storyvaloper1l43wgqtf825k4qwx4lt6xremu0jjptv7w6q0ak | | +| dst_validator_addr | string | storyvaloper17mmqx2r9d5zq8z9jcajxpc64tkhh5tuxzl5rdl | | +--- -## GetDelegatorUnbondingDelegation +## GetUnbondingDelegationsByDelegatorAddress -URL: [GET] /staking/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation +URL: [GET] /staking/delegators/{delegator_addr}/unbonding_delegations ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | | delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | -## GetPeriodDelegationsByDelegatorAddress +--- -URL: [GET] /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations +## GetValidatorsByDelegatorAddressValidatorAddress + +URL: [GET] /staking/delegators/{delegator_addr}/validators/{validator_addr} ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | | delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | +| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | ### Response Example ```json { "code": 200, - "msg": [ - { - "delegator_address": "story1l3ewm920n34gj2cam7lcfangyutn84574cpnl2", - "validator_address": "storyvaloper1l3ewm920n34gj2cam7lcfangyutn8457mh4j5p", - "period_delegation_id": "0", - "shares": "1025000000000.000000000000000000", - "rewards_shares": "1025000000000.000000000000000000", - "end_time": "2024-10-23T08:48:00.313756096Z" + "msg": { + "validator": { + "operator_address": "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw", + "consensus_pubkey": { + "type": "tendermint/PubKeySecp256k1", + "value": "A3ljgjHsCTGAxbqOtMjkQ66DudEruUyCrXFgYkYI4geh" + }, + "jailed": true, + "status": 1, + "tokens": "5722800000000", + "delegator_shares": "6024000000000.000000000000000000", + "description": { + "moniker": "validator-04-create" + }, + "unbonding_height": "4859", + "unbonding_time": "2024-10-22T12:32:13.342436482Z", + "commission": { + "commission_rates": { + "rate": "0.100000000000000000", + "max_rate": "0.500000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "update_time": "2024-10-22T12:16:08.070117612Z" + }, + "min_self_delegation": "1024", + "unbonding_ids": [ + "147" + ], + "support_token_type": 1, + "rewards_tokens": "5772412800000.000000000000000000", + "delegator_rewards_shares": "6076224000000.000000000000000000" } - ], + }, "error": "" } ``` +--- -## GetPeriodDelegationByDelegatorAddressAndID - -URL: [GET] /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations/{period_delegation_id} +## GetAuthParams -### Path Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | -| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | -| period_delegation_id | string | 1 | ✔ | +URL: [GET] /auth/params ### Response Example ```json { "code": 200, "msg": { - "delegator_address": "story1l3ewm920n34gj2cam7lcfangyutn84574cpnl2", - "validator_address": "storyvaloper1l3ewm920n34gj2cam7lcfangyutn8457mh4j5p", - "period_delegation_id": "0", - "shares": "1025000000000.000000000000000000", - "rewards_shares": "1025000000000.000000000000000000", - "end_time": "2024-10-23T08:48:00.313756096Z" + "params": { + "max_memo_characters": "256", + "tx_sig_limit": "7", + "tx_size_cost_per_byte": "10", + "sig_verify_cost_ed25519": "590", + "sig_verify_cost_secp256k1": "1000" + } }, "error": "" } ``` +--- ## GetAccounts URL: [GET] /auth/accounts ### Query Params -| Name | Type | Example | Require | +| Name | Type | Exampe | Require | | --- | --- | --- | --- | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | ### Response Example ```json @@ -1415,6 +1450,7 @@ URL: [GET] /auth/accounts } ``` +--- ## GetBech32Prefix @@ -1431,67 +1467,112 @@ URL: [GET] /auth/bech32 } ``` +--- -## GetAuthParams +## GetBankParams -URL: [GET] /auth/params +URL: [GET] /bank/params ### Response Example ```json { "code": 200, "msg": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" + "params": {} + }, + "error": "" +} +``` + +--- + +## GetSupply + +URL: [GET] /bank/supply + +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | + +### Response Example +```json +{ + "code": 200, + "msg": { + "supply": [ + { + "denom": "stake", + "amount": "79748037492401729" + } + ], + "pagination": { + "total": "1" } }, "error": "" } ``` +--- -## GetBankParams +## GetSupplyByDenom -URL: [GET] /bank/params +URL: [GET] /bank/supply/by_denom + +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| denom | string | stake | | ### Response Example ```json { "code": 200, "msg": { - "params": {} + "amount": { + "denom": "stake", + "amount": "79748037587244392" + } }, "error": "" } ``` +--- -## GetSupply +## GetBalancesByAddress + +URL: [GET] /bank/balances/{address} -URL: [GET] /bank/supply +### Path Params +| Name | Type | Example | Require | +| --- | --- | --- | --- | +| address | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Query Params -| Name | Type | Example | Require | +| Name | Type | Exampe | Require | | --- | --- | --- | --- | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | +| resolve_denom | boolean | true | | ### Response Example ```json { "code": 200, "msg": { - "supply": [ + "balances": [ { "denom": "stake", - "amount": "79748037492401729" + "amount": "50301746" } ], "pagination": { @@ -1502,34 +1583,41 @@ URL: [GET] /bank/supply } ``` +--- -## GetSupplyByDenom +## GetBalancesByAddressDenom -URL: [GET] /bank/supply/by_denom +URL: [GET] /bank/balances/{address}/by_denom -### Query Params +### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| denom | string | stake | ✔ | +| address | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | + +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| denom | string | stake | | ### Response Example ```json { "code": 200, "msg": { - "amount": { + "balance": { "denom": "stake", - "amount": "79748037587244392" + "amount": "50301746" } }, "error": "" } ``` +--- -## GetBalancesByAddress +## GetSpendableBalancesByAddress -URL: [GET] /bank/balances/{address} +URL: [GET] /bank/spendable_balances/{address} ### Path Params | Name | Type | Example | Require | @@ -1537,13 +1625,14 @@ URL: [GET] /bank/balances/{address} | address | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Query Params -| Name | Type | Example | Require | +| Name | Type | Exampe | Require | | --- | --- | --- | --- | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | +| resolve_denom | boolean | true | | ### Response Example ```json @@ -1564,10 +1653,11 @@ URL: [GET] /bank/balances/{address} } ``` +--- -## GetBalancesByAddressDenom +## GetSpendableBalancesByAddressDenom -URL: [GET] /bank/balances/{address}/by_denom +URL: [GET] /bank/spendable_balances/{address}/by_denom ### Path Params | Name | Type | Example | Require | @@ -1575,7 +1665,7 @@ URL: [GET] /bank/balances/{address}/by_denom | address | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Query Params -| Name | Type | Example | Require | +| Name | Type | Exampe | Require | | --- | --- | --- | --- | | denom | string | stake | | @@ -1593,6 +1683,7 @@ URL: [GET] /bank/balances/{address}/by_denom } ``` +--- ## GetDenomOwners @@ -1604,13 +1695,13 @@ URL: [GET] /bank/denom_owners/{denom} | denom | string | stake | ✔ | ### Query Params -| Name | Type | Example | Require | +| Name | Type | Exampe | Require | | --- | --- | --- | --- | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | ### Response Example ```json @@ -1698,19 +1789,20 @@ URL: [GET] /bank/denom_owners/{denom} } ``` +--- ## GetDenomOwnersByQuery URL: [GET] /bank/denom_owners_by_query ### Query Params -| Name | Type | Example | Require | +| Name | Type | Exampe | Require | | --- | --- | --- | --- | -| pagination.key | string | stake | | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | | denom | string | stake | | ### Response Example @@ -1799,6 +1891,7 @@ URL: [GET] /bank/denom_owners_by_query } ``` +--- ## GetDistributionParams @@ -1820,38 +1913,137 @@ URL: [GET] /distribution/params } ``` +--- -## GetDistributionValidatorsByDelegatorAddress +## GetValidatorCommissionByValidatorAddress -URL: [GET] /distribution/delegators/{delegator_address}/validators +URL: [GET] /distribution/validators/{validator_address}/commission ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| delegator_address | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | +| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | ### Response Example ```json { "code": 200, "msg": { - "validators": [ - "storyvaloper1rk277ak9enq422sevnf2yjjc6mhdv44wl8u30p", - "storyvaloper1wk04lv2e2egfdt25e94xvwszny2ww8znancs5z", - "storyvaloper137yg6cc4gpvhdx5wt0q3g5pcjeljuqvs4eu8y2", - "storyvaloper1hcx6v7887r7r7498ge3kxqxrmkt3ekpk7jj5c2", - "storyvaloper1mwgwgn6x5waumhg4tgnuhkezhamnaq4385mrgv", - "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw" + "commission": { + "commission": [ + { + "denom": "stake", + "amount": "11129810.318708930942711499" + } + ] + } + }, + "error": "" +} +``` + +--- + +## GetValidatorOutstandingRewardsByValidatorAddress + +URL: [GET] /distribution/validators/{validator_address}/outstanding_rewards + +### Path Params +| Name | Type | Example | Require | +| --- | --- | --- | --- | +| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | + +### Response Example +```json +{ + "code": 200, + "msg": { + "rewards": { + "rewards": [ + { + "denom": "stake", + "amount": "110356851.470660927219114823" + } + ] + } + }, + "error": "" +} +``` + +--- + +## GetValidatorSlashesByValidatorAddress + +URL: [GET] /distribution/validators/{validator_address}/slashes + +### Path Params +| Name | Type | Example | Require | +| --- | --- | --- | --- | +| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | + +### Query Params +| Name | Type | Exampe | Require | +| --- | --- | --- | --- | +| pagination.key | string | FPoybu9dO+FCSV562u9keKVgUwur | | +| pagination.offset | string | 0 | | +| pagination.limit | array | 10 | | +| pagination.count_total | boolean | true | | +| pagination.reverse | boolean | true | | +| starting_height | string | 1 | | +| ending_height | string | 100 | | + +### Response Example +```json +{ + "code": 200, + "msg": { + "slashes": [], + "pagination": {} + }, + "error": "" +} +``` + +--- + +## GetDistributionValidatorByValidatorAddress + +URL: [GET] /distribution/validators/{validator_address} + +### Path Params +| Name | Type | Example | Require | +| --- | --- | --- | --- | +| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | + +### Response Example +```json +{ + "code": 200, + "msg": { + "operator_address": "story17973uudyv484cgmy4sd4kjwdgrh86vfwecmj59", + "self_bond_rewards": [ + { + "denom": "stake", + "amount": "82232804.757899250000000000" + } + ], + "commission": [ + { + "denom": "stake", + "amount": "11129810.318708930942711499" + } ] }, "error": "" } ``` +--- -## GetDelegatorWithdrawAddressByDelegatorAddress +## GetDistributionValidatorsByDelegatorAddress -URL: [GET] /distribution/delegators/{delegator_address}/withdraw_address +URL: [GET] /distribution/delegators/{delegator_address}/validators ### Path Params | Name | Type | Example | Require | @@ -1863,12 +2055,20 @@ URL: [GET] /distribution/delegators/{delegator_address}/withdraw_address { "code": 200, "msg": { - "withdraw_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3" + "validators": [ + "storyvaloper1rk277ak9enq422sevnf2yjjc6mhdv44wl8u30p", + "storyvaloper1wk04lv2e2egfdt25e94xvwszny2ww8znancs5z", + "storyvaloper137yg6cc4gpvhdx5wt0q3g5pcjeljuqvs4eu8y2", + "storyvaloper1hcx6v7887r7r7498ge3kxqxrmkt3ekpk7jj5c2", + "storyvaloper1mwgwgn6x5waumhg4tgnuhkezhamnaq4385mrgv", + "storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw" + ] }, "error": "" } ``` +--- ## GetDelegatorRewardsByDelegatorAddress @@ -1951,6 +2151,7 @@ URL: [GET] /distribution/delegators/{delegator_address}/rewards } ``` +--- ## GetDelegatorRewardsByDelegatorAddressValidatorAddress @@ -1978,133 +2179,131 @@ URL: [GET] /distribution/delegators/{delegator_address}/rewards/{validator_addre } ``` +--- -## GetDistributionValidatorByValidatorAddress +## GetDelegatorWithdrawAddressByDelegatorAddress -URL: [GET] /distribution/validators/{validator_address} +URL: [GET] /distribution/delegators/{delegator_address}/withdraw_address ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +| delegator_address | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Response Example ```json { "code": 200, "msg": { - "operator_address": "story17973uudyv484cgmy4sd4kjwdgrh86vfwecmj59", - "self_bond_rewards": [ - { - "denom": "stake", - "amount": "82232804.757899250000000000" - } - ], - "commission": [ - { - "denom": "stake", - "amount": "11129810.318708930942711499" - } - ] + "withdraw_address": "story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3" }, "error": "" } ``` +--- -## GetValidatorCommissionByValidatorAddress - -URL: [GET] /distribution/validators/{validator_address}/commission +## GetMintParams -### Path Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +URL: [GET] /mint/params ### Response Example ```json { "code": 200, "msg": { - "commission": { - "commission": [ - { - "denom": "stake", - "amount": "11129810.318708930942711499" - } - ] + "params": { + "mint_denom": "stake", + "inflations_per_year": "24625000000000000.000000000000000000", + "blocks_per_year": "10368000" } }, "error": "" } ``` +--- -## GetValidatorOutstandingRewardsByValidatorAddress +## GetDelegatorByDelegatorAddress -URL: [GET] /distribution/validators/{validator_address}/outstanding_rewards +URL: [GET] /staking/delegators/{delegator_addr} ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Response Example ```json { "code": 200, "msg": { - "rewards": { - "rewards": [ - { - "denom": "stake", - "amount": "110356851.470660927219114823" - } - ] - } + "delegator_addr": "story1l3ewm920n34gj2cam7lcfangyutn84574cpnl2", + "withdraw_address": "0x6E5e0eFC2961ed81e663E53395C51b4154855e77", + "reward_address": "0x6E5e0eFC2961ed81e663E53395C51b4154855e77", + "operator_address": "0x6E5e0eFC2961ed81e663E53395C51b4154855e77" }, "error": "" } ``` +--- -## GetValidatorSlashesByValidatorAddress +## GetPeriodDelegationsByDelegatorAddress -URL: [GET] /distribution/validators/{validator_address}/slashes +URL: [GET] /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations ### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| validator_address | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | - -### Query Params -| Name | Type | Example | Require | -| --- | --- | --- | --- | -| pagination.key | string | | ✔ | -| pagination.offset | string | 0 | ✔ | -| pagination.limit | string | 10 | ✔ | -| pagination.count_total | string | true | ✔ | -| pagination.reverse | string | true | ✔ | +| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | ### Response Example ```json { "code": 200, - "msg": { - "slashes": [], - "pagination": {} - }, + "msg": [ + { + "delegator_address": "story1l3ewm920n34gj2cam7lcfangyutn84574cpnl2", + "validator_address": "storyvaloper1l3ewm920n34gj2cam7lcfangyutn8457mh4j5p", + "period_delegation_id": "0", + "shares": "1025000000000.000000000000000000", + "rewards_shares": "1025000000000.000000000000000000", + "end_time": "2024-10-23T08:48:00.313756096Z" + } + ], "error": "" } ``` +--- -## GetAllValidatorOutstandingRewards +## GetPeriodDelegationByDelegatorAddressAndID -URL: [GET] /distribution/all_validators/outstanding_rewards +URL: [GET] /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations/{period_delegation_id} -### Query Params +### Path Params | Name | Type | Example | Require | | --- | --- | --- | --- | -| from | integer | 100 | | -| to | integer | 200 | | +| validator_addr | string | storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw | ✔ | +| delegator_addr | string | story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 | ✔ | +| period_delegation_id | string | 1 | ✔ | + +### Response Example +```json +{ + "code": 200, + "msg": { + "delegator_address": "story1l3ewm920n34gj2cam7lcfangyutn84574cpnl2", + "validator_address": "storyvaloper1l3ewm920n34gj2cam7lcfangyutn8457mh4j5p", + "period_delegation_id": "0", + "shares": "1025000000000.000000000000000000", + "rewards_shares": "1025000000000.000000000000000000", + "end_time": "2024-10-23T08:48:00.313756096Z" + }, + "error": "" +} +``` + +--- diff --git a/client/server/api.swagger.yaml b/client/server/api.swagger.yaml index 72c1128f..e9ea2bdb 100644 --- a/client/server/api.swagger.yaml +++ b/client/server/api.swagger.yaml @@ -1,37 +1,50 @@ info: - title: story-api + title: consensus-client-api description: '' version: 1.0.0 -tags: [] +tags: + - name: Cosmos Origin + - name: Cosmos Origin/Staking + - name: Cosmos Origin/Auth + - name: Cosmos Origin/Bank + - name: Cosmos Origin/Distribution + - name: Cosmos Origin/Mint + - name: Story Extend + - name: Story Extend/Staking paths: /staking/validators: get: summary: GetValidators deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - - name: status - in: query - description: '' - required: true - type: string - x-example: '' - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -40,16 +53,28 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' + - name: status + in: query + description: status enables to query for validators matching a given status. + required: false + type: string + x-example: '' responses: '200': description: '' @@ -174,11 +199,12 @@ paths: summary: GetValidatorByValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: validator_addr in: path - description: '' + description: validator_addr defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw @@ -288,66 +314,69 @@ paths: security: [] produces: - application/json - /staking/delegators/{delegator_addr}: - get: - summary: GetDelegatorByDelegatorAddress - deprecated: false - description: '' - tags: [] - parameters: - - name: delegator_addr - in: path - description: '' - required: true - type: string - x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - responses: - '200': - description: '' - headers: {} - schema: - type: object - properties: - code: - type: integer - msg: - type: object - properties: - delegator_addr: - type: string - withdraw_address: - type: string - reward_address: - type: string - operator_address: - type: string - required: - - delegator_addr - - withdraw_address - - reward_address - - operator_address - error: - type: string - required: - - code - - msg - - error - security: [] - produces: - - application/json /staking/validators/{validator_addr}/delegations: get: summary: GetValidatorDelegationsByValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: validator_addr in: path - description: '' + description: validator_addr defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw + - name: pagination.key + in: query + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false + type: string + x-example: FPoybu9dO+FCSV562u9keKVgUwur + - name: pagination.offset + in: query + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false + type: string + x-example: '0' + - name: pagination.limit + in: query + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false + type: array + items: + type: string + x-example: + - '10' + collectionFormat: multi + - name: pagination.count_total + in: query + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean + x-example: 'true' + - name: pagination.reverse + in: query + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean + x-example: 'true' responses: '200': description: '' @@ -418,14 +447,64 @@ paths: summary: GetDelegationsByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: delegator_addr in: path - description: '' + description: delegator_addr defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 + - name: pagination.key + in: query + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false + type: string + x-example: FPoybu9dO+FCSV562u9keKVgUwur + - name: pagination.offset + in: query + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false + type: string + x-example: '0' + - name: pagination.limit + in: query + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false + type: array + items: + type: string + x-example: + - '10' + collectionFormat: multi + - name: pagination.count_total + in: query + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean + x-example: 'true' + - name: pagination.reverse + in: query + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean + x-example: 'true' responses: '200': description: '' @@ -496,36 +575,40 @@ paths: summary: GetRedelegationsByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: delegator_addr in: path - description: '' + description: delegator_addr defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - - name: status - in: query - description: '' - required: true - type: string - x-example: '' - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -534,16 +617,34 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' + - name: src_validator_addr + in: query + description: src_validator_addr defines the validator address to redelegate from. + required: false + type: string + x-example: storyvaloper1l43wgqtf825k4qwx4lt6xremu0jjptv7w6q0ak + - name: dst_validator_addr + in: query + description: dst_validator_addr defines the validator address to redelegate to. + required: false + type: string + x-example: storyvaloper17mmqx2r9d5zq8z9jcajxpc64tkhh5tuxzl5rdl responses: '200': description: '' @@ -559,14 +660,64 @@ paths: summary: GetValidatorsByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: delegator_addr in: path - description: '' + description: delegator_addr defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 + - name: pagination.key + in: query + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false + type: string + x-example: FPoybu9dO+FCSV562u9keKVgUwur + - name: pagination.offset + in: query + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false + type: string + x-example: '0' + - name: pagination.limit + in: query + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false + type: array + items: + type: string + x-example: + - '10' + collectionFormat: multi + - name: pagination.count_total + in: query + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean + x-example: 'true' + - name: pagination.reverse + in: query + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean + x-example: 'true' responses: '200': description: '' @@ -688,17 +839,18 @@ paths: summary: GetValidatorsByDelegatorAddressValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: delegator_addr in: path - description: '' + description: delegator_addr defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - name: validator_addr in: path - description: '' + description: validator_addr defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw @@ -813,36 +965,40 @@ paths: summary: GetUnbondingDelegationsByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: delegator_addr in: path - description: '' + description: delegator_addr defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - - name: status - in: query - description: '' - required: true - type: string - x-example: '' - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -851,15 +1007,21 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' responses: '200': @@ -876,7 +1038,8 @@ paths: summary: GetStakingParams deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: [] responses: '200': @@ -959,7 +1122,8 @@ paths: summary: GetStakingPool deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: [] responses: '200': @@ -999,13 +1163,15 @@ paths: summary: GetHistoricalInfoByHeight deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: height in: path - description: '' + description: height defines at which height to query the historical info. required: true type: integer + x-example: 1 responses: '200': description: '' @@ -1149,17 +1315,18 @@ paths: summary: GetDelegationByValidatorAddressDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: validator_addr in: path - description: '' + description: validator_addr defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw - name: delegator_addr in: path - description: '' + description: delegator_addr defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 @@ -1223,36 +1390,40 @@ paths: summary: GetValidatorUnbondingDelegations deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: validator_addr in: path - description: '' + description: validator_addr defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw - - name: status - in: query - description: '' - required: true - type: string - x-example: '' - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -1261,74 +1432,22 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' - responses: - '200': - description: '' - headers: {} - schema: - type: object - properties: {} - security: [] - produces: - - application/json - /staking/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation: - get: - summary: GetDelegatorUnbondingDelegation - deprecated: false - description: '' - tags: [] - parameters: - - name: validator_addr - in: path - description: '' - required: true - type: string - x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw - - name: delegator_addr - in: path - description: '' - required: true - type: string - x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - responses: - '200': - description: '' - headers: {} - schema: - type: object - properties: {} - security: [] - produces: - - application/json - /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations: - get: - summary: GetPeriodDelegationsByDelegatorAddress - deprecated: false - description: '' - tags: [] - parameters: - - name: validator_addr - in: path - description: '' - required: true - type: string - x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw - - name: delegator_addr - in: path - description: '' - required: true - type: string - x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 responses: '200': description: '' @@ -1339,22 +1458,52 @@ paths: code: type: integer msg: - type: array - items: - type: object - properties: - delegator_address: - type: string - validator_address: - type: string - period_delegation_id: - type: string - shares: - type: string - rewards_shares: - type: string - end_time: - type: string + type: object + properties: + unbonding_responses: + type: array + items: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + entries: + type: array + items: + type: object + properties: + creation_height: + type: string + completion_time: + type: string + initial_balance: + type: string + balance: + type: string + unbonding_id: + type: string + required: + - creation_height + - completion_time + - initial_balance + - balance + - unbonding_id + required: + - delegator_address + - validator_address + - entries + pagination: + type: object + properties: + total: + type: string + required: + - total + required: + - unbonding_responses + - pagination error: type: string required: @@ -1364,68 +1513,33 @@ paths: security: [] produces: - application/json - /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations/{period_delegation_id}: + /staking/validators/{validator_addr}/delegations/{delegator_addr}/unbonding_delegation: get: - summary: GetPeriodDelegationByDelegatorAddressAndID + summary: GetDelegatorUnbondingDelegation deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Staking parameters: - name: validator_addr in: path - description: '' + description: validator_addr defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw - name: delegator_addr in: path - description: '' + description: delegator_addr defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - - name: period_delegation_id - in: path - description: '' - required: true - type: string - x-example: '1' responses: '200': description: '' headers: {} schema: type: object - properties: - code: - type: integer - msg: - type: object - properties: - delegator_address: - type: string - validator_address: - type: string - period_delegation_id: - type: string - shares: - type: string - rewards_shares: - type: string - end_time: - type: string - required: - - delegator_address - - validator_address - - period_delegation_id - - shares - - rewards_shares - - end_time - error: - type: string - required: - - code - - msg - - error + properties: {} security: [] produces: - application/json @@ -1434,24 +1548,34 @@ paths: summary: GetAccounts deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Auth parameters: - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -1460,15 +1584,21 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' responses: '200': @@ -1537,7 +1667,8 @@ paths: summary: GetBech32Prefix deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Auth parameters: [] responses: '200': @@ -1569,7 +1700,8 @@ paths: summary: GetAuthParams deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Auth parameters: [] responses: '200': @@ -1618,7 +1750,8 @@ paths: summary: GetBankParams deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Bank parameters: [] responses: '200': @@ -1651,24 +1784,34 @@ paths: summary: GetSupply deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Bank parameters: - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -1677,15 +1820,21 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' responses: '200': @@ -1732,12 +1881,13 @@ paths: summary: GetSupplyByDenom deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Bank parameters: - name: denom in: query - description: '' - required: true + description: denom is the coin denom to query balances for. + required: false type: string x-example: stake responses: @@ -1778,30 +1928,40 @@ paths: summary: GetBalancesByAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Bank parameters: - name: address in: path - description: '' + description: address is the address to query balances for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -1810,15 +1970,140 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean + x-example: 'true' + - name: resolve_denom + in: query + description: >- + resolve_denom is the flag to resolve the denom into a human-readable + form from the metadata. + required: false + type: boolean + x-example: 'true' + responses: + '200': description: '' + headers: {} + schema: + type: object + properties: + code: + type: integer + msg: + type: object + properties: + balances: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + pagination: + type: object + properties: + total: + type: string + required: + - total + required: + - balances + - pagination + error: + type: string + required: + - code + - msg + - error + security: [] + produces: + - application/json + /bank/spendable_balances/{address}: + get: + summary: GetSpendableBalancesByAddress + deprecated: false + description: '' + tags: + - Cosmos Origin/Bank + parameters: + - name: address + in: path + description: address is the address to query balances for. required: true type: string + x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 + - name: pagination.key + in: query + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false + type: string + x-example: FPoybu9dO+FCSV562u9keKVgUwur + - name: pagination.offset + in: query + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false + type: string + x-example: '0' + - name: pagination.limit + in: query + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false + type: array + items: + type: string + x-example: + - '10' + collectionFormat: multi + - name: pagination.count_total + in: query + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean + x-example: 'true' + - name: pagination.reverse + in: query + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean + x-example: 'true' + - name: resolve_denom + in: query + description: >- + resolve_denom is the flag to resolve the denom into a human-readable + form from the metadata. + required: false + type: boolean x-example: 'true' responses: '200': @@ -1862,20 +2147,74 @@ paths: - application/json /bank/balances/{address}/by_denom: get: - summary: GetBalancesByAddressDenom + summary: GetBalancesByAddressDenom + deprecated: false + description: '' + tags: + - Cosmos Origin/Bank + parameters: + - name: address + in: path + description: address is the address to query balances for. + required: true + type: string + x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 + - name: denom + in: query + description: denom is the coin denom to query balances for. + required: false + type: string + x-example: stake + responses: + '200': + description: '' + headers: {} + schema: + type: object + properties: + code: + type: integer + msg: + type: object + properties: + balance: + type: object + properties: + denom: + type: string + amount: + type: string + required: + - denom + - amount + required: + - balance + error: + type: string + required: + - code + - msg + - error + security: [] + produces: + - application/json + /bank/spendable_balances/{address}/by_denom: + get: + summary: GetSpendableBalancesByAddressDenom deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Bank parameters: - name: address in: path - description: '' + description: address is the address to query balances for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - name: denom in: query - description: '' + description: denom is the coin denom to query balances for. required: false type: string x-example: stake @@ -1917,30 +2256,42 @@ paths: summary: GetDenomOwners deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Bank parameters: - name: denom in: path - description: '' + description: >- + denom defines the coin denomination to query all account holders + for. required: true type: string x-example: stake - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -1949,15 +2300,21 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' responses: '200': @@ -2015,24 +2372,34 @@ paths: summary: GetDenomOwnersByQuery deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Bank parameters: - name: pagination.key in: query - description: '' + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. required: false type: string - x-example: stake + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -2041,19 +2408,27 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' - name: denom in: query - description: '' + description: >- + denom defines the coin denomination to query all account holders + for. required: false type: string x-example: stake @@ -2116,7 +2491,8 @@ paths: summary: GetDistributionParams deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: [] responses: '200': @@ -2162,11 +2538,12 @@ paths: summary: GetDistributionValidatorsByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: delegator_address in: path - description: '' + description: delegator_address defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 @@ -2202,11 +2579,12 @@ paths: summary: GetDelegatorWithdrawAddressByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: delegator_address in: path - description: '' + description: delegator_address defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 @@ -2225,11 +2603,12 @@ paths: summary: GetDelegatorRewardsByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: delegator_address in: path - description: '' + description: delegator_address defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 @@ -2293,17 +2672,18 @@ paths: summary: GetDelegatorRewardsByDelegatorAddressValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: delegator_address in: path - description: '' + description: delegator_address defines the delegator address to query for. required: true type: string x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 - name: validator_address in: path - description: '' + description: validator_address defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw @@ -2344,11 +2724,12 @@ paths: summary: GetDistributionValidatorByValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: validator_address in: path - description: '' + description: validator_address defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw @@ -2402,11 +2783,12 @@ paths: summary: GetValidatorCommissionByValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: validator_address in: path - description: '' + description: validator_address defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw @@ -2452,11 +2834,12 @@ paths: summary: GetValidatorOutstandingRewardsByValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: validator_address in: path - description: '' + description: validator_address defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw @@ -2502,30 +2885,40 @@ paths: summary: GetValidatorSlashesByValidatorAddress deprecated: false description: '' - tags: [] + tags: + - Cosmos Origin/Distribution parameters: - name: validator_address in: path - description: '' + description: validator_address defines the validator address to query for. required: true type: string x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw - name: pagination.key in: query - description: '' - required: true + description: >- + key is a value returned in PageResponse.next_key to begin querying + the next page most efficiently. Only one of offset or key should be + set. + required: false type: string - x-example: '' + x-example: FPoybu9dO+FCSV562u9keKVgUwur - name: pagination.offset in: query - description: '' - required: true + description: >- + offset is a numeric offset that can be used when key is unavailable. + It is less efficient than using key. Only one of offset or key + should be set. + required: false type: string x-example: '0' - name: pagination.limit in: query - description: '' - required: true + description: >- + limit is the total number of results to be returned in the result + page. If left empty it will default to a value to be set by each + app. + required: false type: array items: type: string @@ -2534,16 +2927,38 @@ paths: collectionFormat: multi - name: pagination.count_total in: query - description: '' - required: true - type: string + description: >- + count_total is set to true to indicate that the result set should + include a count of the total number of items available for + pagination in UIs. count_total is only respected when offset is + used. It is ignored when key is set. + required: false + type: boolean x-example: 'true' - name: pagination.reverse in: query - description: '' - required: true - type: string + description: >- + reverse is set to true if results are to be returned in the + descending order. + required: false + type: boolean x-example: 'true' + - name: starting_height + in: query + description: >- + starting_height defines the optional starting height to query the + slashes. + required: false + type: string + x-example: '1' + - name: ending_height + in: query + description: >- + ending_height defines the optional ending height to query the + slashes. + required: false + type: string + x-example: '100' responses: '200': description: '' @@ -2575,36 +2990,224 @@ paths: security: [] produces: - application/json - /distribution/all_validators/outstanding_rewards: + /mint/params: + get: + summary: GetMintParams + deprecated: false + description: '' + tags: + - Cosmos Origin/Mint + parameters: [] + responses: + '200': + description: '' + headers: {} + schema: + type: object + properties: + code: + type: integer + msg: + type: object + properties: + params: + type: object + properties: + mint_denom: + type: string + inflations_per_year: + type: string + blocks_per_year: + type: string + required: + - mint_denom + - inflations_per_year + - blocks_per_year + required: + - params + error: + type: string + required: + - code + - msg + - error + security: [] + produces: + - application/json + /staking/delegators/{delegator_addr}: get: - summary: GetAllValidatorOutstandingRewards + summary: GetDelegatorByDelegatorAddress deprecated: false description: '' - tags: [] + tags: + - Story Extend/Staking parameters: - - name: from - in: query + - name: delegator_addr + in: path + description: delegator_addr defines the delegator address to query for. + required: true + type: string + x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 + responses: + '200': description: '' - required: false - type: integer - x-example: 100 - - name: to - in: query + headers: {} + schema: + type: object + properties: + code: + type: integer + msg: + type: object + properties: + delegator_addr: + type: string + withdraw_address: + type: string + reward_address: + type: string + operator_address: + type: string + required: + - delegator_addr + - withdraw_address + - reward_address + - operator_address + error: + type: string + required: + - code + - msg + - error + security: [] + produces: + - application/json + /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations: + get: + summary: GetPeriodDelegationsByDelegatorAddress + deprecated: false + description: '' + tags: + - Story Extend/Staking + parameters: + - name: validator_addr + in: path + description: validator_addr defines the validator address to query for. + required: true + type: string + x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw + - name: delegator_addr + in: path + description: delegator_addr defines the delegator address to query for. + required: true + type: string + x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 + responses: + '200': description: '' - required: false - type: integer - x-example: 200 + headers: {} + schema: + type: object + properties: + code: + type: integer + msg: + type: array + items: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + period_delegation_id: + type: string + shares: + type: string + rewards_shares: + type: string + end_time: + type: string + error: + type: string + required: + - code + - msg + - error + security: [] + produces: + - application/json + /staking/validators/{validator_addr}/delegators/{delegator_addr}/period_delegations/{period_delegation_id}: + get: + summary: GetPeriodDelegationByDelegatorAddressAndID + deprecated: false + description: '' + tags: + - Story Extend/Staking + parameters: + - name: validator_addr + in: path + description: validator_addr defines the validator address to query for. + required: true + type: string + x-example: storyvaloper17973uudyv484cgmy4sd4kjwdgrh86vfwhh0nlw + - name: delegator_addr + in: path + description: delegator_addr defines the delegator address to query for. + required: true + type: string + x-example: story1f5zuqhmwy39cv64g6laeeg264ydz06txlfqtg3 + - name: period_delegation_id + in: path + description: the id of delegation + required: true + type: string + x-example: '1' responses: '200': description: '' headers: {} schema: type: object - properties: {} + properties: + code: + type: integer + msg: + type: object + properties: + delegator_address: + type: string + validator_address: + type: string + period_delegation_id: + type: string + shares: + type: string + rewards_shares: + type: string + end_time: + type: string + required: + - delegator_address + - validator_address + - period_delegation_id + - shares + - rewards_shares + - end_time + error: + type: string + required: + - code + - msg + - error security: [] produces: - application/json swagger: '2.0' +host: staking.odyssey.storyrpc.io +schemes: + - https +basePath: /api definitions: {} securityDefinitions: {} x-components: {} diff --git a/client/server/bank.go b/client/server/bank.go index a6c2fb23..b88e622c 100644 --- a/client/server/bank.go +++ b/client/server/bank.go @@ -1,4 +1,4 @@ -//nolint:wrapcheck // The api server is our server, so we don't need to wrap it +//nolint:wrapcheck,dupl // The api server is our server, so we don't need to wrap it package server import ( diff --git a/client/server/distribution.go b/client/server/distribution.go index 66c87816..6f2ddb7b 100644 --- a/client/server/distribution.go +++ b/client/server/distribution.go @@ -1,11 +1,9 @@ -//nolint:wrapcheck // The api server is our server, so we don't need to wrap it. +//nolint:wrapcheck,dupl // The api server is our server, so we don't need to wrap it. package server import ( - "errors" "net/http" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -21,7 +19,6 @@ func (s *Server) initDistributionRoute() { s.httpMux.HandleFunc("/distribution/validators/{validator_address}/commission", utils.SimpleWrap(s.aminoCodec, s.GetValidatorCommissionByValidatorAddress)) s.httpMux.HandleFunc("/distribution/validators/{validator_address}/outstanding_rewards", utils.SimpleWrap(s.aminoCodec, s.GetValidatorOutstandingRewardsByValidatorAddress)) s.httpMux.HandleFunc("/distribution/validators/{validator_address}/slashes", utils.AutoWrap(s.aminoCodec, s.GetValidatorSlashesByValidatorAddress)) - s.httpMux.HandleFunc("/distribution/all_validators/outstanding_rewards", utils.AutoWrap(s.aminoCodec, s.GetAllValidatorOutstandingRewards)) s.httpMux.HandleFunc("/distribution/delegators/{delegator_address}/validators", utils.SimpleWrap(s.aminoCodec, s.GetDistributionValidatorsByDelegatorAddress)) s.httpMux.HandleFunc("/distribution/delegators/{delegator_address}/rewards", utils.SimpleWrap(s.aminoCodec, s.GetDelegatorRewardsByDelegatorAddress)) @@ -97,47 +94,6 @@ func (s *Server) GetValidatorOutstandingRewardsByValidatorAddress(r *http.Reques return queryResp, nil } -// GetAllValidatorOutstandingRewards queries rewards of all validators. -func (s *Server) GetAllValidatorOutstandingRewards(req *getAllValidatorOutstandingRewardsRequest, r *http.Request) (resp any, err error) { - if req.To-req.From > 100 { - return nil, errors.New("search max 100 blocks") - } - - curBlock, err := s.cl.Block(r.Context(), nil) - if err != nil { - return nil, errors.Join(errors.New("curbock fetch fail"), err) - } - - querier := keeper.NewQuerier(s.store.GetDistrKeeper()) - result := make([]*getAllValidatorOutstandingRewardsRequestBlockResults, 0) - - for i := req.From; i < min(req.To, curBlock.Block.Height); i++ { - queryContext, err := s.store.CreateQueryContext(i, false) - if err != nil { - return nil, errors.Join(errors.New("create query context fail"), err) - } - - blockResult := &getAllValidatorOutstandingRewardsRequestBlockResults{ - Height: i, - Validators: make(map[string]sdk.DecCoins), - } - //nolint: contextcheck // false positive - querier.IterateValidatorOutstandingRewards(queryContext, func(val sdk.ValAddress, rewards distributiontypes.ValidatorOutstandingRewards) (stop bool) { - if len(rewards.Rewards) > 0 { - blockResult.Validators[val.String()] = rewards.Rewards - } - - return false - }) - - if len(blockResult.Validators) > 0 { - result = append(result, blockResult) - } - } - - return result, nil -} - // GetValidatorSlashesByValidatorAddress queries slash events of a validator. func (s *Server) GetValidatorSlashesByValidatorAddress(req *getValidatorSlashesByValidatorAddressRequest, r *http.Request) (resp any, err error) { queryContext, err := s.createQueryContextByHeader(r) diff --git a/client/server/payload.go b/client/server/payload.go index 023a6d28..f7a98c43 100644 --- a/client/server/payload.go +++ b/client/server/payload.go @@ -1,9 +1,5 @@ package server -import ( - sdk "github.com/cosmos/cosmos-sdk/types" -) - type pagination struct { Key string `mapstructure:"key"` Offset uint64 `mapstructure:"offset"` @@ -50,16 +46,6 @@ type getDenomOwnersByQueryRequest struct { Pagination pagination `mapstructure:"pagination"` } -type getAllValidatorOutstandingRewardsRequest struct { - From int64 `mapstructure:"from"` - To int64 `mapstructure:"to"` -} - -type getAllValidatorOutstandingRewardsRequestBlockResults struct { - Height int64 `json:"height"` - Validators map[string]sdk.DecCoins `json:"validators"` -} - type getValidatorSlashesByValidatorAddressRequest struct { StartingHeight uint64 `mapstructure:"starting_height"` EndingHeight uint64 `mapstructure:"ending_height"` diff --git a/client/x/evmstaking/keeper/redelegation.go b/client/x/evmstaking/keeper/redelegation.go index c23293f2..afabc8a2 100644 --- a/client/x/evmstaking/keeper/redelegation.go +++ b/client/x/evmstaking/keeper/redelegation.go @@ -138,12 +138,24 @@ func (k Keeper) ProcessRedelegate(ctx context.Context, ev *bindings.IPTokenStaki depositorAddr.String(), validatorSrcAddr.String(), validatorDstAddr.String(), ev.DelegationId.String(), amountCoin, ) + _, err = skeeper.NewMsgServerImpl(k.stakingKeeper.(*skeeper.Keeper)).BeginRedelegate(cachedCtx, msg) - if err != nil { + switch { + case errors.Is(err, stypes.ErrSelfRedelegation): + return errors.WrapErrWithCode(errors.SelfRedelegation, err) + case errors.Is(err, stypes.ErrNoValidatorFound): + return errors.WrapErrWithCode(errors.ValidatorNotFound, err) + case errors.Is(err, stypes.ErrTokenTypeMismatch): + return errors.WrapErrWithCode(errors.TokenTypeMismatch, err) + case errors.Is(err, stypes.ErrNoDelegation): + return errors.WrapErrWithCode(errors.DelegationNotFound, err) + case errors.Is(err, stypes.ErrNoPeriodDelegation): + return errors.WrapErrWithCode(errors.PeriodDelegationNotFound, err) + case err != nil: return errors.Wrap(err, "failed to begin redelegation") + default: + return nil } - - return nil } func (k Keeper) ParseRedelegateLog(ethLog ethtypes.Log) (*bindings.IPTokenStakingRedelegate, error) { diff --git a/client/x/evmstaking/keeper/unjail.go b/client/x/evmstaking/keeper/unjail.go index 165278fe..58dd0eaf 100644 --- a/client/x/evmstaking/keeper/unjail.go +++ b/client/x/evmstaking/keeper/unjail.go @@ -10,6 +10,7 @@ import ( "cosmossdk.io/collections" sdk "github.com/cosmos/cosmos-sdk/types" + slashtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/piplabs/story/client/x/evmstaking/types" @@ -78,8 +79,15 @@ func (k Keeper) ProcessUnjail(ctx context.Context, ev *bindings.IPTokenStakingUn } } - err = k.slashingKeeper.Unjail(cachedCtx, valAddr) - if err != nil { + if err = k.slashingKeeper.Unjail(cachedCtx, valAddr); errors.Is(err, slashtypes.ErrNoValidatorForAddress) { + return errors.WrapErrWithCode(errors.ValidatorNotFound, err) + } else if errors.Is(err, slashtypes.ErrMissingSelfDelegation) { + return errors.WrapErrWithCode(errors.MissingSelfDelegation, err) + } else if errors.Is(err, slashtypes.ErrValidatorNotJailed) { + return errors.WrapErrWithCode(errors.ValidatorNotJailed, err) + } else if errors.Is(err, slashtypes.ErrValidatorJailed) { + return errors.WrapErrWithCode(errors.ValidatorStillJailed, err) + } else if err != nil { return errors.Wrap(err, "unjail") } diff --git a/client/x/evmstaking/keeper/update_commission.go b/client/x/evmstaking/keeper/update_commission.go index 0de46177..e861428e 100644 --- a/client/x/evmstaking/keeper/update_commission.go +++ b/client/x/evmstaking/keeper/update_commission.go @@ -54,7 +54,9 @@ func (k Keeper) ProcessUpdateValidatorCommission(ctx context.Context, ev *bindin validatorAddr := sdk.ValAddress(validatorPubkey.Address().Bytes()) validator, err := k.stakingKeeper.GetValidator(cachedCtx, validatorAddr) - if err != nil { + if errors.Is(err, stypes.ErrNoValidatorFound) { + return errors.WrapErrWithCode(errors.ValidatorNotFound, err) + } else if err != nil { return errors.Wrap(err, "get validator") } diff --git a/client/x/evmstaking/keeper/validator.go b/client/x/evmstaking/keeper/validator.go index e29aa864..721a1620 100644 --- a/client/x/evmstaking/keeper/validator.go +++ b/client/x/evmstaking/keeper/validator.go @@ -96,13 +96,6 @@ func (k Keeper) ProcessCreateValidator(ctx context.Context, ev *bindings.IPToken } skeeperMsgServer := skeeper.NewMsgServerImpl(evmstakingSKeeper) - if _, err = k.stakingKeeper.GetValidator(cachedCtx, validatorAddr); err == nil { - return errors.WrapErrWithCode(errors.ValidatorAlreadyExists, errors.New("validator already exists")) - } else if !errors.Is(err, stypes.ErrNoValidatorFound) { - // Either the validator does not exist, or unknown error. - return errors.Wrap(err, "get validator") - } - moniker := ev.Moniker if moniker == "" { moniker = validatorAddr.String() // use validator address as moniker if not provided @@ -158,7 +151,9 @@ func (k Keeper) ProcessCreateValidator(ctx context.Context, ev *bindings.IPToken return errors.Wrap(err, "create stake coin for depositor: send coins") } - if _, err = skeeperMsgServer.CreateValidator(cachedCtx, msg); errors.Is(err, stypes.ErrCommissionLTMinRate) { + if _, err := skeeperMsgServer.CreateValidator(cachedCtx, msg); errors.Is(err, stypes.ErrValidatorOwnerExists) { + return errors.WrapErrWithCode(errors.ValidatorAlreadyExists, err) + } else if errors.Is(err, stypes.ErrCommissionLTMinRate) { return errors.WrapErrWithCode(errors.InvalidCommissionRate, err) } else if errors.Is(err, stypes.ErrMinSelfDelegationBelowMinDelegation) { return errors.WrapErrWithCode(errors.InvalidMinSelfDelegation, err) diff --git a/client/x/evmstaking/keeper/withdraw.go b/client/x/evmstaking/keeper/withdraw.go index 59e17e85..3c9a7585 100644 --- a/client/x/evmstaking/keeper/withdraw.go +++ b/client/x/evmstaking/keeper/withdraw.go @@ -420,7 +420,11 @@ func (k Keeper) ProcessWithdraw(ctx context.Context, ev *bindings.IPTokenStaking // Undelegate from the validator (validator existence is checked in ValidateUnbondAmount) resp, err := skeeper.NewMsgServerImpl(k.stakingKeeper.(*skeeper.Keeper)).Undelegate(cachedCtx, msg) - if errors.Is(err, stypes.ErrNoPeriodDelegation) { + if errors.Is(err, stypes.ErrNoValidatorFound) { + return errors.WrapErrWithCode(errors.ValidatorNotFound, err) + } else if errors.Is(err, stypes.ErrNoDelegation) { + return errors.WrapErrWithCode(errors.DelegationNotFound, err) + } else if errors.Is(err, stypes.ErrNoPeriodDelegation) { return errors.WrapErrWithCode(errors.PeriodDelegationNotFound, err) } else if err != nil { return errors.Wrap(err, "undelegate") diff --git a/contracts/script/GenerateAlloc.s.sol b/contracts/script/GenerateAlloc.s.sol index a0f28d0b..d3995f2c 100644 --- a/contracts/script/GenerateAlloc.s.sol +++ b/contracts/script/GenerateAlloc.s.sol @@ -217,16 +217,10 @@ contract GenerateAlloc is Script { vm.stopPrank(); bytes32 cancellerRole = TimelockController(payable(timelock)).CANCELLER_ROLE(); vm.prank(protocolAdmin); - TimelockController(payable(timelock)).grantRole( - cancellerRole, - canceller - ); + TimelockController(payable(timelock)).grantRole(cancellerRole, canceller); if (!KEEP_TIMELOCK_ADMIN_ROLE) { bytes32 adminRole = TimelockController(payable(timelock)).DEFAULT_ADMIN_ROLE(); - TimelockController(payable(timelock)).renounceRole( - adminRole, - protocolAdmin - ); + TimelockController(payable(timelock)).renounceRole(adminRole, protocolAdmin); } vm.stopPrank(); vm.startPrank(deployer); diff --git a/lib/errors/codes.go b/lib/errors/codes.go index 6c7414bb..f816c185 100644 --- a/lib/errors/codes.go +++ b/lib/errors/codes.go @@ -8,50 +8,68 @@ type ErrCode uint32 const ( Unspecified ErrCode = 0 - InvalidUncmpPubKey ErrCode = 1 - ValidatorNotFound ErrCode = 2 - ValidatorAlreadyExists ErrCode = 3 - InvalidTokenType ErrCode = 4 - InvalidPeriodType ErrCode = 5 + UnexpectedCondition ErrCode = 1 + InvalidUncmpPubKey ErrCode = 2 + ValidatorNotFound ErrCode = 3 + ValidatorAlreadyExists ErrCode = 4 + InvalidTokenType ErrCode = 5 InvalidOperator ErrCode = 6 InvalidCommissionRate ErrCode = 7 InvalidMinSelfDelegation ErrCode = 8 - InvalidDelegationAmount ErrCode = 9 - PeriodDelegationNotFound ErrCode = 10 - InvalidRequest ErrCode = 11 - UnexpectedCondition ErrCode = 12 + InvalidPeriodType ErrCode = 9 + InvalidDelegationAmount ErrCode = 10 + DelegationNotFound ErrCode = 11 + PeriodDelegationNotFound ErrCode = 12 + InvalidRequest ErrCode = 13 + SelfRedelegation ErrCode = 14 + TokenTypeMismatch ErrCode = 15 + MissingSelfDelegation ErrCode = 16 + ValidatorNotJailed ErrCode = 17 + ValidatorStillJailed ErrCode = 18 ) var ( ErrUnspecified = stderrors.New("unspecified") + ErrUnexpectedCondition = stderrors.New("unexpected_condition") ErrInvalidUncmpPubKey = stderrors.New("invalid_uncompressed_pubkey") ErrValidatorNotFound = stderrors.New("validator_not_found") ErrValidatorAlreadyExists = stderrors.New("validator_already_exists") ErrInvalidTokenType = stderrors.New("invalid_token_type") - ErrInvalidPeriodType = stderrors.New("invalid_period_type") ErrInvalidOperator = stderrors.New("invalid_operator") ErrInvalidCommissionRate = stderrors.New("invalid_commission_rate") ErrInvalidMinSelfDelegation = stderrors.New("invalid_min_self_delegation") + ErrInvalidPeriodType = stderrors.New("invalid_period_type") ErrInvalidDelegationAmount = stderrors.New("invalid_delegation_amount") + ErrDelegationNotFound = stderrors.New("delegation_not_found") ErrPeriodDelegationNotFound = stderrors.New("period_delegation_not_found") ErrInvalidRequest = stderrors.New("invalid_request") - ErrUnexpectedCondition = stderrors.New("unexpected_condition") + ErrSelfRedelegation = stderrors.New("self_redelegation") + ErrTokenTypeMismatch = stderrors.New("token_type_mismatch") + ErrMissingSelfDelegation = stderrors.New("missing_self_delegation") + ErrValidatorNotJailed = stderrors.New("validator_not_jailed") + ErrValidatorStillJailed = stderrors.New("validator_still_jailed") ) var codeToErr = map[ErrCode]error{ Unspecified: ErrUnspecified, + UnexpectedCondition: ErrUnexpectedCondition, InvalidUncmpPubKey: ErrInvalidUncmpPubKey, ValidatorNotFound: ErrValidatorNotFound, ValidatorAlreadyExists: ErrValidatorAlreadyExists, InvalidTokenType: ErrInvalidTokenType, - InvalidPeriodType: ErrInvalidPeriodType, InvalidOperator: ErrInvalidOperator, InvalidCommissionRate: ErrInvalidCommissionRate, InvalidMinSelfDelegation: ErrInvalidMinSelfDelegation, + InvalidPeriodType: ErrInvalidPeriodType, InvalidDelegationAmount: ErrInvalidDelegationAmount, + DelegationNotFound: ErrDelegationNotFound, PeriodDelegationNotFound: ErrPeriodDelegationNotFound, InvalidRequest: ErrInvalidRequest, - UnexpectedCondition: ErrUnexpectedCondition, + SelfRedelegation: ErrSelfRedelegation, + TokenTypeMismatch: ErrTokenTypeMismatch, + MissingSelfDelegation: ErrMissingSelfDelegation, + ValidatorNotJailed: ErrValidatorNotJailed, + ValidatorStillJailed: ErrValidatorStillJailed, } func (c ErrCode) String() string { @@ -75,6 +93,8 @@ func UnwrapErrCode(err error) ErrCode { switch { case stderrors.Is(err, ErrUnspecified): return Unspecified + case stderrors.Is(err, ErrUnexpectedCondition): + return UnexpectedCondition case stderrors.Is(err, ErrInvalidUncmpPubKey): return InvalidUncmpPubKey case stderrors.Is(err, ErrValidatorNotFound): @@ -83,22 +103,32 @@ func UnwrapErrCode(err error) ErrCode { return ValidatorAlreadyExists case stderrors.Is(err, ErrInvalidTokenType): return InvalidTokenType - case stderrors.Is(err, ErrInvalidPeriodType): - return InvalidPeriodType case stderrors.Is(err, ErrInvalidOperator): return InvalidOperator case stderrors.Is(err, ErrInvalidCommissionRate): return InvalidCommissionRate case stderrors.Is(err, ErrInvalidMinSelfDelegation): return InvalidMinSelfDelegation + case stderrors.Is(err, ErrInvalidPeriodType): + return InvalidPeriodType case stderrors.Is(err, ErrInvalidDelegationAmount): return InvalidDelegationAmount + case stderrors.Is(err, ErrDelegationNotFound): + return DelegationNotFound case stderrors.Is(err, ErrPeriodDelegationNotFound): return PeriodDelegationNotFound case stderrors.Is(err, ErrInvalidRequest): return InvalidRequest - case stderrors.Is(err, ErrUnexpectedCondition): - return UnexpectedCondition + case stderrors.Is(err, ErrSelfRedelegation): + return SelfRedelegation + case stderrors.Is(err, ErrTokenTypeMismatch): + return TokenTypeMismatch + case stderrors.Is(err, ErrMissingSelfDelegation): + return MissingSelfDelegation + case stderrors.Is(err, ErrValidatorNotJailed): + return ValidatorNotJailed + case stderrors.Is(err, ErrValidatorStillJailed): + return ValidatorStillJailed default: return Unspecified }