get withdraw fee info

Retrieve the withdrawal fee details for the asset. Note: If the asset supports cross-chain interoperability, be sure to provide the root asset ID, along with the target chain and chain network parameters.

Get withdrawal fee information for an asset

get
Query parameters
RootAssetIdstringOptional
TargetChainstringOptional
TargetChainNetworkstringOptional
Responses
200
OK
get
GET /v1/asset/withdrawal-fee HTTP/1.1
Host: testnetopenapi.hibit.app
Accept: */*
{
  "code": 1,
  "message": "text",
  "data": {
    "rootAssetId": "text",
    "targetAssetId": "text",
    "feeRate": "text",
    "rateDecimal": "text",
    "minFee": "text"
  }
}

Code example

import {
  hibitClient,
  HibitNetwork,
  Chain,
  ChainNetwork,
  MetaMaskWalletApi
} from '@delandlabs/hibit-sdk';

// Set up client options
hibitClient.setOptions({
  network: HibitNetwork.Testnet, // or HibitNetwork.Mainnet
});

async function fetchWithdrawFee() {
  const assetId = BigInt('10001');
  const targetChain = Chain.Ethereum;
  const targetChainNetwork = ChainNetwork.EvmMainNet;

  try {
    const feeInfo = await hibitClient.getWithdrawFee({
      rootAssetId: assetId,
      targetChain,
      targetNetwork: targetChainNetwork
    });
    console.log('Withdraw fee info:', feeInfo);
  } catch (err) {
    console.error('Failed to fetch withdraw fee:', err);
  }
}

fetchWithdrawFee();

SDK

Source code https://github.com/Deland-Labs/hibit-sdk

Last updated