Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initialize pkg/contracts/sui #3500

Merged
merged 4 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@

### Features

* [3461](https://github.com/zeta-chain/node/pull/3461) - add new 'ConfirmationParams' field to chain params to enable multiple confirmation count values, deprecating `confirmation_count`
* [3461](https://github.com/zeta-chain/node/pull/3461) - add new `ConfirmationParams` field to chain params to enable multiple confirmation count values, deprecating `confirmation_count`
* [3489](https://github.com/zeta-chain/node/pull/3489) - add Sui chain info
* [3455](https://github.com/zeta-chain/node/pull/3455) - add `track-cctx` command to zetatools

### Refactor

* [3381](https://github.com/zeta-chain/node/pull/3381) - split Bitcoin observer and signer into small files and organize outbound logic into reusable/testable functions; renaming, type unification, etc.

### Fixes

* [3501](https://github.com/zeta-chain/node/pull/3501) - fix E2E test failure caused by nil `ConfirmationParams` for Solana and TON

### Tests

* [3430](https://github.com/zeta-chain/node/pull/3430) - add simulation test for MsgWithDrawEmission
Expand Down
14 changes: 10 additions & 4 deletions pkg/contracts/sui/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/pkg/errors"
)

// CoinTypeSUI is the coin type for SUI, native gas token
// SUI is the coin type for SUI, native gas token
const SUI CoinType = "0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"

const (
Expand All @@ -32,7 +32,7 @@ type Gateway struct {
//go:embed bin/gateway.mv
var gatewayBinary []byte

// ErrParse event parse error
// ErrParseEvent event parse error
var ErrParseEvent = errors.New("event parse error")

// NewGateway creates a new SUI gateway
Expand All @@ -48,11 +48,13 @@ func GatewayBytecodeBase64() string {
}

// QueryDepositInbounds queries the inbounds from deposit events from the Sui gateway
// from and to represents time range in Unix time in milliseconds
func (g *Gateway) QueryDepositInbounds(ctx context.Context, from, to uint64) ([]Inbound, error) {
return g.queryInbounds(ctx, from, to, eventDeposit)
}

// QueryDepositAndCallInbounds queries the inbounds from depositAndCall events from the Sui gateway
// from and to represents time range in Unix time in milliseconds
func (g *Gateway) QueryDepositAndCallInbounds(ctx context.Context, from, to uint64) ([]Inbound, error) {
return g.queryInbounds(ctx, from, to, eventDepositAndCall)
}
Expand All @@ -62,17 +64,21 @@ func (g *Gateway) queryInbounds(ctx context.Context, _, _ uint64, event string)
// TODO: Support pagination
res, err := g.client.SuiXQueryEvents(ctx, models.SuiXQueryEventsRequest{
SuiEventFilter: map[string]any{
// TODO: Fix the error
// TODO: Fix the error, or add another solution to query events by time range
// https://github.com/zeta-chain/node/issues/3523
// using TimeRange causes the following error when sending the query:
// {"code":-32602,"message":"Invalid params","data":"expected value at line 1 column 108"}
// commenting out for new and querying all events
//"TimeRange": models.TimeRange{
// StartTime: from,
// EndTime: to,
//},
//"TimeRange": map[string]interface{}{
// "startTime": from,
// "endTime": to,
//},
"MoveEventType": eventType(g.packageID, moduleName, event),
},
Limit: 5,
})
if err != nil {
return []Inbound{}, err
Expand Down
Loading
Loading