Withdraw money

POST /withdraw

process withdraw request to orderbook and return its hash

{
    "maker": str,
    "token": str,
    "amount": {"type": int, "min": 0},
    "salt": {"type": int, "min": 0},
    "receiver": str,
    "sign": {"type": list, "min_size": 2, "max_size": 2, "item_schema": {"type": int, "min": 0}},
    "gas_fee": {
        "type": dict, 
        "fields": {
            "gas_per_action": {"type": int, "min": 0},
            "fee_token": str,
            "max_gas_price": {"type": int, "min": 0},
            "conversion_rate": {"type": list, "min_size": 2, "max_size": 2, "item_schema": {"type": int, "min": 0}}
        }
    }
}

Parameters:

  • maker:

    • Type: String

    • Description: Address of the user initiating the withdrawal.

  • token:

    • Type: String

    • Description: The address of the token to be withdrawn.

  • amount:

    • Type: Integer

    • Description: The quantity of tokens to withdraw.

    • Constraints: Must be a non-negative integer.

  • salt:

    • Type: Integer

    • Description: A random value used to ensure the uniqueness of the withdrawal request.

    • Constraints: Must be a non-negative integer.

  • receiver:

    • Type: String

    • Description: Address of the receiver of the withdrawn tokens.

  • sign:

    • Type: List

    • Description: Signature data required to authorize the withdrawal.

    • Constraints: Must be a list containing exactly 2 integer items, each of which should be non-negative.

    • To sign a withdrawal request, one needs first to obtain the Poseidon hash of the withdraw entity (see) and then sign it by the private key.

  • gas_fee:

    • Type: Dictionary

    • Description: Information about the gas fee associated with the withdrawal.

    • Fields:

      • gas_per_action: Integer, minimum 0, representing the gas cost per action.

      • fee_token: String, indicating the token used for the fee.

      • max_gas_price: Integer, minimum 0, the maximum price per gas unit.

      • conversion_rate: List of integers, with minimum size 2 and maximum size 2, each element being non-negative, representing the conversion rate.

Response example:

In case of a successful place, the order hash is returned

{
    'result': 12345 // withdraw request hash
}

Success operation means the request successfully passed the validation phase and is now in the request processing queue.

In case of unsuccessful request, the error and code are returned (see)

Last updated