@nimiq/fastspot-api
Advanced tools
Comparing version 1.2.1 to 1.3.0
@@ -1,3 +0,3 @@ | ||
import { RequestAsset, SwapAsset, PriceData, FastspotPrice, FastspotContract, FastspotPreSwap, FastspotSwap, FastspotLimits, Contract, PreSwap, Swap, Limits } from './types'; | ||
export declare function coinsToUnits(asset: SwapAsset, value: string | number, roundUp?: boolean): number; | ||
import { RequestAsset, SwapAsset, ReferenceAsset, PriceData, FastspotPrice, FastspotContract, FastspotPreSwap, FastspotSwap, FastspotLimits, Contract, PreSwap, Swap, Limits } from './types'; | ||
export declare function coinsToUnits(asset: SwapAsset | ReferenceAsset, value: string | number, roundUp?: boolean): number; | ||
export declare function convertFromData(from: FastspotPrice): PriceData; | ||
@@ -4,0 +4,0 @@ export declare function convertToData(to: FastspotPrice): PriceData; |
@@ -1,2 +0,2 @@ | ||
import { SwapAsset, } from './types'; | ||
import { SwapAsset, ReferenceAsset, } from './types'; | ||
export function coinsToUnits(asset, value, roundUp = false) { | ||
@@ -14,2 +14,5 @@ let decimals; | ||
break; | ||
case ReferenceAsset.USD: | ||
decimals = 2; | ||
break; | ||
default: throw new Error(`Invalid asset ${asset}`); | ||
@@ -119,2 +122,6 @@ } | ||
monthly: coinsToUnits(limits.asset, limits.monthly), | ||
referenceAsset: limits.referenceAsset, | ||
referenceCurrent: coinsToUnits(limits.referenceAsset, limits.referenceCurrent), | ||
referenceDaily: coinsToUnits(limits.referenceAsset, limits.referenceDaily), | ||
referenceMonthly: coinsToUnits(limits.referenceAsset, limits.referenceMonthly), | ||
}; | ||
@@ -121,0 +128,0 @@ } |
@@ -6,2 +6,5 @@ export declare enum SwapAsset { | ||
} | ||
export declare enum ReferenceAsset { | ||
USD = "USD" | ||
} | ||
export declare type FastspotAsset = { | ||
@@ -96,2 +99,6 @@ symbol: SwapAsset; | ||
monthly: string; | ||
referenceAsset: ReferenceAsset; | ||
referenceCurrent: string; | ||
referenceDaily: string; | ||
referenceMonthly: string; | ||
}; | ||
@@ -176,2 +183,6 @@ export declare type FastspotResult = FastspotAsset[] | FastspotEstimate[] | FastspotSwap | FastspotContractWithEstimate<SwapAsset> | FastspotLimits<SwapAsset>; | ||
monthly: number; | ||
referenceAsset: ReferenceAsset; | ||
referenceCurrent: number; | ||
referenceDaily: number; | ||
referenceMonthly: number; | ||
}; |
@@ -7,1 +7,5 @@ export var SwapAsset; | ||
})(SwapAsset || (SwapAsset = {})); | ||
export var ReferenceAsset; | ||
(function (ReferenceAsset) { | ||
ReferenceAsset["USD"] = "USD"; | ||
})(ReferenceAsset || (ReferenceAsset = {})); |
{ | ||
"name": "@nimiq/fastspot-api", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Typescript library to interact with the Fastspot API", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:nimiq/fastspot-api.git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29343
513