4.0.0 • Published 8 months ago

@paperxyz/embedded-wallet-service-wagmi v4.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

Paper is a developer platform for NFT commerce that easily onboards users without a wallet or cryptocurrency.

Documentation

Installation

Install embedded-wallet-service-wagmi and peer dependencies (wagmi and ethers):

npm install @paperxyz/embedded-wallet-service-wagmi wagmi ethers@^5
yarn add @paperxyz/embedded-wallet-service-wagmi wagmi ethers@^5

Add the Embedded Wallet connector to wagmi:

import { createClient, configureChains } from "wagmi";
import { polygon } from "wagmi/chains";
import { publicProvider } from "wagmi/providers/public";

const { chains, provider } = configureChains([polygon], [publicProvider()]);

// Create a Wagmi-compatible connector for Paper Embedded Wallet.
const paperEmbeddedWallet = new PaperEmbeddedWalletWagmiConnector({
  chains,
  options: {
    chain: "Polygon",
    clientId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  },
});

const client = createClient({
  connectors: [paperEmbeddedWallet],
  provider,
});

// Wrap your application with WagmiConfig.
function App() {
  return <WagmiConfig client={client}>/** ...your app */</WagmiConfig>;
}

Arguments

chains

The list of chains your application may use.

options

The argument passed into the PaperEmbeddedWalletSdk constructor. See PaperEmbeddedWalletSdk.