@dhedge/trading-widget 1.0.5 → 1.1.0
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 +31 -29
- package/{index-a391969b.js → index-9a2113b6.js} +21612 -21555
- package/index-c27f1831.cjs +207 -0
- package/index.cjs +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/{pyth-adapter-8163f926.cjs → pyth-adapter-3e9fb745.cjs} +1 -1
- package/{pyth-adapter-9bc1dcc8.js → pyth-adapter-fbbbc272.js} +1 -1
- package/style.css +1 -1
- package/trading-widget/components/common/alert/alert.d.ts +6 -0
- package/trading-widget/components/common/index.d.ts +1 -0
- package/trading-widget/providers/component-provider/component-provider.d.ts +1 -0
- package/trading-widget/providers/component-provider/component-provider.defaults.d.ts +2 -0
- package/trading-widget/providers/component-provider/component-provider.hooks.d.ts +1 -0
- package/trading-widget/providers/component-provider/component-provider.types.d.ts +1 -0
- package/trading-widget/providers/config-provider/config-provider.types.d.ts +2 -1
- package/trading-widget/providers/overlay-provider/overlay-provider.hooks.d.ts +2 -1
- package/trading-widget/providers/overlay-provider/overlay-provider.types.d.ts +3 -2
- package/index-c83fa790.cjs +0 -207
package/README.md
CHANGED
|
@@ -104,29 +104,30 @@ UI configuration provider. Manages params to configure custom styling, component
|
|
|
104
104
|
|
|
105
105
|
##### params
|
|
106
106
|
|
|
107
|
-
> | name | type | default value | description
|
|
108
|
-
>
|
|
109
|
-
> | `isGeoBlocked` | `boolean` | `false` | Restricts depositing action button and conditionally renders GeoBlockAlert component
|
|
110
|
-
> | `
|
|
111
|
-
> | `
|
|
112
|
-
> | `
|
|
113
|
-
> | `
|
|
114
|
-
> | `
|
|
115
|
-
> | `
|
|
116
|
-
> | `
|
|
117
|
-
> | `
|
|
118
|
-
> | `
|
|
119
|
-
> | `
|
|
120
|
-
> | `
|
|
121
|
-
> | `
|
|
122
|
-
> | `
|
|
107
|
+
> | name | type | default value | description |
|
|
108
|
+
> |------------------------------------|----------------------------------------------------------------|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
109
|
+
> | `isGeoBlocked` | `boolean` | `false` | Restricts depositing action button and conditionally renders GeoBlockAlert component |
|
|
110
|
+
> | `isSanctioned` | `boolean` | `false` | Restricts depositing action button and conditionally renders SanctionedAlert component |
|
|
111
|
+
> | `depositQuoteDiffWarningThreshold` | `number` | `1` | Deposit slippage absolute percent value warning threshold, Affects styling to warn user |
|
|
112
|
+
> | `depositQuoteDiffErrorThreshold` | `number` | `3` | Deposit slippage absolute percent value error threshold, Affects styling to warn user |
|
|
113
|
+
> | `defaultDepositSlippage` | `number` | `0` | Initial deposit slippage absolute percent. Further adjustments are available in panel settings |
|
|
114
|
+
> | `defaultDepositSlippageScale` | `number[]` | `[0]` | Initial deposit slippage absolute percent. Further adjustments are available in panel settings |
|
|
115
|
+
> | `defaultWithdrawSlippageScale` | `number[]` | `[0.1, 0.3, 0.5, 1, 1.5, 3]` | Initial withdraw slippage absolute percent. Further adjustments are available in panel settings |
|
|
116
|
+
> | `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) |
|
|
117
|
+
> | `customLockTime` | `string` | `'15 minutes'` | Formatted custom deposit lock time alternative to be displayed in panel |
|
|
118
|
+
> | `stablePrecision` | `number` | `3` | Number of decimals to be displayed in stables (e.g USDC balance) |
|
|
119
|
+
> | `defaultPrecision` | `number` | `6` | Number of decimals to be displayed in token values |
|
|
120
|
+
> | `stakingChainId` | `number` | `10` (Optimism) | ChainId to be used in staking logic |
|
|
121
|
+
> | `termsOfUseAccepted` | `boolean` | `true` | Requires user to confirm terms of use by rendering DepositTermsOfUse component before deposit action |
|
|
122
|
+
> | `standalone` | `boolean` | `true` | Handles token selection in SPA mode |
|
|
123
|
+
> | `chainConfig` | `Partial<Record<ChainId, { name: string; iconPath: string }>>` | `{}` | Sets map of chain `name` and `iconPath` |
|
|
123
124
|
|
|
124
125
|
##### actions
|
|
125
126
|
|
|
126
|
-
> | name | type
|
|
127
|
-
>
|
|
128
|
-
> | `onConnect` | `() => void`
|
|
129
|
-
> | `onAcceptTermsOfUse` | `() =>
|
|
127
|
+
> | name | type | default value | description |
|
|
128
|
+
> |--------------------------------------|--------------------------|-------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
129
|
+
> | `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 |
|
|
130
|
+
> | `onAcceptTermsOfUse` | `() => Promise<boolean>` | `() => Promise.resolve(true)` | Callback is triggered after user's approval of Terms of Use statements assuming switching of external `config.termsOfUseAccepted` param to `true` state |
|
|
130
131
|
|
|
131
132
|
###### Source: `packages/trading-widget/src/trading-widget/providers/config-provider`
|
|
132
133
|
###### Default values: `packages/trading-widget/src/trading-widget/providers/config-provider/config-provider.defaults.ts`
|
|
@@ -139,15 +140,16 @@ UI configuration provider. Manages params to configure custom styling, component
|
|
|
139
140
|
<code>Custom components to be injected into widget layout</code>
|
|
140
141
|
</summary>
|
|
141
142
|
|
|
142
|
-
> | name
|
|
143
|
-
>
|
|
144
|
-
> | `GeoBlockAlert`
|
|
145
|
-
> | `
|
|
146
|
-
> | `
|
|
147
|
-
> | `
|
|
148
|
-
> | `
|
|
149
|
-
> | `
|
|
150
|
-
> | `
|
|
143
|
+
> | name | type | default value | description |
|
|
144
|
+
> |------------------------|--------------------------------------|---------------------|-----------------------------------------------------------------------------------------------------------------|
|
|
145
|
+
> | `GeoBlockAlert` | ComponentType | `<GeoBlockAlert>` | Component replaces deposit button while `isGeoBlocked` config param is set to `true` |
|
|
146
|
+
> | `SanctionedAlert` | ComponentType | `<SanctionedAlert>` | Component replaces deposit button while `isSanctioned` config param is set to `true` |
|
|
147
|
+
> | `DepositMetaInfo` | ComponentType | `undefined` | Component is injected into deposit meta part of widget layout nearby TransactionOverviewDisclosure |
|
|
148
|
+
> | `WithdrawMetaInfo` | ComponentType | `undefined` | Component is injected into withdraw meta part of widget layout nearby WithdrawTransactionOverviewDisclosure |
|
|
149
|
+
> | `ExtraActionButton` | ComponentType | `undefined` | Component is injected below deposit action button and rendered if `isGeoBlocked` config param is set to `false` |
|
|
150
|
+
> | `Image` | ComponentType<ImageProps> | `<img>` | Component optionally can be used to pass `nextjs` Image component to be used for assets rendering |
|
|
151
|
+
> | `LogoSpinner` | ComponentType<SVGProps<SVGElement>> | `<Spinner>` | Component is injected into widget pending transaction overlay. Assume using of spinning animation |
|
|
152
|
+
> | `DepositTermsOfUse` | ComponentType | `undefined` | Component is injected into `TermsOfUseOverlay` to extend default terms of use statement points |
|
|
151
153
|
|
|
152
154
|
|
|
153
155
|
###### Source: `packages/trading-widget/src/trading-widget/providers/component-provider/component-provider.tsx`
|