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

etherscan

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package etherscan implements the client side of Tenderly's Etherscan-compatible contract verification API — the same protocol Foundry and hardhat-verify speak. Verification is synchronous: a verifysourcecode call returns the outcome directly.

Index

Constants

View Source
const CodeFormatStandardJSON = "solidity-standard-json-input"

CodeFormatStandardJSON submits the full solc standard-JSON input, so the server recompiles with exactly the submitted compiler settings.

Variables

This section is empty.

Functions

func BuildStandardJSONInput

func BuildStandardJSONInput(contracts []providers.Contract, config *payloads.Config) (string, error)

BuildStandardJSONInput assembles the compilation input from the provider build artifacts (all sources, including undeployed library/interface contracts) and the parsed compiler configuration.

Types

type Client

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

Client talks to a single verifier URL: either the dashboard API (.../etherscan/verify/network/{networkId}[/public]) or a Virtual TestNet ({rpc}/verify, where the RPC URL itself authenticates).

func NewClient

func NewClient(verifierURL, accessKey, token, userAgent string) *Client

func (*Client) VerifySourceCode

func (c *Client) VerifySourceCode(request *VerifyRequest) (*Response, error)

type Optimizer

type Optimizer struct {
	Enabled *bool                   `json:"enabled,omitempty"`
	Runs    *int                    `json:"runs,omitempty"`
	Details *payloads.ConfigDetails `json:"details,omitempty"`
}

type Response

type Response struct {
	Status  string `json:"status"`
	Message string `json:"message"`
	Result  string `json:"result"`
}

func (*Response) IsOK

func (r *Response) IsOK() bool

type Settings

type Settings struct {
	Remappings []string                 `json:"remappings,omitempty"`
	Optimizer  *Optimizer               `json:"optimizer,omitempty"`
	EvmVersion *string                  `json:"evmVersion,omitempty"`
	ViaIR      *bool                    `json:"viaIR,omitempty"`
	Metadata   *payloads.ConfigMetadata `json:"metadata,omitempty"`
}

type SourceContent

type SourceContent struct {
	Content string `json:"content"`
}

type StandardJSONInput

type StandardJSONInput struct {
	Language string                   `json:"language"`
	Sources  map[string]SourceContent `json:"sources"`
	Settings Settings                 `json:"settings"`
}

StandardJSONInput is the solc standard-JSON compilation input. The settings are passed through to solc verbatim server-side, so a verification compiles with exactly the submitted configuration.

type VerifyRequest

type VerifyRequest struct {
	// ContractAddress is the deployed address to verify.
	ContractAddress string
	// ContractName is fully qualified: "contracts/Foo.sol:Foo".
	ContractName string
	// CompilerVersion is an exact solc version, e.g. "0.8.20+commit.a1b79de6".
	CompilerVersion string
	// SourceCode is the marshaled solc standard-JSON input.
	SourceCode string
}

Jump to

Keyboard shortcuts

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