# Deposit And Withdraw

## Query deposit address information

{% hint style="info" %}
Please refer to the official Phemex API Docs for the Required parameters.

<https://phemex-docs.github.io#query-deposit-address-information>
{% endhint %}

#### Function Name:

```javascript
getDepositAddress()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getDepositAddress(exchange, options) {
    try {
        let result = await exchange.getDepositAddress(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getDepositAddress(myPhemexExchange, {
         currency: "BTC",
         chainName: "BTC"
     });
```

## Query deposit history records

{% hint style="info" %}
Please refer to the official Phemex API Docs for the Required parameters.

<https://phemex-docs.github.io#query-deposit-history-records>
{% endhint %}

#### Function Name:

```javascript
getDepositHistory()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getDepositHistory(exchange, options) {
    try {
        let result = await exchange.getDepositHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getDepositHistory(myPhemexExchange, {
         currency: "BTC"
     });
```

## Query deposit chain settings

{% hint style="info" %}
Please refer to the official Phemex API Docs for the Required parameters.

<https://phemex-docs.github.io#query-deposit-chain-settings>
{% endhint %}

#### Function Name:

```javascript
getDepositChainSettings()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getDepositChainSettings(exchange, options) {
    try {
        let result = await exchange.getDepositChainSettings(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getDepositChainSettings(myMainPhemexExchange, {
         currency: "USDT"
     });
```

## Query withdraw history records

{% hint style="info" %}
Please refer to the official Phemex API Docs for the Required parameters.

<https://phemex-docs.github.io#query-withdraw-history-records>
{% endhint %}

#### Function Name:

```javascript
getWithdrawHistory()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getWithdrawHistory(exchange, options) {
    try {
        let result = await exchange.getWithdrawHistory(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getWithdrawHistory(myPhemexExchange, {
         currency: "BTC"
     });
```

## Create withdraw request

{% hint style="info" %}
Please refer to the official Phemex API Docs for the Required parameters.

<https://phemex-docs.github.io#create-withdraw-request>
{% endhint %}

#### Function Name:

```javascript
withdraw()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function withdraw(exchange, options) {
    try {
        let result = await exchange.withdraw(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await withdraw(myMainPhemexExchange, {
        currency: "USDT",
        address: "dalwkdmn55ownd22n",
        amount: "1",
        chainName: "ETH"
     });
```

## Cancel withdraw request

{% hint style="info" %}
Please refer to the official Phemex API Docs for the Required parameters.

<https://phemex-docs.github.io#cancel-withdraw-request>
{% endhint %}

#### Function Name:

```javascript
cancelWithdraw()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function cancelWithdraw(exchange, options) {
    try {
        let result = await exchange.cancelWithdraw(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelWithdraw(myMainPhemexExchange, {
        id: "fkjnklnlnm3mnpinpio3333"
     });
```

## Query withdraw chain settings

{% hint style="info" %}
Please refer to the official Phemex API Docs for the Required parameters.

<https://phemex-docs.github.io#query-withdraw-chain-settings>
{% endhint %}

#### Function Name:

```javascript
getWithdrawChainSettings()
```

#### Usage:

```javascript
import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getWithdrawChainSettings(exchange, options) {
    try {
        let result = await exchange.getWithdrawChainSettings(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getWithdrawChainSettings(myMainPhemexExchange, {
        currency: "USDT"
     });
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.compendium.finance/pendax/using-pendax-sdk/phemex-functions/deposit-and-withdraw.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
