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

@openbook-dex/openbook

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openbook-dex/openbook - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

40

lib/market.js

@@ -444,6 +444,6 @@ "use strict";

}
else {
throw new Error('Invalid payer account');
}
}
else {
throw new Error('Invalid payer account');
}
const placeOrderInstruction = this.makePlaceOrderInstruction(connection, {

@@ -1166,6 +1166,32 @@ owner,

function divideBnToNumber(numerator, denominator) {
const quotient = numerator.div(denominator).toNumber();
const rem = numerator.umod(denominator);
const gcd = rem.gcd(denominator);
return quotient + rem.div(gcd).toNumber() / denominator.div(gcd).toNumber();
if (numerator.bitLength() <= 53 && denominator.bitLength() <= 53)
return numerator.toNumber() / denominator.toNumber();
// we can try to shorten this fraction with the gcd, most likely
// these have a large power of 10 as common factor
const gcd_nd = numerator.gcd(denominator);
// don't update these two yet inplace as they are passed by ref
numerator = numerator.div(gcd_nd);
denominator = denominator.div(gcd_nd);
if (numerator.bitLength() <= 53 && denominator.bitLength() <= 53)
return numerator.toNumber() / denominator.toNumber();
// only one of them can be still even at this point as we did already
// eliminate gcds but if we are lucky there's still room left to pull out a
// power of 2 factor on either side which we can multiply back in possibly
// saving some precision bc. we only need to modify the exponent
const numerator_shift = numerator.zeroBits();
if (numerator_shift > 0) {
numerator.ishrn(numerator_shift);
}
const denominator_shift = denominator.zeroBits();
if (denominator_shift > 0) {
denominator.ishrn(denominator_shift);
}
const exponent_bias = Math.pow(2, numerator_shift - denominator_shift);
if (numerator.bitLength() <= 53 && denominator.bitLength() <= 53)
// brackets are important to retain precision
return exponent_bias * (numerator.toNumber() / denominator.toNumber());
// now we have at least one giant odd number, can't do a lot but convert
// to strings and let JS figure out a solution
const string_math = numerator.toString() / denominator.toString();
return exponent_bias * string_math;
}

@@ -1172,0 +1198,0 @@ const MINT_LAYOUT = (0, buffer_layout_1.struct)([(0, buffer_layout_1.blob)(44), (0, buffer_layout_1.u8)('decimals'), (0, buffer_layout_1.blob)(37)]);

@@ -81,2 +81,8 @@ [

{
"address": "ACgDPLf4v6HqouPyAcqFo8nMogVo6axn9jmHo58rw6ox",
"deprecated": false,
"name": "GOFX/USDC",
"programId": "srmqPvymJeFKQ4zGQed1GFppgkRHL9kaELCbyksJtPX"
},
{
"address": "6QNusiQ1g7fKierMQhNeAJxfLXomfcAX3tGRMwxfESsw",

@@ -83,0 +89,0 @@ "deprecated": false,

6

package.json
{
"name": "@openbook-dex/openbook",
"version": "0.0.5",
"version": "0.0.6",
"description": "Library for interacting with the openbook dex",

@@ -19,3 +19,3 @@ "license": "MIT",

"clean": "rm -rf lib",
"prepack": "npm run clean && npm run build",
"prepack": "yarn clean && yarn build",
"shell": "node -e \"$(< shell)\" -i --experimental-repl-await",

@@ -29,3 +29,3 @@ "test": "run-s test:unit test:lint test:build",

"devDependencies": {
"@openbook-dex/tokens": "0.0.5",
"@openbook-dex/tokens": "0.0.4",
"@tsconfig/node12": "^1.0.7",

@@ -32,0 +32,0 @@ "@types/bn.js": "^4.11.6",

@@ -1,7 +0,6 @@

[![npm (scoped)](https://img.shields.io/npm/v/@project-serum/serum)](https://www.npmjs.com/package/@project-serum/serum)
[![Build Status](https://travis-ci.com/project-serum/serum-js.svg?branch=master)](https://travis-ci.com/project-serum/serum-js)
[![npm (scoped)](https://img.shields.io/npm/v/@project-serum/serum)](https://www.npmjs.com/package/@openbook-dex/openbook)
# Serum JS Client Library
JavaScript client library for interacting with the Project Serum DEX.
JavaScript client library for interacting with the OpenBook DEX

@@ -13,3 +12,3 @@ ## Installation

```
npm install @solana/web3.js @project-serum/serum
npm install @solana/web3.js @openbook-dex/openbook
```

@@ -20,3 +19,3 @@

```
yarn add @solana/web3.js @project-serum/serum
yarn add @solana/web3.js @openbook-dex/openbook
```

@@ -23,0 +22,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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