@@ -8,14 +8,6 @@ import (
8
8
"github.com/smartcontractkit/chainlink-solana/pkg/solana/chainwriter"
9
9
)
10
10
11
- type RegistryTokenState struct {
12
- PoolProgram [32 ]byte `json:"pool_program"`
13
- PoolConfig [32 ]byte `json:"pool_config"`
14
- TokenProgram [32 ]byte `json:"token_program"`
15
- TokenState [32 ]byte `json:"token_state"`
16
- PoolAssociatedTokenAccount [32 ]byte `json:"pool_associated_token_account"`
17
- }
18
-
19
11
func TestGetAddresses (t * testing.T ) {
20
12
// Fake constant addresses for the purpose of this example.
21
13
registryAddress := "4Nn9dsYBcSTzRbK9hg9kzCUdrCSkMZq1UR6Vw1Tkaf6A"
@@ -95,7 +87,7 @@ func TestGetAddresses(t *testing.T) {
95
87
// A) The PublicKey lookup resolves to multiple addresses (i.e. multiple token addresses)
96
88
// B) The Seeds or ValueSeeds resolve to multiple values
97
89
chainwriter.PDALookups {
98
- Name : "PerChainRateLimit " ,
90
+ Name : "PerChainConfig " ,
99
91
// PublicKey is a constant account in this case, not a lookup.
100
92
PublicKey : chainwriter.AccountConstant {
101
93
Address : registryAddress ,
@@ -105,6 +97,7 @@ func TestGetAddresses(t *testing.T) {
105
97
// Similar to the RegistryTokenState above, the user is looking up PDA accounts based on the dest tokens.
106
98
Seeds : []chainwriter.Lookup {
107
99
chainwriter.AccountLookup {Location : "Message.TokenAmounts.DestTokenAddress" },
100
+ chainwriter.AccountLookup {Location : "Message.Header.DestChainSelector" },
108
101
},
109
102
IsSigner : false ,
110
103
IsWritable : false ,
@@ -182,6 +175,22 @@ func TestGetAddresses(t *testing.T) {
182
175
IsSigner : false ,
183
176
IsWritable : false ,
184
177
},
178
+ // PDA lookup to get the Router Chain Config
179
+ chainwriter.PDALookups {
180
+ Name : "RouterChainConfig" ,
181
+ // The public key is a constant Router address.
182
+ PublicKey : chainwriter.AccountConstant {
183
+ Address : routerProgramAddress ,
184
+ IsSigner : false ,
185
+ IsWritable : false ,
186
+ },
187
+ Seeds : []chainwriter.Lookup {
188
+ chainwriter.AccountLookup {Location : "Message.Header.DestChainSelector" },
189
+ chainwriter.AccountLookup {Location : "Message.Header.SourceChainSelector" },
190
+ },
191
+ IsSigner : false ,
192
+ IsWritable : false ,
193
+ },
185
194
// PDA lookup to get the Router Report Accounts.
186
195
chainwriter.PDALookups {
187
196
Name : "RouterReportAccount" ,
@@ -213,7 +222,7 @@ func TestGetAddresses(t *testing.T) {
213
222
// with the public key to generate one or multiple PDA accounts.
214
223
Seeds : []chainwriter.Lookup {
215
224
chainwriter.AccountLookup {Location : "Message.Receiver" },
216
- chainwriter.AccountLookup {Location : "Message.DestChainSelector" },
225
+ chainwriter.AccountLookup {Location : "Message.Header. DestChainSelector" },
217
226
},
218
227
},
219
228
// Account constant
@@ -261,7 +270,20 @@ func TestGetAddresses(t *testing.T) {
261
270
},
262
271
},
263
272
Accounts : []chainwriter.Lookup {
264
-
273
+ // Account constant
274
+ chainwriter.AccountConstant {
275
+ Name : "RouterProgram" ,
276
+ Address : routerProgramAddress ,
277
+ IsSigner : false ,
278
+ IsWritable : false ,
279
+ },
280
+ // Account constant
281
+ chainwriter.AccountConstant {
282
+ Name : "RouterAccountConfig" ,
283
+ Address : routerAccountConfigAddress ,
284
+ IsSigner : false ,
285
+ IsWritable : false ,
286
+ },
265
287
// PDA lookup to get the Router Report Accounts.
266
288
chainwriter.PDALookups {
267
289
Name : "RouterReportAccount" ,
@@ -281,13 +303,6 @@ func TestGetAddresses(t *testing.T) {
281
303
IsWritable : false ,
282
304
},
283
305
// Account constant
284
- chainwriter.AccountConstant {
285
- Name : "CPISigner" ,
286
- Address : cpiSignerAddress ,
287
- IsSigner : true ,
288
- IsWritable : false ,
289
- },
290
- // Account constant
291
306
chainwriter.AccountConstant {
292
307
Name : "SystemProgram" ,
293
308
Address : systemProgramAddress ,
0 commit comments