Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/structures/Amount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import FiatCurrency from './FiatCurrency';
export default class Amount {
public value: BigNumber;

public currency?: CryptoCurrency | FiatCurrency;
public currency: CryptoCurrency | FiatCurrency | null;

/**
* Create an Amount.
Expand All @@ -28,10 +28,10 @@ export default class Amount {
this.value = BigNumber(payload.value);
switch (currencyType) {
case 'crypto':
this.currency = getCachedCryptoCurrency(payload.currency);
this.currency = getCachedCryptoCurrency(payload.currency) ?? null;
break;
case 'fiat':
this.currency = getCachedFiatCurrency(payload.currency);
this.currency = getCachedFiatCurrency(payload.currency) ?? null;
break;
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/structures/CurrencyFormat.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { APICryptoCurrency, APIFiatCurrency } from '@tipccjs/tipcc-api-types';
import type {
APICryptoCurrency,
APIFiatCurrency,
} from '@tipccjs/tipcc-api-types';
import CryptoCurrencyUnit from './CurrencyFormatUnits';

/**
Expand Down
24 changes: 12 additions & 12 deletions src/structures/CurrencyFormatUnits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,35 @@ import type {
export default class CurrencyUnit {
public singular: string;

public plural?: string;
public plural: string | null;

public prefix?: string;
public prefix: string | null;

public suffix?: string;
public suffix: string | null;

public scale: number;

public aliases: string[];

public minDecimals?: number;
public minDecimals: number | null;

public optionalDecimals?: boolean;
public optionalDecimals: boolean | null;

public min?: number;
public min: number | null;

/**
* Create a CryptoCurrencyUnit.
* @param payload The format unit from the API
*/
constructor(payload: APIFiatCurrencyUnit | APICryptoCurrencyUnit) {
this.singular = payload.singular;
this.plural = payload.plural ?? undefined;
this.prefix = payload.prefix;
this.suffix = payload.suffix;
this.plural = payload.plural ?? null;
this.prefix = payload.prefix ?? null;
this.suffix = payload.suffix ?? null;
this.scale = payload.scale;
this.aliases = payload.aliases ?? [];
this.minDecimals = payload.minDecimals;
this.optionalDecimals = payload.optionalDecimals;
this.min = payload.min;
this.minDecimals = payload.minDecimals ?? null;
this.optionalDecimals = payload.optionalDecimals ?? null;
this.min = payload.min ?? null;
}
}
2 changes: 1 addition & 1 deletion src/structures/RequestHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class RequestHandler {
constructor(
apiKey: string,
payload: {
apiBaseUrl?: string;
apiBaseUrl?: string | undefined;
} = {},
) {
this._apiBaseUrl = payload.apiBaseUrl ?? 'https://api.tip.cc/api/v0';
Expand Down
8 changes: 4 additions & 4 deletions src/structures/User.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import type { APIConnection } from '@tipccjs/tipcc-api-types';
export default class User {
public identifier: string;

public username?: string;
public username: string | null;

public avatarUrl?: string;
public avatarUrl: string | null;

public service: 'discord';

Expand All @@ -18,8 +18,8 @@ export default class User {
*/
constructor(payload: APIConnection) {
this.identifier = payload.identifier;
this.username = payload.username;
this.avatarUrl = payload.avatar_url;
this.username = payload.username ?? null;
this.avatarUrl = payload.avatar_url ?? null;
this.service = payload.service;
}
}
2 changes: 1 addition & 1 deletion src/structures/Wallet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { APIWallet } from '@tipccjs/tipcc-api-types';
import type { APIWallet } from '@tipccjs/tipcc-api-types';
import Amount from './Amount';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/utils/CacheHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import type {
RESTGetAPICurrenciesCryptoCurrenciesResult,
RESTGetAPICurrenciesFiatsResult,
} from '@tipccjs/tipcc-api-types';
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"removeComments": false,
"strictNullChecks": true,
"preserveConstEnums": true,
"exactOptionalPropertyTypes": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true
},
Expand Down