staking_service

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddDepositAddressRequest

type AddDepositAddressRequest struct {
	DepositAddresses []string `json:"deposit_addresses"`
}

type Assignment

type Assignment struct {
	UID            string `json:"uid"`
	ValidatorCount int    `json:"validatorCount"`
}

type BatchValidatorAssignmentParams

type BatchValidatorAssignmentParams struct {
	Assignments []Assignment `json:"assignments"`
	TxHashs     []string     `json:"tx_hashs"`
}

type CreateUserParams

type CreateUserParams struct {
	UID              string   `json:"uid"`
	DepositAddresses []string `json:"depositAddresses"`
}

type Deposit

type Deposit struct {
	ID              uint64 `json:"id"`
	BrokerID        uint64 `json:"brokerId"`
	FromAddress     string `json:"fromAddress"`
	ContractAddress string `json:"contractAddress"`
	TxHash          string `json:"txHash"`
	ChainName       string `json:"chainName"`
	BlockHeight     uint64 `json:"blockHeight"`
	Slot            uint64 `json:"slot"`
	BlockTime       uint64 `json:"blockTime"`
}

type DepositDataInfo

type DepositDataInfo struct {
	DepositDataRoot      string `json:"depositDataRoot"`
	Pubkey               string `json:"pubkey"`
	Signature            string `json:"signature"`
	WithdrawalCredential string `json:"withdrawalCredential"`
}

type DepositDataRequestParams

type DepositDataRequestParams struct {
	Uid               string `json:"uid"`
	Quantity          int64  `json:"quantity"`
	WithdrawalAddress string `json:"withdrawalAddress"`
}

type DepositDataResponse

type DepositDataResponse struct {
	Network  string            `json:"network"`
	Protocol string            `json:"protocol"`
	Period   string            `json:"period"`
	Ethereum *EthereumResponse `json:"ethereum"`
}

type DepositDetails

type DepositDetails struct {
	Deposit
	Validators ValidatorDetailList `json:"validators"`
}

type EthereumResponse

type EthereumResponse struct {
	ContractAddress     string             `json:"contractAddress"`
	EstimatedGas        uint64             `json:"estimatedGas"`
	UnsignedTransaction string             `json:"unsignedTransaction"`
	DepositData         []*DepositDataInfo `json:"depositData"`
}

type PageParams

type PageParams struct {
	PageNum  int `json:"pageNum" form:"pageNum"`
	PageSize int `json:"pageSize" form:"pageSize"`
}

type PageResult

type PageResult[T any] struct {
	PageNum  int   `json:"pageNum"`
	PageSize int   `json:"pageSize"`
	Total    int64 `json:"total"`
	List     []T   `json:"list"`
}

type PoolRewardInfo

type PoolRewardInfo struct {
	AvgYearApr       string `json:"avg_year_apr"`
	BeginSlot        int    `json:"begin_slot"`
	CumulativeReward string `json:"cumulative_reward"`
	DailyReward      string `json:"daily_reward"`
	Date             string `json:"date"`
	EndSlot          int    `json:"end_slot"`
}

type PoolRewardInfoList

type PoolRewardInfoList []PoolRewardInfo

type PooledStakingInfo

type PooledStakingInfo struct {
	Principal        string `json:"principal"`
	RealizedReward   string `json:"realized_reward"`
	UnrealizedReward string `json:"unrealized_reward"`
	Point            string `json:"point"`
	UserAddress      string `json:"user_address"`
}

type PooledStakingInfoList

type PooledStakingInfoList []PooledStakingInfo

type PooledWithdrawRequestInfo

type PooledWithdrawRequestInfo struct {
	RequestID      int    `json:"request_id"`
	User           string `json:"user"`
	Point          string `json:"point"`
	Amount         string `json:"amount"`
	Principal      string `json:"principal"`
	WithdrawTxhash string `json:"withdraw_txhash"`
	Description    string `json:"description"`
}

type Response

type Response[T any] struct {
	Code uint   `json:"code"`
	Msg  string `json:"msg"`
	Data T      `json:"data"`
}

type Reward

type Reward struct {
	Date              string `json:"date"`
	TotalCount        int64  `json:"totalCount"`
	ActiveCount       int64  `json:"activeCount"`
	ExitCount         int64  `json:"exitCount"`
	Balance           string `json:"balance"`
	Principal         string `json:"principal"`
	Apr               string `json:"apr"`
	CumulativeRewards string `json:"cumulativeRewards"`
	CumulativeStaking string `json:"cumulativeStaking"`
	CumulativeGasFee  string `json:"cumulativeGasFee"`
	Rewards           string `json:"rewards"`
	Staking           string `json:"staking"`
	GasFee            string `json:"gasFee"`
	Withdrawal        string `json:"withdrawal"`
	Rate              string `json:"rate"`
}

type RewardList

type RewardList []Reward

type SendTransactionRequestParams

type SendTransactionRequestParams struct {
	SignedTransaction string `json:"signedTransaction"`
}

type SendTransactionResponse

type SendTransactionResponse struct {
	TxHash string `json:"txHash"`
}

type StakingService

type StakingService struct {
	// contains filtered or unexported fields
}

func NewStakingService

func NewStakingService(baseURL, privateKey, address string) (*StakingService, error)

func (*StakingService) AddDepositAddress

func (stakingService *StakingService) AddDepositAddress(uid string, depositaddresses []string) (result *string, code uint, msg string, err error)

func (*StakingService) AnnuallyRewards

func (stakingService *StakingService) AnnuallyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error)

func (*StakingService) AssignDepositedValidators

func (stakingService *StakingService) AssignDepositedValidators(txHash string, validatorAssignmentParams ValidatorAssignmentParams) (result *[]UserValidators, code uint, msg string, err error)

func (*StakingService) BatchAssignDepositedValidators

func (stakingService *StakingService) BatchAssignDepositedValidators(batchValidatorAssignmentParams BatchValidatorAssignmentParams) (result *[]UserValidators, code uint, msg string, err error)

func (*StakingService) CreateUser

func (stakingService *StakingService) CreateUser(uid string, depositaddresses []string) (result *User, code uint, msg string, err error)

func (*StakingService) DailyRewards

func (stakingService *StakingService) DailyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error)

func (*StakingService) DeleteUser

func (stakingService *StakingService) DeleteUser(uid string) (result *string, code uint, msg string, err error)

func (*StakingService) DepositData

func (stakingService *StakingService) DepositData(depositDataRequestParams DepositDataRequestParams) (result *DepositDataResponse, code uint, msg string, err error)

func (*StakingService) GetDepositDetails

func (stakingService *StakingService) GetDepositDetails(txHash string) (result *DepositDetails, code uint, msg string, err error)

func (*StakingService) GetPoolRewards

func (stakingService *StakingService) GetPoolRewards(date *string, limit *uint) (result *PoolRewardInfoList, code uint, msg string, err error)

func (*StakingService) GetPooledStakingInfo

func (stakingService *StakingService) GetPooledStakingInfo() (result *PooledStakingInfoList, code uint, msg string, err error)

func (*StakingService) GetTransactionHistory

func (stakingService *StakingService) GetTransactionHistory(userAddress string, txType, pageNum, pageSize int64) (result *PageResult[TransactionList], code uint, msg string, err error)

func (*StakingService) GetUnusedKeys

func (stakingService *StakingService) GetUnusedKeys() (result *uint64, code uint, msg string, err error)

func (*StakingService) GetUserDetails

func (stakingService *StakingService) GetUserDetails(uid string) (result *UserDetails, code uint, msg string, err error)

func (*StakingService) GetUserPooledStakingInfo

func (stakingService *StakingService) GetUserPooledStakingInfo(address string) (result *UserPooledStakingInfo, code uint, msg string, err error)

func (*StakingService) GetUserWithdrawPossible

func (stakingService *StakingService) GetUserWithdrawPossible(userAddress string) (result *WithdrawPossibleBlock, code uint, msg string, err error)

func (*StakingService) GetWithdrawRequestInfo

func (stakingService *StakingService) GetWithdrawRequestInfo(requestID uint64) (result *PooledWithdrawRequestInfo, code uint, msg string, err error)

func (*StakingService) ListDeposits

func (stakingService *StakingService) ListDeposits(pageNum, pageSize uint) (result *PageResult[Deposit], code uint, msg string, err error)

func (*StakingService) ListUsers

func (stakingService *StakingService) ListUsers(pageNum, pageSize uint) (result *PageResult[User], code uint, msg string, err error)

func (*StakingService) ManualDepositBroker

func (stakingService *StakingService) ManualDepositBroker(txHash string) (result *string, code uint, msg string, err error)

func (*StakingService) ManualDepositBrokerUser

func (stakingService *StakingService) ManualDepositBrokerUser(txHash string) (result *string, code uint, msg string, err error)

func (*StakingService) MonthlyRewards

func (stakingService *StakingService) MonthlyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error)

func (*StakingService) QuarterlyRewards

func (stakingService *StakingService) QuarterlyRewards(uid string, startTime int64, endTime int64) (result *RewardList, code uint, msg string, err error)

func (*StakingService) SendTransaction

func (stakingService *StakingService) SendTransaction(sendTransactionRequestParams SendTransactionRequestParams) (result *SendTransactionResponse, code uint, msg string, err error)

func (*StakingService) ValidatorExit

func (stakingService *StakingService) ValidatorExit(pubkey string, validatorExitParam ValidatorExitParam) (result *ValidatorExitRes, code uint, msg string, err error)

func (*StakingService) ValidatorList

func (stakingService *StakingService) ValidatorList(validatorListRequestParam ValidatorListRequestParam) (result *PageResult[ValidatorDetail], code uint, msg string, err error)

type TransactionInfo

type TransactionInfo struct {
	Amount         float32 `json:"amount"`
	Type           uint64  `json:"type"`
	TxTime         uint64  `json:"txTime"`
	Status         string  `json:"status"`
	TxHash         string  `json:"txHash"`
	WithdrawalHash string  `json:"withdrawalHash"`
}

type TransactionList

type TransactionList []*TransactionInfo

type User

type User struct {
	ID       uint64 `json:"id"`
	BrokerID uint64 `json:"brokerID"`
	UID      string `json:"uid"`
}

type UserDetails

type UserDetails struct {
	User
	DepositAddresses []string            `json:"depositAddresses"`
	Validators       ValidatorDetailList `json:"validators"`
}

type UserPooledStakingInfo

type UserPooledStakingInfo struct {
	DepositedEth string `json:"deposited_eth"`
	TotalEth     string `json:"total_eth"`
}

type UserValidators

type UserValidators struct {
	UID        string        `json:"uid"`
	Validators ValidatorList `json:"validators"`
}

type Validator

type Validator struct {
	UID            string `json:"uid"`
	ValidatorIndex uint64 `json:"validatorIndex"`
	Pubkey         string `json:"pubkey"`
}

type ValidatorAssignmentParams

type ValidatorAssignmentParams struct {
	Assignments []Assignment `json:"assignments"`
}

type ValidatorDetail

type ValidatorDetail struct {
	Validator
	Balance        string `json:"balance"`
	TotalRewards   string `json:"totalRewards"`
	Status         string `json:"status"`
	ActivationTime string `json:"ActivationTime"`
	ExitTime       string `json:"exitTime"`
	Principal      string `json:"principal"`
}

type ValidatorDetailList

type ValidatorDetailList []ValidatorDetail

type ValidatorExitParam

type ValidatorExitParam struct {
	Epoch     uint64 `json:"epoch"`
	Broadcast uint64 `json:"broadcast"`
}

type ValidatorExitRes

type ValidatorExitRes struct {
	Signature string `json:"signature"`
}

type ValidatorList

type ValidatorList []Validator

type ValidatorListRequestParam

type ValidatorListRequestParam struct {
	Uid string `form:"uid"`
	PageParams
}

type WithdrawPossibleBlock

type WithdrawPossibleBlock struct {
	CanWithdrawBlock string `json:"can_withdraw_block"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL