Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bancorx

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bancorx

BancorX Utility

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
25
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

BancorX utility

Collection of useful Javascript (Typescript) methods used for BancorX.

Install

Using Yarn:

yarn add bancorx

or using NPM:

npm install --save bancorx

Import Module

CommonJS

const bancorx = require("bancorx");

Typescript (ES6)

import * as bancorx from "bancorx";

BancorX Formula

token balance of EOS (eosio.token) in the relay: 77814.0638 EOS token balance of BNT (bntbntbntbnt) in the relay: 429519.5539120331 BNT The Formula: 10.0000 / (77814.0638 + 10.0000) * 429519.5539120331 55.19109809221157

const source_balance = 77814.0638 // EOS
const target_balance = 429519.5539120331 // BNT
const source_amount = 10
bancorx.bancorFormula(source_balance, target_balance, source_amount)
//=> 55.19109809221157

Parse Memo

const memo = bancorx.parseMemo("bnt2eoscnvrt BNT bancorc11144 CUSD", "3.17", "b1")
//=> "1,bnt2eoscnvrt BNT bancorc11144 CUSD,3.17,b1"

Relays

bancorx.relays.CUSD
// {
//     code: "stablecarbon",
//     account: "bancorc11144",
//     symbol: "CUSD",
//     precision: 2
// }

Get Relay Balances

const {code, account, symbol} = bancorx.relays.CUSD;
const balance = await rpc.get_currency_balance(code, account, symbol);

FAQs

Package last updated on 05 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc