From b55b4bc3f32c9a9170b3f4f81ac02d53b355545b Mon Sep 17 00:00:00 2001 From: Geoff Lee Date: Thu, 25 Apr 2024 17:35:06 +0900 Subject: [PATCH] use refactored kvindexer (#26) * use refactored kvindexer * bump kvindexer --- app/app.go | 44 +++++++++++++++++++++++++------------------- go.mod | 6 +++++- go.sum | 12 ++++++++++-- 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/app/app.go b/app/app.go index b0ed39a..02ace17 100644 --- a/app/app.go +++ b/app/app.go @@ -149,12 +149,12 @@ import ( // kvindexer indexer "github.com/initia-labs/kvindexer" indexerconfig "github.com/initia-labs/kvindexer/config" - indexermodule "github.com/initia-labs/kvindexer/module" - indexerkeeper "github.com/initia-labs/kvindexer/module/keeper" - blocksubmodule "github.com/initia-labs/kvindexer/submodule/block" - "github.com/initia-labs/kvindexer/submodule/nft" - "github.com/initia-labs/kvindexer/submodule/pair" - "github.com/initia-labs/kvindexer/submodule/tx" + blocksubmodule "github.com/initia-labs/kvindexer/submodules/block" + nft "github.com/initia-labs/kvindexer/submodules/move-nft" + pair "github.com/initia-labs/kvindexer/submodules/pair" + tx "github.com/initia-labs/kvindexer/submodules/tx" + indexermodule "github.com/initia-labs/kvindexer/x/kvindexer" + indexerkeeper "github.com/initia-labs/kvindexer/x/kvindexer/keeper" // unnamed import of statik for swagger UI support _ "github.com/initia-labs/minimove/client/docs/statik" @@ -1232,24 +1232,30 @@ func (app *MinitiaApp) setupIndexer(appOpts servertypes.AppOptions, homePath str } app.indexerKeeper = indexerkeeper.NewKeeper( appCodec, - app.AccountKeeper, - app.BankKeeper, - nil, // placeholder for distribution keeper - nil, // placeholder for staking keeper - nil, // placeholder for reward keeper, - nil, // placeholder for community pool keeper - indexerkeeper.VMKeeper{Keeper: app.MoveKeeper}, // placeholder for wrapped vm keeper - app.IBCKeeper, - app.TransferKeeper, - app.NftTransferKeeper, - app.OPChildKeeper, - authtypes.FeeCollectorName, + "move", homePath, indexerConfig, ac, vc, ) - err = app.indexerKeeper.RegisterSubmodules(nft.Submodule, pair.Submodule, tx.Submodule, blocksubmodule.Submodule) + + smBlock, err := blocksubmodule.NewBlockSubmodule(appCodec, app.indexerKeeper, app.OPChildKeeper) + if err != nil { + panic(err) + } + smTx, err := tx.NewTxSubmodule(appCodec, app.indexerKeeper) + if err != nil { + panic(err) + } + smPair, err := pair.NewPairSubmodule(appCodec, app.indexerKeeper, app.IBCKeeper.ChannelKeeper, app.TransferKeeper) + if err != nil { + panic(err) + } + smNft, err := nft.NewMoveNftSubmodule(ac, appCodec, app.indexerKeeper, app.MoveKeeper, smPair) + if err != nil { + panic(err) + } + err = app.indexerKeeper.RegisterSubmodules(smBlock, smTx, smPair, smNft) if err != nil { panic(err) } diff --git a/go.mod b/go.mod index 82d7523..332fa24 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,11 @@ require ( github.com/gorilla/mux v1.8.1 github.com/initia-labs/OPinit v0.2.5 github.com/initia-labs/initia v0.2.5 - github.com/initia-labs/kvindexer v0.0.0-20240419060315-a1d97e68ce38 + github.com/initia-labs/kvindexer v0.1.0 + github.com/initia-labs/kvindexer/submodules/block v0.1.0 + github.com/initia-labs/kvindexer/submodules/move-nft v0.1.0 + github.com/initia-labs/kvindexer/submodules/pair v0.1.0 + github.com/initia-labs/kvindexer/submodules/tx v0.1.0 // we also need to update `LIBMOVEVM_VERSION` of images/private/Dockerfile#5 github.com/initia-labs/movevm v0.2.6 github.com/noble-assets/forwarding v0.0.0-20240416085758-ed8e9efaf69a diff --git a/go.sum b/go.sum index 9708215..a6a662e 100644 --- a/go.sum +++ b/go.sum @@ -737,8 +737,16 @@ github.com/initia-labs/ibc-go/v8 v8.0.0-20240419124350-4275a05abe2c h1:FDwh5zZbm github.com/initia-labs/ibc-go/v8 v8.0.0-20240419124350-4275a05abe2c/go.mod h1:wj3qx75iC/XNnsMqbPDCIGs0G6Y3E/lo3bdqCyoCy+8= github.com/initia-labs/initia v0.2.5 h1:s6kucRzWtWiKghlNE3djVzAcLBH5IdaHgoGNHsE5QVo= github.com/initia-labs/initia v0.2.5/go.mod h1:ASbSwDv+qXwJo6HUiiUTsuf8F6xZ9RaHMyYQfJsXJkA= -github.com/initia-labs/kvindexer v0.0.0-20240419060315-a1d97e68ce38 h1:3NBkDgRm07XhiPX/D3yX7zDbAjwlq+WYplfX/a4LTxc= -github.com/initia-labs/kvindexer v0.0.0-20240419060315-a1d97e68ce38/go.mod h1:NpgGtWQ6w5LWLcD3NnfjBtmdWXYkQnUef5GOtpbQekc= +github.com/initia-labs/kvindexer v0.1.0 h1:AwBWy76fZrwj+et1LMlcwvDQZyxuQ1IdBgx4R+94hiU= +github.com/initia-labs/kvindexer v0.1.0/go.mod h1:+2hInhMys7TFlGsAey2bFH4tA9fu+5/W17Ttecf1NHc= +github.com/initia-labs/kvindexer/submodules/block v0.1.0 h1:y+EXnksd/I2F96mzIoQA64nZUZON2P+99YrSzeLCLoY= +github.com/initia-labs/kvindexer/submodules/block v0.1.0/go.mod h1:4c+c59wVAnjuaJv/pcDYaUkeVmOqVV+orqEjya/RIjo= +github.com/initia-labs/kvindexer/submodules/move-nft v0.1.0 h1:uhLJsUFTJF8+E4p3DkIjMxlrjQNPdPepb8Z6HSeONKI= +github.com/initia-labs/kvindexer/submodules/move-nft v0.1.0/go.mod h1:E75HJBUPG2y3gBGQ45ot9NgPbSRf6yMhtMwXp2SuAuE= +github.com/initia-labs/kvindexer/submodules/pair v0.1.0 h1:mZeeYhhz78J/LKjrVGzV9ervjDoBV4AoeiFRBZN+0CI= +github.com/initia-labs/kvindexer/submodules/pair v0.1.0/go.mod h1:VzSXi4eW2dCJ/B1okO6jGIKOhaPurM/PkWWS5OdFgSE= +github.com/initia-labs/kvindexer/submodules/tx v0.1.0 h1:6kbf6wmzXPN0XCQLasiFgq1AlZHkt5K3/ZG+IWw1nNs= +github.com/initia-labs/kvindexer/submodules/tx v0.1.0/go.mod h1:i0XeLbLa6xdgTR01WF8kaAO50vMmwxbeq0fKexwpFHU= github.com/initia-labs/movevm v0.2.6 h1:dhXGeS4cwCA+bnOPv6xWfDX0LdVD+7O5ZV/8+GeQqmM= github.com/initia-labs/movevm v0.2.6/go.mod h1:6MxR4GP5zH3JUc1IMgfqAe1e483mZVS7fshPknZPJ30= github.com/initia-labs/slinky v0.0.0-20240418051646-d45167cc66b1 h1:7mXLhI/X+GLdAYNmzXE5CIvTuOgETUMB7tR6VHvX/tY=