@@ -39,7 +39,7 @@ impl FromStr for SolanaTransaction {
3939 fn from_str ( tx : & str ) -> Result < Self , Self :: Err > {
4040 let tx = bs58:: decode ( tx)
4141 . into_vec ( )
42- . map_err ( |e| TransactionError :: Message ( format ! ( "{}" , e ) ) ) ?;
42+ . map_err ( |e| TransactionError :: Message ( format ! ( "{e}" ) ) ) ?;
4343 SolanaTransaction :: from_bytes ( & tx)
4444 }
4545}
@@ -158,7 +158,7 @@ impl Transaction for SolanaTransaction {
158158
159159 fn from_bytes ( tx : & [ u8 ] ) -> Result < Self , TransactionError > {
160160 let tx = bincode:: deserialize :: < Tx > ( tx)
161- . map_err ( |e| TransactionError :: Message ( format ! ( "{}" , e ) ) ) ?;
161+ . map_err ( |e| TransactionError :: Message ( format ! ( "{e}" ) ) ) ?;
162162
163163 let sig = if !tx. signatures . is_empty ( ) {
164164 let rs = tx. signatures [ 0 ] ;
@@ -178,13 +178,13 @@ impl Transaction for SolanaTransaction {
178178 let program = keys[ ixs[ 0 ] . program_id_index as usize ] ;
179179 let account = & ixs[ 0 ] . accounts ;
180180 let data = & ixs[ 0 ] . data ;
181- match format ! ( "{}" , program ) . as_str ( ) {
181+ match format ! ( "{program}" ) . as_str ( ) {
182182 "11111111111111111111111111111111" => {
183183 let from = keys[ account[ 0 ] as usize ] ;
184184 let to = keys[ account[ 1 ] as usize ] ;
185185
186186 let ix = bincode:: deserialize :: < SystemInstruction > ( data)
187- . map_err ( |e| TransactionError :: Message ( format ! ( "{}" , e ) ) ) ?;
187+ . map_err ( |e| TransactionError :: Message ( format ! ( "{e}" ) ) ) ?;
188188
189189 match ix {
190190 SystemInstruction :: Transfer { lamports } => {
@@ -202,8 +202,7 @@ impl Transaction for SolanaTransaction {
202202 Ok ( tx)
203203 }
204204 _ => Err ( TransactionError :: Message ( format ! (
205- "Unsupported system instruction: {:?}" ,
206- ix
205+ "Unsupported system instruction: {ix:?}"
207206 ) ) ) ,
208207 }
209208 }
@@ -213,7 +212,7 @@ impl Transaction for SolanaTransaction {
213212 let from = keys[ account[ 3 ] as usize ] ;
214213
215214 let ix = TokenInstruction :: unpack ( data)
216- . map_err ( |e| TransactionError :: Message ( format ! ( "{}" , e ) ) ) ?;
215+ . map_err ( |e| TransactionError :: Message ( format ! ( "{e}" ) ) ) ?;
217216
218217 match ix {
219218 TokenInstruction :: TransferChecked { amount, decimals } => {
@@ -231,35 +230,29 @@ impl Transaction for SolanaTransaction {
231230 Ok ( tx)
232231 }
233232 _ => Err ( TransactionError :: Message ( format ! (
234- "Unsupported token instruction: {:?}" ,
235- ix
233+ "Unsupported token instruction: {ix:?}"
236234 ) ) ) ,
237235 }
238236 }
239237 _ => Err ( TransactionError :: Message ( format ! (
240- "Unsupported program {}" ,
241- program
238+ "Unsupported program {program}"
242239 ) ) ) ,
243240 }
244241 }
245242 2 => {
246243 let program1 = keys[ ixs[ 0 ] . program_id_index as usize ] ;
247244 let program2 = keys[ ixs[ 1 ] . program_id_index as usize ] ;
248245
249- if format ! ( "{}" , program1) . as_str ( )
250- != "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
246+ if format ! ( "{program1}" ) . as_str ( ) != "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
251247 {
252248 return Err ( TransactionError :: Message ( format ! (
253- "Unsupported first program {}" ,
254- program1
249+ "Unsupported first program {program1}"
255250 ) ) ) ;
256251 }
257252
258- if format ! ( "{}" , program2) . as_str ( ) != "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
259- {
253+ if format ! ( "{program2}" ) . as_str ( ) != "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" {
260254 return Err ( TransactionError :: Message ( format ! (
261- "Unsupported second program {}" ,
262- program2
255+ "Unsupported second program {program2}"
263256 ) ) ) ;
264257 }
265258
@@ -271,7 +264,7 @@ impl Transaction for SolanaTransaction {
271264 let token_address = keys[ account[ 3 ] as usize ] ;
272265
273266 let ix = TokenInstruction :: unpack ( data)
274- . map_err ( |e| TransactionError :: Message ( format ! ( "{}" , e ) ) ) ?;
267+ . map_err ( |e| TransactionError :: Message ( format ! ( "{e}" ) ) ) ?;
275268
276269 match ix {
277270 TokenInstruction :: TransferChecked { amount, decimals } => {
@@ -289,8 +282,7 @@ impl Transaction for SolanaTransaction {
289282 Ok ( tx)
290283 }
291284 _ => Err ( TransactionError :: Message ( format ! (
292- "Unsupported token instruction: {:?}" ,
293- ix
285+ "Unsupported token instruction: {ix:?}"
294286 ) ) ) ,
295287 }
296288 }
@@ -320,5 +312,5 @@ fn test() {
320312 let tx = "BU8oN58NjvzGdbuQ8zGKF9cJ7N25iWRRgnLodf42gEVDnzcQ3g5y7eygBviCRQHH4sC335gt575JA2NfjpX3P7m1vZ5WYWxHem7wW3Pc4S6YYi4ftivYiGqTMr6eKtUVCbBZabwyMuZ7iGjUtTB6L7LnfQj6wGduNUqwpGPy2xD8aFps6zRfgwNAXe9tpoa3tQvTnyU8WgkpiZjkBFdfXFw8abhsUZLZsxaYra2CHmqrXwG6VFUfhTdYANPTXcBcZ2a75RmqC19d5rYJPexmpGJV529A4WXgE4Pm5Gk5AUB7LcNmAxfkKxJk3ikGohb9n3B7vJ3T9zJZg4i6xEGapobavsLwMuYkCjnRBQ69rouMCJEtz33XNuwx1ZN84cGimZV1KSbwQgcPDFzgdZR2ZisViDWAJUXkadfCfADNEME1jxmHDy7oX9gTYJvkeZAnoFjxVhKrVZft8FaADcRgNcdZJPdt9rMMSpCJXBFgBVsGaqo6iteJqg79qQrEoScRviUh6scB7iwCh" ;
321313 let tx = SolanaTransaction :: from_str ( tx) . unwrap ( ) ;
322314 let txid = tx. to_transaction_id ( ) . unwrap ( ) ;
323- println ! ( "{}" , txid ) ;
315+ println ! ( "{txid}" ) ;
324316}
0 commit comments