sourcify

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SourcifyClient

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

SourcifyClient is a client for interacting with the Sourcify Server API, providing methods to fetch and parse contract data for supported Oasis runtimes.

func NewClient

func NewClient(serverUrl string, chain common.ChainName, logger *log.Logger) (*SourcifyClient, error)

NewClient returns a new Sourcify API client.

func (*SourcifyClient) GetContractSourceFiles

func (s *SourcifyClient) GetContractSourceFiles(ctx context.Context, runtime common.Runtime, address ethCommon.Address) ([]map[string]json.RawMessage, json.RawMessage, error)

GetContractSourceFiles returns the source files for the given contract address that is verified on sourcify. The first return argument are the source files returned in a list of maps, where each map contains the following keys: - "name": The name of the source file. - "content": The content of the source file. - "path": The path of the source file. For convenience the second return argument is the metadata.json file content as a raw JSON message.

See https://docs.sourcify.dev/docs/api/server/get-source-files-full/ for more details.

Note: This uses the free, public server API. If it turns out to be unreliable, we could use the repository API (vis IPFS proxy) instead, e.g.: - https://docs.sourcify.dev/docs/api/repository/get-file-repository/ - http://ipfs.default:8080/ipns/repo.sourcify.dev/contracts/full_match/23294/0x0a0b58b5e6d8f2c0f4c4b6e7a0c8f0b1b4b3b2b1/

func (*SourcifyClient) GetVerifiedContractAddresses

func (s *SourcifyClient) GetVerifiedContractAddresses(ctx context.Context, runtime common.Runtime) ([]ethCommon.Address, error)

GetVerifiedContractAddresses returns a list of all verified contract addresses for the given runtime.

API docs: https://docs.sourcify.dev/docs/api/server/get-contract-addresses-all/

Note: This uses the free, public server API. If it turns out to be unreliable, we could use the repository API (vis IPFS proxy) instead, e.g.: http://ipfs.default:8080/ipns/repo.sourcify.dev/contracts/full_match/23294

Jump to

Keyboard shortcuts

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