This repository was archived by the owner on Mar 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-7
lines changed Expand file tree Collapse file tree 1 file changed +30
-7
lines changed Original file line number Diff line number Diff line change @@ -1166,21 +1166,44 @@ where
1166
1166
let multisig_signers = self . get_multisig_signers ( authority, & signing_pubkeys) ;
1167
1167
let decimals = self . decimals . ok_or ( TokenError :: MissingDecimals ) ?;
1168
1168
1169
- self . process_ixs (
1170
- & [ transfer_fee:: instruction:: transfer_checked_with_fee (
1169
+ let fetch_account_data_fn = |address| {
1170
+ self . client
1171
+ . get_account ( address)
1172
+ . map_ok ( |opt| opt. map ( |acc| acc. data ) )
1173
+ } ;
1174
+
1175
+ let instruction = if let Some ( transfer_hook_accounts) = & self . transfer_hook_accounts {
1176
+ let mut instruction = transfer_fee:: instruction:: transfer_checked_with_fee (
1171
1177
& self . program_id ,
1172
1178
source,
1173
- & self . pubkey ,
1179
+ self . get_address ( ) ,
1174
1180
destination,
1175
1181
authority,
1176
1182
& multisig_signers,
1177
1183
amount,
1178
1184
decimals,
1179
1185
fee,
1180
- ) ?] ,
1181
- signing_keypairs,
1182
- )
1183
- . await
1186
+ ) ?;
1187
+ instruction. accounts . extend ( transfer_hook_accounts. clone ( ) ) ;
1188
+ instruction
1189
+ } else {
1190
+ offchain:: create_transfer_checked_with_fee_instruction_with_extra_metas (
1191
+ & self . program_id ,
1192
+ source,
1193
+ self . get_address ( ) ,
1194
+ destination,
1195
+ authority,
1196
+ & multisig_signers,
1197
+ amount,
1198
+ decimals,
1199
+ fee,
1200
+ fetch_account_data_fn,
1201
+ )
1202
+ . await
1203
+ . map_err ( |_| TokenError :: AccountNotFound ) ?
1204
+ } ;
1205
+
1206
+ self . process_ixs ( & [ instruction] , signing_keypairs) . await
1184
1207
}
1185
1208
1186
1209
/// Burn tokens from account
You can’t perform that action at this time.
0 commit comments