@ref-finance/ref-sdk 1.4.8 → 1.5.0

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.
@@ -4181,22 +4181,18 @@
4181
4181
  }();
4182
4182
  var getAccountNearBalance = /*#__PURE__*/function () {
4183
4183
  var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(accountId) {
4184
- var provider;
4185
4184
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
4186
4185
  while (1) {
4187
4186
  switch (_context9.prev = _context9.next) {
4188
4187
  case 0:
4189
- provider = new nearApiJs.providers.JsonRpcProvider({
4190
- url: getConfig().nodeUrl
4191
- });
4192
- return _context9.abrupt("return", provider.query({
4188
+ return _context9.abrupt("return", near.connection.provider.query({
4193
4189
  request_type: 'view_account',
4194
4190
  finality: 'final',
4195
4191
  account_id: accountId
4196
4192
  }).then(function (data) {
4197
4193
  return data.amount;
4198
4194
  }));
4199
- case 2:
4195
+ case 1:
4200
4196
  case "end":
4201
4197
  return _context9.stop();
4202
4198
  }
@@ -4272,44 +4268,41 @@
4272
4268
  };
4273
4269
  var getMinStorageBalance = /*#__PURE__*/function () {
4274
4270
  var _ref14 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(nep141Address) {
4275
- var provider, result, balance;
4271
+ var result, balance;
4276
4272
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
4277
4273
  while (1) {
4278
4274
  switch (_context11.prev = _context11.next) {
4279
4275
  case 0:
4280
4276
  _context11.prev = 0;
4281
- provider = new nearApiJs.providers.JsonRpcProvider({
4282
- url: getConfig().nodeUrl
4283
- });
4284
- _context11.next = 4;
4285
- return provider.query({
4277
+ _context11.next = 3;
4278
+ return near.connection.provider.query({
4286
4279
  request_type: 'call_function',
4287
4280
  account_id: nep141Address,
4288
4281
  method_name: 'storage_balance_bounds',
4289
4282
  args_base64: '',
4290
4283
  finality: 'optimistic'
4291
4284
  });
4292
- case 4:
4285
+ case 3:
4293
4286
  result = _context11.sent;
4294
4287
  balance = JSON.parse(Buffer.from(result.result).toString());
4295
4288
  if (!(!balance || !balance.min)) {
4296
- _context11.next = 8;
4289
+ _context11.next = 7;
4297
4290
  break;
4298
4291
  }
4299
4292
  return _context11.abrupt("return", FT_MINIMUM_STORAGE_BALANCE_LARGE);
4300
- case 8:
4293
+ case 7:
4301
4294
  return _context11.abrupt("return", balance.min);
4302
- case 11:
4303
- _context11.prev = 11;
4295
+ case 10:
4296
+ _context11.prev = 10;
4304
4297
  _context11.t0 = _context11["catch"](0);
4305
4298
  console.error(_context11.t0, nep141Address);
4306
4299
  return _context11.abrupt("return", FT_MINIMUM_STORAGE_BALANCE_LARGE);
4307
- case 15:
4300
+ case 14:
4308
4301
  case "end":
4309
4302
  return _context11.stop();
4310
4303
  }
4311
4304
  }
4312
- }, _callee11, null, [[0, 11]]);
4305
+ }, _callee11, null, [[0, 10]]);
4313
4306
  }));
4314
4307
  return function getMinStorageBalance(_x13) {
4315
4308
  return _ref14.apply(this, arguments);
@@ -7812,12 +7805,12 @@
7812
7805
  var DCL_POOL_SPLITER = '|';
7813
7806
  var DCLSwap = /*#__PURE__*/function () {
7814
7807
  var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7815
- 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;
7808
+ var Swap, SwapByOutput, LimitOrderWithSwap, SwapByStopPoint, AccountId, swapInfo, referralId, 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;
7816
7809
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7817
7810
  while (1) {
7818
7811
  switch (_context.prev = _context.next) {
7819
7812
  case 0:
7820
- Swap = _ref.Swap, SwapByOutput = _ref.SwapByOutput, LimitOrderWithSwap = _ref.LimitOrderWithSwap, SwapByStopPoint = _ref.SwapByStopPoint, AccountId = _ref.AccountId, swapInfo = _ref.swapInfo;
7813
+ Swap = _ref.Swap, SwapByOutput = _ref.SwapByOutput, LimitOrderWithSwap = _ref.LimitOrderWithSwap, SwapByStopPoint = _ref.SwapByStopPoint, AccountId = _ref.AccountId, swapInfo = _ref.swapInfo, referralId = _ref.referralId;
7821
7814
  transactions = [];
7822
7815
  tokenA = swapInfo.tokenA, tokenB = swapInfo.tokenB, amountA = swapInfo.amountA;
7823
7816
  if (!Swap) {
@@ -7844,6 +7837,7 @@
7844
7837
  pool_ids: pool_ids,
7845
7838
  output_token: output_token,
7846
7839
  min_output_amount: min_output_amount,
7840
+ referral_id: referralId || '',
7847
7841
  client_id: ''
7848
7842
  }
7849
7843
  });
@@ -7875,6 +7869,7 @@
7875
7869
  pool_ids: _pool_ids,
7876
7870
  output_token: _output_token,
7877
7871
  output_amount: output_amount,
7872
+ referral_id: referralId || '',
7878
7873
  client_id: ''
7879
7874
  }
7880
7875
  });
@@ -7958,7 +7953,8 @@
7958
7953
  pool_id: pool_id,
7959
7954
  buy_token: buy_token,
7960
7955
  point: new_point,
7961
- client_id: ''
7956
+ client_id: '',
7957
+ referral_id: referralId || ''
7962
7958
  }
7963
7959
  });
7964
7960
  transactions.push({
@@ -7994,7 +7990,9 @@
7994
7990
  });
7995
7991
  }
7996
7992
  _msg3 = JSON.stringify({
7997
- SwapByStopPoint: SwapByStopPoint
7993
+ SwapByStopPoint: _extends({}, SwapByStopPoint, {
7994
+ referral_id: referralId || ''
7995
+ })
7998
7996
  });
7999
7997
  transactions.push({
8000
7998
  receiverId: tokenA.id,
@@ -8098,12 +8096,12 @@
8098
8096
  var DCLSwapByInputOnBestPool = /*#__PURE__*/function () {
8099
8097
  var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
8100
8098
  var _bestEstimate$tag, _bestEstimate$tag$spl, _bestEstimate$tag2, _bestEstimate$tag2$sp;
8101
- var tokenA, tokenB, amountA, slippageTolerance, AccountId, estimates, bestEstimate, bestFee;
8099
+ var tokenA, tokenB, amountA, slippageTolerance, AccountId, referralId, estimates, bestEstimate, bestFee;
8102
8100
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
8103
8101
  while (1) {
8104
8102
  switch (_context5.prev = _context5.next) {
8105
8103
  case 0:
8106
- tokenA = _ref6.tokenA, tokenB = _ref6.tokenB, amountA = _ref6.amountA, slippageTolerance = _ref6.slippageTolerance, AccountId = _ref6.AccountId;
8104
+ tokenA = _ref6.tokenA, tokenB = _ref6.tokenB, amountA = _ref6.amountA, slippageTolerance = _ref6.slippageTolerance, AccountId = _ref6.AccountId, referralId = _ref6.referralId;
8107
8105
  if (!(slippageTolerance <= 0 || slippageTolerance >= 100)) {
8108
8106
  _context5.next = 3;
8109
8107
  break;
@@ -8165,7 +8163,8 @@
8165
8163
  pool_ids: [getDCLPoolId(tokenA.id, tokenB.id, bestFee)],
8166
8164
  min_output_amount: percentLess(slippageTolerance, bestEstimate.amount)
8167
8165
  },
8168
- AccountId: AccountId
8166
+ AccountId: AccountId,
8167
+ referralId: referralId
8169
8168
  }));
8170
8169
  case 11:
8171
8170
  case "end":