<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Developers Forum for XinFin XDC Network: Alexandra</title>
    <description>The latest articles on Developers Forum for XinFin XDC Network by Alexandra (@alexandra_etherspot).</description>
    <link>https://www.xdc.dev/alexandra_etherspot</link>
    <image>
      <url>https://www.xdc.dev/images/NLHYkUIJ05-nvoSPPQvpuI2iwayExiLK7nmS4gJGzR0/rs:fill:90:90/mb:500000/ar:1/aHR0cHM6Ly93d3cu/eGRjLmRldi91cGxv/YWRzL3VzZXIvcHJv/ZmlsZV9pbWFnZS8z/MzI1L2JiODRhOTVm/LTM0MDAtNGRlMC1h/NjY4LTdiMGE4NzJi/ODQ3Yi5KUEc</url>
      <title>Developers Forum for XinFin XDC Network: Alexandra</title>
      <link>https://www.xdc.dev/alexandra_etherspot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://www.xdc.dev/feed/alexandra_etherspot"/>
    <language>en</language>
    <item>
      <title>📢Account Abstraction is LIVE on the XDC Mainnet with Etherspot</title>
      <dc:creator>Alexandra</dc:creator>
      <pubDate>Mon, 02 Sep 2024 08:50:35 +0000</pubDate>
      <link>https://www.xdc.dev/alexandra_etherspot/account-abstraction-is-live-on-the-xdc-mainnet-with-etherspot-k8m</link>
      <guid>https://www.xdc.dev/alexandra_etherspot/account-abstraction-is-live-on-the-xdc-mainnet-with-etherspot-k8m</guid>
      <description>&lt;p&gt;We’re excited to announce that Etherspot’s Account Abstraction Infrastructure is now available on the XDC Network mainnet, empowering developers to offer unparalleled user experiences!&lt;/p&gt;

&lt;p&gt;With &lt;a href="https://etherspot.io/?utm_source=xdcdev&amp;amp;utm_medium=article&amp;amp;utm_campaign=es_xdc"&gt;Etherspot’s Account Abstraction infrastructure&lt;/a&gt;, developers on the XDC Network will gain access to a suite of tools such as &lt;a href="https://etherspot.fyi/modular-sdk/intro"&gt;Etherspot Modular SDK&lt;/a&gt;, &lt;a href="https://etherspot.fyi/skandha/intro"&gt;Skandha Bundler&lt;/a&gt;, and &lt;a href="https://etherspot.fyi/arka/intro"&gt;Arka Paymaster&lt;/a&gt; that streamline user interactions with their dApps. This integration is set to unlock a host of powerful features that will enhance both the developer and user experience on XDC:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simplified Onboarding:&lt;/strong&gt; Users can log into dApps effortlessly using familiar Web2 options like X (formerly Twitter), Discord, Gmail, and more, which makes onboarding in the Web3 space much easier.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gas Fees in Stablecoins:&lt;/strong&gt; Users can cover gas fees using stablecoins instead of native tokens, offering more flexibility and simplifying the transaction process.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Transaction Batching:&lt;/strong&gt; Users can save time and reduce costs by combining multiple transactions into one, streamlining interactions and enhancing efficiency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smooth Cross-Chain Interactions:&lt;/strong&gt; Etherspot’s AA infrastructure enables smoother interactions across different chains within a single dApp, breaking down barriers and creating a more unified user experience.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚙️ To implement powerful Account Abstraction features into your dApp, follow these steps:&lt;/p&gt;

&lt;p&gt;1.&lt;strong&gt;Install the packages&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;❗️ Note: You should have installed Node.js (version 18.10.0 or higher).&lt;/p&gt;

&lt;p&gt;Install Etherspot Modular SDK with this command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i @etherspot/modular-sdk --save
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2.&lt;strong&gt;Import the SDK&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { ModularSdk } from '@etherspot/modular-sdk';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3.&lt;strong&gt;Get the smart contract address&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’re unsure about the difference between key-based accounts and smart contract accounts, please take a look at this page.&lt;/p&gt;

&lt;p&gt;In this example, we simply create a key-based wallet with ethers.js like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const randomWallet = ethers.Wallet.createRandom();
const privateKey = randomWallet.privateKey;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Set the privayeKey in the .env : WALLET_PRIVATE_KEY
set the apiKey in .env: API_KEY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we use this key-based wallet to instantiate the SDK on XDC Network and get the wallet address.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const chainId = 50;
const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY }, 
{ chainId: chainId, 
bundlerProvider: new EtherspotBundler(chainId, 
bundlerApiKey, customBundlerUrl) }) 
const address: string = await primeSdk.getCounterFactualAddress();
console.log(address);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;4.&lt;strong&gt;Send funds to another address&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Getting all together into a function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { EtherspotBundler, ModularSdk, MODULE_TYPE, printOp, sleep } from '@etherspot/modular-sdk';
import * as dotenv from 'dotenv';

const recipient = ''; // recipient wallet address
const value = '0.0000001'; // transfer value
const bundlerApiKey = process.env.API_KEY;
const privateKey = process.env.WALLET_PRIVATE_KEY;

// initializating sdk...
const modularSdk = new ModularSdk({ privateKey: process.env.WALLET_PRIVATE_KEY },
{ chainId: Number(process.env.CHAIN_ID),
bundlerProvider: new EtherspotBundler(Number(process.env.CHAIN_ID), bundlerApiKey) })

console.log('address: ', modularSdk.state.EOAAddress)

// get address of EtherspotWallet...
const address: string = await modularSdk.getCounterFactualAddress();
console.log('\x1b[33m%s\x1b[0m', `EtherspotWallet address: ${address}`);

// clear the transaction batch
await modularSdk.clearUserOpsFromBatch();

// add transactions to the batch
const transactionBatch = await modularSdk.addUserOpsToBatch({ to: recipient, value: ethers.utils.parseEther(value) });
console.log('transactions: ', transactionBatch);

// get balance of the account address
const balance = await modularSdk.getNativeBalance();

console.log('balances: ', balance);

// estimate transactions added to the batch and get the fee data for the UserOp
const op = await modularSdk.estimate();
console.log(`Estimate UserOp: ${await printOp(op)}`);

// sign the UserOp and sending to the bundler...
const uoHash = await modularSdk.send(op);
console.log(`UserOpHash: ${uoHash}`);

// get transaction hash...
console.log('Waiting for transaction...');
let userOpsReceipt = null;
const timeout = Date.now() + 60000; // 1 minute timeout
while ((userOpsReceipt == null) &amp;amp;&amp;amp; (Date.now() &amp;lt; timeout)) {
await sleep(2);
userOpsReceipt = await modularSdk.getUserOpReceipt(uoHash);
}
console.log('\x1b[33m%s\x1b[0m', `Transaction Receipt: `, userOpsReceipt);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;For the next steps, you can look at &lt;a href="https://etherspot.fyi/modular-sdk/sessionkey/functions"&gt;functions&lt;/a&gt; or &lt;a href="https://etherspot.fyi/modular-sdk/sessionkey/examples/intro"&gt;examples&lt;/a&gt; to tailor the dApp to what you’re trying to accomplish.&lt;/p&gt;

&lt;p&gt;For more info and guidance on commencing your development journey with Etherspot, please refer to our 📚documentation &lt;a href="https://etherspot.fyi/introduction"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you have any questions, do not hesitate to chat with the team on 👾&lt;a href="https://discord.etherspot.io"&gt;Discord&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;🧑‍💻Build unmatched Web3 user experience by removing usability pain points with Etherspot's Account Abstraction infrastructure! Happy coding!&lt;/p&gt;

</description>
      <category>xdc</category>
      <category>etherspot</category>
      <category>integration</category>
      <category>accountabstraction</category>
    </item>
  </channel>
</rss>
