@aurigami/sdk 0.1.5 → 0.1.6

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/src/token.ts DELETED
@@ -1,11 +0,0 @@
1
- export class Token {
2
- public readonly address: string;
3
- public readonly decimals: number;
4
- public readonly expiry?: number;
5
-
6
- public constructor(address: string, decimals: number, expiry?: number) {
7
- this.address = address.toLowerCase();
8
- this.decimals = decimals;
9
- this.expiry = expiry;
10
- }
11
- }
@@ -1,29 +0,0 @@
1
- import { Token } from "./token";
2
- import BigNumber from 'bignumber.js';
3
- import { decimalFactor } from "./helpers";
4
-
5
- export class TokenAmount {
6
- public readonly token: Token;
7
- private rawAmnt: string;
8
-
9
- public constructor(token: Token, amount: string, isRaw: boolean = true) {
10
- if (isRaw) {
11
- this.rawAmnt = amount;
12
- } else {
13
- this.rawAmnt = new BigNumber(amount)
14
- .times(decimalFactor(token.decimals))
15
- .toFixed(0);
16
- }
17
- this.token = token;
18
- }
19
-
20
- public formattedAmount(): string {
21
- return new BigNumber(this.rawAmnt)
22
- .div(decimalFactor(this.token.decimals))
23
- .toString();
24
- }
25
-
26
- public rawAmount(): string {
27
- return this.rawAmnt;
28
- }
29
- }