File tree Expand file tree Collapse file tree
components/Widgets/variants/widgetConfig Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { AB_TEST_NAME } from '@/const/abtests' ;
2+ import { useABTest } from '@/hooks/useABTest' ;
3+ import { makeProviders } from '@/utils/instrumentation/lifiSdkConfig' ;
14import { useAccount } from '@lifi/wallet-management' ;
2- import { ChainType , HiddenUI , type WidgetConfig } from '@lifi/widget' ;
5+ import { HiddenUI , type WidgetConfig } from '@lifi/widget' ;
36import merge from 'lodash/merge' ;
47import { useMemo } from 'react' ;
5- import { AB_TEST_NAME } from '@/const/abtests' ;
6- import { useABTest } from '@/hooks/useABTest' ;
78import type {
89 MainWidgetContext ,
910 MissionWidgetContext ,
@@ -143,6 +144,13 @@ export function useWidgetConfig<T extends WidgetType>(
143144 } ;
144145 }
145146
147+ baseConfig . sdkConfig = {
148+ ...( baseConfig . sdkConfig ?? { } ) ,
149+ providers : makeProviders ( ) ,
150+ } ;
151+
152+ console . error ( 'jumper init baseConfig' , baseConfig ) ;
153+
146154 return baseConfig ;
147155 } , [
148156 sharedBase ,
Original file line number Diff line number Diff line change @@ -18,18 +18,27 @@ export const GLOBAL_HEADERS = {
1818// (injected by the layout <script> tag) is available when getApiUrl() runs.
1919let _client : ReturnType < typeof createClient > ;
2020
21+ /**
22+ * Define our custom providers in a function
23+ * used by the widget and our jumper sdk client.
24+ * This ensures the configuration is consistent accross the UI.
25+ */
26+ export const makeProviders = ( ) => {
27+ return [
28+ EthereumProvider ( ) ,
29+ JumperSolanaProvider ( ) ,
30+ BitcoinProvider ( ) ,
31+ SuiProvider ( ) ,
32+ TronProvider ( ) ,
33+ ] ;
34+ } ;
35+
2136function initClient ( ) {
2237 if ( ! _client ) {
2338 _client = createClient ( {
2439 apiKey : config . NEXT_PUBLIC_LIFI_API_KEY ,
2540 apiUrl : getApiUrl ( ) ,
26- providers : [
27- EthereumProvider ( ) ,
28- JumperSolanaProvider ( ) ,
29- BitcoinProvider ( ) ,
30- SuiProvider ( ) ,
31- TronProvider ( ) ,
32- ] ,
41+ providers : makeProviders ( ) ,
3342 integrator : config . NEXT_PUBLIC_WIDGET_INTEGRATOR || 'jumper.exchange' ,
3443 rpcUrls : {
3544 ...JSON . parse ( config . NEXT_PUBLIC_CUSTOM_RPCS ?? '{}' ) ,
You can’t perform that action at this time.
0 commit comments