@nimiq/fastspot-api
Advanced tools
Comparing version 1.5.4 to 1.5.5
@@ -16,3 +16,3 @@ import { RequestAsset, SwapAsset, Estimate, PreSwap, ContractWithEstimate, Swap, Limits, UserLimits, AssetList } from './types'; | ||
y?: string; | ||
}, refund: { | ||
}, refund?: { | ||
asset: SwapAsset.NIM | SwapAsset.BTC; | ||
@@ -19,0 +19,0 @@ address: string; |
@@ -69,5 +69,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const result = yield api(`/swaps/${swap.id}`, 'POST', Object.assign({ confirm: true, beneficiary: redeem.asset === SwapAsset.EUR | ||
const result = yield api(`/swaps/${swap.id}`, 'POST', Object.assign(Object.assign({ confirm: true, beneficiary: redeem.asset === SwapAsset.EUR | ||
? { [redeem.asset]: Object.assign({ kty: redeem.kty, crv: redeem.crv, x: redeem.x }, (redeem.y ? { y: redeem.y } : {})) } | ||
: { [redeem.asset]: redeem.address }, refund: { [refund.asset]: 'address' in refund ? refund.address : '' } }, (uid ? { uid } : {}))); | ||
: { [redeem.asset]: redeem.address } }, (refund ? { refund: { [refund.asset]: 'address' in refund ? refund.address : '' } } : {})), (uid ? { uid } : {}))); | ||
return convertSwap(result); | ||
@@ -74,0 +74,0 @@ }); |
@@ -15,2 +15,19 @@ export declare enum SwapAsset { | ||
}; | ||
export declare enum SwapStatus { | ||
WAITING_FOR_CONFIRMATION = "waiting-for-confirmation", | ||
WAITING_FOR_TRANSACTIONS = "waiting-for-transactions", | ||
WAITING_FOR_REDEMPTION = "waiting-for-redemption", | ||
FINISHED = "finished", | ||
EXPIRED_PENDING_CONFIRMATIONS = "expired-pending-confirmation", | ||
EXPIRED_PENDING_TRANSACTIONS = "expired-pending-transactions", | ||
CANCELLED = "cancelled", | ||
INVALID = "invalid" | ||
} | ||
export declare enum ContractStatus { | ||
PENDING = "pending", | ||
FUNDED = "funded", | ||
TIMEOUT_REACHED = "timeout-reached", | ||
REFUNDED = "refunded", | ||
REDEEMED = "redeemed" | ||
} | ||
export declare type FastspotAsset = { | ||
@@ -71,3 +88,3 @@ symbol: SwapAsset; | ||
direction: 'send' | 'receive'; | ||
status: string; | ||
status: ContractStatus; | ||
id: string; | ||
@@ -92,3 +109,3 @@ intermediary: T extends SwapAsset.NIM ? { | ||
id: string; | ||
status: string; | ||
status: SwapStatus; | ||
expires: number; | ||
@@ -185,3 +202,3 @@ info: FastspotEstimate; | ||
direction: 'send' | 'receive'; | ||
status: string; | ||
status: ContractStatus; | ||
htlc: T extends SwapAsset.NIM ? NimHtlcDetails : T extends SwapAsset.BTC ? BtcHtlcDetails : T extends SwapAsset.EUR ? EurHtlcDetails : never; | ||
@@ -195,3 +212,3 @@ }; | ||
expires: number; | ||
status: string; | ||
status: SwapStatus; | ||
}; | ||
@@ -198,0 +215,0 @@ export declare type Swap = PreSwap & { |
@@ -17,1 +17,20 @@ export var SwapAsset; | ||
}; | ||
export var SwapStatus; | ||
(function (SwapStatus) { | ||
SwapStatus["WAITING_FOR_CONFIRMATION"] = "waiting-for-confirmation"; | ||
SwapStatus["WAITING_FOR_TRANSACTIONS"] = "waiting-for-transactions"; | ||
SwapStatus["WAITING_FOR_REDEMPTION"] = "waiting-for-redemption"; | ||
SwapStatus["FINISHED"] = "finished"; | ||
SwapStatus["EXPIRED_PENDING_CONFIRMATIONS"] = "expired-pending-confirmation"; | ||
SwapStatus["EXPIRED_PENDING_TRANSACTIONS"] = "expired-pending-transactions"; | ||
SwapStatus["CANCELLED"] = "cancelled"; | ||
SwapStatus["INVALID"] = "invalid"; | ||
})(SwapStatus || (SwapStatus = {})); | ||
export var ContractStatus; | ||
(function (ContractStatus) { | ||
ContractStatus["PENDING"] = "pending"; | ||
ContractStatus["FUNDED"] = "funded"; | ||
ContractStatus["TIMEOUT_REACHED"] = "timeout-reached"; | ||
ContractStatus["REFUNDED"] = "refunded"; | ||
ContractStatus["REDEEMED"] = "redeemed"; | ||
})(ContractStatus || (ContractStatus = {})); |
{ | ||
"name": "@nimiq/fastspot-api", | ||
"version": "1.5.4", | ||
"version": "1.5.5", | ||
"description": "Typescript library to interact with the Fastspot API", | ||
@@ -5,0 +5,0 @@ "repository": "git@github.com:nimiq/fastspot-api.git", |
34726
607