Package detail

@polkassembly/util

paritytech189Apache-2.00.2.0

Set of utility functions for Polkassembly and more.

Polkassembly, Polkadot, newton-raphson

readme

@polkassembly/util

A set of utility functions used in Polkassembly.

Usage

Installation -

yarn add @polkssembly/util

Functions can be imported directly from the package, e.g.

import { getPassingThreshold } from '@polkassembly/util';

Utility functions

  • getPassingThreshold: Get the amount of Aye needed for a referendum to pass.
  • newtonRaphson: This is a fork of scijs/newton-raphson-method that uses bn.js instances instead of plain javascript numbers. It has been simplified and requires to pass the function and its derivative as argument.
  • solveQuadraticEquation: Get the roots of a polynomial function of degree 2 (a*x^2 + b*x + c) where the coeffiscients a, b and c are BN from bn.js.

changelog

Change Log

All notable changes to this project will be documented in this file.

0.2.0 (2020-05-20)

Add getFailingThreshold. Use the aye/nay without conviction. The guess on the threshold makes the assumption that all votes have a conviction of x1.

0.1.3 (2020-04-15)

Fix a case were Supermajority threshold was not returning any value although a root was found.

0.1.2 (2020-04-13)

getPassingThreshold returns an object { isValid: boolean, passingThreshold?: BN } with isValid being true if a threshold was found.

0.1.1 (2020-04-13)

Add function descriptions, fix typo in Readme and fix imports.

0.1.0 Initial release (2020-04-13)