@openocean.finance/openocean-sdk 1.2.84 → 1.2.87

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.
@@ -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,13 +617,13 @@ 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, myWallet, contract, invitee, path, amounts, swapAddr, swapExtraData, swapParams, maxFeePerGas, maxPriorityFeePerGas;
620
+ var _a, inToken, inAmount, outAmount, outToken, data, to, ethGasPrice, gasPrice, value, 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;
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
627
  console.log('sendEthTransactionNew');
628
628
  myWallet = this.wallet.sdk;
629
629
  contract = new myWallet.eth.Contract(aggregator_1.aggregator, (0, config_1.getProxyContract)(this.chain.key));
@@ -654,6 +654,9 @@ 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;
659
+ }
657
660
  contract.methods
658
661
  .swap(invitee, path, amounts, swapAddr, swapExtraData)
659
662
  .send(swapParams)
@@ -674,13 +677,13 @@ var Swap = /** @class */ (function () {
674
677
  };
675
678
  Swap.prototype.sendEthTransaction = function () {
676
679
  return __awaiter(this, void 0, void 0, function () {
677
- var _a, inToken, inAmount, data, to, ethGasPrice, gasPrice, estimatedGas, swapParams, maxFeePerGas, maxPriorityFeePerGas, safeTxHash, e_6, gas, e_7;
680
+ var _a, inToken, inAmount, data, to, ethGasPrice, gasPrice, estimatedGas, value, swapParams, maxFeePerGas, maxPriorityFeePerGas, safeTxHash, e_6, gas, e_7;
678
681
  var _this = this;
679
682
  return __generator(this, function (_b) {
680
683
  switch (_b.label) {
681
684
  case 0:
682
- _a = this.res, inToken = _a.inToken, inAmount = _a.inAmount, data = _a.data, to = _a.to, ethGasPrice = _a.ethGasPrice, gasPrice = _a.gasPrice, estimatedGas = _a.estimatedGas;
683
- 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, value = _a.value;
686
+ console.log('sendEthTransaction res', JSON.stringify(this.res));
684
687
  swapParams = {
685
688
  from: this.wallet.address,
686
689
  to: to,
@@ -699,6 +702,10 @@ var Swap = /** @class */ (function () {
699
702
  if (wallet_1.chainsObj.isNativeToken(this.chain.key, inToken.address)) {
700
703
  swapParams.value = inAmount;
701
704
  }
705
+ else if (value) {
706
+ swapParams.value = value;
707
+ }
708
+ console.log('sendEthTransaction swapParams', JSON.stringify(swapParams));
702
709
  if (!(this.wallet.key === "GnosisSafeWallet")) return [3 /*break*/, 5];
703
710
  _b.label = 1;
704
711
  case 1:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/openocean-sdk",
3
- "version": "1.2.84",
3
+ "version": "1.2.87",
4
4
  "description": "Openocean sdk",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {