abi

package
v1.57.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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)

View Source
var MethodSignatures = struct {
	Pools                string
	PoolIds              string
	IsPeerIdMemberOfPool string
	GetMemberPeerIds     string
	RemoveMemberPeerId   string
}{
	Pools:                "0xced08b2d",
	PoolIds:              "0x69883b4e",
	IsPeerIdMemberOfPool: "0xb098a605",
	GetMemberPeerIds:     "0x31db3ae8",
	RemoveMemberPeerId:   "0x12345678",
}

MethodSignatures contains the 4-byte method signatures

Functions

func DecodePoolIdResponse added in v1.55.16

func DecodePoolIdResponse(result string) (uint32, error)

DecodePoolIdResponse decodes the response from poolIds(uint256) call

func EncodeGetMemberPeerIdsCall

func EncodeGetMemberPeerIdsCall(poolID uint32, memberAddress string) string

EncodeGetMemberPeerIdsCall encodes the getMemberPeerIds(uint32,address) method call

func EncodeIsPeerIdMemberOfPoolCall

func EncodeIsPeerIdMemberOfPoolCall(poolID uint32, peerIDBytes32 string) string

EncodeIsPeerIdMemberOfPoolCall encodes the isPeerIdMemberOfPool(uint32,bytes32) method call

func EncodePoolIdsCall added in v1.55.16

func EncodePoolIdsCall(index uint32) string

EncodePoolIdsCall encodes the poolIds(uint256) method call for index-based pool discovery

func EncodePoolsCall

func EncodePoolsCall(poolID uint32) string

EncodePoolsCall encodes the pools(uint32) method call

func EncodeRemoveMemberPeerIdCall

func EncodeRemoveMemberPeerIdCall(poolID uint32, peerIDBytes32 string) string

EncodeRemoveMemberPeerIdCall encodes the removeMemberPeerId(uint32,bytes32) method call

func ParseContractError

func ParseContractError(data string) error

ParseContractError attempts to parse a contract error from the response

Types

type ContractError

type ContractError struct {
	Code    string
	Message string
}

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

func DecodePoolsResult(data string) (*Pool, error)

DecodePoolsResult decodes the result from pools(uint32) contract call

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL