status-go/protocol/requests/edit_shared_addresses.go
Jonathan Rainville 9674bc463f
feat(communities): add airdropAddress param to SharedAccounts (#3756)
Adds airdropAddress to the request to join params and a is_airdrop_address flag in the communities_requests_to_join_revealed_addresses table. 

This airdropAddress is used by the owner to know which address to use when airdropping
2023-07-14 13:33:47 -04:00

37 lines
984 B
Go

package requests
import (
"errors"
"github.com/status-im/status-go/eth-node/types"
)
var ErrInvalidCommunityID = errors.New("invalid community id")
var ErrMissingPassword = errors.New("password is necessary when sending a list of addresses")
var ErrMissingSharedAddresses = errors.New("list of shared addresses is needed")
var ErrMissingAirdropAddress = errors.New("airdropAddress is needed")
type EditSharedAddresses struct {
CommunityID types.HexBytes `json:"communityId"`
Password string `json:"password"`
AddressesToReveal []string `json:"addressesToReveal"`
AirdropAddress string `json:"airdropAddress"`
}
func (j *EditSharedAddresses) Validate() error {
if len(j.CommunityID) == 0 {
return ErrInvalidCommunityID
}
if j.Password == "" {
return ErrMissingPassword
}
if len(j.AddressesToReveal) == 0 {
return ErrMissingSharedAddresses
}
if j.AirdropAddress == "" {
return ErrMissingAirdropAddress
}
return nil
}