Skip to content

Commit bdddc37

Browse files
authored
deployment/environment.go: add Sui to Environment (#98)
1 parent 0fd0672 commit bdddc37

File tree

6 files changed

+61
-3
lines changed

6 files changed

+61
-3
lines changed

.changeset/nice-mails-yawn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"chainlink-deployments-framework": minor
3+
---
4+
5+
add Sui chain support

deployment/changeset_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ func NewNoopEnvironment(t *testing.T) Environment {
106106
map[uint64]Chain{},
107107
map[uint64]SolChain{},
108108
map[uint64]AptosChain{},
109+
map[uint64]SuiChain{},
109110
[]string{},
110111
nil,
111112
t.Context,

deployment/environment.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ type Environment struct {
124124
Chains map[uint64]Chain
125125
SolChains map[uint64]SolChain
126126
AptosChains map[uint64]AptosChain
127+
SuiChains map[uint64]SuiChain
127128
NodeIDs []string
128129
Offchain OffchainClient
129130
GetContext func() context.Context
@@ -143,6 +144,7 @@ func NewEnvironment(
143144
chains map[uint64]Chain,
144145
solChains map[uint64]SolChain,
145146
aptosChains map[uint64]AptosChain,
147+
suiChains map[uint64]SuiChain,
146148
nodeIDs []string,
147149
offchain OffchainClient,
148150
ctx func() context.Context,
@@ -156,6 +158,7 @@ func NewEnvironment(
156158
Chains: chains,
157159
SolChains: solChains,
158160
AptosChains: aptosChains,
161+
SuiChains: suiChains,
159162
NodeIDs: nodeIDs,
160163
Offchain: offchain,
161164
GetContext: ctx,
@@ -190,6 +193,7 @@ func (e Environment) Clone() Environment {
190193
Chains: e.Chains,
191194
SolChains: e.SolChains,
192195
AptosChains: e.AptosChains,
196+
SuiChains: e.SuiChains,
193197
NodeIDs: e.NodeIDs,
194198
Offchain: e.Offchain,
195199
GetContext: e.GetContext,
@@ -255,8 +259,20 @@ func (e Environment) AllChainSelectorsAptos() []uint64 {
255259
return selectors
256260
}
257261

262+
func (e Environment) AllChainSelectorsSui() []uint64 {
263+
selectors := make([]uint64, 0, len(e.SuiChains))
264+
for sel := range e.SuiChains {
265+
selectors = append(selectors, sel)
266+
}
267+
sort.Slice(selectors, func(i, j int) bool {
268+
return selectors[i] < selectors[j]
269+
})
270+
271+
return selectors
272+
}
273+
258274
func (e Environment) AllChainSelectorsAllFamilies() []uint64 {
259-
selectors := make([]uint64, 0, len(e.Chains)+len(e.SolChains)+len(e.AptosChains))
275+
selectors := make([]uint64, 0, len(e.Chains)+len(e.SolChains)+len(e.AptosChains)+len(e.SuiChains))
260276
for sel := range e.Chains {
261277
selectors = append(selectors, sel)
262278
}
@@ -266,6 +282,9 @@ func (e Environment) AllChainSelectorsAllFamilies() []uint64 {
266282
for sel := range e.AptosChains {
267283
selectors = append(selectors, sel)
268284
}
285+
for sel := range e.SuiChains {
286+
selectors = append(selectors, sel)
287+
}
269288
sort.Slice(selectors, func(i, j int) bool {
270289
return selectors[i] < selectors[j]
271290
})

deployment/sui_chain.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package deployment
2+
3+
import (
4+
"crypto/ed25519"
5+
6+
"github.com/pattonkan/sui-go/suiclient"
7+
)
8+
9+
// SuiChain represents an Sui chain.
10+
type SuiChain struct {
11+
Selector uint64
12+
Client *suiclient.ClientImpl
13+
// TODO: sui-go currently does not have a working Signer interface, so we
14+
// have the raw private key for now.
15+
DeployerKey ed25519.PrivateKey
16+
URL string
17+
18+
Confirm func(txHash string, opts ...any) error
19+
}

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/ethereum/go-ethereum v1.15.3
1010
github.com/gagliardetto/solana-go v1.12.0
1111
github.com/google/uuid v1.6.0
12+
github.com/pattonkan/sui-go v0.1.0
1213
github.com/smartcontractkit/chain-selectors v1.0.57
1314
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250425163923-16aa375957b7
1415
github.com/smartcontractkit/chainlink-common v0.7.0
@@ -31,6 +32,7 @@ require (
3132
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
3233
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
3334
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
35+
github.com/btcsuite/btcutil v1.0.2 // indirect
3436
github.com/coder/websocket v1.8.12 // indirect
3537
github.com/consensys/bavard v0.1.22 // indirect
3638
github.com/consensys/gnark-crypto v0.14.0 // indirect
@@ -41,6 +43,7 @@ require (
4143
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
4244
github.com/ethereum/c-kzg-4844 v1.0.3 // indirect
4345
github.com/ethereum/go-verkle v0.2.2 // indirect
46+
github.com/fardream/go-bcs v0.7.0 // indirect
4447
github.com/fatih/color v1.17.0 // indirect
4548
github.com/fsnotify/fsnotify v1.7.0 // indirect
4649
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
@@ -50,7 +53,7 @@ require (
5053
github.com/go-playground/locales v0.14.1 // indirect
5154
github.com/go-playground/universal-translator v0.18.1 // indirect
5255
github.com/go-playground/validator/v10 v10.24.0 // indirect
53-
github.com/gorilla/websocket v1.5.0 // indirect
56+
github.com/gorilla/websocket v1.5.3 // indirect
5457
github.com/hasura/go-graphql-client v0.13.1 // indirect
5558
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
5659
github.com/holiman/uint256 v1.3.2 // indirect
@@ -62,6 +65,7 @@ require (
6265
github.com/mattn/go-colorable v0.1.13 // indirect
6366
github.com/mattn/go-isatty v0.0.20 // indirect
6467
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
68+
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
6569
github.com/mmcloughlin/addchain v0.4.0 // indirect
6670
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
6771
github.com/modern-go/reflect2 v1.0.2 // indirect

go.sum

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6
4545
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc=
4646
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
4747
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
48+
github.com/btcsuite/btcutil v1.0.2 h1:9iZ1Terx9fMIOtq1VrwdqfsATL9MC2l8ZrUY6YZ2uts=
49+
github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts=
4850
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
4951
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
5052
github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I=
@@ -106,6 +108,8 @@ github.com/ethereum/go-ethereum v1.15.3 h1:OeTWAq6r8iR89bfJDjmmOemE74ywArl9DUViF
106108
github.com/ethereum/go-ethereum v1.15.3/go.mod h1:jMXlpZXfSar1mGs/5sB0aEpEnPsiE1Jn6/3anlueqz8=
107109
github.com/ethereum/go-verkle v0.2.2 h1:I2W0WjnrFUIzzVPwm8ykY+7pL2d4VhlsePn4j7cnFk8=
108110
github.com/ethereum/go-verkle v0.2.2/go.mod h1:M3b90YRnzqKyyzBEWJGqj8Qff4IDeXnzFw0P9bFw3uk=
111+
github.com/fardream/go-bcs v0.7.0 h1:4YIiCXrtUFiRT86TsvUx+tIennZBRXQCzrgt8xC2g0c=
112+
github.com/fardream/go-bcs v0.7.0/go.mod h1:UsoxhIoe2GsVexX0s5NDLIChxeb/JUbjw7IWzzgF3Xk=
109113
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
110114
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
111115
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
@@ -174,8 +178,9 @@ github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/
174178
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
175179
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
176180
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
177-
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
178181
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
182+
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
183+
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
179184
github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE=
180185
github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0=
181186
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
@@ -236,6 +241,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T
236241
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
237242
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
238243
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
244+
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
245+
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
239246
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
240247
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
241248
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
@@ -268,6 +275,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
268275
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
269276
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
270277
github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc=
278+
github.com/pattonkan/sui-go v0.1.0 h1:95re846OafM6erXSqk53UASESQocavRT/g418ic198E=
279+
github.com/pattonkan/sui-go v0.1.0/go.mod h1:E07Cqy27cBNcef90eXnfi/1T5t4Hyn6RxxeK3+NxQ2A=
271280
github.com/pion/dtls/v2 v2.2.7 h1:cSUBsETxepsCSFSxC3mc/aDo14qQLMSL+O6IjG28yV8=
272281
github.com/pion/dtls/v2 v2.2.7/go.mod h1:8WiMkebSHFD0T+dIU+UeBaoV7kDhOW5oDCzZ7WZ/F9s=
273282
github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY=
@@ -393,6 +402,7 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
393402
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
394403
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
395404
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
405+
golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
396406
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
397407
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
398408
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=

0 commit comments

Comments
 (0)