Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staker Event API V1 #283

Closed
wants to merge 11 commits into from
Closed

Staker Event API V1 #283

wants to merge 11 commits into from

Conversation

surbhit14
Copy link
Collaborator

@surbhit14 surbhit14 commented Nov 12, 2024

Staker Event API V1

Introduction

This API will cover the following 6 events

  • EventLogs_StakerDelegated
  • EventLogs_StakerUndelegated
  • EventLogs_OperatorSharesIncreased
  • EventLogs_OperatorSharesDecreased
  • EventLogs_Deposit
  • EventLogs_WithdrawalQueued

with event types

  • DELEGATION
  • UNDELEGATION
  • SHARES_INCREASED
  • SHARES_DECREASED
  • DEPOSIT
  • WITHDRAWAL_QUEUED
  • WITHDRAWAL_COMPLETED

divided into 3 endpoints as follows

API endpoints

  1. /stakers/[address]/events/delegation
    (This is similar to the operator event delegation endpoint except this one is for stakers)

Event Types

  • DELEGATION
  • UNDELEGATION
  • SHARES_INCREASED
  • SHARES_DECREASED

Response

{
  type: string // name of the event
  tx: string // transaction hash
  blockNumber: number // block number of the tx
  blockTime: Date // blocktime of the tx
  args: {
    operator: string
    strategy?: string
    shares?: number
  },
   underlyingToken?: string
   underlyingValue?: number
   ethValue?: number
}

Supported Filters

  • event type
  • transaction hash
  • start date for blockTime
  • end date for blockTime
  • operator address
  • strategy address (for shares increased, shares decreased)
  • withTokenData (when enabled, returns underlyingToken and underlyingValue)
  • withEthValue (when enabled, returns ethValue)
  1. /stakers/[address]/events/deposit

Event Type
DEPOSIT

Response

{
  type: string // name of the event
  tx: string // transaction hash
  blockNumber: number // block number of the tx
  blockTime: Date // blocktime of the tx
  args: {
    token: string
    strategy: string
    shares: number
  },
   underlyingToken?: string
   underlyingValue?: number
   ethValue?: number
}

Supported Filters

  • transaction hash
  • start date for blockTime
  • end date for blockTime
  • token address
  • strategy address
  • withTokenData (when enabled, returns underlyingToken and underlyingValue)
  • withEthValue (when enabled, returns ethValue)

3./stakers/[address]/events/withdrawal

Event Types
WITHDRAWAL_QUEUED
WITHDRAWAL_COMPLETED

Response

{
  type: string // name of the event
  tx: string // transaction hash
  blockNumber: number // block number of the tx
  blockTime: Date // blocktime of the tx
  args: {
    withdrawalRoot: string
    delegatedTo?: string
    withdrawer?: string
    nonce?: number
    startBlock?: number
    strategies?: [
	{
	    strategy: string
            shares: string
            underlyingToken?: string
            underlyingValue?: number
            ethValue?: number
	}	
    ]
  }
}

Supported Filters

  • type
  • transaction hash
  • withdrawalRoot
  • start date for blockTime
  • end date for blockTime
  • delegatedTo (for WITHDRAWAL_QUEUED)
  • withdrawer (for WITHDRAWAL_QUEUED)
  • withTokenData (for WITHDRAWAL_QUEUED)(when enabled, returns underlyingToken and underlyingValue)
  • withEthValue (for WITHDRAWAL_QUEUED)(when enabled, returns ethValue)

@surbhit14 surbhit14 linked an issue Nov 12, 2024 that may be closed by this pull request
@surbhit14 surbhit14 marked this pull request as draft November 12, 2024 12:33
@surbhit14 surbhit14 marked this pull request as ready for review November 25, 2024 18:36
@uditdc uditdc marked this pull request as draft December 3, 2024 05:13
@surbhit14 surbhit14 mentioned this pull request Dec 6, 2024
@surbhit14 surbhit14 closed this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] - Staker Event History
1 participant