Skip to content

Commit 7874f3e

Browse files
authored
Update to ethkit@v1.38.0 (#279)
* go get github.com/0xsequence/ethkit@v1.38.0 * Remove deprecated AuthChain field * testutil.NewTestChain(): require slog.Logger
1 parent 6c22c04 commit 7874f3e

File tree

10 files changed

+139
-98
lines changed

10 files changed

+139
-98
lines changed

deployer/deployer_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package deployer_test
22

33
import (
44
"context"
5+
"log/slog"
6+
"os"
57
"testing"
68

79
"github.com/0xsequence/go-sequence/contracts"
@@ -16,7 +18,9 @@ var (
1618

1719
func init() {
1820
var err error
19-
testChain, err = testutil.NewTestChain()
21+
logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
22+
23+
testChain, err = testutil.NewTestChain(logger)
2024
if err != nil {
2125
panic(err)
2226
}

go.mod

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,64 @@
11
module github.com/0xsequence/go-sequence
22

3-
go 1.23.0
3+
go 1.23.4
44

5-
toolchain go1.24.1
5+
toolchain go1.24.2
66

77
// replace github.com/0xsequence/ethkit => /Users/peter/Dev/0xsequence/ethkit
88

99
require (
10-
github.com/0xsequence/ethkit v1.30.7
10+
github.com/0xsequence/ethkit v1.38.0
1111
github.com/0xsequence/go-ethauth v0.14.0
1212
github.com/BurntSushi/toml v1.2.1
1313
github.com/davecgh/go-spew v1.1.1
1414
github.com/gibson042/canonicaljson-go v1.0.3
1515
github.com/goware/cachestore v0.9.0
1616
github.com/goware/logger v0.3.0
1717
github.com/shopspring/decimal v1.4.0
18-
github.com/stretchr/testify v1.9.0
18+
github.com/stretchr/testify v1.10.0
1919
go.uber.org/mock v0.5.0
2020
)
2121

2222
require (
23-
github.com/Microsoft/go-winio v0.6.2 // indirect
24-
github.com/bits-and-blooms/bitset v1.19.1 // indirect
23+
github.com/bits-and-blooms/bitset v1.22.0 // indirect
2524
github.com/btcsuite/btcd v0.24.2 // indirect
26-
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
25+
github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect
2726
github.com/btcsuite/btcd/btcutil v1.1.6 // indirect
2827
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
29-
github.com/cespare/xxhash/v2 v2.3.0 // indirect
30-
github.com/consensys/bavard v0.1.24 // indirect
31-
github.com/consensys/gnark-crypto v0.14.0 // indirect
32-
github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect
33-
github.com/deckarep/golang-set/v2 v2.7.0 // indirect
34-
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
35-
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
36-
github.com/ethereum/c-kzg-4844/bindings/go v0.0.0-20230126171313-363c7d7593b4 // indirect
28+
github.com/consensys/bavard v0.1.30 // indirect
29+
github.com/consensys/gnark-crypto v0.17.0 // indirect
30+
github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect
31+
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
32+
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
33+
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect
34+
github.com/elastic/go-freelru v0.16.0 // indirect
35+
github.com/ethereum/c-kzg-4844/v2 v2.1.1 // indirect
36+
github.com/ethereum/go-verkle v0.2.2 // indirect
37+
github.com/fsnotify/fsnotify v1.9.0 // indirect
3738
github.com/google/uuid v1.6.0 // indirect
3839
github.com/gorilla/websocket v1.5.3 // indirect
39-
github.com/goware/breaker v0.1.2 // indirect
40+
github.com/goware/breaker v0.2.0 // indirect
41+
github.com/goware/cachestore-mem v0.2.2 // indirect
42+
github.com/goware/cachestore2 v0.12.3 // indirect
4043
github.com/goware/calc v0.2.0 // indirect
41-
github.com/goware/channel v0.4.1 // indirect
42-
github.com/goware/singleflight v0.2.0 // indirect
44+
github.com/goware/channel v0.5.0 // indirect
45+
github.com/goware/singleflight v0.3.0 // indirect
4346
github.com/goware/superr v0.0.2 // indirect
4447
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
4548
github.com/holiman/uint256 v1.3.2 // indirect
49+
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
4650
github.com/mmcloughlin/addchain v0.4.0 // indirect
4751
github.com/pmezard/go-difflib v1.0.0 // indirect
48-
github.com/redis/go-redis/v9 v9.6.1 // indirect
4952
github.com/stretchr/objx v0.5.2 // indirect
50-
github.com/supranational/blst v0.3.13 // indirect
53+
github.com/supranational/blst v0.3.14 // indirect
5154
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
52-
golang.org/x/crypto v0.35.0 // indirect
55+
github.com/zeebo/xxh3 v1.0.2 // indirect
56+
golang.org/x/crypto v0.38.0 // indirect
5357
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
54-
golang.org/x/net v0.36.0 // indirect
55-
golang.org/x/sync v0.11.0 // indirect
56-
golang.org/x/sys v0.30.0 // indirect
57-
golang.org/x/text v0.22.0 // indirect
58+
golang.org/x/net v0.40.0 // indirect
59+
golang.org/x/sync v0.14.0 // indirect
60+
golang.org/x/sys v0.33.0 // indirect
61+
golang.org/x/text v0.25.0 // indirect
5862
gopkg.in/yaml.v3 v3.0.1 // indirect
5963
rsc.io/tmplfunc v0.0.3 // indirect
6064
)

go.sum

Lines changed: 62 additions & 52 deletions
Large diffs are not rendered by default.

go.work

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
go 1.23.0
1+
go 1.23.4
22

3-
toolchain go1.24.1
3+
toolchain go1.24.2
44

55
use (
66
.

go.work.sum

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ github.com/Masterminds/semver/v3 v3.3.1/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lpr
5656
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
5757
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
5858
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
59+
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
5960
github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78=
6061
github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
6162
github.com/ProtonMail/go-crypto v1.1.5/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
@@ -67,8 +68,14 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB
6768
github.com/bits-and-blooms/bitset v1.14.2/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
6869
github.com/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
6970
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
71+
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
72+
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
73+
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
74+
github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0=
7075
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
7176
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
77+
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
78+
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
7279
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
7380
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
7481
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
@@ -93,8 +100,8 @@ github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGL
93100
github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9rTHJQ=
94101
github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
95102
github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
96-
github.com/deckarep/golang-set/v2 v2.8.0 h1:swm0rlPCmdWn9mESxKOjWk8hXSqoxOp+ZlfuyaAdFlQ=
97-
github.com/deckarep/golang-set/v2 v2.8.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
103+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
104+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
98105
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=
99106
github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ=
100107
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -186,6 +193,7 @@ github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5m
186193
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
187194
github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k=
188195
github.com/goware/cachestore v0.8.1/go.mod h1:ikiO2RmxIt4cVqEBII6yR+V4Z7pH+y8bMQHpd1MvG1Y=
196+
github.com/goware/cachestore-redis v0.2.1/go.mod h1:+8rOAfL1qNLNiXHe8+WACPk+I9kaLOAfArj2Z7FDiWg=
189197
github.com/goware/pp v0.0.3/go.mod h1:shID9y83CUGdg/BfO0SrVhchPpIAcT3ArfLVkq3x7tQ=
190198
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
191199
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
@@ -221,6 +229,7 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
221229
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
222230
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
223231
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
232+
github.com/jedisct1/go-minisign v0.0.0-20241212093149-d2f9f49435c7/go.mod h1:BMxO138bOokdgt4UaxZiEfypcSHX0t6SIFimVP1oRfk=
224233
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
225234
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
226235
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
@@ -275,6 +284,8 @@ github.com/posener/gitfs v1.2.2 h1:BqkjTzqV5v/wTWt39Z4hmLPj9ZJyMgIMxXJj7Yy6TWY=
275284
github.com/posener/gitfs v1.2.2/go.mod h1:NESLm7QEkxEA65GGkItljj5rss2gSLdqp+A/0pWo2xI=
276285
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
277286
github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
287+
github.com/redis/go-redis/v9 v9.7.3 h1:YpPyAayJV+XErNsatSElgRZZVCwXX9QzkKYNvO7x0wM=
288+
github.com/redis/go-redis/v9 v9.7.3/go.mod h1:bGUrSggJ9X9GUmZpZNEOQKaANxSGgOEBRltRTZHSvrA=
278289
github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM=
279290
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
280291
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
@@ -321,6 +332,7 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
321332
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
322333
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
323334
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
335+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
324336
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
325337
github.com/webrpc/gen-dart v0.1.1 h1:PZh5oNNdA84Qxu8ixKDf1cT8Iv6t0g7x6q9aeX1bti4=
326338
github.com/webrpc/gen-dart v0.1.1/go.mod h1:yq0ThW3ANNulJLyR50jx1aZMEVBDp19VUHucK65ayPs=
@@ -549,6 +561,7 @@ golang.org/x/term v0.29.0 h1:L6pJp37ocefwRRtYPKSWOWzOtWSxVajvz2ldH/xi3iU=
549561
golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s=
550562
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
551563
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
564+
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
552565
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
553566
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
554567
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -625,6 +638,7 @@ golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE=
625638
golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg=
626639
golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU=
627640
golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ=
641+
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
628642
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
629643
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
630644
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=

network.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import (
1313
// WalletContext is the module addresses deployed on a network, aka the context / environment
1414
// of the Sequence Smart Wallet system on Ethereum.
1515
type WalletContext struct {
16-
FactoryAddress common.Address `json:"factory" toml:"factory_address"`
17-
MainModuleAddress common.Address `json:"mainModule" toml:"main_module_address"`
16+
FactoryAddress common.Address `json:"factory" toml:"factory_address"`
17+
MainModuleAddress common.Address `json:"mainModule" toml:"main_module_address"`
1818
MainModuleUpgradableAddress common.Address `json:"mainModuleUpgradable" toml:"main_module_upgradable_address"`
19-
GuestModuleAddress common.Address `json:"guestModule" toml:"guest_module_address"`
20-
UtilsAddress common.Address `json:"utils" toml:"utils_address"`
19+
GuestModuleAddress common.Address `json:"guestModule" toml:"guest_module_address"`
20+
UtilsAddress common.Address `json:"utils" toml:"utils_address"`
2121
}
2222

2323
// A map of a wallet context for each version
@@ -38,7 +38,6 @@ type NetworkConfig struct {
3838
// Indexer Indexer
3939

4040
IsDefaultChain bool
41-
IsAuthChain bool
4241

4342
SequenceAPIURL string
4443
}

networks/networks.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ type Network struct {
1313
Type NetworkType `toml:"type" json:"type,omitempty"`
1414
LogoURL string `toml:"logo_url" json:"logoUrl,omitempty"`
1515
ENSAddress string `toml:"ens_address" json:"ensAddress,omitempty"`
16-
AuthChain bool `toml:"auth_chain" json:"authChain,omitempty"`
1716
Deprecated bool `toml:"deprecated" json:"deprecated,omitempty"`
1817
Disabled bool `toml:"disabled" json:"disabled,omitempty"`
1918
WSEnabled bool `toml:"ws_enabled" json:"wsEnabled,omitempty"`
@@ -147,7 +146,6 @@ func (n Networks) EthProvidersConfig() ethproviders.Config {
147146
URL: network.NodeURL,
148147
WSEnabled: network.WSEnabled,
149148
WSURL: network.WSURL,
150-
AuthChain: network.AuthChain,
151149
Testnet: network.IsTesnet(),
152150
Disabled: network.Disabled,
153151
}

sequence_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package sequence_test
22

33
import (
4+
"log/slog"
5+
"os"
46
"testing"
57

68
"github.com/0xsequence/go-sequence/testutil"
@@ -13,7 +15,9 @@ var (
1315

1416
func init() {
1517
var err error
16-
testChain, err = testutil.NewTestChain()
18+
logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
19+
20+
testChain, err = testutil.NewTestChain(logger)
1721
if err != nil {
1822
panic(err)
1923
}

testutil/testutil.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"log"
7+
"log/slog"
78
"math/big"
89
"testing"
910
"time"
@@ -24,7 +25,6 @@ import (
2425
v2 "github.com/0xsequence/go-sequence/core/v2"
2526
"github.com/0xsequence/go-sequence/deployer"
2627
"github.com/0xsequence/go-sequence/relayer"
27-
"github.com/goware/logger"
2828
)
2929

3030
type TestChain struct {
@@ -51,7 +51,11 @@ var DefaultTestChainOptions = TestChainOptions{
5151
NodeURL: "http://localhost:8545",
5252
}
5353

54-
func NewTestChain(opts ...TestChainOptions) (*TestChain, error) {
54+
func NewTestChain(logger *slog.Logger, opts ...TestChainOptions) (*TestChain, error) {
55+
if logger == nil {
56+
return nil, fmt.Errorf("logger is required")
57+
}
58+
5559
var err error
5660
tc := &TestChain{}
5761

@@ -71,7 +75,7 @@ func NewTestChain(opts ...TestChainOptions) (*TestChain, error) {
7175
// monitor
7276
var monitor *ethmonitor.Monitor
7377
monitorOptions := ethmonitor.DefaultOptions
74-
// monitorOptions.Logger = logger.NewLogger(logger.LogLevel_INFO)
78+
monitorOptions.Logger = logger
7579
monitorOptions.StartBlockNumber = nil // track the head
7680
monitorOptions.PollingInterval = time.Duration(1000 * time.Millisecond) // default poll for new block once per second
7781
monitorOptions.BlockRetentionLimit = 400 // keep high number of blocks to query history
@@ -88,7 +92,7 @@ func NewTestChain(opts ...TestChainOptions) (*TestChain, error) {
8892
receiptsOptions.NumBlocksToFinality = 10
8993
receiptsOptions.FilterMaxWaitNumBlocks = 15
9094

91-
receipts, err := ethreceipts.NewReceiptsListener(logger.NewLogger(logger.LogLevel_INFO), tc.Provider, monitor, receiptsOptions)
95+
receipts, err := ethreceipts.NewReceiptsListener(logger, tc.Provider, monitor, receiptsOptions)
9296
if err != nil {
9397
return nil, err
9498
}

testutil/testutil_test.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package testutil_test
22

33
import (
4+
"log/slog"
45
"math/big"
56
"os"
67
"testing"
@@ -19,7 +20,9 @@ var (
1920

2021
func init() {
2122
var err error
22-
testChain, err = testutil.NewTestChain()
23+
logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
24+
25+
testChain, err = testutil.NewTestChain(logger)
2326
if err != nil {
2427
panic(err)
2528
}
@@ -82,13 +85,14 @@ func TestContractHelpers(t *testing.T) {
8285
}
8386

8487
func TestNewTestChainWithOptions(t *testing.T) {
85-
opt := testutil.DefaultTestChainOptions
88+
opts := testutil.DefaultTestChainOptions
8689
if nodeURL, ok := os.LookupEnv("CHAIN_NODE_URL"); ok {
87-
opt = testutil.TestChainOptions{
90+
opts = testutil.TestChainOptions{
8891
NodeURL: nodeURL,
8992
}
9093
}
91-
testChain, err := testutil.NewTestChain(opt)
94+
logger := slog.New(slog.NewTextHandler(os.Stderr, nil))
95+
testChain, err := testutil.NewTestChain(logger, opts)
9296
if err != nil {
9397
t.Fatal(err)
9498
}

0 commit comments

Comments
 (0)