@velora-dex/sdk 9.2.0-dev.0 → 9.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velora-dex/sdk",
3
- "version": "9.2.0-dev.0",
3
+ "version": "9.2.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/sdk.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -49,19 +49,19 @@
49
49
  }
50
50
  ],
51
51
  "devDependencies": {
52
- "@size-limit/preset-small-lib": "^11.1.6",
52
+ "@size-limit/preset-small-lib": "^12.0.0",
53
53
  "@tsconfig/recommended": "^1.0.8",
54
- "axios": "^1.7.7",
54
+ "axios": "^1.13.2",
55
55
  "bignumber.js": "^9.1.2",
56
56
  "dotenv": "^16.4.5",
57
57
  "dts-cli": "^2.0.5",
58
58
  "ethers": "^6.13.4",
59
59
  "ethersV5": "npm:ethers@5",
60
- "hardhat": "^2.22.15",
61
- "hardhat-switch-network": "^1.1.1",
60
+ "hardhat": "^2.28.0",
61
+ "hardhat-switch-network": "^1.2.1",
62
62
  "husky": "^9.1.6",
63
63
  "isomorphic-unfetch": "^4.0.2",
64
- "size-limit": "^11.1.6",
64
+ "size-limit": "^12.0.0",
65
65
  "tslib": "^2.8.1",
66
66
  "typedoc": "^0.26.11",
67
67
  "typedoc-plugin-markdown": "^4.2.10",
@@ -65,6 +65,9 @@ export type BuildDeltaOrderDataParams = {
65
65
  /** @description take surplus */
66
66
  partnerTakesSurplus?: boolean;
67
67
 
68
+ /** @description A boolean indicating whether the surplus should be capped. True by default */
69
+ capSurplus?: boolean;
70
+
68
71
  /** @description The side of the order. Default is SELL */
69
72
  side?: SwapSideUnion;
70
73
  /** @description Metadata for the order, hex string */
@@ -164,6 +167,8 @@ export const constructBuildDeltaOrder = (
164
167
  partnerTakesSurplus,
165
168
  partnerFeeBps,
166
169
 
170
+ capSurplus: options.capSurplus,
171
+
167
172
  bridge: options.deltaPrice.bridge, // ZERO_BRIDGE for same-chain Orders
168
173
  };
169
174
 
@@ -94,6 +94,7 @@ export type BuildDeltaOrderDataInput = MarkOptional<
94
94
  paraswapDeltaAddress: string;
95
95
  partnerFeeBps: number;
96
96
  partnerTakesSurplus?: boolean;
97
+ capSurplus?: boolean;
97
98
  chainId: number;
98
99
  bridge: Bridge;
99
100
  };
@@ -122,6 +123,7 @@ export function buildDeltaSignableOrderData({
122
123
  partnerAddress,
123
124
  partnerFeeBps,
124
125
  partnerTakesSurplus = false,
126
+ capSurplus = true,
125
127
 
126
128
  chainId,
127
129
  paraswapDeltaAddress,
@@ -142,6 +144,7 @@ export function buildDeltaSignableOrderData({
142
144
  partnerFeeBps,
143
145
  partnerAddress,
144
146
  partnerTakesSurplus,
147
+ capSurplus,
145
148
  }),
146
149
  bridge,
147
150
  kind,
@@ -159,6 +162,7 @@ type ProducePartnerAndFeeInput = {
159
162
  partnerFeeBps: number;
160
163
  partnerAddress: string;
161
164
  partnerTakesSurplus: boolean;
165
+ capSurplus: boolean;
162
166
  };
163
167
 
164
168
  // fee and address are encoded together
@@ -166,13 +170,18 @@ function producePartnerAndFee({
166
170
  partnerFeeBps,
167
171
  partnerAddress,
168
172
  partnerTakesSurplus,
173
+ capSurplus,
169
174
  }: ProducePartnerAndFeeInput): string {
170
- if (partnerAddress === ZERO_ADDRESS) return '0';
171
-
172
- const partnerAndFee =
173
- (BigInt(partnerAddress) << BigInt(96)) |
174
- BigInt(partnerFeeBps.toFixed(0)) |
175
- (BigInt(partnerTakesSurplus) << BigInt(8));
176
-
177
- return partnerAndFee.toString(10);
175
+ const capSurplusShifted = BigInt(capSurplus) << BigInt(9);
176
+ if (partnerAddress === ZERO_ADDRESS) {
177
+ return capSurplusShifted.toString(10);
178
+ } else {
179
+ const partnerAndFee =
180
+ (BigInt(partnerAddress) << BigInt(96)) |
181
+ BigInt(partnerFeeBps.toFixed(0)) |
182
+ (BigInt(partnerTakesSurplus) << BigInt(8)) |
183
+ capSurplusShifted;
184
+
185
+ return partnerAndFee.toString(10);
186
+ }
178
187
  }
@@ -9,9 +9,10 @@ import {
9
9
  SignableDeltaOrderData,
10
10
  } from './helpers/buildDeltaOrderData';
11
11
  import { sanitizeDeltaOrderData } from './helpers/misc';
12
- import { constructGetDeltaContract, DeltaAuctionOrder } from '../..';
13
- import { ExtractAbiMethodNames } from '../../helpers/misc';
12
+ import type { ExtractAbiMethodNames } from '../../helpers/misc';
14
13
  import { findPrimaryType } from '../../helpers/providers/helpers';
14
+ import { constructGetDeltaContract } from './getDeltaContract';
15
+ import type { DeltaAuctionOrder } from './helpers/types';
15
16
 
16
17
  type HashDeltaOrderTypedData = (
17
18
  signableOrderData: SignableDeltaOrderData