Skip to content

Commit

Permalink
fix: Rename RPC endpoint unstaked_frozen_deposits (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
huancheng-trili authored Jan 13, 2025
1 parent b1b65ee commit 93746c2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion rpc/staking.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ type FrozenDeposit struct {

// GetUnstakedFrozenDeposits returns a delegate's unstaked frozen deposits
func (c *Client) GetUnstakedFrozenDeposits(ctx context.Context, addr tezos.Address, id BlockID) ([]FrozenDeposit, error) {
u := fmt.Sprintf("chains/main/blocks/%s/context/delegates/%s/unstaked_frozen_deposits", id, addr)
p, err := c.GetParams(ctx, id)
if err != nil {
return nil, err
}
resource := "unstaked_frozen_deposits"
if p.Version >= 21 {
resource = "total_unstaked_per_cycle"
}

u := fmt.Sprintf("chains/main/blocks/%s/context/delegates/%s/%s", id, addr, resource)
list := make([]FrozenDeposit, 0, 7)
if err := c.Get(ctx, u, &list); err != nil {
return nil, err
Expand Down

0 comments on commit 93746c2

Please sign in to comment.