2424 order_spec_to_order_wire ,
2525 sign_l1_action ,
2626 sign_usd_transfer_action ,
27+ sign_withdraw_from_bridge_action ,
2728 sign_agent ,
2829 str_to_bytes16 ,
2930)
@@ -335,7 +336,7 @@ def update_isolated_margin(self, amount: float, coin: str) -> Any:
335336 timestamp ,
336337 )
337338
338- def usd_tranfer (self , amount : float , destination : str ) -> Any :
339+ def usd_transfer (self , amount : float , destination : str ) -> Any :
339340 timestamp = get_timestamp_ms ()
340341 payload = {
341342 "destination" : destination ,
@@ -354,6 +355,25 @@ def usd_tranfer(self, amount: float, destination: str) -> Any:
354355 timestamp ,
355356 )
356357
358+ def withdraw_from_bridge (self , usd : float , destination : str ) -> Any :
359+ timestamp = get_timestamp_ms ()
360+ payload = {
361+ "destination" : destination ,
362+ "usd" : str (usd ),
363+ "time" : timestamp ,
364+ }
365+ is_mainnet = self .base_url == MAINNET_API_URL
366+ signature = sign_withdraw_from_bridge_action (self .wallet , payload , is_mainnet )
367+ return self ._post_action (
368+ {
369+ "chain" : "Arbitrum" if is_mainnet else "ArbitrumTestnet" ,
370+ "payload" : payload ,
371+ "type" : "withdraw2" ,
372+ },
373+ signature ,
374+ timestamp ,
375+ )
376+
357377 def approve_agent (self , name : Optional [str ] = None ) -> Tuple [Any , str ]:
358378 agent_key = "0x" + secrets .token_hex (32 )
359379 account = eth_account .Account .from_key (agent_key )
0 commit comments