Skip to content

Commit

Permalink
Merge branch 'feat/sui-client-pkg' into feat/sui-observer
Browse files Browse the repository at this point in the history
  • Loading branch information
swift1337 committed Feb 12, 2025
2 parents 2cc40ae + e84bf2c commit 1cfa054
Show file tree
Hide file tree
Showing 7 changed files with 2,196 additions and 33 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
* [3509](https://github.com/zeta-chain/node/pull/3509) - schedule Bitcoin TSS keysign on interval to avoid TSS keysign spam
* [3517](https://github.com/zeta-chain/node/pull/3517) - remove duplicate gateway event appending to fix false positive on multiple events in same tx

### 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

0 comments on commit 1cfa054

Please sign in to comment.