@@ -18,7 +18,7 @@ import {
18
18
createAssociatedTokenAccountInstruction ,
19
19
createMintToInstruction ,
20
20
getAssociatedTokenAddressSync ,
21
- createTransferCheckedWithTransferHookInstruction
21
+ createTransferCheckedWithTransferHookInstruction ,
22
22
} from "@solana/spl-token" ;
23
23
24
24
describe ( "transfer-hook" , ( ) => {
@@ -59,7 +59,7 @@ describe("transfer-hook", () => {
59
59
[ Buffer . from ( "extra-account-metas" ) , mint . publicKey . toBuffer ( ) ] ,
60
60
program . programId
61
61
) ;
62
-
62
+
63
63
const [ counterPDA ] = PublicKey . findProgramAddressSync (
64
64
[ Buffer . from ( "counter" ) ] ,
65
65
program . programId
@@ -98,13 +98,15 @@ describe("transfer-hook", () => {
98
98
provider . connection ,
99
99
transaction ,
100
100
[ wallet . payer , mint ] ,
101
- { skipPreflight : true , commitment : "finalized" }
101
+ { skipPreflight : true , commitment : "finalized" }
102
102
) ;
103
103
104
- const txDetails = await program . provider . connection . getTransaction ( txSig , { maxSupportedTransactionVersion : 0 , commitment : 'confirmed' } ) ;
104
+ const txDetails = await program . provider . connection . getTransaction ( txSig , {
105
+ maxSupportedTransactionVersion : 0 ,
106
+ commitment : "confirmed" ,
107
+ } ) ;
105
108
console . log ( txDetails . meta . logMessages ) ;
106
109
107
-
108
110
console . log ( `Transaction Signature: ${ txSig } ` ) ;
109
111
} ) ;
110
112
@@ -170,7 +172,7 @@ describe("transfer-hook", () => {
170
172
provider . connection ,
171
173
transaction ,
172
174
[ wallet . payer ] ,
173
- { skipPreflight : true , commitment : "confirmed" }
175
+ { skipPreflight : true , commitment : "confirmed" }
174
176
) ;
175
177
console . log ( "Transaction Signature:" , txSig ) ;
176
178
} ) ;
@@ -180,27 +182,29 @@ describe("transfer-hook", () => {
180
182
const amount = 1 * 10 ** decimals ;
181
183
const amountBigInt = BigInt ( amount ) ;
182
184
183
- let transferInstructionWithHelper = await createTransferCheckedWithTransferHookInstruction (
184
- connection ,
185
- sourceTokenAccount ,
186
- mint . publicKey ,
187
- destinationTokenAccount ,
188
- wallet . publicKey ,
189
- amountBigInt ,
190
- decimals ,
191
- [ ] ,
192
- "confirmed" ,
193
- TOKEN_2022_PROGRAM_ID ,
194
- ) ;
185
+ let transferInstructionWithHelper =
186
+ await createTransferCheckedWithTransferHookInstruction (
187
+ connection ,
188
+ sourceTokenAccount ,
189
+ mint . publicKey ,
190
+ destinationTokenAccount ,
191
+ wallet . publicKey ,
192
+ amountBigInt ,
193
+ decimals ,
194
+ [ ] ,
195
+ "confirmed" ,
196
+ TOKEN_2022_PROGRAM_ID
197
+ ) ;
195
198
196
199
console . log ( "Extra accounts meta: " + extraAccountMetaListPDA ) ;
197
200
console . log ( "Counter PDa: " + counterPDA ) ;
198
- console . log ( "Transfer Instruction: " + JSON . stringify ( transferInstructionWithHelper ) ) ;
199
-
200
- const transaction = new Transaction ( ) . add (
201
- transferInstructionWithHelper
201
+ console . log (
202
+ "Transfer Instruction: " +
203
+ JSON . stringify ( transferInstructionWithHelper , null , 2 )
202
204
) ;
203
205
206
+ const transaction = new Transaction ( ) . add ( transferInstructionWithHelper ) ;
207
+
204
208
const txSig = await sendAndConfirmTransaction (
205
209
connection ,
206
210
transaction ,
0 commit comments