@cryptorubic/core 1.0.0-alpha.no-sdk.2 → 1.0.0-alpha.no-sdk.3
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/package.json +1 -1
- package/src/lib/tokens/price-token-amount.d.ts +1 -0
- package/src/lib/tokens/price-token-amount.js +3 -0
- package/src/lib/tokens/price-token.d.ts +1 -0
- package/src/lib/tokens/price-token.js +3 -0
- package/src/lib/tokens/token-amount.d.ts +1 -0
- package/src/lib/tokens/token-amount.js +3 -0
- package/src/lib/tokens/token.d.ts +1 -0
- package/src/lib/tokens/token.js +3 -0
package/package.json
CHANGED
|
@@ -16,4 +16,5 @@ export declare class PriceTokenAmount<Blockchain extends BlockchainName = Blockc
|
|
|
16
16
|
private getWeiAmount;
|
|
17
17
|
get asStructWithAmount(): TokenAmountStruct<Blockchain>;
|
|
18
18
|
calculatePriceImpactPercent(toToken: PriceTokenAmount): number | null;
|
|
19
|
+
clone(tokenStruct?: Partial<PriceTokenAmountStruct>): PriceTokenAmount;
|
|
19
20
|
}
|
|
@@ -8,4 +8,5 @@ export declare class PriceToken<Blockchain extends BlockchainName = BlockchainNa
|
|
|
8
8
|
set price(price: BigNumber);
|
|
9
9
|
get asStructWithPrice(): PriceTokenStruct<Blockchain>;
|
|
10
10
|
constructor(tokenStruct: PriceTokenStruct<Blockchain>);
|
|
11
|
+
clone(tokenStruct?: Partial<PriceTokenStruct>): PriceToken;
|
|
11
12
|
}
|
|
@@ -13,4 +13,5 @@ export declare class TokenAmount<T extends BlockchainName = BlockchainName> exte
|
|
|
13
13
|
weiAmountPlusSlippage(slippage: number): BigNumber;
|
|
14
14
|
private getWeiAmount;
|
|
15
15
|
get asStructWithAmount(): TokenAmountStruct<BlockchainName>;
|
|
16
|
+
clone(tokenStruct?: Partial<TokenAmountStruct>): TokenAmount;
|
|
16
17
|
}
|
|
@@ -20,6 +20,7 @@ export declare class Token<Blockchain extends BlockchainName = BlockchainName> {
|
|
|
20
20
|
constructor(tokenStruct: TokenStruct<Blockchain>);
|
|
21
21
|
isEqualTo(token: TokenBaseStruct): boolean;
|
|
22
22
|
isEqualToTokens(tokens: TokenBaseStruct[]): boolean;
|
|
23
|
+
clone(tokenStruct?: Partial<TokenStruct>): Token;
|
|
23
24
|
static toWei(amount: BigNumber | string | number, decimals?: number, roundingMode?: BigNumber.RoundingMode): string;
|
|
24
25
|
/**
|
|
25
26
|
* Converts amount from Wei to Ether units.
|
package/src/lib/tokens/token.js
CHANGED
|
@@ -46,6 +46,9 @@ class Token {
|
|
|
46
46
|
isEqualToTokens(tokens) {
|
|
47
47
|
return tokens.some((token) => this.isEqualTo(token));
|
|
48
48
|
}
|
|
49
|
+
clone(tokenStruct) {
|
|
50
|
+
return new Token({ ...this, ...tokenStruct });
|
|
51
|
+
}
|
|
49
52
|
static toWei(amount, decimals = 18, roundingMode) {
|
|
50
53
|
return new bignumber_js_1.default(amount || 0).times(new bignumber_js_1.default(10).pow(decimals)).toFixed(0, roundingMode);
|
|
51
54
|
}
|