@ref-finance/ref-sdk 1.3.0 → 1.3.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/dist/dcl-swap/swap.d.ts +6 -1
- package/dist/ref-sdk.cjs.development.js +46 -11
- package/dist/ref-sdk.cjs.development.js.map +1 -1
- package/dist/ref-sdk.cjs.production.min.js +1 -1
- package/dist/ref-sdk.cjs.production.min.js.map +1 -1
- package/dist/ref-sdk.esm.js +46 -11
- package/dist/ref-sdk.esm.js.map +1 -1
- package/dist/ref-sdk.umd.development.js +46 -11
- package/dist/ref-sdk.umd.development.js.map +1 -1
- package/dist/ref-sdk.umd.production.min.js +1 -1
- package/dist/ref-sdk.umd.production.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -7518,12 +7518,12 @@
|
|
|
7518
7518
|
var DCL_POOL_SPLITER = '|';
|
|
7519
7519
|
var DCLSwap = /*#__PURE__*/function () {
|
|
7520
7520
|
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
7521
|
-
var Swap, SwapByOutput, LimitOrderWithSwap, AccountId, swapInfo, transactions, tokenA, tokenB, amountA, pool_ids, tokenRegistered, output_token, min_output_amount, msg, _pool_ids, _output_token, output_amount, _msg, _tokenRegistered, pool_id, fee, buy_token, point, _tokenRegistered2, DCLRegistered, new_point, _msg2, registered;
|
|
7521
|
+
var Swap, SwapByOutput, LimitOrderWithSwap, SwapByStopPoint, AccountId, swapInfo, transactions, tokenA, tokenB, amountA, pool_ids, tokenRegistered, output_token, min_output_amount, msg, _pool_ids, _output_token, output_amount, _msg, _tokenRegistered, pool_id, fee, buy_token, point, _tokenRegistered2, DCLRegistered, new_point, _msg2, _tokenRegistered3, _msg3, registered;
|
|
7522
7522
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7523
7523
|
while (1) {
|
|
7524
7524
|
switch (_context.prev = _context.next) {
|
|
7525
7525
|
case 0:
|
|
7526
|
-
Swap = _ref.Swap, SwapByOutput = _ref.SwapByOutput, LimitOrderWithSwap = _ref.LimitOrderWithSwap, AccountId = _ref.AccountId, swapInfo = _ref.swapInfo;
|
|
7526
|
+
Swap = _ref.Swap, SwapByOutput = _ref.SwapByOutput, LimitOrderWithSwap = _ref.LimitOrderWithSwap, SwapByStopPoint = _ref.SwapByStopPoint, AccountId = _ref.AccountId, swapInfo = _ref.swapInfo;
|
|
7527
7527
|
transactions = [];
|
|
7528
7528
|
tokenA = swapInfo.tokenA, tokenB = swapInfo.tokenB, amountA = swapInfo.amountA;
|
|
7529
7529
|
if (!Swap) {
|
|
@@ -7566,7 +7566,7 @@
|
|
|
7566
7566
|
amount: ONE_YOCTO_NEAR
|
|
7567
7567
|
}]
|
|
7568
7568
|
});
|
|
7569
|
-
_context.next =
|
|
7569
|
+
_context.next = 52;
|
|
7570
7570
|
break;
|
|
7571
7571
|
case 15:
|
|
7572
7572
|
if (!SwapByOutput) {
|
|
@@ -7609,11 +7609,11 @@
|
|
|
7609
7609
|
amount: ONE_YOCTO_NEAR
|
|
7610
7610
|
}]
|
|
7611
7611
|
});
|
|
7612
|
-
_context.next =
|
|
7612
|
+
_context.next = 52;
|
|
7613
7613
|
break;
|
|
7614
7614
|
case 27:
|
|
7615
7615
|
if (!LimitOrderWithSwap) {
|
|
7616
|
-
_context.next =
|
|
7616
|
+
_context.next = 45;
|
|
7617
7617
|
break;
|
|
7618
7618
|
}
|
|
7619
7619
|
pool_id = LimitOrderWithSwap.pool_id;
|
|
@@ -7680,14 +7680,49 @@
|
|
|
7680
7680
|
amount: ONE_YOCTO_NEAR
|
|
7681
7681
|
}]
|
|
7682
7682
|
});
|
|
7683
|
-
|
|
7683
|
+
_context.next = 52;
|
|
7684
|
+
break;
|
|
7685
|
+
case 45:
|
|
7686
|
+
if (!SwapByStopPoint) {
|
|
7687
|
+
_context.next = 52;
|
|
7688
|
+
break;
|
|
7689
|
+
}
|
|
7690
|
+
_context.next = 48;
|
|
7691
|
+
return ftGetStorageBalance(tokenB.id, AccountId)["catch"](function () {
|
|
7692
|
+
throw new Error(tokenB.id + " doesn't exist.");
|
|
7693
|
+
});
|
|
7694
|
+
case 48:
|
|
7695
|
+
_tokenRegistered3 = _context.sent;
|
|
7696
|
+
if (_tokenRegistered3 === null) {
|
|
7697
|
+
transactions.push({
|
|
7698
|
+
receiverId: tokenB.id,
|
|
7699
|
+
functionCalls: [registerAccountOnToken(AccountId)]
|
|
7700
|
+
});
|
|
7701
|
+
}
|
|
7702
|
+
_msg3 = JSON.stringify({
|
|
7703
|
+
SwapByStopPoint: SwapByStopPoint
|
|
7704
|
+
});
|
|
7705
|
+
transactions.push({
|
|
7706
|
+
receiverId: tokenA.id,
|
|
7707
|
+
functionCalls: [{
|
|
7708
|
+
methodName: 'ft_transfer_call',
|
|
7709
|
+
args: {
|
|
7710
|
+
receiver_id: exports.config.REF_DCL_SWAP_CONTRACT_ID,
|
|
7711
|
+
amount: toNonDivisibleNumber(tokenA.decimals, amountA),
|
|
7712
|
+
msg: _msg3
|
|
7713
|
+
},
|
|
7714
|
+
gas: '180000000000000',
|
|
7715
|
+
amount: ONE_YOCTO_NEAR
|
|
7716
|
+
}]
|
|
7717
|
+
});
|
|
7718
|
+
case 52:
|
|
7684
7719
|
if (!(tokenA.id === exports.WRAP_NEAR_CONTRACT_ID)) {
|
|
7685
|
-
_context.next =
|
|
7720
|
+
_context.next = 57;
|
|
7686
7721
|
break;
|
|
7687
7722
|
}
|
|
7688
|
-
_context.next =
|
|
7723
|
+
_context.next = 55;
|
|
7689
7724
|
return ftGetStorageBalance(exports.WRAP_NEAR_CONTRACT_ID, AccountId);
|
|
7690
|
-
case
|
|
7725
|
+
case 55:
|
|
7691
7726
|
registered = _context.sent;
|
|
7692
7727
|
if (registered === null) {
|
|
7693
7728
|
transactions.unshift({
|
|
@@ -7695,9 +7730,9 @@
|
|
|
7695
7730
|
functionCalls: [registerAccountOnToken(AccountId)]
|
|
7696
7731
|
});
|
|
7697
7732
|
}
|
|
7698
|
-
case
|
|
7733
|
+
case 57:
|
|
7699
7734
|
return _context.abrupt("return", transactions);
|
|
7700
|
-
case
|
|
7735
|
+
case 58:
|
|
7701
7736
|
case "end":
|
|
7702
7737
|
return _context.stop();
|
|
7703
7738
|
}
|