@openocean.finance/openocean-sdk 1.2.86 → 1.2.88

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/lib/swapSdk/Swap.js +14 -13
  2. package/package.json +1 -1
@@ -559,18 +559,18 @@ var Swap = /** @class */ (function () {
559
559
  };
560
560
  Swap.prototype.getGasOld = function () {
561
561
  return __awaiter(this, void 0, void 0, function () {
562
- var _a, inToken, inAmount, data, to, gas;
562
+ var _a, inToken, inAmount, data, to, value, gas;
563
563
  return __generator(this, function (_b) {
564
564
  switch (_b.label) {
565
565
  case 0:
566
- _a = this.res, inToken = _a.inToken, inAmount = _a.inAmount, data = _a.data, to = _a.to;
566
+ _a = this.res, inToken = _a.inToken, inAmount = _a.inAmount, data = _a.data, to = _a.to, value = _a.value;
567
567
  return [4 /*yield*/, this.wallet.sdk.eth.estimateGas({
568
568
  from: this.wallet.address,
569
569
  to: to,
570
570
  data: data,
571
571
  value: wallet_1.chainsObj.isNativeToken(this.chain.key, inToken.address)
572
572
  ? inAmount
573
- : 0,
573
+ : value || 0,
574
574
  })];
575
575
  case 1:
576
576
  gas = _b.sent();
@@ -617,14 +617,14 @@ var Swap = /** @class */ (function () {
617
617
  };
618
618
  Swap.prototype.sendEthTransactionNew = function () {
619
619
  return __awaiter(this, void 0, void 0, function () {
620
- var _a, inToken, inAmount, outAmount, outToken, data, to, ethGasPrice, gasPrice, value, myWallet, contract, invitee, path, amounts, swapAddr, swapExtraData, swapParams, maxFeePerGas, maxPriorityFeePerGas;
620
+ var _a, inToken, inAmount, outAmount, outToken, data, to, ethGasPrice, gasPrice, gmxFee, myWallet, contract, invitee, path, amounts, swapAddr, swapExtraData, swapParams, maxFeePerGas, maxPriorityFeePerGas;
621
621
  var _b;
622
622
  var _this = this;
623
623
  return __generator(this, function (_c) {
624
624
  switch (_c.label) {
625
625
  case 0:
626
- _a = this.res, inToken = _a.inToken, inAmount = _a.inAmount, outAmount = _a.outAmount, outToken = _a.outToken, data = _a.data, to = _a.to, ethGasPrice = _a.ethGasPrice, gasPrice = _a.gasPrice, value = _a.value;
627
- console.log('sendEthTransactionNew');
626
+ _a = this.res, inToken = _a.inToken, inAmount = _a.inAmount, outAmount = _a.outAmount, outToken = _a.outToken, data = _a.data, to = _a.to, ethGasPrice = _a.ethGasPrice, gasPrice = _a.gasPrice, gmxFee = _a.gmxFee;
627
+ console.log('sendEthTransactionNew', JSON.stringify(this.res));
628
628
  myWallet = this.wallet.sdk;
629
629
  contract = new myWallet.eth.Contract(aggregator_1.aggregator, (0, config_1.getProxyContract)(this.chain.key));
630
630
  invitee = this.wallet.address;
@@ -654,8 +654,8 @@ var Swap = /** @class */ (function () {
654
654
  if (wallet_1.chainsObj.isNativeToken(this.chain.key, inToken.address)) {
655
655
  swapParams.value = inAmount;
656
656
  }
657
- else if (value) {
658
- swapParams.value = value;
657
+ if (gmxFee) {
658
+ swapParams.value = new bn_js_1.default(swapParams.value).add(new bn_js_1.default(gmxFee)).toNumber();
659
659
  }
660
660
  contract.methods
661
661
  .swap(invitee, path, amounts, swapAddr, swapExtraData)
@@ -677,13 +677,13 @@ var Swap = /** @class */ (function () {
677
677
  };
678
678
  Swap.prototype.sendEthTransaction = function () {
679
679
  return __awaiter(this, void 0, void 0, function () {
680
- var _a, inToken, inAmount, data, to, ethGasPrice, gasPrice, estimatedGas, value, swapParams, maxFeePerGas, maxPriorityFeePerGas, safeTxHash, e_6, gas, e_7;
680
+ var _a, inToken, inAmount, data, to, ethGasPrice, gasPrice, estimatedGas, gmxFee, swapParams, maxFeePerGas, maxPriorityFeePerGas, safeTxHash, e_6, gas, e_7;
681
681
  var _this = this;
682
682
  return __generator(this, function (_b) {
683
683
  switch (_b.label) {
684
684
  case 0:
685
- _a = this.res, inToken = _a.inToken, inAmount = _a.inAmount, data = _a.data, to = _a.to, ethGasPrice = _a.ethGasPrice, gasPrice = _a.gasPrice, estimatedGas = _a.estimatedGas, value = _a.value;
686
- console.log('sendEthTransaction');
685
+ _a = this.res, inToken = _a.inToken, inAmount = _a.inAmount, data = _a.data, to = _a.to, ethGasPrice = _a.ethGasPrice, gasPrice = _a.gasPrice, estimatedGas = _a.estimatedGas, gmxFee = _a.gmxFee;
686
+ console.log('sendEthTransaction res', JSON.stringify(this.res));
687
687
  swapParams = {
688
688
  from: this.wallet.address,
689
689
  to: to,
@@ -702,9 +702,10 @@ var Swap = /** @class */ (function () {
702
702
  if (wallet_1.chainsObj.isNativeToken(this.chain.key, inToken.address)) {
703
703
  swapParams.value = inAmount;
704
704
  }
705
- else if (value) {
706
- swapParams.value = value;
705
+ if (gmxFee) {
706
+ swapParams.value = new bn_js_1.default(swapParams.value).add(new bn_js_1.default(gmxFee)).toNumber();
707
707
  }
708
+ console.log('sendEthTransaction swapParams', JSON.stringify(swapParams));
708
709
  if (!(this.wallet.key === "GnosisSafeWallet")) return [3 /*break*/, 5];
709
710
  _b.label = 1;
710
711
  case 1:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/openocean-sdk",
3
- "version": "1.2.86",
3
+ "version": "1.2.88",
4
4
  "description": "Openocean sdk",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {