Skip to content

Commit 3f43937

Browse files
refactor: Update SUI client (#774)
This PR includes the following changes: 1. Updates the Sui SDK references to correspond to the gRPC migration changes in `chainlink-sui`. This primarily includes dropping the `ISuiAPI` reference (old version of the Sui SDK) in favor of using a client interface exported by `chainlink-sui/relayer/client`. 2. Update the mocked interface for Sui in this repo. 3. General lint and deps version bumps.
1 parent 856384f commit 3f43937

54 files changed

Lines changed: 2966 additions & 3588 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.mockery.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,19 @@ packages:
9494
config:
9595
dir: "./sdk/aptos/mocks/aptos"
9696
filename: "transactionsigner.go"
97-
github.com/block-vision/sui-go-sdk/sui:
97+
github.com/smartcontractkit/chainlink-sui/relayer/client:
9898
config:
9999
all: false
100100
outpkg: "mock_sui"
101101
interfaces:
102-
ISuiAPI:
102+
BindingsClient:
103103
config:
104104
dir: "./sdk/sui/mocks/sui"
105-
filename: "isuiapi.go"
105+
filename: "bindingsclient.go"
106+
SuiPTBClient:
107+
config:
108+
dir: "./sdk/sui/mocks/sui"
109+
filename: "suiptbclient.go"
106110
github.com/smartcontractkit/chainlink-sui/bindings/utils:
107111
config:
108112
all: false

chainwrappers/chainaccessor.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ package chainwrappers
22

33
import (
44
aptoslib "github.com/aptos-labs/aptos-go-sdk"
5-
"github.com/block-vision/sui-go-sdk/sui"
65
sol "github.com/gagliardetto/solana-go"
76
solrpc "github.com/gagliardetto/solana-go/rpc"
87
"github.com/xssnick/tonutils-go/ton"
98
tonwallet "github.com/xssnick/tonutils-go/ton/wallet"
109

10+
cslclient "github.com/smartcontractkit/chainlink-sui/relayer/client"
11+
1112
cantonsdk "github.com/smartcontractkit/mcms/sdk/canton"
1213
evmsdk "github.com/smartcontractkit/mcms/sdk/evm"
1314
suisdk "github.com/smartcontractkit/mcms/sdk/sui"
@@ -21,7 +22,7 @@ type ChainAccessor interface {
2122
SolanaSigner(selector uint64) (*sol.PrivateKey, bool)
2223
AptosClient(selector uint64) (aptoslib.AptosRpcClient, bool)
2324
AptosSigner(selector uint64) (aptoslib.TransactionSigner, bool)
24-
SuiClient(selector uint64) (sui.ISuiAPI, bool)
25+
SuiClient(selector uint64) (cslclient.BindingsClient, bool)
2526
SuiSigner(selector uint64) (suisdk.SuiSigner, bool)
2627
TonClient(selector uint64) (ton.APIClientWrapped, bool)
2728
TonSigner(selector uint64) (*tonwallet.Wallet, bool)

chainwrappers/executors_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestBuildExecutors(t *testing.T) {
5656
aptosCurseSigner := aptosmocks.NewTransactionSigner(t)
5757
aptosCurseEncoder := aptos.NewEncoder(aptosSelector, 0, false)
5858
aptosCurseExecutor := aptos.NewExecutorWithMCMSType(aptosCurseClient, aptosCurseSigner, aptosCurseEncoder, aptos.TimelockRoleProposer, aptos.MCMSTypeCurse)
59-
suiClient := suimocks.NewISuiAPI(t)
59+
suiClient := suimocks.NewBindingsClient(t)
6060
suiSigner := suibindmocks.NewSuiSigner(t)
6161
suiEncoder := sui.NewEncoder(suiSelector, 0, false)
6262
suiExecutor, err := sui.NewExecutor(suiClient, suiSigner, suiEncoder, nil, "mcms-pkg-id",

chainwrappers/mocks/chain_accessor.go

Lines changed: 18 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chainwrappers/timelock_executors_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestBuildTimelockExecutors(t *testing.T) {
3838
aptosClient := aptosmocks.NewAptosRpcClient(t)
3939
aptosSigner := aptosmocks.NewTransactionSigner(t)
4040
aptosExecutor := aptos.NewTimelockExecutor(aptosClient, aptosSigner)
41-
suiClient := suimocks.NewISuiAPI(t)
41+
suiClient := suimocks.NewBindingsClient(t)
4242
suiSigner := suibindmocks.NewSuiSigner(t)
4343
suiExecutor, err := sui.NewTimelockExecutor(suiClient, suiSigner, nil, "mcms-pkg-id", "0xregistry456", "0xaccount123")
4444
require.NoError(t, err)

e2e/tests/setup.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,20 @@ import (
1212
"testing"
1313

1414
"github.com/aptos-labs/aptos-go-sdk"
15-
"github.com/block-vision/sui-go-sdk/sui"
1615
"github.com/ethereum/go-ethereum/ethclient"
1716
"github.com/gagliardetto/solana-go/rpc"
1817
"github.com/gagliardetto/solana-go/rpc/ws"
1918
"github.com/joho/godotenv"
2019
"github.com/stretchr/testify/require"
2120
"github.com/xssnick/tonutils-go/ton"
2221

22+
"github.com/smartcontractkit/chainlink-common/pkg/logger"
2323
tonchain "github.com/smartcontractkit/chainlink-ton/pkg/ton/chain"
2424

25+
cslclient "github.com/smartcontractkit/chainlink-sui/relayer/client"
26+
27+
suisdk "github.com/smartcontractkit/mcms/sdk/sui"
28+
2529
"github.com/smartcontractkit/chainlink-testing-framework/framework"
2630
"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
2731
"github.com/smartcontractkit/freeport"
@@ -60,7 +64,7 @@ type TestSetup struct {
6064
AptosRPCClient *aptos.NodeClient
6165
SolanaBlockchain *blockchain.Output
6266
AptosBlockchain *blockchain.Output
63-
SuiClient sui.ISuiAPI
67+
SuiClient cslclient.BindingsClient
6468
SuiBlockchain *blockchain.Output
6569
SuiNodeURL string
6670
TonClient *ton.APIClient
@@ -187,14 +191,17 @@ func InitializeSharedTestSetup(t *testing.T) *TestSetup {
187191
}
188192

189193
var (
190-
suiClient sui.ISuiAPI
194+
suiClient cslclient.BindingsClient
191195
suiBlockchainOutput *blockchain.Output
192196
suiNodeURL string
193197
)
198+
suiLog := logger.Test(t)
194199
if in.Settings.LocalSuiNodeURL != "" {
195200
// Connect to local Sui node (highest priority)
196201
suiNodeURL = in.Settings.LocalSuiNodeURL
197-
suiClient = sui.NewSuiClient(suiNodeURL)
202+
var clientErr error
203+
suiClient, clientErr = suisdk.NewBindingsClientFromNodeURL(suiLog, suiNodeURL, "")
204+
require.NoError(t, clientErr, "Failed to create Sui gRPC client")
198205
t.Logf("Connected to local Sui node @ %s", suiNodeURL)
199206
} else if in.SuiChain != nil {
200207
// Use blockchain network setup (fallback)
@@ -208,10 +215,12 @@ func InitializeSharedTestSetup(t *testing.T) *TestSetup {
208215
require.NoError(t, err, "Failed to initialize Sui blockchain")
209216

210217
suiNodeURL = suiBlockchainOutput.Nodes[0].ExternalHTTPUrl
211-
suiClient = sui.NewSuiClient(suiNodeURL)
218+
var clientErr error
219+
suiClient, clientErr = suisdk.NewBindingsClientFromNodeURL(suiLog, suiNodeURL, "")
220+
require.NoError(t, clientErr, "Failed to create Sui gRPC client")
212221

213222
// Test liveness, will also fetch ChainID
214-
t.Logf("Initialized Sui RPC client @ %s", suiNodeURL)
223+
t.Logf("Initialized Sui gRPC client @ %s", suiNodeURL)
215224
}
216225

217226
var (

e2e/tests/sui/common.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import (
66
"fmt"
77

88
"github.com/block-vision/sui-go-sdk/signer"
9-
"github.com/block-vision/sui-go-sdk/sui"
109
"github.com/block-vision/sui-go-sdk/transaction"
1110
"github.com/stretchr/testify/suite"
1211

1312
chainsel "github.com/smartcontractkit/chain-selectors"
1413

14+
cslclient "github.com/smartcontractkit/chainlink-sui/relayer/client"
15+
1516
"github.com/smartcontractkit/chainlink-sui/bindings/bind"
1617
modulemcms "github.com/smartcontractkit/chainlink-sui/bindings/generated/mcms/mcms"
1718
modulemcmsaccount "github.com/smartcontractkit/chainlink-sui/bindings/generated/mcms/mcms_account"
@@ -29,7 +30,7 @@ type TestSuite struct {
2930
suite.Suite
3031
e2e.TestSetup
3132

32-
client sui.ISuiAPI
33+
client cslclient.BindingsClient
3334
signer bindutils.SuiSigner
3435

3536
chainSelector types.ChainSelector
@@ -181,7 +182,7 @@ func (s *TestSuite) extractByteArgsFromEncodedCall(encodedCall bind.EncodedCall)
181182

182183
type TestEntrypointArgEncoder struct {
183184
registryObj string
184-
client sui.ISuiAPI
185+
client cslclient.BindingsClient
185186
}
186187

187188
func (e *TestEntrypointArgEncoder) EncodeEntryPointArg(executingCallbackParams *transaction.Argument, target, module, function, stateObjID string, data []byte, typeArgs []string) (*bind.EncodedCall, error) {

go.mod

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ require (
2222
github.com/google/uuid v1.6.0
2323
github.com/joho/godotenv v1.5.1
2424
github.com/karalabe/hid v1.0.1-0.20260315100226-f5d04adeffeb
25+
github.com/patrickmn/go-cache v2.1.0+incompatible
2526
github.com/samber/lo v1.53.0
2627
github.com/smartcontractkit/chain-selectors v1.0.101
2728
github.com/smartcontractkit/chainlink-aptos v0.0.0-20260428085939-5c70de12dbfc
2829
github.com/smartcontractkit/chainlink-canton v0.0.0-20260609155219-dcbe77d4a320
2930
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260129103204-4c8453dd8139
3031
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260129103204-4c8453dd8139
31-
github.com/smartcontractkit/chainlink-sui v0.0.0-20260527160341-aa3adc0abf67
32+
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260506120607-7f10be016c89
33+
github.com/smartcontractkit/chainlink-sui v0.0.0-20260610194843-349ea43d69ce
3234
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.5
3335
github.com/smartcontractkit/chainlink-ton v1.0.5-0.20260514223130-48bc90aca745
3436
github.com/smartcontractkit/freeport v0.1.3-0.20250828155247-add56fa28aad
@@ -232,7 +234,6 @@ require (
232234
github.com/shopspring/decimal v1.4.0 // indirect
233235
github.com/sigurn/crc16 v0.0.0-20211026045750-20ab5afb07e3 // indirect
234236
github.com/sirupsen/logrus v1.9.4 // indirect
235-
github.com/smartcontractkit/chainlink-common v0.11.2-0.20260506120607-7f10be016c89 // indirect
236237
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.10 // indirect
237238
github.com/smartcontractkit/chainlink-deployments-framework v0.109.0 // indirect
238239
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260505131349-78e491b80735 // indirect

go.sum

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,8 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I
597597
github.com/opencontainers/image-spec v1.1.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040=
598598
github.com/opencontainers/image-spec v1.1.1/go.mod h1:qpqAh3Dmcf36wStyyWU+kCeDgrGnAve2nCC8+7h8Q0M=
599599
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
600+
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
601+
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
600602
github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8=
601603
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
602604
github.com/pelletier/go-toml/v2 v2.3.0 h1:k59bC/lIZREW0/iVaQR8nDHxVq8OVlIzYCOJf421CaM=
@@ -686,6 +688,8 @@ github.com/smartcontractkit/chainlink-aptos v0.0.0-20260428085939-5c70de12dbfc h
686688
github.com/smartcontractkit/chainlink-aptos v0.0.0-20260428085939-5c70de12dbfc/go.mod h1:zfE2R7887kiwXkGTHKPe5NBgwhFwIC3pnA2uAxrbvig=
687689
github.com/smartcontractkit/chainlink-canton v0.0.0-20260609155219-dcbe77d4a320 h1:ix4tCtSTB7S2XGll+uqnhrqAQ+2iW/Zk/vnPjBMYRB0=
688690
github.com/smartcontractkit/chainlink-canton v0.0.0-20260609155219-dcbe77d4a320/go.mod h1:WKmNUX4oy8IvB66ukudrE99uaXjlZ7WghCDwHOTyB1c=
691+
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20260428205619-2db1389501a1 h1:p0nFrTYrOQzDhWYm6suaM5CoWiXV5NV7llHnp6/Kn/8=
692+
github.com/smartcontractkit/chainlink-ccip v0.1.1-solana.0.20260428205619-2db1389501a1/go.mod h1:1XxxpkgCmG/z6y30yRuVrcxre6zixIVX3xzi706Db/8=
689693
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260129103204-4c8453dd8139 h1:jkChf04hhdiMBApbb+lLDxHMY62Md6UeM7v++GSw3K8=
690694
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260129103204-4c8453dd8139/go.mod h1:wuhagkM/lU0GbV2YcrROOH0GlsfXJYwm6qmpa4CK70w=
691695
github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260129103204-4c8453dd8139 h1:tw3K4UkH5XfW5SoyYkvAlbzrccoGSLdz/XkxD6nyGC8=
@@ -706,8 +710,8 @@ github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260211172625
706710
github.com/smartcontractkit/chainlink-protos/node-platform v0.0.0-20260211172625-dff40e83b3c9/go.mod h1:dkR2uYg9XYJuT1JASkPzWE51jjFkVb86P7a/yXe5/GM=
707711
github.com/smartcontractkit/chainlink-protos/op-catalog v0.1.0 h1:hGEJFD2X3oNIPXQbtIPxCJyg5CcKglRCYBmESS+gmeQ=
708712
github.com/smartcontractkit/chainlink-protos/op-catalog v0.1.0/go.mod h1:PjZD54vr6rIKEKQj6HNA4hllvYI/QpT+Zefj3tqkFAs=
709-
github.com/smartcontractkit/chainlink-sui v0.0.0-20260527160341-aa3adc0abf67 h1:NNvPOgvf5vbOYVLxLST+5E88iPOAnpmzZGPihEx8DFc=
710-
github.com/smartcontractkit/chainlink-sui v0.0.0-20260527160341-aa3adc0abf67/go.mod h1:k1HSbHyPaQWPOj6lXDIAe04EuwbC5ge1nK+cpG2E8hE=
713+
github.com/smartcontractkit/chainlink-sui v0.0.0-20260610194843-349ea43d69ce h1:Xglr7eM24+Y9eMOhgK//QjXLDjPuT1oUAtdvsGqY8P0=
714+
github.com/smartcontractkit/chainlink-sui v0.0.0-20260610194843-349ea43d69ce/go.mod h1:Y2kTVIsAUjqqSNGiEQomsaVH5XsBJzxov4j07MaDJOw=
711715
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.5 h1:EiQx0LCPzxlfO9piSPeMCVSZAnp/BxAsPIGh/jBal18=
712716
github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.5/go.mod h1:nyOjn4ADJGqRMe3+4ZXSV+J/7nWb1H2Vx8Qk57eLRYA=
713717
github.com/smartcontractkit/chainlink-testing-framework/seth v1.51.5 h1:RwZXxdIAOyjp6cwc9Quxgr38k8r7ACz+Lxh9o/A6oH0=

sdk/aptos/mocks/aptos/rpcclient.go

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)