@dhedge/trading-widget 1.0.0 → 1.0.2

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.
package/README.md ADDED
@@ -0,0 +1,493 @@
1
+ # dHEDGE Trading Widget API Docs
2
+
3
+ ## Get started
4
+
5
+ Requirements:
6
+
7
+ Widget library has some vital `peerDependencies` as a core tool stack. Make sure having all those dependencies installed in app before starting the integration:
8
+
9
+ ```bash
10
+ "@tanstack/react-query": "^5.28.4",
11
+ "react": ">=18.2.0",
12
+ "viem": "^2.8.14",
13
+ "wagmi": "^2.5.11"
14
+ ```
15
+
16
+ 1. Installation:
17
+
18
+ ```bash
19
+ npm i @dhedge/trading-widget
20
+ ```
21
+ 2. Providers hierarchy
22
+
23
+ ```typescript jsx
24
+ import { WagmiProvider } from 'wagmi';
25
+ import { TradingPanelProvider, TradingWidget } from '@dhedge/trading-widget';
26
+ ```
27
+
28
+ - Setup [Wagmi Provider](https://wagmi.sh/react/api/WagmiProvider) on top level or use existing one in your app
29
+ - Setup [TradingPanelProvider](#tradingpanelprovider)
30
+ - Setup [TradingWidget](#tradingwidget)
31
+
32
+ 3. Minimum required config
33
+
34
+ See bare minimum setup example: `packages/trading-widget/src/examples/simple-example.tsx`
35
+
36
+ 4. Styling
37
+
38
+ ```typescript jsx
39
+ import '@dhedge/trading-widget/style.css'
40
+ ```
41
+
42
+ Initially widget takes full parent width
43
+
44
+ See [TradingWidget](#tradingwidget) -> `theme` config to manage customization
45
+
46
+ ## API
47
+
48
+ ### TradingPanelProvider
49
+
50
+ Top level provider component. Headless part of trading logic. API handles params to setup `initialState` and `actions`. See below for more details
51
+
52
+ <details>
53
+ <summary><code>actions</code> <code><b>/</b></code> <code>Optional General callbacks to interact with 3rd party services</code></summary>
54
+
55
+ > | name | type | default value | description |
56
+ > |-----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|-----------------------------------------------------------------------------------|
57
+ > | `onUpdatePoolConfigDepositMethod` | (payload: { address: `Address`; method: `'deposit' \| 'depositWithCustomCooldown'` }) => void | undefined | triggers on deposit method change |
58
+ > | `onUpdateSendTokenInput` | (payload: Partial\<{ address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }\>) => void | undefined | triggers on send token change |
59
+ > | `onUpdateTradingSettings` | (payload: Partial\<{ slippage: `number \| 'auto'`; minSlippage?: `number` isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isMaxSlippageLoading: `boolean` }\>) => void | undefined | triggers on trading settings change |
60
+ > | `onSetTradingType` | (payload: `'deposit' \| 'withdraw'`) => void | undefined | triggers on trading type change |
61
+ > | `onUpdateTradingMeta` | (payload: Partial\<{ approvingStatus: `'pending' \| 'success'` }\>) => void | undefined | triggers on trading meta change |
62
+ > | `onUpdateTradingModal` | (payload: Partial\<{ isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'` }\>) => void | undefined | triggers on trading modal change |
63
+ > | `onUpdateTransactions` | (payload: AddTransaction \| UpdateTransaction \| RemoveTransaction) => void | undefined | triggers on transaction action change |
64
+ > | `onUpdateEntryFee` | (payload: Partial\<Record<DepositMethodName, number>\>) => void | undefined | triggers on transaction action change |
65
+ > | `onTransactionError` | (error: `Error`, action: `TransactionAction` \| `undefined`, chainId?: `ChainId`, txHash?: `Address`) => void | undefined | triggers on transaction error |
66
+ > | `onTransactionSuccess` | (data: `WaitForTransactionReceiptReturnType`, action: `TransactionAction` \| `undefined`, link?: `string`) => void | undefined | triggers on transaction success |
67
+ > | `onTransactionEstimationError` | (error: `EstimationError`, address: `Address`, chainId?: `ChainId`, account?: `Address`) => void | undefined | triggers on transaction estimation error |
68
+ > | `onTokenSelector` | (payload: { isOpen: `boolean`; entity: `'token' \| 'pool'` }) => void | undefined | triggers on token selector change |
69
+ > | `onLog` | (eventName: `string`, payload?: `Record<string, unknown>`) => void | undefined | triggers on log event |
70
+ > | `onSimulateTransaction` | (payload: { chainId: `ChainId`; from: `Address`: to: `Address`; input: `string`; gas: `number`; value?: `string` }) => Promise<{ link?: `string`; simulation: { status: `boolean`; error_message: `string` } } \| null> | undefined | triggers to simulate transaction and get error details after failed tx estimation |
71
+
72
+ ###### Source: `packages/trading-widget/src/core-kit/providers/index.tsx`
73
+ ###### Default values: `undefined`
74
+ </details>
75
+
76
+ ------------------------------------------------------------------------------------------
77
+
78
+ <details>
79
+ <summary><code>initialState</code> <code><b>/</b></code> <code>Optional initial state of trading panel</code></summary>
80
+
81
+ > | name | type | default value | description |
82
+ > |--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
83
+ > | `poolAddress` | Address | `AddressZero` | Current active pool address |
84
+ > | `poolConfigMap` | Record<Address, PoolConfig> | `{}` | Map of pool configs available for trading |
85
+ > | `settings` | { slippage: `number \| 'auto'`; minSlippage?: `number`; isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isMaxSlippageLoading: `boolean` } | { slippage: `'auto'`; isInfiniteAllowance: `false`; isMultiAssetWithdrawalEnabled: `true`; isMaxSlippageLoading: `false` } | Panel settings |
86
+ > | `type` | 'deposit' \| 'withdraw' | `'deposit'` | Trading type |
87
+ > | `input` | { sendToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }; receiveToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` } } | `poolConfigMap[poolAddress]` | Send/receive tokens pair |
88
+ > | `entryFee` | { deposit: `number`; depositWithCustomCooldown: `number`; } | { deposit: `0`; depositWithCustomCooldown: `0.1` } | Entry fee config map |
89
+ > | `meta` | { approvingStatus?: `'pending' \| 'success'` } | `{}` | Trading meta info |
90
+ > | `modal` | { isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'`; action: `'deposit' \| 'withdraw' \| 'approve \| 'oraclesUpdate'`; link?: `string`; sendToken: TradingToken \| null; receiveToken: TradingToken \| null } | `{ isOpen: `false`,status: `'None'`, receiveToken: `null`, sendToken: `null` }` | Trading modal state |
91
+ > | `transactions` | { action: `'deposit' \| 'withdraw' \| 'approve'`; symbol: `string`; chainId: `ChainId`; txHash?: `Address` }[] | `[]` | Pending transactions |
92
+ > | `poolFallbackData` | { address: `Address`; managerLogicAddress?: `Address`; poolCompositions: `PoolComposition[]`; tokenPrice?: `string`; apy?: { value: `number`; currency: `'USD' \| 'ETH'` } } | { address: `AddressZero` } | Current active pool fallback data to override or extend contract's response |
93
+
94
+ ###### Source: `packages/trading-widget/src/core-kit/providers/index.tsx`
95
+ ###### Default values: `packages/trading-widget/src/core-kit/providers/index.tsx`
96
+ </details>
97
+
98
+ ### TradingWidget
99
+
100
+ UI configuration provider. Manages params to configure custom styling, components, translations and basic trading params. Decomposed into `config`, `components`, `theme` and `translation` params. See below for more details
101
+
102
+ <details>
103
+ <summary><code>config</code> <code><b>/</b></code> <code>General feature configuration params</code></summary>
104
+
105
+ ##### params
106
+
107
+ > | name | type | default value | description |
108
+ > |------------------------------------|----------------------------------------------------------------|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|
109
+ > | `isGeoBlocked` | `boolean` | `false` | Restricts depositing action button and conditionally renders GeoBlockAlert component |
110
+ > | `depositQuoteDiffWarningThreshold` | `number` | `1` | Deposit slippage absolute percent value warning threshold, Affects styling to warn user |
111
+ > | `depositQuoteDiffErrorThreshold` | `number` | `3` | Deposit slippage absolute percent value error threshold, Affects styling to warn user |
112
+ > | `defaultDepositSlippage` | `number` | `0` | Initial deposit slippage absolute percent. Further adjustments are available in panel settings |
113
+ > | `defaultDepositSlippageScale` | `number[]` | `[0]` | Initial deposit slippage absolute percent. Further adjustments are available in panel settings |
114
+ > | `defaultWithdrawSlippageScale` | `number[]` | `[0.1, 0.3, 0.5, 1, 1.5, 3]` | Initial withdraw slippage absolute percent. Further adjustments are available in panel settings |
115
+ > | `defaultLockTime` | `string` | `'24 hours'` | Formatted default deposit lock time to be displayed in panel (Long lockup period is used to bypass entry fee and can be managed in panel settings) |
116
+ > | `customLockTime` | `string` | `'15 minutes'` | Formatted custom deposit lock time alternative to be displayed in panel |
117
+ > | `stablePrecision` | `number` | `3` | Number of decimals to be displayed in stables (e.g USDC balance) |
118
+ > | `defaultPrecision` | `number` | `6` | Number of decimals to be displayed in token values |
119
+ > | `stakingChainId` | `number` | `10` (Optimism) | ChainId to be used in staking logic |
120
+ > | `termsOfUseAccepted` | `boolean` | `true` | Requires user to confirm terms of use by rendering DepositTermsOfUse component before deposit action |
121
+ > | `standalone` | `boolean` | `true` | Handles token selection in SPA mode |
122
+ > | `chainConfig` | `Partial<Record<ChainId, { name: string; iconPath: string }>>` | `{}` | Sets map of chain `name` and `iconPath` |
123
+
124
+ ##### actions
125
+
126
+ > | name | type | default value | description |
127
+ > |--------------------------------------|------------------------------------------------------------------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
128
+ > | `onConnect` | `() => void` | `() => {}` | Widget has built-in `Connect Wallet` action button that triggers `onConnect` callback assuming starting of abstract wallet connection process. After all the only requirement is to get connected wallet inside wagmi's `useAccount` hook to make trading operations possible |
129
+ > | `onAcceptTermsOfUse` | `() => void` | `() => {}` | Callback is triggered after user's approval of Terms of Use statements assuming switching of external `config.termsOfUseAccepted` param to `true` state |
130
+
131
+ ###### Source: `packages/trading-widget/src/trading-widget/providers/config-provider`
132
+ ###### Default values: `packages/trading-widget/src/trading-widget/providers/config-provider/config-provider.defaults.ts`
133
+ </details>
134
+
135
+ <details>
136
+ <summary>
137
+ <code>components</code>
138
+ <code><b>/</b></code>
139
+ <code>Custom components to be injected into widget layout</code>
140
+ </summary>
141
+
142
+ > | name | type | default value | description |
143
+ > |-----------------------|-------------------------------------|---------------|-----------------------------------------------------------------------------------------------------------------|
144
+ > | `GeoBlockAlert` | ComponentType | `undefined` | Component replaces deposit button while `isGeoBlocked` config param is set to `true` |
145
+ > | `DepositMetaInfo` | ComponentType | `undefined` | Component is injected into deposit meta part of widget layout nearby TransactionOverviewDisclosure |
146
+ > | `WithdrawMetaInfo` | ComponentType | `undefined` | Component is injected into withdraw meta part of widget layout nearby WithdrawTransactionOverviewDisclosure |
147
+ > | `ExtraActionButton` | ComponentType | `undefined` | Component is injected below deposit action button and rendered if `isGeoBlocked` config param is set to `false` |
148
+ > | `Image` | ComponentType<ImageProps> | `<img>` | Component optionally can be used to pass `nextjs` Image component to be used for assets rendering |
149
+ > | `LogoSpinner` | ComponentType<SVGProps<SVGElement>> | `<Spinner>` | Component is injected into widget pending transaction overlay. Assume using of spinning animation |
150
+ > | `DepositTermsOfUse` | ComponentType | `undefined` | Component is injected into `TermsOfUseOverlay` to extend default terms of use statement points |
151
+
152
+
153
+ ###### Source: `packages/trading-widget/src/trading-widget/providers/component-provider/component-provider.tsx`
154
+ ###### Default values: `undefined`
155
+ </details>
156
+
157
+ ------------------------------------------------------------------------------------------
158
+
159
+ <details>
160
+ <summary>
161
+ <code>theme</code>
162
+ <code><b>/</b></code>
163
+ <code>Widget styling variables config</code>
164
+ </summary>
165
+
166
+ ##### global
167
+
168
+ ###### color
169
+
170
+ path: `global.color[name]`
171
+
172
+ > | name | type | default value | description |
173
+ > |----------------------------|------------|----------------------------------------------|---------------------------------------|
174
+ > | `colorTextPrimary` | string | `#ffffff` | Primary text color |
175
+ > | `colorTextPrimaryHover` | string | `#ffffffCC` | Primary hover text color |
176
+ > | `colorBorderPrimary` | string | `global?.color?.colorTextPrimary ?? #ffffff` | Primary border color |
177
+ > | `colorTextSecondary` | string | `#9DA2AD` | Secondary text color |
178
+ > | `colorBgPrimary` | string | `#1B2432` | Primary bg color |
179
+ > | `colorBgSecondary` | string | `#2B313E` | Secondary bg color |
180
+ > | `colorTextAccent` | string | `#ffffff` | Accent text color |
181
+ > | `colorTextAccentHover` | string | `#ffffffCC` | Accent hover text color |
182
+ > | `colorBgAccentFrom` | string | `#73D393` | Accent bg gradient `from` color |
183
+ > | `colorBgAccentTo` | string | `#34855E` | Accent bg gradient `to` color |
184
+ > | `colorBgAccentFromHover` | string | `#73D393CC` | Accent hover bg gradient `from` color |
185
+ > | `colorBgAccentToHover` | string | `#162435` | Accent hover bg gradient `to` color |
186
+ > | `colorTextNeutral` | string | `#9DA2AD80` | Neutral text color |
187
+ > | `colorBgNeutral` | string | `#9DA2AD33` | Neutral bg color |
188
+ > | `colorTextLoading` | string | `#ffffff99` | Loading text color |
189
+ > | `colorTextError` | string | `#EF4444` | Error text color |
190
+ > | `colorTextWarning` | string | `#AFA58D` | Warning text color |
191
+ > | `colorIcon` | string | `global?.color?.colorTextPrimary ?? #ffffff` | Warning text color |
192
+
193
+ ###### size
194
+
195
+ path: `global.size[name]`
196
+
197
+ > | name | type | default value | description |
198
+ > |------------------------|--------------|----------------------------------------------|------------------------|
199
+ > | `gap` | string | `0.25rem` | General flex gap |
200
+ > | `spacer` | string | `4px` | General spacer |
201
+ > | `fontSizeBase` | string | `16px` | Font size base |
202
+ > | `lineHeightBase` | string | `24px` | Line height base |
203
+ > | `fontSizeXs` | string | `12px` | Font size xs |
204
+ > | `lineHeightXs` | string | `16px` | Line height xs |
205
+ > | `fontSizeSm` | string | `14px` | Font size sm |
206
+ > | `lineHeightSm` | string | `20px` | Line height sm |
207
+ > | `fontSizeLg` | string | `18px` | Font size lg |
208
+ > | `lineHeightLg` | string | `28px` | Line height lg |
209
+ > | `iconSize` | string | `20px` | Icon size base |
210
+ > | `iconSizeSm` | string | `24px` | Icon size sm |
211
+ > | `iconSecondarySize` | string | `16px` | Icon secondary size |
212
+ > | `iconSecondarySizeSm` | string | `16px` | Icon secondary size sm |
213
+ > | `labelFontSize` | string | `config?.global?.size?.fontSizeXs ?? 12px` | Label font size |
214
+ > | `labelLineHeight` | string | `config?.global?.size?.lineHeightXs ?? 16px` | Label font size |
215
+ > | `labelLineHeight` | string | `config?.global?.size?.lineHeightXs ?? 16px` | Label font size |
216
+
217
+ ###### style
218
+
219
+ path: `global.style[name]`
220
+
221
+ > | name | type | default value | description |
222
+ > |----------------------------------------------------|----------------|---------------|------------------------------|
223
+ > | `radiusPrimary` | string | `1rem` | General border radius |
224
+ > | `radiusSecondary` | string | `1rem` | Secondary border radius |
225
+ > | `fontWeightLight` | string | `300` | Font weight light |
226
+ > | `fontWeightMedium` | string | `500` | Font weight medium |
227
+ > | `fontWeightBold` | string | `700` | Font weight bold |
228
+ > | `actionOpacity` | string | `1` | Action element opacity |
229
+ > | `actionOpacityHover` | string | `0.8` | Action hover element opacity |
230
+
231
+ ##### component
232
+
233
+ ###### popup
234
+
235
+ path: `component.popup[name]`
236
+
237
+ > | name | type | default value | description |
238
+ > |----------------------|------------------|---------------------------------------------------------|------------------|
239
+ > | `color.colorText` | string | `config?.global?.color?.colorTextSecondary ?? #9DA2AD` | Popup text color |
240
+ > | `color.colorBg` | string | `config?.global?.color?.colorBgSecondary ?? #2B313E` | Popup bg color |
241
+ > | `color.colorBorder` | string | `config?.global?.color?.colorTextSecondary ?? #9DA2AD` | Popup bg color |
242
+ > | `size.fontSize` | string | `config?.global?.size?.fontSizeXs ?? 12px` | Popup font size |
243
+
244
+ ###### popupList
245
+
246
+ path: `component.popupList[name]`
247
+
248
+ > | name | type | default value | description |
249
+ > |-------------------------|------------------|----------------------------------------------------------|-------------------------------|
250
+ > | `color.itemBgEven` | string | `transparent` | Popup list even item bg color |
251
+ > | `color.itemBgOdd` | string | `#2A3648` | Popup list odd item bg color |
252
+ > | `color.headerBg` | string | `#1B2432` | Popup list header bg color |
253
+
254
+ ###### tabGroup
255
+
256
+ path: `component.tabGroup[name]`
257
+
258
+ > | name | type | default value | description |
259
+ > |-----------|------------------|----------------------------------|--------------------------|
260
+ > | `size.px` | string | `global.size.spacer * 3` | Tab group padding inline |
261
+
262
+ ###### tabContent
263
+
264
+ path: `component.tabContent[name]`
265
+
266
+ > | name | type | default value | description |
267
+ > |------------|------------------|---------------------------|----------------------------|
268
+ > | `size.pt` | string | `global.size.spacer * 3` | Tab content padding top |
269
+ > | `size.px` | string | `0px` | Tab content padding inline |
270
+ > | `size.pb` | string | `global.size.spacer * 9` | Tab content padding bottom |
271
+ > | `size.gap` | string | `global.size.spacer * 2` | Tab content flex gap |
272
+
273
+ ###### tab
274
+
275
+ path: `component.tab[name]`
276
+
277
+ > | name | type | default value | description |
278
+ > |--------------------------|---------------------|--------------------------------------|-----------------------|
279
+ > | `size.px` | string | `global.size.spacer * 9` | Tab padding inline |
280
+ > | `size.py` | string | `global.size.spacer * 3` | Tab padding block |
281
+ > | `size.fontSize` | string | `global.size.fontSizeSm` | Tab font size |
282
+ > | `color.colorBg` | string | `global.color.colorBgNeutral` | Tab bg color |
283
+ > | `color.colorText` | string | `global.color.colorTextNeutral` | Tab text color |
284
+ > | `color.selectColorText` | string | `global.color.colorTextPrimary` | Tab select text color |
285
+ > | `color.colorTextHover` | string | `global.color.colorTextPrimaryHover` | Tab hover text color |
286
+ > | `style.fontWeight` | string | `global.style.fontWeightBold` | Tab font weight |
287
+ > | `style.lineHeight` | string | `global.size.lineHeightSm` | Tab line height |
288
+
289
+ ###### balance
290
+
291
+ path: `component.balance[name]`
292
+
293
+ > | name | type | default value | description |
294
+ > |------------------------|---------------------|------------------------------------|---------------------------|
295
+ > | `size.px` | string | `global.size.spacer * 3` | Balance padding inline |
296
+ > | `size.gap` | string | `global.size.gap` | Balance flex gap |
297
+ > | `size.fontSize` | string | `global.size.fontSizeLg` | Balance font size |
298
+ > | `size.lineHeight` | string | `global.size.lineHeightLg` | Balance line height |
299
+ > | `size.priceFontSize` | string | `global.size.fontSizeBase` | Balance price font size |
300
+ > | `size.priceLineHeight` | string | `global.size.lineHeightBase` | Balance price line height |
301
+ > | `color.colorText` | string | `global.color.colorTextPrimary` | Balance text color |
302
+ > | `color.priceColorText` | string | `global.color.colorTextSecondary` | Balance price text color |
303
+
304
+ ###### inputGroup
305
+
306
+ path: `component.inputGroup[name]`
307
+
308
+ > | name | type | default value | description |
309
+ > |----------------|---------------------|---------------------------------------|----------------------------|
310
+ > | `size.px` | string | `global.size.spacer * 3` | Input group padding inline |
311
+ > | `size.gap` | string | `global.size.gap` | Input group flex gap |
312
+
313
+ ###### input
314
+
315
+ path: `component.input[name]`
316
+
317
+ > | name | type | default value | description |
318
+ > |----------------------------|-------------------------|-------------------------------------|-----------------------------|
319
+ > | `size.px` | string | `global.size.spacer * 3` | Input padding inline |
320
+ > | `size.py` | string | `global.size.spacer * 2` | Input padding block |
321
+ > | `size.gap` | string | `global.size.gap * 2` | Input flex gap |
322
+ > | `size.priceGap` | string | `global.size.gap * 2` | Input flex gap |
323
+ > | `size.iconSize` | string | `global.size.iconSize` | Input icon size |
324
+ > | `size.iconSizeSm` | string | `global.size.iconSizeSm` | Input icon size sm |
325
+ > | `size.labelFontSize` | string | `global.size.fontSizeSm` | Input label line height |
326
+ > | `size.labelLineHeight` | string | `global.size.lineHeightSm` | Input label font size |
327
+ > | `size.fontSize` | string | `global.size.fontSizeSm` | Input font size |
328
+ > | `size.lineHeight` | string | `global.size.lineHeightSm` | Input line height |
329
+ > | `size.fontSizeLg` | string | `global.size.fontSizeLg` | Input font size lg |
330
+ > | `size.lineHeightLg` | string | `global.size.lineHeightLg` | Input line height lg |
331
+ > | `size.tokenFontSize` | string | `global.size.fontSizeXs` | Input token font size |
332
+ > | `size.tokenLineHeight` | string | `global.size.lineHeightXs` | Input token line height |
333
+ > | `size.tokenFontSizeSm` | string | `global.size.fontSizeBase` | Input token font size sm |
334
+ > | `size.tokenLineHeightSm` | string | `global.size.lineHeightBase` | Input token line height sm |
335
+ > | `size.buttonPx` | string | `global.size.spacer * 2` | Input button padding inline |
336
+ > | `size.buttonPy` | string | `global.size.spacer` | Input button padding block |
337
+ > | `size.buttonFontSize` | string | `global?.size?.fontSizeXs` | Input button font size |
338
+ > | `size.buttonLineHeight` | string | `global?.size?.lineHeightXs` | Input button line height |
339
+ > | `color.textColor` | string | `global.color.colorTextPrimary` | Input text color |
340
+ > | `color.loadingTextColor` | string | `global.color.colorTextLoading` | Input loading text color |
341
+ > | `color.bgColor` | string | `global.color.colorBgNeutral` | Input bg color |
342
+ > | `color.bgColorFocus` | string | `transparent` | Input bg color |
343
+ > | `color.borderColor` | string | `#4C505B` | Input border color |
344
+ > | `color.borderColorFocus` | string | `global.color.colorTextPrimary` | Input border focus color |
345
+ > | `color.placeholderColor` | string | `global.color.colorTextSecondary` | Input placeholder color |
346
+ > | `color.buttonBgColor` | string | `global.color.colorBgSecondary` | Input button bg color |
347
+ > | `color.buttonBorderColor` | string | `global.color.colorBgAccentTo` | Input button border color |
348
+ > | `color.buttonTextColor` | string | `global.color.colorTextPrimary` | Input button text color |
349
+ > | `style.radius` | string | `global.style.radiusPrimary` | Input border radius |
350
+ > | `style.labelFontWeight` | string | `global.style.fontWeightLight` | Input label font weight |
351
+ > | `style.fontWeight` | string | `global.style.fontWeightLight` | Input font weight |
352
+ > | `style.tokenFontWeight` | string | `global.style.fontWeightLight` | Input token font weight |
353
+ > | `style.buttonRadius` | string | `30px` | Input button border radius |
354
+
355
+ ###### tooltip
356
+
357
+ path: `component.tooltip[name]`
358
+
359
+ > | name | type | default value | description |
360
+ > |--------------------------|-------------------|-----------------------------------------------------------|------------------|
361
+ > | `color.colorBg` | string | `#12171F` | Tooltip bg color |
362
+
363
+ ###### switch
364
+
365
+ path: `component.switch[name]`
366
+
367
+ > | name | type | default value | description |
368
+ > |----------------------------|-------------------|------------------------------------------------------------|---------------------------|
369
+ > | `color.colorBgChecked` | string | `#152E4D` | Switch checked bg color |
370
+ > | `color.colorBg` | string | `#4C505B` | Switch unchecked bg color |
371
+
372
+ ###### actionButton
373
+
374
+ path: `component.actionButton[name]`
375
+
376
+ > | name | type | default value | description |
377
+ > |----------------------------------|---------------------|---------------------------------------|--------------------------------------------|
378
+ > | `size.borderWidth` | string | `1px` | Action button border width |
379
+ > | `color.colorBgFrom` | string | `global.color.colorBgAccentFrom` | Action button bg gradient color from |
380
+ > | `color.colorBgTo` | string | `global.color.colorBgAccentTo` | Action button bg gradient color to |
381
+ > | `color.colorBgFromHover` | string | `global.color.colorBgAccentFromHover` | Action button hover bg gradient color from |
382
+ > | `color.colorBgToHover` | string | `global.color.colorBgAccentTo` | Action button hover bg gradient color to |
383
+ > | `color.colorBorder` | string | `global.color.colorBgAccentFrom` | Action button border color |
384
+ > | `color.colorText` | string | `global.color.colorTextAccent` | Action button text color |
385
+ > | `color.colorText` | string | `global.color.colorTextAccent` | Action button text color |
386
+ > | `color.outlineColorBorder` | string | `#ffffff33` | Action outline button border color |
387
+ > | `color.outlineColorBorderHover` | string | `#ffffffCC` | Action outline button hover border color |
388
+ > | `color.outlineColorText` | string | `global.color.colorTextPrimary` | Action outline button text color |
389
+
390
+ ###### meta
391
+
392
+ path: `component.meta[name]`
393
+
394
+ > | name | type | default value | description |
395
+ > |-----------------------|---------------------|----------------------------------------|----------------------|
396
+ > | `size.gap` | string | `global.size.gap` | Meta flex gap |
397
+ > | `size.px` | string | `global.size.spacer * 3` | Meta padding inline |
398
+ > | `color.linkTextColor` | string | `global.color.colorBgAccentFrom` | Meta link text color |
399
+ > | `color.panelBgHover` | string | `config.global.color.colorBgNeutral` | Meta panel hover bg |
400
+
401
+ ###### Source: `packages/trading-widget/src/trading-widget/providers/theme-provider/theme-provider.tsx`
402
+ ###### Default values: `undefined`
403
+ </details>
404
+
405
+ ------------------------------------------------------------------------------------------
406
+
407
+ <details>
408
+ <summary>
409
+ <code>translation</code>
410
+ <code><b>/</b></code>
411
+ <code>Translation keys</code>
412
+ </summary>
413
+
414
+ > | name | type | default value | description |
415
+ > |---------------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
416
+ > | `depositSlippageWarning` | string | Includes entry fee. We recommend 2-3%, but usually it will be < 1%. Slippage may be amplified by the leverage. See the docs for more info. | |
417
+ > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
418
+ > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
419
+ > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
420
+ > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
421
+ > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
422
+ > | `dailyEarnings` | string | Daily Earnings | |
423
+ > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
424
+ > | `yearlyEarnings` | string | Yearly Earnings | |
425
+ > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
426
+ > | `tradeDetails` | string | Trade details | |
427
+ > | `maxSlippage` | string | Max slippage | |
428
+ > | `minReceiveAmount` | string | You will receive no less than this amount. | |
429
+ > | `minReceived` | string | Minimum Received | |
430
+ > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
431
+ > | `infinite` | string | Infinite | |
432
+ > | `tokenAllowance` | string | Token Allowance | |
433
+ > | `entryFee` | string | Entry Fee | |
434
+ > | `entryFeeExplanation` | string | When you deposit, the token takes a small entry fee. This fee helps cover the costs when we rebalance the underlying funds, and it's shared among all token holders. | |
435
+ > | `easySwapperEntryFee` | string | Entry fee is charged when a cooldown of {time} is selected. Bypass Entry Fee at trading settings. | |
436
+ > | `amountToBeApproved` | string | Amount of {symbol} tokens to be approved. Can be customized in settings. | |
437
+ > | `minDepositUsd` | string | Minimum deposit in USD. | |
438
+ > | `minDeposit` | string | Minimum Deposit | |
439
+ > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
440
+ > | `slippageTolerance` | string | Slippage tolerance | |
441
+ > | `bypassEntryFee` | string | Bypass Entry Fee | |
442
+ > | `entryFeeSwitchWarning` | string | By removing the entry fee, your position is locked for up to {defaultLockTime} instead of the normal {customLockTime}. | |
443
+ > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
444
+ > | `auto` | string | Auto | |
445
+ > | `autoSlippageDescription` | string | App is testing different slippage ranges, starting low and increasing until it's likely to pass | |
446
+ > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
447
+ > | `deposit` | string | Buy | |
448
+ > | `withdraw` | string | Sell | |
449
+ > | `yourBalance` | string | Your Balance | |
450
+ > | `max` | string | Max | |
451
+ > | `allAssets` | string | All Assets | |
452
+ > | `all` | string | All | |
453
+ > | `payWith` | string | Pay with | |
454
+ > | `buyEstimated` | string | Buy (estimated) | |
455
+ > | `sell` | string | Sell | |
456
+ > | `receiveEstimated` | string | Receive (estimated) | |
457
+ > | `confirmInWallet` | string | Please confirm in wallet | |
458
+ > | `pending` | string | Pending... | |
459
+ > | `approve` | string | Approve | |
460
+ > | `connectWallet` | string | Connect Wallet | |
461
+ > | `minimumPurchase` | string | Minimum purchase is ${value} | |
462
+ > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
463
+ > | `poolIsPrivate` | string | This vault is currently private | |
464
+ > | `updateOracles` | string | Update Oracles | |
465
+ > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
466
+ > | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
467
+ > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
468
+ > | `termsOfUse` | string | Terms Of Use | |
469
+ > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
470
+ > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
471
+ > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
472
+ > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
473
+ > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
474
+ > | `termOfUseDepositAccept` | string | Accept & Deposit | |
475
+ > | `back` | string | Back | |
476
+ > | `highSlippage` | string | High Slippage Alert | |
477
+ > | `responsibleHighSlippage` | string | By proceeding with this trade, you acknowledge and accept the possibility of experiencing high slippage, resulting in a potential difference between the expected and executed price. | |
478
+ > | `highSlippageListTitle` | string | Please consider the following before confirming | |
479
+ > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
480
+ > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
481
+ > | `confirm` | string | Confirm | |
482
+ > | `selectToken` | string | Select Token | |
483
+ > | `sendingOrderToWallet` | string | Sending order to your wallet | |
484
+ > | `settingUpTx` | string | Setting up transaction | |
485
+ > | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
486
+ > | `approveSpending` | string | Approve {symbol} spending | |
487
+ > | `pay` | string | Pay | |
488
+ > | `multiAssetFractions` | string | multi asset fractions | |
489
+ > | `explorer` | string | Explorer | |
490
+
491
+ ###### Source: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.tsx`
492
+ ###### Default values: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.defaults.ts`
493
+ </details>