@pancakeswap/swap-sdk-core 1.4.0 → 1.5.1
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/index.d.ts +363 -9
- package/dist/index.js +156 -22
- package/dist/index.mjs +153 -22
- package/package.json +1 -1
- package/dist/baseCurrency.d.ts +0 -51
- package/dist/baseCurrency.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -31
- package/dist/constants.d.ts.map +0 -1
- package/dist/currency.d.ts +0 -4
- package/dist/currency.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -17
- package/dist/errors.d.ts.map +0 -1
- package/dist/fractions/currencyAmount.d.ts +0 -33
- package/dist/fractions/currencyAmount.d.ts.map +0 -1
- package/dist/fractions/fraction.d.ts +0 -24
- package/dist/fractions/fraction.d.ts.map +0 -1
- package/dist/fractions/index.d.ts +0 -5
- package/dist/fractions/index.d.ts.map +0 -1
- package/dist/fractions/percent.d.ts +0 -22
- package/dist/fractions/percent.d.ts.map +0 -1
- package/dist/fractions/price.d.ts +0 -49
- package/dist/fractions/price.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.test.d.ts +0 -2
- package/dist/index.test.d.ts.map +0 -1
- package/dist/nativeCurrency.d.ts +0 -11
- package/dist/nativeCurrency.d.ts.map +0 -1
- package/dist/token.d.ts +0 -41
- package/dist/token.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -22
- package/dist/utils.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import invariant8 from 'tiny-invariant';
|
|
2
2
|
import _Decimal from 'decimal.js-light';
|
|
3
3
|
import _Big from 'big.js';
|
|
4
4
|
import toFormat from 'toformat';
|
|
@@ -45,8 +45,7 @@ var BaseCurrency = class {
|
|
|
45
45
|
* @param name of the currency
|
|
46
46
|
*/
|
|
47
47
|
constructor(chainId, decimals, symbol, name) {
|
|
48
|
-
|
|
49
|
-
invariant6(decimals >= 0 && decimals < 255 && Number.isInteger(decimals), "DECIMALS");
|
|
48
|
+
invariant8(decimals >= 0 && decimals < 255 && Number.isInteger(decimals), "DECIMALS");
|
|
50
49
|
this.chainId = chainId;
|
|
51
50
|
this.decimals = decimals;
|
|
52
51
|
this.symbol = symbol;
|
|
@@ -132,15 +131,15 @@ var Fraction = class {
|
|
|
132
131
|
return new Fraction(this.numerator * otherParsed.denominator, this.denominator * otherParsed.numerator);
|
|
133
132
|
}
|
|
134
133
|
toSignificant(significantDigits, format = { groupSeparator: "" }, rounding = 1 /* ROUND_HALF_UP */) {
|
|
135
|
-
|
|
136
|
-
|
|
134
|
+
invariant8(Number.isInteger(significantDigits), `${significantDigits} is not an integer.`);
|
|
135
|
+
invariant8(significantDigits > 0, `${significantDigits} is not positive.`);
|
|
137
136
|
Decimal.set({ precision: significantDigits + 1, rounding: toSignificantRounding[rounding] });
|
|
138
137
|
const quotient = new Decimal(this.numerator.toString()).div(this.denominator.toString()).toSignificantDigits(significantDigits);
|
|
139
138
|
return quotient.toFormat(quotient.decimalPlaces(), format);
|
|
140
139
|
}
|
|
141
140
|
toFixed(decimalPlaces, format = { groupSeparator: "" }, rounding = 1 /* ROUND_HALF_UP */) {
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
invariant8(Number.isInteger(decimalPlaces), `${decimalPlaces} is not an integer.`);
|
|
142
|
+
invariant8(decimalPlaces >= 0, `${decimalPlaces} is negative.`);
|
|
144
143
|
Big.DP = decimalPlaces;
|
|
145
144
|
Big.RM = toFixedRounding[rounding];
|
|
146
145
|
return new Big(this.numerator.toString()).div(this.denominator.toString()).toFormat(decimalPlaces, format);
|
|
@@ -190,7 +189,7 @@ var Big2 = toFormat(_Big);
|
|
|
190
189
|
var CurrencyAmount = class extends Fraction {
|
|
191
190
|
constructor(currency, numerator, denominator) {
|
|
192
191
|
super(numerator, denominator);
|
|
193
|
-
|
|
192
|
+
invariant8(this.quotient <= MaxUint256, "AMOUNT");
|
|
194
193
|
this.currency = currency;
|
|
195
194
|
this.decimalScale = 10n ** BigInt(currency.decimals);
|
|
196
195
|
}
|
|
@@ -212,7 +211,7 @@ var CurrencyAmount = class extends Fraction {
|
|
|
212
211
|
return new CurrencyAmount(currency, numerator, denominator);
|
|
213
212
|
}
|
|
214
213
|
add(other) {
|
|
215
|
-
|
|
214
|
+
invariant8(this.currency.equals(other.currency), "CURRENCY");
|
|
216
215
|
const added = super.add(other);
|
|
217
216
|
return CurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator);
|
|
218
217
|
}
|
|
@@ -224,7 +223,7 @@ var CurrencyAmount = class extends Fraction {
|
|
|
224
223
|
this.denominator
|
|
225
224
|
);
|
|
226
225
|
}
|
|
227
|
-
|
|
226
|
+
invariant8(this.currency.equals(value.currency), "CURRENCY");
|
|
228
227
|
const subtracted = super.subtract(value);
|
|
229
228
|
return CurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator);
|
|
230
229
|
}
|
|
@@ -240,7 +239,7 @@ var CurrencyAmount = class extends Fraction {
|
|
|
240
239
|
return super.divide(this.decimalScale).toSignificant(significantDigits, format, rounding);
|
|
241
240
|
}
|
|
242
241
|
toFixed(decimalPlaces = this.currency.decimals, format, rounding = 0 /* ROUND_DOWN */) {
|
|
243
|
-
|
|
242
|
+
invariant8(decimalPlaces <= this.currency.decimals, "DECIMALS");
|
|
244
243
|
return super.divide(this.decimalScale).toFixed(decimalPlaces, format, rounding);
|
|
245
244
|
}
|
|
246
245
|
toExact(format = { groupSeparator: "" }) {
|
|
@@ -256,6 +255,76 @@ var CurrencyAmount = class extends Fraction {
|
|
|
256
255
|
return `${this.toExact()}${this.currency.symbol}`;
|
|
257
256
|
}
|
|
258
257
|
};
|
|
258
|
+
var Big3 = toFormat(_Big);
|
|
259
|
+
var UnifiedCurrencyAmount = class extends Fraction {
|
|
260
|
+
constructor(currency, numerator, denominator) {
|
|
261
|
+
super(numerator, denominator);
|
|
262
|
+
invariant8(this.quotient <= MaxUint256, "AMOUNT");
|
|
263
|
+
this.currency = currency;
|
|
264
|
+
this.decimalScale = 10n ** BigInt(currency.decimals);
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
|
|
268
|
+
* @param currency the currency in the amount
|
|
269
|
+
* @param rawAmount the raw token or ether amount
|
|
270
|
+
*/
|
|
271
|
+
static fromRawAmount(currency, rawAmount) {
|
|
272
|
+
return new UnifiedCurrencyAmount(currency, rawAmount);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Construct a currency amount with a denominator that is not equal to 1
|
|
276
|
+
* @param currency the currency
|
|
277
|
+
* @param numerator the numerator of the fractional token amount
|
|
278
|
+
* @param denominator the denominator of the fractional token amount
|
|
279
|
+
*/
|
|
280
|
+
static fromFractionalAmount(currency, numerator, denominator) {
|
|
281
|
+
return new UnifiedCurrencyAmount(currency, numerator, denominator);
|
|
282
|
+
}
|
|
283
|
+
add(other) {
|
|
284
|
+
invariant8(this.currency.equals(other.currency), "CURRENCY");
|
|
285
|
+
const added = super.add(other);
|
|
286
|
+
return UnifiedCurrencyAmount.fromFractionalAmount(this.currency, added.numerator, added.denominator);
|
|
287
|
+
}
|
|
288
|
+
subtract(value) {
|
|
289
|
+
if (typeof value === "bigint") {
|
|
290
|
+
return UnifiedCurrencyAmount.fromFractionalAmount(
|
|
291
|
+
this.currency,
|
|
292
|
+
this.numerator - value * this.denominator,
|
|
293
|
+
this.denominator
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
invariant8(this.currency.equals(value.currency), "CURRENCY");
|
|
297
|
+
const subtracted = super.subtract(value);
|
|
298
|
+
return UnifiedCurrencyAmount.fromFractionalAmount(this.currency, subtracted.numerator, subtracted.denominator);
|
|
299
|
+
}
|
|
300
|
+
multiply(other) {
|
|
301
|
+
const multiplied = super.multiply(other);
|
|
302
|
+
return UnifiedCurrencyAmount.fromFractionalAmount(this.currency, multiplied.numerator, multiplied.denominator);
|
|
303
|
+
}
|
|
304
|
+
divide(other) {
|
|
305
|
+
const divided = super.divide(other);
|
|
306
|
+
return UnifiedCurrencyAmount.fromFractionalAmount(this.currency, divided.numerator, divided.denominator);
|
|
307
|
+
}
|
|
308
|
+
toSignificant(significantDigits = 6, format, rounding = 0 /* ROUND_DOWN */) {
|
|
309
|
+
return super.divide(this.decimalScale).toSignificant(significantDigits, format, rounding);
|
|
310
|
+
}
|
|
311
|
+
toFixed(decimalPlaces = this.currency.decimals, format, rounding = 0 /* ROUND_DOWN */) {
|
|
312
|
+
invariant8(decimalPlaces <= this.currency.decimals, "DECIMALS");
|
|
313
|
+
return super.divide(this.decimalScale).toFixed(decimalPlaces, format, rounding);
|
|
314
|
+
}
|
|
315
|
+
toExact(format = { groupSeparator: "" }) {
|
|
316
|
+
Big3.DP = this.currency.decimals;
|
|
317
|
+
return new Big3(this.quotient.toString()).div(this.decimalScale.toString()).toFormat(format);
|
|
318
|
+
}
|
|
319
|
+
get wrapped() {
|
|
320
|
+
if (this.currency.isToken)
|
|
321
|
+
return this;
|
|
322
|
+
return UnifiedCurrencyAmount.fromFractionalAmount(this.currency.wrapped, this.numerator, this.denominator);
|
|
323
|
+
}
|
|
324
|
+
info() {
|
|
325
|
+
return `${this.toExact()}${this.currency.symbol}`;
|
|
326
|
+
}
|
|
327
|
+
};
|
|
259
328
|
var Price = class extends Fraction {
|
|
260
329
|
// used to adjust the raw fraction w/r/t the decimals of the {base,quote}Token
|
|
261
330
|
/**
|
|
@@ -294,7 +363,7 @@ var Price = class extends Fraction {
|
|
|
294
363
|
* @param other the other price
|
|
295
364
|
*/
|
|
296
365
|
multiply(other) {
|
|
297
|
-
|
|
366
|
+
invariant8(this.quoteCurrency.equals(other.baseCurrency), "TOKEN");
|
|
298
367
|
const fraction = super.multiply(other);
|
|
299
368
|
return new Price(this.baseCurrency, other.quoteCurrency, fraction.denominator, fraction.numerator);
|
|
300
369
|
}
|
|
@@ -303,9 +372,9 @@ var Price = class extends Fraction {
|
|
|
303
372
|
* @param currencyAmount the amount of base currency to quote against the price
|
|
304
373
|
*/
|
|
305
374
|
quote(currencyAmount) {
|
|
306
|
-
|
|
375
|
+
invariant8(currencyAmount.currency.equals(this.baseCurrency), "TOKEN");
|
|
307
376
|
const result = super.multiply(currencyAmount);
|
|
308
|
-
return
|
|
377
|
+
return UnifiedCurrencyAmount.fromFractionalAmount(this.quoteCurrency, result.numerator, result.denominator);
|
|
309
378
|
}
|
|
310
379
|
/**
|
|
311
380
|
* Get the value scaled by decimals for formatting
|
|
@@ -367,8 +436,8 @@ var Token = class extends BaseCurrency {
|
|
|
367
436
|
* @throws if the tokens are on different chains
|
|
368
437
|
*/
|
|
369
438
|
sortsBefore(other) {
|
|
370
|
-
|
|
371
|
-
|
|
439
|
+
invariant8(this.chainId === other.chainId, "CHAIN_IDS");
|
|
440
|
+
invariant8(this.address !== other.address, "ADDRESSES");
|
|
372
441
|
return this.address.toLowerCase() < other.address.toLowerCase();
|
|
373
442
|
}
|
|
374
443
|
/**
|
|
@@ -401,6 +470,68 @@ var NativeCurrency = class extends BaseCurrency {
|
|
|
401
470
|
}
|
|
402
471
|
};
|
|
403
472
|
|
|
473
|
+
// src/splNativeCurrency.ts
|
|
474
|
+
var SPLNativeCurrency = class extends BaseCurrency {
|
|
475
|
+
constructor() {
|
|
476
|
+
super(...arguments);
|
|
477
|
+
this.isNative = true;
|
|
478
|
+
this.isToken = false;
|
|
479
|
+
this.address = "";
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
var SPLToken = class extends BaseCurrency {
|
|
483
|
+
constructor({
|
|
484
|
+
chainId,
|
|
485
|
+
programId,
|
|
486
|
+
address,
|
|
487
|
+
decimals,
|
|
488
|
+
symbol,
|
|
489
|
+
logoURI,
|
|
490
|
+
name,
|
|
491
|
+
projectLink
|
|
492
|
+
}) {
|
|
493
|
+
super(chainId, decimals, symbol, name);
|
|
494
|
+
this.isNative = false;
|
|
495
|
+
this.isToken = true;
|
|
496
|
+
this.address = address;
|
|
497
|
+
this.programId = programId;
|
|
498
|
+
this.logoURI = logoURI;
|
|
499
|
+
this.projectLink = projectLink;
|
|
500
|
+
}
|
|
501
|
+
static isSPLToken(token) {
|
|
502
|
+
if (!token)
|
|
503
|
+
return false;
|
|
504
|
+
return "programId" in token || token.wrapped instanceof SPLToken;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Returns true if the two tokens are equivalent, i.e. have the same chainId and programId.
|
|
508
|
+
* @param other other token to compare
|
|
509
|
+
*/
|
|
510
|
+
equals(other) {
|
|
511
|
+
return this.chainId === other.chainId && this.address === other.address;
|
|
512
|
+
}
|
|
513
|
+
sortsBefore(other) {
|
|
514
|
+
invariant8(this.chainId === other.chainId, "CHAIN_IDS");
|
|
515
|
+
invariant8(this.programId !== other.programId, "ADDRESSES");
|
|
516
|
+
return this.programId.toLowerCase() < other.programId.toLowerCase();
|
|
517
|
+
}
|
|
518
|
+
/* For compatibility */
|
|
519
|
+
get wrapped() {
|
|
520
|
+
return this;
|
|
521
|
+
}
|
|
522
|
+
get serialize() {
|
|
523
|
+
return {
|
|
524
|
+
address: this.address,
|
|
525
|
+
programId: this.programId,
|
|
526
|
+
chainId: this.chainId,
|
|
527
|
+
decimals: this.decimals,
|
|
528
|
+
symbol: this.symbol,
|
|
529
|
+
name: this.name,
|
|
530
|
+
projectLink: this.projectLink
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
};
|
|
534
|
+
|
|
404
535
|
// src/errors.ts
|
|
405
536
|
var CAN_SET_PROTOTYPE = "setPrototypeOf" in Object;
|
|
406
537
|
var InsufficientReservesError = class extends Error {
|
|
@@ -422,11 +553,11 @@ var InsufficientInputAmountError = class extends Error {
|
|
|
422
553
|
}
|
|
423
554
|
};
|
|
424
555
|
function validateVMTypeInstance(value, vmType) {
|
|
425
|
-
|
|
426
|
-
|
|
556
|
+
invariant8(value >= ZERO, `${value} is not a ${vmType}.`);
|
|
557
|
+
invariant8(value <= VM_TYPE_MAXIMA[vmType], `${value} is not a ${vmType}.`);
|
|
427
558
|
}
|
|
428
559
|
function sqrt(y) {
|
|
429
|
-
|
|
560
|
+
invariant8(y >= ZERO, "NEGATIVE");
|
|
430
561
|
let z = ZERO;
|
|
431
562
|
let x;
|
|
432
563
|
if (y > THREE) {
|
|
@@ -442,8 +573,8 @@ function sqrt(y) {
|
|
|
442
573
|
return z;
|
|
443
574
|
}
|
|
444
575
|
function sortedInsert(items, add, maxSize, comparator) {
|
|
445
|
-
|
|
446
|
-
|
|
576
|
+
invariant8(maxSize > 0, "MAX_SIZE_ZERO");
|
|
577
|
+
invariant8(items.length <= maxSize, "ITEMS_SIZE");
|
|
447
578
|
if (items.length === 0) {
|
|
448
579
|
items.push(add);
|
|
449
580
|
return null;
|
|
@@ -527,4 +658,4 @@ function getMatchedCurrency(currency, list, matchWrappedCurrency = true) {
|
|
|
527
658
|
return void 0;
|
|
528
659
|
}
|
|
529
660
|
|
|
530
|
-
export { BaseCurrency, CurrencyAmount, FIVE, Fraction, InsufficientInputAmountError, InsufficientReservesError, MINIMUM_LIQUIDITY, MaxUint256, NativeCurrency, ONE, Percent, Price, Rounding, TEN, THREE, TWO, Token, TradeType, VMType, VM_TYPE_MAXIMA, ZERO, ZERO_ADDRESS, _100, _10000, _9975, computePriceImpact, getCurrencyAddress, getMatchedCurrency, getTokenComparator, isCurrencySorted, sortCurrencies, sortedInsert, sqrt, validateVMTypeInstance };
|
|
661
|
+
export { BaseCurrency, CurrencyAmount, FIVE, Fraction, InsufficientInputAmountError, InsufficientReservesError, MINIMUM_LIQUIDITY, MaxUint256, NativeCurrency, ONE, Percent, Price, Rounding, SPLNativeCurrency, SPLToken, TEN, THREE, TWO, Token, TradeType, UnifiedCurrencyAmount, VMType, VM_TYPE_MAXIMA, ZERO, ZERO_ADDRESS, _100, _10000, _9975, computePriceImpact, getCurrencyAddress, getMatchedCurrency, getTokenComparator, isCurrencySorted, sortCurrencies, sortedInsert, sqrt, validateVMTypeInstance };
|
package/package.json
CHANGED
package/dist/baseCurrency.d.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { Currency } from './currency';
|
|
2
|
-
import type { Token } from './token';
|
|
3
|
-
/**
|
|
4
|
-
* A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class BaseCurrency {
|
|
7
|
-
/**
|
|
8
|
-
* Returns whether the currency is native to the chain and must be wrapped (e.g. Ether)
|
|
9
|
-
*/
|
|
10
|
-
abstract readonly isNative: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Returns whether the currency is a token that is usable in PancakeSwap without wrapping
|
|
13
|
-
*/
|
|
14
|
-
abstract readonly isToken: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* The chain ID on which this currency resides
|
|
17
|
-
*/
|
|
18
|
-
readonly chainId: number;
|
|
19
|
-
/**
|
|
20
|
-
* The decimals used in representing currency amounts
|
|
21
|
-
*/
|
|
22
|
-
readonly decimals: number;
|
|
23
|
-
/**
|
|
24
|
-
* The symbol of the currency, i.e. a short textual non-unique identifier
|
|
25
|
-
*/
|
|
26
|
-
readonly symbol: string;
|
|
27
|
-
/**
|
|
28
|
-
* The name of the currency, i.e. a descriptive textual non-unique identifier
|
|
29
|
-
*/
|
|
30
|
-
readonly name?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Constructs an instance of the base class `BaseCurrency`.
|
|
33
|
-
* @param chainId the chain ID on which this currency resides
|
|
34
|
-
* @param decimals decimals of the currency
|
|
35
|
-
* @param symbol symbol of the currency
|
|
36
|
-
* @param name of the currency
|
|
37
|
-
*/
|
|
38
|
-
protected constructor(chainId: number, decimals: number, symbol: string, name?: string);
|
|
39
|
-
/**
|
|
40
|
-
* Returns whether this currency is functionally equivalent to the other currency
|
|
41
|
-
* @param other the other currency
|
|
42
|
-
*/
|
|
43
|
-
abstract equals(other: Currency): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Return the wrapped version of this currency that can be used with the PancakeSwap contracts. Currencies must
|
|
46
|
-
* implement this to be used in PancakeSwap
|
|
47
|
-
*/
|
|
48
|
-
abstract get wrapped(): Token;
|
|
49
|
-
get asToken(): Token;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=baseCurrency.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"baseCurrency.d.ts","sourceRoot":"","sources":["../src/baseCurrency.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC;;GAEG;AACH,8BAAsB,YAAY;IAChC;;OAEG;IACH,kBAAyB,QAAQ,EAAE,OAAO,CAAA;IAE1C;;OAEG;IACH,kBAAyB,OAAO,EAAE,OAAO,CAAA;IAEzC;;OAEG;IACH,SAAgB,OAAO,EAAE,MAAM,CAAA;IAE/B;;OAEG;IACH,SAAgB,QAAQ,EAAE,MAAM,CAAA;IAEhC;;OAEG;IACH,SAAgB,MAAM,EAAE,MAAM,CAAA;IAE9B;;OAEG;IACH,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAA;IAE7B;;;;;;OAMG;IACH,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM;IAUtF;;;OAGG;aACa,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAEhD;;;OAGG;IACH,aAAoB,OAAO,IAAI,KAAK,CAAA;IAEpC,IAAW,OAAO,IAAI,KAAK,CAE1B;CACF"}
|
package/dist/constants.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export type BigintIsh = bigint | number | string;
|
|
2
|
-
export declare enum TradeType {
|
|
3
|
-
EXACT_INPUT = 0,
|
|
4
|
-
EXACT_OUTPUT = 1
|
|
5
|
-
}
|
|
6
|
-
export declare enum Rounding {
|
|
7
|
-
ROUND_DOWN = 0,
|
|
8
|
-
ROUND_HALF_UP = 1,
|
|
9
|
-
ROUND_UP = 2
|
|
10
|
-
}
|
|
11
|
-
export declare const MINIMUM_LIQUIDITY = 1000n;
|
|
12
|
-
export declare const ZERO = 0n;
|
|
13
|
-
export declare const ONE = 1n;
|
|
14
|
-
export declare const TWO = 2n;
|
|
15
|
-
export declare const THREE = 3n;
|
|
16
|
-
export declare const FIVE = 5n;
|
|
17
|
-
export declare const TEN = 10n;
|
|
18
|
-
export declare const _100 = 100n;
|
|
19
|
-
export declare const _9975 = 9975n;
|
|
20
|
-
export declare const _10000 = 10000n;
|
|
21
|
-
export declare const MaxUint256: bigint;
|
|
22
|
-
export declare enum VMType {
|
|
23
|
-
uint8 = "uint8",
|
|
24
|
-
uint256 = "uint256"
|
|
25
|
-
}
|
|
26
|
-
export declare const VM_TYPE_MAXIMA: {
|
|
27
|
-
uint8: bigint;
|
|
28
|
-
uint256: bigint;
|
|
29
|
-
};
|
|
30
|
-
export declare const ZERO_ADDRESS: "0x0000000000000000000000000000000000000000";
|
|
31
|
-
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAEhD,oBAAY,SAAS;IACnB,WAAW,IAAA;IACX,YAAY,IAAA;CACb;AAED,oBAAY,QAAQ;IAClB,UAAU,IAAA;IACV,aAAa,IAAA;IACb,QAAQ,IAAA;CACT;AAED,eAAO,MAAM,iBAAiB,QAAQ,CAAA;AAGtC,eAAO,MAAM,IAAI,KAAK,CAAA;AACtB,eAAO,MAAM,GAAG,KAAK,CAAA;AACrB,eAAO,MAAM,GAAG,KAAK,CAAA;AACrB,eAAO,MAAM,KAAK,KAAK,CAAA;AACvB,eAAO,MAAM,IAAI,KAAK,CAAA;AACtB,eAAO,MAAM,GAAG,MAAM,CAAA;AACtB,eAAO,MAAM,IAAI,OAAO,CAAA;AACxB,eAAO,MAAM,KAAK,QAAQ,CAAA;AAC1B,eAAO,MAAM,MAAM,SAAS,CAAA;AAE5B,eAAO,MAAM,UAAU,QAA+E,CAAA;AAEtG,oBAAY,MAAM;IAChB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,cAAc;;;CAG1B,CAAA;AAED,eAAO,MAAM,YAAY,EAAG,4CAAqD,CAAA"}
|
package/dist/currency.d.ts
DELETED
package/dist/currency.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../src/currency.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,MAAM,MAAM,QAAQ,GAAG,cAAc,GAAG,KAAK,CAAA"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Indicates that the pair has insufficient reserves for a desired output amount. I.e. the amount of output cannot be
|
|
3
|
-
* obtained by sending any amount of input.
|
|
4
|
-
*/
|
|
5
|
-
export declare class InsufficientReservesError extends Error {
|
|
6
|
-
readonly isInsufficientReservesError: true;
|
|
7
|
-
constructor();
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Indicates that the input amount is too small to produce any amount of output. I.e. the amount of input sent is less
|
|
11
|
-
* than the price of a single unit of output after fees.
|
|
12
|
-
*/
|
|
13
|
-
export declare class InsufficientInputAmountError extends Error {
|
|
14
|
-
readonly isInsufficientInputAmountError: true;
|
|
15
|
-
constructor();
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,SAAgB,2BAA2B,EAAG,IAAI,CAAS;;CAO5D;AAED;;;GAGG;AACH,qBAAa,4BAA6B,SAAQ,KAAK;IACrD,SAAgB,8BAA8B,EAAG,IAAI,CAAS;;CAO/D"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Currency } from '../currency';
|
|
2
|
-
import { Token } from '../token';
|
|
3
|
-
import { Fraction } from './fraction';
|
|
4
|
-
import { BigintIsh, Rounding } from '../constants';
|
|
5
|
-
export declare class CurrencyAmount<T extends Currency> extends Fraction {
|
|
6
|
-
readonly currency: T;
|
|
7
|
-
readonly decimalScale: bigint;
|
|
8
|
-
/**
|
|
9
|
-
* Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
|
|
10
|
-
* @param currency the currency in the amount
|
|
11
|
-
* @param rawAmount the raw token or ether amount
|
|
12
|
-
*/
|
|
13
|
-
static fromRawAmount<T extends Currency>(currency: T, rawAmount: BigintIsh): CurrencyAmount<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Construct a currency amount with a denominator that is not equal to 1
|
|
16
|
-
* @param currency the currency
|
|
17
|
-
* @param numerator the numerator of the fractional token amount
|
|
18
|
-
* @param denominator the denominator of the fractional token amount
|
|
19
|
-
*/
|
|
20
|
-
static fromFractionalAmount<T extends Currency>(currency: T, numerator: BigintIsh, denominator: BigintIsh): CurrencyAmount<T>;
|
|
21
|
-
protected constructor(currency: T, numerator: BigintIsh, denominator?: BigintIsh);
|
|
22
|
-
add(other: CurrencyAmount<T>): CurrencyAmount<T>;
|
|
23
|
-
subtract(value: bigint): CurrencyAmount<T>;
|
|
24
|
-
subtract(other: CurrencyAmount<T>): CurrencyAmount<T>;
|
|
25
|
-
multiply(other: Fraction | BigintIsh): CurrencyAmount<T>;
|
|
26
|
-
divide(other: Fraction | BigintIsh): CurrencyAmount<T>;
|
|
27
|
-
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
28
|
-
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
29
|
-
toExact(format?: object): string;
|
|
30
|
-
get wrapped(): CurrencyAmount<Token>;
|
|
31
|
-
info(): string;
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=currencyAmount.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"currencyAmount.d.ts","sourceRoot":"","sources":["../../src/fractions/currencyAmount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,OAAO,EAAE,SAAS,EAAc,QAAQ,EAAE,MAAM,cAAc,CAAA;AAI9D,qBAAa,cAAc,CAAC,CAAC,SAAS,QAAQ,CAAE,SAAQ,QAAQ;IAC9D,SAAgB,QAAQ,EAAE,CAAC,CAAA;IAE3B,SAAgB,YAAY,EAAE,MAAM,CAAA;IAEpC;;;;OAIG;WACW,aAAa,CAAC,CAAC,SAAS,QAAQ,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC;IAIrG;;;;;OAKG;WACW,oBAAoB,CAAC,CAAC,SAAS,QAAQ,EACnD,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,SAAS,GACrB,cAAc,CAAC,CAAC,CAAC;IAIpB,SAAS,aAAa,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,EAAE,SAAS;IAOzE,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;IAMhD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,CAAC,CAAC;IAE1C,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;IAgBrD,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC;IAKxD,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,cAAc,CAAC,CAAC,CAAC;IAKtD,aAAa,CAAC,iBAAiB,SAAI,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAE,QAA8B,GAAG,MAAM;IAIvG,OAAO,CACZ,aAAa,GAAE,MAA+B,EAC9C,MAAM,CAAC,EAAE,MAAM,EACf,QAAQ,GAAE,QAA8B,GACvC,MAAM;IAKF,OAAO,CAAC,MAAM,GAAE,MAA+B,GAAG,MAAM;IAK/D,IAAW,OAAO,IAAI,cAAc,CAAC,KAAK,CAAC,CAG1C;IAEM,IAAI;CAGZ"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BigintIsh, Rounding } from '../constants';
|
|
2
|
-
export declare class Fraction {
|
|
3
|
-
readonly numerator: bigint;
|
|
4
|
-
readonly denominator: bigint;
|
|
5
|
-
constructor(numerator: BigintIsh, denominator?: BigintIsh);
|
|
6
|
-
private static tryParseFraction;
|
|
7
|
-
get quotient(): bigint;
|
|
8
|
-
get remainder(): Fraction;
|
|
9
|
-
invert(): Fraction;
|
|
10
|
-
add(other: Fraction | BigintIsh): Fraction;
|
|
11
|
-
subtract(other: Fraction | BigintIsh): Fraction;
|
|
12
|
-
lessThan(other: Fraction | BigintIsh): boolean;
|
|
13
|
-
equalTo(other: Fraction | BigintIsh): boolean;
|
|
14
|
-
greaterThan(other: Fraction | BigintIsh): boolean;
|
|
15
|
-
multiply(other: Fraction | BigintIsh): Fraction;
|
|
16
|
-
divide(other: Fraction | BigintIsh): Fraction;
|
|
17
|
-
toSignificant(significantDigits: number, format?: object, rounding?: Rounding): string;
|
|
18
|
-
toFixed(decimalPlaces: number, format?: object, rounding?: Rounding): string;
|
|
19
|
-
/**
|
|
20
|
-
* Helper method for converting any super class back to a fraction
|
|
21
|
-
*/
|
|
22
|
-
get asFraction(): Fraction;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=fraction.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fraction.d.ts","sourceRoot":"","sources":["../../src/fractions/fraction.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAuClD,qBAAa,QAAQ;IACnB,SAAgB,SAAS,EAAE,MAAM,CAAA;IAEjC,SAAgB,WAAW,EAAE,MAAM,CAAA;gBAEhB,SAAS,EAAE,SAAS,EAAE,WAAW,GAAE,SAAc;IAKpE,OAAO,CAAC,MAAM,CAAC,gBAAgB;IAS/B,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAGD,IAAW,SAAS,IAAI,QAAQ,CAE/B;IAEM,MAAM,IAAI,QAAQ;IAIlB,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ;IAW1C,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ;IAW/C,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAK9C,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAK7C,WAAW,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAKjD,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ;IAK/C,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ;IAK7C,aAAa,CAClB,iBAAiB,EAAE,MAAM,EACzB,MAAM,GAAE,MAA+B,EACvC,QAAQ,GAAE,QAAiC,GAC1C,MAAM;IAWF,OAAO,CACZ,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,MAA+B,EACvC,QAAQ,GAAE,QAAiC,GAC1C,MAAM;IAST;;OAEG;IACH,IAAW,UAAU,IAAI,QAAQ,CAEhC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fractions/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BigintIsh, Rounding } from '../constants';
|
|
2
|
-
import { Fraction } from './fraction';
|
|
3
|
-
/**
|
|
4
|
-
* Converts a fraction to a percent
|
|
5
|
-
* @param fraction the fraction to convert
|
|
6
|
-
*/
|
|
7
|
-
declare function toPercent(fraction: Fraction): Percent;
|
|
8
|
-
export declare class Percent extends Fraction {
|
|
9
|
-
/**
|
|
10
|
-
* This boolean prevents a fraction from being interpreted as a Percent
|
|
11
|
-
*/
|
|
12
|
-
readonly isPercent: true;
|
|
13
|
-
static toPercent: typeof toPercent;
|
|
14
|
-
add(other: Fraction | BigintIsh): Percent;
|
|
15
|
-
subtract(other: Fraction | BigintIsh): Percent;
|
|
16
|
-
multiply(other: Fraction | BigintIsh): Percent;
|
|
17
|
-
divide(other: Fraction | BigintIsh): Percent;
|
|
18
|
-
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
19
|
-
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=percent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/fractions/percent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAIrC;;;GAGG;AACH,iBAAS,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAE9C;AAED,qBAAa,OAAQ,SAAQ,QAAQ;IACnC;;OAEG;IACH,SAAgB,SAAS,EAAG,IAAI,CAAS;IAEzC,MAAM,CAAC,SAAS,mBAAY;IAE5B,GAAG,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAIzC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAI9C,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAI9C,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,OAAO;IAIrC,aAAa,CAAC,iBAAiB,SAAI,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAIlF,OAAO,CAAC,aAAa,SAAI,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;CAGhF"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { BigintIsh, Rounding } from '../constants';
|
|
2
|
-
import { Currency } from '../currency';
|
|
3
|
-
import { Token } from '../token';
|
|
4
|
-
import { CurrencyAmount } from './currencyAmount';
|
|
5
|
-
import { Fraction } from './fraction';
|
|
6
|
-
export declare class Price<TBase extends Currency, TQuote extends Currency> extends Fraction {
|
|
7
|
-
readonly baseCurrency: TBase;
|
|
8
|
-
readonly quoteCurrency: TQuote;
|
|
9
|
-
readonly scalar: Fraction;
|
|
10
|
-
/**
|
|
11
|
-
* Construct a price, either with the base and quote currency amount, or the
|
|
12
|
-
* @param args
|
|
13
|
-
*/
|
|
14
|
-
constructor(...args: [TBase, TQuote, BigintIsh, BigintIsh] | [{
|
|
15
|
-
baseAmount: CurrencyAmount<TBase>;
|
|
16
|
-
quoteAmount: CurrencyAmount<TQuote>;
|
|
17
|
-
}]);
|
|
18
|
-
/**
|
|
19
|
-
* Flip the price, switching the base and quote currency
|
|
20
|
-
*/
|
|
21
|
-
invert(): Price<TQuote, TBase>;
|
|
22
|
-
/**
|
|
23
|
-
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
|
|
24
|
-
* @param other the other price
|
|
25
|
-
*/
|
|
26
|
-
multiply<TOtherQuote extends Currency>(other: Price<TQuote, TOtherQuote>): Price<TBase, TOtherQuote>;
|
|
27
|
-
/**
|
|
28
|
-
* Return the amount of quote currency corresponding to a given amount of the base currency
|
|
29
|
-
* @param currencyAmount the amount of base currency to quote against the price
|
|
30
|
-
*/
|
|
31
|
-
quote(currencyAmount: CurrencyAmount<TBase>): CurrencyAmount<TQuote>;
|
|
32
|
-
/**
|
|
33
|
-
* Get the value scaled by decimals for formatting
|
|
34
|
-
* @private
|
|
35
|
-
*/
|
|
36
|
-
private get adjustedForDecimals();
|
|
37
|
-
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
38
|
-
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
39
|
-
get wrapped(): Price<Token, Token>;
|
|
40
|
-
/**
|
|
41
|
-
* Create a price from base and quote currency and a decimal string
|
|
42
|
-
* @param base
|
|
43
|
-
* @param quote
|
|
44
|
-
* @param value
|
|
45
|
-
* @returns Price<TBase, TQuote> | undefined
|
|
46
|
-
*/
|
|
47
|
-
static fromDecimal<TBase extends Currency, TQuote extends Currency>(base: TBase, quote: TQuote, value: string): Price<TBase, TQuote> | undefined;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=price.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/fractions/price.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBAAa,KAAK,CAAC,KAAK,SAAS,QAAQ,EAAE,MAAM,SAAS,QAAQ,CAAE,SAAQ,QAAQ;IAClF,SAAgB,YAAY,EAAE,KAAK,CAAA;IAEnC,SAAgB,aAAa,EAAE,MAAM,CAAA;IAErC,SAAgB,MAAM,EAAE,QAAQ,CAAA;IAEhC;;;OAGG;gBAED,GAAG,IAAI,EACH,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,GACrC,CAAC;QAAE,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;QAAC,WAAW,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;KAAE,CAAC;IA0BlF;;OAEG;IACI,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC;IAIrC;;;OAGG;IACI,QAAQ,CAAC,WAAW,SAAS,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,WAAW,CAAC;IAM3G;;;OAGG;IACI,KAAK,CAAC,cAAc,EAAE,cAAc,CAAC,KAAK,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC;IAM3E;;;OAGG;IACH,OAAO,KAAK,mBAAmB,GAE9B;IAEM,aAAa,CAAC,iBAAiB,SAAI,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAIlF,OAAO,CAAC,aAAa,SAAI,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAI/E,IAAW,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAExC;IAED;;;;;;OAMG;WACW,WAAW,CAAC,KAAK,SAAS,QAAQ,EAAE,MAAM,SAAS,QAAQ,EACvE,IAAI,EAAE,KAAK,EACX,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,SAAS;CAiBpC"}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
|
package/dist/index.test.d.ts
DELETED
package/dist/index.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":""}
|
package/dist/nativeCurrency.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseCurrency } from './baseCurrency';
|
|
2
|
-
import { Token } from './token';
|
|
3
|
-
/**
|
|
4
|
-
* Represents the native currency of the chain on which it resides, e.g.
|
|
5
|
-
*/
|
|
6
|
-
export declare abstract class NativeCurrency extends BaseCurrency {
|
|
7
|
-
readonly isNative: true;
|
|
8
|
-
readonly isToken: false;
|
|
9
|
-
get asToken(): Token;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=nativeCurrency.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"nativeCurrency.d.ts","sourceRoot":"","sources":["../src/nativeCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B;;GAEG;AACH,8BAAsB,cAAe,SAAQ,YAAY;IACvD,SAAgB,QAAQ,EAAG,IAAI,CAAS;IAExC,SAAgB,OAAO,EAAG,KAAK,CAAS;IAExC,IAAoB,OAAO,IAAI,KAAK,CAEnC;CACF"}
|
package/dist/token.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { BaseCurrency } from './baseCurrency';
|
|
2
|
-
import { Currency } from './currency';
|
|
3
|
-
export interface SerializedToken {
|
|
4
|
-
chainId: number;
|
|
5
|
-
address: `0x${string}`;
|
|
6
|
-
decimals: number;
|
|
7
|
-
symbol: string;
|
|
8
|
-
name?: string;
|
|
9
|
-
projectLink?: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Represents an ERC20 token with a unique address and some metadata.
|
|
13
|
-
*/
|
|
14
|
-
export declare class Token extends BaseCurrency {
|
|
15
|
-
readonly isNative: false;
|
|
16
|
-
readonly isToken: true;
|
|
17
|
-
/**
|
|
18
|
-
* The contract address on the chain on which this token lives
|
|
19
|
-
*/
|
|
20
|
-
readonly address: `0x${string}`;
|
|
21
|
-
readonly projectLink?: string;
|
|
22
|
-
constructor(chainId: number, address: `0x${string}`, decimals: number, symbol: string, name?: string, projectLink?: string);
|
|
23
|
-
/**
|
|
24
|
-
* Returns true if the two tokens are equivalent, i.e. have the same chainId and address.
|
|
25
|
-
* @param other other token to compare
|
|
26
|
-
*/
|
|
27
|
-
equals(other: Currency): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Returns true if the address of this token sorts before the address of the other token
|
|
30
|
-
* @param other other token to compare
|
|
31
|
-
* @throws if the tokens have the same address
|
|
32
|
-
* @throws if the tokens are on different chains
|
|
33
|
-
*/
|
|
34
|
-
sortsBefore(other: Token): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* Return this token, which does not need to be wrapped
|
|
37
|
-
*/
|
|
38
|
-
get wrapped(): Token;
|
|
39
|
-
get serialize(): SerializedToken;
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=token.d.ts.map
|
package/dist/token.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../src/token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,KAAK,MAAM,EAAE,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;;GAEG;AACH,qBAAa,KAAM,SAAQ,YAAY;IACrC,SAAgB,QAAQ,EAAE,KAAK,CAAiB;IAEhD,SAAgB,OAAO,EAAE,IAAI,CAAgB;IAE7C;;OAEG;IACH,SAAgB,OAAO,EAAE,KAAK,MAAM,EAAE,CAAA;IAEtC,SAAgB,WAAW,CAAC,EAAE,MAAM,CAAA;gBAGlC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM;IAOtB;;;OAGG;IACI,MAAM,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAIvC;;;;;OAKG;IACI,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO;IAMzC;;OAEG;IACH,IAAW,OAAO,IAAI,KAAK,CAE1B;IAED,IAAW,SAAS,IAAI,eAAe,CAStC;CACF"}
|