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 ,
@@ -139,6 +140,13 @@ export function useWidgetConfig<T extends WidgetType>(
139140 } ;
140141 }
141142
143+ baseConfig . sdkConfig = {
144+ ...( baseConfig . sdkConfig ?? { } ) ,
145+ providers : makeProviders ( ) ,
146+ } ;
147+
148+ console . error ( 'jumper init baseConfig' , baseConfig ) ;
149+
142150 return baseConfig ;
143151 } , [
144152 sharedBase ,
Original file line number Diff line number Diff line change @@ -17,17 +17,26 @@ export const GLOBAL_HEADERS = {
1717// (injected by the layout <script> tag) is available when getApiUrl() runs.
1818let _client : ReturnType < typeof createClient > ;
1919
20+ /**
21+ * Define our custom providers in a function
22+ * used by the widget and our jumper sdk client.
23+ * This ensures the configuration is consistent accross the UI.
24+ */
25+ export const makeProviders = ( ) => {
26+ return [
27+ EthereumProvider ( ) ,
28+ JumperSolanaProvider ( ) ,
29+ BitcoinProvider ( ) ,
30+ SuiProvider ( ) ,
31+ ] ;
32+ } ;
33+
2034function initClient ( ) {
2135 if ( ! _client ) {
2236 _client = createClient ( {
2337 apiKey : config . NEXT_PUBLIC_LIFI_API_KEY ,
2438 apiUrl : getApiUrl ( ) ,
25- providers : [
26- EthereumProvider ( ) ,
27- JumperSolanaProvider ( ) ,
28- BitcoinProvider ( ) ,
29- SuiProvider ( ) ,
30- ] ,
39+ providers : makeProviders ( ) ,
3140 integrator : config . NEXT_PUBLIC_WIDGET_INTEGRATOR || 'jumper.exchange' ,
3241 rpcUrls : {
3342 ...JSON . parse ( config . NEXT_PUBLIC_CUSTOM_RPCS ?? '{}' ) ,
You can’t perform that action at this time.
0 commit comments