@@ -105,7 +105,7 @@ pub enum SwapInstruction {
105
105
/// Must be empty, not owned by swap authority
106
106
/// 6. `[writable]` Pool Token Account to deposit the initial pool token
107
107
/// supply. Must be empty, not owned by swap authority.
108
- /// 7. `[]` Token program id
108
+ /// 7. `[]` Pool Token program id
109
109
Initialize ( Initialize ) ,
110
110
111
111
/// Swap the tokens in the pool.
@@ -119,8 +119,10 @@ pub enum SwapInstruction {
119
119
/// 6. `[writable]` token_(A|B) DESTINATION Account assigned to USER as the owner.
120
120
/// 7. `[writable]` Pool token mint, to generate trading fees
121
121
/// 8. `[writable]` Fee account, to receive trading fees
122
- /// 9. `[]` Token program id
123
- /// 10. `[optional, writable]` Host fee account to receive additional trading fees
122
+ /// 9. `[]` Token (A|B) SOURCE program id
123
+ /// 10. `[]` Token (A|B) DESTINATION program id
124
+ /// 11. `[]` Pool Token program id
125
+ /// 12. `[optional, writable]` Host fee account to receive additional trading fees
124
126
Swap ( Swap ) ,
125
127
126
128
/// Deposit both types of tokens into the pool. The output is a "pool"
@@ -136,7 +138,9 @@ pub enum SwapInstruction {
136
138
/// 6. `[writable]` token_b Base Account to deposit into.
137
139
/// 7. `[writable]` Pool MINT account, swap authority is the owner.
138
140
/// 8. `[writable]` Pool Account to deposit the generated tokens, user is the owner.
139
- /// 9. `[]` Token program id
141
+ /// 9. `[]` Token A program id
142
+ /// 10. `[]` Token B program id
143
+ /// 11. `[]` Pool Token program id
140
144
DepositAllTokenTypes ( DepositAllTokenTypes ) ,
141
145
142
146
/// Withdraw both types of tokens from the pool at the current ratio, given
@@ -153,7 +157,9 @@ pub enum SwapInstruction {
153
157
/// 7. `[writable]` token_a user Account to credit.
154
158
/// 8. `[writable]` token_b user Account to credit.
155
159
/// 9. `[writable]` Fee account, to receive withdrawal fees
156
- /// 10. `[]` Token program id
160
+ /// 10. `[]` Pool Token program id
161
+ /// 11. `[]` Token A program id
162
+ /// 12. `[]` Token B program id
157
163
WithdrawAllTokenTypes ( WithdrawAllTokenTypes ) ,
158
164
159
165
/// Deposit one type of tokens into the pool. The output is a "pool" token
@@ -168,7 +174,8 @@ pub enum SwapInstruction {
168
174
/// 5. `[writable]` token_b Swap Account, may deposit INTO.
169
175
/// 6. `[writable]` Pool MINT account, swap authority is the owner.
170
176
/// 7. `[writable]` Pool Account to deposit the generated tokens, user is the owner.
171
- /// 8. `[]` Token program id
177
+ /// 8. `[]` Token (A|B) SOURCE program id
178
+ /// 9. `[]` Pool Token program id
172
179
DepositSingleTokenTypeExactAmountIn ( DepositSingleTokenTypeExactAmountIn ) ,
173
180
174
181
/// Withdraw one token type from the pool at the current ratio given the
@@ -183,7 +190,8 @@ pub enum SwapInstruction {
183
190
/// 6. `[writable]` token_b Swap Account to potentially withdraw from.
184
191
/// 7. `[writable]` token_(A|B) User Account to credit
185
192
/// 8. `[writable]` Fee account, to receive withdrawal fees
186
- /// 9. `[]` Token program id
193
+ /// 9. `[]` Pool Token program id
194
+ /// 10. `[]` Token (A|B) DESTINATION program id
187
195
WithdrawSingleTokenTypeExactAmountOut ( WithdrawSingleTokenTypeExactAmountOut ) ,
188
196
}
189
197
@@ -366,7 +374,9 @@ pub fn initialize(
366
374
/// Creates a 'deposit_all_token_types' instruction.
367
375
pub fn deposit_all_token_types (
368
376
program_id : & Pubkey ,
369
- token_program_id : & Pubkey ,
377
+ token_a_program_id : & Pubkey ,
378
+ token_b_program_id : & Pubkey ,
379
+ pool_token_program_id : & Pubkey ,
370
380
swap_pubkey : & Pubkey ,
371
381
authority_pubkey : & Pubkey ,
372
382
user_transfer_authority_pubkey : & Pubkey ,
@@ -390,7 +400,9 @@ pub fn deposit_all_token_types(
390
400
AccountMeta :: new( * swap_token_b_pubkey, false ) ,
391
401
AccountMeta :: new( * pool_mint_pubkey, false ) ,
392
402
AccountMeta :: new( * destination_pubkey, false ) ,
393
- AccountMeta :: new_readonly( * token_program_id, false ) ,
403
+ AccountMeta :: new_readonly( * token_a_program_id, false ) ,
404
+ AccountMeta :: new_readonly( * token_b_program_id, false ) ,
405
+ AccountMeta :: new_readonly( * pool_token_program_id, false ) ,
394
406
] ;
395
407
396
408
Ok ( Instruction {
@@ -403,7 +415,9 @@ pub fn deposit_all_token_types(
403
415
/// Creates a 'withdraw_all_token_types' instruction.
404
416
pub fn withdraw_all_token_types (
405
417
program_id : & Pubkey ,
406
- token_program_id : & Pubkey ,
418
+ pool_token_program_id : & Pubkey ,
419
+ token_a_program_id : & Pubkey ,
420
+ token_b_program_id : & Pubkey ,
407
421
swap_pubkey : & Pubkey ,
408
422
authority_pubkey : & Pubkey ,
409
423
user_transfer_authority_pubkey : & Pubkey ,
@@ -429,7 +443,9 @@ pub fn withdraw_all_token_types(
429
443
AccountMeta :: new( * destination_token_a_pubkey, false ) ,
430
444
AccountMeta :: new( * destination_token_b_pubkey, false ) ,
431
445
AccountMeta :: new( * fee_account_pubkey, false ) ,
432
- AccountMeta :: new_readonly( * token_program_id, false ) ,
446
+ AccountMeta :: new_readonly( * pool_token_program_id, false ) ,
447
+ AccountMeta :: new_readonly( * token_a_program_id, false ) ,
448
+ AccountMeta :: new_readonly( * token_b_program_id, false ) ,
433
449
] ;
434
450
435
451
Ok ( Instruction {
@@ -442,7 +458,8 @@ pub fn withdraw_all_token_types(
442
458
/// Creates a 'deposit_single_token_type_exact_amount_in' instruction.
443
459
pub fn deposit_single_token_type_exact_amount_in (
444
460
program_id : & Pubkey ,
445
- token_program_id : & Pubkey ,
461
+ source_token_program_id : & Pubkey ,
462
+ pool_token_program_id : & Pubkey ,
446
463
swap_pubkey : & Pubkey ,
447
464
authority_pubkey : & Pubkey ,
448
465
user_transfer_authority_pubkey : & Pubkey ,
@@ -464,7 +481,8 @@ pub fn deposit_single_token_type_exact_amount_in(
464
481
AccountMeta :: new( * swap_token_b_pubkey, false ) ,
465
482
AccountMeta :: new( * pool_mint_pubkey, false ) ,
466
483
AccountMeta :: new( * destination_pubkey, false ) ,
467
- AccountMeta :: new_readonly( * token_program_id, false ) ,
484
+ AccountMeta :: new_readonly( * source_token_program_id, false ) ,
485
+ AccountMeta :: new_readonly( * pool_token_program_id, false ) ,
468
486
] ;
469
487
470
488
Ok ( Instruction {
@@ -477,7 +495,8 @@ pub fn deposit_single_token_type_exact_amount_in(
477
495
/// Creates a 'withdraw_single_token_type_exact_amount_out' instruction.
478
496
pub fn withdraw_single_token_type_exact_amount_out (
479
497
program_id : & Pubkey ,
480
- token_program_id : & Pubkey ,
498
+ pool_token_program_id : & Pubkey ,
499
+ destination_token_program_id : & Pubkey ,
481
500
swap_pubkey : & Pubkey ,
482
501
authority_pubkey : & Pubkey ,
483
502
user_transfer_authority_pubkey : & Pubkey ,
@@ -501,7 +520,8 @@ pub fn withdraw_single_token_type_exact_amount_out(
501
520
AccountMeta :: new( * swap_token_b_pubkey, false ) ,
502
521
AccountMeta :: new( * destination_pubkey, false ) ,
503
522
AccountMeta :: new( * fee_account_pubkey, false ) ,
504
- AccountMeta :: new_readonly( * token_program_id, false ) ,
523
+ AccountMeta :: new_readonly( * pool_token_program_id, false ) ,
524
+ AccountMeta :: new_readonly( * destination_token_program_id, false ) ,
505
525
] ;
506
526
507
527
Ok ( Instruction {
@@ -514,7 +534,9 @@ pub fn withdraw_single_token_type_exact_amount_out(
514
534
/// Creates a 'swap' instruction.
515
535
pub fn swap (
516
536
program_id : & Pubkey ,
517
- token_program_id : & Pubkey ,
537
+ source_token_program_id : & Pubkey ,
538
+ destination_token_program_id : & Pubkey ,
539
+ pool_token_program_id : & Pubkey ,
518
540
swap_pubkey : & Pubkey ,
519
541
authority_pubkey : & Pubkey ,
520
542
user_transfer_authority_pubkey : & Pubkey ,
@@ -539,7 +561,9 @@ pub fn swap(
539
561
AccountMeta :: new( * destination_pubkey, false ) ,
540
562
AccountMeta :: new( * pool_mint_pubkey, false ) ,
541
563
AccountMeta :: new( * pool_fee_pubkey, false ) ,
542
- AccountMeta :: new_readonly( * token_program_id, false ) ,
564
+ AccountMeta :: new_readonly( * source_token_program_id, false ) ,
565
+ AccountMeta :: new_readonly( * destination_token_program_id, false ) ,
566
+ AccountMeta :: new_readonly( * pool_token_program_id, false ) ,
543
567
] ;
544
568
if let Some ( host_fee_pubkey) = host_fee_pubkey {
545
569
accounts. push ( AccountMeta :: new ( * host_fee_pubkey, false ) ) ;
0 commit comments