@nimiq/fastspot-api
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -1,6 +0,3 @@ | ||
import { RequestAsset, SwapAsset, Estimate, PreSwap, ContractWithEstimate, Swap, Limits, UserLimits, AssetList } from './types'; | ||
export declare function init(url: string, key: string, referral?: { | ||
partnerCode: string; | ||
refCode: string; | ||
}): void; | ||
import { RequestAsset, SwapAsset, Estimate, PreSwap, ContractWithEstimate, Swap, Limits, UserLimits, AssetList, ReferralCodes } from './types'; | ||
export declare function init(url: string, key: string, referral?: ReferralCodes): void; | ||
export declare function getEstimate(from: RequestAsset<SwapAsset>, to: SwapAsset): Promise<Estimate>; | ||
@@ -7,0 +4,0 @@ export declare function getEstimate(from: SwapAsset, to: RequestAsset<SwapAsset>): Promise<Estimate>; |
@@ -58,2 +58,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
validateRequestPairs(from, to); | ||
const headers = {}; | ||
if (REFERRAL) { | ||
headers['X-S3-Partner-Code'] = REFERRAL.partnerCode; | ||
if (REFERRAL.refCode) | ||
headers['X-S3-Ref-Code'] = REFERRAL.refCode; | ||
} | ||
const result = yield api('/swaps', 'POST', { | ||
@@ -63,6 +69,3 @@ from, | ||
includedFees: 'required', | ||
}, REFERRAL ? { | ||
'X-S3-Partner-Code': REFERRAL.partnerCode, | ||
'X-S3-Ref-Code': REFERRAL.refCode, | ||
} : undefined); | ||
}, headers); | ||
return convertSwap(result); | ||
@@ -69,0 +72,0 @@ }); |
@@ -46,2 +46,3 @@ import { SwapAsset, Precision, } from './types'; | ||
address: contract.intermediary.contractId || contract.id, | ||
// TODO: Parse clearing instructions if provided | ||
}; | ||
@@ -48,0 +49,0 @@ break; |
@@ -9,2 +9,6 @@ export declare enum SwapAsset { | ||
} | ||
export declare type ReferralCodes = { | ||
partnerCode: string; | ||
refCode?: string; | ||
}; | ||
export declare const Precision: { | ||
@@ -11,0 +15,0 @@ readonly NIM: 5; |
{ | ||
"name": "@nimiq/fastspot-api", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"description": "Typescript library to interact with the Fastspot API", | ||
@@ -17,4 +17,4 @@ "repository": "git@github.com:nimiq/fastspot-api.git", | ||
"devDependencies": { | ||
"typescript": "^4.0.5" | ||
"typescript": "^4.6.3" | ||
} | ||
} |
35356
621