order detail foldout

This commit is contained in:
Tim Olson
2023-12-09 00:12:24 -04:00
parent aa731d678e
commit 7e33ffba76
5 changed files with 88 additions and 36 deletions

View File

@@ -6,6 +6,9 @@ export function encodeIEE754(value) {
}
export function decodeIEE754(buffer) {
return new DataView(buffer).getFloat32(0, false);
export function decodeIEE754(value) {
const buffer = new ArrayBuffer(4);
const view = new DataView(buffer);
view.setUint32(0, value, false)
return view.getFloat32(0, false)
}

View File

@@ -1,5 +1,5 @@
import {uint32max, uint64max} from "@/misc.js";
import {encodeIEE754} from "@/blockchain/common.js";
import {decodeIEE754, encodeIEE754} from "@/blockchain/common.js";
export const MAX_FRACTION = 65535;
export const NO_CHAIN = uint64max;
@@ -177,6 +177,10 @@ export function parseTranche(tranche) {
maxIntercept,
maxSlope,
] = tranche
minIntercept = decodeIEE754(minIntercept)
minSlope = decodeIEE754(minSlope)
maxIntercept = decodeIEE754(maxIntercept)
maxSlope = decodeIEE754(maxSlope)
return {
fraction, startTimeIsRelative, endTimeIsRelative, minIsBarrier, maxIsBarrier, marketOrder,
startTime, endTime, minIntercept, minSlope, maxIntercept, maxSlope,