@velora-dex/sdk 9.3.0-dev.1 → 9.3.0

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/sdk.esm.js CHANGED
@@ -3672,6 +3672,8 @@ function buildDeltaSignableOrderData(_ref2) {
3672
3672
  partnerFeeBps = _ref2.partnerFeeBps,
3673
3673
  _ref2$partnerTakesSur = _ref2.partnerTakesSurplus,
3674
3674
  partnerTakesSurplus = _ref2$partnerTakesSur === void 0 ? false : _ref2$partnerTakesSur,
3675
+ _ref2$capSurplus = _ref2.capSurplus,
3676
+ capSurplus = _ref2$capSurplus === void 0 ? true : _ref2$capSurplus,
3675
3677
  chainId = _ref2.chainId,
3676
3678
  paraswapDeltaAddress = _ref2.paraswapDeltaAddress,
3677
3679
  bridge = _ref2.bridge;
@@ -3689,7 +3691,8 @@ function buildDeltaSignableOrderData(_ref2) {
3689
3691
  partnerAndFee: producePartnerAndFee({
3690
3692
  partnerFeeBps: partnerFeeBps,
3691
3693
  partnerAddress: partnerAddress,
3692
- partnerTakesSurplus: partnerTakesSurplus
3694
+ partnerTakesSurplus: partnerTakesSurplus,
3695
+ capSurplus: capSurplus
3693
3696
  }),
3694
3697
  bridge: bridge,
3695
3698
  kind: kind,
@@ -3705,10 +3708,15 @@ function buildDeltaSignableOrderData(_ref2) {
3705
3708
  function producePartnerAndFee(_ref3) {
3706
3709
  var partnerFeeBps = _ref3.partnerFeeBps,
3707
3710
  partnerAddress = _ref3.partnerAddress,
3708
- partnerTakesSurplus = _ref3.partnerTakesSurplus;
3709
- if (partnerAddress === ZERO_ADDRESS) return '0';
3710
- var partnerAndFee = BigInt(partnerAddress) << BigInt(96) | BigInt(partnerFeeBps.toFixed(0)) | BigInt(partnerTakesSurplus) << BigInt(8);
3711
- return partnerAndFee.toString(10);
3711
+ partnerTakesSurplus = _ref3.partnerTakesSurplus,
3712
+ capSurplus = _ref3.capSurplus;
3713
+ var capSurplusShifted = BigInt(capSurplus) << BigInt(9);
3714
+ if (partnerAddress === ZERO_ADDRESS) {
3715
+ return capSurplusShifted.toString(10);
3716
+ } else {
3717
+ var partnerAndFee = BigInt(partnerAddress) << BigInt(96) | BigInt(partnerFeeBps.toFixed(0)) | BigInt(partnerTakesSurplus) << BigInt(8) | capSurplusShifted;
3718
+ return partnerAndFee.toString(10);
3719
+ }
3712
3720
  }
3713
3721
 
3714
3722
  var _SwapSideToOrderKind;
@@ -3800,6 +3808,7 @@ var constructBuildDeltaOrder = function constructBuildDeltaOrder(options) {
3800
3808
  partnerAddress: partnerAddress,
3801
3809
  partnerTakesSurplus: partnerTakesSurplus,
3802
3810
  partnerFeeBps: partnerFeeBps,
3811
+ capSurplus: options.capSurplus,
3803
3812
  bridge: options.deltaPrice.bridge // ZERO_BRIDGE for same-chain Orders
3804
3813
  };
3805
3814
  return _context.abrupt("return", buildDeltaSignableOrderData(input));
@@ -4283,7 +4292,7 @@ var constructGetBridgeInfo = function constructGetBridgeInfo(_ref) {
4283
4292
  var deltaBridgeUrl = apiURL + "/delta/prices";
4284
4293
  var getBridgeInfo = /*#__PURE__*/function () {
4285
4294
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(params, requestParams) {
4286
- var _params, allowBridgeAndSwap, bridges, allowBridgeAndSwapString, bridgesString, search, fetchURL, data;
4295
+ var _params, allowBridgeAndSwap, bridges, bridgesString, search, fetchURL, data;
4287
4296
  return _regeneratorRuntime().wrap(function _callee$(_context) {
4288
4297
  while (1) switch (_context.prev = _context.next) {
4289
4298
  case 0:
@@ -4291,23 +4300,22 @@ var constructGetBridgeInfo = function constructGetBridgeInfo(_ref) {
4291
4300
  params = {};
4292
4301
  }
4293
4302
  _params = params, allowBridgeAndSwap = _params.allowBridgeAndSwap, bridges = _params.bridges;
4294
- allowBridgeAndSwapString = allowBridgeAndSwap ? 'true' : 'false';
4295
4303
  bridgesString = bridges ? bridges.join(',') : undefined;
4296
4304
  search = constructSearchString({
4297
- allowBridgeAndSwap: allowBridgeAndSwapString,
4305
+ allowBridgeAndSwap: allowBridgeAndSwap,
4298
4306
  bridges: bridgesString
4299
4307
  });
4300
4308
  fetchURL = deltaBridgeUrl + "/bridge-info" + search;
4301
- _context.next = 8;
4309
+ _context.next = 7;
4302
4310
  return fetcher({
4303
4311
  url: fetchURL,
4304
4312
  method: 'GET',
4305
4313
  requestParams: requestParams
4306
4314
  });
4307
- case 8:
4315
+ case 7:
4308
4316
  data = _context.sent;
4309
4317
  return _context.abrupt("return", data.supportedTokens);
4310
- case 10:
4318
+ case 9:
4311
4319
  case "end":
4312
4320
  return _context.stop();
4313
4321
  }