@parifi/sdk
Version:
Parifi SDK with common utility functions
177 lines (174 loc) • 4.9 kB
text/typescript
import Decimal__default from 'decimal.js';
import { SnxAccountType, OrderStatus, PositionStatus } from './subgraphTypes.mjs';
type Wallet = {
id: string;
snxAccounts?: SnxAccount[];
};
type SnxAccount = {
id: string;
type?: SnxAccountType;
accountId?: string;
owner?: Wallet;
totalOrdersCount?: string;
totalPositionsCount?: string;
openPositionCount?: string;
countProfitablePositions?: string;
countLossPositions?: string;
countLiquidatedPositions?: string;
realizedPnlFromPositions?: string;
totalFeesPaid?: string;
finalPnlAfterFees?: string;
totalVolumeInUsd?: string;
totalAccruedBorrowingFeesInUsd?: string;
integratorFeesGenerated?: string;
lastLiquidationValue?: string;
orders?: Order[];
positions?: Position[];
collateralDeposits?: CollateralDeposit[];
};
type CollateralDeposit = {
id: string;
snxAccountId?: string;
collateralId?: string;
collateralName?: string;
collateralSymbol?: string;
collateralDecimals?: string;
collateralAddress?: string;
currentDepositedAmount?: string;
totalAmountDeposited?: string;
totalAmountWithdrawn?: string;
totalAmountLiquidated?: string;
};
type Synth = {
id: string;
name?: string;
symbol?: string;
decimals?: number;
synthAddress?: string;
};
type Market = {
id: string;
marketName?: string;
marketSymbol?: string;
feedId?: string;
skew?: string;
size?: string;
maxOpenInterest?: string;
interestRate?: string;
currentFundingRate?: string;
currentFundingVelocity?: string;
indexPrice?: string;
skewScale?: string;
maxFundingVelocity?: string;
makerFee?: string;
takerFee?: string;
maxMarketValue?: string;
maxMarketSize?: string;
marketPrice?: string;
initialMarginRatioD18?: string;
maintenanceMarginRatioD18?: string;
minimumInitialMarginRatioD18?: string;
flagRewardRatioD18?: string;
minimumPositionMargin?: string;
openInterestUsd?: string;
};
type Order = {
id: string;
market?: Market;
snxAccountId?: string;
isLimitOrder?: boolean;
acceptablePrice?: string;
commitmentTime?: string;
expectedPriceTime?: string;
settlementTime?: string;
expirationTime?: string;
trackingCode?: string;
deltaSize?: string;
deltaSizeUsd?: string;
executionPrice?: string;
collectedFees?: string;
settlementReward?: string;
referralFees?: string;
partnerAddress?: string;
txHash?: string;
createdTimestamp?: string;
status?: OrderStatus;
settledTxHash?: string;
cancellationTxHash?: string;
settledTimestamp?: string;
settledTimestampISO: string;
settledBy?: Wallet;
snapshotCollateralValueUsd?: string;
};
type Position = {
id: string;
market?: Market;
snxAccountId?: string;
isLong?: boolean;
positionSize?: string;
avgPrice?: string;
avgPriceDec?: string;
status?: PositionStatus;
txHash?: string;
liquidationTxHash?: string;
closingPrice?: string;
realizedPositionPnl?: string;
totalFeesPaid?: string;
realizedPnlAfterFees?: string;
createdTimestamp?: string;
lastRefresh?: string;
lastRefreshISO?: string;
accruedBorrowingFees?: string;
canBeLiquidated?: boolean;
snapshotCollateralValueUsd?: string;
};
interface ProtocolStats {
id?: string;
userCount?: string;
activeUsersCount?: string;
orderCount?: string;
settledCount?: string;
positionCount?: string;
totalActivePositions?: string;
referralFeesReceived?: string;
totalVolume?: string;
orderTotalFees?: string;
}
interface LeaderboardUserData {
userAddress?: string;
totalOrdersCount?: number;
totalPositionsCount?: number;
countProfitablePositions?: number;
countLossPositions?: number;
countLiquidatedPositions?: number;
totalVolumeInUsd?: Decimal__default;
totalVolumeInUsdLongs?: Decimal__default;
totalVolumeInUsdShorts?: Decimal__default;
totalRealizedPnlPositions?: Decimal__default;
totalAccruedBorrowingFeesInUsd?: Decimal__default;
}
type Token = {
id?: string;
name?: string;
symbol?: string;
decimals?: string;
lastPriceUSD?: string;
lastPriceTimestamp?: string;
};
type SettlementStrategy = {
id?: string;
strategyId?: string;
strategyType?: string;
settlementDelay?: string;
settlementWindowDuration?: string;
priceVerificationContract?: string;
feedId?: string;
settlementReward?: string;
disabled?: string;
commitmentPriceDelay?: string;
};
type FormattedPythPrice = {
priceId: string;
formattedPrice: Decimal__default;
};
export type { CollateralDeposit, FormattedPythPrice, LeaderboardUserData, Market, Order, Position, ProtocolStats, SettlementStrategy, SnxAccount, Synth, Token, Wallet };