@openzeppelin/contracts-ui-builder-adapter-stellar
Version:
Stellar Adapter for Contracts UI Builder
18 lines (13 loc) • 507 B
text/typescript
import { useContext } from 'react';
import { StellarWalletContext, type StellarWalletContextType } from './StellarWalletContext';
/**
* Hook to use the Stellar wallet context
* @throws Error if used outside of StellarWalletUiRoot
*/
export function useStellarWalletContext(): StellarWalletContextType {
const context = useContext(StellarWalletContext);
if (context === undefined) {
throw new Error('useStellarWalletContext must be used within a StellarWalletUiRoot');
}
return context;
}