Skip to content

Commit

Permalink
refactor: support the refactored hub rollapp API (dymensionxyz#338)
Browse files Browse the repository at this point in the history
Co-authored-by: Itzhak Bokris <[email protected]>
  • Loading branch information
ItzhakBokris and Itzhak Bokris authored Jun 7, 2023
1 parent 7c65250 commit 6afe964
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 161 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/celestiaorg/go-cnc v0.2.0
github.com/dgraph-io/badger/v3 v3.2103.3
github.com/dymensionxyz/cosmosclient v0.3.0-beta.0.20230514120937-449e9becd080
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230503120250-228ff624f61c
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6
github.com/go-kit/kit v0.12.0
github.com/gofrs/uuid v4.3.0+incompatible
github.com/gogo/protobuf v1.3.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQx
github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU=
github.com/dymensionxyz/cosmosclient v0.3.0-beta.0.20230514120937-449e9becd080 h1:ZNTHi2xEJ5reGw1k8X6QFM9n1TdW/3zMCbi27hEmSi0=
github.com/dymensionxyz/cosmosclient v0.3.0-beta.0.20230514120937-449e9becd080/go.mod h1:+zZkh3ntB21qQsfJjdn9aRGLLMmeDWWO+FxnWl8RWpw=
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230503120250-228ff624f61c h1:FgOj+LZxMYdWvMFDxFyays7RGPtxRwarLX8ed+AXMqA=
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230503120250-228ff624f61c/go.mod h1:Y6vWJ7h5PfSS6KTN7Fw28KYqhQpjR5b93iaHB5rf5a0=
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6 h1:dnriGXmMdYEiF/8lMrj+PDlN1vyQc6zgs/ZHL67eoyI=
github.com/dymensionxyz/dymension v0.2.0-beta.0.20230607115558-745644a96ea6/go.mod h1:rDkVuF+DxBDi5tTgVHFk1D2xpqf8bOccs6aB1wTOvP0=
github.com/dymensionxyz/rpc v1.3.1 h1:7EXWIobaBes5zldRvTIg7TmNsEKjicrWA/OjCc0NaGs=
github.com/dymensionxyz/rpc v1.3.1/go.mod h1:f+WpX8ysy8wt95iGc6auYlHcnHj2bUkhiRVkkKNys8c=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
Expand Down
160 changes: 5 additions & 155 deletions mocks/settlement/rollapp_query_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions settlement/dymension/dymension.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,15 @@ WaitForBatchAcceptance:

// GetLatestBatch returns the latest batch from the Dymension Hub.
func (d *HubClient) GetLatestBatch(rollappID string) (*settlement.ResultRetrieveBatch, error) {
latestStateInfoIndexResp, err := d.rollappQueryClient.LatestStateInfoIndex(d.ctx,
&rollapptypes.QueryGetLatestStateInfoIndexRequest{RollappId: d.config.RollappID})
latestStateInfoIndexResp, err := d.rollappQueryClient.LatestStateIndex(d.ctx,
&rollapptypes.QueryGetLatestStateIndexRequest{RollappId: d.config.RollappID})
if latestStateInfoIndexResp == nil {
return nil, settlement.ErrBatchNotFound
}
if err != nil {
return nil, err
}
latestBatch, err := d.GetBatchAtIndex(rollappID, latestStateInfoIndexResp.LatestStateInfoIndex.Index)
latestBatch, err := d.GetBatchAtIndex(rollappID, latestStateInfoIndexResp.StateIndex.Index)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 6afe964

Please sign in to comment.