Documentation ¶
Index ¶
- type SourceFile
- type SourcifyClient
- func (s *SourcifyClient) GetAllAddressPages(ctx context.Context, u *url.URL) ([]ethCommon.Address, error)
- func (s *SourcifyClient) GetContractSourceFiles(ctx context.Context, runtime common.Runtime, address ethCommon.Address) ([]SourceFile, json.RawMessage, error)
- func (s *SourcifyClient) GetVerifiedContractAddresses(ctx context.Context, runtime common.Runtime) (map[ethCommon.Address]VerificationLevel, error)
- type SourcifyPagination
- type VerificationLevel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SourceFile ¶ added in v0.2.10
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) GetAllAddressPages ¶ added in v0.4.1
func (*SourcifyClient) GetContractSourceFiles ¶
func (s *SourcifyClient) GetContractSourceFiles(ctx context.Context, runtime common.Runtime, address ethCommon.Address) ([]SourceFile, 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://sourcify.dev/server/api-docs/#/Repository/get_files_any__chain___address_ 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) (map[ethCommon.Address]VerificationLevel, error)
GetVerifiedContractAddresses returns a list of all verified contract addresses for the given runtime.
API docs: https://sourcify.dev/server/api-docs/#/Repository/get_files_contracts__chain_
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
type SourcifyPagination ¶ added in v0.4.1
type SourcifyPagination struct { CurrentPage uint64 `json:"currentPage"` TotalPages uint64 `json:"totalPages"` ResultsPerPage uint64 `json:"resultsPerPage"` ResultsCurrentPage uint64 `json:"resultsCurrentPage"` TotalResults uint64 `json:"totalResults"` HasNextPage bool `json:"hasNextPage"` HasPreviousPage bool `json:"hasPreviousPage"` }
type VerificationLevel ¶ added in v0.2.10
type VerificationLevel string
Level of contract verification, as defined by Sourcify. Keep values in sync with the `sourcify_level` postgres ENUM.
const ( VerificationLevelPartial VerificationLevel = "partial" VerificationLevelFull VerificationLevel = "full" )