@depthhq/sdk 0.1.10 → 0.1.11

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/index.js +10 -10
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -47861,7 +47861,6 @@ class DepthClient {
47861
47861
  const currentSide = position.position > 0n ? "long" : "short";
47862
47862
  const direction = intent === "reduce" || intent === "close" ? currentSide === "long" ? "short" : "long" : input.direction;
47863
47863
  encodeSide(direction);
47864
- const worstPriceE8 = tradeLimit(input, direction, BigInt(market.state.oraclePriceE8.toString()));
47865
47864
  if ((intent === "reduce" || intent === "close" || intent === "reverse") && position.position === 0n)
47866
47865
  throw new Error("There is no position to manage");
47867
47866
  if (intent === "increase" && position.position !== 0n && direction !== currentSide)
@@ -47880,15 +47879,6 @@ class DepthClient {
47880
47879
  const inputKey = x25519.getPublicKey(secret);
47881
47880
  const inputNonce = randomBytes3(16);
47882
47881
  const cipher = new RescueCipher(x25519.getSharedSecret(secret, mxePublicKey));
47883
- const ciphertexts = cipher.encrypt(circuits2.OrderInput.pack({
47884
- side: encodeSide(direction),
47885
- amount,
47886
- margin: position.collateral,
47887
- limit_price: worstPriceE8,
47888
- max_fee: input.maxFee,
47889
- intent: BigInt(["increase", "reduce", "close", "reverse"].indexOf(intent)),
47890
- version: position.version
47891
- }), inputNonce);
47892
47882
  const offset2 = nonce();
47893
47883
  const queue = await this.queue("match_order", offset2);
47894
47884
  let keys = [];
@@ -47915,6 +47905,16 @@ class DepthClient {
47915
47905
  await new Promise((resolve) => setTimeout(resolve, 1000));
47916
47906
  }
47917
47907
  }
47908
+ const worstPriceE8 = tradeLimit(input, direction, BigInt(market.state.oraclePriceE8.toString()));
47909
+ const ciphertexts = cipher.encrypt(circuits2.OrderInput.pack({
47910
+ side: encodeSide(direction),
47911
+ amount,
47912
+ margin: position.collateral,
47913
+ limit_price: worstPriceE8,
47914
+ max_fee: input.maxFee,
47915
+ intent: BigInt(["increase", "reduce", "close", "reverse"].indexOf(intent)),
47916
+ version: position.version
47917
+ }), inputNonce);
47918
47918
  const signature = await this.program.methods.submitOrder(offset2, orderNonce, appId, app.feeBps, app.version, new anchor9.BN(deadline), market.state.revision, market.state.oracleTimestamp, ciphertexts, Array.from(inputKey), new anchor9.BN(inputNonce, "le")).accountsPartial({
47919
47919
  ...queue,
47920
47920
  trader: this.options.wallet.publicKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@depthhq/sdk",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -44,8 +44,8 @@
44
44
  "@noble/hashes": "1.8.0",
45
45
  "@solana/web3.js": "1.99.0",
46
46
  "buffer": "6.0.3",
47
- "@depthhq/schema": "0.1.2",
48
- "@depthhq/bindings": "0.1.5"
47
+ "@depthhq/bindings": "0.1.5",
48
+ "@depthhq/schema": "0.1.2"
49
49
  },
50
50
  "devDependencies": {
51
51
  "fake-indexeddb": "6.2.4"