mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-04 03:58:00 +03:00
CFD (#28)
* Added new pairs type: futures * Added new pairs type: futures * added market param to pairsConfig request * OP-3268 [CFD] Deposit amount Added CFDContracts endpoint package.json version update * OP-3268 [CFD] Deposit amount CFDContractsSchema export * OP-3268 [CFD] Deposit amount CFDContractsSchema export package.json update * cfdContractsSchema rename Add getCFDHistory method package.json update * Parameter of getCFDHistory method was updated * cfdHistorySchema was updated * WS subscribtion for CFD balances, CFD Order signing functionality * cfdHistorySchema was updated package.json version 0.16.0-rc.6 was updated * package.json version 0.16.0-rc.7 was updated * Exchange and CFD history schemas was transformed package.json version 0.16.0-rc.8 was updated * Added HistoryTransactionStatus package.json version 0.16.0-rc.8 was updated * cfdContractsSchema was updated package.json version 0.16.0-rc.10 was updated * Merge conflicts fix package.json version was updated to 0.16.0-rc.12 * updated schemas, updated version * Updated CFD balance schema, updated unsubscribe with passing extra details * CFD balances schema update * Added CFD prices request * typing small fix * fixed transformation of CFD init / update responses * temporary added debug * temporary added debug. changed ver * debug, ver up * Add currentPrice to cfdBalanceSchema * Added maxAvailableLong maxAvailableShort to balances * added leverage and position status * Update isWithCode - allow string code * version up Co-authored-by: Mikhail Gladchenko <m@gladchenko.pw> Co-authored-by: Demid <demidn@gmail.com> Co-authored-by: Dmitry Leleko <lelekodmitry@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@ type WithReason = {
|
||||
}
|
||||
|
||||
type WithCodeError = Error & {
|
||||
code: number;
|
||||
code: number | string;
|
||||
}
|
||||
|
||||
type WithMessage = {
|
||||
@@ -41,9 +41,9 @@ export function hasProp<T extends Record<string, unknown>, K extends PropertyKey
|
||||
}
|
||||
|
||||
export function isWithCode(candidate: unknown): candidate is WithCodeError {
|
||||
if (!isUnknownObject(candidate)) return false;
|
||||
const hasCodeProperty = hasProp(candidate, 'code') && typeof candidate.code === 'number';
|
||||
return hasCodeProperty;
|
||||
if (!isUnknownObject(candidate) || !hasProp(candidate, 'code')) return false;
|
||||
const type = typeof candidate.code;
|
||||
return type === 'number' || type === 'string';
|
||||
}
|
||||
|
||||
export function isWithReason(candidate: unknown): candidate is WithReason {
|
||||
|
||||
Reference in New Issue
Block a user