Skip to content

Commit

Permalink
Merge pull request #20 from Layr-Labs/sm-protocolRpcs
Browse files Browse the repository at this point in the history
protocol rpc tweaks
  • Loading branch information
seanmcgary authored Jan 27, 2025
2 parents a836ac4 + b2e6b30 commit a6d8a11
Show file tree
Hide file tree
Showing 8 changed files with 1,311 additions and 553 deletions.
46 changes: 38 additions & 8 deletions gen/api-ts/eigenlayer/sidecar/v1/rewards/rewards.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,21 @@ export type GenerateClaimProofResponse = {
proof?: Proof
}

export type GetAvailableRewardsRequest = {
export type GetClaimableRewardsRequest = {
earnerAddress?: string
blockHeight?: string
}

export type GetAvailableRewardsResponse = {
export type GetClaimableRewardsResponse = {
rewards?: Reward[]
}

export type TotalClaimedReward = {
earner?: string
token?: string
amount?: string
}


type BaseGetTotalClaimedRewardsRequest = {
earnerAddress?: string
Expand All @@ -181,22 +188,27 @@ export type GetTotalClaimedRewardsRequest = BaseGetTotalClaimedRewardsRequest
& OneOf<{ blockHeight: string }>

export type GetTotalClaimedRewardsResponse = {
rewards?: Reward[]
rewards?: TotalClaimedReward[]
}

export type GetAvailableRewardsTokensRequest = {

type BaseGetAvailableRewardsTokensRequest = {
earnerAddress?: string
}

export type GetAvailableRewardsTokensRequest = BaseGetAvailableRewardsTokensRequest
& OneOf<{ blockHeight: string }>

export type GetAvailableRewardsTokensResponse = {
tokens?: string[]
}

export type SummarizedEarnerReward = {
token?: string
earned?: string
claimable?: string
active?: string
claimed?: string
claimable?: string
}


Expand All @@ -217,6 +229,7 @@ export type ClaimedReward = {
token?: string
amount?: string
distributionRoot?: string
blockNumber?: string
}

export type GetClaimedRewardsByBlockRequest = {
Expand All @@ -227,13 +240,27 @@ export type GetClaimedRewardsByBlockResponse = {
rewards?: ClaimedReward[]
}

export type ListDistributionRootsRequest = {

type BaseListDistributionRootsRequest = {
}

export type ListDistributionRootsRequest = BaseListDistributionRootsRequest
& OneOf<{ blockHeight: string }>

export type ListDistributionRootsResponse = {
distributionRoots?: DistributionRoot[]
}

export type ListClaimedRewardsByBlockRangeRequest = {
earnerAddress?: string
startBlockHeight?: string
endBlockHeight?: string
}

export type ListClaimedRewardsByBlockRangeResponse = {
rewards?: ClaimedReward[]
}

export class Rewards {
static GetRewardsRoot(req: GetRewardsRootRequest, initReq?: fm.InitReq): Promise<GetRewardsRootResponse> {
return fm.fetchReq<GetRewardsRootRequest, GetRewardsRootResponse>(`/rewards/v1/blocks/${req["blockHeight"]}/rewards-root?${fm.renderURLSearchParams(req, ["blockHeight"])}`, {...initReq, method: "GET"})
Expand Down Expand Up @@ -262,8 +289,8 @@ export class Rewards {
static GenerateClaimProof(req: GenerateClaimProofRequest, initReq?: fm.InitReq): Promise<GenerateClaimProofResponse> {
return fm.fetchReq<GenerateClaimProofRequest, GenerateClaimProofResponse>(`/rewards/v1/claim-proof`, {...initReq, method: "POST", body: JSON.stringify(req, fm.replacer)})
}
static GetAvailableRewards(req: GetAvailableRewardsRequest, initReq?: fm.InitReq): Promise<GetAvailableRewardsResponse> {
return fm.fetchReq<GetAvailableRewardsRequest, GetAvailableRewardsResponse>(`/rewards/v1/earners/${req["earnerAddress"]}/available-rewards?${fm.renderURLSearchParams(req, ["earnerAddress"])}`, {...initReq, method: "GET"})
static GetClaimableRewards(req: GetClaimableRewardsRequest, initReq?: fm.InitReq): Promise<GetClaimableRewardsResponse> {
return fm.fetchReq<GetClaimableRewardsRequest, GetClaimableRewardsResponse>(`/rewards/v1/earners/${req["earnerAddress"]}/claimable-rewards?${fm.renderURLSearchParams(req, ["earnerAddress"])}`, {...initReq, method: "GET"})
}
static GetTotalClaimedRewards(req: GetTotalClaimedRewardsRequest, initReq?: fm.InitReq): Promise<GetTotalClaimedRewardsResponse> {
return fm.fetchReq<GetTotalClaimedRewardsRequest, GetTotalClaimedRewardsResponse>(`/rewards/v1/earners/${req["earnerAddress"]}/total-claimed-rewards?${fm.renderURLSearchParams(req, ["earnerAddress"])}`, {...initReq, method: "GET"})
Expand All @@ -277,6 +304,9 @@ export class Rewards {
static GetClaimedRewardsByBlock(req: GetClaimedRewardsByBlockRequest, initReq?: fm.InitReq): Promise<GetClaimedRewardsByBlockResponse> {
return fm.fetchReq<GetClaimedRewardsByBlockRequest, GetClaimedRewardsByBlockResponse>(`/rewards/v1/blocks/${req["blockHeight"]}/claimed-rewards?${fm.renderURLSearchParams(req, ["blockHeight"])}`, {...initReq, method: "GET"})
}
static ListClaimedRewardsByBlockRange(req: ListClaimedRewardsByBlockRangeRequest, initReq?: fm.InitReq): Promise<ListClaimedRewardsByBlockRangeResponse> {
return fm.fetchReq<ListClaimedRewardsByBlockRangeRequest, ListClaimedRewardsByBlockRangeResponse>(`/rewards/v1/earners/${req["earnerAddress"]}/claimed-rewards?${fm.renderURLSearchParams(req, ["earnerAddress"])}`, {...initReq, method: "GET"})
}
static ListDistributionRoots(req: ListDistributionRootsRequest, initReq?: fm.InitReq): Promise<ListDistributionRootsResponse> {
return fm.fetchReq<ListDistributionRootsRequest, ListDistributionRootsResponse>(`/rewards/v1/distribution-roots?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
}
Expand Down
142 changes: 122 additions & 20 deletions gen/openapiv2/apidocs.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
},
"/rewards/v1/blocks/{blockHeight}/claimed-rewards": {
"get": {
"summary": "GetClaimedRewardsByBlock returns the claimed rewards for the given block height",
"summary": "GetClaimedRewardsByBlock returns the claimed rewards for the provided block height",
"operationId": "Rewards_GetClaimedRewardsByBlock",
"responses": {
"200": {
Expand Down Expand Up @@ -608,20 +608,29 @@
}
}
},
"parameters": [
{
"name": "blockHeight",
"in": "query",
"required": false,
"type": "string",
"format": "uint64"
}
],
"tags": [
"Rewards"
]
}
},
"/rewards/v1/earners/{earnerAddress}/available-rewards": {
"/rewards/v1/earners/{earnerAddress}/available-rewards-tokens": {
"get": {
"summary": "GetAvailableRewards returns the available rewards for the given earner address\nThis takes the amount earned from the current active root and subtracts total claimed.",
"operationId": "Rewards_GetAvailableRewards",
"summary": "GetAvailableRewardsTokens returns the available rewards tokens for the given earner address",
"operationId": "Rewards_GetAvailableRewardsTokens",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/rewardsGetAvailableRewardsResponse"
"$ref": "#/definitions/rewardsGetAvailableRewardsTokensResponse"
}
},
"default": {
Expand All @@ -637,22 +646,29 @@
"in": "path",
"required": true,
"type": "string"
},
{
"name": "blockHeight",
"in": "query",
"required": false,
"type": "string",
"format": "uint64"
}
],
"tags": [
"Rewards"
]
}
},
"/rewards/v1/earners/{earnerAddress}/available-rewards-tokens": {
"/rewards/v1/earners/{earnerAddress}/claimable-rewards": {
"get": {
"summary": "GetAvailableRewardsTokens returns the available rewards tokens for the given earner address",
"operationId": "Rewards_GetAvailableRewardsTokens",
"summary": "GetClaimableRewards returns the claimable rewards for the given earner address.\nThis takes the current active tokens earned and subtracts total claimed.",
"operationId": "Rewards_GetClaimableRewards",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/rewardsGetAvailableRewardsTokensResponse"
"$ref": "#/definitions/rewardsGetClaimableRewardsResponse"
}
},
"default": {
Expand All @@ -668,6 +684,58 @@
"in": "path",
"required": true,
"type": "string"
},
{
"name": "blockHeight",
"in": "query",
"required": false,
"type": "string",
"format": "uint64"
}
],
"tags": [
"Rewards"
]
}
},
"/rewards/v1/earners/{earnerAddress}/claimed-rewards": {
"get": {
"summary": "ListClaimedRewardsByBlockRange returns the claimed rewards for the given earner address and block range,\ninclusive of the start and end block heights",
"operationId": "Rewards_ListClaimedRewardsByBlockRange",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/rewardsListClaimedRewardsByBlockRangeResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "earnerAddress",
"in": "path",
"required": true,
"type": "string"
},
{
"name": "startBlockHeight",
"in": "query",
"required": false,
"type": "string",
"format": "uint64"
},
{
"name": "endBlockHeight",
"in": "query",
"required": false,
"type": "string",
"format": "uint64"
}
],
"tags": [
Expand All @@ -677,7 +745,7 @@
},
"/rewards/v1/earners/{earnerAddress}/summarized-rewards": {
"get": {
"summary": "GetSummarizedRewardsForEarner returns the summarized rewards for the given earner address, including how much\ntheyve earned, how much is currently claimable, and how much has been claimed.",
"summary": "GetSummarizedRewardsForEarner returns the summarized rewards for the given earner address, including:\n- total tokens earned\n- total tokens active (subset of earned that are in roots that have surpassed their activation delay)\n- total claimed\n- total claimable (total active - total claimed)",
"operationId": "Rewards_GetSummarizedRewardsForEarner",
"responses": {
"200": {
Expand Down Expand Up @@ -715,7 +783,7 @@
},
"/rewards/v1/earners/{earnerAddress}/total-claimed-rewards": {
"get": {
"summary": "GetTotalClaimedRewards returns the total claimed rewards for the given earner address\nBlockHeight is optional. If omitted, the latest block height is used.",
"summary": "GetTotalClaimedRewards returns the total claimed rewards for the given earner address, summed up to and including\nthe provided blockHeight. If a blockHeight is omitted, the most recent indexed block is used.",
"operationId": "Rewards_GetTotalClaimedRewards",
"responses": {
"200": {
Expand Down Expand Up @@ -1595,6 +1663,10 @@
},
"distributionRoot": {
"type": "string"
},
"blockNumber": {
"type": "string",
"format": "uint64"
}
}
},
Expand Down Expand Up @@ -1772,25 +1844,25 @@
}
}
},
"rewardsGetAvailableRewardsResponse": {
"rewardsGetAvailableRewardsTokensResponse": {
"type": "object",
"properties": {
"rewards": {
"tokens": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/rewardsReward"
"type": "string"
}
}
}
},
"rewardsGetAvailableRewardsTokensResponse": {
"rewardsGetClaimableRewardsResponse": {
"type": "object",
"properties": {
"tokens": {
"rewards": {
"type": "array",
"items": {
"type": "string"
"type": "object",
"$ref": "#/definitions/rewardsReward"
}
}
}
Expand Down Expand Up @@ -1846,7 +1918,19 @@
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/rewardsReward"
"$ref": "#/definitions/rewardsTotalClaimedReward"
}
}
}
},
"rewardsListClaimedRewardsByBlockRangeResponse": {
"type": "object",
"properties": {
"rewards": {
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/rewardsClaimedReward"
}
}
}
Expand Down Expand Up @@ -1932,13 +2016,17 @@
"type": "string",
"title": "Rewards that have been earned but not necessarily activated yet"
},
"claimable": {
"active": {
"type": "string",
"title": "total rewards that are claimable (does not account for claimed)"
},
"claimed": {
"type": "string",
"title": "total rewards that have been claimed"
},
"claimable": {
"type": "string",
"title": "rewards that can be claimed at the block height"
}
}
},
Expand All @@ -1953,6 +2041,20 @@
}
}
},
"rewardsTotalClaimedReward": {
"type": "object",
"properties": {
"earner": {
"type": "string"
},
"token": {
"type": "string"
},
"amount": {
"type": "string"
}
}
},
"rpcStatus": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit a6d8a11

Please sign in to comment.