This is a Vite project together with React.
- Go to Reown Cloud and create a new project.
- Copy your
Project ID
- Rename
.env.example
to.env
and paste yourProject ID
as the value forVITE_PROJECT_ID
- Update the
VITE_SHYFT_WALLET_URL
to the Shyft Wallet URL - Run
pnpm install
to install dependencies - Run
pnpm run dev
to start the development server
-
Update your config file to include Shyft wallet connector:
import { Chain, http, createConfig } from 'wagmi' import { injected } from 'wagmi/connectors' const shyftConnector = injected({ target: 'shyft', shimDisconnect: true, }) export const wagmiAdapter = new WagmiAdapter({ projectId, networks, connectors: [shyftConnector] })
-
Configure Shyft wallet in your App:
const shyftWallet: CustomWallet = { id: 'shyft', name: 'Shyft Wallet', homepage: 'https://shyft.tech', image_url: 'https://s3.us-east-1.amazonaws.com/asset.shyft.tech/shyft-logo-back-128.png', webapp_link: 'https://app.shyft.tech', } createAppKit({ adapters: [wagmiAdapter], customWallets: [shyftWallet], showWallets: false, allWallets: 'HIDE', includeWalletIds: ['shyft'], enableInjected: false, enableCoinbase: false, ...generalConfig, features: { analytics: true } })
After you have configured the Shyft Wallet, the Shyft Wallet will be shown in the wallet list. User can connect to your app using the wallet.
-
Request sign message
import { signMessageAsync } from 'wagmi'
const { signMessageAsync } = useSignMessage() // Wagmi hook to sign a message
const msg = "Hello Reown AppKit!" // message to sign
const sig = await signMessageAsync({ message: msg, account: address as Address });
- Request send transaction
import { useSendTransaction } from 'wagmi'
const { data: hash, sendTransaction, } = useSendTransaction(); // Wagmi hook to send a transaction
const handleSendTx = () => {
try {
sendTransaction({
...transaction,
});
} catch (err) {
console.log('Error sending transaction:', err);
}
}