make a withdrawal https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request :param str code: unified currency code :param float amount: the amount to withdraw :param str address: the address to withdraw to :param
(self, code: str, amount: float, address: str, tag: Str = None, params={})
| 2422 | return self.sign_hash(self.hash_message(message), privateKey[-64:]) |
| 2423 | |
| 2424 | async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}) -> Transaction: |
| 2425 | """ |
| 2426 | make a withdrawal |
| 2427 | |
| 2428 | https://orderly.network/docs/build-on-evm/evm-api/restful-api/private/create-withdraw-request |
| 2429 | |
| 2430 | :param str code: unified currency code |
| 2431 | :param float amount: the amount to withdraw |
| 2432 | :param str address: the address to withdraw to |
| 2433 | :param str tag: |
| 2434 | :param dict [params]: extra parameters specific to the exchange API endpoint |
| 2435 | :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>` |
| 2436 | """ |
| 2437 | await self.load_markets() |
| 2438 | self.check_address(address) |
| 2439 | if code is not None: |
| 2440 | code = code.upper() |
| 2441 | if code != 'USDC': |
| 2442 | raise NotSupported(self.id + ' withdraw() only support USDC') |
| 2443 | currency = self.currency(code) |
| 2444 | verifyingContractAddress = self.safe_string(self.options, 'verifyingContractAddress') |
| 2445 | chainId = self.safe_string(params, 'chainId') |
| 2446 | currencyNetworks = self.safe_dict(currency, 'networks', {}) |
| 2447 | coinNetwork = self.safe_dict(currencyNetworks, chainId, {}) |
| 2448 | coinNetworkId = self.safe_number(coinNetwork, 'id') |
| 2449 | if coinNetworkId is None: |
| 2450 | raise BadRequest(self.id + ' withdraw() require chainId parameter') |
| 2451 | withdrawNonce = await self.get_withdraw_nonce(params) |
| 2452 | nonce = self.nonce() |
| 2453 | domain = { |
| 2454 | 'chainId': chainId, |
| 2455 | 'name': 'Orderly', |
| 2456 | 'verifyingContract': verifyingContractAddress, |
| 2457 | 'version': '1', |
| 2458 | } |
| 2459 | messageTypes = { |
| 2460 | 'Withdraw': [ |
| 2461 | {'name': 'brokerId', 'type': 'string'}, |
| 2462 | {'name': 'chainId', 'type': 'uint256'}, |
| 2463 | {'name': 'receiver', 'type': 'address'}, |
| 2464 | {'name': 'token', 'type': 'string'}, |
| 2465 | {'name': 'amount', 'type': 'uint256'}, |
| 2466 | {'name': 'withdrawNonce', 'type': 'uint64'}, |
| 2467 | {'name': 'timestamp', 'type': 'uint64'}, |
| 2468 | ], |
| 2469 | } |
| 2470 | withdrawRequest = { |
| 2471 | 'brokerId': self.safe_string(self.options, 'keyBrokerId', 'mode'), |
| 2472 | 'chainId': self.parse_to_int(chainId), |
| 2473 | 'receiver': address, |
| 2474 | 'token': code, |
| 2475 | 'amount': str(amount), |
| 2476 | 'withdrawNonce': withdrawNonce, |
| 2477 | 'timestamp': nonce, |
| 2478 | } |
| 2479 | msg = self.eth_encode_structured_data(domain, messageTypes, withdrawRequest) |
| 2480 | signature = self.sign_message(msg, self.privateKey) |
| 2481 | request = { |
nothing calls this directly
no test coverage detected