Skip to content

Commit

Permalink
edit
Browse files Browse the repository at this point in the history
  • Loading branch information
YuriGii committed May 1, 2024
1 parent 32dd2d3 commit 285442c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/rmrk-hooks/src/lib/RMRKContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ type RMRKConfigInitial = {
ipfsGateway?: string;
};

export type RMRKConfig<utilityContracts extends RMRKUtilityContracts = RMRKUtilityContracts> = {
export type RMRKConfig<
utilityContracts extends RMRKUtilityContracts = RMRKUtilityContracts,
> = {
utilityContracts: utilityContracts;
ipfsGateway?: string;
};
Expand All @@ -27,11 +29,15 @@ export type ConfigParameter<config extends RMRKConfig = RMRKConfig> = {
config?: RMRKConfig | config | undefined;
};

export const RMRKContext = React.createContext<RMRKConfig | undefined>(undefined);
export const RMRKContext = React.createContext<RMRKConfig | undefined>(
undefined,
);

export type UseConfigReturnType<config extends RMRKConfig = RMRKConfig> = config;
export type UseConfigReturnType<config extends RMRKConfig = RMRKConfig> =
config;

export type UseConfigParameters<config extends RMRKConfig = RMRKConfig> = ConfigParameter<config>;
export type UseConfigParameters<config extends RMRKConfig = RMRKConfig> =
ConfigParameter<config>;

export function useRMRKConfig<
config extends RMRKConfig = ResolveRMRKConfig['config'],
Expand All @@ -51,5 +57,7 @@ export const RMRKContextProvider = ({ children, config }: Props) => {
utilityContracts: EVM_RMRK_CONTRACTS,
} satisfies RMRKConfig;
const rmrkConfig = mergeDeepRight(defaultConfig, config || {});
return <RMRKContext.Provider value={rmrkConfig}>{children}</RMRKContext.Provider>;
return (
<RMRKContext.Provider value={rmrkConfig}>{children}</RMRKContext.Provider>
);
};

0 comments on commit 285442c

Please sign in to comment.