@crtxio/wallet
@crtxio/wallet is a Nuxt3 layer which provides Nuxt 3 components and composables to log into MetaMask or Magic accounts.
Setup
Make sure to install the dependencies:
npm install --save @crtxio/wallet
or
yarn add @crtxio/wallet
Add the dependency to your extends
in nuxt.config
:
defineNuxtConfig({
extends: [
'@crtxio/wallet'
]
})
How to use it
Components
<template>
<Wallet
:rpc-url="rpcUrl"
:magic-key="magicKey"
:chainid="chainId"
connectPrompt="<your-connect-prompt>"
connectClassProperties="<your-css-classes-for-connect-button>"
expandedClassProperties="<your-css-classes-for-wallet-selection-frame>"
:services="['metamask', 'magic']"
/>
</template>
Composables
// returns the provider or null
await getProvider(service: string, magicKey = '', rpcUrl = '', chainId= 1)
// returns signer or null
await getSigner(service: string, magicKey = '', rpcUrl = '', chainId= 1)
// returns account value
await getAccount()
// returns wallet state
await getWalletState()