|
26 | 26 | sign_convert_to_multi_sig_user_action, |
27 | 27 | sign_l1_action, |
28 | 28 | sign_multi_sig_action, |
29 | | - sign_perp_dex_class_transfer_action, |
| 29 | + sign_send_asset_action, |
30 | 30 | sign_spot_transfer_action, |
31 | 31 | sign_token_delegate_action, |
32 | 32 | sign_usd_class_transfer_action, |
@@ -456,21 +456,25 @@ def usd_class_transfer(self, amount: float, to_perp: bool) -> Any: |
456 | 456 | timestamp, |
457 | 457 | ) |
458 | 458 |
|
459 | | - def perp_dex_class_transfer(self, dex: str, token: str, amount: float, to_perp: bool) -> Any: |
| 459 | + def send_asset(self, destination: str, source_dex: str, destination_dex: str, token: str, amount: float) -> Any: |
| 460 | + """ |
| 461 | + For the default perp dex use the empty string "" as name. For spot use "spot". |
| 462 | + Token must match the collateral token if transferring to or from a perp dex. |
| 463 | + """ |
460 | 464 | timestamp = get_timestamp_ms() |
461 | 465 | str_amount = str(amount) |
462 | | - if self.vault_address: |
463 | | - str_amount += f" subaccount:{self.vault_address}" |
464 | 466 |
|
465 | 467 | action = { |
466 | | - "type": "PerpDexClassTransfer", |
467 | | - "dex": dex, |
| 468 | + "type": "sendAsset", |
| 469 | + "destination": destination, |
| 470 | + "sourceDex": source_dex, |
| 471 | + "destinationDex": destination_dex, |
468 | 472 | "token": token, |
469 | 473 | "amount": str_amount, |
470 | | - "toPerp": to_perp, |
| 474 | + "fromSubAccount": self.vault_address if self.vault_address else "", |
471 | 475 | "nonce": timestamp, |
472 | 476 | } |
473 | | - signature = sign_perp_dex_class_transfer_action(self.wallet, action, self.base_url == MAINNET_API_URL) |
| 477 | + signature = sign_send_asset_action(self.wallet, action, self.base_url == MAINNET_API_URL) |
474 | 478 | return self._post_action( |
475 | 479 | action, |
476 | 480 | signature, |
@@ -917,13 +921,11 @@ def perp_deploy_set_oracle( |
917 | 921 | self, |
918 | 922 | dex: str, |
919 | 923 | oracle_pxs: Dict[str, str], |
920 | | - mark_pxs: Optional[Dict[str, str]], |
| 924 | + all_mark_pxs: List[Dict[str, str]], |
921 | 925 | ) -> Any: |
922 | 926 | timestamp = get_timestamp_ms() |
923 | 927 | oracle_pxs_wire = sorted(list(oracle_pxs.items())) |
924 | | - mark_pxs_wire = None |
925 | | - if mark_pxs is not None: |
926 | | - mark_pxs_wire = sorted(list(mark_pxs.items())) |
| 928 | + mark_pxs_wire = [sorted(list(mark_pxs.items())) for mark_pxs in all_mark_pxs] |
927 | 929 | action = { |
928 | 930 | "type": "perpDeploy", |
929 | 931 | "setOracle": { |
|
0 commit comments