@depthhq/maker-sdk 0.1.11 → 0.1.12

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.
Files changed (2) hide show
  1. package/dist/node.js +5 -2
  2. package/package.json +1 -1
package/dist/node.js CHANGED
@@ -466,7 +466,7 @@ class MakerBot {
466
466
  await this.store.save(this.state);
467
467
  }
468
468
  }
469
- if (ready && (!this.position || (this.inventoryVersion ?? this.position.version) !== currentVersion)) {
469
+ if (ready && (!this.position || this.position.status !== "ready" || this.position.position === undefined || (this.inventoryVersion ?? this.position.version) !== currentVersion)) {
470
470
  const prior = this.position;
471
471
  this.position = await this.maker.position.summary({ timeoutMs: 180000 });
472
472
  const fresh = await this.maker.read("MarketAccount", this.maker.marketAccount(), "finalized");
@@ -681,12 +681,15 @@ class MakerBot {
681
681
  const account = await this.maker.read("MarketAccount", this.maker.marketAccount());
682
682
  if (!("ready" in account.status) || market.pendingOrders)
683
683
  return this.snapshot("pending", "settlement in progress");
684
- if (!this.position || this.position.version !== BigInt(account.version.toString())) {
684
+ if (!this.position || this.position.status !== "ready" || this.position.version !== BigInt(account.version.toString())) {
685
685
  this.position = await this.maker.position.summary({
686
686
  timeoutMs: 180000
687
687
  });
688
688
  if (this.position.status !== "ready" || this.position.version !== BigInt(account.version.toString()))
689
689
  return this.snapshot("pending", "maker view changed");
690
+ this.inventoryVersion = this.position.version;
691
+ this.dirty = false;
692
+ return this.snapshot("pending", "maker view refreshed");
690
693
  }
691
694
  this.inventoryVersion = this.position.version;
692
695
  this.dirty = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depthhq/maker-sdk",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },