{"id":19845413,"url":"https://github.com/unpackdev/sourcify-go","last_synced_at":"2025-05-01T21:30:32.815Z","repository":{"id":176689525,"uuid":"656221773","full_name":"unpackdev/sourcify-go","owner":"unpackdev","description":"A Golang client for the Sourcify API - aimed at facilitating smart contract verification, enhanced security, and simplifying interactions with the Sourcify infrastructure. Leverage the power of Sourcify using Go.","archived":false,"fork":false,"pushed_at":"2024-04-26T18:01:42.000Z","size":56,"stargazers_count":7,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-27T15:58:08.440Z","etag":null,"topics":["abi","binance-smart-chain","contract-validation","ethereum","go-ethereum","golang-package","solidity-contracts","sourcify","vyper-contracts"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unpackdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-20T13:52:05.000Z","updated_at":"2024-06-21T13:12:19.346Z","dependencies_parsed_at":null,"dependency_job_id":"c9da8552-2d25-466f-b297-9e4398f0df18","html_url":"https://github.com/unpackdev/sourcify-go","commit_stats":null,"previous_names":["txpull/sourcify-go","unpackdev/sourcify-go"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unpackdev%2Fsourcify-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unpackdev%2Fsourcify-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unpackdev%2Fsourcify-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unpackdev%2Fsourcify-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unpackdev","download_url":"https://codeload.github.com/unpackdev/sourcify-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224278481,"owners_count":17285080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abi","binance-smart-chain","contract-validation","ethereum","go-ethereum","golang-package","solidity-contracts","sourcify","vyper-contracts"],"created_at":"2024-11-12T13:07:39.004Z","updated_at":"2024-11-12T13:07:40.107Z","avatar_url":"https://github.com/unpackdev.png","language":"Go","readme":"\n[![Build Status](https://app.travis-ci.com/unpackdev/sourcify-go.svg?branch=main)](https://app.travis-ci.com/unpackdev/sourcify-go)\n[![Coverage Status](https://coveralls.io/repos/github/unpackdev/sourcify-go/badge.svg?branch=main)](https://coveralls.io/github/unpackdev/sourcify-go?branch=main)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/unpackdev/sourcify-go)](https://pkg.go.dev/github.com/unpackdev/sourcify-go)\n\n\n# Sourcify Go\n\nSourcify Go is a Golang package that provides tools for interacting with the [Sourcify API](https://docs.sourcify.dev/docs/api). \n\nIt allows you to access various API endpoints and perform operations such as checking server status, retrieving chains information, obtaining contract information from supported chains and more.\n\n## Installation\n\nTo use Sourcify in your Go project, you can simply import the package:\n\n```go\nimport \"github.com/unpackdev/sourcify-go\"\n```\n\n## Usage\n\n### Creating a Client\n\nTo interact with the Sourcify API, you need to create a client using the `NewClient` function. You can provide optional configuration options using `ClientOption` functions. For example, you can specify a custom base URL or a custom HTTP client, set retry configuration in case sourcify servers are temporairly unavailable and set rate limits in order to control the rate at which HTTP requests are sent to the sourcify servers.\n\n```go\nclient := sourcify.NewClient(\n\tsourcify.WithHTTPClient(httpClient),\n\tsourcify.WithBaseURL(\"https://sourcify.dev/server\"),\n\tsourcify.WithRetryOptions(\n\t\tsourcify.WithMaxRetries(3),\n\t\tsourcify.WithDelay(2*time.Second),\n\t),\n\tsourcify.WithRateLimit(10, 1*time.Second),\n)\n``` \n\n### Calling Raw API Endpoints\n\nSourcify provides various API endpoints as `Method` objects. You can call these endpoints using the `CallMethod` function on the client and do your own method parsers if you wish to. \n\nHowever, if there are methods that we do not provide yet, you can do something like this to extend\npackage.\n\n```go\ncustomMethod := sourcify.Method{...}\n\ncustomMethod.SetParams(\n\tMethodParam{Key: \":chain\", Value: chainId},\n)\n\nif err := customMethod.Verify(); err != nil {\n\treturn nil, err\n}\n\nresponse, statusCode, err := client.CallMethod(customMethod)\nif err != nil {\n\treturn nil, err\n}\n\n// Close the io.ReadCloser interface.\n// This is important as CallMethod is NOT closing the response body!\n// You'll have memory leaks if you don't do this!\ndefer response.Close()\n\n// Process the response\n```\n\n### Supported API Endpoints\n\nSourcify provides the following API endpoints that you can call that are currently supported by this package:\n\n- `MethodHealth`: Check the server status. [More information](https://docs.sourcify.dev/docs/api/server/check-server-status/)\n- `MethodGetChains`: Retrieve the chains (networks) added to Sourcify. [More information](https://docs.sourcify.dev/docs/api/server/retrieve-chains/)\n- `MethodCheckByAddresses`: Check if contracts with the desired chain and addresses are verified and in the repository. [More information](https://docs.sourcify.dev/docs/api/server/check-by-addresses/)\n- `MethodCheckAllByAddresses`: Check if contracts with the desired chain and addresses are verified and in the repository. [More information](https://docs.sourcify.dev/docs/api/server/check-all-by-addresses/)\n- `MethodGetFileTreeFullOrPartialMatch`: Get the file tree with full or partial match for the desired chain and address. [More information](https://docs.sourcify.dev/docs/api/server/get-file-tree-all/)\n- `MethodGetFileTreeFullMatch`: Get the file tree with full match for the desired chain and address. [More information](https://docs.sourcify.dev/docs/api/server/get-file-tree-full/)\n- `MethodSourceFilesFullOrPartialMatch`: Get the source files with full or partial match for the desired chain and address, including metadata.json. [More information](https://docs.sourcify.dev/docs/api/server/get-source-files-all/)\n- `MethodSourceFilesFullMatch`: Get the source files with full match for the desired chain and address, including metadata.json. [More information](https://docs.sourcify.dev/docs/api/server/get-source-files-full/)\n- `MethodGetContractAddressesFullOrPartialMatch`: Get the verified contract addresses for the chain with full or partial match. [More information](https://docs.sourcify.dev/docs/api/server/get-contract-addresses-all/)\n- `MethodGetFileFromRepositoryFullMatch`: Retrieve statically served files over the server for full match contract. [More information](https://docs.sourcify.dev/docs/api/repository/get-file-static/)\n- `MethodGetFileFromRepositoryPartialMatch`: Retrieve statically served files over the server for partial match contract. [More information](https://docs.sourcify.dev/docs/api/repository/get-file-static/)\n\nFor more information on each endpoint, including the parameters they require and the expected responses, refer to the [Sourcify API documentation](https://docs.sourcify.dev/docs/api).\n\n## Examples\n\nYou can find endpoint examples under the [examples](/examples) directory.\n\n## Contributing\n\nContributions to Sourcify are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on GitHub.\n\n\n## License\n\nSourcify is released under the Apache 2.0 License. See the [LICENSE](LICENSE) file for more details.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funpackdev%2Fsourcify-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funpackdev%2Fsourcify-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funpackdev%2Fsourcify-go/lists"}