Bancor's new SDK allows you to interact with the Bancor Network using JavaScript. It can be used independently of the network smart contracts for grabbing data or (soon) submitting a transaction. Or it can be used as an accessory to the smart contract logic in your Dapp, generating smart contract inputs off-chain in a convenient, user-friendly way.
To initialize the Bancor SDK in your JavaScript code:
const BancorSDK = require('@bancor/sdk').SDK;
const settings = {
// optional, mandatory when interacting with the ethereum mainnet
ethereumNodeEndpoint: '<ethereum node endpoint>',
// optional, mandatory when interacting with the EOS mainnet
eosNodeEndpoint: '<eos node endpoint>'
};
let bancorSDK = await BancorSDK.create(settings);
To generate a conversion path and the expected rate of return of a trade: