New to Nutbox?

[개발] 바이낸스 api 를 이용한 출금시 코인별 network 확인 방법

1 comment

realmankwon
83
last year2 min read

안녕하세요 @realmankwon 입니다.

바이낸스 api 를 이용하여 출금을 하려고 할때 코인별 network를 설정하는 것이 중요합니다.
출금할 코인이 지원하는 네트워크를 확인해야 하는데 이때 사용하는 것이 capitalConfig() 함수입니다.

아래와 같이 symbol 변수에 원하는 코인을 입력하면 networkList 에서 지원하는 network 를 확인할 수 있습니다.

const client = Binance({
      apiKey: apiKey,
      apiSecret: apiSecret,
      getTime: () => Date.now(),
    });

    let result = await client.capitalConfigs();
    result = result.filter((data) => data.coin === `${symbol}`);
    console.log(result[0].networkList);

BNB의 경우 결과값은 다음과 같습니다.

[
  [Object: null prototype] {
    network: 'BSC',
    coin: 'BNB',
    withdrawIntegerMultiple: '0.00000001',
    isDefault: false,
    depositEnable: true,
    withdrawEnable: true,
    depositDesc: '',
    withdrawDesc: '',
    specialTips: '',
    specialWithdrawTips: 'The network you have selected is BSC. Please ensure that the withdrawal address supports the Binance Smart Chain network. You will lose your assets if the chosen platform does not support retrievals.',
    name: 'BNB Smart Chain (BEP20)',
    resetAddressStatus: false,
    addressRegex: '^(0x)[0-9A-Fa-f]{40}$',
    addressRule: '',
    memoRegex: '',
    withdrawFee: '0.0005',
    withdrawMin: '0.01',
    withdrawMax: '10000000000',
    minConfirm: 15,
    unLockConfirm: 0,
    sameAddress: false,
    estimatedArrivalTime: 5,
    busy: false,
    country: 'AE,BINANCE_BAHRAIN_BSC,custody,KZ',
    contractAddressUrl: 'https://bscscan.com/token/'
  },
  [Object: null prototype] {
    network: 'BNB',
    coin: 'BNB',
    withdrawIntegerMultiple: '0.00000001',
    isDefault: true,
    depositEnable: true,
    withdrawEnable: true,
    depositDesc: '',
    withdrawDesc: '',
    specialTips: 'Please enter both MEMO and Address data, which are required to deposit BNB Mainnet tokens to your Binance account.',
    name: 'BNB Beacon Chain (BEP2)',
    resetAddressStatus: false,
    addressRegex: '^(bnb1)[0-9a-z]{38}$',
    addressRule: '',
    memoRegex: '^[0-9A-Za-z\\-_]{1,120}$',
    withdrawFee: '0.0005',
    withdrawMin: '0.01',
    withdrawMax: '10000000000',
    depositDust: '0.00001',
    minConfirm: 1,
    unLockConfirm: 0,
    sameAddress: true,
    estimatedArrivalTime: 5,
    busy: false,
    country: 'AE,BINANCE_BAHRAIN_BSC,KZ',
    contractAddressUrl: 'https://binance.mintscan.io/assets/',
    contractAddress: 'BNB'
  },
  [Object: null prototype] {
    network: 'ETH',
    coin: 'BNB',
    withdrawIntegerMultiple: '0.00000001',
    isDefault: false,
    depositEnable: true,
    withdrawEnable: false,
    depositDesc: '',
    withdrawDesc: 'Withdrawal for this token is not supported, please try other networks.',
    specialTips: 'This deposit address supports ERC20 tokens. We will automatically convert your tokens to the Mainnet.',
    name: 'Ethereum (ERC20)',
    resetAddressStatus: false,
    addressRegex: '^(0x)[0-9A-Fa-f]{40}$',
    addressRule: '',
    memoRegex: '',
    withdrawFee: '0',
    withdrawMin: '0.012',
    withdrawMax: '10000000000',
    minConfirm: 12,
    unLockConfirm: 0,
    sameAddress: false,
    estimatedArrivalTime: 5,
    busy: false,
    country: 'AE,BINANCE_BAHRAIN_BSC,custody,KZ',
    contractAddressUrl: 'https://etherscan.io/token/',
    contractAddress: '0xb8c77482e45f1f44de1745f52c74426c631bdd52'
  }
]

api 가 잘 되어 있으니 정말 편한 세상이네요 ㅎ

Comments

Sort byBest