Binance Smart Chain (BSC)
  • Introduction
  • web3 on BSC
    • gas
    • wallet-balance
    • BEP20 tokens lists
    • transfer
    • broadcast
Powered by GitBook
On this page

Was this helpful?

  1. web3 on BSC

transfer

Transfer any BEP20 token or BNB from one wallet to another

/bsc/transfer

GET https://cryptotalk-public-gateway-byeii62k.de.gateway.dev/bsc/transfer

This end point all you to safely transfer any BEP-20 token or BNB from one wallet to another.

Query Parameters

Name
Type
Description

key

string

API Key

Request Body

Name
Type
Description

params

object

{ "addr" : "0x5585D5365F37671Eecc0FDCAC5a06BD1d176408E", "dst_addr" : "0x66Eb772458FC2743C5e3AdB232Dc18Ef3A80D580", "tkn_addr" : "0x337610d27c682e347c9cd60bd4b3b107c9d34ddd", "amt_float" : 0.01, "gas" : "10", "decimals" : 18 }

{
  "operation": "TRANSFER",
  "rawTx": {
    "from": "0x5585d5365f37671eecc0fdcac5a06bd1d176408e",
    "value": "0x0",
    "to": "0x337610d27c682e347c9cd60bd4b3b107c9d34ddd",
    "data": "0xa9059cbb00000000000000000000000066eb772458fc2743c5e3adb232dc18ef3a80d580000000000000000000000000000000000000000000000000002386f26fc10000",
    "nonce": "0xf16",
    "gasLimit": "0x7eae",
    "gasPrice": "0x2540be400"
  },
  "isError": false,
  "text": "Sign rawTx & broadcast"
}
### Example of transfering 10 BUSD token from one wallet to another ###
async function transfer(){
    const fetch                 = require('node-fetch');
    const TRANSFER_URL          = "https://cryptotalk-public-gateway-byeii62k.de.gateway.dev/bsc/transfer";
    const API_KEY               = "AIzaSyCngkz41JSdBMlr4iKqAMLiTMHD9TfQvuc";

    const amount                = 10;
    const decimal               = 18;
    const gas                   = "10";
    const BUSD                  = "0xe9e7cea3dedca5984780bafc599bd69add087d56";
    const frm_addr              = "0x5585D5365F37671Eecc0FDCAC5a06BD1d176408E";
    const to_addr               = "0x66Eb772458FC2743C5e3AdB232Dc18Ef3A80D580"; 
    
    const request_body          = {
		                            "addr" 		: frm_addr,
		                            "dst_addr" 	: to_addr,
		                            "tkn_addr" 	: BUSD,
		                            "amt_float" : amount,
		                            "gas" 		: gas,
		                            "decimals" 	: decimal
	                            }
    
    let txn_response            = await fetch(TRANSFER_URL +"?key=" + API_KEY, 
                                                { method : 'post', 
                                                  body   : JSON.stringify({ params : request_body}), 
                                                  headers: { 'Content-Type': 'application/json'}
                                                }
                                            );
    let tx                      = await txn_response.json();
    if(tx.isError){
        console.error("Error");
    }else{
        console.log("Sign and Broadcast following :");
        console.log(tx.rawTx);
    }
}
PreviousBEP20 tokens listsNextbroadcast

Last updated 4 years ago

Was this helpful?