-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
113 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module github.com/zeta-chain/node/contrib/rpcimportable | ||
|
||
go 1.22.5 | ||
|
||
require github.com/zeta-chain/node v0.0.0-20240903163921-74f1ab59c658 // indirect | ||
|
||
replace ( | ||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 | ||
) | ||
|
||
// uncomment this for local testing/development | ||
// replace github.com/zeta-chain/node => ../.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
github.com/zeta-chain/node v0.0.0-20240903163921-74f1ab59c658 h1:+KzsEBBWfxAMqMjwOcivdpSHPncDSMU3yw7oIG5YJAw= | ||
github.com/zeta-chain/node v0.0.0-20240903163921-74f1ab59c658/go.mod h1:XJj15D2+sgtX3wqx1O85A0bKUI3srKyZwkxdcfgoK6I= | ||
github.com/zeta-chain/node v1.2.1/go.mod h1:z72YVX6jPPst8K06l0LTKORJXN7XB1RKUiliU52Cwk0= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package rpcimportable | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/zeta-chain/node/pkg/rpc" | ||
) | ||
|
||
func TestRPCImportable(t *testing.T) { | ||
_ = rpc.Clients{} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package zetacore | ||
|
||
import ( | ||
"context" | ||
"sort" | ||
|
||
"cosmossdk.io/errors" | ||
"github.com/cosmos/cosmos-sdk/types/query" | ||
"github.com/zeta-chain/node/x/crosschain/types" | ||
"github.com/zeta-chain/node/zetaclient/chains/interfaces" | ||
) | ||
|
||
// GetAllOutboundTrackerByChain returns all outbound trackers for a chain | ||
func (c *Client) GetAllOutboundTrackerByChain( | ||
ctx context.Context, | ||
chainID int64, | ||
order interfaces.Order, | ||
) ([]types.OutboundTracker, error) { | ||
in := &types.QueryAllOutboundTrackerByChainRequest{ | ||
Chain: chainID, | ||
Pagination: &query.PageRequest{ | ||
Key: nil, | ||
Offset: 0, | ||
Limit: 2000, | ||
CountTotal: false, | ||
Reverse: false, | ||
}, | ||
} | ||
|
||
resp, err := c.Crosschain.OutboundTrackerAllByChain(ctx, in) | ||
if err != nil { | ||
return nil, errors.Wrap(err, "failed to get all outbound trackers") | ||
} | ||
|
||
if order == interfaces.Ascending { | ||
sort.SliceStable(resp.OutboundTracker, func(i, j int) bool { | ||
return resp.OutboundTracker[i].Nonce < resp.OutboundTracker[j].Nonce | ||
}) | ||
} else if order == interfaces.Descending { | ||
sort.SliceStable(resp.OutboundTracker, func(i, j int) bool { | ||
return resp.OutboundTracker[i].Nonce > resp.OutboundTracker[j].Nonce | ||
}) | ||
} | ||
|
||
return resp.OutboundTracker, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters