@ref-finance/ref-sdk 1.3.11 → 1.3.12
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/constant.d.ts +1 -0
- package/dist/ref-sdk.cjs.development.js +78 -14
- 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 +77 -15
- package/dist/ref-sdk.esm.js.map +1 -1
- package/dist/ref-sdk.umd.development.js +81 -18
- 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/dist/ref.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('near-api-js'), require('bn.js'), require('fs'), require('lodash-es'), require('mathjs'), require('big.js'), require('react'), require('@react-icons/all-files/fi/FiChevronDown'), require('@react-icons/all-files/fi/FiChevronLeft'), require('@react-icons/all-files/fi/FiChevronUp'), require('@react-icons/all-files/fa/FaSearch'), require('@react-icons/all-files/ri/RiRefreshLine'), require('@react-icons/all-files/ti/TiArrowSortedUp'), require('@react-icons/all-files/ti/TiArrowSortedDown'), require('@react-icons/all-files/hi/HiOutlineExternalLink'), require('@react-icons/all-files/ai/AiFillPushpin'), require('@react-icons/all-files/ai/AiOutlinePushpin'), require('@react-icons/all-files/ri/RiExchangeFill'), require('@react-icons/all-files/io5/IoWarning'), require('@react-icons/all-files/io5/IoCloseOutline'), require('@react-icons/all-files/ti/TiWarning'), require('@react-icons/all-files/cg/CgArrowsExchangeAltV')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'near-api-js', 'bn.js', 'fs', 'lodash-es', 'mathjs', 'big.js', 'react', '@react-icons/all-files/fi/FiChevronDown', '@react-icons/all-files/fi/FiChevronLeft', '@react-icons/all-files/fi/FiChevronUp', '@react-icons/all-files/fa/FaSearch', '@react-icons/all-files/ri/RiRefreshLine', '@react-icons/all-files/ti/TiArrowSortedUp', '@react-icons/all-files/ti/TiArrowSortedDown', '@react-icons/all-files/hi/HiOutlineExternalLink', '@react-icons/all-files/ai/AiFillPushpin', '@react-icons/all-files/ai/AiOutlinePushpin', '@react-icons/all-files/ri/RiExchangeFill', '@react-icons/all-files/io5/IoWarning', '@react-icons/all-files/io5/IoCloseOutline', '@react-icons/all-files/ti/TiWarning', '@react-icons/all-files/cg/CgArrowsExchangeAltV'], factory) :
|
|
4
|
-
(global = global || self, factory(global['@ref-finance/ref-sdk'] = {}, global.nearApiJs, global.BN, global.fs, global._, global.math, global.Big, global.React, global.FiChevronDown, global.FiChevronLeft, global.FiChevronUp, global.FaSearch, global.RiRefreshLine, global.TiArrowSortedUp, global.TiArrowSortedDown, global.HiOutlineExternalLink, global.AiFillPushpin, global.AiOutlinePushpin, global.RiExchangeFill, global.IoWarning, global.IoCloseOutline, global.TiWarning, global.CgArrowsExchangeAltV));
|
|
5
|
-
}(this, (function (exports, nearApiJs, BN, fs, _, math, Big, React, FiChevronDown, FiChevronLeft, FiChevronUp, FaSearch, RiRefreshLine, TiArrowSortedUp, TiArrowSortedDown, HiOutlineExternalLink, AiFillPushpin, AiOutlinePushpin, RiExchangeFill, IoWarning, IoCloseOutline, TiWarning, CgArrowsExchangeAltV) { 'use strict';
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('near-api-js'), require('bn.js'), require('fs'), require('lodash-es'), require('mathjs'), require('big.js'), require('near-api-js/lib/utils/format'), require('react'), require('@react-icons/all-files/fi/FiChevronDown'), require('@react-icons/all-files/fi/FiChevronLeft'), require('@react-icons/all-files/fi/FiChevronUp'), require('@react-icons/all-files/fa/FaSearch'), require('@react-icons/all-files/ri/RiRefreshLine'), require('@react-icons/all-files/ti/TiArrowSortedUp'), require('@react-icons/all-files/ti/TiArrowSortedDown'), require('@react-icons/all-files/hi/HiOutlineExternalLink'), require('@react-icons/all-files/ai/AiFillPushpin'), require('@react-icons/all-files/ai/AiOutlinePushpin'), require('@react-icons/all-files/ri/RiExchangeFill'), require('@react-icons/all-files/io5/IoWarning'), require('@react-icons/all-files/io5/IoCloseOutline'), require('@react-icons/all-files/ti/TiWarning'), require('@react-icons/all-files/cg/CgArrowsExchangeAltV')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'near-api-js', 'bn.js', 'fs', 'lodash-es', 'mathjs', 'big.js', 'near-api-js/lib/utils/format', 'react', '@react-icons/all-files/fi/FiChevronDown', '@react-icons/all-files/fi/FiChevronLeft', '@react-icons/all-files/fi/FiChevronUp', '@react-icons/all-files/fa/FaSearch', '@react-icons/all-files/ri/RiRefreshLine', '@react-icons/all-files/ti/TiArrowSortedUp', '@react-icons/all-files/ti/TiArrowSortedDown', '@react-icons/all-files/hi/HiOutlineExternalLink', '@react-icons/all-files/ai/AiFillPushpin', '@react-icons/all-files/ai/AiOutlinePushpin', '@react-icons/all-files/ri/RiExchangeFill', '@react-icons/all-files/io5/IoWarning', '@react-icons/all-files/io5/IoCloseOutline', '@react-icons/all-files/ti/TiWarning', '@react-icons/all-files/cg/CgArrowsExchangeAltV'], factory) :
|
|
4
|
+
(global = global || self, factory(global['@ref-finance/ref-sdk'] = {}, global.nearApiJs, global.BN, global.fs, global._, global.math, global.Big, global.format, global.React, global.FiChevronDown, global.FiChevronLeft, global.FiChevronUp, global.FaSearch, global.RiRefreshLine, global.TiArrowSortedUp, global.TiArrowSortedDown, global.HiOutlineExternalLink, global.AiFillPushpin, global.AiOutlinePushpin, global.RiExchangeFill, global.IoWarning, global.IoCloseOutline, global.TiWarning, global.CgArrowsExchangeAltV));
|
|
5
|
+
}(this, (function (exports, nearApiJs, BN, fs, _, math, Big, format, React, FiChevronDown, FiChevronLeft, FiChevronUp, FaSearch, RiRefreshLine, TiArrowSortedUp, TiArrowSortedDown, HiOutlineExternalLink, AiFillPushpin, AiOutlinePushpin, RiExchangeFill, IoWarning, IoCloseOutline, TiWarning, CgArrowsExchangeAltV) { 'use strict';
|
|
6
6
|
|
|
7
7
|
BN = BN && Object.prototype.hasOwnProperty.call(BN, 'default') ? BN['default'] : BN;
|
|
8
8
|
fs = fs && Object.prototype.hasOwnProperty.call(fs, 'default') ? fs['default'] : fs;
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
var STABLE_LP_TOKEN_DECIMALS = 18;
|
|
15
15
|
var RATED_POOL_LP_TOKEN_DECIMALS = 24;
|
|
16
16
|
var STORAGE_TO_REGISTER_WITH_MFT = '0.1';
|
|
17
|
+
//0.0125 NEAR
|
|
18
|
+
var FT_MINIMUM_STORAGE_BALANCE_LARGE = "12500000000000000000000";
|
|
17
19
|
var ONE_YOCTO_NEAR = '0.000000000000000000000001';
|
|
18
20
|
var ENV = '';
|
|
19
21
|
var INDEXER_URL = '';
|
|
@@ -4259,6 +4261,51 @@
|
|
|
4259
4261
|
}
|
|
4260
4262
|
});
|
|
4261
4263
|
};
|
|
4264
|
+
var getMinStorageBalance = /*#__PURE__*/function () {
|
|
4265
|
+
var _ref14 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(nep141Address) {
|
|
4266
|
+
var provider, result, balance;
|
|
4267
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
4268
|
+
while (1) {
|
|
4269
|
+
switch (_context11.prev = _context11.next) {
|
|
4270
|
+
case 0:
|
|
4271
|
+
_context11.prev = 0;
|
|
4272
|
+
provider = new nearApiJs.providers.JsonRpcProvider({
|
|
4273
|
+
url: getConfig().nodeUrl
|
|
4274
|
+
});
|
|
4275
|
+
_context11.next = 4;
|
|
4276
|
+
return provider.query({
|
|
4277
|
+
request_type: 'call_function',
|
|
4278
|
+
account_id: nep141Address,
|
|
4279
|
+
method_name: 'storage_balance_bounds',
|
|
4280
|
+
args_base64: '',
|
|
4281
|
+
finality: 'optimistic'
|
|
4282
|
+
});
|
|
4283
|
+
case 4:
|
|
4284
|
+
result = _context11.sent;
|
|
4285
|
+
balance = JSON.parse(Buffer.from(result.result).toString());
|
|
4286
|
+
if (!(!balance || !balance.min)) {
|
|
4287
|
+
_context11.next = 8;
|
|
4288
|
+
break;
|
|
4289
|
+
}
|
|
4290
|
+
return _context11.abrupt("return", FT_MINIMUM_STORAGE_BALANCE_LARGE);
|
|
4291
|
+
case 8:
|
|
4292
|
+
return _context11.abrupt("return", balance.min);
|
|
4293
|
+
case 11:
|
|
4294
|
+
_context11.prev = 11;
|
|
4295
|
+
_context11.t0 = _context11["catch"](0);
|
|
4296
|
+
console.error(_context11.t0, nep141Address);
|
|
4297
|
+
return _context11.abrupt("return", FT_MINIMUM_STORAGE_BALANCE_LARGE);
|
|
4298
|
+
case 15:
|
|
4299
|
+
case "end":
|
|
4300
|
+
return _context11.stop();
|
|
4301
|
+
}
|
|
4302
|
+
}
|
|
4303
|
+
}, _callee11, null, [[0, 11]]);
|
|
4304
|
+
}));
|
|
4305
|
+
return function getMinStorageBalance(_x13) {
|
|
4306
|
+
return _ref14.apply(this, arguments);
|
|
4307
|
+
};
|
|
4308
|
+
}();
|
|
4262
4309
|
|
|
4263
4310
|
var DCL_POOL_FEE_LIST = [100, 400, 2000, 10000];
|
|
4264
4311
|
var getDCLPoolId = function getDCLPoolId(tokenA, tokenB, fee) {
|
|
@@ -4359,21 +4406,35 @@
|
|
|
4359
4406
|
});
|
|
4360
4407
|
case 2:
|
|
4361
4408
|
tokenRegistered = _context.sent;
|
|
4362
|
-
if (tokenRegistered === null) {
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
functionCalls: [{
|
|
4366
|
-
methodName: 'storage_deposit',
|
|
4367
|
-
args: {
|
|
4368
|
-
registration_only: true,
|
|
4369
|
-
account_id: AccountId
|
|
4370
|
-
},
|
|
4371
|
-
gas: '30000000000000',
|
|
4372
|
-
amount: STORAGE_TO_REGISTER_WITH_MFT
|
|
4373
|
-
}]
|
|
4374
|
-
});
|
|
4409
|
+
if (!(tokenRegistered === null)) {
|
|
4410
|
+
_context.next = 16;
|
|
4411
|
+
break;
|
|
4375
4412
|
}
|
|
4376
|
-
|
|
4413
|
+
_context.t0 = transactions;
|
|
4414
|
+
_context.t1 = token.id;
|
|
4415
|
+
_context.t2 = {
|
|
4416
|
+
registration_only: true,
|
|
4417
|
+
account_id: AccountId
|
|
4418
|
+
};
|
|
4419
|
+
_context.t3 = format.formatNearAmount;
|
|
4420
|
+
_context.next = 10;
|
|
4421
|
+
return getMinStorageBalance(token.id);
|
|
4422
|
+
case 10:
|
|
4423
|
+
_context.t4 = _context.sent;
|
|
4424
|
+
_context.t5 = (0, _context.t3)(_context.t4, 24);
|
|
4425
|
+
_context.t6 = {
|
|
4426
|
+
methodName: 'storage_deposit',
|
|
4427
|
+
args: _context.t2,
|
|
4428
|
+
gas: '30000000000000',
|
|
4429
|
+
amount: _context.t5
|
|
4430
|
+
};
|
|
4431
|
+
_context.t7 = [_context.t6];
|
|
4432
|
+
_context.t8 = {
|
|
4433
|
+
receiverId: _context.t1,
|
|
4434
|
+
functionCalls: _context.t7
|
|
4435
|
+
};
|
|
4436
|
+
_context.t0.push.call(_context.t0, _context.t8);
|
|
4437
|
+
case 16:
|
|
4377
4438
|
case "end":
|
|
4378
4439
|
return _context.stop();
|
|
4379
4440
|
}
|
|
@@ -8230,6 +8291,7 @@
|
|
|
8230
8291
|
exports.DefaultMainnetTokenList = DefaultMainnetTokenList;
|
|
8231
8292
|
exports.DefaultTestnetTokenList = DefaultTestnetTokenList;
|
|
8232
8293
|
exports.FEE_DIVISOR = FEE_DIVISOR;
|
|
8294
|
+
exports.FT_MINIMUM_STORAGE_BALANCE_LARGE = FT_MINIMUM_STORAGE_BALANCE_LARGE;
|
|
8233
8295
|
exports.InValidAccessKeyError = InValidAccessKeyError;
|
|
8234
8296
|
exports.NEAR_META_DATA = NEAR_META_DATA;
|
|
8235
8297
|
exports.NoAccountIdFound = NoAccountIdFound;
|
|
@@ -8300,6 +8362,7 @@
|
|
|
8300
8362
|
exports.getKeyStore = getKeyStore;
|
|
8301
8363
|
exports.getMax = getMax;
|
|
8302
8364
|
exports.getMemorySigner = getMemorySigner;
|
|
8365
|
+
exports.getMinStorageBalance = getMinStorageBalance;
|
|
8303
8366
|
exports.getPointByPrice = getPointByPrice;
|
|
8304
8367
|
exports.getPool = getPool;
|
|
8305
8368
|
exports.getPoolAllocationPercents = getPoolAllocationPercents;
|