sdk-passkeyring
v1.1.5
Published
sdk passkeyring to connect smart account
Downloads
1,762
Readme
Passkey connect
The sdk package provides a simple support connect Smart account.
Install (for single position)
npm install --save sdk-passkeyring
yarn add sdk-passkeyring
Usage
//Used for the first file to run (index.js)
import React from "react";
import { PasskeyProvider } from "sdk-passkeyring";
const App = ({children}) => {
return (
<PasskeyProvider>
{children}
</PasskeyProvider>
);
};
export default App;
//example
import React from "react";
import { useConnect, useAccount, PasskeyProvider } from "sdk-passkeyring";
const Home = () => {
const { onConnect, isConnected, onDisconnect } = useConnect();
const account = useAccount() ;
const { address } = account;
return (
<div>
{isConnected ? (
<div>
<h1>Connected</h1>
<button
onClick={() => {
onConnect();
}}
>
Address: {address}
</button>
<br />
<button
onClick={() => {
onDisconnect();
}}
>
disConnect
</button>
</div>
) : (
<button onClick={onConnect}>Connect</button>
)}
</div>
);
};
export default Home;