2021-09-25 01:30:22 +00:00
|
|
|
package heliumapi
|
|
|
|
|
2021-10-12 13:19:58 +00:00
|
|
|
const (
|
|
|
|
// WORKAROUND: for some reason, helium api partially breaks when given the timezone information
|
|
|
|
// in "max_time" and "min_time", even if the example code suggest that it supports it.
|
|
|
|
// For this reason, we cannot use time.RFC3339 as the time format.
|
|
|
|
timeFormat = "2006-01-02T15:04:05Z"
|
|
|
|
)
|
|
|
|
|
2021-09-26 03:38:16 +00:00
|
|
|
type AccountResp struct {
|
|
|
|
Data Account `json:"data"`
|
|
|
|
}
|
|
|
|
|
2021-10-07 14:24:46 +00:00
|
|
|
type AccountHotspotsResp struct {
|
|
|
|
Data []Hotspot `json:"data"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ActivityCounts map[string]int
|
|
|
|
type ActivityCountsResp struct {
|
|
|
|
Data ActivityCounts
|
|
|
|
}
|
|
|
|
|
|
|
|
type RewardTotalResp struct {
|
|
|
|
Meta struct {
|
|
|
|
MinTime string `json:"min_time"`
|
|
|
|
MaxTime string `json:"max_time"`
|
|
|
|
} `json:"meta"`
|
|
|
|
|
|
|
|
Data RewardTotal `json:"data"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type CurrentOraclePriceResp struct {
|
|
|
|
Data CurrentOraclePrice `json:"data"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type BlockchainStatsResp struct {
|
|
|
|
Data BlockchainStats `json:"data"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type WitnessesResp struct {
|
|
|
|
Data []Hotspot `json:"data"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type HeightResp struct {
|
|
|
|
Data struct {
|
|
|
|
Height int `json:"height"`
|
|
|
|
} `json:"data"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type WitnessedResp struct {
|
|
|
|
Data []Hotspot `json:"data"`
|
|
|
|
}
|
|
|
|
|
2021-09-25 01:30:22 +00:00
|
|
|
type Account struct {
|
2021-09-26 03:38:16 +00:00
|
|
|
Address string `json:"address"`
|
|
|
|
Balance int `json:"balance"`
|
|
|
|
Block int `json:"block"`
|
|
|
|
DCBalance int `json:"dc_balance"`
|
|
|
|
DCNonce int `json:"dc_nonce"`
|
|
|
|
SECBalance int `json:"sec_balance"`
|
|
|
|
SECNonce int `json:"sec_nonce"`
|
|
|
|
SpeculativeNonce int `json:"speculative_nonce"`
|
|
|
|
}
|
|
|
|
|
2021-10-07 14:24:46 +00:00
|
|
|
type Hotspot struct {
|
2021-09-26 03:38:16 +00:00
|
|
|
Lng float64 `json:"lng"`
|
|
|
|
Lat float64 `json:"lat"`
|
|
|
|
TimestampAdded string `json:"timestamp_added"`
|
|
|
|
Status struct {
|
|
|
|
Timestamp string `json:"timestamp"`
|
|
|
|
Online string `json:"online"`
|
|
|
|
ListenAddrs []string `json:"listen_addrs"`
|
|
|
|
Height int `json:"height"`
|
|
|
|
} `json:"status"`
|
|
|
|
RewardScale float64 `json:"reward_scale"`
|
|
|
|
Payer string `json:"payer"`
|
|
|
|
Owner string `json:"owner"`
|
|
|
|
Nonce int `json:"nonce"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Mode string `json:"mode"`
|
|
|
|
LocationHex string `json:"location_hex"`
|
|
|
|
Location string `json:"location"`
|
|
|
|
LastPocChallenge int `json:"last_poc_challenge"`
|
|
|
|
LastChangeBlock int `json:"last_change_block"`
|
|
|
|
Geocode struct {
|
|
|
|
ShortStreet string `json:"short_street"`
|
|
|
|
ShortState string `json:"short_state"`
|
|
|
|
ShortCountry string `json:"short_country"`
|
|
|
|
ShortCity string `json:"short_city"`
|
|
|
|
LongStreet string `json:"long_street"`
|
|
|
|
LongState string `json:"long_state"`
|
|
|
|
LongCountry string `json:"long_country"`
|
|
|
|
LongCity string `json:"long_city"`
|
|
|
|
CityID string `json:"city_id"`
|
|
|
|
} `json:"geocode"`
|
|
|
|
Gain int `json:"gain"`
|
|
|
|
Elevation int `json:"elevation"`
|
|
|
|
BlockAdded int `json:"block_added"`
|
|
|
|
Block int `json:"block"`
|
|
|
|
Address string `json:"address"`
|
2021-09-25 01:30:22 +00:00
|
|
|
}
|
|
|
|
|
2021-09-26 03:38:16 +00:00
|
|
|
type RewardTotal struct {
|
|
|
|
Total float64 `json:"total"`
|
|
|
|
Sum float64 `json:"sum"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
Min float64 `json:"min"`
|
|
|
|
Median float64 `json:"median"`
|
|
|
|
Max float64 `json:"max"`
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
}
|
|
|
|
|
2021-09-25 01:30:22 +00:00
|
|
|
type CurrentOraclePrice struct {
|
2021-09-26 03:38:16 +00:00
|
|
|
Price int `json:"price"`
|
|
|
|
Block int `json:"block"`
|
|
|
|
}
|
|
|
|
|
2021-09-25 01:30:22 +00:00
|
|
|
type BlockchainStats struct {
|
2021-09-26 03:38:16 +00:00
|
|
|
BlockTime struct {
|
|
|
|
LastDay struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_day"`
|
|
|
|
LastHour struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_hour"`
|
|
|
|
LastMonth struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_month"`
|
|
|
|
LastWeek struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_week"`
|
|
|
|
} `json:"block_times"`
|
|
|
|
ChallengeCount struct {
|
|
|
|
Active int `json:"active"`
|
|
|
|
LastDay int `json:"last_day"`
|
|
|
|
} `json:"challenge_counts"`
|
|
|
|
Counts struct {
|
|
|
|
Validators int `json:"validators"`
|
|
|
|
Ouis int `json:"ouis"`
|
|
|
|
HotspotsDataonly int `json:"hotspots_dataonly"`
|
|
|
|
Blocks int `json:"blocks"`
|
|
|
|
Challenges int `json:"challenges"`
|
|
|
|
Cities int `json:"cities"`
|
|
|
|
ConsensusGroups int `json:"consensus_groups"`
|
|
|
|
Countries int `json:"countries"`
|
|
|
|
Hotspots int `json:"hotspots"`
|
|
|
|
Transactions int `json:"transactions"`
|
|
|
|
} `json:"counts"`
|
|
|
|
ElectionTimes struct {
|
|
|
|
LastDay struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_day"`
|
|
|
|
LastHour struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_hour"`
|
|
|
|
LastMonth struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_month"`
|
|
|
|
LastWeek struct {
|
|
|
|
Avg float64 `json:"avg"`
|
|
|
|
Stddev float64 `json:"stddev"`
|
|
|
|
} `json:"last_week"`
|
|
|
|
} `json:"election_times"`
|
|
|
|
TokenSupply float64 `json:"token_supply"`
|
2021-09-25 01:30:22 +00:00
|
|
|
}
|