@kodiak-finance/orderly-ui-share
Version:
111 lines (105 loc) • 2.8 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
type layoutInfo = {
width?: number;
height?: number;
fontSize?: number;
color?: string;
textAlign?: CanvasTextAlign;
textBaseline?: CanvasTextBaseline;
position: Partial<{
left: number;
right: number;
top: number;
bottom: number;
}>;
};
type PosterLayoutConfig = {
message?: layoutInfo;
domain?: layoutInfo;
position?: layoutInfo;
unrealizedPnl?: layoutInfo & {
secondaryColor: string;
secondaryFontSize: number;
};
informations?: layoutInfo & {
labelColor?: string;
};
updateTime?: layoutInfo;
};
type SharePnLConfig = SharePnLOptions & Partial<Omit<SharePnLParams, "refCode">>;
type SharePnLParams = {
entity: ShareEntity;
refCode?: string;
refSlogan?: string;
refLink?: string;
};
type SharePnLOptions = {
/**
* default is Manrope
*/
fontFamily?: string;
/**
* can not empty
*/
backgroundImages?: string[];
/**
* posterLayoutConfig
*/
layout?: PosterLayoutConfig;
/**
* norma text color, default is "rgba(255, 255, 255, 0.98)"
*/
color?: string;
/**
* profit text color, default is "rgb(0,181,159)"
*/
profitColor?: string;
/**
* loss text color, default is "rgb(255,103,194)"
*/
lossColor?: string;
/**
* brand color, default is "rgb(0,181,159)"
*/
brandColor?: string;
};
type ReferralType = {
code?: string;
link?: string;
slogan?: string;
};
type ShareEntity = {
symbol: string;
side: "LONG" | "SHORT";
pnl?: number;
roi?: number;
openPrice?: number;
closePrice?: number;
openTime?: number;
closeTime?: number;
markPrice?: number;
quantity?: number;
leverage?: number;
};
declare const useSharePnLScript: (props: {
pnl?: SharePnLOptions & SharePnLParams;
hide?: () => void;
}) => {
entity: ShareEntity | undefined;
baseDp: number | undefined;
quoteDp: number | undefined;
referralInfo: ReferralType | undefined;
shareOptions: SharePnLOptions;
hide: (() => void) | undefined;
};
declare const SharePnLBottomSheetWidget: (props: {
hide?: () => void;
pnl?: SharePnLOptions & SharePnLParams;
}) => react_jsx_runtime.JSX.Element;
declare const SharePnLDialogWidget: (props: {
hide?: () => void;
pnl?: SharePnLOptions & SharePnLParams;
}) => react_jsx_runtime.JSX.Element;
declare const SharePnLDialogId = "sharePnLDialog";
declare const SharePnLBottomSheetId = "sharePnLBottomSheet";
export { SharePnLBottomSheetId, SharePnLBottomSheetWidget, type SharePnLConfig, SharePnLDialogId, SharePnLDialogWidget, type SharePnLOptions, type SharePnLParams, useSharePnLScript };