Documentation
¶
Index ¶
- Variables
- func EncodeGetMemberPeerIdsCall(poolID uint32, memberAddress string) string
- func EncodeIsPeerIdMemberOfPoolCall(poolID uint32, peerIDBytes32 string) string
- func EncodePoolsCall(poolID uint32) string
- func EncodeRemoveMemberPeerIdCall(poolID uint32, peerIDBytes32 string) string
- func ParseContractError(data string) error
- type ContractError
- type GetMemberPeerIdsResult
- type IsMemberOfPoolResult
- type Pool
Constants ¶
This section is empty.
Variables ¶
var ContractErrorSignatures = map[string]ContractError{
"0x12345678": {Code: "PNF", Message: "PoolNotFound"},
"0x87654321": {Code: "AIP", Message: "AlreadyInPool"},
"0x11111111": {Code: "ARQ", Message: "AlreadyRequested"},
"0x22222222": {Code: "PNF2", Message: "PeerNotFound"},
"0x33333333": {Code: "CR", Message: "CapacityReached"},
"0x44444444": {Code: "UF", Message: "UserFlagged"},
"0x55555555": {Code: "NM", Message: "NotMember"},
"0x66666666": {Code: "AV", Message: "AlreadyVoted"},
"0x77777777": {Code: "NAR", Message: "NoActiveRequest"},
"0x88888888": {Code: "OCA", Message: "OnlyCreatorOrAdmin"},
"0x99999999": {Code: "PNE", Message: "PoolNotEmpty"},
"0xAAAAAAAA": {Code: "PRE", Message: "PendingRequestsExist"},
"0xBBBBBBBB": {Code: "ITA", Message: "InvalidTokenAmount"},
"0xCCCCCCCC": {Code: "IA", Message: "InsufficientAllowance"},
}
Contract error signatures (4-byte selectors)
var MethodSignatures = struct { Pools string IsPeerIdMemberOfPool string GetMemberPeerIds string RemoveMemberPeerId string }{ Pools: "0xced08b2d", IsPeerIdMemberOfPool: "0x95c5eb1a", GetMemberPeerIds: "0x31db3ae8", RemoveMemberPeerId: "0x12345678", }
MethodSignatures contains the 4-byte method signatures
Functions ¶
func EncodeGetMemberPeerIdsCall ¶
EncodeGetMemberPeerIdsCall encodes the getMemberPeerIds(uint32,address) method call
func EncodeIsPeerIdMemberOfPoolCall ¶
EncodeIsPeerIdMemberOfPoolCall encodes the isPeerIdMemberOfPool(uint32,bytes32) method call
func EncodePoolsCall ¶
EncodePoolsCall encodes the pools(uint32) method call
func EncodeRemoveMemberPeerIdCall ¶
EncodeRemoveMemberPeerIdCall encodes the removeMemberPeerId(uint32,bytes32) method call
func ParseContractError ¶
ParseContractError attempts to parse a contract error from the response
Types ¶
type ContractError ¶
ContractError represents a custom error from the contract
func (ContractError) Error ¶
func (e ContractError) Error() string
type GetMemberPeerIdsResult ¶
type GetMemberPeerIdsResult struct {
PeerIds []string `json:"peerIds"` // Array of bytes32 peer IDs
}
GetMemberPeerIdsResult represents the result of getMemberPeerIds call
func DecodeGetMemberPeerIdsResult ¶
func DecodeGetMemberPeerIdsResult(data string) (*GetMemberPeerIdsResult, error)
DecodeGetMemberPeerIdsResult decodes the result from getMemberPeerIds(uint32,address) contract call
type IsMemberOfPoolResult ¶
type IsMemberOfPoolResult struct {
IsMember bool `json:"isMember"`
MemberAddress string `json:"memberAddress"`
}
IsMemberOfPoolResult represents the result of isPeerIdMemberOfPool call
func DecodeIsMemberOfPoolResult ¶
func DecodeIsMemberOfPoolResult(data string) (*IsMemberOfPoolResult, error)
DecodeIsMemberOfPoolResult decodes the result from isPeerIdMemberOfPool(uint32,bytes32) contract call
type Pool ¶
type Pool struct {
Creator string `json:"creator"`
ID uint32 `json:"id"`
MaxChallengeResponsePeriod uint32 `json:"maxChallengeResponsePeriod"`
MemberCount uint32 `json:"memberCount"`
MaxMembers uint32 `json:"maxMembers"`
RequiredTokens *big.Int `json:"requiredTokens"`
MinPingTime *big.Int `json:"minPingTime"`
Name string `json:"name"`
Region string `json:"region"`
}
Pool represents the Pool struct from the contract
func DecodePoolsResult ¶
DecodePoolsResult decodes the result from pools(uint32) contract call