Skip to content

Commit

Permalink
add GetStakableBlobbers
Browse files Browse the repository at this point in the history
  • Loading branch information
devyetii committed Jun 13, 2024
1 parent bffaa2c commit be40732
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions zcncore/wallet_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,17 +1160,27 @@ func GetStakePoolUserInfo(clientID string, offset, limit int, cb GetInfoCallback
return
}

// GetStakeableBlobbers obtains list of all active blobbers that can be staked (i.e. still number of delegations < max_delegations)
// # Inputs
// - cb: callback for checking result
// - limit: how many blobbers should be fetched
// - offset: how many blobbers should be skipped
// - active: only fetch active blobbers
func GetStakableBlobbers(cb GetInfoCallback, limit, offset int, active bool) {
getBlobbersInternal(cb, active, limit, offset, true)
}

// GetBlobbers obtains list of all active blobbers.
// # Inputs
// - cb: callback for checking result
// - limit: how many blobbers should be fetched
// - offset: how many blobbers should be skipped
// - active: only fetch active blobbers
func GetBlobbers(cb GetInfoCallback, limit, offset int, active bool) {
getBlobbersInternal(cb, active, limit, offset)
getBlobbersInternal(cb, active, limit, offset, false)
}

func getBlobbersInternal(cb GetInfoCallback, active bool, limit, offset int) {
func getBlobbersInternal(cb GetInfoCallback, active bool, limit, offset int, stakable bool) {
if err := CheckConfig(); err != nil {
return
}
Expand All @@ -1179,6 +1189,7 @@ func getBlobbersInternal(cb GetInfoCallback, active bool, limit, offset int) {
"active": strconv.FormatBool(active),
"offset": strconv.FormatInt(int64(offset), 10),
"limit": strconv.FormatInt(int64(limit), 10),
"stakable": strconv.FormatBool(stakable),
})

go GetInfoFromSharders(url, OpStorageSCGetBlobbers, cb)
Expand Down

0 comments on commit be40732

Please sign in to comment.