Magic signer
Magic is a popular embedded wallet provider that supports social logins, making it easier for users to onboard without managing private keys.
Setup
To use Magic with SDK Core , first create an application that integrates with Magic.
Refer to the Magic documentation site for instructions on setting up an application with the Magic SDK.
For a quick start, Magic provides a CLI to create a starter project, available here.
Integration
After following the Magic documentation, you will have access to a MagicBase
object as shown below that you can pass as an owner to createSafeSmartAccount
:
import { OAuthExtension } from "@magic-ext/oauth"
import { Magic as MagicBase } from "magic-sdk"
import { providerToSmartAccountSigner } from "@cometh/connect-core-sdk";
const rpcUrl = process.env.RPC_URL;
const magicApiKey = process.env.MAGIC_API_KEY;
const magic = new MagicBase(magicApiKey as string, {
network: {
rpcUrl,
chainId: arbitrumSepolia.id,
},
extensions: [new OAuthExtension()],
})
// Get the Provider from Magic and convert it to a signer
const magicProvider = await magic.wallet.getProvider()
const signer = await providerToSmartAccountSigner(magicProvider);
Last updated