diff --git a/package-lock.json b/package-lock.json index aa7c950..b36c6b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "tipcc-api-types", - "version": "1.1.1", + "name": "@tipccjs/tipcc-api-types", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "tipcc-api-types", - "version": "1.1.1", + "name": "@tipccjs/tipcc-api-types", + "version": "1.0.0", "license": "MIT", "dependencies": { "typescript": "^5.0.4" diff --git a/payloads/v0/account.ts b/payloads/v0/account.ts index ec1638d..7c734c4 100644 --- a/payloads/v0/account.ts +++ b/payloads/v0/account.ts @@ -1,4 +1,4 @@ -import type { APICryptoCurrency, APIMonetary } from './currencies'; +import type { APICurrencySymbol, APIMonetary } from './currencies'; export enum APITransactionDirection { Incoming = 'incoming', @@ -42,7 +42,7 @@ export interface APIConnection { } export interface APIWallet { - code: APICryptoCurrency; + code: APICurrencySymbol; name: string; balance: APIMonetary; usd_value: APIMonetary; diff --git a/payloads/v0/currencies.ts b/payloads/v0/currencies.ts index b4793c7..24b7979 100644 --- a/payloads/v0/currencies.ts +++ b/payloads/v0/currencies.ts @@ -1,17 +1,15 @@ -export type APICryptoCurrency = string; -export type APIFiatCurrency = string; -export type APICurrency = string; +export type APICurrencySymbol = string; export interface APIMonetary { /* Pattern: `^[0-9]*$` */ value: string; - currency: APICurrency; + currency: APICurrencySymbol; } export interface APICoin { /* Pattern: `^[0-9]*$` */ value: string; - currency: APICryptoCurrency; + currency: APICurrencySymbol; } export interface APIExchangeRate { @@ -19,3 +17,44 @@ export interface APIExchangeRate { name: string; usd_value?: APIMonetary; } + +export interface APICryptoCurrencyUnit { + singular: string; + plural?: string; + prefix?: string; + suffix?: string; + scale: number; + aliases?: string[]; + minDecimals?: number; + optionalDecimals?: boolean; + min?: number; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface APIFiatCurrencyUnit extends APICryptoCurrencyUnit {} + +export interface APICryptoCurrency { + code: string; + name: string; + color: string; + icon: string; + explorer: string; + feeUnit: string; + format: { + scale: number; + units: APICryptoCurrencyUnit; + }; + options: { + extras?: string; + accounts?: boolean; + }; +} + +export interface APIFiatCurrency { + code: string; + name: string; + format: { + scale: number; + units: APIFiatCurrencyUnit; + }; +} diff --git a/rest/v0/account.ts b/rest/v0/account.ts index 83ba7d5..93f519d 100644 --- a/rest/v0/account.ts +++ b/rest/v0/account.ts @@ -5,9 +5,9 @@ import type { APIWallet, APIWithdrawl, } from '../../payloads/v0/account'; -import { +import type { APICoin, - APICryptoCurrency, + APICurrencySymbol, APIMonetary, } from '../../payloads/v0/currencies'; @@ -34,7 +34,7 @@ export interface RESTGetAPIAccountWalletPath { * https://api.tip.cc/docs/static/index.html#/wallet/get_api_v0_account_wallets__code__addresses */ export interface RESTGetAPIAccountWalletAddressesResult { - code: APICryptoCurrency; + code: APICurrencySymbol; name: string; master?: string; addresses: { diff --git a/rest/v0/currencies.ts b/rest/v0/currencies.ts index 3cfeab8..48630b2 100644 --- a/rest/v0/currencies.ts +++ b/rest/v0/currencies.ts @@ -1,4 +1,8 @@ -import { APICryptoCurrency, APIExchangeRate, APIFiatCurrency } from '../../v0'; +import type { + APICryptoCurrency, + APIFiatCurrency, + APIExchangeRate, +} from '../../v0'; export interface RESTGetAPICurrenciesCryptoCurrenciesResult { cryptocurrencies: APICryptoCurrency[];