@kodiak-finance/orderly-trading-rewards 2.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,131 @@
1
+ import React, { ReactNode, FC, PropsWithChildren } from 'react';
2
+ import * as _kodiak_finance_orderly_hooks from '@kodiak-finance/orderly-hooks';
3
+ import { CurrentEpochEstimate, EpochInfoItem, WalletRewardsItem, TWType } from '@kodiak-finance/orderly-hooks';
4
+ import * as _kodiak_finance_orderly_ui from '@kodiak-finance/orderly-ui';
5
+ import { ScaffoldProps, SideBarProps } from '@kodiak-finance/orderly-ui-scaffold';
6
+
7
+ type TitleConfig = {
8
+ title?: string | ReactNode;
9
+ subtitle?: string | ReactNode;
10
+ content?: string | ReactNode;
11
+ docOpenOptions?: {
12
+ url?: string;
13
+ target?: string;
14
+ features?: string;
15
+ };
16
+ brokerName?: string;
17
+ };
18
+
19
+ declare const Title: FC<TitleConfig>;
20
+
21
+ declare const TitleWidget: React.FC;
22
+
23
+ declare const CurEpochWidget: FC;
24
+
25
+ type RewardsTooltipProps = {
26
+ brokerName: string | undefined;
27
+ curRewards: number;
28
+ otherRewards: number;
29
+ };
30
+
31
+ declare const useCurEpochScript: () => {
32
+ epochList: _kodiak_finance_orderly_hooks.EpochInfoType;
33
+ estimate: _kodiak_finance_orderly_hooks.CurrentEpochEstimate | undefined;
34
+ hideData: boolean;
35
+ notConnected: boolean;
36
+ connect: (options?: any) => Promise<_kodiak_finance_orderly_hooks.WalletState[]>;
37
+ rewardsTooltip: RewardsTooltipProps | undefined;
38
+ statusInfo: _kodiak_finance_orderly_hooks.StatusInfo | undefined;
39
+ showEpochPauseCountdown: boolean | undefined;
40
+ };
41
+ type CurEpochReturns = ReturnType<typeof useCurEpochScript>;
42
+
43
+ declare const CurEpoch: FC<CurEpochReturns>;
44
+
45
+ declare const AvailableToClaimWidget: React.FC;
46
+
47
+ type AvailableReturns = {
48
+ order?: number;
49
+ esOrder?: number;
50
+ goToClaim?: (e: any) => void;
51
+ };
52
+
53
+ declare const AvailableToClaim: FC<AvailableReturns>;
54
+
55
+ declare const StakeBoosterWidget: React.FC;
56
+
57
+ declare const useStakeBoosterScript: () => {
58
+ curEpochEstimate: CurrentEpochEstimate | undefined;
59
+ stakeNow: (e: any) => void;
60
+ booster: string | number | undefined;
61
+ };
62
+ type StakeBoosterReturns = ReturnType<typeof useStakeBoosterScript>;
63
+
64
+ declare const StakeBooster: FC<StakeBoosterReturns>;
65
+
66
+ type ListType = EpochInfoItem & {
67
+ info?: WalletRewardsItem;
68
+ state?: string;
69
+ rewardsTooltip?: RewardsTooltipProps;
70
+ };
71
+ type RewardsHistoryReturns = ReturnType<typeof useRewardsHistoryScript>;
72
+ declare const useRewardsHistoryScript: () => {
73
+ data: ListType[];
74
+ originalData: ListType[];
75
+ pagination: _kodiak_finance_orderly_ui.PaginationMeta;
76
+ isLoading: boolean;
77
+ };
78
+
79
+ declare const RewardHistory: FC<RewardsHistoryReturns>;
80
+
81
+ declare const RewardsHistoryWidget: React.FC;
82
+
83
+ declare const TradingRewardsProvider: React.FC<PropsWithChildren<{
84
+ type?: TWType;
85
+ titleConfig?: TitleConfig;
86
+ showEpochPauseCountdown?: boolean;
87
+ }>>;
88
+
89
+ declare const HomePage: React.FC<{
90
+ titleConfig?: TitleConfig;
91
+ className?: string;
92
+ showEpochPauseCountdown?: boolean;
93
+ }>;
94
+
95
+ declare const index_AvailableToClaim: typeof AvailableToClaim;
96
+ declare const index_AvailableToClaimWidget: typeof AvailableToClaimWidget;
97
+ declare const index_CurEpoch: typeof CurEpoch;
98
+ declare const index_CurEpochWidget: typeof CurEpochWidget;
99
+ declare const index_HomePage: typeof HomePage;
100
+ declare const index_RewardHistory: typeof RewardHistory;
101
+ declare const index_RewardsHistoryWidget: typeof RewardsHistoryWidget;
102
+ declare const index_StakeBooster: typeof StakeBooster;
103
+ declare const index_StakeBoosterWidget: typeof StakeBoosterWidget;
104
+ declare const index_Title: typeof Title;
105
+ type index_TitleConfig = TitleConfig;
106
+ declare const index_TitleWidget: typeof TitleWidget;
107
+ declare const index_TradingRewardsProvider: typeof TradingRewardsProvider;
108
+ declare const index_useCurEpochScript: typeof useCurEpochScript;
109
+ declare namespace index {
110
+ export { index_AvailableToClaim as AvailableToClaim, index_AvailableToClaimWidget as AvailableToClaimWidget, index_CurEpoch as CurEpoch, index_CurEpochWidget as CurEpochWidget, index_HomePage as HomePage, index_RewardHistory as RewardHistory, index_RewardsHistoryWidget as RewardsHistoryWidget, index_StakeBooster as StakeBooster, index_StakeBoosterWidget as StakeBoosterWidget, index_Title as Title, type index_TitleConfig as TitleConfig, index_TitleWidget as TitleWidget, index_TradingRewardsProvider as TradingRewardsProvider, index_useCurEpochScript as useCurEpochScript };
111
+ }
112
+
113
+ declare const TradingRewardsLayoutWidget: FC<PropsWithChildren<ScaffoldProps>>;
114
+
115
+ type TradingRewardsLayoutProps = ScaffoldProps & {
116
+ hideSideBar?: boolean;
117
+ items?: SideBarProps["items"];
118
+ };
119
+ declare const TradingRewardsLayout: React.FC<PropsWithChildren<TradingRewardsLayoutProps>>;
120
+
121
+ declare enum TradingRewardsLeftSidebarPath {
122
+ Trading = "/rewards/trading",
123
+ Affiliate = "/rewards/affiliate"
124
+ }
125
+ declare const useTradingRewardsLayoutScript: (props: {
126
+ current?: string;
127
+ }) => SideBarProps & {
128
+ hideSideBar: boolean;
129
+ };
130
+
131
+ export { index as TradingRewards, TradingRewardsLayout, TradingRewardsLayoutWidget, TradingRewardsLeftSidebarPath, useTradingRewardsLayoutScript };
@@ -0,0 +1,131 @@
1
+ import React, { ReactNode, FC, PropsWithChildren } from 'react';
2
+ import * as _kodiak_finance_orderly_hooks from '@kodiak-finance/orderly-hooks';
3
+ import { CurrentEpochEstimate, EpochInfoItem, WalletRewardsItem, TWType } from '@kodiak-finance/orderly-hooks';
4
+ import * as _kodiak_finance_orderly_ui from '@kodiak-finance/orderly-ui';
5
+ import { ScaffoldProps, SideBarProps } from '@kodiak-finance/orderly-ui-scaffold';
6
+
7
+ type TitleConfig = {
8
+ title?: string | ReactNode;
9
+ subtitle?: string | ReactNode;
10
+ content?: string | ReactNode;
11
+ docOpenOptions?: {
12
+ url?: string;
13
+ target?: string;
14
+ features?: string;
15
+ };
16
+ brokerName?: string;
17
+ };
18
+
19
+ declare const Title: FC<TitleConfig>;
20
+
21
+ declare const TitleWidget: React.FC;
22
+
23
+ declare const CurEpochWidget: FC;
24
+
25
+ type RewardsTooltipProps = {
26
+ brokerName: string | undefined;
27
+ curRewards: number;
28
+ otherRewards: number;
29
+ };
30
+
31
+ declare const useCurEpochScript: () => {
32
+ epochList: _kodiak_finance_orderly_hooks.EpochInfoType;
33
+ estimate: _kodiak_finance_orderly_hooks.CurrentEpochEstimate | undefined;
34
+ hideData: boolean;
35
+ notConnected: boolean;
36
+ connect: (options?: any) => Promise<_kodiak_finance_orderly_hooks.WalletState[]>;
37
+ rewardsTooltip: RewardsTooltipProps | undefined;
38
+ statusInfo: _kodiak_finance_orderly_hooks.StatusInfo | undefined;
39
+ showEpochPauseCountdown: boolean | undefined;
40
+ };
41
+ type CurEpochReturns = ReturnType<typeof useCurEpochScript>;
42
+
43
+ declare const CurEpoch: FC<CurEpochReturns>;
44
+
45
+ declare const AvailableToClaimWidget: React.FC;
46
+
47
+ type AvailableReturns = {
48
+ order?: number;
49
+ esOrder?: number;
50
+ goToClaim?: (e: any) => void;
51
+ };
52
+
53
+ declare const AvailableToClaim: FC<AvailableReturns>;
54
+
55
+ declare const StakeBoosterWidget: React.FC;
56
+
57
+ declare const useStakeBoosterScript: () => {
58
+ curEpochEstimate: CurrentEpochEstimate | undefined;
59
+ stakeNow: (e: any) => void;
60
+ booster: string | number | undefined;
61
+ };
62
+ type StakeBoosterReturns = ReturnType<typeof useStakeBoosterScript>;
63
+
64
+ declare const StakeBooster: FC<StakeBoosterReturns>;
65
+
66
+ type ListType = EpochInfoItem & {
67
+ info?: WalletRewardsItem;
68
+ state?: string;
69
+ rewardsTooltip?: RewardsTooltipProps;
70
+ };
71
+ type RewardsHistoryReturns = ReturnType<typeof useRewardsHistoryScript>;
72
+ declare const useRewardsHistoryScript: () => {
73
+ data: ListType[];
74
+ originalData: ListType[];
75
+ pagination: _kodiak_finance_orderly_ui.PaginationMeta;
76
+ isLoading: boolean;
77
+ };
78
+
79
+ declare const RewardHistory: FC<RewardsHistoryReturns>;
80
+
81
+ declare const RewardsHistoryWidget: React.FC;
82
+
83
+ declare const TradingRewardsProvider: React.FC<PropsWithChildren<{
84
+ type?: TWType;
85
+ titleConfig?: TitleConfig;
86
+ showEpochPauseCountdown?: boolean;
87
+ }>>;
88
+
89
+ declare const HomePage: React.FC<{
90
+ titleConfig?: TitleConfig;
91
+ className?: string;
92
+ showEpochPauseCountdown?: boolean;
93
+ }>;
94
+
95
+ declare const index_AvailableToClaim: typeof AvailableToClaim;
96
+ declare const index_AvailableToClaimWidget: typeof AvailableToClaimWidget;
97
+ declare const index_CurEpoch: typeof CurEpoch;
98
+ declare const index_CurEpochWidget: typeof CurEpochWidget;
99
+ declare const index_HomePage: typeof HomePage;
100
+ declare const index_RewardHistory: typeof RewardHistory;
101
+ declare const index_RewardsHistoryWidget: typeof RewardsHistoryWidget;
102
+ declare const index_StakeBooster: typeof StakeBooster;
103
+ declare const index_StakeBoosterWidget: typeof StakeBoosterWidget;
104
+ declare const index_Title: typeof Title;
105
+ type index_TitleConfig = TitleConfig;
106
+ declare const index_TitleWidget: typeof TitleWidget;
107
+ declare const index_TradingRewardsProvider: typeof TradingRewardsProvider;
108
+ declare const index_useCurEpochScript: typeof useCurEpochScript;
109
+ declare namespace index {
110
+ export { index_AvailableToClaim as AvailableToClaim, index_AvailableToClaimWidget as AvailableToClaimWidget, index_CurEpoch as CurEpoch, index_CurEpochWidget as CurEpochWidget, index_HomePage as HomePage, index_RewardHistory as RewardHistory, index_RewardsHistoryWidget as RewardsHistoryWidget, index_StakeBooster as StakeBooster, index_StakeBoosterWidget as StakeBoosterWidget, index_Title as Title, type index_TitleConfig as TitleConfig, index_TitleWidget as TitleWidget, index_TradingRewardsProvider as TradingRewardsProvider, index_useCurEpochScript as useCurEpochScript };
111
+ }
112
+
113
+ declare const TradingRewardsLayoutWidget: FC<PropsWithChildren<ScaffoldProps>>;
114
+
115
+ type TradingRewardsLayoutProps = ScaffoldProps & {
116
+ hideSideBar?: boolean;
117
+ items?: SideBarProps["items"];
118
+ };
119
+ declare const TradingRewardsLayout: React.FC<PropsWithChildren<TradingRewardsLayoutProps>>;
120
+
121
+ declare enum TradingRewardsLeftSidebarPath {
122
+ Trading = "/rewards/trading",
123
+ Affiliate = "/rewards/affiliate"
124
+ }
125
+ declare const useTradingRewardsLayoutScript: (props: {
126
+ current?: string;
127
+ }) => SideBarProps & {
128
+ hideSideBar: boolean;
129
+ };
130
+
131
+ export { index as TradingRewards, TradingRewardsLayout, TradingRewardsLayoutWidget, TradingRewardsLeftSidebarPath, useTradingRewardsLayoutScript };
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var orderlyUi = require('@kodiak-finance/orderly-ui');
4
+ var orderlyI18n = require('@kodiak-finance/orderly-i18n');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var O = require('react');
7
+ var orderlyHooks = require('@kodiak-finance/orderly-hooks');
8
+ var orderlyReactApp = require('@kodiak-finance/orderly-react-app');
9
+ var orderlyTypes = require('@kodiak-finance/orderly-types');
10
+ var orderlyUtils = require('@kodiak-finance/orderly-utils');
11
+ var orderlyUiConnector = require('@kodiak-finance/orderly-ui-connector');
12
+ var gr = require('ramda/es/omit');
13
+ var orderlyUiScaffold = require('@kodiak-finance/orderly-ui-scaffold');
14
+
15
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
+
17
+ var O__default = /*#__PURE__*/_interopDefault(O);
18
+ var gr__default = /*#__PURE__*/_interopDefault(gr);
19
+
20
+ var Gt=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var V=(e,t)=>{for(var o in t)Gt(e,o,{get:t[o],enumerable:true});};var le,Jt,Te=c(()=>{le=e=>{let{title:t,subtitle:o,content:i,docOpenOptions:a}=e,{t:r}=orderlyI18n.useTranslation();return jsxRuntime.jsxs(orderlyUi.Flex,{id:"oui-tradingRewards-home-title",p:6,direction:"column",itemAlign:"start",gap:4,className:"oui-bg-base-9 oui-font-semibold",r:"2xl",width:"100%",children:[t||jsxRuntime.jsx(orderlyUi.Text,{size:"lg",children:r("common.tradingRewards")}),jsxRuntime.jsx(orderlyUi.Divider,{intensity:8,className:"oui-w-full"}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",itemAlign:"start",gap:1,children:[o||jsxRuntime.jsx(orderlyUi.Text,{size:"base",children:r("tradingRewards.subtitle",{brokerName:e.brokerName})}),i||jsxRuntime.jsx(Jt,{docOpenOptions:a})]})]})},Jt=e=>{let{t}=orderlyI18n.useTranslation();return jsxRuntime.jsxs("div",{className:"oui-text-sm oui-text-base-contrast-54 oui-font-normal oui-flex oui-gap-1 oui-items-center hover:oui-text-primary-darken oui-text-primary-light oui-cursor-pointer",onClick:()=>[window.open(e.docOpenOptions?.url,e.docOpenOptions?.target,e.docOpenOptions?.features)],children:[jsxRuntime.jsx("span",{className:"oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer",children:t("tradingRewards.learnMore")}),jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4.008 7.995c0-.368.298-.666.666-.666H9.71L7.733 5.331l.937-.936 3.143 3.122c.13.13.195.304.195.479a.67.67 0 0 1-.195.478L8.67 11.596l-.937-.937 1.978-1.998H4.674a.666.666 0 0 1-.666-.666"})})]})};});var it,ce,E,H=c(()=>{it=O.createContext({}),ce=e=>{let{type:t=orderlyHooks.TWType.normal,showEpochPauseCountdown:o,titleConfig:i={docOpenOptions:{url:"https://orderly.network/docs/introduction/tokenomics/trading-rewards",target:"_blank"}},children:a}=e,r=orderlyHooks.useConfig("brokerId"),{statusInfo:n}=orderlyHooks.useTradingRewardsStatus(t===orderlyHooks.TWType.mm),d=orderlyHooks.useGetClaimed(t===orderlyHooks.TWType.mm?orderlyHooks.DistributionId.mmOrder:orderlyHooks.DistributionId.order),g=orderlyHooks.useGetClaimed(t===orderlyHooks.TWType.mm?orderlyHooks.DistributionId.mmEsOrder:orderlyHooks.DistributionId.esORder),[u]=orderlyHooks.useAllBrokers(),[w]=orderlyHooks.useCurEpochEstimate(t),f=orderlyHooks.useWalletRewardsHistory(t),C=orderlyHooks.useEpochInfo(t),b=O.useMemo(()=>u?.[r],[r,u]),L=O.useMemo(()=>({type:t,totalOrderClaimedReward:d,totalEsOrderClaimedReward:g,epochList:C,curEpochEstimate:w,walletRewardsHistory:f,titleConfig:i,brokerId:r,brokerName:b,brokers:u,statusInfo:n,showEpochPauseCountdown:o??false}),[t,d,g,C,w,f,i,r,b,u,n,o]);return jsxRuntime.jsx(it.Provider,{value:L,children:a})},E=()=>O.useContext(it);});var at,st=c(()=>{H();at=()=>{let{titleConfig:e}=E();return e};});var nt={};V(nt,{TitleWidget:()=>ye});var ye,Ne=c(()=>{st();Te();ye=()=>{let e=at();return jsxRuntime.jsx(le,{...e})};});var Y,Se=c(()=>{H();Y=()=>{let{epochList:e,curEpochEstimate:t,brokerId:o,brokerName:i,statusInfo:a,showEpochPauseCountdown:r}=E(),{wrongNetwork:n,disabledConnect:d}=orderlyReactApp.useAppContext(),{connect:g}=orderlyHooks.useWalletConnector(),{state:u}=orderlyHooks.useAccount(),w=O.useMemo(()=>u.status<=orderlyTypes.AccountStatusEnum.SignedIn||n||d,[u,n,d]),f=O.useMemo(()=>u.status<=orderlyTypes.AccountStatusEnum.SignedIn||d,[u,d]),C=O.useMemo(()=>{if(typeof t>"u"||t===null)return;let b=t.rows.filter(S=>S.broker_id!==o).reduce((S,_)=>S+_.est_r_account,0),L=Number(t.est_r_wallet)-b;return {brokerName:i,curRewards:L,otherRewards:b}},[o,i,t]);return {epochList:e,estimate:t,hideData:w,notConnected:f,connect:g,rewardsTooltip:w?void 0:C,statusInfo:a,showEpochPauseCountdown:r}};});var k,K=c(()=>{k=e=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:[jsxRuntime.jsxs("g",{clipPath:"url(#clip0_862_2449)",children:[jsxRuntime.jsx("path",{d:"M10.0249 19.9361C15.5202 19.9361 19.9751 15.4813 19.9751 9.98589C19.9751 4.49052 15.5202 0.0356445 10.0249 0.0356445C4.52949 0.0356445 0.0746155 4.49052 0.0746155 9.98589C0.0746155 15.4813 4.52949 19.9361 10.0249 19.9361Z",fill:"url(#paint0_linear_862_2449)"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0992 5.0347C14.1824 5.0347 14.2202 4.93253 14.1556 4.88017C13.0272 3.96625 11.59 3.41876 10.0249 3.41876C8.4598 3.41876 7.02258 3.96625 5.89428 4.88017C5.82963 4.93253 5.86743 5.0347 5.95063 5.0347H14.0992ZM7.2658 11.6648C7.34763 11.6648 7.42329 11.707 7.47028 11.7739C8.03421 12.5781 8.96819 13.1038 10.025 13.1038C11.0817 13.1038 12.0156 12.5781 12.5796 11.7739C12.6266 11.707 12.7022 11.6648 12.7841 11.6648H16.2198C16.2985 11.6648 16.3559 11.7395 16.334 11.8151C15.5419 14.5521 13.0171 16.5531 10.0249 16.5531C7.03275 16.5531 4.50795 14.5521 3.71578 11.8151C3.6939 11.7395 3.75127 11.6648 3.83 11.6648H7.2658ZM12.335 7.8919C12.3825 7.94426 12.4493 7.97581 12.5199 7.97581H16.114C16.1955 7.97581 16.2533 7.89653 16.2264 7.81972C15.9727 7.0936 15.5951 6.42564 15.119 5.84118C15.0743 5.78631 15.007 5.75526 14.9361 5.75526H5.11354C5.04279 5.75526 4.97543 5.78631 4.93075 5.84118C4.4546 6.42564 4.07701 7.0936 3.82337 7.81972C3.79653 7.89653 3.8543 7.97581 3.93567 7.97581H7.52983C7.60053 7.97581 7.66725 7.94426 7.71477 7.8919C8.28522 7.263 9.10892 6.86807 10.0249 6.86807C10.9408 6.86807 11.7646 7.263 12.335 7.8919ZM13.028 10.8273C13.0114 10.8862 13.0549 10.9458 13.116 10.9458H16.4447C16.4894 10.9458 16.5273 10.913 16.5333 10.8688C16.572 10.5798 16.5921 10.285 16.5921 9.98539C16.5921 9.56935 16.5534 9.1623 16.4795 8.76771C16.4716 8.72551 16.4345 8.6952 16.3916 8.6952H13.0042C12.9388 8.6952 12.895 8.763 12.9195 8.82377C13.0636 9.18276 13.1429 9.57477 13.1429 9.98529C13.1429 10.277 13.1029 10.5595 13.028 10.8273ZM6.9338 10.9458C6.99492 10.9458 7.03829 10.8862 7.02183 10.8273C6.94688 10.5595 6.90682 10.277 6.90682 9.98529C6.90682 9.57477 6.98617 9.18276 7.13037 8.82377C7.15477 8.763 7.11101 8.6952 7.04553 8.6952H3.65817C3.61522 8.6952 3.5782 8.72551 3.5703 8.76771C3.49631 9.1623 3.45761 9.56935 3.45761 9.98539C3.45761 10.285 3.47767 10.5798 3.51651 10.8688C3.52246 10.913 3.56045 10.9458 3.60511 10.9458H6.9338Z",fill:"url(#paint1_linear_862_2449)"})]}),jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsxs("linearGradient",{id:"paint0_linear_862_2449",x1:"10.0249",y1:"-2.24058",x2:"10.0249",y2:"21.2774",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx("stop",{stopColor:"white"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"#EDE9F4"})]}),jsxRuntime.jsxs("linearGradient",{id:"paint1_linear_862_2449",x1:"10.0249",y1:"3.41876",x2:"10.0249",y2:"16.5531",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx("stop",{stopColor:"#C750FF"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"#5800E8"})]}),jsxRuntime.jsx("clipPath",{id:"clip0_862_2449",children:jsxRuntime.jsx("rect",{width:"20",height:"20",fill:"white"})})]})]});});var F,X=c(()=>{F=e=>jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:[jsxRuntime.jsxs("g",{clipPath:"url(#clip0_862_2443)",children:[jsxRuntime.jsx("path",{d:"M10.0249 19.9491C15.5202 19.9491 19.9751 15.4942 19.9751 9.99883C19.9751 4.50346 15.5202 0.048584 10.0249 0.048584C4.52949 0.048584 0.0746155 4.50346 0.0746155 9.99883C0.0746155 15.4942 4.52949 19.9491 10.0249 19.9491Z",fill:"url(#paint0_linear_862_2443)"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.1556 4.8931C14.2202 4.94547 14.1824 5.04764 14.0992 5.04764H5.95063C5.86743 5.04764 5.82963 4.94547 5.89428 4.8931C7.02258 3.97918 8.4598 3.4317 10.0249 3.4317C11.59 3.4317 13.0272 3.97918 14.1556 4.8931Z",fill:"white"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.47028 11.7869C7.4233 11.7199 7.34764 11.6777 7.26581 11.6777H3.83C3.75128 11.6777 3.69391 11.7525 3.71579 11.8281C4.50796 14.565 7.03275 16.566 10.0249 16.566C13.0171 16.566 15.5419 14.565 16.334 11.8281C16.3559 11.7525 16.2985 11.6777 16.2198 11.6777H12.7841C12.7022 11.6777 12.6266 11.7199 12.5796 11.7869C12.0156 12.5911 11.0817 13.1167 10.025 13.1167C8.96818 13.1167 8.03421 12.5911 7.47028 11.7869Z",fill:"white"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.335 7.90476C12.3825 7.95713 12.4493 7.98867 12.5199 7.98867H16.114C16.1955 7.98867 16.2533 7.9094 16.2264 7.83259C15.9727 7.10647 15.5951 6.43851 15.119 5.85405C15.0743 5.79918 15.007 5.76813 14.9361 5.76813H5.11354C5.04278 5.76813 4.97543 5.79918 4.93074 5.85405C4.45459 6.43851 4.07701 7.10647 3.82337 7.83259C3.79652 7.9094 3.85428 7.98867 3.93567 7.98867H7.52982C7.60052 7.98867 7.66725 7.95713 7.71475 7.90476C8.28522 7.27587 9.10892 6.88093 10.0249 6.88093C10.9408 6.88093 11.7646 7.27587 12.335 7.90476Z",fill:"white"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.116 10.9587C13.0549 10.9587 13.0114 10.8991 13.028 10.8402C13.1029 10.5723 13.1429 10.29 13.1429 9.99822C13.1429 9.5877 13.0636 9.19568 12.9195 8.83669C12.895 8.77593 12.9388 8.70813 13.0042 8.70813H16.3916C16.4345 8.70813 16.4716 8.73843 16.4795 8.78064C16.5534 9.17523 16.5921 9.58228 16.5921 9.99832C16.5921 10.2979 16.572 10.5927 16.5333 10.8816C16.5273 10.9259 16.4894 10.9587 16.4447 10.9587H13.116ZM7.02183 10.8402C7.03829 10.8991 6.99492 10.9587 6.93381 10.9587H3.60511C3.56045 10.9587 3.52246 10.9259 3.51651 10.8816C3.47767 10.5927 3.45761 10.2979 3.45761 9.99832C3.45761 9.58228 3.49631 9.17523 3.5703 8.78064C3.5782 8.73843 3.61523 8.70813 3.65817 8.70813H7.04553C7.11101 8.70813 7.15477 8.77593 7.13037 8.83669C6.98617 9.19568 6.90682 9.5877 6.90682 9.99822C6.90682 10.29 6.94688 10.5723 7.02183 10.8402Z",fill:"white"})]}),jsxRuntime.jsxs("defs",{children:[jsxRuntime.jsxs("linearGradient",{id:"paint0_linear_862_2443",x1:"10.0249",y1:"0.0486119",x2:"10.0249",y2:"19.9491",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx("stop",{stopColor:"#C750FF"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"#5800E8"})]}),jsxRuntime.jsx("clipPath",{id:"clip0_862_2443",children:jsxRuntime.jsx("rect",{width:"20",height:"20",fill:"white"})})]})]});});var j,Fe=c(()=>{j=e=>{let[t,o]=O.useState(false),{t:i}=orderlyI18n.useTranslation();return jsxRuntime.jsx(orderlyUi.Tooltip,{content:jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",className:"oui-leading-[1.5] oui-text-2xs oui-text-base-contrast-80 oui-min-w-[204px]",gap:1,children:[jsxRuntime.jsxs(orderlyUi.Flex,{gap:1,width:"100%",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-flex-1",children:e.rewardsTooltip?.brokerName}),jsxRuntime.jsx(orderlyUi.Text,{children:orderlyUtils.commifyOptional(e.rewardsTooltip?.curRewards,{fix:2})})]}),jsxRuntime.jsxs(orderlyUi.Flex,{gap:1,width:"100%",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-flex-1",children:i("tradingRewards.otherOrderlyDex")}),jsxRuntime.jsx(orderlyUi.Text,{children:orderlyUtils.commifyOptional(e.rewardsTooltip?.otherRewards,{fix:2})})]})]}),align:e.align,className:e.className,open:t,onOpenChange:o,arrow:{className:e.arrowClassName},delayDuration:100,children:e.children?O__default.default.cloneElement(e.children,{onClick:r=>{r.preventDefault(),o(!t);}}):jsxRuntime.jsx("svg",{width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"oui-cursor-pointer",onClick:r=>{r.preventDefault(),o(!t);},children:jsxRuntime.jsx("path",{d:"M10.5 1.678a8.333 8.333 0 1 0-.001 16.667 8.333 8.333 0 0 0 0-16.667m0 4.167a.833.833 0 1 1-.001 1.667.833.833 0 0 1 0-1.667m0 2.5c.46 0 .832.373.832.833v4.167a.833.833 0 0 1-1.666 0V9.178c0-.46.373-.833.833-.833",fill:"#fff",fillOpacity:".36"})})})};});var te,wo,ct,mt,pt,ho,Co,Oe=c(()=>{K();X();Fe();te=e=>{let{t}=orderlyI18n.useTranslation(),o=e,i=o.epochList?.[1].curEpochInfo,a=o.epochList?.[0],r=i?.start_time,n=i?.end_time,d=i?.epoch_id,g=i?.max_reward_amount,u=i?.epoch_token,w=i?`${i?.epoch_token}`.toLowerCase()==="order":void 0,f=O.useMemo(()=>{if(!e.showEpochPauseCountdown||!a||e.statusInfo?.epochStatus!==orderlyHooks.EpochStatus.paused)return;let b=e.statusInfo?.lastCompletedEpoch;if(b===void 0)return;let L=b+1;return a.find(_=>_.epoch_id===L)?.start_time},[e.statusInfo?.epochStatus,a]),C=O.useMemo(()=>e.statusInfo?.epochStatus===orderlyHooks.EpochStatus.paused&&f,[e.statusInfo?.epochStatus,f]);return e.statusInfo?.epochStatus!==orderlyHooks.EpochStatus.active?jsxRuntime.jsx(orderlyUi.Flex,{id:"oui-tradingRewards-home-currentEpoch",r:"2xl",className:"oui-bg-base-9 oui-font-semibold oui-p-10",width:"100%",height:"100%",direction:"column",itemAlign:"stretch",children:jsxRuntime.jsxs(orderlyUi.Flex,{gap:2,direction:"column",justify:"center",itemAlign:"center",className:"oui-size-full",children:[C?jsxRuntime.jsxs(orderlyUi.Flex,{gap:2,direction:"column",justify:"center",itemAlign:"center",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-base-contrast-54 oui-text-sm",children:t("tradingRewards.epochPauseCountdown.title")}),jsxRuntime.jsx(mt,{targetTimestamp:f,isStandalone:true})]}):jsxRuntime.jsx(orderlyUi.Flex,{className:"oui-text-base-contrast-54 oui-text-sm oui-text-center",justify:"center",itemAlign:"center",children:e.statusInfo?.epochStatus===orderlyHooks.EpochStatus.paused?t("tradingRewards.eopchStatus.pause"):t("tradingRewards.eopchStatus.ended")}),e.statusInfo?.epochStatus===orderlyHooks.EpochStatus.paused&&jsxRuntime.jsx("div",{className:orderlyUi.cn("oui-w-full",C?"oui-mt-2":"oui-mt-0"),children:jsxRuntime.jsx(Co,{})})]})}):jsxRuntime.jsxs(orderlyUi.Flex,{id:"oui-tradingRewards-home-currentEpoch",r:"2xl",className:"oui-bg-base-9 oui-font-semibold",width:"100%",height:"100%",direction:"column",itemAlign:"stretch",children:[jsxRuntime.jsx(mt,{targetTimestamp:n}),jsxRuntime.jsxs(orderlyUi.Flex,{p:6,direction:"column",gap:4,className:"oui-h-full",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:3,width:"100%",justify:"around",children:[jsxRuntime.jsx(ct,{title:t("tradingRewards.epoch"),highLight:d?`${d}`:"--",text:r&&n?`${pt(r)} - ${pt(n)}`:""}),jsxRuntime.jsx(ct,{title:t("tradingRewards.epochRewards"),highLight:orderlyUtils.commifyOptional(g,{fix:0}),text:u})]}),jsxRuntime.jsx(wo,{isOrder:w,direction:o.notConnected?"row":"column",justify:o.notConnected?"between":"center",hideData:o.hideData,estRewards:o.hideData?"--":e.estimate?.est_r_wallet,rewardsTooltip:e.rewardsTooltip,background:o.notConnected?"linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%)":"linear-gradient(0deg, #2D0061 2.62%, #BD6BED 86.5%)"}),jsxRuntime.jsx("div",{className:"oui-w-full",children:jsxRuntime.jsx(orderlyUiConnector.AuthGuard,{status:orderlyTypes.AccountStatusEnum.SignedIn,buttonProps:{fullWidth:true},children:jsxRuntime.jsx(jsxRuntime.Fragment,{})})})]})]})},wo=e=>{let{t}=orderlyI18n.useTranslation();return jsxRuntime.jsxs(orderlyUi.Flex,{direction:e.direction,gap:2,py:4,px:6,width:"100%",r:"xl",itemAlign:"center",justify:e.justify,style:{background:e.background},className:"oui-flex-1 oui-h-full",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-base xl:oui-text-lg oui-text-base-contrast-54",children:t("tradingRewards.myEstRewards")}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:3,children:[e.isOrder==true&&jsxRuntime.jsx(F,{className:"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8"}),e.isOrder==false&&jsxRuntime.jsx(k,{className:"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8"}),jsxRuntime.jsx(orderlyUi.Text,{children:orderlyUtils.commifyOptional(e.estRewards,{fix:2}),className:"oui-text-xl md:oui-text-2xl xl:oui-text-[32px]"}),e.rewardsTooltip&&jsxRuntime.jsx(j,{rewardsTooltip:e.rewardsTooltip})]})]})},ct=e=>{let{title:t,highLight:o,text:i}=e;return jsxRuntime.jsxs(orderlyUi.Flex,{py:2,justify:"between",direction:"column",className:"flex-1",gap:2,children:[jsxRuntime.jsx(orderlyUi.Text,{className:orderlyUi.cn("oui-text-base-contrast-54","oui-text-xs md:oui-text-sm xl:oui-text-base","oui-leading-[20px] xl:oui-leading-[24px]"),children:t}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,itemAlign:"end",justify:"center",children:[jsxRuntime.jsx(orderlyUi.Text.gradient,{color:"brand",angle:90,className:"oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl",children:o}),jsxRuntime.jsx(orderlyUi.Text,{intensity:80,className:"oui-mb-[3px] oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:i})]})]})},mt=e=>{let{targetTimestamp:t,isStandalone:o}=e,{t:i}=orderlyI18n.useTranslation(),[a,r]=O.useState({days:0,hours:0,minutes:0,seconds:0});O.useEffect(()=>{let d=setInterval(()=>{if(typeof t>"u")return;let g=new Date().getTime(),u=t-g;if(u<0)clearInterval(d),r({days:0,hours:0,minutes:0,seconds:0});else {let w=Math.floor(u/864e5),f=Math.floor(u%(1e3*60*60*24)/(1e3*60*60)),C=Math.floor(u%(1e3*60*60)/(1e3*60)),b=Math.floor(u%(1e3*60)/1e3);r({days:w,hours:f,minutes:C,seconds:b});}},1e3);return ()=>clearInterval(d)},[t]);let n=d=>jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg ",children:d});return jsxRuntime.jsx(orderlyUi.Box,{className:"oui-rounded-t-2xl oui-font-semibold oui-text-base-contrast-54",gradient:o?void 0:"neutral",angle:180,width:"full",children:jsxRuntime.jsxs(orderlyUi.Flex,{justify:"center",gap:1,children:[o?null:jsxRuntime.jsx("span",{children:`${i("common.countdown")}: `}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",itemAlign:"end",gap:1,className:orderlyUi.cn("oui-text-2xs md:oui-text-xs lg:oui-text-sm",o?"oui-py-0":"oui-py-[13px]"),children:[n(`${a.days}`.padStart(2,"0")),jsxRuntime.jsx("span",{children:"D"}),n(`${a.hours}`.padStart(2,"0")),jsxRuntime.jsx("span",{children:"H"}),n(`${a.minutes}`.padStart(2,"0")),jsxRuntime.jsx("span",{children:"M"}),n(`${a.seconds}`.padStart(2,"0")),jsxRuntime.jsx("span",{children:"S"})]})]})})},pt=e=>{if(!e)return "";let t=new Date(e),i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getUTCMonth()],a=t.getUTCDate();return `${i}. ${a}`},ho=e=>jsxRuntime.jsxs("svg",{width:"21",height:"20",viewBox:"0 0 21 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[jsxRuntime.jsx("mask",{id:"mask0_1997_45723",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"21",height:"20",children:jsxRuntime.jsx("rect",{x:"0.5",width:"20",height:"20",fill:"#D9D9D9"})}),jsxRuntime.jsx("g",{mask:"url(#mask0_1997_45723)",children:jsxRuntime.jsx("path",{d:"M12.0384 14.7111L11.1603 13.8073L14.343 10.6246H4.25V9.37463H14.343L11.1603 6.19192L12.0384 5.28809L16.75 9.99961L12.0384 14.7111Z"})})]}),Co=()=>{let{t:e}=orderlyI18n.useTranslation();return jsxRuntime.jsxs(orderlyUi.Flex,{gap:1,itemAlign:"center",justify:"center",className:"oui-group oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80",onClick:()=>window.open("https://x.com/OrderlyNetwork"),children:[jsxRuntime.jsx("div",{className:"oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80",children:e("tradingRewards.eopchStatus.linkDescription")}),jsxRuntime.jsx(ho,{className:"oui-text-fill-base-contrast-36 oui-fill-base-contrast-36 group-hover:oui-fill-base-contrast-80"})]})};});var Pe,xt=c(()=>{Se();Oe();Pe=()=>{let e=Y();return jsxRuntime.jsx(te,{...e})};});var gt={};V(gt,{CurEpoch:()=>te,CurEpochWidget:()=>Pe,useCurEpochScript:()=>Y});var Ie=c(()=>{xt();Oe();Se();});var bt,Rt=c(()=>{H();bt=()=>{let{totalOrderClaimedReward:e,walletRewardsHistory:t,totalEsOrderClaimedReward:o}=E(),[i]=e,[a]=o,{namespace:r}=orderlyHooks.useWalletConnector(),[n]=t,d=O.useMemo(()=>r===orderlyTypes.ChainNamespace.evm?n?.wallet_lifetime_trading_rewards_order:n?.wallet_pending_trading_rewards_order,[r,n]),g=O.useMemo(()=>r===orderlyTypes.ChainNamespace.evm?n?.wallet_lifetime_trading_rewards_escrow:n?.wallet_pending_trading_rewards_escrow,[n,r]),u=orderlyHooks.useGetEnv(),w=_=>{let $=`https://${u!==orderlyHooks.ENVType.prod?`${u}-`:""}app.orderly.network/tradingRewards`;window.open($,"_blank");},f=O.useCallback((_,$)=>{if(typeof $<"u"&&typeof _<"u"){let h=new orderlyUtils.Decimal(_).sub($).toFixed(18,orderlyUtils.Decimal.ROUND_DOWN);return Number(h)}},[]),C=O.useMemo(()=>f(d,i),[d,i,f]),b=O.useMemo(()=>f(g,a),[g,a,f]),L=orderlyReactApp.useDataTap(C),S=orderlyReactApp.useDataTap(b);return {order:L??void 0,esOrder:S??void 0,goToClaim:w}};});var ge,Le=c(()=>{ge=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M11.3275 13.9938C12.8001 13.9938 13.9941 12.7998 13.9941 11.3272V4.66049C13.9941 3.18782 12.8001 1.99382 11.3275 1.99382H4.66081C3.18814 1.99382 1.99414 3.18782 1.99414 4.66049V11.3272C1.99414 12.7998 3.18814 13.9938 4.66081 13.9938H11.3275ZM5.99414 10.6605C5.82347 10.6605 5.64548 10.6031 5.51481 10.4732C5.25481 10.2125 5.25481 9.77516 5.51481 9.51449L8.18148 6.84782L6.66081 5.32715H10.6608V9.32715L9.14014 7.80648L6.47347 10.4732C6.34347 10.6031 6.16481 10.6605 5.99414 10.6605Z"})});});var oe,yt,He=c(()=>{Le();K();X();oe=e=>{let{t}=orderlyI18n.useTranslation();return jsxRuntime.jsxs(orderlyUi.Flex,{id:"oui-tradingRewards-home-availableToClaim",p:6,r:"2xl",direction:"column",gap:4,width:"100%",className:" oui-font-semibold oui-bg-base-9 ",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",justify:"between",width:"100%",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-lg",children:t("tradingRewards.availableClaim")}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,onClick:e.goToClaim,className:"oui-cursor-pointer oui-text-primary-light",children:[jsxRuntime.jsx(orderlyUi.Text,{size:"sm",children:t("tradingRewards.claim")}),jsxRuntime.jsx(ge,{})]})]}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:3,width:"100%",children:[jsxRuntime.jsx(yt,{title:"ORDER",value:e.order}),jsxRuntime.jsx(yt,{title:"esORDER",value:e.esOrder,isEsOrder:true})]})]})},yt=e=>{let{value:t}=e;return jsxRuntime.jsxs(orderlyUi.Flex,{className:"oui-flex-1 oui-bg-base-8 oui-py-[11px]",direction:"column",gap:2,r:"xl",gradient:"neutral",angle:180,border:true,borderColor:6,children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54",children:e.title}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,children:[e.isEsOrder?jsxRuntime.jsx(k,{}):jsxRuntime.jsx(F,{}),jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-sm xl:oui-text-base",children:orderlyUtils.commifyOptional(t,{fix:2})})]})]})};});var Me,Nt=c(()=>{Rt();He();Me=()=>{let e=bt();return jsxRuntime.jsx(oe,{...e})};});var vt={};V(vt,{AvailableToClaim:()=>oe,AvailableToClaimWidget:()=>Me});var Ae=c(()=>{Nt();He();});var St,_t=c(()=>{H();St=()=>{let{curEpochEstimate:e}=E(),t=orderlyHooks.useGetEnv(),o=r=>{let n=`https://${t!==orderlyHooks.ENVType.prod?`${t}-`:""}app.orderly.network/staking`;window.open(n,"_blank");},i=orderlyReactApp.useDataTap(e),a=O.useMemo(()=>{let r=e?.est_stake_boost;if(!(typeof r>"u"||r===null))return r===0?r:new orderlyUtils.Decimal(r).div(new orderlyUtils.Decimal(10).pow(.15)).toDecimalPlaces(2,orderlyUtils.Decimal.ROUND_DOWN).toString()},[e?.est_stake_boost]);return {curEpochEstimate:i??void 0,stakeNow:o,booster:a}};});var Ft,Et=c(()=>{Ft=()=>jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M14.439 10.5672C14.0868 10.9198 13.7025 11.2403 13.3183 11.5287C13.1902 11.6248 13.1261 11.721 13.0941 11.8812C12.7739 13.1952 12.1015 14.4451 11.0448 15.5027C10.5645 15.9835 10.0522 16.3681 9.47584 16.7206C8.99553 17.009 8.41917 16.5283 8.61129 15.9835C8.93149 15.1502 9.05957 14.2528 9.05957 13.3234C8.99553 13.3234 8.89947 13.3555 8.83543 13.3555C8.06695 12.7145 7.3625 12.0415 6.65805 11.3364C5.95361 10.6313 5.28118 9.89421 4.64078 9.15708C4.64078 9.09299 4.6728 8.99684 4.6728 8.93274C3.74421 8.93274 2.84764 9.09299 2.01512 9.38143C1.50279 9.57372 0.990469 8.99684 1.27865 8.51611C1.63087 7.93923 2.01512 7.42645 2.49542 6.94572C3.55209 5.88811 4.80088 5.21508 6.11371 4.89459C6.24179 4.86255 6.36987 4.7664 6.46593 4.67025C6.75412 4.25362 7.07432 3.90108 7.42654 3.54855C9.92412 1.04874 13.4143 0.183422 16.6484 0.920545C16.8725 0.984642 17.0326 1.14489 17.0967 1.36923C17.8011 4.57411 16.9366 8.06742 14.439 10.5672ZM13.0301 4.95869C12.2616 4.18952 10.9808 4.18952 10.2123 4.95869C9.44382 5.72786 9.44382 7.00982 10.2123 7.77899C10.9808 8.54816 12.2616 8.54816 13.0301 7.77899C13.8306 6.97777 13.8306 5.72786 13.0301 4.95869ZM5.88957 14.7656C5.28118 15.3745 1.53481 17.9385 0.798348 17.2013C0.0618817 16.4642 2.6235 12.7145 3.23189 12.1056C3.84027 11.4966 4.92896 11.5928 5.66543 12.3299C6.40189 13.067 6.49795 14.1567 5.88957 14.7656Z",fill:"url(#paint0_linear_88_1748)"}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"paint0_linear_88_1748",x1:"17.3331",y1:"8.99996",x2:"0.666504",y2:"8.99996",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx("stop",{stopColor:"rgb(var(--oui-gradient-brand-end))"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"rgb(var(--oui-gradient-brand-start))"})]})})]});});var ie,Ot,Be=c(()=>{Le();K();X();Et();ie=e=>{let{t}=orderlyI18n.useTranslation();return jsxRuntime.jsxs(orderlyUi.Flex,{id:"oui-tradingRewards-home-stakeBooster",p:6,r:"2xl",direction:"column",gap:4,width:"100%",className:" oui-font-semibold oui-bg-base-9 ",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",justify:"between",width:"100%",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-lg",children:t("tradingRewards.stakeBooster")}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,onClick:e.stakeNow,className:"oui-cursor-pointer oui-text-primary-light",children:[jsxRuntime.jsx(orderlyUi.Text,{size:"sm",children:t("tradingRewards.stake")}),jsxRuntime.jsx(ge,{})]})]}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:3,width:"100%",children:[jsxRuntime.jsx(Ot,{title:t("tradingRewards.avgStakedAmount"),value:e.curEpochEstimate?.est_avg_stake,icon:jsxRuntime.jsxs("div",{className:"oui-flex oui-w-[32px] oui-h-[20px] oui-relative",children:[jsxRuntime.jsx("div",{className:"oui-absolute oui-right-0 oui-top-0",children:jsxRuntime.jsx(k,{})}),jsxRuntime.jsx("div",{className:"oui-absolute oui-left-0 oui-top-0 ",children:jsxRuntime.jsx(F,{})})]})}),jsxRuntime.jsx(Ot,{title:t("tradingRewards.booster"),value:e.booster,icon:jsxRuntime.jsx(Ft,{}),gradient:true})]})]})},Ot=e=>{let t=orderlyUtils.commify(e.value||"--",2);return jsxRuntime.jsxs(orderlyUi.Flex,{className:"oui-flex-1 oui-bg-base-8 oui-py-[11px]",direction:"column",gap:2,r:"xl",gradient:"neutral",angle:180,border:true,borderColor:6,children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54",children:e.title}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,children:[e.icon,e.gradient?jsxRuntime.jsx(orderlyUi.Text.gradient,{className:"oui-text-sm xl:oui-text-base",color:"brand",angle:90,children:t+(t==="--"?"":"x")}):jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-sm xl:oui-text-base",children:orderlyUtils.commifyOptional(e.value,{fix:2})})]})]})};});var We,Pt=c(()=>{_t();Be();We=()=>{let e=St();return jsxRuntime.jsx(ie,{...e})};});var It={};V(It,{StakeBooster:()=>ie,StakeBoosterWidget:()=>We});var ze=c(()=>{Pt();Be();});function A(e){if(typeof e>"u")return {firstPart:"-",secondPart:""};let t=new Date(e),i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getUTCMonth()],a=t.getUTCDate().toString().padStart(2,"0"),r=t.getUTCFullYear(),n=t.getUTCHours(),d=t.getUTCMinutes(),g=n>=12?"PM":"AM",u=(n%12).toString().padStart(2,"0"),w=d.toString().padStart(2,"0");return {firstPart:`${i} ${a}, ${r}`,secondPart:`${u}:${w} ${g}`}}var ae,Uo,Go,Zo,Ve=c(()=>{K();X();Fe();ae=e=>{let{t}=orderlyI18n.useTranslation();return jsxRuntime.jsxs(orderlyUi.Flex,{id:"oui-tradingRewards-home-rewardHistory",py:4,px:3,direction:"column",gap:2,itemAlign:"start",r:"2xl",className:"oui-bg-base-9 oui-w-full oui-font-semibold oui-tabular-nums",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-lg oui-px-3",children:t("tradingRewards.rewardHistory")}),jsxRuntime.jsx("div",{className:"oui-border-t-2 oui-border-line-4 oui-w-full",children:jsxRuntime.jsx(Uo,{...e})})]})},Uo=e=>orderlyHooks.useMediaQuery("(max-width: 767px)")?jsxRuntime.jsx(orderlyUi.ListView,{dataSource:e.originalData,renderItem:(o,i)=>jsxRuntime.jsx(Go,{data:o}),className:"oui-mt-3 oui-max-h-[356px]"}):jsxRuntime.jsx(orderlyUi.Box,{px:3,children:jsxRuntime.jsx(Zo,{...e})}),Go=e=>{let{data:t}=e,{t:o}=orderlyI18n.useTranslation(),i=`${t?.info?.epoch_token||t.epoch_token}`.toLowerCase()==="order",a=orderlyUtils.commifyOptional(t.info?.r_wallet,{fix:2});return jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",px:4,pt:0,gap:3,className:"oui-text-base-contrast-80",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",width:"100%",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.epoch")}),jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-sm",children:`Epoch ${t.epoch_id}`})]}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsxRuntime.jsxs(orderlyUi.Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:[o("tradingRewards.epochRewards")," "]}),jsxRuntime.jsxs(orderlyUi.Flex,{gap:1,children:[i?jsxRuntime.jsx(F,{}):jsxRuntime.jsx(k,{}),jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-sm",children:orderlyUtils.commifyOptional(t.max_reward_amount,{fix:2})})]})]}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"end",children:[jsxRuntime.jsxs(orderlyUi.Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:[o("tradingRewards.rewardsEarned")," "]}),jsxRuntime.jsxs(orderlyUi.Flex,{gap:1,children:[a!=="--"&&(i?jsxRuntime.jsx(F,{}):jsxRuntime.jsx(k,{})),t.rewardsTooltip?jsxRuntime.jsx(j,{rewardsTooltip:t.rewardsTooltip,children:jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-sm oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16",children:a}),align:"center",className:"oui-bg-base-5",arrowClassName:"oui-fill-base-5"}):jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-sm",children:a})]})]})]}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",width:"100%",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.rewardHistory.column.startDate")}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",children:[jsxRuntime.jsxs(orderlyUi.Text,{className:"oui-text-sm",children:[A(t.start_time).firstPart,"\xA0"]}),jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-2xs oui-text-base-contrast-36",children:A(t.start_time).secondPart})]})]}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"end",children:[jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.rewardHistory.column.endDate")}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",children:[jsxRuntime.jsxs(orderlyUi.Text,{className:"oui-text-sm",children:[A(t.end_time).firstPart,"\xA0"]}),jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-2xs oui-text-base-contrast-36",children:A(t.end_time).secondPart})]})]})]}),jsxRuntime.jsx(orderlyUi.Divider,{className:"oui-w-full"})]},t.epoch_id)},Zo=e=>{let{data:t}=e,{t:o}=orderlyI18n.useTranslation(),i=[{title:o("tradingRewards.epoch"),dataIndex:"epoch_id",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:a=>jsxRuntime.jsx(orderlyUi.Text,{children:`${o("tradingRewards.epoch")} ${a}`})},{title:o("tradingRewards.rewardHistory.column.start&EndDate"),dataIndex:"time",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>jsxRuntime.jsxs(orderlyUi.Flex,{direction:"column",className:"oui-gap-[2px]",justify:"start",itemAlign:"start",children:[jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,children:[jsxRuntime.jsx(orderlyUi.Text,{children:A(r.start_time).firstPart}),jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-base-contrast-54",children:A(r.start_time).secondPart})]}),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,children:[jsxRuntime.jsx(orderlyUi.Text,{children:A(r.end_time).firstPart}),jsxRuntime.jsx(orderlyUi.Text,{className:"oui-text-base-contrast-54",children:A(r.end_time).secondPart})]})]})},{title:o("tradingRewards.epochRewards"),dataIndex:"max_reward_amount",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>{let n=`${r?.info?.epoch_token||r.epoch_token}`.toLowerCase()==="order";return jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,children:[n?jsxRuntime.jsx(F,{}):jsxRuntime.jsx(k,{}),jsxRuntime.jsx(orderlyUi.Text,{children:orderlyUtils.commifyOptional(a)})]})}},{title:o("tradingRewards.rewardsEarned"),dataIndex:"earned",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>{let n=`${r?.info?.epoch_token||r.epoch_token}`.toLowerCase()==="order",d=jsxRuntime.jsx(orderlyUi.Text,{className:r.rewardsTooltip?"oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16":"",children:orderlyUtils.commifyOptional(r.info?.r_wallet,{fix:2})});return r.rewardsTooltip&&(d=jsxRuntime.jsx(j,{rewardsTooltip:r.rewardsTooltip,children:d,align:"center",className:"oui-bg-base-5",arrowClassName:"oui-fill-base-5"})),jsxRuntime.jsxs(orderlyUi.Flex,{direction:"row",gap:1,children:[n?jsxRuntime.jsx(F,{}):jsxRuntime.jsx(k,{}),d]})}}];return jsxRuntime.jsx(orderlyUi.DataTable,{bordered:true,columns:i,loading:e.isLoading,dataSource:t,emptyView:jsxRuntime.jsx(orderlyUiConnector.AuthGuardEmpty,{status:orderlyTypes.AccountStatusEnum.SignedIn}),onRow:a=>({className:"oui-h-[59px]"}),pagination:e.pagination})};});var Lt,Ht=c(()=>{H();Lt=()=>{let{account:e}=orderlyHooks.useAccount(),{epochList:t,walletRewardsHistory:o,totalOrderClaimedReward:i,brokerId:a,brokerName:r}=E(),n=t?.[0],{isNotStared:d}=t?.[1],[g]=o,{wrongNetwork:u,disabledConnect:w}=orderlyReactApp.useAppContext(),{data:f}=orderlyHooks.useAccountRewardsHistory(e.address),C=O.useMemo(()=>{if(d||w)return [];let S=[...n||[]].map(h=>{let R=h.epoch_id,Q=g?.rows.findIndex(se=>R===se.epoch_id),qe;if(Q!==-1&&!u){let se=g?.rows?.[Q],be=f?.findIndex(ne=>ne?.epoch_id===h.epoch_id);if(f!==void 0&&be!==void 0&&be!==-1){let ne=f[be].broker,Ke=ne.findIndex(Ut=>Ut.broker_id===a),Xe=(Ke!==-1?ne[Ke]:void 0)?.r_account??0,Vt=Math.max(0,(se?.r_wallet??0)-Xe);qe={brokerName:r,curRewards:Xe,otherRewards:Vt};}return {...h,info:se,rewardsTooltip:qe}}return {...h}});S.sort((h,R)=>h.epoch_id-R.epoch_id);let[_]=i;if(typeof _<"u")for(let h=0;h<S.length;h++){let R=S[h];if(typeof R?.info>"u"){R.state="Null";continue}let Q=R.info?.reward_status;Q==="Confirmed"?(_-R.info?.r_wallet>=0?R.state="Claimed":R.state="Claimable",_-=R.info?.r_wallet):Q==="Pending"&&(R.state="Processing");}S.sort((h,R)=>R.epoch_id-h.epoch_id);let $=orderlyUtils.getTimestamp();return S.filter(h=>h.end_time<=$)},[g,n,i,d,u,f,w]),{pagination:b}=orderlyUi.usePagination();return {data:C,originalData:C,pagination:b,isLoading:t[1].isLoading}};});var Ue,Mt=c(()=>{Ht();Ve();Ue=()=>{let e=Lt();return jsxRuntime.jsx(ae,{...e})};});var At={};V(At,{RewardHistory:()=>ae,RewardsHistoryWidget:()=>Ue});var Ge=c(()=>{Ve();Mt();});var Bt={};V(Bt,{AvailableToClaim:()=>oe,AvailableToClaimWidget:()=>Me,CurEpoch:()=>te,CurEpochWidget:()=>Pe,HomePage:()=>Dt,RewardHistory:()=>ae,RewardsHistoryWidget:()=>Ue,StakeBooster:()=>ie,StakeBoosterWidget:()=>We,Title:()=>le,TitleWidget:()=>ye,TradingRewardsProvider:()=>ce,useCurEpochScript:()=>Y});Te();Ne();Ie();Ae();ze();Ge();H();H();var ar=O__default.default.lazy(()=>Promise.resolve().then(()=>(Ne(),nt)).then(e=>({default:e.TitleWidget}))),sr=O__default.default.lazy(()=>Promise.resolve().then(()=>(Ie(),gt)).then(e=>({default:e.CurEpochWidget}))),nr=O__default.default.lazy(()=>Promise.resolve().then(()=>(Ae(),vt)).then(e=>({default:e.AvailableToClaimWidget}))),lr=O__default.default.lazy(()=>Promise.resolve().then(()=>(ze(),It)).then(e=>({default:e.StakeBoosterWidget}))),dr=O__default.default.lazy(()=>Promise.resolve().then(()=>(Ge(),At)).then(e=>({default:e.RewardsHistoryWidget}))),ur=()=>{let{statusInfo:e}=orderlyHooks.useTradingRewardsStatus(false);return O.useMemo(()=>e?.epochStatus===orderlyHooks.EpochStatus.active,[e?.epochStatus])?jsxRuntime.jsx(O__default.default.Suspense,{fallback:null,children:jsxRuntime.jsx(lr,{})}):null},Dt=e=>jsxRuntime.jsx(ce,{titleConfig:e.titleConfig,showEpochPauseCountdown:e.showEpochPauseCountdown,children:jsxRuntime.jsxs(orderlyUi.Flex,{id:"oui-tradingRewards-home-page",className:orderlyUi.cn("oui-h-lvw oui-w-full",e.className),direction:"column",gap:4,children:[jsxRuntime.jsx(O__default.default.Suspense,{fallback:null,children:jsxRuntime.jsx(ar,{})}),jsxRuntime.jsxs(orderlyUi.Flex,{className:"oui-flex oui-size-full oui-flex-col oui-gap-4 2xl:oui-flex-row 2xl:oui-items-stretch",children:[jsxRuntime.jsx(orderlyUi.Box,{className:"oui-w-full 2xl:oui-size-auto 2xl:oui-flex-1",children:jsxRuntime.jsx(O__default.default.Suspense,{fallback:null,children:jsxRuntime.jsx(sr,{})})}),jsxRuntime.jsxs(orderlyUi.Flex,{className:"oui-flex oui-w-full oui-flex-col oui-gap-4 lg:oui-flex-row 2xl:oui-flex-1 2xl:oui-flex-col",children:[jsxRuntime.jsx(O__default.default.Suspense,{fallback:null,children:jsxRuntime.jsx(nr,{})}),jsxRuntime.jsx(ur,{})]})]}),jsxRuntime.jsx(O__default.default.Suspense,{fallback:null,children:jsxRuntime.jsx(dr,{})})]})});var zt=(o=>(o.Trading="/rewards/trading",o.Affiliate="/rewards/affiliate",o))(zt||{}),Qe=e=>{let{t}=orderlyI18n.useTranslation(),[o,i]=O.useState(e.current||"/rewards/affiliate");O.useEffect(()=>{e.current&&i(e.current);},[e.current]);let a=O.useMemo(()=>[{name:t("common.trading"),href:"/rewards/trading",icon:jsxRuntime.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M4.883 1.5c-.166.01-.393.076-.515.173a2 2 0 0 0-.18.173L.918 6.553a.86.86 0 0 0-.168.475c0 .339.232.543.232.543l7.374 8.633c.005.006.269.301.644.296s.64-.29.644-.296l7.402-8.663s.204-.269.204-.513-.196-.517-.196-.517L13.82 1.848c-.023-.032-.076-.021-.103-.049-.033-.038-.037-.091-.077-.124-.123-.097-.267-.106-.413-.123-.04-.005-.063-.049-.103-.049h-.078zm1.745 1.582h4.744L9 5.795zm-1.675.542 2.294 2.615H3.122zm8.094 0 1.831 2.615h-4.125zM3.328 7.818h4.847v5.672zm6.497 0h4.847c-1.151 1.345-3.422 4.007-4.847 5.672z",className:"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"}),jsxRuntime.jsx("defs",{children:jsxRuntime.jsxs("linearGradient",{id:"a",x1:"17.25",y1:"9",x2:".75",y2:"9",gradientUnits:"userSpaceOnUse",children:[jsxRuntime.jsx("stop",{stopColor:"rgb(var(--oui-gradient-brand-end))"}),jsxRuntime.jsx("stop",{offset:"1",stopColor:"rgb(var(--oui-gradient-brand-start))"})]})})]})},{name:t("common.affiliate"),href:"/rewards/affiliate",icon:jsxRuntime.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.625 4.95c0-.746.604-1.35 1.35-1.35h4.05c.746 0 1.35.604 1.35 1.35v4.62L9 12.195 5.625 9.57zm8.624 3.163-.524.407v-.96l.074.05c.193.128.346.302.45.502m-4.42 5.148L14.4 9.705v3.345a1.35 1.35 0 0 1-1.35 1.35h-8.1a1.35 1.35 0 0 1-1.35-1.35V9.705l4.571 3.556c.488.379 1.17.379 1.658 0M4.275 8.52l-.524-.407c.104-.2.257-.374.45-.503l.074-.049zm0-2.581V4.95a2.7 2.7 0 0 1 2.7-2.7h4.05a2.7 2.7 0 0 1 2.7 2.7v.989l.823.548a2.7 2.7 0 0 1 1.202 2.247v4.316a2.7 2.7 0 0 1-2.7 2.7h-8.1a2.7 2.7 0 0 1-2.7-2.7V8.734a2.7 2.7 0 0 1 1.202-2.247zM9 6.089l.111-.118.005-.005a1.08 1.08 0 0 1 1.58.004 1.223 1.223 0 0 1 0 1.668l-1.515 1.62-.004.004c-.1.102-.26.1-.358-.004l-1.516-1.62a1.223 1.223 0 0 1 0-1.668l.004-.004a1.08 1.08 0 0 1 1.58.004z",className:"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"})})}],[t]),r=orderlyHooks.useMediaQuery("(max-width: 768px)");return {items:a,current:o,hideSideBar:r,onItemSelect:n=>{i(n.href);}}};var Ye=e=>{let{children:t,classNames:o,...i}=e;return jsxRuntime.jsx(orderlyUiScaffold.Scaffold,{leftSidebar:null,routerAdapter:e.routerAdapter,classNames:{...o,content:o?.content,topNavbar:orderlyUi.cn("oui-bg-base-9",o?.topNavbar),leftSidebar:orderlyUi.cn("oui-rounded-xl oui-bg-base-9","oui-m-3 oui-p-4","oui-border oui-border-line",o?.leftSidebar)},...gr__default.default(["leftSideProps"],i),children:t})};var Cr=e=>{let t=Qe({current:e.leftSideProps?.current});return jsxRuntime.jsx(Ye,{...t,...e,children:e.children})};
21
+
22
+ exports.TradingRewards = Bt;
23
+ exports.TradingRewardsLayout = Ye;
24
+ exports.TradingRewardsLayoutWidget = Cr;
25
+ exports.TradingRewardsLeftSidebarPath = zt;
26
+ exports.useTradingRewardsLayoutScript = Qe;
27
+ //# sourceMappingURL=out.js.map
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pages/index/title/title.ui.tsx","../src/pages/index/provider.tsx","../src/pages/index/title/title.script.tsx","../src/pages/index/title/title.widget.tsx","../src/pages/index/curEpoch/curEpoch.script.tsx","../src/pages/index/components/esOrderlyIcon.tsx","../src/pages/index/components/orderlyIcon.tsx","../src/pages/index/curEpoch/rewardsTooltip.tsx","../src/pages/index/curEpoch/curEpoch.ui.tsx","../src/pages/index/curEpoch/curEpoch.widget.tsx","../src/pages/index/curEpoch/index.ts","../src/pages/index/availableToClaim/availableToClaim.script.tsx","../src/pages/index/components/jumpIcon.tsx","../src/pages/index/availableToClaim/availableToClaim.ui.tsx","../src/pages/index/availableToClaim/availableToClaim.widget.tsx","../src/pages/index/availableToClaim/index.ts","../src/pages/index/stakeBooster/stakeBooster.script.tsx","../src/pages/index/components/rocket.tsx","../src/pages/index/stakeBooster/stakeBooster.ui.tsx","../src/pages/index/stakeBooster/stakeBooster.widget.tsx","../src/pages/index/stakeBooster/index.ts","../src/pages/index/rewardHistory/rewardsHistory.ui.tsx","../src/pages/index/rewardHistory/rewardsHistory.script.tsx","../src/pages/index/rewardHistory/rewardsHistory.widget.tsx","../src/pages/index/rewardHistory/index.ts","../src/pages/index/index.tsx","../src/pages/index/title/index.ts","../src/pages/index/page.tsx","../src/layout/layout.script.tsx","../src/layout/layout.ui.tsx","../src/layout/layout.widget.tsx"],"names":["Divider","Flex","Text","useTranslation","jsx","jsxs","Title","MultiLineText","init_title_ui","__esmMin","props","title","subtitle","content","docOpenOptions","t","createContext","useContext","useMemo","TWType","useEpochInfo","useAllBrokers","useGetClaimed","DistributionId","useCurEpochEstimate","useWalletRewardsHistory","useConfig","useTradingRewardsStatus","TradingRewardsContext","TradingRewardsProvider","useTradingRewardsContext","init_provider","type","showEpochPauseCountdown","titleConfig","children","brokerId","statusInfo","totalOrderClaimedReward","totalEsOrderClaimedReward","brokers","curEpochEstimate","walletRewardsHistory","epochList","brokerName","memoizedValue","useTitleScript","init_title_script","title_widget_exports","__export","TitleWidget","init_title_widget","state","useAccount","useWalletConnector","useAppContext","AccountStatusEnum","useCurEpochScript","init_curEpoch_script","estimate","wrongNetwork","disabledConnect","connect","hideData","notConnected","rewardsTooltip","otherRewards","item","a","b","curRewards","EsOrderlyIcon","init_esOrderlyIcon","OrderlyIcon","init_orderlyIcon","React","useState","Tooltip","commifyOptional","RewardsTooltip","init_rewardsTooltip","open","setOpen","e","useEffect","EpochStatus","Box","cn","AuthGuard","Fragment","CurEpoch","EstRewards","Statics","Countdown","getDate","ArrowRightIcon","TwitterLInk","init_curEpoch_ui","curEpochInfo","startTime","endTime","curEpochId","max_reward_amount","token","isOrder","pausedEpochTimeDown","lastCompletedEpoch","nextEpoch","showPauseCountdown","highLight","text","targetTimestamp","isStandalone","timeLeft","setTimeLeft","intervalId","now","distance","days","hours","minutes","seconds","num","value","timestamp","date","month","day","CurEpochWidget","init_curEpoch_widget","curEpoch_exports","init_curEpoch","useCallback","useDataTap","Decimal","ChainNamespace","ENVType","useGetEnv","useAvailableScript","init_availableToClaim_script","orderClaimedRewardData","esOrderClaimedRewardData","namespace","data","lifetimeOrderReward","lifetimeEsOrderReward","env","goToClaim","url","calculateRemainingReward","totalReward","claimedReward","remainingReward","availableOrder","availableEsOrder","orderValue","esorderValue","JumpIcon","init_jumpIcon","AvailableToClaim","init_availableToClaim_ui","AvailableToClaimWidget","init_availableToClaim_widget","availableToClaim_exports","init_availableToClaim","useStakeBoosterScript","init_stakeBooster_script","stakeNow","estimateValue","booster","estStakeBoost","RocketIcon","init_rocket","commify","StakeBooster","init_stakeBooster_ui","calcValue","StakeBoosterWidget","init_stakeBooster_widget","stakeBooster_exports","init_stakeBooster","ListView","DataTable","useMediaQuery","AuthGuardEmpty","formatTimestamp","year","amPm","formattedHours","formattedMinutes","RewardHistory","List","MobileCell","DesktopList","init_rewardsHistory_ui","index","r_warret","columns","record","useAccountRewardsHistory","usePagination","getTimestamp","useRewardsHistoryScript","init_rewardsHistory_script","account","epochInfos","isNotStared","history","accountHistory","combineData","id","info","_findIndex","brokerList","curBrokerIndex","i","element","status","curDate","pagination","RewardsHistoryWidget","init_rewardsHistory_widget","rewardHistory_exports","init_rewardHistory","index_exports","HomePage","LazyTitleWidget","mod","LazyCurEpochWidget","LazyAvailableToClaimWidget","LazyStakeBoosterWidget","LazyRewardsHistoryWidget","TradingRewardsLeftSidebarPath","useTradingRewardsLayoutScript","current","setCurrent","items","hideSideBar","omit","Scaffold","TradingRewardsLayout","classNames","rest","TradingRewardsLayoutWidget"],"mappings":"+HAAA,OAAS,WAAAA,GAAS,QAAAC,GAAM,QAAAC,OAAY,6BAGpC,OAAS,kBAAAC,OAAsB,+BAiBf,cAAAC,EAEV,QAAAC,OAFU,oBApBhB,IAKaC,GAgCPC,GArCNC,GAAAC,EAAA,kBAKaH,GAA0BI,GAAU,CAC/C,GAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,QAAAC,EAAS,eAAAC,CAAe,EAAIJ,EAC/C,CAAE,EAAAK,CAAE,EAAIZ,GAAe,EAE7B,OACEE,GAACJ,GAAA,CACC,GAAG,gCACH,EAAG,EACH,UAAW,SACX,UAAW,QACX,IAAK,EACL,UAAU,kCACV,EAAG,MACH,MAAO,OAEN,UAAAU,GAASP,EAACF,GAAA,CAAK,KAAK,KAAM,SAAAa,EAAE,uBAAuB,EAAE,EACtDX,EAACJ,GAAA,CAAQ,UAAW,EAAG,UAAU,aAAa,EAC9CK,GAACJ,GAAA,CAAK,UAAW,SAAU,UAAW,QAAS,IAAK,EACjD,UAAAW,GACCR,EAACF,GAAA,CAAK,KAAK,OACR,SAAAa,EAAE,0BAA2B,CAC5B,WAAYL,EAAM,UACpB,CAAC,EACH,EAGDG,GAAWT,EAACG,GAAA,CAAc,eAAgBO,EAAgB,GAC7D,GACF,CAEJ,EAEMP,GAMAG,GAAU,CACd,GAAM,CAAE,CAAE,EAAIP,GAAe,EAgC7B,OACEE,GAAC,OACC,UAAU,oKACV,QAAS,IAAM,CACb,OAAO,KACLK,EAAM,gBAAgB,IACtBA,EAAM,gBAAgB,OAC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,MAAAqD,EACA,QAAAF,EACA,YAAAG,EAKA,aAAe1K,GAAS,CAEtBwK,EAAWxK,EAAK,IAAI,CACtB,CACF,CACF,EChGA,OAAO2K,OAAU,gBACjB,OAAS,MAAAvJ,OAAU,6BACnB,OAAS,YAAAwJ,OAA8B,sCAanC,cAAA3O,OAAA,oBALG,IAAM4O,GAERtO,GAAU,CACb,GAAM,CAAE,SAAAyB,EAAU,WAAA8M,EAAY,GAAGC,CAAK,EAAIxO,EAC1C,OACEN,GAAC2O,GAAA,CACC,YAAa,KACb,cAAerO,EAAM,cACrB,WAAY,CACV,GAAGuO,EACH,QAASA,GAAY,QACrB,UAAW1J,GAAG,gBAAiB0J,GAAY,SAAS,EACpD,YAAa1J,GACX,+BACA,kBACA,6BACA0J,GAAY,WACd,CACF,EACC,GAAGH,GAAK,CAAC,eAAe,EAAGI,CAAI,EAE/B,SAAA/M,EACH,CAEJ,ECvBI,cAAA/B,OAAA,oBAPG,IAAM+O,GAERzO,GAAU,CACb,IAAM0C,EAAQqL,GAA8B,CAC1C,QAAS/N,EAAM,eAAe,OAChC,CAAC,EACD,OACEN,GAAC4O,GAAA,CAAsB,GAAG5L,EAAQ,GAAG1C,EAClC,SAAAA,EAAM,SACT,CAEJ","sourcesContent":["import { Divider, Flex, Text } from \"@kodiak-finance/orderly-ui\";\nimport { FC } from \"react\";\nimport { TitleConfig } from \"./title.script\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const Title: FC<TitleConfig> = (props) => {\n const { title, subtitle, content, docOpenOptions } = props;\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-title\"\n p={6}\n direction={\"column\"}\n itemAlign={\"start\"}\n gap={4}\n className=\"oui-bg-base-9 oui-font-semibold\"\n r={\"2xl\"}\n width={\"100%\"}\n >\n {title || <Text size=\"lg\">{t(\"common.tradingRewards\")}</Text>}\n <Divider intensity={8} className=\"oui-w-full\" />\n <Flex direction={\"column\"} itemAlign={\"start\"} gap={1}>\n {subtitle || (\n <Text size=\"base\">\n {t(\"tradingRewards.subtitle\", {\n brokerName: props.brokerName,\n })}\n </Text>\n )}\n\n {content || <MultiLineText docOpenOptions={docOpenOptions} />}\n </Flex>\n </Flex>\n );\n};\n\nconst MultiLineText: FC<{\n docOpenOptions?: {\n url?: string;\n target?: string;\n features?: string;\n };\n}> = (props) => {\n const { t } = useTranslation();\n\n // const clickableParts = [\n // {\n // content: \"Learn more here\",\n // isLink: true,\n // },\n // // {\n // // content: \"about Orderly Trading rewards Program.\",\n // // isLink: false,\n // // },\n // // {\n // // content: \"Trading rewards Docs\",\n // // isLink: true,\n // // },\n // ];\n // const renderText = () => {\n // return clickableParts.map((item, index) => {\n // return (\n // <span\n // key={index}\n // className={`${\n // item.isLink\n // ? \"oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer\"\n // : \"\"\n // }`}\n // dangerouslySetInnerHTML={{ __html: item.content }}\n // />\n // );\n // });\n // };\n\n return (\n <div\n className=\"oui-text-sm oui-text-base-contrast-54 oui-font-normal oui-flex oui-gap-1 oui-items-center hover:oui-text-primary-darken oui-text-primary-light oui-cursor-pointer\"\n onClick={() => [\n window.open(\n props.docOpenOptions?.url,\n props.docOpenOptions?.target,\n props.docOpenOptions?.features\n ),\n ]}\n >\n <span className=\"oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer\">\n {t(\"tradingRewards.learnMore\")}\n </span>\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M4.008 7.995c0-.368.298-.666.666-.666H9.71L7.733 5.331l.937-.936 3.143 3.122c.13.13.195.304.195.479a.67.67 0 0 1-.195.478L8.67 11.596l-.937-.937 1.978-1.998H4.674a.666.666 0 0 1-.666-.666\" />\n </svg>\n </div>\n );\n};\n\nexport default MultiLineText;\n","import React, {\n PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n} from \"react\";\nimport {\n TWType,\n EpochInfoType,\n useEpochInfo,\n useAllBrokers,\n useGetClaimed,\n DistributionId,\n useCurEpochEstimate,\n CurrentEpochEstimate,\n useWalletRewardsHistory,\n WalletRewardsHistoryReturns,\n Brokers,\n useConfig,\n useTradingRewardsStatus,\n StatusInfo,\n} from \"@kodiak-finance/orderly-hooks\";\nimport type { TitleConfig } from \"./title/title.script\";\n\nexport type TradingRewardsState = {\n type: TWType;\n brokerId: string;\n brokerName?: string;\n brokers?: Brokers;\n epochList: EpochInfoType;\n totalOrderClaimedReward: [number | undefined, { refresh: () => void }];\n totalEsOrderClaimedReward: [number | undefined, { refresh: () => void }];\n curEpochEstimate?: CurrentEpochEstimate;\n walletRewardsHistory: WalletRewardsHistoryReturns;\n titleConfig: TitleConfig;\n statusInfo: StatusInfo | undefined;\n showEpochPauseCountdown?: boolean;\n};\n\nexport const TradingRewardsContext = createContext<TradingRewardsState>(\n {} as TradingRewardsState,\n);\n\nexport const TradingRewardsProvider: React.FC<\n PropsWithChildren<{\n type?: TWType;\n titleConfig?: TitleConfig;\n showEpochPauseCountdown?: boolean;\n }>\n> = (props) => {\n const {\n type = TWType.normal,\n showEpochPauseCountdown,\n titleConfig = {\n docOpenOptions: {\n url: \"https://orderly.network/docs/introduction/tokenomics/trading-rewards\",\n target: \"_blank\",\n },\n },\n children,\n } = props;\n\n const brokerId = useConfig(\"brokerId\");\n\n const { statusInfo } = useTradingRewardsStatus(type === TWType.mm);\n const totalOrderClaimedReward = useGetClaimed(\n type === TWType.mm ? DistributionId.mmOrder : DistributionId.order,\n );\n const totalEsOrderClaimedReward = useGetClaimed(\n type === TWType.mm ? DistributionId.mmEsOrder : DistributionId.esORder,\n );\n\n const [brokers] = useAllBrokers();\n\n const [curEpochEstimate] = useCurEpochEstimate(type);\n\n const walletRewardsHistory = useWalletRewardsHistory(type);\n\n const epochList = useEpochInfo(type);\n\n const brokerName = useMemo(() => {\n return brokers?.[brokerId];\n }, [brokerId, brokers]);\n\n const memoizedValue = useMemo<TradingRewardsState>(() => {\n return {\n type: type,\n totalOrderClaimedReward,\n totalEsOrderClaimedReward,\n epochList,\n curEpochEstimate,\n walletRewardsHistory,\n titleConfig,\n brokerId,\n brokerName,\n brokers,\n statusInfo,\n showEpochPauseCountdown: showEpochPauseCountdown ?? false,\n };\n }, [\n type,\n totalOrderClaimedReward,\n totalEsOrderClaimedReward,\n epochList,\n curEpochEstimate,\n walletRewardsHistory,\n titleConfig,\n brokerId,\n brokerName,\n brokers,\n statusInfo,\n showEpochPauseCountdown,\n ]);\n\n return (\n <TradingRewardsContext.Provider value={memoizedValue}>\n {children}\n </TradingRewardsContext.Provider>\n );\n};\n\nexport const useTradingRewardsContext = () => {\n return useContext<TradingRewardsState>(TradingRewardsContext);\n};\n","import { ReactNode } from \"react\";\nimport { useTradingRewardsContext } from \"../provider\";\n\nexport type TitleConfig = {\n /// default is `Trading rewards`\n title?: string | ReactNode;\n /// default is `Trade with Orderly’s to earn ORDER.`\n subtitle?: string | ReactNode;\n /// default is `Learn more about Orderly Trading rewards Program in Trading rewards Docs`\n content?: string | ReactNode;\n /// default is { url: 'https://orderly.network/docs/introduction/tokenomics/trading-rewards', target: \"_blank\"}\n docOpenOptions?: {\n url?: string;\n target?: string;\n features?: string;\n };\n brokerName?: string;\n};\n\nexport const useTitleScript = (): TitleConfig => {\n\n const { titleConfig } = useTradingRewardsContext();\n\n return titleConfig;\n};\n","import React from \"react\";\nimport { useTitleScript } from \"./title.script\";\nimport { Title } from \"./title.ui\";\n\nexport const TitleWidget: React.FC = () => {\n const state = useTitleScript();\n return <Title {...state} />;\n};\n","import { useMemo } from \"react\";\nimport { useAccount, useWalletConnector } from \"@kodiak-finance/orderly-hooks\";\nimport { useAppContext } from \"@kodiak-finance/orderly-react-app\";\nimport { AccountStatusEnum } from \"@kodiak-finance/orderly-types\";\nimport { useTradingRewardsContext } from \"../provider\";\nimport { RewardsTooltipProps } from \"./rewardsTooltip\";\n\nexport const useCurEpochScript = () => {\n const {\n epochList,\n curEpochEstimate: estimate,\n brokerId,\n brokerName,\n statusInfo,\n showEpochPauseCountdown,\n } = useTradingRewardsContext();\n const { wrongNetwork, disabledConnect } = useAppContext();\n const { connect } = useWalletConnector();\n const { state } = useAccount();\n\n const hideData = useMemo(() => {\n return (\n state.status <= AccountStatusEnum.SignedIn ||\n wrongNetwork ||\n disabledConnect\n );\n }, [state, wrongNetwork, disabledConnect]);\n\n const notConnected = useMemo(() => {\n return state.status <= AccountStatusEnum.SignedIn || disabledConnect;\n }, [state, disabledConnect]);\n\n const rewardsTooltip = useMemo((): RewardsTooltipProps | undefined => {\n if (typeof estimate === \"undefined\" || estimate === null) return undefined;\n const otherRewards = estimate.rows\n .filter((item) => item.broker_id !== brokerId)\n .reduce((a, b) => a + b.est_r_account, 0);\n const curRewards = Number(estimate.est_r_wallet) - otherRewards;\n return {\n brokerName,\n curRewards,\n otherRewards,\n };\n }, [brokerId, brokerName, estimate]);\n\n return {\n epochList,\n estimate,\n hideData,\n notConnected,\n connect,\n rewardsTooltip: hideData ? undefined : rewardsTooltip,\n statusInfo,\n showEpochPauseCountdown,\n };\n};\n\nexport type CurEpochReturns = ReturnType<typeof useCurEpochScript>;\n","export const EsOrderlyIcon = (props: {className?: string}) => {\n return (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={props.className}\n >\n <g clipPath=\"url(#clip0_862_2449)\">\n <path\n d=\"M10.0249 19.9361C15.5202 19.9361 19.9751 15.4813 19.9751 9.98589C19.9751 4.49052 15.5202 0.0356445 10.0249 0.0356445C4.52949 0.0356445 0.0746155 4.49052 0.0746155 9.98589C0.0746155 15.4813 4.52949 19.9361 10.0249 19.9361Z\"\n fill=\"url(#paint0_linear_862_2449)\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M14.0992 5.0347C14.1824 5.0347 14.2202 4.93253 14.1556 4.88017C13.0272 3.96625 11.59 3.41876 10.0249 3.41876C8.4598 3.41876 7.02258 3.96625 5.89428 4.88017C5.82963 4.93253 5.86743 5.0347 5.95063 5.0347H14.0992ZM7.2658 11.6648C7.34763 11.6648 7.42329 11.707 7.47028 11.7739C8.03421 12.5781 8.96819 13.1038 10.025 13.1038C11.0817 13.1038 12.0156 12.5781 12.5796 11.7739C12.6266 11.707 12.7022 11.6648 12.7841 11.6648H16.2198C16.2985 11.6648 16.3559 11.7395 16.334 11.8151C15.5419 14.5521 13.0171 16.5531 10.0249 16.5531C7.03275 16.5531 4.50795 14.5521 3.71578 11.8151C3.6939 11.7395 3.75127 11.6648 3.83 11.6648H7.2658ZM12.335 7.8919C12.3825 7.94426 12.4493 7.97581 12.5199 7.97581H16.114C16.1955 7.97581 16.2533 7.89653 16.2264 7.81972C15.9727 7.0936 15.5951 6.42564 15.119 5.84118C15.0743 5.78631 15.007 5.75526 14.9361 5.75526H5.11354C5.04279 5.75526 4.97543 5.78631 4.93075 5.84118C4.4546 6.42564 4.07701 7.0936 3.82337 7.81972C3.79653 7.89653 3.8543 7.97581 3.93567 7.97581H7.52983C7.60053 7.97581 7.66725 7.94426 7.71477 7.8919C8.28522 7.263 9.10892 6.86807 10.0249 6.86807C10.9408 6.86807 11.7646 7.263 12.335 7.8919ZM13.028 10.8273C13.0114 10.8862 13.0549 10.9458 13.116 10.9458H16.4447C16.4894 10.9458 16.5273 10.913 16.5333 10.8688C16.572 10.5798 16.5921 10.285 16.5921 9.98539C16.5921 9.56935 16.5534 9.1623 16.4795 8.76771C16.4716 8.72551 16.4345 8.6952 16.3916 8.6952H13.0042C12.9388 8.6952 12.895 8.763 12.9195 8.82377C13.0636 9.18276 13.1429 9.57477 13.1429 9.98529C13.1429 10.277 13.1029 10.5595 13.028 10.8273ZM6.9338 10.9458C6.99492 10.9458 7.03829 10.8862 7.02183 10.8273C6.94688 10.5595 6.90682 10.277 6.90682 9.98529C6.90682 9.57477 6.98617 9.18276 7.13037 8.82377C7.15477 8.763 7.11101 8.6952 7.04553 8.6952H3.65817C3.61522 8.6952 3.5782 8.72551 3.5703 8.76771C3.49631 9.1623 3.45761 9.56935 3.45761 9.98539C3.45761 10.285 3.47767 10.5798 3.51651 10.8688C3.52246 10.913 3.56045 10.9458 3.60511 10.9458H6.9338Z\"\n fill=\"url(#paint1_linear_862_2449)\"\n />\n </g>\n <defs>\n <linearGradient\n id=\"paint0_linear_862_2449\"\n x1=\"10.0249\"\n y1=\"-2.24058\"\n x2=\"10.0249\"\n y2=\"21.2774\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"white\" />\n <stop offset=\"1\" stopColor=\"#EDE9F4\" />\n </linearGradient>\n <linearGradient\n id=\"paint1_linear_862_2449\"\n x1=\"10.0249\"\n y1=\"3.41876\"\n x2=\"10.0249\"\n y2=\"16.5531\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#C750FF\" />\n <stop offset=\"1\" stopColor=\"#5800E8\" />\n </linearGradient>\n <clipPath id=\"clip0_862_2449\">\n <rect width=\"20\" height=\"20\" fill=\"white\" />\n </clipPath>\n </defs>\n </svg>\n );\n};\n","export const OrderlyIcon = (props: {\n className?: string;\n}) => {\n return (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={props.className}\n >\n <g clipPath=\"url(#clip0_862_2443)\">\n <path\n d=\"M10.0249 19.9491C15.5202 19.9491 19.9751 15.4942 19.9751 9.99883C19.9751 4.50346 15.5202 0.048584 10.0249 0.048584C4.52949 0.048584 0.0746155 4.50346 0.0746155 9.99883C0.0746155 15.4942 4.52949 19.9491 10.0249 19.9491Z\"\n fill=\"url(#paint0_linear_862_2443)\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M14.1556 4.8931C14.2202 4.94547 14.1824 5.04764 14.0992 5.04764H5.95063C5.86743 5.04764 5.82963 4.94547 5.89428 4.8931C7.02258 3.97918 8.4598 3.4317 10.0249 3.4317C11.59 3.4317 13.0272 3.97918 14.1556 4.8931Z\"\n fill=\"white\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M7.47028 11.7869C7.4233 11.7199 7.34764 11.6777 7.26581 11.6777H3.83C3.75128 11.6777 3.69391 11.7525 3.71579 11.8281C4.50796 14.565 7.03275 16.566 10.0249 16.566C13.0171 16.566 15.5419 14.565 16.334 11.8281C16.3559 11.7525 16.2985 11.6777 16.2198 11.6777H12.7841C12.7022 11.6777 12.6266 11.7199 12.5796 11.7869C12.0156 12.5911 11.0817 13.1167 10.025 13.1167C8.96818 13.1167 8.03421 12.5911 7.47028 11.7869Z\"\n fill=\"white\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.335 7.90476C12.3825 7.95713 12.4493 7.98867 12.5199 7.98867H16.114C16.1955 7.98867 16.2533 7.9094 16.2264 7.83259C15.9727 7.10647 15.5951 6.43851 15.119 5.85405C15.0743 5.79918 15.007 5.76813 14.9361 5.76813H5.11354C5.04278 5.76813 4.97543 5.79918 4.93074 5.85405C4.45459 6.43851 4.07701 7.10647 3.82337 7.83259C3.79652 7.9094 3.85428 7.98867 3.93567 7.98867H7.52982C7.60052 7.98867 7.66725 7.95713 7.71475 7.90476C8.28522 7.27587 9.10892 6.88093 10.0249 6.88093C10.9408 6.88093 11.7646 7.27587 12.335 7.90476Z\"\n fill=\"white\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M13.116 10.9587C13.0549 10.9587 13.0114 10.8991 13.028 10.8402C13.1029 10.5723 13.1429 10.29 13.1429 9.99822C13.1429 9.5877 13.0636 9.19568 12.9195 8.83669C12.895 8.77593 12.9388 8.70813 13.0042 8.70813H16.3916C16.4345 8.70813 16.4716 8.73843 16.4795 8.78064C16.5534 9.17523 16.5921 9.58228 16.5921 9.99832C16.5921 10.2979 16.572 10.5927 16.5333 10.8816C16.5273 10.9259 16.4894 10.9587 16.4447 10.9587H13.116ZM7.02183 10.8402C7.03829 10.8991 6.99492 10.9587 6.93381 10.9587H3.60511C3.56045 10.9587 3.52246 10.9259 3.51651 10.8816C3.47767 10.5927 3.45761 10.2979 3.45761 9.99832C3.45761 9.58228 3.49631 9.17523 3.5703 8.78064C3.5782 8.73843 3.61523 8.70813 3.65817 8.70813H7.04553C7.11101 8.70813 7.15477 8.77593 7.13037 8.83669C6.98617 9.19568 6.90682 9.5877 6.90682 9.99822C6.90682 10.29 6.94688 10.5723 7.02183 10.8402Z\"\n fill=\"white\"\n />\n </g>\n <defs>\n <linearGradient\n id=\"paint0_linear_862_2443\"\n x1=\"10.0249\"\n y1=\"0.0486119\"\n x2=\"10.0249\"\n y2=\"19.9491\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#C750FF\" />\n <stop offset=\"1\" stopColor=\"#5800E8\" />\n </linearGradient>\n <clipPath id=\"clip0_862_2443\">\n <rect width=\"20\" height=\"20\" fill=\"white\" />\n </clipPath>\n </defs>\n </svg>\n );\n };\n ","import React, { FC, useState } from \"react\";\nimport { Flex, Text, Tooltip } from \"@kodiak-finance/orderly-ui\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport type RewardsTooltipProps = {\n brokerName: string | undefined;\n curRewards: number;\n otherRewards: number;\n};\n\nexport const RewardsTooltip: FC<{\n rewardsTooltip?: RewardsTooltipProps;\n children?: React.ReactElement;\n className?: string;\n arrowClassName?: string;\n align?: \"start\" | \"center\" | \"end\";\n}> = (props) => {\n const [open, setOpen] = useState(false);\n const { t } = useTranslation();\n\n const content = (): any => {\n return (\n <Flex\n direction={\"column\"}\n className=\"oui-leading-[1.5] oui-text-2xs oui-text-base-contrast-80 oui-min-w-[204px]\"\n gap={1}\n >\n <Flex gap={1} width={\"100%\"}>\n <Text className=\"oui-flex-1\">{props.rewardsTooltip?.brokerName}</Text>\n <Text>\n {commifyOptional(props.rewardsTooltip?.curRewards, { fix: 2 })}\n </Text>\n </Flex>\n <Flex gap={1} width={\"100%\"}>\n <Text className=\"oui-flex-1\">\n {t(\"tradingRewards.otherOrderlyDex\")}\n </Text>\n <Text>\n {commifyOptional(props.rewardsTooltip?.otherRewards, { fix: 2 })}\n </Text>\n </Flex>\n </Flex>\n );\n };\n\n return (\n <Tooltip\n content={content()}\n align={props.align}\n className={props.className}\n open={open}\n onOpenChange={setOpen}\n arrow={{\n className: props.arrowClassName,\n }}\n delayDuration={100}\n >\n {!!props.children ? (\n React.cloneElement(props.children!, {\n onClick: (e: any) => {\n e.preventDefault();\n setOpen(!open);\n },\n })\n ) : (\n <svg\n width=\"21\"\n height=\"20\"\n viewBox=\"0 0 21 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"oui-cursor-pointer\"\n onClick={(e) => {\n e.preventDefault();\n setOpen(!open);\n }}\n >\n <path\n d=\"M10.5 1.678a8.333 8.333 0 1 0-.001 16.667 8.333 8.333 0 0 0 0-16.667m0 4.167a.833.833 0 1 1-.001 1.667.833.833 0 0 1 0-1.667m0 2.5c.46 0 .832.373.832.833v4.167a.833.833 0 0 1-1.666 0V9.178c0-.46.373-.833.833-.833\"\n fill=\"#fff\"\n fillOpacity=\".36\"\n />\n </svg>\n )}\n </Tooltip>\n );\n};\n","import { useState, useEffect, FC, ReactNode, SVGProps, useMemo } from \"react\";\nimport { EpochStatus } from \"@kodiak-finance/orderly-hooks\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\nimport { AccountStatusEnum } from \"@kodiak-finance/orderly-types\";\nimport { Box, Flex, Text, cn } from \"@kodiak-finance/orderly-ui\";\nimport { AuthGuard } from \"@kodiak-finance/orderly-ui-connector\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { CurEpochReturns } from \"./curEpoch.script\";\nimport { RewardsTooltip } from \"./rewardsTooltip\";\n\nexport const CurEpoch: FC<CurEpochReturns> = (props) => {\n const { t } = useTranslation();\n\n const state = props;\n const curEpochInfo = state.epochList?.[1].curEpochInfo;\n const epochList = state.epochList?.[0];\n const startTime = curEpochInfo?.start_time;\n const endTime = curEpochInfo?.end_time;\n const curEpochId = curEpochInfo?.epoch_id;\n const max_reward_amount = curEpochInfo?.max_reward_amount;\n const token = curEpochInfo?.epoch_token;\n\n const isOrder = curEpochInfo\n ? `${curEpochInfo?.epoch_token}`.toLowerCase() === \"order\"\n : undefined;\n\n const pausedEpochTimeDown = useMemo(() => {\n if (!props.showEpochPauseCountdown) {\n return undefined;\n }\n if (!epochList || props.statusInfo?.epochStatus !== EpochStatus.paused) {\n return undefined;\n }\n\n const lastCompletedEpoch = props.statusInfo?.lastCompletedEpoch;\n if (lastCompletedEpoch === undefined) {\n return undefined;\n }\n const nextEpoch = lastCompletedEpoch + 1;\n const epoch = epochList.find((item: any) => item.epoch_id === nextEpoch);\n return epoch?.start_time;\n }, [props.statusInfo?.epochStatus, epochList]);\n\n const showPauseCountdown = useMemo(() => {\n return (\n props.statusInfo?.epochStatus === EpochStatus.paused &&\n pausedEpochTimeDown\n );\n }, [props.statusInfo?.epochStatus, pausedEpochTimeDown]);\n\n if (props.statusInfo?.epochStatus !== EpochStatus.active) {\n return (\n <Flex\n id=\"oui-tradingRewards-home-currentEpoch\"\n r={\"2xl\"}\n className=\"oui-bg-base-9 oui-font-semibold oui-p-10\"\n width={\"100%\"}\n height={\"100%\"}\n direction={\"column\"}\n // justify={\"stretch\"}\n itemAlign={\"stretch\"}\n >\n <Flex\n gap={2}\n direction={\"column\"}\n justify={\"center\"}\n itemAlign={\"center\"}\n className=\"oui-size-full\"\n >\n {showPauseCountdown ? (\n <Flex\n gap={2}\n direction={\"column\"}\n justify={\"center\"}\n itemAlign={\"center\"}\n >\n <Text className=\"oui-text-base-contrast-54 oui-text-sm\">\n {t(\"tradingRewards.epochPauseCountdown.title\")}\n </Text>\n <Countdown targetTimestamp={pausedEpochTimeDown} isStandalone />\n </Flex>\n ) : (\n <Flex\n className=\"oui-text-base-contrast-54 oui-text-sm oui-text-center\"\n justify={\"center\"}\n itemAlign={\"center\"}\n >\n {props.statusInfo?.epochStatus === EpochStatus.paused\n ? t(\"tradingRewards.eopchStatus.pause\")\n : t(\"tradingRewards.eopchStatus.ended\")}\n </Flex>\n )}\n {props.statusInfo?.epochStatus === EpochStatus.paused && (\n <div\n className={cn(\n \"oui-w-full\",\n showPauseCountdown ? \"oui-mt-2\" : \"oui-mt-0\",\n )}\n >\n <TwitterLInk />\n </div>\n )}\n </Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-currentEpoch\"\n r={\"2xl\"}\n className=\"oui-bg-base-9 oui-font-semibold\"\n width={\"100%\"}\n height={\"100%\"}\n direction={\"column\"}\n // justify={\"stretch\"}\n itemAlign={\"stretch\"}\n >\n <Countdown targetTimestamp={endTime} />\n <Flex p={6} direction={\"column\"} gap={4} className=\"oui-h-full\">\n <Flex direction={\"row\"} gap={3} width={\"100%\"} justify={\"around\"}>\n <Statics\n title={t(\"tradingRewards.epoch\")}\n highLight={curEpochId ? `${curEpochId}` : \"--\"}\n text={\n startTime && endTime\n ? `${getDate(startTime)} - ${getDate(endTime)}`\n : \"\"\n }\n />\n <Statics\n title={t(\"tradingRewards.epochRewards\")}\n highLight={commifyOptional(max_reward_amount, { fix: 0 })}\n text={token}\n />\n </Flex>\n <EstRewards\n isOrder={isOrder}\n direction={state.notConnected ? \"row\" : \"column\"}\n justify={state.notConnected ? \"between\" : \"center\"}\n hideData={state.hideData}\n estRewards={state.hideData ? \"--\" : props.estimate?.est_r_wallet}\n rewardsTooltip={props.rewardsTooltip}\n background={\n state.notConnected\n ? \"linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%)\"\n : \"linear-gradient(0deg, #2D0061 2.62%, #BD6BED 86.5%)\"\n }\n />\n {/* {state.notConnected && (\n <Button\n variant=\"gradient\"\n fullWidth\n onClick={(e) => {\n e.stopPropagation();\n state.connect();\n }}\n >\n Connect wallet\n </Button>\n )} */}\n\n <div className=\"oui-w-full\">\n <AuthGuard\n status={AccountStatusEnum.SignedIn}\n buttonProps={{ fullWidth: true }}\n >\n <></>\n </AuthGuard>\n </div>\n </Flex>\n </Flex>\n );\n};\n\nconst EstRewards: FC<{\n isOrder?: boolean;\n estRewards?: number | string;\n direction: \"row\" | \"column\";\n justify: \"center\" | \"between\";\n background: string;\n hideData: boolean;\n rewardsTooltip:\n | {\n brokerName: string | undefined;\n curRewards: number;\n otherRewards: number;\n }\n | undefined;\n}> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n direction={props.direction}\n gap={2}\n py={4}\n px={6}\n width={\"100%\"}\n r=\"xl\"\n itemAlign={\"center\"}\n justify={props.justify}\n style={{\n background: props.background,\n }}\n className=\"oui-flex-1 oui-h-full\"\n >\n <Text className=\"oui-text-base xl:oui-text-lg oui-text-base-contrast-54\">\n {t(\"tradingRewards.myEstRewards\")}\n </Text>\n <Flex direction={\"row\"} gap={3}>\n {props.isOrder == true && (\n <OrderlyIcon className=\"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8\" />\n )}\n {props.isOrder == false && (\n <EsOrderlyIcon className=\"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8\" />\n )}\n <Text\n children={commifyOptional(props.estRewards, { fix: 2 })}\n className=\"oui-text-xl md:oui-text-2xl xl:oui-text-[32px]\"\n />\n {props.rewardsTooltip && (\n <RewardsTooltip rewardsTooltip={props.rewardsTooltip} />\n )}\n </Flex>\n </Flex>\n );\n};\n\nconst Statics: FC<{\n title: string;\n highLight?: string;\n text?: string;\n}> = (props) => {\n const { title, highLight, text } = props;\n return (\n <Flex\n // px={1}\n py={2}\n justify={\"between\"}\n direction={\"column\"}\n className=\"flex-1\"\n gap={2}\n >\n <Text\n className={cn(\n \"oui-text-base-contrast-54\",\n // font size\n \"oui-text-xs md:oui-text-sm xl:oui-text-base\",\n /// leading\n \"oui-leading-[20px] xl:oui-leading-[24px]\",\n )}\n >\n {title}\n </Text>\n <Flex direction={\"row\"} gap={1} itemAlign={\"end\"} justify={\"center\"}>\n <Text.gradient\n color=\"brand\"\n angle={90}\n className=\"oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl\"\n >\n {highLight}\n </Text.gradient>\n <Text\n intensity={80}\n className=\"oui-mb-[3px] oui-text-2xs md:oui-text-xs xl:oui-text-sm\"\n >\n {text}\n </Text>\n </Flex>\n </Flex>\n );\n};\n\nconst Countdown: FC<{\n targetTimestamp?: number;\n isStandalone?: boolean;\n}> = (props) => {\n const { targetTimestamp, isStandalone } = props;\n const { t } = useTranslation();\n const [timeLeft, setTimeLeft] = useState({\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n });\n\n useEffect(() => {\n const intervalId = setInterval(() => {\n if (typeof targetTimestamp === \"undefined\") return;\n const now = new Date().getTime();\n const distance = targetTimestamp - now;\n\n if (distance < 0) {\n clearInterval(intervalId as unknown as number);\n setTimeLeft({\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n });\n } else {\n const days = Math.floor(distance / (1000 * 60 * 60 * 24));\n const hours = Math.floor(\n (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60),\n );\n const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));\n const seconds = Math.floor((distance % (1000 * 60)) / 1000);\n\n setTimeLeft({ days, hours, minutes, seconds });\n }\n }, 1000);\n\n return () => clearInterval(intervalId as unknown as number);\n }, [targetTimestamp]);\n\n const num = (value: string) => {\n return (\n <Text className=\"oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg \">\n {value}\n </Text>\n );\n };\n\n return (\n <Box\n className=\"oui-rounded-t-2xl oui-font-semibold oui-text-base-contrast-54\"\n gradient={isStandalone ? undefined : \"neutral\"}\n angle={180}\n width={\"full\"}\n >\n <Flex justify={\"center\"} gap={1}>\n {isStandalone ? null : <span>{`${t(\"common.countdown\")}: `}</span>}\n <Flex\n direction={\"row\"}\n itemAlign={\"end\"}\n gap={1}\n className={cn(\n \"oui-text-2xs md:oui-text-xs lg:oui-text-sm\",\n isStandalone ? \"oui-py-0\" : \"oui-py-[13px]\",\n )}\n >\n {num(`${timeLeft.days}`.padStart(2, \"0\"))}\n <span>D</span>\n {num(`${timeLeft.hours}`.padStart(2, \"0\"))}\n <span>H</span>\n {num(`${timeLeft.minutes}`.padStart(2, \"0\"))}\n <span>M</span>\n {num(`${timeLeft.seconds}`.padStart(2, \"0\"))}\n <span>S</span>\n </Flex>\n </Flex>\n </Box>\n );\n};\n\nconst CountDownNum = (props: { children?: ReactNode }) => {\n return (\n <Text className=\"oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg \">\n {props.children}\n </Text>\n );\n};\n\nconst getDate = (timestamp?: number) => {\n if (!timestamp) return \"\";\n\n const date = new Date(timestamp);\n\n // return format(timestamp, \"MMM. d\");\n\n const monthNames = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ];\n const month = monthNames[date.getUTCMonth()];\n const day = date.getUTCDate();\n return `${month}. ${day}`;\n};\n\nexport const ArrowRightIcon: FC<SVGProps<SVGSVGElement>> = (props) => (\n <svg\n width=\"21\"\n height=\"20\"\n viewBox=\"0 0 21 20\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <mask\n id=\"mask0_1997_45723\"\n style={{ maskType: \"alpha\" }}\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"21\"\n height=\"20\"\n >\n <rect x=\"0.5\" width=\"20\" height=\"20\" fill=\"#D9D9D9\" />\n </mask>\n <g mask=\"url(#mask0_1997_45723)\">\n <path\n d=\"M12.0384 14.7111L11.1603 13.8073L14.343 10.6246H4.25V9.37463H14.343L11.1603 6.19192L12.0384 5.28809L16.75 9.99961L12.0384 14.7111Z\"\n // fill=\"black\"\n // fill-opacity=\"0.8\"\n />\n </g>\n </svg>\n);\nconst TwitterLInk: FC = () => {\n const { t } = useTranslation();\n return (\n <Flex\n gap={1}\n itemAlign={\"center\"}\n justify={\"center\"}\n className=\"oui-group oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80\"\n onClick={() => window.open(\"https://x.com/OrderlyNetwork\")}\n >\n <div className=\"oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80\">\n {t(\"tradingRewards.eopchStatus.linkDescription\")}\n </div>\n <ArrowRightIcon className=\"oui-text-fill-base-contrast-36 oui-fill-base-contrast-36 group-hover:oui-fill-base-contrast-80\" />\n </Flex>\n );\n};\n","import { FC } from \"react\";\nimport { useCurEpochScript } from \"./curEpoch.script\";\nimport { CurEpoch } from \"./curEpoch.ui\";\n\nexport const CurEpochWidget: FC = () => {\n const state = useCurEpochScript();\n return <CurEpoch {...state} />;\n};\n","export { CurEpochWidget } from \"./curEpoch.widget\";\nexport { CurEpoch } from \"./curEpoch.ui\";\nexport { useCurEpochScript } from \"./curEpoch.script\";\n","import { useCallback, useMemo } from \"react\";\nimport { useDataTap } from \"@kodiak-finance/orderly-react-app\";\nimport { Decimal } from \"@kodiak-finance/orderly-utils\";\nimport { ChainNamespace } from \"@kodiak-finance/orderly-types\";\nimport { ENVType, useGetEnv, useWalletConnector } from \"@kodiak-finance/orderly-hooks\";\nimport { useTradingRewardsContext } from \"../provider\";\n\nexport type AvailableReturns = {\n order?: number;\n esOrder?: number;\n goToClaim?: (e: any) => void;\n};\n\nexport const useAvailableScript = (): AvailableReturns => {\n const {\n totalOrderClaimedReward,\n walletRewardsHistory,\n totalEsOrderClaimedReward,\n } = useTradingRewardsContext();\n const [orderClaimedRewardData] = totalOrderClaimedReward;\n const [esOrderClaimedRewardData] = totalEsOrderClaimedReward;\n\n const { namespace } = useWalletConnector();\n\n const [data] = walletRewardsHistory;\n\n const lifetimeOrderReward = useMemo(() => {\n if (namespace === ChainNamespace.evm) {\n return data?.wallet_lifetime_trading_rewards_order;\n }\n return data?.wallet_pending_trading_rewards_order;\n }, [namespace, data]);\n\n const lifetimeEsOrderReward = useMemo(() => {\n if (namespace === ChainNamespace.evm) {\n return data?.wallet_lifetime_trading_rewards_escrow;\n }\n return data?.wallet_pending_trading_rewards_escrow;\n }, [data, namespace]);\n\n const env = useGetEnv();\n const goToClaim = (e: any) => {\n const url = `https://${\n env !== ENVType.prod ? `${env}-` : \"\"\n }app.orderly.network/tradingRewards`;\n window.open(url, \"_blank\");\n };\n\n const calculateRemainingReward = useCallback(\n (totalReward: string | undefined, claimedReward: number | undefined) => {\n if (\n typeof claimedReward !== \"undefined\" &&\n typeof totalReward !== \"undefined\"\n ) {\n const remainingReward = new Decimal(totalReward)\n .sub(claimedReward)\n .toFixed(18, Decimal.ROUND_DOWN);\n return Number(remainingReward);\n }\n return undefined;\n },\n []\n );\n\n const availableOrder = useMemo(\n () => calculateRemainingReward(lifetimeOrderReward, orderClaimedRewardData),\n [lifetimeOrderReward, orderClaimedRewardData, calculateRemainingReward]\n );\n\n const availableEsOrder = useMemo(\n () =>\n calculateRemainingReward(lifetimeEsOrderReward, esOrderClaimedRewardData),\n [lifetimeEsOrderReward, esOrderClaimedRewardData, calculateRemainingReward]\n );\n\n const orderValue = useDataTap<number | undefined>(availableOrder);\n const esorderValue = useDataTap<number | undefined>(availableEsOrder);\n return {\n order: orderValue ?? undefined,\n esOrder: esorderValue ?? undefined,\n goToClaim,\n };\n};\n","export const JumpIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n // fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n >\n <path\n d=\"M11.3275 13.9938C12.8001 13.9938 13.9941 12.7998 13.9941 11.3272V4.66049C13.9941 3.18782 12.8001 1.99382 11.3275 1.99382H4.66081C3.18814 1.99382 1.99414 3.18782 1.99414 4.66049V11.3272C1.99414 12.7998 3.18814 13.9938 4.66081 13.9938H11.3275ZM5.99414 10.6605C5.82347 10.6605 5.64548 10.6031 5.51481 10.4732C5.25481 10.2125 5.25481 9.77516 5.51481 9.51449L8.18148 6.84782L6.66081 5.32715H10.6608V9.32715L9.14014 7.80648L6.47347 10.4732C6.34347 10.6031 6.16481 10.6605 5.99414 10.6605Z\"\n \n />\n </svg>\n );\n};\n","import { Flex, Text } from \"@kodiak-finance/orderly-ui\";\nimport { JumpIcon } from \"../components/jumpIcon\";\nimport { FC } from \"react\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { AvailableReturns } from \"./availableToClaim.script\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const AvailableToClaim: FC<AvailableReturns> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-availableToClaim\"\n p={6}\n r=\"2xl\"\n direction={\"column\"}\n gap={4}\n width={\"100%\"}\n className=\" oui-font-semibold oui-bg-base-9 \"\n >\n <Flex direction={\"row\"} justify={\"between\"} width={\"100%\"}>\n <Text className=\"oui-text-lg\">\n {t(\"tradingRewards.availableClaim\")}\n </Text>\n <Flex\n direction={\"row\"}\n gap={1}\n onClick={props.goToClaim}\n className=\"oui-cursor-pointer oui-text-primary-light\"\n >\n <Text size=\"sm\">{t(\"tradingRewards.claim\")}</Text>\n <JumpIcon />\n </Flex>\n </Flex>\n <Flex direction={\"row\"} gap={3} width={\"100%\"}>\n <Statics title=\"ORDER\" value={props.order} />\n <Statics title=\"esORDER\" value={props.esOrder} isEsOrder />\n </Flex>\n </Flex>\n );\n};\n// background: linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%);\n\nconst Statics: FC<{\n title: string;\n isEsOrder?: boolean;\n value?: number;\n}> = (props) => {\n const { value } = props;\n return (\n <Flex\n className=\"oui-flex-1 oui-bg-base-8 oui-py-[11px]\"\n direction={\"column\"}\n gap={2}\n r=\"xl\"\n gradient=\"neutral\"\n angle={180}\n border\n borderColor={6}\n >\n <Text className=\"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54\">\n {props.title}\n </Text>\n <Flex direction={\"row\"} gap={1}>\n {props.isEsOrder ? <EsOrderlyIcon /> : <OrderlyIcon />}\n <Text\n className=\"oui-text-sm xl:oui-text-base\"\n children={commifyOptional(value, { fix: 2 })}\n />\n </Flex>\n </Flex>\n );\n};\n","import React from \"react\";\nimport { useAvailableScript } from \"./availableToClaim.script\";\nimport { AvailableToClaim } from \"./availableToClaim.ui\";\n\nexport const AvailableToClaimWidget: React.FC = () => {\n const state = useAvailableScript();\n return <AvailableToClaim {...state} />;\n};\n","\nexport { AvailableToClaimWidget } from \"./availableToClaim.widget\";\nexport { AvailableToClaim } from \"./availableToClaim.ui\";","import { CurrentEpochEstimate } from \"@kodiak-finance/orderly-hooks\";\nimport { useTradingRewardsContext } from \"../provider\";\nimport { ENVType, useGetEnv } from \"@kodiak-finance/orderly-hooks\";\nimport { useDataTap } from \"@kodiak-finance/orderly-react-app\";\nimport { Decimal } from \"@kodiak-finance/orderly-utils\";\nimport { useMemo } from \"react\";\n\nexport const useStakeBoosterScript = () => {\n const { curEpochEstimate } = useTradingRewardsContext();\n\n const env = useGetEnv();\n const stakeNow = (e: any) => {\n const url = `https://${\n env !== ENVType.prod ? `${env}-` : \"\"\n }app.orderly.network/staking`;\n window.open(url, \"_blank\");\n };\n const estimateValue = useDataTap(curEpochEstimate);\n\n const booster = useMemo(() => {\n const estStakeBoost = curEpochEstimate?.est_stake_boost;\n if (typeof estStakeBoost === \"undefined\" || estStakeBoost === null) {\n return undefined;\n }\n\n if (estStakeBoost === 0) return estStakeBoost;\n\n return new Decimal(estStakeBoost)\n .div(new Decimal(10).pow(0.15))\n .toDecimalPlaces(2, Decimal.ROUND_DOWN)\n .toString();\n }, [curEpochEstimate?.est_stake_boost]);\n return {\n curEpochEstimate: estimateValue ?? undefined,\n stakeNow,\n booster,\n };\n};\n\n\nexport type StakeBoosterReturns = ReturnType<typeof useStakeBoosterScript>;","export const RocketIcon = () => {\n return (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.439 10.5672C14.0868 10.9198 13.7025 11.2403 13.3183 11.5287C13.1902 11.6248 13.1261 11.721 13.0941 11.8812C12.7739 13.1952 12.1015 14.4451 11.0448 15.5027C10.5645 15.9835 10.0522 16.3681 9.47584 16.7206C8.99553 17.009 8.41917 16.5283 8.61129 15.9835C8.93149 15.1502 9.05957 14.2528 9.05957 13.3234C8.99553 13.3234 8.89947 13.3555 8.83543 13.3555C8.06695 12.7145 7.3625 12.0415 6.65805 11.3364C5.95361 10.6313 5.28118 9.89421 4.64078 9.15708C4.64078 9.09299 4.6728 8.99684 4.6728 8.93274C3.74421 8.93274 2.84764 9.09299 2.01512 9.38143C1.50279 9.57372 0.990469 8.99684 1.27865 8.51611C1.63087 7.93923 2.01512 7.42645 2.49542 6.94572C3.55209 5.88811 4.80088 5.21508 6.11371 4.89459C6.24179 4.86255 6.36987 4.7664 6.46593 4.67025C6.75412 4.25362 7.07432 3.90108 7.42654 3.54855C9.92412 1.04874 13.4143 0.183422 16.6484 0.920545C16.8725 0.984642 17.0326 1.14489 17.0967 1.36923C17.8011 4.57411 16.9366 8.06742 14.439 10.5672ZM13.0301 4.95869C12.2616 4.18952 10.9808 4.18952 10.2123 4.95869C9.44382 5.72786 9.44382 7.00982 10.2123 7.77899C10.9808 8.54816 12.2616 8.54816 13.0301 7.77899C13.8306 6.97777 13.8306 5.72786 13.0301 4.95869ZM5.88957 14.7656C5.28118 15.3745 1.53481 17.9385 0.798348 17.2013C0.0618817 16.4642 2.6235 12.7145 3.23189 12.1056C3.84027 11.4966 4.92896 11.5928 5.66543 12.3299C6.40189 13.067 6.49795 14.1567 5.88957 14.7656Z\"\n fill=\"url(#paint0_linear_88_1748)\"\n />\n <defs>\n <linearGradient\n id=\"paint0_linear_88_1748\"\n x1=\"17.3331\"\n y1=\"8.99996\"\n x2=\"0.666504\"\n y2=\"8.99996\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"rgb(var(--oui-gradient-brand-end))\" />\n <stop offset=\"1\" stopColor=\"rgb(var(--oui-gradient-brand-start))\" />\n </linearGradient>\n </defs>\n </svg>\n );\n};\n","import { FC, ReactNode } from \"react\";\nimport { Flex, Text } from \"@kodiak-finance/orderly-ui\";\nimport { JumpIcon } from \"../components/jumpIcon\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { RocketIcon } from \"../components/rocket\";\nimport { StakeBoosterReturns } from \"./stakeBooster.script\";\nimport { commify, commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const StakeBooster: FC<StakeBoosterReturns> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-stakeBooster\"\n p={6}\n r=\"2xl\"\n direction={\"column\"}\n gap={4}\n width={\"100%\"}\n className=\" oui-font-semibold oui-bg-base-9 \"\n >\n <Flex direction={\"row\"} justify={\"between\"} width={\"100%\"}>\n <Text className=\"oui-text-lg\">{t(\"tradingRewards.stakeBooster\")}</Text>\n <Flex\n direction={\"row\"}\n gap={1}\n onClick={props.stakeNow}\n className=\"oui-cursor-pointer oui-text-primary-light\"\n >\n <Text size=\"sm\">{t(\"tradingRewards.stake\")}</Text>\n <JumpIcon />\n </Flex>\n </Flex>\n <Flex direction={\"row\"} gap={3} width={\"100%\"}>\n <Statics\n title={t(\"tradingRewards.avgStakedAmount\")}\n value={props.curEpochEstimate?.est_avg_stake}\n icon={\n <div className=\"oui-flex oui-w-[32px] oui-h-[20px] oui-relative\">\n <div className=\"oui-absolute oui-right-0 oui-top-0\">\n <EsOrderlyIcon />\n </div>\n <div className=\"oui-absolute oui-left-0 oui-top-0 \">\n <OrderlyIcon />\n </div>\n </div>\n }\n />\n <Statics\n title={t(\"tradingRewards.booster\")}\n value={props.booster}\n icon={<RocketIcon />}\n gradient\n />\n </Flex>\n </Flex>\n );\n};\n\nconst Statics: FC<{\n title: string;\n icon: ReactNode;\n value?: number | string;\n gradient?: boolean;\n}> = (props) => {\n const calcValue = commify(props.value || \"--\", 2);\n return (\n <Flex\n className=\"oui-flex-1 oui-bg-base-8 oui-py-[11px]\"\n direction={\"column\"}\n gap={2}\n r=\"xl\"\n gradient=\"neutral\"\n angle={180}\n border\n borderColor={6}\n >\n <Text className=\"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54\">\n {props.title}\n </Text>\n <Flex direction={\"row\"} gap={1}>\n {props.icon}\n {props.gradient ? (\n <Text.gradient\n className=\"oui-text-sm xl:oui-text-base\"\n color=\"brand\"\n angle={90}\n >\n {calcValue + (calcValue === \"--\" ? \"\" : \"x\")}\n </Text.gradient>\n ) : (\n <Text className=\"oui-text-sm xl:oui-text-base\">\n {commifyOptional(props.value, { fix: 2 })}\n </Text>\n )}\n </Flex>\n </Flex>\n );\n};\n","import React from \"react\";\nimport { useStakeBoosterScript } from \"./stakeBooster.script\";\nimport { StakeBooster } from \"./stakeBooster.ui\";\n\nexport const StakeBoosterWidget: React.FC = () => {\n const state = useStakeBoosterScript();\n return <StakeBooster {...state} />;\n};\n","\nexport { StakeBoosterWidget } from \"./stakeBooster.widget\";\nexport { StakeBooster } from \"./stakeBooster.ui\";","import { FC } from \"react\";\nimport {\n Box,\n Divider,\n Flex,\n ListView,\n Text,\n DataTable,\n Column,\n} from \"@kodiak-finance/orderly-ui\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { ListType, RewardsHistoryReturns } from \"./rewardsHistory.script\";\nimport { useMediaQuery } from \"@kodiak-finance/orderly-hooks\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { AuthGuardEmpty } from \"@kodiak-finance/orderly-ui-connector\";\nimport { AccountStatusEnum } from \"@kodiak-finance/orderly-types\";\nimport { RewardsTooltip } from \"../curEpoch/rewardsTooltip\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const RewardHistory: FC<RewardsHistoryReturns> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-rewardHistory\"\n py={4}\n px={3}\n direction={\"column\"}\n gap={2}\n itemAlign={\"start\"}\n r=\"2xl\"\n className=\"oui-bg-base-9 oui-w-full oui-font-semibold oui-tabular-nums\"\n >\n <Text className=\"oui-text-lg oui-px-3\">\n {t(\"tradingRewards.rewardHistory\")}\n </Text>\n <div className=\"oui-border-t-2 oui-border-line-4 oui-w-full\">\n <List {...props} />\n </div>\n </Flex>\n );\n};\n\nconst List: FC<RewardsHistoryReturns> = (props) => {\n const isMobile = useMediaQuery(\"(max-width: 767px)\");\n\n return isMobile ? (\n <ListView\n dataSource={props.originalData}\n renderItem={(item, index) => {\n return <MobileCell data={item} />;\n }}\n className=\"oui-mt-3 oui-max-h-[356px]\"\n />\n ) : (\n <Box px={3}>\n <DesktopList {...props} />\n </Box>\n );\n};\n\nconst MobileCell: FC<{\n data: ListType;\n}> = (props) => {\n const { data } = props;\n const { t } = useTranslation();\n\n console.log(data.rewardsTooltip);\n const isOrder =\n `${data?.info?.epoch_token || data.epoch_token}`.toLowerCase() === \"order\";\n const r_warret = commifyOptional(data.info?.r_wallet, { fix: 2 });\n\n return (\n <Flex\n key={data.epoch_id}\n direction={\"column\"}\n px={4}\n pt={0}\n gap={3}\n className=\"oui-text-base-contrast-80\"\n >\n <Flex direction={\"row\"} width={\"100%\"}>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"start\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.epoch\")}\n </Text>\n <Text className=\"oui-text-sm\">{`Epoch ${data.epoch_id}`}</Text>\n </Flex>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"start\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.epochRewards\")}{\" \"}\n </Text>\n <Flex gap={1}>\n {isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />}\n <Text className=\"oui-text-sm\">\n {commifyOptional(data.max_reward_amount, { fix: 2 })}\n </Text>\n </Flex>\n </Flex>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"end\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.rewardsEarned\")}{\" \"}\n </Text>\n <Flex gap={1}>\n {r_warret !== \"--\" &&\n (isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />)}\n {!!data.rewardsTooltip ? (\n <RewardsTooltip\n rewardsTooltip={data.rewardsTooltip}\n children={\n <Text className=\"oui-text-sm oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16\">\n {r_warret}\n </Text>\n }\n align=\"center\"\n className=\"oui-bg-base-5\"\n arrowClassName=\"oui-fill-base-5\"\n />\n ) : (\n <Text className=\"oui-text-sm\">{r_warret}</Text>\n )}\n </Flex>\n </Flex>\n </Flex>\n <Flex direction={\"row\"} width={\"100%\"}>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"start\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.rewardHistory.column.startDate\")}\n </Text>\n <Flex direction={\"row\"}>\n <Text className=\"oui-text-sm\">\n {formatTimestamp(data.start_time).firstPart}&nbsp;\n </Text>\n <Text className=\"oui-text-2xs oui-text-base-contrast-36\">\n {formatTimestamp(data.start_time).secondPart}\n </Text>\n </Flex>\n </Flex>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"end\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.rewardHistory.column.endDate\")}\n </Text>\n <Flex direction={\"row\"}>\n <Text className=\"oui-text-sm\">\n {formatTimestamp(data.end_time).firstPart}&nbsp;\n </Text>\n <Text className=\"oui-text-2xs oui-text-base-contrast-36\">\n {formatTimestamp(data.end_time).secondPart}\n </Text>\n </Flex>\n </Flex>\n </Flex>\n <Divider className=\"oui-w-full\" />\n </Flex>\n );\n};\n\nconst DesktopList: FC<RewardsHistoryReturns> = (props) => {\n const { data } = props;\n const { t } = useTranslation();\n\n const columns: Column<ListType>[] = [\n {\n title: t(\"tradingRewards.epoch\"),\n dataIndex: \"epoch_id\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value) => {\n return <Text>{`${t(\"tradingRewards.epoch\")} ${value}`}</Text>;\n },\n },\n {\n title: t(\"tradingRewards.rewardHistory.column.start&EndDate\"),\n dataIndex: \"time\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value, record) => {\n return (\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[2px]\"\n justify={\"start\"}\n itemAlign={\"start\"}\n >\n <Flex direction={\"row\"} gap={1}>\n <Text>{formatTimestamp(record.start_time).firstPart}</Text>\n <Text className=\"oui-text-base-contrast-54\">\n {formatTimestamp(record.start_time).secondPart}\n </Text>\n </Flex>\n <Flex direction={\"row\"} gap={1}>\n <Text>{formatTimestamp(record.end_time).firstPart}</Text>\n <Text className=\"oui-text-base-contrast-54\">\n {formatTimestamp(record.end_time).secondPart}\n </Text>\n </Flex>\n </Flex>\n );\n },\n },\n {\n title: t(\"tradingRewards.epochRewards\"),\n dataIndex: \"max_reward_amount\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value, record) => {\n const isOrder =\n `${record?.info?.epoch_token || record.epoch_token}`.toLowerCase() ===\n \"order\";\n return (\n <Flex direction={\"row\"} gap={1}>\n {isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />}\n <Text>{commifyOptional(value)}</Text>\n </Flex>\n );\n },\n },\n {\n title: t(\"tradingRewards.rewardsEarned\"),\n dataIndex: \"earned\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value, record) => {\n const isOrder =\n `${record?.info?.epoch_token || record.epoch_token}`.toLowerCase() ===\n \"order\";\n\n let children = (\n <Text\n className={\n record.rewardsTooltip\n ? \"oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16\"\n : \"\"\n }\n >\n {commifyOptional(record.info?.r_wallet, { fix: 2 })}\n </Text>\n );\n\n if (record.rewardsTooltip) {\n children = (\n <RewardsTooltip\n rewardsTooltip={record.rewardsTooltip}\n children={children}\n align=\"center\"\n className=\"oui-bg-base-5\"\n arrowClassName=\"oui-fill-base-5\"\n />\n );\n }\n return (\n <Flex direction={\"row\"} gap={1}>\n {isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />}\n {children}\n </Flex>\n );\n },\n },\n ];\n\n return (\n <DataTable\n bordered\n columns={columns}\n loading={props.isLoading}\n dataSource={data}\n emptyView={<AuthGuardEmpty status={AccountStatusEnum.SignedIn} />}\n onRow={(record) => {\n return {\n className: \"oui-h-[59px]\",\n };\n }}\n pagination={props.pagination}\n />\n );\n};\n\nfunction formatTimestamp(timestamp?: number) {\n if (typeof timestamp === \"undefined\")\n return {\n firstPart: \"-\",\n secondPart: \"\",\n };\n const date = new Date(timestamp);\n\n const monthNames = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ];\n const month = monthNames[date.getUTCMonth()];\n const day = date.getUTCDate().toString().padStart(2, \"0\");\n const year = date.getUTCFullYear();\n const hours = date.getUTCHours();\n const minutes = date.getUTCMinutes();\n const amPm = hours >= 12 ? \"PM\" : \"AM\";\n const formattedHours = (hours % 12).toString().padStart(2, \"0\");\n const formattedMinutes = minutes.toString().padStart(2, \"0\");\n\n // return `${month} ${day}, ${year}_${formattedHours}:${formattedMinutes} ${amPm}`;\n return {\n firstPart: `${month} ${day}, ${year}`,\n secondPart: `${formattedHours}:${formattedMinutes} ${amPm}`,\n };\n}\n","import { useMemo } from \"react\";\nimport {\n EpochInfoItem,\n useAccount,\n useAccountRewardsHistory,\n WalletRewardsItem,\n} from \"@kodiak-finance/orderly-hooks\";\nimport { useAppContext } from \"@kodiak-finance/orderly-react-app\";\nimport { usePagination } from \"@kodiak-finance/orderly-ui\";\nimport { getTimestamp } from \"@kodiak-finance/orderly-utils\";\nimport { RewardsTooltipProps } from \"../curEpoch/rewardsTooltip\";\nimport { useTradingRewardsContext } from \"../provider\";\n\nexport type ListType = EpochInfoItem & {\n info?: WalletRewardsItem;\n state?: string;\n rewardsTooltip?: RewardsTooltipProps;\n};\n\nexport type RewardsHistoryReturns = ReturnType<typeof useRewardsHistoryScript>;\n\nexport const useRewardsHistoryScript = () => {\n const { account } = useAccount();\n const {\n epochList,\n walletRewardsHistory,\n totalOrderClaimedReward,\n brokerId,\n brokerName,\n } = useTradingRewardsContext();\n const epochInfos = epochList?.[0];\n const { isNotStared } = epochList?.[1];\n const [history] = walletRewardsHistory;\n const { wrongNetwork, disabledConnect } = useAppContext();\n\n const { data: accountHistory } = useAccountRewardsHistory(account.address);\n\n const data = useMemo(() => {\n if (isNotStared || disabledConnect) {\n return [];\n }\n const list = [...(epochInfos || [])];\n\n const combineData = list.map((e): ListType => {\n const id = e.epoch_id;\n const index = history?.rows.findIndex((info) => id === info.epoch_id);\n\n let rewardsTooltip: RewardsTooltipProps | undefined = undefined;\n\n if (index !== -1 && !wrongNetwork) {\n const info = history?.rows?.[index as number];\n const _findIndex = accountHistory?.findIndex((item: any) => {\n return item?.epoch_id === e.epoch_id;\n });\n\n if (\n accountHistory !== undefined &&\n _findIndex !== undefined &&\n _findIndex !== -1\n ) {\n // get broker\n const brokerList = accountHistory[_findIndex].broker;\n const curBrokerIndex = brokerList.findIndex(\n (item) => item.broker_id === brokerId,\n );\n const curBroker =\n curBrokerIndex !== -1 ? brokerList[curBrokerIndex] : undefined;\n const curRewards = curBroker?.r_account ?? 0;\n const otherRewards = Math.max(0, (info?.r_wallet ?? 0) - curRewards);\n rewardsTooltip = {\n brokerName,\n curRewards,\n otherRewards,\n };\n }\n return {\n ...e,\n info,\n rewardsTooltip,\n } as ListType;\n }\n return {\n ...e,\n } as ListType;\n });\n\n combineData.sort((a, b) => a.epoch_id - b.epoch_id); // asc\n let [claimedReward] = totalOrderClaimedReward;\n if (typeof claimedReward !== \"undefined\") {\n for (let i = 0; i < combineData.length; i++) {\n const element = combineData[i];\n if (typeof element?.info === \"undefined\") {\n element.state = \"Null\";\n continue;\n }\n const status = element.info?.reward_status;\n if (status === \"Confirmed\") {\n if (claimedReward - element.info?.r_wallet >= 0) {\n element.state = \"Claimed\";\n } else {\n element.state = \"Claimable\";\n }\n claimedReward -= element.info?.r_wallet;\n } else if (status === \"Pending\") {\n element.state = \"Processing\";\n }\n }\n }\n combineData.sort((a, b) => b.epoch_id - a.epoch_id);\n const curDate = getTimestamp();\n return combineData.filter((item) => item.end_time <= curDate);\n }, [\n history,\n epochInfos,\n totalOrderClaimedReward,\n isNotStared,\n wrongNetwork,\n accountHistory,\n disabledConnect,\n ]);\n\n const { pagination } = usePagination();\n\n return {\n data,\n originalData: data,\n pagination,\n isLoading: epochList[1].isLoading,\n };\n};\n","import React from \"react\";\nimport { useRewardsHistoryScript } from \"./rewardsHistory.script\";\nimport { RewardHistory } from \"./rewardsHistory.ui\";\n\nexport const RewardsHistoryWidget: React.FC = () => {\n const state = useRewardsHistoryScript();\n return <RewardHistory {...state} />;\n};\n","export { RewardHistory } from \"./rewardsHistory.ui\";\nexport { RewardsHistoryWidget } from \"./rewardsHistory.widget\";","\nexport * from \"./title\";\nexport * from \"./curEpoch\";\nexport * from \"./availableToClaim\";\nexport * from \"./stakeBooster\";\nexport * from \"./rewardHistory\";\nexport { TradingRewardsProvider} from \"./provider\";\nexport { HomePage } from \"./page\";\n","export { Title } from \"./title.ui\";\nexport { TitleWidget } from \"./title.widget\";\nexport type { TitleConfig } from \"./title.script\";","import React, { useMemo } from \"react\";\nimport { useTradingRewardsStatus, EpochStatus } from \"@kodiak-finance/orderly-hooks\";\nimport { Flex, Box, cn } from \"@kodiak-finance/orderly-ui\";\nimport { TradingRewardsProvider } from \"./provider\";\nimport type { TitleConfig } from \"./title/title.script\";\n\nconst LazyTitleWidget = React.lazy(() =>\n import(\"./title/title.widget\").then((mod) => {\n return { default: mod.TitleWidget };\n }),\n);\n\nconst LazyCurEpochWidget = React.lazy(() =>\n import(\"./curEpoch\").then((mod) => {\n return { default: mod.CurEpochWidget };\n }),\n);\n\nconst LazyAvailableToClaimWidget = React.lazy(() =>\n import(\"./availableToClaim\").then((mod) => {\n return { default: mod.AvailableToClaimWidget };\n }),\n);\n\nconst LazyStakeBoosterWidget = React.lazy(() =>\n import(\"./stakeBooster\").then((mod) => {\n return { default: mod.StakeBoosterWidget };\n }),\n);\n\nconst LazyRewardsHistoryWidget = React.lazy(() =>\n import(\"./rewardHistory\").then((mod) => {\n return { default: mod.RewardsHistoryWidget };\n }),\n);\n\nconst StakeBooster: React.FC = () => {\n const { statusInfo } = useTradingRewardsStatus(false);\n const isStakeBoosterVisible = useMemo(() => {\n return statusInfo?.epochStatus === EpochStatus.active;\n }, [statusInfo?.epochStatus]);\n return isStakeBoosterVisible ? (\n <React.Suspense fallback={null}>\n <LazyStakeBoosterWidget />\n </React.Suspense>\n ) : null;\n};\n\nexport const HomePage: React.FC<{\n titleConfig?: TitleConfig;\n className?: string;\n showEpochPauseCountdown?: boolean;\n}> = (props) => {\n return (\n <TradingRewardsProvider\n titleConfig={props.titleConfig}\n showEpochPauseCountdown={props.showEpochPauseCountdown}\n >\n <Flex\n id=\"oui-tradingRewards-home-page\"\n className={cn(\"oui-h-lvw oui-w-full\", props.className)}\n direction={\"column\"}\n gap={4}\n >\n <React.Suspense fallback={null}>\n <LazyTitleWidget />\n </React.Suspense>\n <Flex className=\"oui-flex oui-size-full oui-flex-col oui-gap-4 2xl:oui-flex-row 2xl:oui-items-stretch\">\n <Box className=\"oui-w-full 2xl:oui-size-auto 2xl:oui-flex-1\">\n <React.Suspense fallback={null}>\n <LazyCurEpochWidget />\n </React.Suspense>\n </Box>\n <Flex className=\"oui-flex oui-w-full oui-flex-col oui-gap-4 lg:oui-flex-row 2xl:oui-flex-1 2xl:oui-flex-col\">\n <React.Suspense fallback={null}>\n <LazyAvailableToClaimWidget />\n </React.Suspense>\n <StakeBooster />\n </Flex>\n </Flex>\n <React.Suspense fallback={null}>\n <LazyRewardsHistoryWidget />\n </React.Suspense>\n </Flex>\n </TradingRewardsProvider>\n );\n};\n","import { useEffect, useMemo, useState } from \"react\";\nimport { useMediaQuery } from \"@kodiak-finance/orderly-hooks\";\nimport type { SideBarProps } from \"@kodiak-finance/orderly-ui-scaffold\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport enum TradingRewardsLeftSidebarPath {\n Trading = \"/rewards/trading\",\n Affiliate = \"/rewards/affiliate\",\n}\n\nexport const useTradingRewardsLayoutScript = (props: {\n current?: string;\n}): SideBarProps & {\n hideSideBar: boolean;\n} => {\n const { t } = useTranslation();\n const [current, setCurrent] = useState(props.current || \"/rewards/affiliate\");\n\n useEffect(() => {\n if (props.current) setCurrent(props.current);\n }, [props.current]);\n\n const items = useMemo(() => {\n return [\n {\n name: t(\"common.trading\"),\n href: TradingRewardsLeftSidebarPath.Trading,\n icon: (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.883 1.5c-.166.01-.393.076-.515.173a2 2 0 0 0-.18.173L.918 6.553a.86.86 0 0 0-.168.475c0 .339.232.543.232.543l7.374 8.633c.005.006.269.301.644.296s.64-.29.644-.296l7.402-8.663s.204-.269.204-.513-.196-.517-.196-.517L13.82 1.848c-.023-.032-.076-.021-.103-.049-.033-.038-.037-.091-.077-.124-.123-.097-.267-.106-.413-.123-.04-.005-.063-.049-.103-.049h-.078zm1.745 1.582h4.744L9 5.795zm-1.675.542 2.294 2.615H3.122zm8.094 0 1.831 2.615h-4.125zM3.328 7.818h4.847v5.672zm6.497 0h4.847c-1.151 1.345-3.422 4.007-4.847 5.672z\"\n // fill=\"url(#a)\"\n className=\"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]\"\n />\n <defs>\n <linearGradient\n id=\"a\"\n x1=\"17.25\"\n y1=\"9\"\n x2=\".75\"\n y2=\"9\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"rgb(var(--oui-gradient-brand-end))\" />\n <stop\n offset=\"1\"\n stopColor=\"rgb(var(--oui-gradient-brand-start))\"\n />\n </linearGradient>\n </defs>\n </svg>\n ),\n },\n {\n name: t(\"common.affiliate\"),\n href: TradingRewardsLeftSidebarPath.Affiliate,\n icon: (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.625 4.95c0-.746.604-1.35 1.35-1.35h4.05c.746 0 1.35.604 1.35 1.35v4.62L9 12.195 5.625 9.57zm8.624 3.163-.524.407v-.96l.074.05c.193.128.346.302.45.502m-4.42 5.148L14.4 9.705v3.345a1.35 1.35 0 0 1-1.35 1.35h-8.1a1.35 1.35 0 0 1-1.35-1.35V9.705l4.571 3.556c.488.379 1.17.379 1.658 0M4.275 8.52l-.524-.407c.104-.2.257-.374.45-.503l.074-.049zm0-2.581V4.95a2.7 2.7 0 0 1 2.7-2.7h4.05a2.7 2.7 0 0 1 2.7 2.7v.989l.823.548a2.7 2.7 0 0 1 1.202 2.247v4.316a2.7 2.7 0 0 1-2.7 2.7h-8.1a2.7 2.7 0 0 1-2.7-2.7V8.734a2.7 2.7 0 0 1 1.202-2.247zM9 6.089l.111-.118.005-.005a1.08 1.08 0 0 1 1.58.004 1.223 1.223 0 0 1 0 1.668l-1.515 1.62-.004.004c-.1.102-.26.1-.358-.004l-1.516-1.62a1.223 1.223 0 0 1 0-1.668l.004-.004a1.08 1.08 0 0 1 1.58.004z\"\n className=\"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]\"\n />\n </svg>\n ),\n },\n ];\n }, [t]);\n\n const hideSideBar = useMediaQuery(\"(max-width: 768px)\");\n\n return {\n items,\n current,\n hideSideBar,\n // open: sideOpen,\n // onOpenChange(open) {\n // setSideOpen(open);\n // },\n onItemSelect: (item) => {\n // @ts-ignore\n setCurrent(item.href);\n },\n };\n};\n","import React, { PropsWithChildren } from \"react\";\nimport omit from \"ramda/es/omit\";\nimport { cn } from \"@kodiak-finance/orderly-ui\";\nimport { Scaffold, SideBarProps } from \"@kodiak-finance/orderly-ui-scaffold\";\nimport { ScaffoldProps } from \"@kodiak-finance/orderly-ui-scaffold\";\n\nexport type TradingRewardsLayoutProps = ScaffoldProps & {\n hideSideBar?: boolean;\n items?: SideBarProps[\"items\"];\n};\n\nexport const TradingRewardsLayout: React.FC<\n PropsWithChildren<TradingRewardsLayoutProps>\n> = (props) => {\n const { children, classNames, ...rest } = props;\n return (\n <Scaffold\n leftSidebar={null}\n routerAdapter={props.routerAdapter}\n classNames={{\n ...classNames,\n content: classNames?.content,\n topNavbar: cn(\"oui-bg-base-9\", classNames?.topNavbar),\n leftSidebar: cn(\n \"oui-rounded-xl oui-bg-base-9\",\n \"oui-m-3 oui-p-4\",\n \"oui-border oui-border-line\",\n classNames?.leftSidebar,\n ),\n }}\n {...omit([\"leftSideProps\"], rest)}\n >\n {children}\n </Scaffold>\n );\n};\n\n// type LeftSidebarProps = SideBarProps & {\n// routerAdapter?: RouterAdapter;\n// };\n\n// const LeftSidebar: React.FC<LeftSidebarProps> = (props) => {\n// const { t } = useTranslation();\n// const { expanded, setExpand } = useScaffoldContext();\n// return (\n// <SideBar\n// title={t(\"tradingRewards.rewards\")}\n// {...props}\n// open={expanded}\n// onOpenChange={(open) => setExpand(open)}\n// onItemSelect={(a) => {\n// props.onItemSelect?.(a);\n// props.routerAdapter?.onRouteChange?.({\n// href: a.href || \"\",\n// name: a.name,\n// });\n// }}\n// />\n// );\n// };\n","import { FC, PropsWithChildren } from \"react\";\nimport { ScaffoldProps } from \"@kodiak-finance/orderly-ui-scaffold\";\nimport { useTradingRewardsLayoutScript } from \"./layout.script\";\nimport { TradingRewardsLayout } from \"./layout.ui\";\n\nexport const TradingRewardsLayoutWidget: FC<\n PropsWithChildren<ScaffoldProps>\n> = (props) => {\n const state = useTradingRewardsLayoutScript({\n current: props.leftSideProps?.current,\n });\n return (\n <TradingRewardsLayout {...state} {...props}>\n {props.children}\n </TradingRewardsLayout>\n );\n};\n"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,17 @@
1
+ import { Flex, cn, Box, Text, Divider, ListView, DataTable, Tooltip, usePagination } from '@kodiak-finance/orderly-ui';
2
+ import { useTranslation } from '@kodiak-finance/orderly-i18n';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import O, { createContext, useState, useEffect, useMemo, useContext, useCallback } from 'react';
5
+ import { useMediaQuery, useTradingRewardsStatus, EpochStatus, TWType, useConfig, useGetClaimed, DistributionId, useAllBrokers, useCurEpochEstimate, useWalletRewardsHistory, useEpochInfo, useWalletConnector, useAccount, useGetEnv, ENVType, useAccountRewardsHistory } from '@kodiak-finance/orderly-hooks';
6
+ import { useAppContext, useDataTap } from '@kodiak-finance/orderly-react-app';
7
+ import { AccountStatusEnum, ChainNamespace } from '@kodiak-finance/orderly-types';
8
+ import { commifyOptional, commify, Decimal, getTimestamp } from '@kodiak-finance/orderly-utils';
9
+ import { AuthGuard, AuthGuardEmpty } from '@kodiak-finance/orderly-ui-connector';
10
+ import gr from 'ramda/es/omit';
11
+ import { Scaffold } from '@kodiak-finance/orderly-ui-scaffold';
12
+
13
+ var Gt=Object.defineProperty;var c=(e,t)=>()=>(e&&(t=e(e=0)),t);var V=(e,t)=>{for(var o in t)Gt(e,o,{get:t[o],enumerable:true});};var le,Jt,Te=c(()=>{le=e=>{let{title:t,subtitle:o,content:i,docOpenOptions:a}=e,{t:r}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-title",p:6,direction:"column",itemAlign:"start",gap:4,className:"oui-bg-base-9 oui-font-semibold",r:"2xl",width:"100%",children:[t||jsx(Text,{size:"lg",children:r("common.tradingRewards")}),jsx(Divider,{intensity:8,className:"oui-w-full"}),jsxs(Flex,{direction:"column",itemAlign:"start",gap:1,children:[o||jsx(Text,{size:"base",children:r("tradingRewards.subtitle",{brokerName:e.brokerName})}),i||jsx(Jt,{docOpenOptions:a})]})]})},Jt=e=>{let{t}=useTranslation();return jsxs("div",{className:"oui-text-sm oui-text-base-contrast-54 oui-font-normal oui-flex oui-gap-1 oui-items-center hover:oui-text-primary-darken oui-text-primary-light oui-cursor-pointer",onClick:()=>[window.open(e.docOpenOptions?.url,e.docOpenOptions?.target,e.docOpenOptions?.features)],children:[jsx("span",{className:"oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer",children:t("tradingRewards.learnMore")}),jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4.008 7.995c0-.368.298-.666.666-.666H9.71L7.733 5.331l.937-.936 3.143 3.122c.13.13.195.304.195.479a.67.67 0 0 1-.195.478L8.67 11.596l-.937-.937 1.978-1.998H4.674a.666.666 0 0 1-.666-.666"})})]})};});var it,ce,E,H=c(()=>{it=createContext({}),ce=e=>{let{type:t=TWType.normal,showEpochPauseCountdown:o,titleConfig:i={docOpenOptions:{url:"https://orderly.network/docs/introduction/tokenomics/trading-rewards",target:"_blank"}},children:a}=e,r=useConfig("brokerId"),{statusInfo:n}=useTradingRewardsStatus(t===TWType.mm),d=useGetClaimed(t===TWType.mm?DistributionId.mmOrder:DistributionId.order),g=useGetClaimed(t===TWType.mm?DistributionId.mmEsOrder:DistributionId.esORder),[u]=useAllBrokers(),[w]=useCurEpochEstimate(t),f=useWalletRewardsHistory(t),C=useEpochInfo(t),b=useMemo(()=>u?.[r],[r,u]),L=useMemo(()=>({type:t,totalOrderClaimedReward:d,totalEsOrderClaimedReward:g,epochList:C,curEpochEstimate:w,walletRewardsHistory:f,titleConfig:i,brokerId:r,brokerName:b,brokers:u,statusInfo:n,showEpochPauseCountdown:o??false}),[t,d,g,C,w,f,i,r,b,u,n,o]);return jsx(it.Provider,{value:L,children:a})},E=()=>useContext(it);});var at,st=c(()=>{H();at=()=>{let{titleConfig:e}=E();return e};});var nt={};V(nt,{TitleWidget:()=>ye});var ye,Ne=c(()=>{st();Te();ye=()=>{let e=at();return jsx(le,{...e})};});var Y,Se=c(()=>{H();Y=()=>{let{epochList:e,curEpochEstimate:t,brokerId:o,brokerName:i,statusInfo:a,showEpochPauseCountdown:r}=E(),{wrongNetwork:n,disabledConnect:d}=useAppContext(),{connect:g}=useWalletConnector(),{state:u}=useAccount(),w=useMemo(()=>u.status<=AccountStatusEnum.SignedIn||n||d,[u,n,d]),f=useMemo(()=>u.status<=AccountStatusEnum.SignedIn||d,[u,d]),C=useMemo(()=>{if(typeof t>"u"||t===null)return;let b=t.rows.filter(S=>S.broker_id!==o).reduce((S,_)=>S+_.est_r_account,0),L=Number(t.est_r_wallet)-b;return {brokerName:i,curRewards:L,otherRewards:b}},[o,i,t]);return {epochList:e,estimate:t,hideData:w,notConnected:f,connect:g,rewardsTooltip:w?void 0:C,statusInfo:a,showEpochPauseCountdown:r}};});var k,K=c(()=>{k=e=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:[jsxs("g",{clipPath:"url(#clip0_862_2449)",children:[jsx("path",{d:"M10.0249 19.9361C15.5202 19.9361 19.9751 15.4813 19.9751 9.98589C19.9751 4.49052 15.5202 0.0356445 10.0249 0.0356445C4.52949 0.0356445 0.0746155 4.49052 0.0746155 9.98589C0.0746155 15.4813 4.52949 19.9361 10.0249 19.9361Z",fill:"url(#paint0_linear_862_2449)"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.0992 5.0347C14.1824 5.0347 14.2202 4.93253 14.1556 4.88017C13.0272 3.96625 11.59 3.41876 10.0249 3.41876C8.4598 3.41876 7.02258 3.96625 5.89428 4.88017C5.82963 4.93253 5.86743 5.0347 5.95063 5.0347H14.0992ZM7.2658 11.6648C7.34763 11.6648 7.42329 11.707 7.47028 11.7739C8.03421 12.5781 8.96819 13.1038 10.025 13.1038C11.0817 13.1038 12.0156 12.5781 12.5796 11.7739C12.6266 11.707 12.7022 11.6648 12.7841 11.6648H16.2198C16.2985 11.6648 16.3559 11.7395 16.334 11.8151C15.5419 14.5521 13.0171 16.5531 10.0249 16.5531C7.03275 16.5531 4.50795 14.5521 3.71578 11.8151C3.6939 11.7395 3.75127 11.6648 3.83 11.6648H7.2658ZM12.335 7.8919C12.3825 7.94426 12.4493 7.97581 12.5199 7.97581H16.114C16.1955 7.97581 16.2533 7.89653 16.2264 7.81972C15.9727 7.0936 15.5951 6.42564 15.119 5.84118C15.0743 5.78631 15.007 5.75526 14.9361 5.75526H5.11354C5.04279 5.75526 4.97543 5.78631 4.93075 5.84118C4.4546 6.42564 4.07701 7.0936 3.82337 7.81972C3.79653 7.89653 3.8543 7.97581 3.93567 7.97581H7.52983C7.60053 7.97581 7.66725 7.94426 7.71477 7.8919C8.28522 7.263 9.10892 6.86807 10.0249 6.86807C10.9408 6.86807 11.7646 7.263 12.335 7.8919ZM13.028 10.8273C13.0114 10.8862 13.0549 10.9458 13.116 10.9458H16.4447C16.4894 10.9458 16.5273 10.913 16.5333 10.8688C16.572 10.5798 16.5921 10.285 16.5921 9.98539C16.5921 9.56935 16.5534 9.1623 16.4795 8.76771C16.4716 8.72551 16.4345 8.6952 16.3916 8.6952H13.0042C12.9388 8.6952 12.895 8.763 12.9195 8.82377C13.0636 9.18276 13.1429 9.57477 13.1429 9.98529C13.1429 10.277 13.1029 10.5595 13.028 10.8273ZM6.9338 10.9458C6.99492 10.9458 7.03829 10.8862 7.02183 10.8273C6.94688 10.5595 6.90682 10.277 6.90682 9.98529C6.90682 9.57477 6.98617 9.18276 7.13037 8.82377C7.15477 8.763 7.11101 8.6952 7.04553 8.6952H3.65817C3.61522 8.6952 3.5782 8.72551 3.5703 8.76771C3.49631 9.1623 3.45761 9.56935 3.45761 9.98539C3.45761 10.285 3.47767 10.5798 3.51651 10.8688C3.52246 10.913 3.56045 10.9458 3.60511 10.9458H6.9338Z",fill:"url(#paint1_linear_862_2449)"})]}),jsxs("defs",{children:[jsxs("linearGradient",{id:"paint0_linear_862_2449",x1:"10.0249",y1:"-2.24058",x2:"10.0249",y2:"21.2774",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"white"}),jsx("stop",{offset:"1",stopColor:"#EDE9F4"})]}),jsxs("linearGradient",{id:"paint1_linear_862_2449",x1:"10.0249",y1:"3.41876",x2:"10.0249",y2:"16.5531",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"#C750FF"}),jsx("stop",{offset:"1",stopColor:"#5800E8"})]}),jsx("clipPath",{id:"clip0_862_2449",children:jsx("rect",{width:"20",height:"20",fill:"white"})})]})]});});var F,X=c(()=>{F=e=>jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e.className,children:[jsxs("g",{clipPath:"url(#clip0_862_2443)",children:[jsx("path",{d:"M10.0249 19.9491C15.5202 19.9491 19.9751 15.4942 19.9751 9.99883C19.9751 4.50346 15.5202 0.048584 10.0249 0.048584C4.52949 0.048584 0.0746155 4.50346 0.0746155 9.99883C0.0746155 15.4942 4.52949 19.9491 10.0249 19.9491Z",fill:"url(#paint0_linear_862_2443)"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.1556 4.8931C14.2202 4.94547 14.1824 5.04764 14.0992 5.04764H5.95063C5.86743 5.04764 5.82963 4.94547 5.89428 4.8931C7.02258 3.97918 8.4598 3.4317 10.0249 3.4317C11.59 3.4317 13.0272 3.97918 14.1556 4.8931Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.47028 11.7869C7.4233 11.7199 7.34764 11.6777 7.26581 11.6777H3.83C3.75128 11.6777 3.69391 11.7525 3.71579 11.8281C4.50796 14.565 7.03275 16.566 10.0249 16.566C13.0171 16.566 15.5419 14.565 16.334 11.8281C16.3559 11.7525 16.2985 11.6777 16.2198 11.6777H12.7841C12.7022 11.6777 12.6266 11.7199 12.5796 11.7869C12.0156 12.5911 11.0817 13.1167 10.025 13.1167C8.96818 13.1167 8.03421 12.5911 7.47028 11.7869Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.335 7.90476C12.3825 7.95713 12.4493 7.98867 12.5199 7.98867H16.114C16.1955 7.98867 16.2533 7.9094 16.2264 7.83259C15.9727 7.10647 15.5951 6.43851 15.119 5.85405C15.0743 5.79918 15.007 5.76813 14.9361 5.76813H5.11354C5.04278 5.76813 4.97543 5.79918 4.93074 5.85405C4.45459 6.43851 4.07701 7.10647 3.82337 7.83259C3.79652 7.9094 3.85428 7.98867 3.93567 7.98867H7.52982C7.60052 7.98867 7.66725 7.95713 7.71475 7.90476C8.28522 7.27587 9.10892 6.88093 10.0249 6.88093C10.9408 6.88093 11.7646 7.27587 12.335 7.90476Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.116 10.9587C13.0549 10.9587 13.0114 10.8991 13.028 10.8402C13.1029 10.5723 13.1429 10.29 13.1429 9.99822C13.1429 9.5877 13.0636 9.19568 12.9195 8.83669C12.895 8.77593 12.9388 8.70813 13.0042 8.70813H16.3916C16.4345 8.70813 16.4716 8.73843 16.4795 8.78064C16.5534 9.17523 16.5921 9.58228 16.5921 9.99832C16.5921 10.2979 16.572 10.5927 16.5333 10.8816C16.5273 10.9259 16.4894 10.9587 16.4447 10.9587H13.116ZM7.02183 10.8402C7.03829 10.8991 6.99492 10.9587 6.93381 10.9587H3.60511C3.56045 10.9587 3.52246 10.9259 3.51651 10.8816C3.47767 10.5927 3.45761 10.2979 3.45761 9.99832C3.45761 9.58228 3.49631 9.17523 3.5703 8.78064C3.5782 8.73843 3.61523 8.70813 3.65817 8.70813H7.04553C7.11101 8.70813 7.15477 8.77593 7.13037 8.83669C6.98617 9.19568 6.90682 9.5877 6.90682 9.99822C6.90682 10.29 6.94688 10.5723 7.02183 10.8402Z",fill:"white"})]}),jsxs("defs",{children:[jsxs("linearGradient",{id:"paint0_linear_862_2443",x1:"10.0249",y1:"0.0486119",x2:"10.0249",y2:"19.9491",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"#C750FF"}),jsx("stop",{offset:"1",stopColor:"#5800E8"})]}),jsx("clipPath",{id:"clip0_862_2443",children:jsx("rect",{width:"20",height:"20",fill:"white"})})]})]});});var j,Fe=c(()=>{j=e=>{let[t,o]=useState(false),{t:i}=useTranslation();return jsx(Tooltip,{content:jsxs(Flex,{direction:"column",className:"oui-leading-[1.5] oui-text-2xs oui-text-base-contrast-80 oui-min-w-[204px]",gap:1,children:[jsxs(Flex,{gap:1,width:"100%",children:[jsx(Text,{className:"oui-flex-1",children:e.rewardsTooltip?.brokerName}),jsx(Text,{children:commifyOptional(e.rewardsTooltip?.curRewards,{fix:2})})]}),jsxs(Flex,{gap:1,width:"100%",children:[jsx(Text,{className:"oui-flex-1",children:i("tradingRewards.otherOrderlyDex")}),jsx(Text,{children:commifyOptional(e.rewardsTooltip?.otherRewards,{fix:2})})]})]}),align:e.align,className:e.className,open:t,onOpenChange:o,arrow:{className:e.arrowClassName},delayDuration:100,children:e.children?O.cloneElement(e.children,{onClick:r=>{r.preventDefault(),o(!t);}}):jsx("svg",{width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"oui-cursor-pointer",onClick:r=>{r.preventDefault(),o(!t);},children:jsx("path",{d:"M10.5 1.678a8.333 8.333 0 1 0-.001 16.667 8.333 8.333 0 0 0 0-16.667m0 4.167a.833.833 0 1 1-.001 1.667.833.833 0 0 1 0-1.667m0 2.5c.46 0 .832.373.832.833v4.167a.833.833 0 0 1-1.666 0V9.178c0-.46.373-.833.833-.833",fill:"#fff",fillOpacity:".36"})})})};});var te,wo,ct,mt,pt,ho,Co,Oe=c(()=>{K();X();Fe();te=e=>{let{t}=useTranslation(),o=e,i=o.epochList?.[1].curEpochInfo,a=o.epochList?.[0],r=i?.start_time,n=i?.end_time,d=i?.epoch_id,g=i?.max_reward_amount,u=i?.epoch_token,w=i?`${i?.epoch_token}`.toLowerCase()==="order":void 0,f=useMemo(()=>{if(!e.showEpochPauseCountdown||!a||e.statusInfo?.epochStatus!==EpochStatus.paused)return;let b=e.statusInfo?.lastCompletedEpoch;if(b===void 0)return;let L=b+1;return a.find(_=>_.epoch_id===L)?.start_time},[e.statusInfo?.epochStatus,a]),C=useMemo(()=>e.statusInfo?.epochStatus===EpochStatus.paused&&f,[e.statusInfo?.epochStatus,f]);return e.statusInfo?.epochStatus!==EpochStatus.active?jsx(Flex,{id:"oui-tradingRewards-home-currentEpoch",r:"2xl",className:"oui-bg-base-9 oui-font-semibold oui-p-10",width:"100%",height:"100%",direction:"column",itemAlign:"stretch",children:jsxs(Flex,{gap:2,direction:"column",justify:"center",itemAlign:"center",className:"oui-size-full",children:[C?jsxs(Flex,{gap:2,direction:"column",justify:"center",itemAlign:"center",children:[jsx(Text,{className:"oui-text-base-contrast-54 oui-text-sm",children:t("tradingRewards.epochPauseCountdown.title")}),jsx(mt,{targetTimestamp:f,isStandalone:true})]}):jsx(Flex,{className:"oui-text-base-contrast-54 oui-text-sm oui-text-center",justify:"center",itemAlign:"center",children:e.statusInfo?.epochStatus===EpochStatus.paused?t("tradingRewards.eopchStatus.pause"):t("tradingRewards.eopchStatus.ended")}),e.statusInfo?.epochStatus===EpochStatus.paused&&jsx("div",{className:cn("oui-w-full",C?"oui-mt-2":"oui-mt-0"),children:jsx(Co,{})})]})}):jsxs(Flex,{id:"oui-tradingRewards-home-currentEpoch",r:"2xl",className:"oui-bg-base-9 oui-font-semibold",width:"100%",height:"100%",direction:"column",itemAlign:"stretch",children:[jsx(mt,{targetTimestamp:n}),jsxs(Flex,{p:6,direction:"column",gap:4,className:"oui-h-full",children:[jsxs(Flex,{direction:"row",gap:3,width:"100%",justify:"around",children:[jsx(ct,{title:t("tradingRewards.epoch"),highLight:d?`${d}`:"--",text:r&&n?`${pt(r)} - ${pt(n)}`:""}),jsx(ct,{title:t("tradingRewards.epochRewards"),highLight:commifyOptional(g,{fix:0}),text:u})]}),jsx(wo,{isOrder:w,direction:o.notConnected?"row":"column",justify:o.notConnected?"between":"center",hideData:o.hideData,estRewards:o.hideData?"--":e.estimate?.est_r_wallet,rewardsTooltip:e.rewardsTooltip,background:o.notConnected?"linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%)":"linear-gradient(0deg, #2D0061 2.62%, #BD6BED 86.5%)"}),jsx("div",{className:"oui-w-full",children:jsx(AuthGuard,{status:AccountStatusEnum.SignedIn,buttonProps:{fullWidth:true},children:jsx(Fragment,{})})})]})]})},wo=e=>{let{t}=useTranslation();return jsxs(Flex,{direction:e.direction,gap:2,py:4,px:6,width:"100%",r:"xl",itemAlign:"center",justify:e.justify,style:{background:e.background},className:"oui-flex-1 oui-h-full",children:[jsx(Text,{className:"oui-text-base xl:oui-text-lg oui-text-base-contrast-54",children:t("tradingRewards.myEstRewards")}),jsxs(Flex,{direction:"row",gap:3,children:[e.isOrder==true&&jsx(F,{className:"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8"}),e.isOrder==false&&jsx(k,{className:"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8"}),jsx(Text,{children:commifyOptional(e.estRewards,{fix:2}),className:"oui-text-xl md:oui-text-2xl xl:oui-text-[32px]"}),e.rewardsTooltip&&jsx(j,{rewardsTooltip:e.rewardsTooltip})]})]})},ct=e=>{let{title:t,highLight:o,text:i}=e;return jsxs(Flex,{py:2,justify:"between",direction:"column",className:"flex-1",gap:2,children:[jsx(Text,{className:cn("oui-text-base-contrast-54","oui-text-xs md:oui-text-sm xl:oui-text-base","oui-leading-[20px] xl:oui-leading-[24px]"),children:t}),jsxs(Flex,{direction:"row",gap:1,itemAlign:"end",justify:"center",children:[jsx(Text.gradient,{color:"brand",angle:90,className:"oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl",children:o}),jsx(Text,{intensity:80,className:"oui-mb-[3px] oui-text-2xs md:oui-text-xs xl:oui-text-sm",children:i})]})]})},mt=e=>{let{targetTimestamp:t,isStandalone:o}=e,{t:i}=useTranslation(),[a,r]=useState({days:0,hours:0,minutes:0,seconds:0});useEffect(()=>{let d=setInterval(()=>{if(typeof t>"u")return;let g=new Date().getTime(),u=t-g;if(u<0)clearInterval(d),r({days:0,hours:0,minutes:0,seconds:0});else {let w=Math.floor(u/864e5),f=Math.floor(u%(1e3*60*60*24)/(1e3*60*60)),C=Math.floor(u%(1e3*60*60)/(1e3*60)),b=Math.floor(u%(1e3*60)/1e3);r({days:w,hours:f,minutes:C,seconds:b});}},1e3);return ()=>clearInterval(d)},[t]);let n=d=>jsx(Text,{className:"oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg ",children:d});return jsx(Box,{className:"oui-rounded-t-2xl oui-font-semibold oui-text-base-contrast-54",gradient:o?void 0:"neutral",angle:180,width:"full",children:jsxs(Flex,{justify:"center",gap:1,children:[o?null:jsx("span",{children:`${i("common.countdown")}: `}),jsxs(Flex,{direction:"row",itemAlign:"end",gap:1,className:cn("oui-text-2xs md:oui-text-xs lg:oui-text-sm",o?"oui-py-0":"oui-py-[13px]"),children:[n(`${a.days}`.padStart(2,"0")),jsx("span",{children:"D"}),n(`${a.hours}`.padStart(2,"0")),jsx("span",{children:"H"}),n(`${a.minutes}`.padStart(2,"0")),jsx("span",{children:"M"}),n(`${a.seconds}`.padStart(2,"0")),jsx("span",{children:"S"})]})]})})},pt=e=>{if(!e)return "";let t=new Date(e),i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getUTCMonth()],a=t.getUTCDate();return `${i}. ${a}`},ho=e=>jsxs("svg",{width:"21",height:"20",viewBox:"0 0 21 20",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[jsx("mask",{id:"mask0_1997_45723",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"21",height:"20",children:jsx("rect",{x:"0.5",width:"20",height:"20",fill:"#D9D9D9"})}),jsx("g",{mask:"url(#mask0_1997_45723)",children:jsx("path",{d:"M12.0384 14.7111L11.1603 13.8073L14.343 10.6246H4.25V9.37463H14.343L11.1603 6.19192L12.0384 5.28809L16.75 9.99961L12.0384 14.7111Z"})})]}),Co=()=>{let{t:e}=useTranslation();return jsxs(Flex,{gap:1,itemAlign:"center",justify:"center",className:"oui-group oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80",onClick:()=>window.open("https://x.com/OrderlyNetwork"),children:[jsx("div",{className:"oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80",children:e("tradingRewards.eopchStatus.linkDescription")}),jsx(ho,{className:"oui-text-fill-base-contrast-36 oui-fill-base-contrast-36 group-hover:oui-fill-base-contrast-80"})]})};});var Pe,xt=c(()=>{Se();Oe();Pe=()=>{let e=Y();return jsx(te,{...e})};});var gt={};V(gt,{CurEpoch:()=>te,CurEpochWidget:()=>Pe,useCurEpochScript:()=>Y});var Ie=c(()=>{xt();Oe();Se();});var bt,Rt=c(()=>{H();bt=()=>{let{totalOrderClaimedReward:e,walletRewardsHistory:t,totalEsOrderClaimedReward:o}=E(),[i]=e,[a]=o,{namespace:r}=useWalletConnector(),[n]=t,d=useMemo(()=>r===ChainNamespace.evm?n?.wallet_lifetime_trading_rewards_order:n?.wallet_pending_trading_rewards_order,[r,n]),g=useMemo(()=>r===ChainNamespace.evm?n?.wallet_lifetime_trading_rewards_escrow:n?.wallet_pending_trading_rewards_escrow,[n,r]),u=useGetEnv(),w=_=>{let $=`https://${u!==ENVType.prod?`${u}-`:""}app.orderly.network/tradingRewards`;window.open($,"_blank");},f=useCallback((_,$)=>{if(typeof $<"u"&&typeof _<"u"){let h=new Decimal(_).sub($).toFixed(18,Decimal.ROUND_DOWN);return Number(h)}},[]),C=useMemo(()=>f(d,i),[d,i,f]),b=useMemo(()=>f(g,a),[g,a,f]),L=useDataTap(C),S=useDataTap(b);return {order:L??void 0,esOrder:S??void 0,goToClaim:w}};});var ge,Le=c(()=>{ge=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",children:jsx("path",{d:"M11.3275 13.9938C12.8001 13.9938 13.9941 12.7998 13.9941 11.3272V4.66049C13.9941 3.18782 12.8001 1.99382 11.3275 1.99382H4.66081C3.18814 1.99382 1.99414 3.18782 1.99414 4.66049V11.3272C1.99414 12.7998 3.18814 13.9938 4.66081 13.9938H11.3275ZM5.99414 10.6605C5.82347 10.6605 5.64548 10.6031 5.51481 10.4732C5.25481 10.2125 5.25481 9.77516 5.51481 9.51449L8.18148 6.84782L6.66081 5.32715H10.6608V9.32715L9.14014 7.80648L6.47347 10.4732C6.34347 10.6031 6.16481 10.6605 5.99414 10.6605Z"})});});var oe,yt,He=c(()=>{Le();K();X();oe=e=>{let{t}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-availableToClaim",p:6,r:"2xl",direction:"column",gap:4,width:"100%",className:" oui-font-semibold oui-bg-base-9 ",children:[jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:t("tradingRewards.availableClaim")}),jsxs(Flex,{direction:"row",gap:1,onClick:e.goToClaim,className:"oui-cursor-pointer oui-text-primary-light",children:[jsx(Text,{size:"sm",children:t("tradingRewards.claim")}),jsx(ge,{})]})]}),jsxs(Flex,{direction:"row",gap:3,width:"100%",children:[jsx(yt,{title:"ORDER",value:e.order}),jsx(yt,{title:"esORDER",value:e.esOrder,isEsOrder:true})]})]})},yt=e=>{let{value:t}=e;return jsxs(Flex,{className:"oui-flex-1 oui-bg-base-8 oui-py-[11px]",direction:"column",gap:2,r:"xl",gradient:"neutral",angle:180,border:true,borderColor:6,children:[jsx(Text,{className:"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54",children:e.title}),jsxs(Flex,{direction:"row",gap:1,children:[e.isEsOrder?jsx(k,{}):jsx(F,{}),jsx(Text,{className:"oui-text-sm xl:oui-text-base",children:commifyOptional(t,{fix:2})})]})]})};});var Me,Nt=c(()=>{Rt();He();Me=()=>{let e=bt();return jsx(oe,{...e})};});var vt={};V(vt,{AvailableToClaim:()=>oe,AvailableToClaimWidget:()=>Me});var Ae=c(()=>{Nt();He();});var St,_t=c(()=>{H();St=()=>{let{curEpochEstimate:e}=E(),t=useGetEnv(),o=r=>{let n=`https://${t!==ENVType.prod?`${t}-`:""}app.orderly.network/staking`;window.open(n,"_blank");},i=useDataTap(e),a=useMemo(()=>{let r=e?.est_stake_boost;if(!(typeof r>"u"||r===null))return r===0?r:new Decimal(r).div(new Decimal(10).pow(.15)).toDecimalPlaces(2,Decimal.ROUND_DOWN).toString()},[e?.est_stake_boost]);return {curEpochEstimate:i??void 0,stakeNow:o,booster:a}};});var Ft,Et=c(()=>{Ft=()=>jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M14.439 10.5672C14.0868 10.9198 13.7025 11.2403 13.3183 11.5287C13.1902 11.6248 13.1261 11.721 13.0941 11.8812C12.7739 13.1952 12.1015 14.4451 11.0448 15.5027C10.5645 15.9835 10.0522 16.3681 9.47584 16.7206C8.99553 17.009 8.41917 16.5283 8.61129 15.9835C8.93149 15.1502 9.05957 14.2528 9.05957 13.3234C8.99553 13.3234 8.89947 13.3555 8.83543 13.3555C8.06695 12.7145 7.3625 12.0415 6.65805 11.3364C5.95361 10.6313 5.28118 9.89421 4.64078 9.15708C4.64078 9.09299 4.6728 8.99684 4.6728 8.93274C3.74421 8.93274 2.84764 9.09299 2.01512 9.38143C1.50279 9.57372 0.990469 8.99684 1.27865 8.51611C1.63087 7.93923 2.01512 7.42645 2.49542 6.94572C3.55209 5.88811 4.80088 5.21508 6.11371 4.89459C6.24179 4.86255 6.36987 4.7664 6.46593 4.67025C6.75412 4.25362 7.07432 3.90108 7.42654 3.54855C9.92412 1.04874 13.4143 0.183422 16.6484 0.920545C16.8725 0.984642 17.0326 1.14489 17.0967 1.36923C17.8011 4.57411 16.9366 8.06742 14.439 10.5672ZM13.0301 4.95869C12.2616 4.18952 10.9808 4.18952 10.2123 4.95869C9.44382 5.72786 9.44382 7.00982 10.2123 7.77899C10.9808 8.54816 12.2616 8.54816 13.0301 7.77899C13.8306 6.97777 13.8306 5.72786 13.0301 4.95869ZM5.88957 14.7656C5.28118 15.3745 1.53481 17.9385 0.798348 17.2013C0.0618817 16.4642 2.6235 12.7145 3.23189 12.1056C3.84027 11.4966 4.92896 11.5928 5.66543 12.3299C6.40189 13.067 6.49795 14.1567 5.88957 14.7656Z",fill:"url(#paint0_linear_88_1748)"}),jsx("defs",{children:jsxs("linearGradient",{id:"paint0_linear_88_1748",x1:"17.3331",y1:"8.99996",x2:"0.666504",y2:"8.99996",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"rgb(var(--oui-gradient-brand-end))"}),jsx("stop",{offset:"1",stopColor:"rgb(var(--oui-gradient-brand-start))"})]})})]});});var ie,Ot,Be=c(()=>{Le();K();X();Et();ie=e=>{let{t}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-stakeBooster",p:6,r:"2xl",direction:"column",gap:4,width:"100%",className:" oui-font-semibold oui-bg-base-9 ",children:[jsxs(Flex,{direction:"row",justify:"between",width:"100%",children:[jsx(Text,{className:"oui-text-lg",children:t("tradingRewards.stakeBooster")}),jsxs(Flex,{direction:"row",gap:1,onClick:e.stakeNow,className:"oui-cursor-pointer oui-text-primary-light",children:[jsx(Text,{size:"sm",children:t("tradingRewards.stake")}),jsx(ge,{})]})]}),jsxs(Flex,{direction:"row",gap:3,width:"100%",children:[jsx(Ot,{title:t("tradingRewards.avgStakedAmount"),value:e.curEpochEstimate?.est_avg_stake,icon:jsxs("div",{className:"oui-flex oui-w-[32px] oui-h-[20px] oui-relative",children:[jsx("div",{className:"oui-absolute oui-right-0 oui-top-0",children:jsx(k,{})}),jsx("div",{className:"oui-absolute oui-left-0 oui-top-0 ",children:jsx(F,{})})]})}),jsx(Ot,{title:t("tradingRewards.booster"),value:e.booster,icon:jsx(Ft,{}),gradient:true})]})]})},Ot=e=>{let t=commify(e.value||"--",2);return jsxs(Flex,{className:"oui-flex-1 oui-bg-base-8 oui-py-[11px]",direction:"column",gap:2,r:"xl",gradient:"neutral",angle:180,border:true,borderColor:6,children:[jsx(Text,{className:"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54",children:e.title}),jsxs(Flex,{direction:"row",gap:1,children:[e.icon,e.gradient?jsx(Text.gradient,{className:"oui-text-sm xl:oui-text-base",color:"brand",angle:90,children:t+(t==="--"?"":"x")}):jsx(Text,{className:"oui-text-sm xl:oui-text-base",children:commifyOptional(e.value,{fix:2})})]})]})};});var We,Pt=c(()=>{_t();Be();We=()=>{let e=St();return jsx(ie,{...e})};});var It={};V(It,{StakeBooster:()=>ie,StakeBoosterWidget:()=>We});var ze=c(()=>{Pt();Be();});function A(e){if(typeof e>"u")return {firstPart:"-",secondPart:""};let t=new Date(e),i=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][t.getUTCMonth()],a=t.getUTCDate().toString().padStart(2,"0"),r=t.getUTCFullYear(),n=t.getUTCHours(),d=t.getUTCMinutes(),g=n>=12?"PM":"AM",u=(n%12).toString().padStart(2,"0"),w=d.toString().padStart(2,"0");return {firstPart:`${i} ${a}, ${r}`,secondPart:`${u}:${w} ${g}`}}var ae,Uo,Go,Zo,Ve=c(()=>{K();X();Fe();ae=e=>{let{t}=useTranslation();return jsxs(Flex,{id:"oui-tradingRewards-home-rewardHistory",py:4,px:3,direction:"column",gap:2,itemAlign:"start",r:"2xl",className:"oui-bg-base-9 oui-w-full oui-font-semibold oui-tabular-nums",children:[jsx(Text,{className:"oui-text-lg oui-px-3",children:t("tradingRewards.rewardHistory")}),jsx("div",{className:"oui-border-t-2 oui-border-line-4 oui-w-full",children:jsx(Uo,{...e})})]})},Uo=e=>useMediaQuery("(max-width: 767px)")?jsx(ListView,{dataSource:e.originalData,renderItem:(o,i)=>jsx(Go,{data:o}),className:"oui-mt-3 oui-max-h-[356px]"}):jsx(Box,{px:3,children:jsx(Zo,{...e})}),Go=e=>{let{data:t}=e,{t:o}=useTranslation(),i=`${t?.info?.epoch_token||t.epoch_token}`.toLowerCase()==="order",a=commifyOptional(t.info?.r_wallet,{fix:2});return jsxs(Flex,{direction:"column",px:4,pt:0,gap:3,className:"oui-text-base-contrast-80",children:[jsxs(Flex,{direction:"row",width:"100%",children:[jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.epoch")}),jsx(Text,{className:"oui-text-sm",children:`Epoch ${t.epoch_id}`})]}),jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsxs(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:[o("tradingRewards.epochRewards")," "]}),jsxs(Flex,{gap:1,children:[i?jsx(F,{}):jsx(k,{}),jsx(Text,{className:"oui-text-sm",children:commifyOptional(t.max_reward_amount,{fix:2})})]})]}),jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"end",children:[jsxs(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:[o("tradingRewards.rewardsEarned")," "]}),jsxs(Flex,{gap:1,children:[a!=="--"&&(i?jsx(F,{}):jsx(k,{})),t.rewardsTooltip?jsx(j,{rewardsTooltip:t.rewardsTooltip,children:jsx(Text,{className:"oui-text-sm oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16",children:a}),align:"center",className:"oui-bg-base-5",arrowClassName:"oui-fill-base-5"}):jsx(Text,{className:"oui-text-sm",children:a})]})]})]}),jsxs(Flex,{direction:"row",width:"100%",children:[jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"start",children:[jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.rewardHistory.column.startDate")}),jsxs(Flex,{direction:"row",children:[jsxs(Text,{className:"oui-text-sm",children:[A(t.start_time).firstPart,"\xA0"]}),jsx(Text,{className:"oui-text-2xs oui-text-base-contrast-36",children:A(t.start_time).secondPart})]})]}),jsxs(Flex,{direction:"column",className:"oui-gap-[6px] oui-flex-1",itemAlign:"end",children:[jsx(Text,{className:"oui-text-base-contrast-36 oui-text-2xs",children:o("tradingRewards.rewardHistory.column.endDate")}),jsxs(Flex,{direction:"row",children:[jsxs(Text,{className:"oui-text-sm",children:[A(t.end_time).firstPart,"\xA0"]}),jsx(Text,{className:"oui-text-2xs oui-text-base-contrast-36",children:A(t.end_time).secondPart})]})]})]}),jsx(Divider,{className:"oui-w-full"})]},t.epoch_id)},Zo=e=>{let{data:t}=e,{t:o}=useTranslation(),i=[{title:o("tradingRewards.epoch"),dataIndex:"epoch_id",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:a=>jsx(Text,{children:`${o("tradingRewards.epoch")} ${a}`})},{title:o("tradingRewards.rewardHistory.column.start&EndDate"),dataIndex:"time",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>jsxs(Flex,{direction:"column",className:"oui-gap-[2px]",justify:"start",itemAlign:"start",children:[jsxs(Flex,{direction:"row",gap:1,children:[jsx(Text,{children:A(r.start_time).firstPart}),jsx(Text,{className:"oui-text-base-contrast-54",children:A(r.start_time).secondPart})]}),jsxs(Flex,{direction:"row",gap:1,children:[jsx(Text,{children:A(r.end_time).firstPart}),jsx(Text,{className:"oui-text-base-contrast-54",children:A(r.end_time).secondPart})]})]})},{title:o("tradingRewards.epochRewards"),dataIndex:"max_reward_amount",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>{let n=`${r?.info?.epoch_token||r.epoch_token}`.toLowerCase()==="order";return jsxs(Flex,{direction:"row",gap:1,children:[n?jsx(F,{}):jsx(k,{}),jsx(Text,{children:commifyOptional(a)})]})}},{title:o("tradingRewards.rewardsEarned"),dataIndex:"earned",className:"oui-w-1/4 oui-pl-0 oui-pr-0",render:(a,r)=>{let n=`${r?.info?.epoch_token||r.epoch_token}`.toLowerCase()==="order",d=jsx(Text,{className:r.rewardsTooltip?"oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16":"",children:commifyOptional(r.info?.r_wallet,{fix:2})});return r.rewardsTooltip&&(d=jsx(j,{rewardsTooltip:r.rewardsTooltip,children:d,align:"center",className:"oui-bg-base-5",arrowClassName:"oui-fill-base-5"})),jsxs(Flex,{direction:"row",gap:1,children:[n?jsx(F,{}):jsx(k,{}),d]})}}];return jsx(DataTable,{bordered:true,columns:i,loading:e.isLoading,dataSource:t,emptyView:jsx(AuthGuardEmpty,{status:AccountStatusEnum.SignedIn}),onRow:a=>({className:"oui-h-[59px]"}),pagination:e.pagination})};});var Lt,Ht=c(()=>{H();Lt=()=>{let{account:e}=useAccount(),{epochList:t,walletRewardsHistory:o,totalOrderClaimedReward:i,brokerId:a,brokerName:r}=E(),n=t?.[0],{isNotStared:d}=t?.[1],[g]=o,{wrongNetwork:u,disabledConnect:w}=useAppContext(),{data:f}=useAccountRewardsHistory(e.address),C=useMemo(()=>{if(d||w)return [];let S=[...n||[]].map(h=>{let R=h.epoch_id,Q=g?.rows.findIndex(se=>R===se.epoch_id),qe;if(Q!==-1&&!u){let se=g?.rows?.[Q],be=f?.findIndex(ne=>ne?.epoch_id===h.epoch_id);if(f!==void 0&&be!==void 0&&be!==-1){let ne=f[be].broker,Ke=ne.findIndex(Ut=>Ut.broker_id===a),Xe=(Ke!==-1?ne[Ke]:void 0)?.r_account??0,Vt=Math.max(0,(se?.r_wallet??0)-Xe);qe={brokerName:r,curRewards:Xe,otherRewards:Vt};}return {...h,info:se,rewardsTooltip:qe}}return {...h}});S.sort((h,R)=>h.epoch_id-R.epoch_id);let[_]=i;if(typeof _<"u")for(let h=0;h<S.length;h++){let R=S[h];if(typeof R?.info>"u"){R.state="Null";continue}let Q=R.info?.reward_status;Q==="Confirmed"?(_-R.info?.r_wallet>=0?R.state="Claimed":R.state="Claimable",_-=R.info?.r_wallet):Q==="Pending"&&(R.state="Processing");}S.sort((h,R)=>R.epoch_id-h.epoch_id);let $=getTimestamp();return S.filter(h=>h.end_time<=$)},[g,n,i,d,u,f,w]),{pagination:b}=usePagination();return {data:C,originalData:C,pagination:b,isLoading:t[1].isLoading}};});var Ue,Mt=c(()=>{Ht();Ve();Ue=()=>{let e=Lt();return jsx(ae,{...e})};});var At={};V(At,{RewardHistory:()=>ae,RewardsHistoryWidget:()=>Ue});var Ge=c(()=>{Ve();Mt();});var Bt={};V(Bt,{AvailableToClaim:()=>oe,AvailableToClaimWidget:()=>Me,CurEpoch:()=>te,CurEpochWidget:()=>Pe,HomePage:()=>Dt,RewardHistory:()=>ae,RewardsHistoryWidget:()=>Ue,StakeBooster:()=>ie,StakeBoosterWidget:()=>We,Title:()=>le,TitleWidget:()=>ye,TradingRewardsProvider:()=>ce,useCurEpochScript:()=>Y});Te();Ne();Ie();Ae();ze();Ge();H();H();var ar=O.lazy(()=>Promise.resolve().then(()=>(Ne(),nt)).then(e=>({default:e.TitleWidget}))),sr=O.lazy(()=>Promise.resolve().then(()=>(Ie(),gt)).then(e=>({default:e.CurEpochWidget}))),nr=O.lazy(()=>Promise.resolve().then(()=>(Ae(),vt)).then(e=>({default:e.AvailableToClaimWidget}))),lr=O.lazy(()=>Promise.resolve().then(()=>(ze(),It)).then(e=>({default:e.StakeBoosterWidget}))),dr=O.lazy(()=>Promise.resolve().then(()=>(Ge(),At)).then(e=>({default:e.RewardsHistoryWidget}))),ur=()=>{let{statusInfo:e}=useTradingRewardsStatus(false);return useMemo(()=>e?.epochStatus===EpochStatus.active,[e?.epochStatus])?jsx(O.Suspense,{fallback:null,children:jsx(lr,{})}):null},Dt=e=>jsx(ce,{titleConfig:e.titleConfig,showEpochPauseCountdown:e.showEpochPauseCountdown,children:jsxs(Flex,{id:"oui-tradingRewards-home-page",className:cn("oui-h-lvw oui-w-full",e.className),direction:"column",gap:4,children:[jsx(O.Suspense,{fallback:null,children:jsx(ar,{})}),jsxs(Flex,{className:"oui-flex oui-size-full oui-flex-col oui-gap-4 2xl:oui-flex-row 2xl:oui-items-stretch",children:[jsx(Box,{className:"oui-w-full 2xl:oui-size-auto 2xl:oui-flex-1",children:jsx(O.Suspense,{fallback:null,children:jsx(sr,{})})}),jsxs(Flex,{className:"oui-flex oui-w-full oui-flex-col oui-gap-4 lg:oui-flex-row 2xl:oui-flex-1 2xl:oui-flex-col",children:[jsx(O.Suspense,{fallback:null,children:jsx(nr,{})}),jsx(ur,{})]})]}),jsx(O.Suspense,{fallback:null,children:jsx(dr,{})})]})});var zt=(o=>(o.Trading="/rewards/trading",o.Affiliate="/rewards/affiliate",o))(zt||{}),Qe=e=>{let{t}=useTranslation(),[o,i]=useState(e.current||"/rewards/affiliate");useEffect(()=>{e.current&&i(e.current);},[e.current]);let a=useMemo(()=>[{name:t("common.trading"),href:"/rewards/trading",icon:jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M4.883 1.5c-.166.01-.393.076-.515.173a2 2 0 0 0-.18.173L.918 6.553a.86.86 0 0 0-.168.475c0 .339.232.543.232.543l7.374 8.633c.005.006.269.301.644.296s.64-.29.644-.296l7.402-8.663s.204-.269.204-.513-.196-.517-.196-.517L13.82 1.848c-.023-.032-.076-.021-.103-.049-.033-.038-.037-.091-.077-.124-.123-.097-.267-.106-.413-.123-.04-.005-.063-.049-.103-.049h-.078zm1.745 1.582h4.744L9 5.795zm-1.675.542 2.294 2.615H3.122zm8.094 0 1.831 2.615h-4.125zM3.328 7.818h4.847v5.672zm6.497 0h4.847c-1.151 1.345-3.422 4.007-4.847 5.672z",className:"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"}),jsx("defs",{children:jsxs("linearGradient",{id:"a",x1:"17.25",y1:"9",x2:".75",y2:"9",gradientUnits:"userSpaceOnUse",children:[jsx("stop",{stopColor:"rgb(var(--oui-gradient-brand-end))"}),jsx("stop",{offset:"1",stopColor:"rgb(var(--oui-gradient-brand-start))"})]})})]})},{name:t("common.affiliate"),href:"/rewards/affiliate",icon:jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.625 4.95c0-.746.604-1.35 1.35-1.35h4.05c.746 0 1.35.604 1.35 1.35v4.62L9 12.195 5.625 9.57zm8.624 3.163-.524.407v-.96l.074.05c.193.128.346.302.45.502m-4.42 5.148L14.4 9.705v3.345a1.35 1.35 0 0 1-1.35 1.35h-8.1a1.35 1.35 0 0 1-1.35-1.35V9.705l4.571 3.556c.488.379 1.17.379 1.658 0M4.275 8.52l-.524-.407c.104-.2.257-.374.45-.503l.074-.049zm0-2.581V4.95a2.7 2.7 0 0 1 2.7-2.7h4.05a2.7 2.7 0 0 1 2.7 2.7v.989l.823.548a2.7 2.7 0 0 1 1.202 2.247v4.316a2.7 2.7 0 0 1-2.7 2.7h-8.1a2.7 2.7 0 0 1-2.7-2.7V8.734a2.7 2.7 0 0 1 1.202-2.247zM9 6.089l.111-.118.005-.005a1.08 1.08 0 0 1 1.58.004 1.223 1.223 0 0 1 0 1.668l-1.515 1.62-.004.004c-.1.102-.26.1-.358-.004l-1.516-1.62a1.223 1.223 0 0 1 0-1.668l.004-.004a1.08 1.08 0 0 1 1.58.004z",className:"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]"})})}],[t]),r=useMediaQuery("(max-width: 768px)");return {items:a,current:o,hideSideBar:r,onItemSelect:n=>{i(n.href);}}};var Ye=e=>{let{children:t,classNames:o,...i}=e;return jsx(Scaffold,{leftSidebar:null,routerAdapter:e.routerAdapter,classNames:{...o,content:o?.content,topNavbar:cn("oui-bg-base-9",o?.topNavbar),leftSidebar:cn("oui-rounded-xl oui-bg-base-9","oui-m-3 oui-p-4","oui-border oui-border-line",o?.leftSidebar)},...gr(["leftSideProps"],i),children:t})};var Cr=e=>{let t=Qe({current:e.leftSideProps?.current});return jsx(Ye,{...t,...e,children:e.children})};
14
+
15
+ export { Bt as TradingRewards, Ye as TradingRewardsLayout, Cr as TradingRewardsLayoutWidget, zt as TradingRewardsLeftSidebarPath, Qe as useTradingRewardsLayoutScript };
16
+ //# sourceMappingURL=out.js.map
17
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/pages/index/title/title.ui.tsx","../src/pages/index/provider.tsx","../src/pages/index/title/title.script.tsx","../src/pages/index/title/title.widget.tsx","../src/pages/index/curEpoch/curEpoch.script.tsx","../src/pages/index/components/esOrderlyIcon.tsx","../src/pages/index/components/orderlyIcon.tsx","../src/pages/index/curEpoch/rewardsTooltip.tsx","../src/pages/index/curEpoch/curEpoch.ui.tsx","../src/pages/index/curEpoch/curEpoch.widget.tsx","../src/pages/index/curEpoch/index.ts","../src/pages/index/availableToClaim/availableToClaim.script.tsx","../src/pages/index/components/jumpIcon.tsx","../src/pages/index/availableToClaim/availableToClaim.ui.tsx","../src/pages/index/availableToClaim/availableToClaim.widget.tsx","../src/pages/index/availableToClaim/index.ts","../src/pages/index/stakeBooster/stakeBooster.script.tsx","../src/pages/index/components/rocket.tsx","../src/pages/index/stakeBooster/stakeBooster.ui.tsx","../src/pages/index/stakeBooster/stakeBooster.widget.tsx","../src/pages/index/stakeBooster/index.ts","../src/pages/index/rewardHistory/rewardsHistory.ui.tsx","../src/pages/index/rewardHistory/rewardsHistory.script.tsx","../src/pages/index/rewardHistory/rewardsHistory.widget.tsx","../src/pages/index/rewardHistory/index.ts","../src/pages/index/index.tsx","../src/pages/index/title/index.ts","../src/pages/index/page.tsx","../src/layout/layout.script.tsx","../src/layout/layout.ui.tsx","../src/layout/layout.widget.tsx"],"names":["Divider","Flex","Text","useTranslation","jsx","jsxs","Title","MultiLineText","init_title_ui","__esmMin","props","title","subtitle","content","docOpenOptions","t","createContext","useContext","useMemo","TWType","useEpochInfo","useAllBrokers","useGetClaimed","DistributionId","useCurEpochEstimate","useWalletRewardsHistory","useConfig","useTradingRewardsStatus","TradingRewardsContext","TradingRewardsProvider","useTradingRewardsContext","init_provider","type","showEpochPauseCountdown","titleConfig","children","brokerId","statusInfo","totalOrderClaimedReward","totalEsOrderClaimedReward","brokers","curEpochEstimate","walletRewardsHistory","epochList","brokerName","memoizedValue","useTitleScript","init_title_script","title_widget_exports","__export","TitleWidget","init_title_widget","state","useAccount","useWalletConnector","useAppContext","AccountStatusEnum","useCurEpochScript","init_curEpoch_script","estimate","wrongNetwork","disabledConnect","connect","hideData","notConnected","rewardsTooltip","otherRewards","item","a","b","curRewards","EsOrderlyIcon","init_esOrderlyIcon","OrderlyIcon","init_orderlyIcon","React","useState","Tooltip","commifyOptional","RewardsTooltip","init_rewardsTooltip","open","setOpen","e","useEffect","EpochStatus","Box","cn","AuthGuard","Fragment","CurEpoch","EstRewards","Statics","Countdown","getDate","ArrowRightIcon","TwitterLInk","init_curEpoch_ui","curEpochInfo","startTime","endTime","curEpochId","max_reward_amount","token","isOrder","pausedEpochTimeDown","lastCompletedEpoch","nextEpoch","showPauseCountdown","highLight","text","targetTimestamp","isStandalone","timeLeft","setTimeLeft","intervalId","now","distance","days","hours","minutes","seconds","num","value","timestamp","date","month","day","CurEpochWidget","init_curEpoch_widget","curEpoch_exports","init_curEpoch","useCallback","useDataTap","Decimal","ChainNamespace","ENVType","useGetEnv","useAvailableScript","init_availableToClaim_script","orderClaimedRewardData","esOrderClaimedRewardData","namespace","data","lifetimeOrderReward","lifetimeEsOrderReward","env","goToClaim","url","calculateRemainingReward","totalReward","claimedReward","remainingReward","availableOrder","availableEsOrder","orderValue","esorderValue","JumpIcon","init_jumpIcon","AvailableToClaim","init_availableToClaim_ui","AvailableToClaimWidget","init_availableToClaim_widget","availableToClaim_exports","init_availableToClaim","useStakeBoosterScript","init_stakeBooster_script","stakeNow","estimateValue","booster","estStakeBoost","RocketIcon","init_rocket","commify","StakeBooster","init_stakeBooster_ui","calcValue","StakeBoosterWidget","init_stakeBooster_widget","stakeBooster_exports","init_stakeBooster","ListView","DataTable","useMediaQuery","AuthGuardEmpty","formatTimestamp","year","amPm","formattedHours","formattedMinutes","RewardHistory","List","MobileCell","DesktopList","init_rewardsHistory_ui","index","r_warret","columns","record","useAccountRewardsHistory","usePagination","getTimestamp","useRewardsHistoryScript","init_rewardsHistory_script","account","epochInfos","isNotStared","history","accountHistory","combineData","id","info","_findIndex","brokerList","curBrokerIndex","i","element","status","curDate","pagination","RewardsHistoryWidget","init_rewardsHistory_widget","rewardHistory_exports","init_rewardHistory","index_exports","HomePage","LazyTitleWidget","mod","LazyCurEpochWidget","LazyAvailableToClaimWidget","LazyStakeBoosterWidget","LazyRewardsHistoryWidget","TradingRewardsLeftSidebarPath","useTradingRewardsLayoutScript","current","setCurrent","items","hideSideBar","omit","Scaffold","TradingRewardsLayout","classNames","rest","TradingRewardsLayoutWidget"],"mappings":"+HAAA,OAAS,WAAAA,GAAS,QAAAC,GAAM,QAAAC,OAAY,6BAGpC,OAAS,kBAAAC,OAAsB,+BAiBf,cAAAC,EAEV,QAAAC,OAFU,oBApBhB,IAKaC,GAgCPC,GArCNC,GAAAC,EAAA,kBAKaH,GAA0BI,GAAU,CAC/C,GAAM,CAAE,MAAAC,EAAO,SAAAC,EAAU,QAAAC,EAAS,eAAAC,CAAe,EAAIJ,EAC/C,CAAE,EAAAK,CAAE,EAAIZ,GAAe,EAE7B,OACEE,GAACJ,GAAA,CACC,GAAG,gCACH,EAAG,EACH,UAAW,SACX,UAAW,QACX,IAAK,EACL,UAAU,kCACV,EAAG,MACH,MAAO,OAEN,UAAAU,GAASP,EAACF,GAAA,CAAK,KAAK,KAAM,SAAAa,EAAE,uBAAuB,EAAE,EACtDX,EAACJ,GAAA,CAAQ,UAAW,EAAG,UAAU,aAAa,EAC9CK,GAACJ,GAAA,CAAK,UAAW,SAAU,UAAW,QAAS,IAAK,EACjD,UAAAW,GACCR,EAACF,GAAA,CAAK,KAAK,OACR,SAAAa,EAAE,0BAA2B,CAC5B,WAAYL,EAAM,UACpB,CAAC,EACH,EAGDG,GAAWT,EAACG,GAAA,CAAc,eAAgBO,EAAgB,GAC7D,GACF,CAEJ,EAEMP,GAMAG,GAAU,CACd,GAAM,CAAE,CAAE,EAAIP,GAAe,EAgC7B,OACE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iFACZ,EACF,CAEJ,CACF,EACC,CAAC,CAAC,CAAC,EAEAyO,EAActD,GAAc,oBAAoB,EAEtD,MAAO,CACL,MAAAqD,EACA,QAAAF,EACA,YAAAG,EAKA,aAAe1K,GAAS,CAEtBwK,EAAWxK,EAAK,IAAI,CACtB,CACF,CACF,EChGA,OAAO2K,OAAU,gBACjB,OAAS,MAAAvJ,OAAU,6BACnB,OAAS,YAAAwJ,OAA8B,sCAanC,cAAA3O,OAAA,oBALG,IAAM4O,GAERtO,GAAU,CACb,GAAM,CAAE,SAAAyB,EAAU,WAAA8M,EAAY,GAAGC,CAAK,EAAIxO,EAC1C,OACEN,GAAC2O,GAAA,CACC,YAAa,KACb,cAAerO,EAAM,cACrB,WAAY,CACV,GAAGuO,EACH,QAASA,GAAY,QACrB,UAAW1J,GAAG,gBAAiB0J,GAAY,SAAS,EACpD,YAAa1J,GACX,+BACA,kBACA,6BACA0J,GAAY,WACd,CACF,EACC,GAAGH,GAAK,CAAC,eAAe,EAAGI,CAAI,EAE/B,SAAA/M,EACH,CAEJ,ECvBI,cAAA/B,OAAA,oBAPG,IAAM+O,GAERzO,GAAU,CACb,IAAM0C,EAAQqL,GAA8B,CAC1C,QAAS/N,EAAM,eAAe,OAChC,CAAC,EACD,OACEN,GAAC4O,GAAA,CAAsB,GAAG5L,EAAQ,GAAG1C,EAClC,SAAAA,EAAM,SACT,CAEJ","sourcesContent":["import { Divider, Flex, Text } from \"@kodiak-finance/orderly-ui\";\nimport { FC } from \"react\";\nimport { TitleConfig } from \"./title.script\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const Title: FC<TitleConfig> = (props) => {\n const { title, subtitle, content, docOpenOptions } = props;\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-title\"\n p={6}\n direction={\"column\"}\n itemAlign={\"start\"}\n gap={4}\n className=\"oui-bg-base-9 oui-font-semibold\"\n r={\"2xl\"}\n width={\"100%\"}\n >\n {title || <Text size=\"lg\">{t(\"common.tradingRewards\")}</Text>}\n <Divider intensity={8} className=\"oui-w-full\" />\n <Flex direction={\"column\"} itemAlign={\"start\"} gap={1}>\n {subtitle || (\n <Text size=\"base\">\n {t(\"tradingRewards.subtitle\", {\n brokerName: props.brokerName,\n })}\n </Text>\n )}\n\n {content || <MultiLineText docOpenOptions={docOpenOptions} />}\n </Flex>\n </Flex>\n );\n};\n\nconst MultiLineText: FC<{\n docOpenOptions?: {\n url?: string;\n target?: string;\n features?: string;\n };\n}> = (props) => {\n const { t } = useTranslation();\n\n // const clickableParts = [\n // {\n // content: \"Learn more here\",\n // isLink: true,\n // },\n // // {\n // // content: \"about Orderly Trading rewards Program.\",\n // // isLink: false,\n // // },\n // // {\n // // content: \"Trading rewards Docs\",\n // // isLink: true,\n // // },\n // ];\n // const renderText = () => {\n // return clickableParts.map((item, index) => {\n // return (\n // <span\n // key={index}\n // className={`${\n // item.isLink\n // ? \"oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer\"\n // : \"\"\n // }`}\n // dangerouslySetInnerHTML={{ __html: item.content }}\n // />\n // );\n // });\n // };\n\n return (\n <div\n className=\"oui-text-sm oui-text-base-contrast-54 oui-font-normal oui-flex oui-gap-1 oui-items-center hover:oui-text-primary-darken oui-text-primary-light oui-cursor-pointer\"\n onClick={() => [\n window.open(\n props.docOpenOptions?.url,\n props.docOpenOptions?.target,\n props.docOpenOptions?.features\n ),\n ]}\n >\n <span className=\"oui-text-primary-light hover:oui-text-primary-darken oui-cursor-pointer\">\n {t(\"tradingRewards.learnMore\")}\n </span>\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M4.008 7.995c0-.368.298-.666.666-.666H9.71L7.733 5.331l.937-.936 3.143 3.122c.13.13.195.304.195.479a.67.67 0 0 1-.195.478L8.67 11.596l-.937-.937 1.978-1.998H4.674a.666.666 0 0 1-.666-.666\" />\n </svg>\n </div>\n );\n};\n\nexport default MultiLineText;\n","import React, {\n PropsWithChildren,\n createContext,\n useContext,\n useMemo,\n} from \"react\";\nimport {\n TWType,\n EpochInfoType,\n useEpochInfo,\n useAllBrokers,\n useGetClaimed,\n DistributionId,\n useCurEpochEstimate,\n CurrentEpochEstimate,\n useWalletRewardsHistory,\n WalletRewardsHistoryReturns,\n Brokers,\n useConfig,\n useTradingRewardsStatus,\n StatusInfo,\n} from \"@kodiak-finance/orderly-hooks\";\nimport type { TitleConfig } from \"./title/title.script\";\n\nexport type TradingRewardsState = {\n type: TWType;\n brokerId: string;\n brokerName?: string;\n brokers?: Brokers;\n epochList: EpochInfoType;\n totalOrderClaimedReward: [number | undefined, { refresh: () => void }];\n totalEsOrderClaimedReward: [number | undefined, { refresh: () => void }];\n curEpochEstimate?: CurrentEpochEstimate;\n walletRewardsHistory: WalletRewardsHistoryReturns;\n titleConfig: TitleConfig;\n statusInfo: StatusInfo | undefined;\n showEpochPauseCountdown?: boolean;\n};\n\nexport const TradingRewardsContext = createContext<TradingRewardsState>(\n {} as TradingRewardsState,\n);\n\nexport const TradingRewardsProvider: React.FC<\n PropsWithChildren<{\n type?: TWType;\n titleConfig?: TitleConfig;\n showEpochPauseCountdown?: boolean;\n }>\n> = (props) => {\n const {\n type = TWType.normal,\n showEpochPauseCountdown,\n titleConfig = {\n docOpenOptions: {\n url: \"https://orderly.network/docs/introduction/tokenomics/trading-rewards\",\n target: \"_blank\",\n },\n },\n children,\n } = props;\n\n const brokerId = useConfig(\"brokerId\");\n\n const { statusInfo } = useTradingRewardsStatus(type === TWType.mm);\n const totalOrderClaimedReward = useGetClaimed(\n type === TWType.mm ? DistributionId.mmOrder : DistributionId.order,\n );\n const totalEsOrderClaimedReward = useGetClaimed(\n type === TWType.mm ? DistributionId.mmEsOrder : DistributionId.esORder,\n );\n\n const [brokers] = useAllBrokers();\n\n const [curEpochEstimate] = useCurEpochEstimate(type);\n\n const walletRewardsHistory = useWalletRewardsHistory(type);\n\n const epochList = useEpochInfo(type);\n\n const brokerName = useMemo(() => {\n return brokers?.[brokerId];\n }, [brokerId, brokers]);\n\n const memoizedValue = useMemo<TradingRewardsState>(() => {\n return {\n type: type,\n totalOrderClaimedReward,\n totalEsOrderClaimedReward,\n epochList,\n curEpochEstimate,\n walletRewardsHistory,\n titleConfig,\n brokerId,\n brokerName,\n brokers,\n statusInfo,\n showEpochPauseCountdown: showEpochPauseCountdown ?? false,\n };\n }, [\n type,\n totalOrderClaimedReward,\n totalEsOrderClaimedReward,\n epochList,\n curEpochEstimate,\n walletRewardsHistory,\n titleConfig,\n brokerId,\n brokerName,\n brokers,\n statusInfo,\n showEpochPauseCountdown,\n ]);\n\n return (\n <TradingRewardsContext.Provider value={memoizedValue}>\n {children}\n </TradingRewardsContext.Provider>\n );\n};\n\nexport const useTradingRewardsContext = () => {\n return useContext<TradingRewardsState>(TradingRewardsContext);\n};\n","import { ReactNode } from \"react\";\nimport { useTradingRewardsContext } from \"../provider\";\n\nexport type TitleConfig = {\n /// default is `Trading rewards`\n title?: string | ReactNode;\n /// default is `Trade with Orderly’s to earn ORDER.`\n subtitle?: string | ReactNode;\n /// default is `Learn more about Orderly Trading rewards Program in Trading rewards Docs`\n content?: string | ReactNode;\n /// default is { url: 'https://orderly.network/docs/introduction/tokenomics/trading-rewards', target: \"_blank\"}\n docOpenOptions?: {\n url?: string;\n target?: string;\n features?: string;\n };\n brokerName?: string;\n};\n\nexport const useTitleScript = (): TitleConfig => {\n\n const { titleConfig } = useTradingRewardsContext();\n\n return titleConfig;\n};\n","import React from \"react\";\nimport { useTitleScript } from \"./title.script\";\nimport { Title } from \"./title.ui\";\n\nexport const TitleWidget: React.FC = () => {\n const state = useTitleScript();\n return <Title {...state} />;\n};\n","import { useMemo } from \"react\";\nimport { useAccount, useWalletConnector } from \"@kodiak-finance/orderly-hooks\";\nimport { useAppContext } from \"@kodiak-finance/orderly-react-app\";\nimport { AccountStatusEnum } from \"@kodiak-finance/orderly-types\";\nimport { useTradingRewardsContext } from \"../provider\";\nimport { RewardsTooltipProps } from \"./rewardsTooltip\";\n\nexport const useCurEpochScript = () => {\n const {\n epochList,\n curEpochEstimate: estimate,\n brokerId,\n brokerName,\n statusInfo,\n showEpochPauseCountdown,\n } = useTradingRewardsContext();\n const { wrongNetwork, disabledConnect } = useAppContext();\n const { connect } = useWalletConnector();\n const { state } = useAccount();\n\n const hideData = useMemo(() => {\n return (\n state.status <= AccountStatusEnum.SignedIn ||\n wrongNetwork ||\n disabledConnect\n );\n }, [state, wrongNetwork, disabledConnect]);\n\n const notConnected = useMemo(() => {\n return state.status <= AccountStatusEnum.SignedIn || disabledConnect;\n }, [state, disabledConnect]);\n\n const rewardsTooltip = useMemo((): RewardsTooltipProps | undefined => {\n if (typeof estimate === \"undefined\" || estimate === null) return undefined;\n const otherRewards = estimate.rows\n .filter((item) => item.broker_id !== brokerId)\n .reduce((a, b) => a + b.est_r_account, 0);\n const curRewards = Number(estimate.est_r_wallet) - otherRewards;\n return {\n brokerName,\n curRewards,\n otherRewards,\n };\n }, [brokerId, brokerName, estimate]);\n\n return {\n epochList,\n estimate,\n hideData,\n notConnected,\n connect,\n rewardsTooltip: hideData ? undefined : rewardsTooltip,\n statusInfo,\n showEpochPauseCountdown,\n };\n};\n\nexport type CurEpochReturns = ReturnType<typeof useCurEpochScript>;\n","export const EsOrderlyIcon = (props: {className?: string}) => {\n return (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={props.className}\n >\n <g clipPath=\"url(#clip0_862_2449)\">\n <path\n d=\"M10.0249 19.9361C15.5202 19.9361 19.9751 15.4813 19.9751 9.98589C19.9751 4.49052 15.5202 0.0356445 10.0249 0.0356445C4.52949 0.0356445 0.0746155 4.49052 0.0746155 9.98589C0.0746155 15.4813 4.52949 19.9361 10.0249 19.9361Z\"\n fill=\"url(#paint0_linear_862_2449)\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M14.0992 5.0347C14.1824 5.0347 14.2202 4.93253 14.1556 4.88017C13.0272 3.96625 11.59 3.41876 10.0249 3.41876C8.4598 3.41876 7.02258 3.96625 5.89428 4.88017C5.82963 4.93253 5.86743 5.0347 5.95063 5.0347H14.0992ZM7.2658 11.6648C7.34763 11.6648 7.42329 11.707 7.47028 11.7739C8.03421 12.5781 8.96819 13.1038 10.025 13.1038C11.0817 13.1038 12.0156 12.5781 12.5796 11.7739C12.6266 11.707 12.7022 11.6648 12.7841 11.6648H16.2198C16.2985 11.6648 16.3559 11.7395 16.334 11.8151C15.5419 14.5521 13.0171 16.5531 10.0249 16.5531C7.03275 16.5531 4.50795 14.5521 3.71578 11.8151C3.6939 11.7395 3.75127 11.6648 3.83 11.6648H7.2658ZM12.335 7.8919C12.3825 7.94426 12.4493 7.97581 12.5199 7.97581H16.114C16.1955 7.97581 16.2533 7.89653 16.2264 7.81972C15.9727 7.0936 15.5951 6.42564 15.119 5.84118C15.0743 5.78631 15.007 5.75526 14.9361 5.75526H5.11354C5.04279 5.75526 4.97543 5.78631 4.93075 5.84118C4.4546 6.42564 4.07701 7.0936 3.82337 7.81972C3.79653 7.89653 3.8543 7.97581 3.93567 7.97581H7.52983C7.60053 7.97581 7.66725 7.94426 7.71477 7.8919C8.28522 7.263 9.10892 6.86807 10.0249 6.86807C10.9408 6.86807 11.7646 7.263 12.335 7.8919ZM13.028 10.8273C13.0114 10.8862 13.0549 10.9458 13.116 10.9458H16.4447C16.4894 10.9458 16.5273 10.913 16.5333 10.8688C16.572 10.5798 16.5921 10.285 16.5921 9.98539C16.5921 9.56935 16.5534 9.1623 16.4795 8.76771C16.4716 8.72551 16.4345 8.6952 16.3916 8.6952H13.0042C12.9388 8.6952 12.895 8.763 12.9195 8.82377C13.0636 9.18276 13.1429 9.57477 13.1429 9.98529C13.1429 10.277 13.1029 10.5595 13.028 10.8273ZM6.9338 10.9458C6.99492 10.9458 7.03829 10.8862 7.02183 10.8273C6.94688 10.5595 6.90682 10.277 6.90682 9.98529C6.90682 9.57477 6.98617 9.18276 7.13037 8.82377C7.15477 8.763 7.11101 8.6952 7.04553 8.6952H3.65817C3.61522 8.6952 3.5782 8.72551 3.5703 8.76771C3.49631 9.1623 3.45761 9.56935 3.45761 9.98539C3.45761 10.285 3.47767 10.5798 3.51651 10.8688C3.52246 10.913 3.56045 10.9458 3.60511 10.9458H6.9338Z\"\n fill=\"url(#paint1_linear_862_2449)\"\n />\n </g>\n <defs>\n <linearGradient\n id=\"paint0_linear_862_2449\"\n x1=\"10.0249\"\n y1=\"-2.24058\"\n x2=\"10.0249\"\n y2=\"21.2774\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"white\" />\n <stop offset=\"1\" stopColor=\"#EDE9F4\" />\n </linearGradient>\n <linearGradient\n id=\"paint1_linear_862_2449\"\n x1=\"10.0249\"\n y1=\"3.41876\"\n x2=\"10.0249\"\n y2=\"16.5531\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#C750FF\" />\n <stop offset=\"1\" stopColor=\"#5800E8\" />\n </linearGradient>\n <clipPath id=\"clip0_862_2449\">\n <rect width=\"20\" height=\"20\" fill=\"white\" />\n </clipPath>\n </defs>\n </svg>\n );\n};\n","export const OrderlyIcon = (props: {\n className?: string;\n}) => {\n return (\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={props.className}\n >\n <g clipPath=\"url(#clip0_862_2443)\">\n <path\n d=\"M10.0249 19.9491C15.5202 19.9491 19.9751 15.4942 19.9751 9.99883C19.9751 4.50346 15.5202 0.048584 10.0249 0.048584C4.52949 0.048584 0.0746155 4.50346 0.0746155 9.99883C0.0746155 15.4942 4.52949 19.9491 10.0249 19.9491Z\"\n fill=\"url(#paint0_linear_862_2443)\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M14.1556 4.8931C14.2202 4.94547 14.1824 5.04764 14.0992 5.04764H5.95063C5.86743 5.04764 5.82963 4.94547 5.89428 4.8931C7.02258 3.97918 8.4598 3.4317 10.0249 3.4317C11.59 3.4317 13.0272 3.97918 14.1556 4.8931Z\"\n fill=\"white\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M7.47028 11.7869C7.4233 11.7199 7.34764 11.6777 7.26581 11.6777H3.83C3.75128 11.6777 3.69391 11.7525 3.71579 11.8281C4.50796 14.565 7.03275 16.566 10.0249 16.566C13.0171 16.566 15.5419 14.565 16.334 11.8281C16.3559 11.7525 16.2985 11.6777 16.2198 11.6777H12.7841C12.7022 11.6777 12.6266 11.7199 12.5796 11.7869C12.0156 12.5911 11.0817 13.1167 10.025 13.1167C8.96818 13.1167 8.03421 12.5911 7.47028 11.7869Z\"\n fill=\"white\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M12.335 7.90476C12.3825 7.95713 12.4493 7.98867 12.5199 7.98867H16.114C16.1955 7.98867 16.2533 7.9094 16.2264 7.83259C15.9727 7.10647 15.5951 6.43851 15.119 5.85405C15.0743 5.79918 15.007 5.76813 14.9361 5.76813H5.11354C5.04278 5.76813 4.97543 5.79918 4.93074 5.85405C4.45459 6.43851 4.07701 7.10647 3.82337 7.83259C3.79652 7.9094 3.85428 7.98867 3.93567 7.98867H7.52982C7.60052 7.98867 7.66725 7.95713 7.71475 7.90476C8.28522 7.27587 9.10892 6.88093 10.0249 6.88093C10.9408 6.88093 11.7646 7.27587 12.335 7.90476Z\"\n fill=\"white\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M13.116 10.9587C13.0549 10.9587 13.0114 10.8991 13.028 10.8402C13.1029 10.5723 13.1429 10.29 13.1429 9.99822C13.1429 9.5877 13.0636 9.19568 12.9195 8.83669C12.895 8.77593 12.9388 8.70813 13.0042 8.70813H16.3916C16.4345 8.70813 16.4716 8.73843 16.4795 8.78064C16.5534 9.17523 16.5921 9.58228 16.5921 9.99832C16.5921 10.2979 16.572 10.5927 16.5333 10.8816C16.5273 10.9259 16.4894 10.9587 16.4447 10.9587H13.116ZM7.02183 10.8402C7.03829 10.8991 6.99492 10.9587 6.93381 10.9587H3.60511C3.56045 10.9587 3.52246 10.9259 3.51651 10.8816C3.47767 10.5927 3.45761 10.2979 3.45761 9.99832C3.45761 9.58228 3.49631 9.17523 3.5703 8.78064C3.5782 8.73843 3.61523 8.70813 3.65817 8.70813H7.04553C7.11101 8.70813 7.15477 8.77593 7.13037 8.83669C6.98617 9.19568 6.90682 9.5877 6.90682 9.99822C6.90682 10.29 6.94688 10.5723 7.02183 10.8402Z\"\n fill=\"white\"\n />\n </g>\n <defs>\n <linearGradient\n id=\"paint0_linear_862_2443\"\n x1=\"10.0249\"\n y1=\"0.0486119\"\n x2=\"10.0249\"\n y2=\"19.9491\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#C750FF\" />\n <stop offset=\"1\" stopColor=\"#5800E8\" />\n </linearGradient>\n <clipPath id=\"clip0_862_2443\">\n <rect width=\"20\" height=\"20\" fill=\"white\" />\n </clipPath>\n </defs>\n </svg>\n );\n };\n ","import React, { FC, useState } from \"react\";\nimport { Flex, Text, Tooltip } from \"@kodiak-finance/orderly-ui\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport type RewardsTooltipProps = {\n brokerName: string | undefined;\n curRewards: number;\n otherRewards: number;\n};\n\nexport const RewardsTooltip: FC<{\n rewardsTooltip?: RewardsTooltipProps;\n children?: React.ReactElement;\n className?: string;\n arrowClassName?: string;\n align?: \"start\" | \"center\" | \"end\";\n}> = (props) => {\n const [open, setOpen] = useState(false);\n const { t } = useTranslation();\n\n const content = (): any => {\n return (\n <Flex\n direction={\"column\"}\n className=\"oui-leading-[1.5] oui-text-2xs oui-text-base-contrast-80 oui-min-w-[204px]\"\n gap={1}\n >\n <Flex gap={1} width={\"100%\"}>\n <Text className=\"oui-flex-1\">{props.rewardsTooltip?.brokerName}</Text>\n <Text>\n {commifyOptional(props.rewardsTooltip?.curRewards, { fix: 2 })}\n </Text>\n </Flex>\n <Flex gap={1} width={\"100%\"}>\n <Text className=\"oui-flex-1\">\n {t(\"tradingRewards.otherOrderlyDex\")}\n </Text>\n <Text>\n {commifyOptional(props.rewardsTooltip?.otherRewards, { fix: 2 })}\n </Text>\n </Flex>\n </Flex>\n );\n };\n\n return (\n <Tooltip\n content={content()}\n align={props.align}\n className={props.className}\n open={open}\n onOpenChange={setOpen}\n arrow={{\n className: props.arrowClassName,\n }}\n delayDuration={100}\n >\n {!!props.children ? (\n React.cloneElement(props.children!, {\n onClick: (e: any) => {\n e.preventDefault();\n setOpen(!open);\n },\n })\n ) : (\n <svg\n width=\"21\"\n height=\"20\"\n viewBox=\"0 0 21 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"oui-cursor-pointer\"\n onClick={(e) => {\n e.preventDefault();\n setOpen(!open);\n }}\n >\n <path\n d=\"M10.5 1.678a8.333 8.333 0 1 0-.001 16.667 8.333 8.333 0 0 0 0-16.667m0 4.167a.833.833 0 1 1-.001 1.667.833.833 0 0 1 0-1.667m0 2.5c.46 0 .832.373.832.833v4.167a.833.833 0 0 1-1.666 0V9.178c0-.46.373-.833.833-.833\"\n fill=\"#fff\"\n fillOpacity=\".36\"\n />\n </svg>\n )}\n </Tooltip>\n );\n};\n","import { useState, useEffect, FC, ReactNode, SVGProps, useMemo } from \"react\";\nimport { EpochStatus } from \"@kodiak-finance/orderly-hooks\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\nimport { AccountStatusEnum } from \"@kodiak-finance/orderly-types\";\nimport { Box, Flex, Text, cn } from \"@kodiak-finance/orderly-ui\";\nimport { AuthGuard } from \"@kodiak-finance/orderly-ui-connector\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { CurEpochReturns } from \"./curEpoch.script\";\nimport { RewardsTooltip } from \"./rewardsTooltip\";\n\nexport const CurEpoch: FC<CurEpochReturns> = (props) => {\n const { t } = useTranslation();\n\n const state = props;\n const curEpochInfo = state.epochList?.[1].curEpochInfo;\n const epochList = state.epochList?.[0];\n const startTime = curEpochInfo?.start_time;\n const endTime = curEpochInfo?.end_time;\n const curEpochId = curEpochInfo?.epoch_id;\n const max_reward_amount = curEpochInfo?.max_reward_amount;\n const token = curEpochInfo?.epoch_token;\n\n const isOrder = curEpochInfo\n ? `${curEpochInfo?.epoch_token}`.toLowerCase() === \"order\"\n : undefined;\n\n const pausedEpochTimeDown = useMemo(() => {\n if (!props.showEpochPauseCountdown) {\n return undefined;\n }\n if (!epochList || props.statusInfo?.epochStatus !== EpochStatus.paused) {\n return undefined;\n }\n\n const lastCompletedEpoch = props.statusInfo?.lastCompletedEpoch;\n if (lastCompletedEpoch === undefined) {\n return undefined;\n }\n const nextEpoch = lastCompletedEpoch + 1;\n const epoch = epochList.find((item: any) => item.epoch_id === nextEpoch);\n return epoch?.start_time;\n }, [props.statusInfo?.epochStatus, epochList]);\n\n const showPauseCountdown = useMemo(() => {\n return (\n props.statusInfo?.epochStatus === EpochStatus.paused &&\n pausedEpochTimeDown\n );\n }, [props.statusInfo?.epochStatus, pausedEpochTimeDown]);\n\n if (props.statusInfo?.epochStatus !== EpochStatus.active) {\n return (\n <Flex\n id=\"oui-tradingRewards-home-currentEpoch\"\n r={\"2xl\"}\n className=\"oui-bg-base-9 oui-font-semibold oui-p-10\"\n width={\"100%\"}\n height={\"100%\"}\n direction={\"column\"}\n // justify={\"stretch\"}\n itemAlign={\"stretch\"}\n >\n <Flex\n gap={2}\n direction={\"column\"}\n justify={\"center\"}\n itemAlign={\"center\"}\n className=\"oui-size-full\"\n >\n {showPauseCountdown ? (\n <Flex\n gap={2}\n direction={\"column\"}\n justify={\"center\"}\n itemAlign={\"center\"}\n >\n <Text className=\"oui-text-base-contrast-54 oui-text-sm\">\n {t(\"tradingRewards.epochPauseCountdown.title\")}\n </Text>\n <Countdown targetTimestamp={pausedEpochTimeDown} isStandalone />\n </Flex>\n ) : (\n <Flex\n className=\"oui-text-base-contrast-54 oui-text-sm oui-text-center\"\n justify={\"center\"}\n itemAlign={\"center\"}\n >\n {props.statusInfo?.epochStatus === EpochStatus.paused\n ? t(\"tradingRewards.eopchStatus.pause\")\n : t(\"tradingRewards.eopchStatus.ended\")}\n </Flex>\n )}\n {props.statusInfo?.epochStatus === EpochStatus.paused && (\n <div\n className={cn(\n \"oui-w-full\",\n showPauseCountdown ? \"oui-mt-2\" : \"oui-mt-0\",\n )}\n >\n <TwitterLInk />\n </div>\n )}\n </Flex>\n </Flex>\n );\n }\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-currentEpoch\"\n r={\"2xl\"}\n className=\"oui-bg-base-9 oui-font-semibold\"\n width={\"100%\"}\n height={\"100%\"}\n direction={\"column\"}\n // justify={\"stretch\"}\n itemAlign={\"stretch\"}\n >\n <Countdown targetTimestamp={endTime} />\n <Flex p={6} direction={\"column\"} gap={4} className=\"oui-h-full\">\n <Flex direction={\"row\"} gap={3} width={\"100%\"} justify={\"around\"}>\n <Statics\n title={t(\"tradingRewards.epoch\")}\n highLight={curEpochId ? `${curEpochId}` : \"--\"}\n text={\n startTime && endTime\n ? `${getDate(startTime)} - ${getDate(endTime)}`\n : \"\"\n }\n />\n <Statics\n title={t(\"tradingRewards.epochRewards\")}\n highLight={commifyOptional(max_reward_amount, { fix: 0 })}\n text={token}\n />\n </Flex>\n <EstRewards\n isOrder={isOrder}\n direction={state.notConnected ? \"row\" : \"column\"}\n justify={state.notConnected ? \"between\" : \"center\"}\n hideData={state.hideData}\n estRewards={state.hideData ? \"--\" : props.estimate?.est_r_wallet}\n rewardsTooltip={props.rewardsTooltip}\n background={\n state.notConnected\n ? \"linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%)\"\n : \"linear-gradient(0deg, #2D0061 2.62%, #BD6BED 86.5%)\"\n }\n />\n {/* {state.notConnected && (\n <Button\n variant=\"gradient\"\n fullWidth\n onClick={(e) => {\n e.stopPropagation();\n state.connect();\n }}\n >\n Connect wallet\n </Button>\n )} */}\n\n <div className=\"oui-w-full\">\n <AuthGuard\n status={AccountStatusEnum.SignedIn}\n buttonProps={{ fullWidth: true }}\n >\n <></>\n </AuthGuard>\n </div>\n </Flex>\n </Flex>\n );\n};\n\nconst EstRewards: FC<{\n isOrder?: boolean;\n estRewards?: number | string;\n direction: \"row\" | \"column\";\n justify: \"center\" | \"between\";\n background: string;\n hideData: boolean;\n rewardsTooltip:\n | {\n brokerName: string | undefined;\n curRewards: number;\n otherRewards: number;\n }\n | undefined;\n}> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n direction={props.direction}\n gap={2}\n py={4}\n px={6}\n width={\"100%\"}\n r=\"xl\"\n itemAlign={\"center\"}\n justify={props.justify}\n style={{\n background: props.background,\n }}\n className=\"oui-flex-1 oui-h-full\"\n >\n <Text className=\"oui-text-base xl:oui-text-lg oui-text-base-contrast-54\">\n {t(\"tradingRewards.myEstRewards\")}\n </Text>\n <Flex direction={\"row\"} gap={3}>\n {props.isOrder == true && (\n <OrderlyIcon className=\"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8\" />\n )}\n {props.isOrder == false && (\n <EsOrderlyIcon className=\"oui-w-5 oui-h-5 md:oui-w-6 md:oui-h-6 lg:oui-w-7 lg:oui-h-7 xl:oui-w-8 xl:oui-h-8\" />\n )}\n <Text\n children={commifyOptional(props.estRewards, { fix: 2 })}\n className=\"oui-text-xl md:oui-text-2xl xl:oui-text-[32px]\"\n />\n {props.rewardsTooltip && (\n <RewardsTooltip rewardsTooltip={props.rewardsTooltip} />\n )}\n </Flex>\n </Flex>\n );\n};\n\nconst Statics: FC<{\n title: string;\n highLight?: string;\n text?: string;\n}> = (props) => {\n const { title, highLight, text } = props;\n return (\n <Flex\n // px={1}\n py={2}\n justify={\"between\"}\n direction={\"column\"}\n className=\"flex-1\"\n gap={2}\n >\n <Text\n className={cn(\n \"oui-text-base-contrast-54\",\n // font size\n \"oui-text-xs md:oui-text-sm xl:oui-text-base\",\n /// leading\n \"oui-leading-[20px] xl:oui-leading-[24px]\",\n )}\n >\n {title}\n </Text>\n <Flex direction={\"row\"} gap={1} itemAlign={\"end\"} justify={\"center\"}>\n <Text.gradient\n color=\"brand\"\n angle={90}\n className=\"oui-text-base md:oui-text-lg lg:oui-text-xl xl:oui-text-2xl\"\n >\n {highLight}\n </Text.gradient>\n <Text\n intensity={80}\n className=\"oui-mb-[3px] oui-text-2xs md:oui-text-xs xl:oui-text-sm\"\n >\n {text}\n </Text>\n </Flex>\n </Flex>\n );\n};\n\nconst Countdown: FC<{\n targetTimestamp?: number;\n isStandalone?: boolean;\n}> = (props) => {\n const { targetTimestamp, isStandalone } = props;\n const { t } = useTranslation();\n const [timeLeft, setTimeLeft] = useState({\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n });\n\n useEffect(() => {\n const intervalId = setInterval(() => {\n if (typeof targetTimestamp === \"undefined\") return;\n const now = new Date().getTime();\n const distance = targetTimestamp - now;\n\n if (distance < 0) {\n clearInterval(intervalId as unknown as number);\n setTimeLeft({\n days: 0,\n hours: 0,\n minutes: 0,\n seconds: 0,\n });\n } else {\n const days = Math.floor(distance / (1000 * 60 * 60 * 24));\n const hours = Math.floor(\n (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60),\n );\n const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));\n const seconds = Math.floor((distance % (1000 * 60)) / 1000);\n\n setTimeLeft({ days, hours, minutes, seconds });\n }\n }, 1000);\n\n return () => clearInterval(intervalId as unknown as number);\n }, [targetTimestamp]);\n\n const num = (value: string) => {\n return (\n <Text className=\"oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg \">\n {value}\n </Text>\n );\n };\n\n return (\n <Box\n className=\"oui-rounded-t-2xl oui-font-semibold oui-text-base-contrast-54\"\n gradient={isStandalone ? undefined : \"neutral\"}\n angle={180}\n width={\"full\"}\n >\n <Flex justify={\"center\"} gap={1}>\n {isStandalone ? null : <span>{`${t(\"common.countdown\")}: `}</span>}\n <Flex\n direction={\"row\"}\n itemAlign={\"end\"}\n gap={1}\n className={cn(\n \"oui-text-2xs md:oui-text-xs lg:oui-text-sm\",\n isStandalone ? \"oui-py-0\" : \"oui-py-[13px]\",\n )}\n >\n {num(`${timeLeft.days}`.padStart(2, \"0\"))}\n <span>D</span>\n {num(`${timeLeft.hours}`.padStart(2, \"0\"))}\n <span>H</span>\n {num(`${timeLeft.minutes}`.padStart(2, \"0\"))}\n <span>M</span>\n {num(`${timeLeft.seconds}`.padStart(2, \"0\"))}\n <span>S</span>\n </Flex>\n </Flex>\n </Box>\n );\n};\n\nconst CountDownNum = (props: { children?: ReactNode }) => {\n return (\n <Text className=\"oui-text-sm oui-text-base-contrast md:oui-text-base lg:oui-text-lg \">\n {props.children}\n </Text>\n );\n};\n\nconst getDate = (timestamp?: number) => {\n if (!timestamp) return \"\";\n\n const date = new Date(timestamp);\n\n // return format(timestamp, \"MMM. d\");\n\n const monthNames = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ];\n const month = monthNames[date.getUTCMonth()];\n const day = date.getUTCDate();\n return `${month}. ${day}`;\n};\n\nexport const ArrowRightIcon: FC<SVGProps<SVGSVGElement>> = (props) => (\n <svg\n width=\"21\"\n height=\"20\"\n viewBox=\"0 0 21 20\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n {...props}\n >\n <mask\n id=\"mask0_1997_45723\"\n style={{ maskType: \"alpha\" }}\n maskUnits=\"userSpaceOnUse\"\n x=\"0\"\n y=\"0\"\n width=\"21\"\n height=\"20\"\n >\n <rect x=\"0.5\" width=\"20\" height=\"20\" fill=\"#D9D9D9\" />\n </mask>\n <g mask=\"url(#mask0_1997_45723)\">\n <path\n d=\"M12.0384 14.7111L11.1603 13.8073L14.343 10.6246H4.25V9.37463H14.343L11.1603 6.19192L12.0384 5.28809L16.75 9.99961L12.0384 14.7111Z\"\n // fill=\"black\"\n // fill-opacity=\"0.8\"\n />\n </g>\n </svg>\n);\nconst TwitterLInk: FC = () => {\n const { t } = useTranslation();\n return (\n <Flex\n gap={1}\n itemAlign={\"center\"}\n justify={\"center\"}\n className=\"oui-group oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80\"\n onClick={() => window.open(\"https://x.com/OrderlyNetwork\")}\n >\n <div className=\"oui-cursor-pointer oui-fill-base-contrast-36 oui-text-sm oui-text-base-contrast-36 group-hover:oui-text-base-contrast-80\">\n {t(\"tradingRewards.eopchStatus.linkDescription\")}\n </div>\n <ArrowRightIcon className=\"oui-text-fill-base-contrast-36 oui-fill-base-contrast-36 group-hover:oui-fill-base-contrast-80\" />\n </Flex>\n );\n};\n","import { FC } from \"react\";\nimport { useCurEpochScript } from \"./curEpoch.script\";\nimport { CurEpoch } from \"./curEpoch.ui\";\n\nexport const CurEpochWidget: FC = () => {\n const state = useCurEpochScript();\n return <CurEpoch {...state} />;\n};\n","export { CurEpochWidget } from \"./curEpoch.widget\";\nexport { CurEpoch } from \"./curEpoch.ui\";\nexport { useCurEpochScript } from \"./curEpoch.script\";\n","import { useCallback, useMemo } from \"react\";\nimport { useDataTap } from \"@kodiak-finance/orderly-react-app\";\nimport { Decimal } from \"@kodiak-finance/orderly-utils\";\nimport { ChainNamespace } from \"@kodiak-finance/orderly-types\";\nimport { ENVType, useGetEnv, useWalletConnector } from \"@kodiak-finance/orderly-hooks\";\nimport { useTradingRewardsContext } from \"../provider\";\n\nexport type AvailableReturns = {\n order?: number;\n esOrder?: number;\n goToClaim?: (e: any) => void;\n};\n\nexport const useAvailableScript = (): AvailableReturns => {\n const {\n totalOrderClaimedReward,\n walletRewardsHistory,\n totalEsOrderClaimedReward,\n } = useTradingRewardsContext();\n const [orderClaimedRewardData] = totalOrderClaimedReward;\n const [esOrderClaimedRewardData] = totalEsOrderClaimedReward;\n\n const { namespace } = useWalletConnector();\n\n const [data] = walletRewardsHistory;\n\n const lifetimeOrderReward = useMemo(() => {\n if (namespace === ChainNamespace.evm) {\n return data?.wallet_lifetime_trading_rewards_order;\n }\n return data?.wallet_pending_trading_rewards_order;\n }, [namespace, data]);\n\n const lifetimeEsOrderReward = useMemo(() => {\n if (namespace === ChainNamespace.evm) {\n return data?.wallet_lifetime_trading_rewards_escrow;\n }\n return data?.wallet_pending_trading_rewards_escrow;\n }, [data, namespace]);\n\n const env = useGetEnv();\n const goToClaim = (e: any) => {\n const url = `https://${\n env !== ENVType.prod ? `${env}-` : \"\"\n }app.orderly.network/tradingRewards`;\n window.open(url, \"_blank\");\n };\n\n const calculateRemainingReward = useCallback(\n (totalReward: string | undefined, claimedReward: number | undefined) => {\n if (\n typeof claimedReward !== \"undefined\" &&\n typeof totalReward !== \"undefined\"\n ) {\n const remainingReward = new Decimal(totalReward)\n .sub(claimedReward)\n .toFixed(18, Decimal.ROUND_DOWN);\n return Number(remainingReward);\n }\n return undefined;\n },\n []\n );\n\n const availableOrder = useMemo(\n () => calculateRemainingReward(lifetimeOrderReward, orderClaimedRewardData),\n [lifetimeOrderReward, orderClaimedRewardData, calculateRemainingReward]\n );\n\n const availableEsOrder = useMemo(\n () =>\n calculateRemainingReward(lifetimeEsOrderReward, esOrderClaimedRewardData),\n [lifetimeEsOrderReward, esOrderClaimedRewardData, calculateRemainingReward]\n );\n\n const orderValue = useDataTap<number | undefined>(availableOrder);\n const esorderValue = useDataTap<number | undefined>(availableEsOrder);\n return {\n order: orderValue ?? undefined,\n esOrder: esorderValue ?? undefined,\n goToClaim,\n };\n};\n","export const JumpIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n // fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n >\n <path\n d=\"M11.3275 13.9938C12.8001 13.9938 13.9941 12.7998 13.9941 11.3272V4.66049C13.9941 3.18782 12.8001 1.99382 11.3275 1.99382H4.66081C3.18814 1.99382 1.99414 3.18782 1.99414 4.66049V11.3272C1.99414 12.7998 3.18814 13.9938 4.66081 13.9938H11.3275ZM5.99414 10.6605C5.82347 10.6605 5.64548 10.6031 5.51481 10.4732C5.25481 10.2125 5.25481 9.77516 5.51481 9.51449L8.18148 6.84782L6.66081 5.32715H10.6608V9.32715L9.14014 7.80648L6.47347 10.4732C6.34347 10.6031 6.16481 10.6605 5.99414 10.6605Z\"\n \n />\n </svg>\n );\n};\n","import { Flex, Text } from \"@kodiak-finance/orderly-ui\";\nimport { JumpIcon } from \"../components/jumpIcon\";\nimport { FC } from \"react\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { AvailableReturns } from \"./availableToClaim.script\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const AvailableToClaim: FC<AvailableReturns> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-availableToClaim\"\n p={6}\n r=\"2xl\"\n direction={\"column\"}\n gap={4}\n width={\"100%\"}\n className=\" oui-font-semibold oui-bg-base-9 \"\n >\n <Flex direction={\"row\"} justify={\"between\"} width={\"100%\"}>\n <Text className=\"oui-text-lg\">\n {t(\"tradingRewards.availableClaim\")}\n </Text>\n <Flex\n direction={\"row\"}\n gap={1}\n onClick={props.goToClaim}\n className=\"oui-cursor-pointer oui-text-primary-light\"\n >\n <Text size=\"sm\">{t(\"tradingRewards.claim\")}</Text>\n <JumpIcon />\n </Flex>\n </Flex>\n <Flex direction={\"row\"} gap={3} width={\"100%\"}>\n <Statics title=\"ORDER\" value={props.order} />\n <Statics title=\"esORDER\" value={props.esOrder} isEsOrder />\n </Flex>\n </Flex>\n );\n};\n// background: linear-gradient(28.29deg, #1B1D22 21.6%, #26292E 83.23%);\n\nconst Statics: FC<{\n title: string;\n isEsOrder?: boolean;\n value?: number;\n}> = (props) => {\n const { value } = props;\n return (\n <Flex\n className=\"oui-flex-1 oui-bg-base-8 oui-py-[11px]\"\n direction={\"column\"}\n gap={2}\n r=\"xl\"\n gradient=\"neutral\"\n angle={180}\n border\n borderColor={6}\n >\n <Text className=\"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54\">\n {props.title}\n </Text>\n <Flex direction={\"row\"} gap={1}>\n {props.isEsOrder ? <EsOrderlyIcon /> : <OrderlyIcon />}\n <Text\n className=\"oui-text-sm xl:oui-text-base\"\n children={commifyOptional(value, { fix: 2 })}\n />\n </Flex>\n </Flex>\n );\n};\n","import React from \"react\";\nimport { useAvailableScript } from \"./availableToClaim.script\";\nimport { AvailableToClaim } from \"./availableToClaim.ui\";\n\nexport const AvailableToClaimWidget: React.FC = () => {\n const state = useAvailableScript();\n return <AvailableToClaim {...state} />;\n};\n","\nexport { AvailableToClaimWidget } from \"./availableToClaim.widget\";\nexport { AvailableToClaim } from \"./availableToClaim.ui\";","import { CurrentEpochEstimate } from \"@kodiak-finance/orderly-hooks\";\nimport { useTradingRewardsContext } from \"../provider\";\nimport { ENVType, useGetEnv } from \"@kodiak-finance/orderly-hooks\";\nimport { useDataTap } from \"@kodiak-finance/orderly-react-app\";\nimport { Decimal } from \"@kodiak-finance/orderly-utils\";\nimport { useMemo } from \"react\";\n\nexport const useStakeBoosterScript = () => {\n const { curEpochEstimate } = useTradingRewardsContext();\n\n const env = useGetEnv();\n const stakeNow = (e: any) => {\n const url = `https://${\n env !== ENVType.prod ? `${env}-` : \"\"\n }app.orderly.network/staking`;\n window.open(url, \"_blank\");\n };\n const estimateValue = useDataTap(curEpochEstimate);\n\n const booster = useMemo(() => {\n const estStakeBoost = curEpochEstimate?.est_stake_boost;\n if (typeof estStakeBoost === \"undefined\" || estStakeBoost === null) {\n return undefined;\n }\n\n if (estStakeBoost === 0) return estStakeBoost;\n\n return new Decimal(estStakeBoost)\n .div(new Decimal(10).pow(0.15))\n .toDecimalPlaces(2, Decimal.ROUND_DOWN)\n .toString();\n }, [curEpochEstimate?.est_stake_boost]);\n return {\n curEpochEstimate: estimateValue ?? undefined,\n stakeNow,\n booster,\n };\n};\n\n\nexport type StakeBoosterReturns = ReturnType<typeof useStakeBoosterScript>;","export const RocketIcon = () => {\n return (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M14.439 10.5672C14.0868 10.9198 13.7025 11.2403 13.3183 11.5287C13.1902 11.6248 13.1261 11.721 13.0941 11.8812C12.7739 13.1952 12.1015 14.4451 11.0448 15.5027C10.5645 15.9835 10.0522 16.3681 9.47584 16.7206C8.99553 17.009 8.41917 16.5283 8.61129 15.9835C8.93149 15.1502 9.05957 14.2528 9.05957 13.3234C8.99553 13.3234 8.89947 13.3555 8.83543 13.3555C8.06695 12.7145 7.3625 12.0415 6.65805 11.3364C5.95361 10.6313 5.28118 9.89421 4.64078 9.15708C4.64078 9.09299 4.6728 8.99684 4.6728 8.93274C3.74421 8.93274 2.84764 9.09299 2.01512 9.38143C1.50279 9.57372 0.990469 8.99684 1.27865 8.51611C1.63087 7.93923 2.01512 7.42645 2.49542 6.94572C3.55209 5.88811 4.80088 5.21508 6.11371 4.89459C6.24179 4.86255 6.36987 4.7664 6.46593 4.67025C6.75412 4.25362 7.07432 3.90108 7.42654 3.54855C9.92412 1.04874 13.4143 0.183422 16.6484 0.920545C16.8725 0.984642 17.0326 1.14489 17.0967 1.36923C17.8011 4.57411 16.9366 8.06742 14.439 10.5672ZM13.0301 4.95869C12.2616 4.18952 10.9808 4.18952 10.2123 4.95869C9.44382 5.72786 9.44382 7.00982 10.2123 7.77899C10.9808 8.54816 12.2616 8.54816 13.0301 7.77899C13.8306 6.97777 13.8306 5.72786 13.0301 4.95869ZM5.88957 14.7656C5.28118 15.3745 1.53481 17.9385 0.798348 17.2013C0.0618817 16.4642 2.6235 12.7145 3.23189 12.1056C3.84027 11.4966 4.92896 11.5928 5.66543 12.3299C6.40189 13.067 6.49795 14.1567 5.88957 14.7656Z\"\n fill=\"url(#paint0_linear_88_1748)\"\n />\n <defs>\n <linearGradient\n id=\"paint0_linear_88_1748\"\n x1=\"17.3331\"\n y1=\"8.99996\"\n x2=\"0.666504\"\n y2=\"8.99996\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"rgb(var(--oui-gradient-brand-end))\" />\n <stop offset=\"1\" stopColor=\"rgb(var(--oui-gradient-brand-start))\" />\n </linearGradient>\n </defs>\n </svg>\n );\n};\n","import { FC, ReactNode } from \"react\";\nimport { Flex, Text } from \"@kodiak-finance/orderly-ui\";\nimport { JumpIcon } from \"../components/jumpIcon\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { RocketIcon } from \"../components/rocket\";\nimport { StakeBoosterReturns } from \"./stakeBooster.script\";\nimport { commify, commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const StakeBooster: FC<StakeBoosterReturns> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-stakeBooster\"\n p={6}\n r=\"2xl\"\n direction={\"column\"}\n gap={4}\n width={\"100%\"}\n className=\" oui-font-semibold oui-bg-base-9 \"\n >\n <Flex direction={\"row\"} justify={\"between\"} width={\"100%\"}>\n <Text className=\"oui-text-lg\">{t(\"tradingRewards.stakeBooster\")}</Text>\n <Flex\n direction={\"row\"}\n gap={1}\n onClick={props.stakeNow}\n className=\"oui-cursor-pointer oui-text-primary-light\"\n >\n <Text size=\"sm\">{t(\"tradingRewards.stake\")}</Text>\n <JumpIcon />\n </Flex>\n </Flex>\n <Flex direction={\"row\"} gap={3} width={\"100%\"}>\n <Statics\n title={t(\"tradingRewards.avgStakedAmount\")}\n value={props.curEpochEstimate?.est_avg_stake}\n icon={\n <div className=\"oui-flex oui-w-[32px] oui-h-[20px] oui-relative\">\n <div className=\"oui-absolute oui-right-0 oui-top-0\">\n <EsOrderlyIcon />\n </div>\n <div className=\"oui-absolute oui-left-0 oui-top-0 \">\n <OrderlyIcon />\n </div>\n </div>\n }\n />\n <Statics\n title={t(\"tradingRewards.booster\")}\n value={props.booster}\n icon={<RocketIcon />}\n gradient\n />\n </Flex>\n </Flex>\n );\n};\n\nconst Statics: FC<{\n title: string;\n icon: ReactNode;\n value?: number | string;\n gradient?: boolean;\n}> = (props) => {\n const calcValue = commify(props.value || \"--\", 2);\n return (\n <Flex\n className=\"oui-flex-1 oui-bg-base-8 oui-py-[11px]\"\n direction={\"column\"}\n gap={2}\n r=\"xl\"\n gradient=\"neutral\"\n angle={180}\n border\n borderColor={6}\n >\n <Text className=\"oui-text-xs xl:oui-text-sm oui-text-base-contrast-54\">\n {props.title}\n </Text>\n <Flex direction={\"row\"} gap={1}>\n {props.icon}\n {props.gradient ? (\n <Text.gradient\n className=\"oui-text-sm xl:oui-text-base\"\n color=\"brand\"\n angle={90}\n >\n {calcValue + (calcValue === \"--\" ? \"\" : \"x\")}\n </Text.gradient>\n ) : (\n <Text className=\"oui-text-sm xl:oui-text-base\">\n {commifyOptional(props.value, { fix: 2 })}\n </Text>\n )}\n </Flex>\n </Flex>\n );\n};\n","import React from \"react\";\nimport { useStakeBoosterScript } from \"./stakeBooster.script\";\nimport { StakeBooster } from \"./stakeBooster.ui\";\n\nexport const StakeBoosterWidget: React.FC = () => {\n const state = useStakeBoosterScript();\n return <StakeBooster {...state} />;\n};\n","\nexport { StakeBoosterWidget } from \"./stakeBooster.widget\";\nexport { StakeBooster } from \"./stakeBooster.ui\";","import { FC } from \"react\";\nimport {\n Box,\n Divider,\n Flex,\n ListView,\n Text,\n DataTable,\n Column,\n} from \"@kodiak-finance/orderly-ui\";\nimport { EsOrderlyIcon } from \"../components/esOrderlyIcon\";\nimport { OrderlyIcon } from \"../components/orderlyIcon\";\nimport { ListType, RewardsHistoryReturns } from \"./rewardsHistory.script\";\nimport { useMediaQuery } from \"@kodiak-finance/orderly-hooks\";\nimport { commifyOptional } from \"@kodiak-finance/orderly-utils\";\nimport { AuthGuardEmpty } from \"@kodiak-finance/orderly-ui-connector\";\nimport { AccountStatusEnum } from \"@kodiak-finance/orderly-types\";\nimport { RewardsTooltip } from \"../curEpoch/rewardsTooltip\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport const RewardHistory: FC<RewardsHistoryReturns> = (props) => {\n const { t } = useTranslation();\n\n return (\n <Flex\n id=\"oui-tradingRewards-home-rewardHistory\"\n py={4}\n px={3}\n direction={\"column\"}\n gap={2}\n itemAlign={\"start\"}\n r=\"2xl\"\n className=\"oui-bg-base-9 oui-w-full oui-font-semibold oui-tabular-nums\"\n >\n <Text className=\"oui-text-lg oui-px-3\">\n {t(\"tradingRewards.rewardHistory\")}\n </Text>\n <div className=\"oui-border-t-2 oui-border-line-4 oui-w-full\">\n <List {...props} />\n </div>\n </Flex>\n );\n};\n\nconst List: FC<RewardsHistoryReturns> = (props) => {\n const isMobile = useMediaQuery(\"(max-width: 767px)\");\n\n return isMobile ? (\n <ListView\n dataSource={props.originalData}\n renderItem={(item, index) => {\n return <MobileCell data={item} />;\n }}\n className=\"oui-mt-3 oui-max-h-[356px]\"\n />\n ) : (\n <Box px={3}>\n <DesktopList {...props} />\n </Box>\n );\n};\n\nconst MobileCell: FC<{\n data: ListType;\n}> = (props) => {\n const { data } = props;\n const { t } = useTranslation();\n\n console.log(data.rewardsTooltip);\n const isOrder =\n `${data?.info?.epoch_token || data.epoch_token}`.toLowerCase() === \"order\";\n const r_warret = commifyOptional(data.info?.r_wallet, { fix: 2 });\n\n return (\n <Flex\n key={data.epoch_id}\n direction={\"column\"}\n px={4}\n pt={0}\n gap={3}\n className=\"oui-text-base-contrast-80\"\n >\n <Flex direction={\"row\"} width={\"100%\"}>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"start\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.epoch\")}\n </Text>\n <Text className=\"oui-text-sm\">{`Epoch ${data.epoch_id}`}</Text>\n </Flex>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"start\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.epochRewards\")}{\" \"}\n </Text>\n <Flex gap={1}>\n {isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />}\n <Text className=\"oui-text-sm\">\n {commifyOptional(data.max_reward_amount, { fix: 2 })}\n </Text>\n </Flex>\n </Flex>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"end\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.rewardsEarned\")}{\" \"}\n </Text>\n <Flex gap={1}>\n {r_warret !== \"--\" &&\n (isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />)}\n {!!data.rewardsTooltip ? (\n <RewardsTooltip\n rewardsTooltip={data.rewardsTooltip}\n children={\n <Text className=\"oui-text-sm oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16\">\n {r_warret}\n </Text>\n }\n align=\"center\"\n className=\"oui-bg-base-5\"\n arrowClassName=\"oui-fill-base-5\"\n />\n ) : (\n <Text className=\"oui-text-sm\">{r_warret}</Text>\n )}\n </Flex>\n </Flex>\n </Flex>\n <Flex direction={\"row\"} width={\"100%\"}>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"start\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.rewardHistory.column.startDate\")}\n </Text>\n <Flex direction={\"row\"}>\n <Text className=\"oui-text-sm\">\n {formatTimestamp(data.start_time).firstPart}&nbsp;\n </Text>\n <Text className=\"oui-text-2xs oui-text-base-contrast-36\">\n {formatTimestamp(data.start_time).secondPart}\n </Text>\n </Flex>\n </Flex>\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[6px] oui-flex-1\"\n itemAlign={\"end\"}\n >\n <Text className=\"oui-text-base-contrast-36 oui-text-2xs\">\n {t(\"tradingRewards.rewardHistory.column.endDate\")}\n </Text>\n <Flex direction={\"row\"}>\n <Text className=\"oui-text-sm\">\n {formatTimestamp(data.end_time).firstPart}&nbsp;\n </Text>\n <Text className=\"oui-text-2xs oui-text-base-contrast-36\">\n {formatTimestamp(data.end_time).secondPart}\n </Text>\n </Flex>\n </Flex>\n </Flex>\n <Divider className=\"oui-w-full\" />\n </Flex>\n );\n};\n\nconst DesktopList: FC<RewardsHistoryReturns> = (props) => {\n const { data } = props;\n const { t } = useTranslation();\n\n const columns: Column<ListType>[] = [\n {\n title: t(\"tradingRewards.epoch\"),\n dataIndex: \"epoch_id\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value) => {\n return <Text>{`${t(\"tradingRewards.epoch\")} ${value}`}</Text>;\n },\n },\n {\n title: t(\"tradingRewards.rewardHistory.column.start&EndDate\"),\n dataIndex: \"time\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value, record) => {\n return (\n <Flex\n direction={\"column\"}\n className=\"oui-gap-[2px]\"\n justify={\"start\"}\n itemAlign={\"start\"}\n >\n <Flex direction={\"row\"} gap={1}>\n <Text>{formatTimestamp(record.start_time).firstPart}</Text>\n <Text className=\"oui-text-base-contrast-54\">\n {formatTimestamp(record.start_time).secondPart}\n </Text>\n </Flex>\n <Flex direction={\"row\"} gap={1}>\n <Text>{formatTimestamp(record.end_time).firstPart}</Text>\n <Text className=\"oui-text-base-contrast-54\">\n {formatTimestamp(record.end_time).secondPart}\n </Text>\n </Flex>\n </Flex>\n );\n },\n },\n {\n title: t(\"tradingRewards.epochRewards\"),\n dataIndex: \"max_reward_amount\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value, record) => {\n const isOrder =\n `${record?.info?.epoch_token || record.epoch_token}`.toLowerCase() ===\n \"order\";\n return (\n <Flex direction={\"row\"} gap={1}>\n {isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />}\n <Text>{commifyOptional(value)}</Text>\n </Flex>\n );\n },\n },\n {\n title: t(\"tradingRewards.rewardsEarned\"),\n dataIndex: \"earned\",\n className: \"oui-w-1/4 oui-pl-0 oui-pr-0\",\n render: (value, record) => {\n const isOrder =\n `${record?.info?.epoch_token || record.epoch_token}`.toLowerCase() ===\n \"order\";\n\n let children = (\n <Text\n className={\n record.rewardsTooltip\n ? \"oui-underline oui-decoration-dashed oui-cursor-pointer oui-underline-offset-4 oui-decoration-line-16\"\n : \"\"\n }\n >\n {commifyOptional(record.info?.r_wallet, { fix: 2 })}\n </Text>\n );\n\n if (record.rewardsTooltip) {\n children = (\n <RewardsTooltip\n rewardsTooltip={record.rewardsTooltip}\n children={children}\n align=\"center\"\n className=\"oui-bg-base-5\"\n arrowClassName=\"oui-fill-base-5\"\n />\n );\n }\n return (\n <Flex direction={\"row\"} gap={1}>\n {isOrder ? <OrderlyIcon /> : <EsOrderlyIcon />}\n {children}\n </Flex>\n );\n },\n },\n ];\n\n return (\n <DataTable\n bordered\n columns={columns}\n loading={props.isLoading}\n dataSource={data}\n emptyView={<AuthGuardEmpty status={AccountStatusEnum.SignedIn} />}\n onRow={(record) => {\n return {\n className: \"oui-h-[59px]\",\n };\n }}\n pagination={props.pagination}\n />\n );\n};\n\nfunction formatTimestamp(timestamp?: number) {\n if (typeof timestamp === \"undefined\")\n return {\n firstPart: \"-\",\n secondPart: \"\",\n };\n const date = new Date(timestamp);\n\n const monthNames = [\n \"Jan\",\n \"Feb\",\n \"Mar\",\n \"Apr\",\n \"May\",\n \"Jun\",\n \"Jul\",\n \"Aug\",\n \"Sep\",\n \"Oct\",\n \"Nov\",\n \"Dec\",\n ];\n const month = monthNames[date.getUTCMonth()];\n const day = date.getUTCDate().toString().padStart(2, \"0\");\n const year = date.getUTCFullYear();\n const hours = date.getUTCHours();\n const minutes = date.getUTCMinutes();\n const amPm = hours >= 12 ? \"PM\" : \"AM\";\n const formattedHours = (hours % 12).toString().padStart(2, \"0\");\n const formattedMinutes = minutes.toString().padStart(2, \"0\");\n\n // return `${month} ${day}, ${year}_${formattedHours}:${formattedMinutes} ${amPm}`;\n return {\n firstPart: `${month} ${day}, ${year}`,\n secondPart: `${formattedHours}:${formattedMinutes} ${amPm}`,\n };\n}\n","import { useMemo } from \"react\";\nimport {\n EpochInfoItem,\n useAccount,\n useAccountRewardsHistory,\n WalletRewardsItem,\n} from \"@kodiak-finance/orderly-hooks\";\nimport { useAppContext } from \"@kodiak-finance/orderly-react-app\";\nimport { usePagination } from \"@kodiak-finance/orderly-ui\";\nimport { getTimestamp } from \"@kodiak-finance/orderly-utils\";\nimport { RewardsTooltipProps } from \"../curEpoch/rewardsTooltip\";\nimport { useTradingRewardsContext } from \"../provider\";\n\nexport type ListType = EpochInfoItem & {\n info?: WalletRewardsItem;\n state?: string;\n rewardsTooltip?: RewardsTooltipProps;\n};\n\nexport type RewardsHistoryReturns = ReturnType<typeof useRewardsHistoryScript>;\n\nexport const useRewardsHistoryScript = () => {\n const { account } = useAccount();\n const {\n epochList,\n walletRewardsHistory,\n totalOrderClaimedReward,\n brokerId,\n brokerName,\n } = useTradingRewardsContext();\n const epochInfos = epochList?.[0];\n const { isNotStared } = epochList?.[1];\n const [history] = walletRewardsHistory;\n const { wrongNetwork, disabledConnect } = useAppContext();\n\n const { data: accountHistory } = useAccountRewardsHistory(account.address);\n\n const data = useMemo(() => {\n if (isNotStared || disabledConnect) {\n return [];\n }\n const list = [...(epochInfos || [])];\n\n const combineData = list.map((e): ListType => {\n const id = e.epoch_id;\n const index = history?.rows.findIndex((info) => id === info.epoch_id);\n\n let rewardsTooltip: RewardsTooltipProps | undefined = undefined;\n\n if (index !== -1 && !wrongNetwork) {\n const info = history?.rows?.[index as number];\n const _findIndex = accountHistory?.findIndex((item: any) => {\n return item?.epoch_id === e.epoch_id;\n });\n\n if (\n accountHistory !== undefined &&\n _findIndex !== undefined &&\n _findIndex !== -1\n ) {\n // get broker\n const brokerList = accountHistory[_findIndex].broker;\n const curBrokerIndex = brokerList.findIndex(\n (item) => item.broker_id === brokerId,\n );\n const curBroker =\n curBrokerIndex !== -1 ? brokerList[curBrokerIndex] : undefined;\n const curRewards = curBroker?.r_account ?? 0;\n const otherRewards = Math.max(0, (info?.r_wallet ?? 0) - curRewards);\n rewardsTooltip = {\n brokerName,\n curRewards,\n otherRewards,\n };\n }\n return {\n ...e,\n info,\n rewardsTooltip,\n } as ListType;\n }\n return {\n ...e,\n } as ListType;\n });\n\n combineData.sort((a, b) => a.epoch_id - b.epoch_id); // asc\n let [claimedReward] = totalOrderClaimedReward;\n if (typeof claimedReward !== \"undefined\") {\n for (let i = 0; i < combineData.length; i++) {\n const element = combineData[i];\n if (typeof element?.info === \"undefined\") {\n element.state = \"Null\";\n continue;\n }\n const status = element.info?.reward_status;\n if (status === \"Confirmed\") {\n if (claimedReward - element.info?.r_wallet >= 0) {\n element.state = \"Claimed\";\n } else {\n element.state = \"Claimable\";\n }\n claimedReward -= element.info?.r_wallet;\n } else if (status === \"Pending\") {\n element.state = \"Processing\";\n }\n }\n }\n combineData.sort((a, b) => b.epoch_id - a.epoch_id);\n const curDate = getTimestamp();\n return combineData.filter((item) => item.end_time <= curDate);\n }, [\n history,\n epochInfos,\n totalOrderClaimedReward,\n isNotStared,\n wrongNetwork,\n accountHistory,\n disabledConnect,\n ]);\n\n const { pagination } = usePagination();\n\n return {\n data,\n originalData: data,\n pagination,\n isLoading: epochList[1].isLoading,\n };\n};\n","import React from \"react\";\nimport { useRewardsHistoryScript } from \"./rewardsHistory.script\";\nimport { RewardHistory } from \"./rewardsHistory.ui\";\n\nexport const RewardsHistoryWidget: React.FC = () => {\n const state = useRewardsHistoryScript();\n return <RewardHistory {...state} />;\n};\n","export { RewardHistory } from \"./rewardsHistory.ui\";\nexport { RewardsHistoryWidget } from \"./rewardsHistory.widget\";","\nexport * from \"./title\";\nexport * from \"./curEpoch\";\nexport * from \"./availableToClaim\";\nexport * from \"./stakeBooster\";\nexport * from \"./rewardHistory\";\nexport { TradingRewardsProvider} from \"./provider\";\nexport { HomePage } from \"./page\";\n","export { Title } from \"./title.ui\";\nexport { TitleWidget } from \"./title.widget\";\nexport type { TitleConfig } from \"./title.script\";","import React, { useMemo } from \"react\";\nimport { useTradingRewardsStatus, EpochStatus } from \"@kodiak-finance/orderly-hooks\";\nimport { Flex, Box, cn } from \"@kodiak-finance/orderly-ui\";\nimport { TradingRewardsProvider } from \"./provider\";\nimport type { TitleConfig } from \"./title/title.script\";\n\nconst LazyTitleWidget = React.lazy(() =>\n import(\"./title/title.widget\").then((mod) => {\n return { default: mod.TitleWidget };\n }),\n);\n\nconst LazyCurEpochWidget = React.lazy(() =>\n import(\"./curEpoch\").then((mod) => {\n return { default: mod.CurEpochWidget };\n }),\n);\n\nconst LazyAvailableToClaimWidget = React.lazy(() =>\n import(\"./availableToClaim\").then((mod) => {\n return { default: mod.AvailableToClaimWidget };\n }),\n);\n\nconst LazyStakeBoosterWidget = React.lazy(() =>\n import(\"./stakeBooster\").then((mod) => {\n return { default: mod.StakeBoosterWidget };\n }),\n);\n\nconst LazyRewardsHistoryWidget = React.lazy(() =>\n import(\"./rewardHistory\").then((mod) => {\n return { default: mod.RewardsHistoryWidget };\n }),\n);\n\nconst StakeBooster: React.FC = () => {\n const { statusInfo } = useTradingRewardsStatus(false);\n const isStakeBoosterVisible = useMemo(() => {\n return statusInfo?.epochStatus === EpochStatus.active;\n }, [statusInfo?.epochStatus]);\n return isStakeBoosterVisible ? (\n <React.Suspense fallback={null}>\n <LazyStakeBoosterWidget />\n </React.Suspense>\n ) : null;\n};\n\nexport const HomePage: React.FC<{\n titleConfig?: TitleConfig;\n className?: string;\n showEpochPauseCountdown?: boolean;\n}> = (props) => {\n return (\n <TradingRewardsProvider\n titleConfig={props.titleConfig}\n showEpochPauseCountdown={props.showEpochPauseCountdown}\n >\n <Flex\n id=\"oui-tradingRewards-home-page\"\n className={cn(\"oui-h-lvw oui-w-full\", props.className)}\n direction={\"column\"}\n gap={4}\n >\n <React.Suspense fallback={null}>\n <LazyTitleWidget />\n </React.Suspense>\n <Flex className=\"oui-flex oui-size-full oui-flex-col oui-gap-4 2xl:oui-flex-row 2xl:oui-items-stretch\">\n <Box className=\"oui-w-full 2xl:oui-size-auto 2xl:oui-flex-1\">\n <React.Suspense fallback={null}>\n <LazyCurEpochWidget />\n </React.Suspense>\n </Box>\n <Flex className=\"oui-flex oui-w-full oui-flex-col oui-gap-4 lg:oui-flex-row 2xl:oui-flex-1 2xl:oui-flex-col\">\n <React.Suspense fallback={null}>\n <LazyAvailableToClaimWidget />\n </React.Suspense>\n <StakeBooster />\n </Flex>\n </Flex>\n <React.Suspense fallback={null}>\n <LazyRewardsHistoryWidget />\n </React.Suspense>\n </Flex>\n </TradingRewardsProvider>\n );\n};\n","import { useEffect, useMemo, useState } from \"react\";\nimport { useMediaQuery } from \"@kodiak-finance/orderly-hooks\";\nimport type { SideBarProps } from \"@kodiak-finance/orderly-ui-scaffold\";\nimport { useTranslation } from \"@kodiak-finance/orderly-i18n\";\n\nexport enum TradingRewardsLeftSidebarPath {\n Trading = \"/rewards/trading\",\n Affiliate = \"/rewards/affiliate\",\n}\n\nexport const useTradingRewardsLayoutScript = (props: {\n current?: string;\n}): SideBarProps & {\n hideSideBar: boolean;\n} => {\n const { t } = useTranslation();\n const [current, setCurrent] = useState(props.current || \"/rewards/affiliate\");\n\n useEffect(() => {\n if (props.current) setCurrent(props.current);\n }, [props.current]);\n\n const items = useMemo(() => {\n return [\n {\n name: t(\"common.trading\"),\n href: TradingRewardsLeftSidebarPath.Trading,\n icon: (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.883 1.5c-.166.01-.393.076-.515.173a2 2 0 0 0-.18.173L.918 6.553a.86.86 0 0 0-.168.475c0 .339.232.543.232.543l7.374 8.633c.005.006.269.301.644.296s.64-.29.644-.296l7.402-8.663s.204-.269.204-.513-.196-.517-.196-.517L13.82 1.848c-.023-.032-.076-.021-.103-.049-.033-.038-.037-.091-.077-.124-.123-.097-.267-.106-.413-.123-.04-.005-.063-.049-.103-.049h-.078zm1.745 1.582h4.744L9 5.795zm-1.675.542 2.294 2.615H3.122zm8.094 0 1.831 2.615h-4.125zM3.328 7.818h4.847v5.672zm6.497 0h4.847c-1.151 1.345-3.422 4.007-4.847 5.672z\"\n // fill=\"url(#a)\"\n className=\"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]\"\n />\n <defs>\n <linearGradient\n id=\"a\"\n x1=\"17.25\"\n y1=\"9\"\n x2=\".75\"\n y2=\"9\"\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"rgb(var(--oui-gradient-brand-end))\" />\n <stop\n offset=\"1\"\n stopColor=\"rgb(var(--oui-gradient-brand-start))\"\n />\n </linearGradient>\n </defs>\n </svg>\n ),\n },\n {\n name: t(\"common.affiliate\"),\n href: TradingRewardsLeftSidebarPath.Affiliate,\n icon: (\n <svg\n width=\"18\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.625 4.95c0-.746.604-1.35 1.35-1.35h4.05c.746 0 1.35.604 1.35 1.35v4.62L9 12.195 5.625 9.57zm8.624 3.163-.524.407v-.96l.074.05c.193.128.346.302.45.502m-4.42 5.148L14.4 9.705v3.345a1.35 1.35 0 0 1-1.35 1.35h-8.1a1.35 1.35 0 0 1-1.35-1.35V9.705l4.571 3.556c.488.379 1.17.379 1.658 0M4.275 8.52l-.524-.407c.104-.2.257-.374.45-.503l.074-.049zm0-2.581V4.95a2.7 2.7 0 0 1 2.7-2.7h4.05a2.7 2.7 0 0 1 2.7 2.7v.989l.823.548a2.7 2.7 0 0 1 1.202 2.247v4.316a2.7 2.7 0 0 1-2.7 2.7h-8.1a2.7 2.7 0 0 1-2.7-2.7V8.734a2.7 2.7 0 0 1 1.202-2.247zM9 6.089l.111-.118.005-.005a1.08 1.08 0 0 1 1.58.004 1.223 1.223 0 0 1 0 1.668l-1.515 1.62-.004.004c-.1.102-.26.1-.358-.004l-1.516-1.62a1.223 1.223 0 0 1 0-1.668l.004-.004a1.08 1.08 0 0 1 1.58.004z\"\n className=\"oui-fill-current group-data-[actived=true]:oui-fill-[url(#side-menu-gradient)]\"\n />\n </svg>\n ),\n },\n ];\n }, [t]);\n\n const hideSideBar = useMediaQuery(\"(max-width: 768px)\");\n\n return {\n items,\n current,\n hideSideBar,\n // open: sideOpen,\n // onOpenChange(open) {\n // setSideOpen(open);\n // },\n onItemSelect: (item) => {\n // @ts-ignore\n setCurrent(item.href);\n },\n };\n};\n","import React, { PropsWithChildren } from \"react\";\nimport omit from \"ramda/es/omit\";\nimport { cn } from \"@kodiak-finance/orderly-ui\";\nimport { Scaffold, SideBarProps } from \"@kodiak-finance/orderly-ui-scaffold\";\nimport { ScaffoldProps } from \"@kodiak-finance/orderly-ui-scaffold\";\n\nexport type TradingRewardsLayoutProps = ScaffoldProps & {\n hideSideBar?: boolean;\n items?: SideBarProps[\"items\"];\n};\n\nexport const TradingRewardsLayout: React.FC<\n PropsWithChildren<TradingRewardsLayoutProps>\n> = (props) => {\n const { children, classNames, ...rest } = props;\n return (\n <Scaffold\n leftSidebar={null}\n routerAdapter={props.routerAdapter}\n classNames={{\n ...classNames,\n content: classNames?.content,\n topNavbar: cn(\"oui-bg-base-9\", classNames?.topNavbar),\n leftSidebar: cn(\n \"oui-rounded-xl oui-bg-base-9\",\n \"oui-m-3 oui-p-4\",\n \"oui-border oui-border-line\",\n classNames?.leftSidebar,\n ),\n }}\n {...omit([\"leftSideProps\"], rest)}\n >\n {children}\n </Scaffold>\n );\n};\n\n// type LeftSidebarProps = SideBarProps & {\n// routerAdapter?: RouterAdapter;\n// };\n\n// const LeftSidebar: React.FC<LeftSidebarProps> = (props) => {\n// const { t } = useTranslation();\n// const { expanded, setExpand } = useScaffoldContext();\n// return (\n// <SideBar\n// title={t(\"tradingRewards.rewards\")}\n// {...props}\n// open={expanded}\n// onOpenChange={(open) => setExpand(open)}\n// onItemSelect={(a) => {\n// props.onItemSelect?.(a);\n// props.routerAdapter?.onRouteChange?.({\n// href: a.href || \"\",\n// name: a.name,\n// });\n// }}\n// />\n// );\n// };\n","import { FC, PropsWithChildren } from \"react\";\nimport { ScaffoldProps } from \"@kodiak-finance/orderly-ui-scaffold\";\nimport { useTradingRewardsLayoutScript } from \"./layout.script\";\nimport { TradingRewardsLayout } from \"./layout.ui\";\n\nexport const TradingRewardsLayoutWidget: FC<\n PropsWithChildren<ScaffoldProps>\n> = (props) => {\n const state = useTradingRewardsLayoutScript({\n current: props.leftSideProps?.current,\n });\n return (\n <TradingRewardsLayout {...state} {...props}>\n {props.children}\n </TradingRewardsLayout>\n );\n};\n"]}
@@ -0,0 +1 @@
1
+ .oui-absolute{position:absolute}.oui-relative{position:relative}.oui-left-0{left:0}.oui-right-0{right:0}.oui-top-0{top:0}.oui-m-3{margin:.75rem}.oui-mb-\[3px\]{margin-bottom:3px}.oui-mt-0{margin-top:0}.oui-mt-2{margin-top:.5rem}.oui-mt-3{margin-top:.75rem}.oui-flex{display:flex}.oui-size-full{width:100%;height:100%}.oui-h-5{height:1.25rem}.oui-h-\[20px\]{height:20px}.oui-h-\[59px\]{height:59px}.oui-h-full{height:100%}.oui-max-h-\[356px\]{max-height:356px}.oui-w-1\/4{width:25%}.oui-w-5{width:1.25rem}.oui-w-\[32px\]{width:32px}.oui-w-full{width:100%}.oui-min-w-\[204px\]{min-width:204px}.oui-flex-1{flex:1 1 0%}.oui-cursor-pointer{cursor:pointer}.oui-flex-col{flex-direction:column}.oui-items-center{align-items:center}.oui-gap-1{gap:.25rem}.oui-gap-4{gap:1rem}.oui-gap-\[2px\]{gap:2px}.oui-gap-\[6px\]{gap:6px}.oui-rounded-xl{border-radius:var(--oui-rounded-xl,.75rem)}.oui-rounded-t-2xl{border-top-left-radius:var(--oui-rounded-2xl,1rem);border-top-right-radius:var(--oui-rounded-2xl,1rem)}.oui-border{border-width:1px}.oui-border-t-2{border-top-width:2px}.oui-border-line{border-color:rgb(var(--oui-color-line,255 255 255)/.08)}.oui-border-line-4{border-color:rgb(var(--oui-color-line,255 255 255)/.04)}.oui-bg-base-5{--tw-bg-opacity:1;background-color:rgb(var(--oui-color-base-5)/var(--tw-bg-opacity,1))}.oui-bg-base-8{--tw-bg-opacity:1;background-color:rgb(var(--oui-color-base-8)/var(--tw-bg-opacity,1))}.oui-bg-base-9{--tw-bg-opacity:1;background-color:rgb(var(--oui-color-base-9)/var(--tw-bg-opacity,1))}.oui-fill-base-5{fill:rgb(var(--oui-color-base-5)/1)}.oui-fill-base-contrast-36{fill:rgb(var(--oui-color-base-foreground)/.36)}.oui-fill-current{fill:currentColor}.oui-p-10{padding:2.5rem}.oui-p-4{padding:1rem}.oui-px-3{padding-left:.75rem;padding-right:.75rem}.oui-py-0{padding-top:0;padding-bottom:0}.oui-py-\[11px\]{padding-top:11px;padding-bottom:11px}.oui-py-\[13px\]{padding-top:13px;padding-bottom:13px}.oui-pl-0{padding-left:0}.oui-pr-0{padding-right:0}.oui-text-center{text-align:center}.oui-text-2xs{font-size:var(--oui-font-size-2xs,.75rem);line-height:1.125rem}.oui-text-base{font-size:var(--oui-font-size-base,1rem);line-height:1.5rem}.oui-text-lg{font-size:var(--oui-font-size-lg,1.125rem);line-height:1.625rem}.oui-text-sm{font-size:var(--oui-font-size-sm,.875rem);line-height:1.25rem}.oui-text-xl{font-size:var(--oui-font-size-xl,1.25rem);line-height:1.75rem}.oui-text-xs{font-size:var(--oui-font-size-xs,calc(.875rem - 1px));line-height:1.25rem}.oui-font-normal{font-weight:400}.oui-font-semibold{font-weight:600}.oui-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.oui-leading-\[1\.5\]{line-height:1.5}.oui-leading-\[20px\]{line-height:20px}.oui-text-base-contrast{color:rgb(var(--oui-color-base-foreground)/.98)}.oui-text-base-contrast-36{color:rgb(var(--oui-color-base-foreground)/.36)}.oui-text-base-contrast-54{color:rgb(var(--oui-color-base-foreground)/.54)}.oui-text-base-contrast-80{color:rgb(var(--oui-color-base-foreground)/.8)}.oui-text-primary-light{--tw-text-opacity:1;color:rgb(var(--oui-color-primary-light)/var(--tw-text-opacity,1))}.oui-underline{text-decoration-line:underline}.oui-decoration-line-16{text-decoration-color:rgb(var(--oui-color-line,255 255 255)/.16)}.oui-decoration-dashed{text-decoration-style:dashed}.oui-underline-offset-4{text-underline-offset:4px}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.hover\:oui-text-primary-darken:hover{--tw-text-opacity:1;color:rgb(var(--oui-color-primary-darken)/var(--tw-text-opacity,1))}.oui-group:hover .group-hover\:oui-fill-base-contrast-80{fill:rgb(var(--oui-color-base-foreground)/.8)}.oui-group:hover .group-hover\:oui-text-base-contrast-80{color:rgb(var(--oui-color-base-foreground)/.8)}.oui-group[data-actived=true] .group-data-\[actived\=true\]\:oui-fill-\[url\(\#side-menu-gradient\)\]{fill:url(#side-menu-gradient)}@media (min-width:480px){.md\:oui-h-6{height:1.5rem}.md\:oui-w-6{width:1.5rem}.md\:oui-text-2xl{font-size:var(--oui-font-size-2xl,1.5rem);line-height:2rem}.md\:oui-text-base{font-size:var(--oui-font-size-base,1rem);line-height:1.5rem}.md\:oui-text-lg{font-size:var(--oui-font-size-lg,1.125rem);line-height:1.625rem}.md\:oui-text-sm{font-size:var(--oui-font-size-sm,.875rem)}.md\:oui-text-sm,.md\:oui-text-xs{line-height:1.25rem}.md\:oui-text-xs{font-size:var(--oui-font-size-xs,calc(.875rem - 1px))}}@media (min-width:768px){.lg\:oui-h-7{height:1.75rem}.lg\:oui-w-7{width:1.75rem}.lg\:oui-flex-row{flex-direction:row}.lg\:oui-text-lg{font-size:var(--oui-font-size-lg,1.125rem);line-height:1.625rem}.lg\:oui-text-sm{font-size:var(--oui-font-size-sm,.875rem);line-height:1.25rem}.lg\:oui-text-xl{font-size:var(--oui-font-size-xl,1.25rem);line-height:1.75rem}}@media (min-width:1024px){.xl\:oui-h-8{height:2rem}.xl\:oui-w-8{width:2rem}.xl\:oui-text-2xl{font-size:var(--oui-font-size-2xl,1.5rem);line-height:2rem}.xl\:oui-text-\[32px\]{font-size:32px}.xl\:oui-text-base{font-size:var(--oui-font-size-base,1rem);line-height:1.5rem}.xl\:oui-text-lg{font-size:var(--oui-font-size-lg,1.125rem);line-height:1.625rem}.xl\:oui-text-sm{font-size:var(--oui-font-size-sm,.875rem);line-height:1.25rem}.xl\:oui-leading-\[24px\]{line-height:24px}}@media (min-width:1280px){.\32xl\:oui-size-auto{width:auto;height:auto}.\32xl\:oui-flex-1{flex:1 1 0%}.\32xl\:oui-flex-row{flex-direction:row}.\32xl\:oui-flex-col{flex-direction:column}.\32xl\:oui-items-stretch{align-items:stretch}}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@kodiak-finance/orderly-trading-rewards",
3
+ "version": "2.7.4",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "keywords": [],
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "date-fns": "^3.6.0",
17
+ "ramda": "^0.31.3",
18
+ "@kodiak-finance/orderly-hooks": "2.7.4",
19
+ "@kodiak-finance/orderly-react-app": "2.7.4",
20
+ "@kodiak-finance/orderly-types": "2.7.4",
21
+ "@kodiak-finance/orderly-ui-connector": "2.7.4",
22
+ "@kodiak-finance/orderly-ui": "2.7.4",
23
+ "@kodiak-finance/orderly-i18n": "2.7.4",
24
+ "@kodiak-finance/orderly-ui-scaffold": "2.7.4",
25
+ "@kodiak-finance/orderly-utils": "2.7.4"
26
+ },
27
+ "devDependencies": {
28
+ "@types/ramda": "^0.29.3",
29
+ "@types/react": "^18.3.2",
30
+ "@types/react-dom": "^18.3.0",
31
+ "react": "^18.2.0",
32
+ "react-dom": "^18.2.0",
33
+ "tailwindcss": "^3.4.4",
34
+ "tsup": "^7.1.0",
35
+ "typescript": "^5.1.6",
36
+ "tsconfig": "0.10.4"
37
+ },
38
+ "peerDependencies": {
39
+ "react": ">=18",
40
+ "react-dom": ">=18"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup && pnpm run build:css",
44
+ "build:css": "tailwindcss build -i src/tailwind.css -o dist/styles.css --minify",
45
+ "test": "echo \"Error: no test specified\" && exit 1"
46
+ }
47
+ }