@@ -38,6 +38,7 @@ describe("svm_spoke.refund_claims", () => {
3838 state : PublicKey ;
3939 vault : PublicKey ;
4040 mint : PublicKey ;
41+ refundAddress : PublicKey ;
4142 tokenAccount : PublicKey ;
4243 claimAccount : PublicKey ;
4344 tokenProgram : PublicKey ;
@@ -149,6 +150,7 @@ describe("svm_spoke.refund_claims", () => {
149150 state,
150151 vault,
151152 mint,
153+ refundAddress : relayer . publicKey ,
152154 tokenAccount,
153155 claimAccount,
154156 tokenProgram : TOKEN_PROGRAM_ID ,
@@ -176,7 +178,7 @@ describe("svm_spoke.refund_claims", () => {
176178 const iRelayerBal = ( await connection . getTokenAccountBalance ( tokenAccount ) ) . value . amount ;
177179
178180 // Claim refund for the relayer.
179- const tx = await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
181+ const tx = await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
180182
181183 // The relayer should have received funds from the vault.
182184 const fVaultBal = ( await connection . getTokenAccountBalance ( vault ) ) . value . amount ;
@@ -198,11 +200,11 @@ describe("svm_spoke.refund_claims", () => {
198200 await executeRelayerRefundToClaim ( relayerRefund ) ;
199201
200202 // Claim refund for the relayer.
201- await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
203+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
202204
203205 // The claim account should have been automatically closed, so repeated claim should fail.
204206 try {
205- await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
207+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
206208 assert . fail ( "Claiming refund from closed account should fail" ) ;
207209 } catch ( error : any ) {
208210 assert . instanceOf ( error , AnchorError ) ;
@@ -216,7 +218,7 @@ describe("svm_spoke.refund_claims", () => {
216218 // After reinitalizing the claim account, the repeated claim should still fail.
217219 await initializeClaimAccount ( ) ;
218220 try {
219- await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
221+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
220222 assert . fail ( "Claiming refund from reinitalized account should fail" ) ;
221223 } catch ( error : any ) {
222224 assert . instanceOf ( error , AnchorError ) ;
@@ -235,7 +237,7 @@ describe("svm_spoke.refund_claims", () => {
235237 const iRelayerBal = ( await connection . getTokenAccountBalance ( tokenAccount ) ) . value . amount ;
236238
237239 // Claim refund for the relayer.
238- await await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
240+ await await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
239241
240242 // The relayer should have received both refunds.
241243 const fVaultBal = ( await connection . getTokenAccountBalance ( vault ) ) . value . amount ;
@@ -260,7 +262,7 @@ describe("svm_spoke.refund_claims", () => {
260262
261263 // Claiming with default initializer should fail.
262264 try {
263- await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
265+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
264266 } catch ( error : any ) {
265267 assert . instanceOf ( error , AnchorError ) ;
266268 assert . strictEqual (
@@ -272,7 +274,7 @@ describe("svm_spoke.refund_claims", () => {
272274
273275 // Claim refund for the relayer passing the correct initializer account.
274276 claimRelayerRefundAccounts . initializer = anotherInitializer . publicKey ;
275- await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
277+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
276278
277279 // The relayer should have received funds from the vault.
278280 const fVaultBal = ( await connection . getTokenAccountBalance ( vault ) ) . value . amount ;
@@ -344,7 +346,7 @@ describe("svm_spoke.refund_claims", () => {
344346 claimRelayerRefundAccounts . tokenAccount = wrongTokenAccount ;
345347
346348 try {
347- await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
349+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
348350 assert . fail ( "Claiming refund to custom token account should fail" ) ;
349351 } catch ( error : any ) {
350352 assert . instanceOf ( error , AnchorError ) ;
@@ -369,7 +371,7 @@ describe("svm_spoke.refund_claims", () => {
369371 await setAuthority ( connection , payer , wrongTokenAccount , wrongOwner , AuthorityType . AccountOwner , relayer . publicKey ) ;
370372
371373 try {
372- await program . methods . claimRelayerRefund ( relayer . publicKey ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
374+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
373375 assert . fail ( "Claiming refund to custom token account should fail" ) ;
374376 } catch ( error : any ) {
375377 assert . instanceOf ( error , AnchorError ) ;
@@ -396,11 +398,7 @@ describe("svm_spoke.refund_claims", () => {
396398 claimRelayerRefundAccounts . signer = relayer . publicKey ; // Only relayer itself should be able to do this.
397399
398400 // Relayer can claim refund to custom token account.
399- const tx = await program . methods
400- . claimRelayerRefund ( null )
401- . accounts ( claimRelayerRefundAccounts )
402- . signers ( [ relayer ] )
403- . rpc ( ) ;
401+ const tx = await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . signers ( [ relayer ] ) . rpc ( ) ;
404402
405403 // The relayer should have received funds from the vault.
406404 const fVaultBal = ( await connection . getTokenAccountBalance ( vault ) ) . value . amount ;
@@ -422,8 +420,9 @@ describe("svm_spoke.refund_claims", () => {
422420 await executeRelayerRefundToClaim ( relayerRefund ) ;
423421
424422 // Claim refund for the relayer with the default signer should fail as relayer address is part of claim account derivation.
423+ claimRelayerRefundAccounts . refundAddress = owner ;
425424 try {
426- await program . methods . claimRelayerRefund ( null ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
425+ await program . methods . claimRelayerRefund ( ) . accounts ( claimRelayerRefundAccounts ) . rpc ( ) ;
427426 assert . fail ( "Claiming refund with wrong signer should fail" ) ;
428427 } catch ( error : any ) {
429428 assert . instanceOf ( error , AnchorError ) ;
0 commit comments