@dynamic-labs/sdk-react-core
Version:
A React SDK for implementing wallet web3 authentication and authorization to your website.
19 lines (16 loc) • 727 B
JavaScript
'use client'
import { useContext } from 'react';
import { ConnectWithOtpContext } from './ConnectWithOtpContext.js';
const useConnectWithOtp = ({ emailProvider: defaultProvider, } = {}) => {
const context = useContext(ConnectWithOtpContext);
if (!context) {
throw new Error('useConnectWithOtp must be used within a DynamicContextProvider');
}
return {
connectWithEmail: (email, options = {}) => context.connectWithEmail(email, Object.assign({ provider: defaultProvider }, options)),
connectWithSms: context.connectWithSms,
retryOneTimePassword: context.retryOneTimePassword,
verifyOneTimePassword: context.verifyOneTimePassword,
};
};
export { useConnectWithOtp };