@nimiq/fastspot-api
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -14,3 +14,3 @@ import { SwapAsset, } from './types'; | ||
throw new Error('API URL and key not set, call init() first'); | ||
return fetch(`${API_URL}${path}`, { | ||
const response = await fetch(`${API_URL}${path}`, { | ||
method, | ||
@@ -22,9 +22,8 @@ headers: { | ||
...(body ? { body: JSON.stringify(body) } : {}), | ||
}).then(async (res) => { | ||
if (!res.ok) { | ||
const error = await res.json(); | ||
throw new Error(error.detail); | ||
} | ||
return res.json(); | ||
}); | ||
if (!response.ok) { | ||
const error = await response.json(); | ||
throw new Error(error.detail); | ||
} | ||
return response.json(); | ||
} | ||
@@ -31,0 +30,0 @@ export async function getEstimate(from, to) { |
@@ -32,2 +32,3 @@ import { SwapAsset, } from './types'; | ||
serviceNetworkFee: coinsToUnits(asset, from.finalizeNetworkFee.total, true), | ||
serviceEscrowFee: coinsToUnits(asset, from.operatingNetworkFee.total, true), | ||
}; | ||
@@ -43,2 +44,3 @@ } | ||
serviceNetworkFee: coinsToUnits(asset, to.fundingNetworkFee.total, true), | ||
serviceEscrowFee: coinsToUnits(asset, to.operatingNetworkFee.total, true), | ||
}; | ||
@@ -45,0 +47,0 @@ } |
@@ -36,3 +36,3 @@ export declare enum SwapAsset { | ||
fundingNetworkFee: FastspotFee; | ||
operatingNetworkFee: FastspotFee; | ||
operatingNetworkFee: Omit<FastspotFee, 'perUnit'>; | ||
finalizeNetworkFee: FastspotFee; | ||
@@ -127,2 +127,3 @@ }; | ||
serviceNetworkFee: number; | ||
serviceEscrowFee: number; | ||
}; | ||
@@ -129,0 +130,0 @@ export declare type Estimate = { |
{ | ||
"name": "@nimiq/fastspot-api", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Typescript library to interact with the Fastspot API", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:nimiq/fastspot-api.git", |
28350
487