@proton/wrap-constants 0.2.12 → 0.2.16
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/parsers/dex.d.ts +23 -0
- package/dist/wrap-constants.cjs.development.js +39 -8
- package/dist/wrap-constants.cjs.development.js.map +1 -1
- package/dist/wrap-constants.cjs.production.min.js +1 -1
- package/dist/wrap-constants.cjs.production.min.js.map +1 -1
- package/dist/wrap-constants.esm.js +39 -9
- package/dist/wrap-constants.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/coins.ts +25 -0
- package/src/math.ts +8 -8
- package/src/parsers/dex.ts +10 -0
|
@@ -618,6 +618,28 @@ var initializeCoins = function initializeCoins(protonChain) {
|
|
|
618
618
|
}] : []),
|
|
619
619
|
image: 'https://www.proton.org/images/tokens/xtokensXBCH.png',
|
|
620
620
|
coingeckoId: 'bitcoin-cash'
|
|
621
|
+
}, {
|
|
622
|
+
allowSwap: false,
|
|
623
|
+
allowBridge: true,
|
|
624
|
+
allowLend: false,
|
|
625
|
+
allowBorrow: false,
|
|
626
|
+
name: 'Lunar Crush',
|
|
627
|
+
coin: 'LUNR',
|
|
628
|
+
xtokenSymbol: 'XLUNR',
|
|
629
|
+
xtokenPrecision: 4,
|
|
630
|
+
xtokenContract: 'xtokens',
|
|
631
|
+
wallets: [].concat(IS_MAINNET ? [{
|
|
632
|
+
wallet: 'LUNR',
|
|
633
|
+
symbol: 'LUNR',
|
|
634
|
+
chain: Chains.EthereumMainnet,
|
|
635
|
+
network: Networks.ERC20,
|
|
636
|
+
precision: 4,
|
|
637
|
+
contract: undefined,
|
|
638
|
+
provider: Providers.FIREBLOCKS,
|
|
639
|
+
hasWithdrawMemo: false
|
|
640
|
+
}] : []),
|
|
641
|
+
image: 'https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/xlunr.png',
|
|
642
|
+
coingeckoId: 'lunr-token'
|
|
621
643
|
}, {
|
|
622
644
|
allowSwap: false,
|
|
623
645
|
allowBridge: IS_TESTNET,
|
|
@@ -1474,6 +1496,14 @@ var getDepthParser = /*#__PURE__*/z.object({
|
|
|
1474
1496
|
return n <= 250;
|
|
1475
1497
|
}, 'Max limit is 250')
|
|
1476
1498
|
});
|
|
1499
|
+
var dailyParser = /*#__PURE__*/z.object({
|
|
1500
|
+
market_id: /*#__PURE__*/z.number(),
|
|
1501
|
+
first: /*#__PURE__*/z.number(),
|
|
1502
|
+
last: /*#__PURE__*/z.number(),
|
|
1503
|
+
bid: /*#__PURE__*/z.number(),
|
|
1504
|
+
ask: /*#__PURE__*/z.number(),
|
|
1505
|
+
change_percentage_24hr: /*#__PURE__*/z.number()
|
|
1506
|
+
});
|
|
1477
1507
|
var tradeParser = /*#__PURE__*/z.object({
|
|
1478
1508
|
block_num: /*#__PURE__*/z.number(),
|
|
1479
1509
|
block_time: /*#__PURE__*/z.string(),
|
|
@@ -1762,12 +1792,12 @@ var Graph = /*#__PURE__*/function () {
|
|
|
1762
1792
|
|
|
1763
1793
|
var compute_transfer = function compute_transfer(pool1, pool2, swap, exchange_fee, precision) {
|
|
1764
1794
|
var term1 = pool2;
|
|
1765
|
-
var term2over = pool1.
|
|
1795
|
+
var term2over = pool1.times(pool2);
|
|
1766
1796
|
var term2under = pool1.plus(swap);
|
|
1767
|
-
var term2 = term2over.
|
|
1797
|
+
var term2 = term2over.div(term2under).integerValue(BigNumber.ROUND_DOWN);
|
|
1768
1798
|
var term = term1.minus(term2);
|
|
1769
|
-
var fee = new BigNumber(exchange_fee).
|
|
1770
|
-
var result = term.minus(term.
|
|
1799
|
+
var fee = new BigNumber(exchange_fee).div(FEE_FACTOR);
|
|
1800
|
+
var result = term.minus(term.times(fee));
|
|
1771
1801
|
return result.integerValue(BigNumber.ROUND_DOWN).shiftedBy(-precision);
|
|
1772
1802
|
};
|
|
1773
1803
|
var compute_transfer_curve = function compute_transfer_curve(reserve_in, reserve_out, amount_in, exchange_fee, precision, amplifier) {
|
|
@@ -1800,7 +1830,7 @@ var compute_transfer_curve = function compute_transfer_curve(reserve_in, reserve
|
|
|
1800
1830
|
|
|
1801
1831
|
while (x != x_prev && i--) {
|
|
1802
1832
|
x_prev = F(x);
|
|
1803
|
-
x = +new BigNumber(x * x + c).
|
|
1833
|
+
x = +new BigNumber(x * x + c).div(2 * x + b).toFixed(0, BigNumber.ROUND_DOWN);
|
|
1804
1834
|
}
|
|
1805
1835
|
|
|
1806
1836
|
if (reserve_out <= x) {
|
|
@@ -1811,15 +1841,15 @@ var compute_transfer_curve = function compute_transfer_curve(reserve_in, reserve
|
|
|
1811
1841
|
var amount_out_with_fee = new BigNumber(reserve_out - x); // Fee + 1
|
|
1812
1842
|
// +1 covers small precision issues
|
|
1813
1843
|
|
|
1814
|
-
var fee = amount_out_with_fee.
|
|
1844
|
+
var fee = amount_out_with_fee.times(exchange_fee).div(FEE_FACTOR).plus(1).toFixed(0, BigNumber.ROUND_DOWN); // Amount out
|
|
1815
1845
|
|
|
1816
1846
|
var amount_out = amount_out_with_fee.minus(fee);
|
|
1817
1847
|
return amount_out.integerValue(BigNumber.ROUND_DOWN).shiftedBy(-precision);
|
|
1818
1848
|
};
|
|
1819
1849
|
var compute_liquidity = function compute_liquidity(amount_lt, pool, lt_supply, precision) {
|
|
1820
|
-
var over = amount_lt.
|
|
1850
|
+
var over = amount_lt.times(pool);
|
|
1821
1851
|
var under = lt_supply;
|
|
1822
|
-
var result = over.
|
|
1852
|
+
var result = over.div(under).integerValue(BigNumber.ROUND_DOWN);
|
|
1823
1853
|
return +result.shiftedBy(-precision).toFixed(precision, BigNumber.ROUND_DOWN);
|
|
1824
1854
|
};
|
|
1825
1855
|
var isInputInvalid = function isInputInvalid(data, value, pool) {
|
|
@@ -1843,5 +1873,5 @@ var applyDiscountToFee = function applyDiscountToFee(fee, staked) {
|
|
|
1843
1873
|
}
|
|
1844
1874
|
};
|
|
1845
1875
|
|
|
1846
|
-
export { Chains, ExtendedAssetParser, FEE_FACTOR, Graph, ILink, INode, ITopics, Networks, Providers, Status, TOPICS, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, accountParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, depositBodyParser, depthParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, generateAddressBodyParser, generateAddressResponse, generateAuthParser, getDepthParser, getOhlcvParser, getOrderHistoryParser, getTradesParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, logStatus, median, ohlcvParser, orderHistoryParser, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, protonExplorerTxUrl, rateParser, similarChains, singleActionTransactionParser, syncParser, tradeParser, transactionParser, webauthActionParser, withdrawBodyParser, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };
|
|
1876
|
+
export { Chains, ExtendedAssetParser, FEE_FACTOR, Graph, ILink, INode, ITopics, Networks, Providers, Status, TOPICS, Type, WRAP_AUTH_ACTION, WRAP_CONTRACT, accountParser, addressParser, applyDiscountToFee, authorizationParser, authorizationsParser, baseActionParser, baseActionSerializedParser, bloksRatesParser, compute_liquidity, compute_transfer, compute_transfer_curve, createAbstractAuthParser, dailyParser, depositBodyParser, depthParser, exchangeRateParser, exchangeRatesParser, explorerLinkByChain, generateAddressBodyParser, generateAddressResponse, generateAuthParser, getDepthParser, getOhlcvParser, getOrderHistoryParser, getTradesParser, initializeCoins, initializeConstants, isInputInvalid, isSameToken, logStatus, median, ohlcvParser, orderHistoryParser, orderSide, orderType, otcOrderResponseParser, otcQuoteBodyParser, otcQuoteResponseParser, protonExplorerTxUrl, rateParser, similarChains, singleActionTransactionParser, syncParser, tradeParser, transactionParser, webauthActionParser, withdrawBodyParser, withdrawHistoryMetalResponseParser, withdrawHistoryMetalSwapParser, withdrawMetalResponseParser, withdrawalFeeQuoteParser, wrapParser, wrapSetConfParser, wrapStartParser };
|
|
1847
1877
|
//# sourceMappingURL=wrap-constants.esm.js.map
|