mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 06:12:55 +00:00
9674bc463f
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
34 lines
1.1 KiB
Go
34 lines
1.1 KiB
Go
package requests
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
)
|
|
|
|
var ErrRequestToJoinCommunityInvalidCommunityID = errors.New("request-to-join-community: invalid community id")
|
|
var ErrRequestToJoinCommunityMissingPassword = errors.New("request-to-join-community: password is necessary when sending a list of addresses")
|
|
var ErrRequestToJoinNoAirdropAddress = errors.New("request-to-join-community: airdropAddress is necessary when sending a list of addresses")
|
|
|
|
type RequestToJoinCommunity struct {
|
|
CommunityID types.HexBytes `json:"communityId"`
|
|
ENSName string `json:"ensName"`
|
|
Password string `json:"password"`
|
|
AddressesToReveal []string `json:"addressesToReveal"`
|
|
AirdropAddress string `json:"airdropAddress"`
|
|
}
|
|
|
|
func (j *RequestToJoinCommunity) Validate() error {
|
|
if len(j.CommunityID) == 0 {
|
|
return ErrRequestToJoinCommunityInvalidCommunityID
|
|
}
|
|
if len(j.AddressesToReveal) > 0 && j.Password == "" {
|
|
return ErrRequestToJoinCommunityMissingPassword
|
|
}
|
|
if len(j.AddressesToReveal) > 0 && j.AirdropAddress == "" {
|
|
return ErrRequestToJoinNoAirdropAddress
|
|
}
|
|
|
|
return nil
|
|
}
|