forge

package
v1.19.6 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StandardVersion string

StandardVersion is the Foundry version that op-deployer will download if it's not found on PATH.

Functions

func ConvertAnonStructToTyped

func ConvertAnonStructToTyped[T any](anonStruct any) (result T, err error)

ConvertAnonStructToTyped converts anonStruct to T and returns conversion failures as errors. The source and target must be structs with equal field counts at every corresponding struct.

func GoStructToABITuple

func GoStructToABITuple(structType reflect.Type, tupleName string) (abi.Type, error)

func GoTypeToABIType

func GoTypeToABIType(goType reflect.Type) (string, error)

Types

type Bin

type Bin struct {
	// contains filtered or unexported fields
}

func (*Bin) Ensure

func (b *Bin) Ensure(ctx context.Context) error

func (*Bin) Path

func (b *Bin) Path() string

type Binary

type Binary interface {
	Ensure(ctx context.Context) error
	Path() string
}

func PathBinary

func PathBinary() Binary

func StaticBinary

func StaticBinary(path string) Binary

type BytesScriptDecoder

type BytesScriptDecoder[T any] struct {
	TypeName string // e.g., "DeploySuperchainOutput"
}

func (*BytesScriptDecoder[T]) Decode

func (d *BytesScriptDecoder[T]) Decode(rawOutput []byte) (T, error)

type BytesScriptEncoder

type BytesScriptEncoder[T any] struct {
	TypeName string // e.g., "DeploySuperchainInput"
}

func (*BytesScriptEncoder[T]) Encode

func (e *BytesScriptEncoder[T]) Encode(input T) ([]byte, error)

type Client

type Client struct {
	Binary Binary
	Stdout io.Writer
	Stderr io.Writer
	Wd     string
	// Timeout bounds each forge invocation. Zero means no limit.
	Timeout time.Duration
	// SlowBroadcast adds --slow to broadcast script runs, sending transactions
	// sequentially so forge never waits on a receipt for a transaction that
	// raced an in-flight one out of the node's pool.
	SlowBroadcast bool
}

func NewClient

func NewClient(binary Binary) *Client

func NewStandardClient

func NewStandardClient(workdir string) (*Client, error)

func (*Client) Build

func (c *Client) Build(ctx context.Context, opts ...string) error

func (*Client) Clean

func (c *Client) Clean(ctx context.Context, opts ...string) error

func (*Client) RunScript

func (c *Client) RunScript(ctx context.Context, script string, sig string, args []byte, opts ...string) (string, error)

func (*Client) VerifyContract

func (c *Client) VerifyContract(ctx context.Context, opts ...string) (string, error)

func (*Client) Version

func (c *Client) Version(ctx context.Context) (VersionInfo, error)

type PathBin

type PathBin struct {
	// contains filtered or unexported fields
}

func (*PathBin) Ensure

func (b *PathBin) Ensure(ctx context.Context) error

func (*PathBin) Path

func (b *PathBin) Path() string

type ScriptCallDecoder

type ScriptCallDecoder[O any] interface {
	Decode(raw []byte) (O, error)
}

type ScriptCallEncoder

type ScriptCallEncoder[I any] interface {
	Encode(I) ([]byte, error)
}

type ScriptCaller

type ScriptCaller[I any, O any] func(ctx context.Context, input I, opts ...string) (O, bool, error)

ScriptCaller is a function that calls a forge script Ouputs: - Return value of the script (decoded into go type) - Bool indicating if the script was recompiled (mostly used for testing) - Error if the script fails to run

func NewScriptCaller

func NewScriptCaller[I any, O any](client *Client, script string, sig string, encoder ScriptCallEncoder[I], decoder ScriptCallDecoder[O]) ScriptCaller[I, O]

type StandardBin

type StandardBin struct {
	// contains filtered or unexported fields
}

StandardBin forces the use of the standard forge binary version by first checking for the version locally, then downloading from github if needed

func NewStandardBinary

func NewStandardBinary(opts ...StandardBinOpt) (*StandardBin, error)

func (*StandardBin) Ensure

func (b *StandardBin) Ensure(ctx context.Context) error

func (*StandardBin) Path

func (b *StandardBin) Path() string

type StandardBinOpt

type StandardBinOpt func(s *StandardBin)

func WithCachePather

func WithCachePather(pather func() (string, error)) StandardBinOpt

func WithChecksummer

func WithChecksummer(checksummer func(r io.Reader) error) StandardBinOpt

func WithProgressor

func WithProgressor(p ioutil.Progressor) StandardBinOpt

func WithURL

func WithURL(url string) StandardBinOpt

type VersionConfig

type VersionConfig struct {
	Forge     string            `json:"forge"`
	Checksums map[string]string `json:"checksums"`
}

type VersionInfo

type VersionInfo struct {
	Semver string
	SHA    string
}

Jump to

Keyboard shortcuts

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