Hyper API

Use this API to integrate Hypertrade R1 on HyperEVM + HyperCore.

Base URL:

Deposit Contract Address:

Router Contract Address:

To execute a swap, you must follow the steps in order

  1. Send a POST request to /getSwapInfo to get the details of the upcoming transaction and the exchange rate. 1. Find route & get transaction

  2. Send a POST request to /swap to create a swap request and get its ID. 2. Create a swap request

  3. Based on the /getSwapInfo data, execute the transaction on behalf of the user. 3. Execute the transaction on behalf of the user

  4. Send a GET request to /getSwapById to obtain the swap status. 4. Get swap information

  5. If the user has rejected the deposit transaction (e.g., in Metamask), it is important to close the swap. 5. Close an undeposited swap if the user has rejected the transaction

  6. Information for correct processing of swap statuses. 6. Swap request statuses

⚠️ Important note: data priority for transactions

1. Find route & get transaction

POST /trade/getSwapInfo

Returns the optimal routing path for a tokens. Provides the full route details, expected output amount, and raw transaction data for simulation purposes.

Request Body:

{
  "inputAmount": "1000000",
  "slippage": 0.3,
  "inputTokenAddress": "0x...",
  "outputTokenAddress": "0x...",
  "feeAddress": "0x...",
  "feeBps": 1,
  "enableHyperCore": true
}

Parameters:

Name
Type
Description
Required

inputAmount

wei

Raw input token amount in atomic units (value × 10^decimals).

Non-negative integer for precision.

yes

slippage

number

Maximum slippage tolerance.

yes

inputTokenAddress

address

Contract address of the input token.

yes

outputTokenAddress

address

Contract address of the output token.

yes

feeAddress

address

Your address for receiving commissions from swaps, including positive slippage shares (requires address approval from our side for positive slippage).

optional

feeBps

number

Your commission in basis points (100 = 1%). Max: 100.

optional

enableHyperCore

boolean

Enable cross-chain multi-hop routing between HyperEVM and HyperCore. This allows to use intermediary tokens from both networks in a single route.

optional

✅ Successful Response (200 OK):

{
  "action": "evm|core",
  "economy": "123.45",
  "fee": "123.45",
  "outputAmount": "123.45",
  "routeCore": {
    "path": [
      "string"
    ],
    "pathIndexes": [
      0
    ]
  },
  "routeEvm": [
    {
      "inputTokenAddress": "string",
      "outputTokenAddress": "string",
      "splits": [
        {
          "dex": "string",
          "fee": 0,
          "poolAddress": "string",
          "portion": 0
        }
      ]
    }
  ],
  "slippage": "123.45",
  "to": "0x...Contract address",
  "transaction": "evm:0xabc123...Raw-transaction for swap execution.|core:spotSend",
  "transactionValue": "1000000"
}

2. Create a swap request

POST /trade/swap

Creates a swap request or returns direct transaction data for immediate execution.

Request Body:

{
  "userAddress": "0x...",
  "recipientAddress": "0x...",
  "inputAmount": "1000000",
  "slippage": 0.3,
  "inputTokenAddress": "0x...",
  "outputTokenAddress": "0x...",
  "feeAddress": "0x...",
  "feeBps": 1,
  "enableHyperCore": true
}

Parameters:

Name
Type
Description
Required

userAddress

address

User's wallet address for the swap.

yes

recipientAddress

address

Address for sending output tokens post-swap. Defaults to userAddress; optionally use a different one.

optional

inputAmount

wei

Raw input token amount in atomic units (value × 10^decimals).

Non-negative integer for precision.

yes

slippage

number

Maximum slippage tolerance.

yes

inputTokenAddress

address

Contract address of the input token.

yes

outputTokenAddress

address

Contract address of the output token.

yes

feeAddress

address

Your address for receiving commissions from swaps, including positive slippage shares (requires address approval from our side for positive slippage).

optional

feeBps

bps

Your commission in basis points (100 = 1%). Max: 100.

optional

enableHyperCore

boolean

Enable cross-chain multi-hop routing between HyperEVM and HyperCore. This allows to use intermediary tokens from both networks in a single route.

optional

✅ Successful Response (200 OK):

⚠️ Don't forget important note: data priority for transactions

{
  "amount_in": 0,
  "amount_out": 0,
  "created_at": "string",
  "deposit_core_tx_hash": "string",
  "deposit_evm_tx_hash": "string",
  "fee_gas": 0,
  "fee_our": 0,
  "id": "string",
  "integration_fee_address": "string",
  "integration_fee_bps": 0,
  "recipient": "string",
  "retries_count": 0,
  "route": "string",
  "slippage": 0,
  "status": 0,
  "status_extra": 0,
  "token_in": "string",
  "token_out": "string",
  "updated_at": "string",
  "usd_amount": 0,
  "wallet": "string"
}

3. Execute the transaction on behalf of the user

4. Get swap information

GET /trade/getSwapById

Retrieves the current status of a created swap request by its ID and User Wallet.

Request:

/trade/getSwapById?id={id}&wallet={wallet}

Parameters:

Name
Type
Description
Required

id

string

Swap ID returns in /swap request.

yes

wallet

address

The wallet address of the user who initiated the swap.

yes

✅ Successful Response (200 OK):

{
  "amount_in": 0,
  "amount_out": 0,
  "created_at": "string",
  "deposit_core_tx_hash": "string",
  "deposit_evm_tx_hash": "string",
  "fee_gas": 0,
  "fee_our": 0,
  "id": "string",
  "integration_fee_address": "string",
  "integration_fee_bps": 0,
  "recipient": "string",
  "retries_count": 0,
  "route": "string",
  "slippage": 0,
  "status": 0,
  "status_extra": 0,
  "token_in": "string",
  "token_out": "string",
  "updated_at": "string",
  "usd_amount": 0,
  "wallet": "string"
}

5. Close an undeposited swap if the user has rejected the transaction

GET /trade/closeSwapById

Close the current created undeposited swap request by its ID and User Wallet.

Request:

/trade/closeSwapById?id={id}&wallet={wallet}

Parameters:

Name
Type
Description
Required

id

string

Swap ID returns in /swap request.

yes

wallet

address

The wallet address of the user who initiated the swap.

yes

✅ Successful Response (200 OK):

{
  "amount_in": 0,
  "amount_out": 0,
  "created_at": "string",
  "deposit_core_tx_hash": "string",
  "deposit_evm_tx_hash": "string",
  "fee_gas": 0,
  "fee_our": 0,
  "id": "string",
  "integration_fee_address": "string",
  "integration_fee_bps": 0,
  "recipient": "string",
  "retries_count": 0,
  "route": "string",
  "slippage": 0,
  "status": 0,
  "status_extra": 0,
  "token_in": "string",
  "token_out": "string",
  "updated_at": "string",
  "usd_amount": 0,
  "wallet": "string"
}

6. Swap request statuses

Status
Status Extra
Description

0

Pending deposit (recently created), 5 minutes given to deposit.

1

Deposit confirmed.

2

Swap order in progress to cancel.

2

1

Swap order in progress to cancel in core.

2

2

Swap order in progress to cancel in core(2).

2

3

Swap order in progress to cancel in evm.

3

Swap order is cancelled.

3

1

Swap order cancelled because 5 minutes passed, the deposit has not been found or confirmed.

3

2

Swap order cancelled in core.

3

3

Swap order cancelled in core(2).

3

4

Swap order cancelled in evm.

3

5

Swap order cancelled by user.

4

Swap order in progress to complete.

5

Swap order is completed.

999

Undefined error.

Last updated