From 509522b6db0f836f5808b5eadab83beee4cae8b6 Mon Sep 17 00:00:00 2001 From: Nevio Vesic <0x19@users.noreply.github.com> Date: Fri, 26 Apr 2024 19:58:21 +0200 Subject: [PATCH] Changing namespace and cross tests (#11) --- .github/workflows/goveralls.yml | 2 +- README.md | 4 ++-- examples/chains.go | 3 +-- examples/check_addresses.go | 3 +-- examples/get_all_addresses.go | 3 +-- examples/get_files.go | 5 ++--- examples/get_metadata.go | 5 ++--- examples/get_source_code.go | 5 ++--- examples/health.go | 3 +-- go.mod | 11 ++++++----- go.sum | 14 ++++++++------ sourcify.go | 4 ++-- sourcify_test.go | 4 ++-- 13 files changed, 31 insertions(+), 35 deletions(-) diff --git a/.github/workflows/goveralls.yml b/.github/workflows/goveralls.yml index 672c4b3..604a292 100644 --- a/.github/workflows/goveralls.yml +++ b/.github/workflows/goveralls.yml @@ -7,7 +7,7 @@ jobs: fail-fast: false matrix: go: - - '1.19' + - '1.22' steps: - uses: actions/setup-go@v3 diff --git a/README.md b/README.md index f15b2e8..5b5eeb8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Build Status](https://app.travis-ci.com/txpull/sourcify-go.svg?branch=main)](https://app.travis-ci.com/txpull/sourcify-go) [![Coverage Status](https://coveralls.io/repos/github/txpull/sourcify-go/badge.svg?branch=main)](https://coveralls.io/github/txpull/sourcify-go?branch=main) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) -[![PkgGoDev](https://pkg.go.dev/badge/github.com/txpull/sourcify-go)](https://pkg.go.dev/github.com/txpull/sourcify-go) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/unpackdev/sourcify-go)](https://pkg.go.dev/github.com/unpackdev/sourcify-go) @@ -17,7 +17,7 @@ It allows you to access various API endpoints and perform operations such as che To use Sourcify in your Go project, you can simply import the package: ```go -import "github.com/txpull/sourcify-go" +import "github.com/unpackdev/sourcify-go" ``` ## Usage diff --git a/examples/chains.go b/examples/chains.go index 9ed373b..126bc7b 100644 --- a/examples/chains.go +++ b/examples/chains.go @@ -2,10 +2,9 @@ package examples import ( "fmt" + "github.com/unpackdev/sourcify-go" "net/http" "time" - - "github.com/txpull/sourcify-go" ) // Example_GetChains demonstrates how to retrieve chains using the Sourcify client. diff --git a/examples/check_addresses.go b/examples/check_addresses.go index b22d906..95e5461 100644 --- a/examples/check_addresses.go +++ b/examples/check_addresses.go @@ -2,10 +2,9 @@ package examples import ( "fmt" + "github.com/unpackdev/sourcify-go" "net/http" "time" - - "github.com/txpull/sourcify-go" ) // Example_CheckAddresses demonstrates how to check contract addresses using the Sourcify client. diff --git a/examples/get_all_addresses.go b/examples/get_all_addresses.go index 229e486..e8d3732 100644 --- a/examples/get_all_addresses.go +++ b/examples/get_all_addresses.go @@ -2,10 +2,9 @@ package examples import ( "fmt" + "github.com/unpackdev/sourcify-go" "net/http" "time" - - "github.com/txpull/sourcify-go" ) // Example_GetAllAddresses demonstrates how to retrieve all available contract addresses using the Sourcify client. diff --git a/examples/get_files.go b/examples/get_files.go index e2e0463..8b4c0d4 100644 --- a/examples/get_files.go +++ b/examples/get_files.go @@ -2,11 +2,10 @@ package examples import ( "fmt" + "github.com/ethereum/go-ethereum/common" + "github.com/unpackdev/sourcify-go" "net/http" "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/txpull/sourcify-go" ) // Example_GetFiles demonstrates how to retrieve source files for a contract using the Sourcify client. diff --git a/examples/get_metadata.go b/examples/get_metadata.go index 52e540f..94fe08a 100644 --- a/examples/get_metadata.go +++ b/examples/get_metadata.go @@ -2,11 +2,10 @@ package examples import ( "fmt" + "github.com/ethereum/go-ethereum/common" + "github.com/unpackdev/sourcify-go" "net/http" "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/txpull/sourcify-go" ) // Example_GetMetadata demonstrates how to retrieve full metadata for a contract using the Sourcify client. diff --git a/examples/get_source_code.go b/examples/get_source_code.go index 7e76a33..967be0e 100644 --- a/examples/get_source_code.go +++ b/examples/get_source_code.go @@ -2,11 +2,10 @@ package examples import ( "fmt" + "github.com/ethereum/go-ethereum/common" + "github.com/unpackdev/sourcify-go" "net/http" "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/txpull/sourcify-go" ) // Example_GetSourceCode demonstrates how to retrieve source code for a contract using the Sourcify client. diff --git a/examples/health.go b/examples/health.go index 49fef1b..89b95fb 100644 --- a/examples/health.go +++ b/examples/health.go @@ -2,10 +2,9 @@ package examples import ( "fmt" + "github.com/unpackdev/sourcify-go" "net/http" "time" - - "github.com/txpull/sourcify-go" ) // Example_GetHealth demonstrates how to check the health status of the Sourcify server using the Sourcify client. diff --git a/go.mod b/go.mod index eed3603..82abce9 100644 --- a/go.mod +++ b/go.mod @@ -1,16 +1,17 @@ -module github.com/txpull/sourcify-go +module github.com/unpackdev/sourcify-go -go 1.19 +go 1.22 require ( - github.com/ethereum/go-ethereum v1.12.1 + github.com/ethereum/go-ethereum v1.14.0 github.com/stretchr/testify v1.8.4 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect + github.com/holiman/uint256 v1.2.4 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - golang.org/x/crypto v0.17.0 // indirect - golang.org/x/sys v0.15.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/sys v0.19.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a2db628..6f8bac3 100644 --- a/go.sum +++ b/go.sum @@ -1,15 +1,17 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/ethereum/go-ethereum v1.12.1 h1:1kXDPxhLfyySuQYIfRxVBGYuaHdxNNxevA73vjIwsgk= -github.com/ethereum/go-ethereum v1.12.1/go.mod h1:zKetLweqBR8ZS+1O9iJWI8DvmmD2NzD19apjEWDCsnw= +github.com/ethereum/go-ethereum v1.14.0 h1:xRWC5NlB6g1x7vNy4HDBLuqVNbtLrc7v8S6+Uxim1LU= +github.com/ethereum/go-ethereum v1.14.0/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= -golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= -golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= -golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sourcify.go b/sourcify.go index c882248..abd28cf 100644 --- a/sourcify.go +++ b/sourcify.go @@ -29,6 +29,6 @@ // fmt.Println("Contract Metadata:", metadata) // // For more information on the Sourcify API and its endpoints, refer to the official documentation: -// - API Documentation: https://pkg.go.dev/github.com/txpull/sourcify-go -// - GitHub Repository: https://github.com/txpull/sourcify-go +// - API Documentation: https://pkg.go.dev/github.com/unpackdev/sourcify-go +// - GitHub Repository: https://github.com/unpackdev/sourcify-go package sourcify diff --git a/sourcify_test.go b/sourcify_test.go index 695d2c0..b1df772 100644 --- a/sourcify_test.go +++ b/sourcify_test.go @@ -59,7 +59,7 @@ func (suite *SourcifySuite) TestGetContractSourceCode() { assert := assert.New(suite.T()) assert.NoError(err, "Expected GetContractSourceCode to run without error") assert.NotNil(sourceCode, "source code should not be nil") - assert.Equal(len(sourceCode.Code), 2, "Expected source code to have 2 files") + assert.Equal(len(sourceCode.Code), 3, "Expected source code to have 3 files") } // TestGetChains tests the GetChains function. It asserts that no error is returned, the chains @@ -120,7 +120,7 @@ func (suite *SourcifySuite) TestGetContractFiles() { assert := assert.New(suite.T()) assert.NoError(err, "Expected GetContractSourceCode to run without error") assert.NotNil(tree, "tree code should not be nil") - assert.Equal(len(tree.Files), 2, "Expected tree to have 2 files") + assert.Equal(len(tree.Files), 3, "Expected tree to have 3 files") } // TestGetContractFiles tests the GetContractFiles function. It asserts that no error is returned,