@thesingularitynetwork/darkswap-sdk 0.1.21 → 0.1.22

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.
@@ -8644,7 +8644,7 @@ var ProSwapService = /*#__PURE__*/function (_BaseContractService) {
8644
8644
  var _proto = ProSwapService.prototype;
8645
8645
  _proto.prepare = /*#__PURE__*/function () {
8646
8646
  var _prepare = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(address, orderNote, bobAddress, bobSwapMessage, signature) {
8647
- var _yield$generateKeyPai2, pubKey, swapOutAmount, swapInAmount, aliceFeeAmount, changeNote, swapInNote, context;
8647
+ var _yield$generateKeyPai2, pubKey, swapOutAmount, swapInAmount, aliceFeeAmount, changeAmount, changeNote, swapInNote, context;
8648
8648
  return _regenerator().w(function (_context2) {
8649
8649
  while (1) switch (_context2.n) {
8650
8650
  case 0:
@@ -8656,7 +8656,8 @@ var ProSwapService = /*#__PURE__*/function (_BaseContractService) {
8656
8656
  swapOutAmount = bobSwapMessage.feeAmount + bobSwapMessage.inNote.amount;
8657
8657
  swapInAmount = bobSwapMessage.orderNote.amount;
8658
8658
  aliceFeeAmount = calcFeeAmount(swapInAmount, orderNote.feeRatio);
8659
- changeNote = createNote(address, orderNote.asset, orderNote.amount - swapOutAmount, pubKey);
8659
+ changeAmount = orderNote.amount - swapOutAmount;
8660
+ changeNote = changeAmount == 0n ? EMPTY_NOTE : createNote(address, orderNote.asset, changeAmount, pubKey);
8660
8661
  swapInNote = createNote(address, bobSwapMessage.orderNote.asset, swapInAmount - aliceFeeAmount, pubKey);
8661
8662
  context = new ProSwapContext(signature);
8662
8663
  context.orderNote = orderNote;