@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.
@@ -4195,22 +4195,18 @@ var getUserRegisteredTokens = /*#__PURE__*/function () {
4195
4195
  }();
4196
4196
  var getAccountNearBalance = /*#__PURE__*/function () {
4197
4197
  var _ref11 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(accountId) {
4198
- var provider;
4199
4198
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
4200
4199
  while (1) {
4201
4200
  switch (_context9.prev = _context9.next) {
4202
4201
  case 0:
4203
- provider = new providers.JsonRpcProvider({
4204
- url: getConfig().nodeUrl
4205
- });
4206
- return _context9.abrupt("return", provider.query({
4202
+ return _context9.abrupt("return", near.connection.provider.query({
4207
4203
  request_type: 'view_account',
4208
4204
  finality: 'final',
4209
4205
  account_id: accountId
4210
4206
  }).then(function (data) {
4211
4207
  return data.amount;
4212
4208
  }));
4213
- case 2:
4209
+ case 1:
4214
4210
  case "end":
4215
4211
  return _context9.stop();
4216
4212
  }
@@ -4286,44 +4282,41 @@ var DCLSwapGetStorageBalance = function DCLSwapGetStorageBalance(tokenId, Accoun
4286
4282
  };
4287
4283
  var getMinStorageBalance = /*#__PURE__*/function () {
4288
4284
  var _ref14 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(nep141Address) {
4289
- var provider, result, balance;
4285
+ var result, balance;
4290
4286
  return _regeneratorRuntime().wrap(function _callee11$(_context11) {
4291
4287
  while (1) {
4292
4288
  switch (_context11.prev = _context11.next) {
4293
4289
  case 0:
4294
4290
  _context11.prev = 0;
4295
- provider = new providers.JsonRpcProvider({
4296
- url: getConfig().nodeUrl
4297
- });
4298
- _context11.next = 4;
4299
- return provider.query({
4291
+ _context11.next = 3;
4292
+ return near.connection.provider.query({
4300
4293
  request_type: 'call_function',
4301
4294
  account_id: nep141Address,
4302
4295
  method_name: 'storage_balance_bounds',
4303
4296
  args_base64: '',
4304
4297
  finality: 'optimistic'
4305
4298
  });
4306
- case 4:
4299
+ case 3:
4307
4300
  result = _context11.sent;
4308
4301
  balance = JSON.parse(Buffer.from(result.result).toString());
4309
4302
  if (!(!balance || !balance.min)) {
4310
- _context11.next = 8;
4303
+ _context11.next = 7;
4311
4304
  break;
4312
4305
  }
4313
4306
  return _context11.abrupt("return", FT_MINIMUM_STORAGE_BALANCE_LARGE);
4314
- case 8:
4307
+ case 7:
4315
4308
  return _context11.abrupt("return", balance.min);
4316
- case 11:
4317
- _context11.prev = 11;
4309
+ case 10:
4310
+ _context11.prev = 10;
4318
4311
  _context11.t0 = _context11["catch"](0);
4319
4312
  console.error(_context11.t0, nep141Address);
4320
4313
  return _context11.abrupt("return", FT_MINIMUM_STORAGE_BALANCE_LARGE);
4321
- case 15:
4314
+ case 14:
4322
4315
  case "end":
4323
4316
  return _context11.stop();
4324
4317
  }
4325
4318
  }
4326
- }, _callee11, null, [[0, 11]]);
4319
+ }, _callee11, null, [[0, 10]]);
4327
4320
  }));
4328
4321
  return function getMinStorageBalance(_x13) {
4329
4322
  return _ref14.apply(this, arguments);
@@ -7826,12 +7819,12 @@ function getDefaultTokenList() {
7826
7819
  var DCL_POOL_SPLITER = '|';
7827
7820
  var DCLSwap = /*#__PURE__*/function () {
7828
7821
  var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
7829
- 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;
7822
+ 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;
7830
7823
  return _regeneratorRuntime().wrap(function _callee$(_context) {
7831
7824
  while (1) {
7832
7825
  switch (_context.prev = _context.next) {
7833
7826
  case 0:
7834
- Swap = _ref.Swap, SwapByOutput = _ref.SwapByOutput, LimitOrderWithSwap = _ref.LimitOrderWithSwap, SwapByStopPoint = _ref.SwapByStopPoint, AccountId = _ref.AccountId, swapInfo = _ref.swapInfo;
7827
+ Swap = _ref.Swap, SwapByOutput = _ref.SwapByOutput, LimitOrderWithSwap = _ref.LimitOrderWithSwap, SwapByStopPoint = _ref.SwapByStopPoint, AccountId = _ref.AccountId, swapInfo = _ref.swapInfo, referralId = _ref.referralId;
7835
7828
  transactions = [];
7836
7829
  tokenA = swapInfo.tokenA, tokenB = swapInfo.tokenB, amountA = swapInfo.amountA;
7837
7830
  if (!Swap) {
@@ -7858,6 +7851,7 @@ var DCLSwap = /*#__PURE__*/function () {
7858
7851
  pool_ids: pool_ids,
7859
7852
  output_token: output_token,
7860
7853
  min_output_amount: min_output_amount,
7854
+ referral_id: referralId || '',
7861
7855
  client_id: ''
7862
7856
  }
7863
7857
  });
@@ -7889,6 +7883,7 @@ var DCLSwap = /*#__PURE__*/function () {
7889
7883
  pool_ids: _pool_ids,
7890
7884
  output_token: _output_token,
7891
7885
  output_amount: output_amount,
7886
+ referral_id: referralId || '',
7892
7887
  client_id: ''
7893
7888
  }
7894
7889
  });
@@ -7972,7 +7967,8 @@ var DCLSwap = /*#__PURE__*/function () {
7972
7967
  pool_id: pool_id,
7973
7968
  buy_token: buy_token,
7974
7969
  point: new_point,
7975
- client_id: ''
7970
+ client_id: '',
7971
+ referral_id: referralId || ''
7976
7972
  }
7977
7973
  });
7978
7974
  transactions.push({
@@ -8008,7 +8004,9 @@ var DCLSwap = /*#__PURE__*/function () {
8008
8004
  });
8009
8005
  }
8010
8006
  _msg3 = JSON.stringify({
8011
- SwapByStopPoint: SwapByStopPoint
8007
+ SwapByStopPoint: _extends({}, SwapByStopPoint, {
8008
+ referral_id: referralId || ''
8009
+ })
8012
8010
  });
8013
8011
  transactions.push({
8014
8012
  receiverId: tokenA.id,
@@ -8112,12 +8110,12 @@ var list_user_assets = /*#__PURE__*/function () {
8112
8110
  var DCLSwapByInputOnBestPool = /*#__PURE__*/function () {
8113
8111
  var _ref7 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
8114
8112
  var _bestEstimate$tag, _bestEstimate$tag$spl, _bestEstimate$tag2, _bestEstimate$tag2$sp;
8115
- var tokenA, tokenB, amountA, slippageTolerance, AccountId, estimates, bestEstimate, bestFee;
8113
+ var tokenA, tokenB, amountA, slippageTolerance, AccountId, referralId, estimates, bestEstimate, bestFee;
8116
8114
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
8117
8115
  while (1) {
8118
8116
  switch (_context5.prev = _context5.next) {
8119
8117
  case 0:
8120
- tokenA = _ref6.tokenA, tokenB = _ref6.tokenB, amountA = _ref6.amountA, slippageTolerance = _ref6.slippageTolerance, AccountId = _ref6.AccountId;
8118
+ tokenA = _ref6.tokenA, tokenB = _ref6.tokenB, amountA = _ref6.amountA, slippageTolerance = _ref6.slippageTolerance, AccountId = _ref6.AccountId, referralId = _ref6.referralId;
8121
8119
  if (!(slippageTolerance <= 0 || slippageTolerance >= 100)) {
8122
8120
  _context5.next = 3;
8123
8121
  break;
@@ -8179,7 +8177,8 @@ var DCLSwapByInputOnBestPool = /*#__PURE__*/function () {
8179
8177
  pool_ids: [getDCLPoolId(tokenA.id, tokenB.id, bestFee)],
8180
8178
  min_output_amount: percentLess(slippageTolerance, bestEstimate.amount)
8181
8179
  },
8182
- AccountId: AccountId
8180
+ AccountId: AccountId,
8181
+ referralId: referralId
8183
8182
  }));
8184
8183
  case 11:
8185
8184
  case "end":