Skip to content

Commit 96dc9bd

Browse files
committed
feat!: a new token list approach - wallet sdk token lists integration
1 parent 44f94ad commit 96dc9bd

File tree

85 files changed

+6609
-33298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+6609
-33298
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,6 @@ pkg/sentry/SENTRY_PRODUCTION
131131
# Don't ignore generated files in the vendor/ directory
132132
!vendor/**/*.pb.go
133133
!vendor/**/migrations.go
134+
services/wallet/token/local-token-lists/default-lists/status.go
135+
services/wallet/token/local-token-lists/default-lists/coingecko_*.go
136+
services/wallet/token/local-token-lists/default-lists/uniswap.go

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ status-go-deps:
179179

180180

181181

182-
statusgo-library: generate
182+
statusgo-library: generate download-tokens
183183
statusgo-library: $(LIBWAKU) ##@cross-compile Build status-go as static library for current platform
184184
## cmd/library/README.md explains the magic incantation behind this
185185
mkdir -p build/bin/statusgo-lib
@@ -196,7 +196,7 @@ statusgo-library: $(LIBWAKU) ##@cross-compile Build status-go as static library
196196

197197
build-libwaku: $(LIBWAKU)
198198

199-
statusgo-shared-library: generate
199+
statusgo-shared-library: generate download-tokens
200200
statusgo-shared-library: $(LIBWAKU) ##@cross-compile Build status-go as shared library for current platform
201201
## cmd/library/README.md explains the magic incantation behind this
202202
mkdir -p build/bin/statusgo-lib
@@ -252,9 +252,10 @@ generate: ##@ Run generate for all given packages using go-generate-fast, fallb
252252
generate-contracts:
253253
go generate ./contracts
254254
download-tokens:
255-
go run ./services/wallet/token/token-lists/default-lists/downloader/main.go
255+
@echo "Downloading token lists..."
256+
go run ./services/wallet/token/local-token-lists/default-lists/downloader/main.go
256257
analyze-token-stores:
257-
go run ./services/wallet/token/token-lists/analyzer/main.go
258+
go run ./services/wallet/token/local-token-lists/analyzer/main.go
258259

259260
prepare-release: clean-release
260261
mkdir -p $(RELEASE_DIR)

contracts/hop/address.go

Lines changed: 235 additions & 218 deletions
Large diffs are not rendered by default.

contracts/snt/address.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ import (
99
var errorNotAvailableOnChainID = errors.New("not available for chainID")
1010

1111
var contractAddressByChainID = map[uint64]common.Address{
12-
1: common.HexToAddress("0x744d70fdbe2ba4cf95131626614a1763df805b9e"), // mainnet
13-
11155111: common.HexToAddress("0xE452027cdEF746c7Cd3DB31CB700428b16cD8E51"), // sepolia
12+
1: common.HexToAddress("0x744d70fdbe2ba4cf95131626614a1763df805b9e"), // mainnet
13+
10: common.HexToAddress("0x650af3c15af43dcb218406d30784416d64cfb6b2"), // optimism
14+
8453: common.HexToAddress("0x662015ec830df08c0fc45896fab726542e8ac09e"), // base
15+
42161: common.HexToAddress("0x707f635951193ddafbb40971a0fcaab8a6415160"), // arbitrum
16+
11155111: common.HexToAddress("0xE452027cdEF746c7Cd3DB31CB700428b16cD8E51"), // sepolia
17+
84532: common.HexToAddress("0xfdb3b57944943a7724fcc0520ee2b10659969a06"), // base testnet
18+
1660990954: common.HexToAddress("0x1c3ac2a186c6149ae7cb4d716ebbd0766e4f898a"), // status testnet
1419
}
1520

1621
func ContractAddress(chainID uint64) (common.Address, error) {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ require (
9191
github.com/prometheus/client_model v0.6.1
9292
github.com/schollz/peerdiscovery v1.7.0
9393
github.com/status-im/extkeys v1.3.0
94-
github.com/status-im/go-wallet-sdk v0.0.0-20250912130226-d334ec9bff18
94+
github.com/status-im/go-wallet-sdk v0.0.0-20250915173310-79b8fc965dd9
9595
github.com/waku-org/go-waku v0.8.1-0.20250825172353-0c3d6dc0a8cc
9696
github.com/waku-org/waku-go-bindings v0.0.0-20250714110306-6feba5b0df4d
9797
github.com/wk8/go-ordered-map/v2 v2.1.7

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2059,8 +2059,8 @@ github.com/status-im/go-ethereum v1.10.25-status.24 h1:TOLSwMHbJ1KeLAPljVP7o8jmg
20592059
github.com/status-im/go-ethereum v1.10.25-status.24/go.mod h1:kcIyUwKuTYxEXYRTVkvHtV6EyESKuI5EubF3et9cyR8=
20602060
github.com/status-im/go-sqlcipher/v4 v4.5.4-status.3 h1:/73h1w1hUfb3wVyTlNrUIwahZxatgesCHa6lwO57C2M=
20612061
github.com/status-im/go-sqlcipher/v4 v4.5.4-status.3/go.mod h1:mF2UmIpBnzFeBdu/ypTDb/LdbS0nk0dfSN1WUsWTjMA=
2062-
github.com/status-im/go-wallet-sdk v0.0.0-20250912130226-d334ec9bff18 h1:yBufceOQkh+LkOgMlkQUkvaJPlrjsH0S+m/0nl9as9U=
2063-
github.com/status-im/go-wallet-sdk v0.0.0-20250912130226-d334ec9bff18/go.mod h1:mFt4aWzn/gR/IOWL75oEowJNQaBvpe3DxYQo0woAdCE=
2062+
github.com/status-im/go-wallet-sdk v0.0.0-20250915173310-79b8fc965dd9 h1:jRacPB2GowJM13xTEvo+UEdh629mP80o0YH4XF6uH3c=
2063+
github.com/status-im/go-wallet-sdk v0.0.0-20250915173310-79b8fc965dd9/go.mod h1:9OJTHMVtuLPIWWY3l7b00IgqKjlHSz9j77BHzc5/UnU=
20642064
github.com/status-im/gomoji v1.1.3-0.20220213022530-e5ac4a8732d4 h1:CtobZoiNdHpx+xurFxnuJ1xsGm3oKMfcZkB3vmomJmA=
20652065
github.com/status-im/gomoji v1.1.3-0.20220213022530-e5ac4a8732d4/go.mod h1:hmpnZzkzSZJbFYWAUkrPV8I36x7mdYiPhPqnALP4fKA=
20662066
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=

nix/pkgs/status-go/library/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ in pkgs.buildGoModule {
4242
preBuild = ''
4343
go run cmd/library/*.go > $NIX_BUILD_TOP/main.go
4444
make generate SHELL=$SHELL GO111MODULE=on GO_GENERATE_CMD='go generate'
45+
make download-tokens SHELL=$SHELL GO111MODULE=on
4546
'';
4647

4748
# Build the Go library

node/get_status_node.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,6 @@ func (n *StatusNode) startWithDB(config *params.NodeConfig) error {
359359
}
360360

361361
func (n *StatusNode) createAndStartTokenManager() error {
362-
accDB, err := accounts.NewDB(n.appDB)
363-
if err != nil {
364-
return err
365-
}
366-
367-
n.tokenManager = token.NewTokenManager(n.walletDB, n.rpcClient, community.NewManager(n.appDB, n.mediaServer, nil),
368-
n.rpcClient.GetNetworkManager(), n.appDB, n.mediaServer, &n.walletFeed, n.accountsPublisher, accDB,
369-
token.NewPersistence(n.walletDB))
370-
371362
const (
372363
defaultAutoRefreshInterval = 30 * time.Minute // interval after which we should fetch the token lists from the remote source (or use the default one if remote source is not set)
373364
defaultAutoRefreshCheckInterval = 3 * time.Minute // interval after which we should check if we should trigger the auto-refresh
@@ -382,7 +373,19 @@ func (n *StatusNode) createAndStartTokenManager() error {
382373
autoRefreshCheckInterval = time.Duration(n.config.WalletConfig.TokensListsAutoRefreshCheckInterval) * time.Second
383374
}
384375

385-
n.tokenManager.Start(context.Background(), autoRefreshInterval, autoRefreshCheckInterval)
376+
accDB, err := accounts.NewDB(n.appDB)
377+
if err != nil {
378+
return err
379+
}
380+
381+
n.tokenManager, err = token.NewTokenManager(n.walletDB, n.rpcClient, community.NewManager(n.appDB, n.mediaServer, nil),
382+
n.rpcClient.GetNetworkManager(), n.appDB, n.mediaServer, &n.walletFeed, n.accountsPublisher, accDB,
383+
autoRefreshInterval, autoRefreshCheckInterval)
384+
if err != nil {
385+
return err
386+
}
387+
388+
n.tokenManager.Start(context.Background())
386389
return nil
387390
}
388391

node/status_node_services.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ func (b *StatusNode) initServices(config *params.NodeConfig, mediaServer *server
7373
// Wallet Service is used by wakuExtSrvc/wakuV2ExtSrvc
7474
// Keep this initialization before the other two
7575
if config.WalletConfig.Enabled {
76-
walletService := b.walletService(accDB, b.appDB, b.accountsPublisher, &b.walletFeed, config.WalletConfig.StatusProxyStageName)
77-
services = append(services, walletService)
76+
err := b.createWalletService(accDB, b.appDB, b.accountsPublisher, &b.walletFeed, config.WalletConfig.StatusProxyStageName)
77+
if err != nil {
78+
return err
79+
}
80+
services = append(services, b.walletSrvc)
7881
}
7982

8083
// CollectiblesManager needs the WakuExt service to get metadata for
@@ -283,9 +286,9 @@ func (b *StatusNode) SetWalletCommunityInfoProvider(provider thirdparty.Communit
283286
}
284287
}
285288

286-
func (b *StatusNode) walletService(accountsDB *accounts.Database, appDB *sql.DB, accountsPublisher *pubsub.Publisher, walletFeed *event.Feed, statusProxyStageName string) *wallet.Service {
289+
func (b *StatusNode) createWalletService(accountsDB *accounts.Database, appDB *sql.DB, accountsPublisher *pubsub.Publisher, walletFeed *event.Feed, statusProxyStageName string) (err error) {
287290
if b.walletSrvc == nil {
288-
b.walletSrvc = wallet.NewService(
291+
b.walletSrvc, err = wallet.NewService(
289292
b.walletDB, accountsDB, appDB, b.rpcClient, accountsPublisher, b.gethAccountsManager, b.transactor, b.config,
290293
b.ensService(b.timeSourceNow()).API().EnsResolver(),
291294
b.pendingTracker,
@@ -295,7 +298,7 @@ func (b *StatusNode) walletService(accountsDB *accounts.Database, appDB *sql.DB,
295298
statusProxyStageName,
296299
)
297300
}
298-
return b.walletSrvc
301+
return
299302
}
300303

301304
func (b *StatusNode) ethService() *eth.Service {

params/config.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ type WalletConfig struct {
225225
StatusProxyBlockchainPassword security.SensitiveString `json:"StatusProxyBlockchainPassword"`
226226

227227
StatusProxyStageName string `json:"StatusProxyStageName"`
228-
EnableCelerBridge bool `json:"EnableCelerBridge"`
229228
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
230229
EthRpcProxyUrl security.SensitiveString `json:"EthRpcProxyUrl"`
231230
EthRpcProxyUser security.SensitiveString `json:"EthRpcProxyUser"`
@@ -249,13 +248,11 @@ type MarketDataProxyConfig struct {
249248
func (wc WalletConfig) MarshalJSON() ([]byte, error) {
250249
return json.Marshal(struct {
251250
Enabled bool `json:"Enabled"`
252-
EnableCelerBridge bool `json:"EnableCelerBridge"`
253251
EnableMercuryoProvider bool `json:"EnableMercuryoProvider"`
254252
TokensListsAutoRefreshInterval int `json:"TokensListsAutoRefreshInterval"`
255253
TokensListsAutoRefreshCheckInterval int `json:"TokensListsAutoRefreshCheckInterval"`
256254
}{
257255
Enabled: wc.Enabled,
258-
EnableCelerBridge: wc.EnableCelerBridge,
259256
EnableMercuryoProvider: wc.EnableMercuryoProvider,
260257
TokensListsAutoRefreshInterval: wc.TokensListsAutoRefreshInterval,
261258
TokensListsAutoRefreshCheckInterval: wc.TokensListsAutoRefreshCheckInterval,

0 commit comments

Comments
 (0)