@@ -237,32 +237,13 @@ impl<
237237 . await
238238 . map_err ( |e| log:: error!( "Could not get wallet from pumpx-signer: {:?}" , e) ) ?;
239239
240- let cross_order_data = CreateCrossOrderData {
241- request_id : intent_id,
242- chain_id : chain_id. clone ( ) ,
243- info : vec ! [ CrossOrderInfo {
244- chain_id: chain_id. clone( ) ,
245- wallet_index: pumpx_config. wallet_index,
246- address: wallet_address. to_hex( ) ,
247- amount: from_amount_string. clone( ) ,
248- usd: usd_worth,
249- token_ca: token_ca. clone( ) ,
250- } ] ,
251- } ;
252240 let storage = PumpxJwtStorage :: new ( self . storage_db . clone ( ) ) ;
253241 let Some ( access_token) = storage. get ( & ( account_id. clone ( ) , AUTH_TOKEN_ACCESS_TYPE ) )
254242 else {
255243 log:: error!( "Failed to get access token from storage" ) ;
256244 return Err ( ( ) ) ;
257245 } ;
258246
259- self . pumpx_api
260- . create_cross_order ( & access_token, cross_order_data)
261- . await
262- . map_err ( |_| {
263- log:: error!( "Failed to create cross order" ) ;
264- } ) ?;
265-
266247 let pumpx_order_response: Option < Vec < u8 > > ;
267248
268249 if swap_order. from_asset . is_same_chain ( & swap_order. to_asset ) {
@@ -451,6 +432,26 @@ impl<
451432 } ;
452433 pumpx_order_response = Some ( order_response) ;
453434 } else {
435+ // notify backend about it
436+ let cross_order_data = CreateCrossOrderData {
437+ request_id : intent_id,
438+ chain_id : chain_id. clone ( ) ,
439+ info : vec ! [ CrossOrderInfo {
440+ chain_id: chain_id. clone( ) ,
441+ wallet_index: pumpx_config. wallet_index,
442+ address: wallet_address. to_hex( ) ,
443+ amount: from_amount_string. clone( ) ,
444+ usd: usd_worth,
445+ token_ca: token_ca. clone( ) ,
446+ } ] ,
447+ } ;
448+ self . pumpx_api
449+ . create_cross_order ( & access_token, cross_order_data)
450+ . await
451+ . map_err ( |_| {
452+ log:: error!( "Failed to create cross order" ) ;
453+ } ) ?;
454+
454455 //TODO: execute cross-chain swap
455456 // to binance swap, If it fails, notify the backend via /v3/trade/cross_fail
456457 // TODO:
0 commit comments