@undrground/auth
Version:
Web3 Lukso authentication for NextJS. Built by the undrground team
23 lines (20 loc) • 755 B
JavaScript
import * as React from 'react';
import { connectUP, connectEOA } from '@undrground/auth/client';
const ConnectButton = /*#__PURE__*/ React.forwardRef(({ className, setState, provider, ...props }, ref)=>{
const [loading, setLoading] = React.useState(false);
const connect = async ()=>{
setLoading(true);
const connectFn = provider === "up" ? connectUP : connectEOA;
const wallet = await connectFn().finally(()=>setLoading(false));
setState(wallet);
};
return /*#__PURE__*/ React.createElement("button", {
onClick: connect,
disabled: loading,
className: className,
ref: ref,
...props
});
});
ConnectButton.displayName = "ConnectButton";
export { ConnectButton };