@ref-finance/ref-sdk 1.3.1 → 1.3.2

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/README.md CHANGED
@@ -1273,6 +1273,11 @@ interface DCLSwapProps {
1273
1273
  pool_id: string;
1274
1274
  output_amount: string;
1275
1275
  };
1276
+ SwapByStopPoint?: {
1277
+ pool_id: string;
1278
+ stop_point: number;
1279
+ skip_unwrap_near: boolean;
1280
+ };
1276
1281
  AccountId: string;
1277
1282
  }
1278
1283
  ```
@@ -1439,6 +1444,61 @@ Response (LimitOrderWithSwap)
1439
1444
 
1440
1445
  ```
1441
1446
 
1447
+ Example (SwapByStopPoint)
1448
+
1449
+ ```plain
1450
+ const tokenA = "usdt.fakes.testnet";
1451
+
1452
+ const tokenB = "wrap.testnet";
1453
+
1454
+ const fee = 2000
1455
+
1456
+ const pool_ids = [getDCLPoolId(tokenA, tokenB, fee)];
1457
+
1458
+
1459
+ const tokenAMetadata = await ftGetTokenMetadata(tokenA)
1460
+
1461
+ const tokenBMetadata = await ftGetTokenMetadata(tokenB)
1462
+
1463
+
1464
+ const res = await DCLSwap({
1465
+ swapInfo: {
1466
+ amountA: input_amount,
1467
+ tokenA: tokenAMetadata,
1468
+ tokenB: tokenBMetadata,
1469
+ },
1470
+ SwapByStopPoint: {
1471
+ pool_id: pool_id,
1472
+ stop_point: 405920,
1473
+ },
1474
+ AccountId,
1475
+ });
1476
+ ```
1477
+
1478
+ Response (SwapByStopPoint)
1479
+
1480
+ ```
1481
+
1482
+ [
1483
+ {
1484
+ receiverId: "usdt.fakes.testnet",
1485
+ functionCalls: [
1486
+ {
1487
+ methodName: "ft_transfer_call",
1488
+ args: {
1489
+ receiver_id: "dcl.ref-dev.testnet",
1490
+ amount: "1000000",
1491
+ msg: '{"SwapByStopPoint":{"pool_id":"usdt.fakes.testnet|wrap.testnet|2000","stop_point":495240}}',
1492
+ },
1493
+ gas: "180000000000000",
1494
+ amount: "0.000000000000000000000001",
1495
+ },
1496
+ ],
1497
+ },
1498
+ ];
1499
+
1500
+ ```
1501
+
1442
1502
  ---
1443
1503
 
1444
1504
  #### DCLSwapByInputOnBestPool
@@ -3884,11 +3884,7 @@ var refFiViewFunction = /*#__PURE__*/function () {
3884
3884
  return near.account(exports.REF_FI_CONTRACT_ID);
3885
3885
  case 3:
3886
3886
  nearConnection = _context.sent;
3887
- return _context.abrupt("return", nearConnection.viewFunction({
3888
- contractId: exports.REF_FI_CONTRACT_ID,
3889
- methodName: methodName,
3890
- args: args
3891
- }));
3887
+ return _context.abrupt("return", nearConnection.viewFunction(exports.REF_FI_CONTRACT_ID, methodName, args));
3892
3888
  case 5:
3893
3889
  case "end":
3894
3890
  return _context.stop();
@@ -3912,11 +3908,7 @@ var ftViewFunction = /*#__PURE__*/function () {
3912
3908
  return near.account(exports.REF_FI_CONTRACT_ID);
3913
3909
  case 3:
3914
3910
  nearConnection = _context2.sent;
3915
- return _context2.abrupt("return", nearConnection.viewFunction({
3916
- contractId: tokenId,
3917
- methodName: methodName,
3918
- args: args
3919
- }));
3911
+ return _context2.abrupt("return", nearConnection.viewFunction(tokenId, methodName, args));
3920
3912
  case 5:
3921
3913
  case "end":
3922
3914
  return _context2.stop();
@@ -4208,11 +4200,7 @@ var refDCLSwapViewFunction = /*#__PURE__*/function () {
4208
4200
  }
4209
4201
  throw DCLInValid;
4210
4202
  case 6:
4211
- return _context10.abrupt("return", nearConnection.viewFunction({
4212
- contractId: exports.config.REF_DCL_SWAP_CONTRACT_ID,
4213
- methodName: methodName,
4214
- args: args
4215
- }));
4203
+ return _context10.abrupt("return", nearConnection.viewFunction(exports.config.REF_DCL_SWAP_CONTRACT_ID, methodName, args));
4216
4204
  case 7:
4217
4205
  case "end":
4218
4206
  return _context10.stop();