mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
1418d40a63
`AddressDetails` is added, basically it is the same as `GetAddressDetails`, but does the check for address activity (if has balance) across all chains if the chainIDs list is empty. Setting `timeoutInMilliseconds` param ensures that in case of network congestion or no internet `AddressDetails` will return the response setting `hasActivity` property to `false`.
24 lines
474 B
Go
24 lines
474 B
Go
package requests
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
)
|
|
|
|
var ErrAddresInvalid = errors.New("address-details: invalid address")
|
|
|
|
type AddressDetails struct {
|
|
Address string `json:"address"`
|
|
ChainIDs []uint64 `json:"chainIds"`
|
|
TimeoutInMilliseconds int64 `json:"timeoutInMilliseconds"`
|
|
}
|
|
|
|
func (a *AddressDetails) Validate() error {
|
|
if !common.IsHexAddress(a.Address) {
|
|
return ErrAddresInvalid
|
|
}
|
|
|
|
return nil
|
|
}
|