Account Funds
This guide explains how to manage your Lens Account funds.
The Lens Account is a smart wallet that allows you to manage funds for your collects, tips, and other transactions on Lens. By using the Lens Account funds, your wallet's exposure to the Lens app is minimized, which helps mitigate potential security threats.
Fiat On-Ramps
Integrate fiat on-ramps into your app to allow users to deposit funds into their Lens Account using a debit or credit card. This can be achieved with Thirdweb Pay.
The following procedure lays a foundation for integrating fiat on-ramps into your app.
No tokens will be sent to the Lens Account at this stage. This applies only to the Testnet and serves as an interim solution while we finalize the underlying details for the Mainnet.
First, log in to the thirdweb dashboard. Navigate to the Settings page and create an API key to get your Client ID.
Next, install the thirdweb SDK.
And, wrap your app with the <ThirdwebProvider> component as follows.
App.tsx
import { ThirdwebProvider } from "thirdweb/react";
export default function App() { return <ThirdwebProvider>{/* Your app code here */}</ThirdwebProvider>;}
Create a thirdweb client using your Client ID.
thirdweb.ts
import { createThirdwebClient } from "thirdweb";
export const client = createThirdwebClient({ clientId: "<your_client_id>",});
Finally, integrate the PayEmbed widget into your app to allow users to deposit funds using fiat on-ramps.
These values are for testing purposes only and are intended to help you integrate fiat on-ramps user experience while we finalize the underlying details for the Mainnet.
import { base } from "thirdweb/chains";import { PayEmbed } from "thirdweb/react";
import { client } from "./thirdweb";
// …
<PayEmbed client={client} payOptions={{ buyWithFiat: { preferredProvider: "COINBASE", testMode: true, // <<<<<<<<< IMPORTANT!!! enable test mode }, buyWithCrypto: false, prefillBuy: { token: { // Using GHO on Ethereum to get quotes working address: "0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f",
// Making it look like GRASS token name: "GRASS", symbol: "GRASS", icon: "https://block-explorer.testnet.lens.dev/images/grass.png", }, chain: ethereum, // workaround for getting quotes working allowEdits: { amount: true, // allow editing buy amount token: false, // disable selecting buy token chain: false, // disable selecting buy chain }, }, onPurchaseSuccess: (purchase) => { console.log("Purchase success", purchase); }, }}/>;
Wallet Adapters
To prevent the need to reconnect the wallet when using the PayEmbed widget, you can utilize the wallet adapter for your chosen library.
- Viem
- Ethers
If you encounter a TypeScript error while assigning the WalletClient instance to the thirdweb viem adapter, it is likely due to a version mismatch between the viem version you have installed and the version used in the thirdweb SDK.
Type Error
export const thirdwebWallet = await viemAdapter.wallet.fromViem({ walletClient: walletClient,});
To fix this, you can force the viem version in your package.json file according to the package manager you are using.
Then, run the following line before embedding the PayEmbed widget.
await thirdwebWallet.connect({ client });
And pass the thirdweb wallet to the PayEmbed widget.
import { thirdwebWallet } from "./thirdweb";
// …
<PayEmbed activeWallet={thirdwebWallet} client={client} // …/>;
That's it—this will make the PayEmbed widget render without displaying a Connect button.
Deposit Funds
More information on how to deposit funds onto your Lens Account will be added in due course.
Withdraw Funds
More information on how to withdraw funds from your Lens Account will be added in due course.