Help us shape the future of Go! Take the 2026 Go Developer Survey

abi

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package abi provides helpers for working with contract ABIs beyond what generated bindings offer: address auto-discovery via the FWSS root of trust, generic event extraction from receipts, and PieceCID <-> contract struct conversions.

Index

Constants

View Source
const DefaultMaxMulticallCalls = 64

DefaultMaxMulticallCalls is the default maximum number of sub-calls sent in one aggregate3 invocation by SDK methods whose batch size depends on input.

Variables

View Source
var ErrEventNotFound = errors.New("event not found in receipt")

ErrEventNotFound is returned when the named event is not present in the receipt's logs.

Functions

func DecodePieceCID

func DecodePieceCID(raw pdpverifier.CidsCid) (cid.Cid, error)

DecodePieceCID parses a CidsCid back into a cid.Cid.

func DecodePieceCIDs

func DecodePieceCIDs(raw []pdpverifier.CidsCid) ([]cid.Cid, error)

DecodePieceCIDs batches DecodePieceCID over a slice. Returns the first decoding error encountered.

func EncodePieceCID

func EncodePieceCID(c cid.Cid) pdpverifier.CidsCid

EncodePieceCID converts a cid.Cid to the on-chain Cids.Cid struct shape (the bindings alias it as CidsCid). The stored bytes are the raw CID byte representation (cid.Bytes()).

func EncodePieceCIDs

func EncodePieceCIDs(cids []cid.Cid) []pdpverifier.CidsCid

EncodePieceCIDs batches EncodePieceCID over a slice.

func ExtractEvent

func ExtractEvent(receipt *types.Receipt, contractABI *ethabi.ABI, eventName string, emitter common.Address, dst any) error

ExtractEvent finds the first log in receipt matching the event named eventName in contractABI, emitted by the optional address filter (zero address = any emitter). Non-indexed fields are unpacked into dst, which must be a pointer to a compatible struct or slice as expected by go-ethereum's abi.UnpackIntoInterface. Indexed fields are not populated; use a typed bindings helper if you need indexed topic values.

Types

type Call3

type Call3 struct {
	Target       common.Address
	AllowFailure bool
	CallData     []byte
}

type ContractCaller

type ContractCaller interface {
	CallContract(ctx context.Context, call ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
}

ContractCaller is the RPC surface used by address and multicall helpers.

type ResolvedAddresses

type ResolvedAddresses struct {
	FWSS               common.Address
	PDPVerifier        common.Address
	SPRegistry         common.Address
	USDFC              common.Address
	Payments           common.Address
	ViewContract       common.Address
	FilBeamBeneficiary common.Address
	SessionKeyRegistry common.Address
}

ResolvedAddresses holds the set of contract addresses that FWSS points to, plus FWSS itself.

func ResolveAddresses

func ResolveAddresses(ctx context.Context, caller ContractCaller, fwssAddr common.Address) (*ResolvedAddresses, error)

ResolveAddresses reads address pointers directly from the FWSS contract. fwssAddr must be non-zero. Any RPC or decoding failure returns an error.

type Result3

type Result3 struct {
	Success    bool
	ReturnData []byte
}

func BatchCall

func BatchCall(ctx context.Context, caller ContractCaller, calls []Call3) ([]Result3, error)

func BatchCallChunked added in v0.5.0

func BatchCallChunked(ctx context.Context, caller ContractCaller, calls []Call3, maxCalls int) ([]Result3, error)

BatchCallChunked executes calls in serial aggregate3 batches of at most maxCalls entries and returns results in input order. It stops at the first context or batch error and does not retry a failed batch.

func BatchCallChunkedUntil added in v0.5.0

func BatchCallChunkedUntil(
	ctx context.Context,
	caller ContractCaller,
	calls []Call3,
	maxCalls int,
	stop func(start int, results []Result3) bool,
) ([]Result3, error)

BatchCallChunkedUntil is BatchCallChunked with a callback that can stop execution after a completed batch. The returned results include that batch.

Jump to

Keyboard shortcuts

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