@orderly.network/hooks 1.1.4-alpha.4 → 1.1.4-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -20,9 +20,9 @@ import { createClient } from '@layerzerolabs/scan-client';
20
20
  // src/version.ts
21
21
  if (typeof window !== "undefined") {
22
22
  window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
23
- window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-alpha.4";
23
+ window.__ORDERLY_VERSION__["@orderly.network/hooks"] = "1.1.4-alpha.6";
24
24
  }
25
- var version_default = "1.1.4-alpha.4";
25
+ var version_default = "1.1.4-alpha.6";
26
26
  var fetcher = (url, init = {}, queryOptions) => get(url, init, queryOptions?.formatter);
27
27
  var OrderlyContext = createContext({
28
28
  // configStore: new MemoryConfigStore(),
@@ -964,20 +964,24 @@ var reduceOrderbook = (depth, level, data) => {
964
964
  let bids = reduceItems(depth, level, data.bids);
965
965
  if (asks.length !== 0 && bids.length !== 0 && asks[0][0] <= bids[0][0]) {
966
966
  if (asks.length === 1) {
967
- const [price, qty, newQuantity] = asks[0];
967
+ const [price, qty, newQuantity, newAmount] = asks[0];
968
968
  asks.shift();
969
- asks.push([price + (depth === void 0 ? 0 : depth), qty, newQuantity]);
969
+ asks.push([price + (depth === void 0 ? 0 : depth), qty, newQuantity, newAmount]);
970
970
  } else {
971
971
  const [bidPrice] = bids[0];
972
972
  while (asks.length > 0) {
973
- const [askPrice, askQty, newQuantity] = asks[0];
973
+ const [askPrice, askQty, newQuantity, newAmount] = asks[0];
974
974
  if (askPrice <= bidPrice) {
975
975
  asks.shift();
976
976
  for (let index = 0; index < asks.length; index++) {
977
977
  if (index === 0) {
978
- asks[index][1] += askQty;
978
+ const quantity = asks[index][1] + askQty;
979
+ asks[index][1] = quantity;
980
+ asks[index][2] = quantity;
981
+ asks[index][3] += newAmount;
982
+ } else {
983
+ asks[index][3] += newAmount;
979
984
  }
980
- asks[index][2] += newQuantity;
981
985
  }
982
986
  } else {
983
987
  break;