Skip to content

Commit

Permalink
Merge pull request #133 from B-Venkatesh7210/newTipSections
Browse files Browse the repository at this point in the history
Added Tip Section for Particle
  • Loading branch information
Rahat-ch authored Dec 14, 2023
2 parents b092f5e + c270817 commit 960b4c6
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 60 deletions.
119 changes: 60 additions & 59 deletions docs/Account/signers/particle.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
---
sidebar_label: 'Particle Network'
sidebar_label: "Particle Network"
sidebar_position: 3
---

# Particle Network

One way to utilize Social Logins is via Particle Network. This section will give you code snippets for creating Biconomy Smart Accounts with Particle Network. Particle Network allows you to introduce familiar Web2 experiences, with the following code snippets you can unlock: authentication with email to create a smart account as well as authentication with different social providers to create a Smart Account.
One way to utilize Social Logins is via Particle Network. This section will give you code snippets for creating Biconomy Smart Accounts with Particle Network. Particle Network allows you to introduce familiar Web2 experiences, with the following code snippets you can unlock: authentication with email to create a smart account as well as authentication with different social providers to create a Smart Account.

:::tip

Check out an end-to-end integration of Particle with Biconomy on this [example app](https://aaparticle.vercel.app/) and [repo](https://github.com/bcnmy/biconomy_particle_example)!

:::

## Dependencies

Expand All @@ -20,84 +24,81 @@ yarn add @biconomy/account @biconomy/bundler @biconomy/common @biconomy/core-typ
## Imports

```typescript
import { IPaymaster, BiconomyPaymaster } from '@biconomy/paymaster'
import { IBundler, Bundler } from '@biconomy/bundler'
import { BiconomySmartAccountV2, DEFAULT_ENTRYPOINT_ADDRESS } from "@biconomy/account"
import { Wallet, providers, ethers } from 'ethers';
import { ChainId } from "@biconomy/core-types"
import { IPaymaster, BiconomyPaymaster } from "@biconomy/paymaster";
import { IBundler, Bundler } from "@biconomy/bundler";
import {
BiconomySmartAccountV2,
DEFAULT_ENTRYPOINT_ADDRESS,
} from "@biconomy/account";
import { Wallet, providers, ethers } from "ethers";
import { ChainId } from "@biconomy/core-types";
import { ParticleAuthModule, ParticleProvider } from "@biconomy/particle-auth";
```

## Particle Auth Configuration
## Particle Auth Configuration

Particle auth will require api keys which you can get from the [Particle Dashboard](https://docs.particle.network/getting-started/dashboard).


```typescript
const particle = new ParticleAuthModule.ParticleNetwork({
projectId: "",
clientKey: "",
appId: "",
wallet: {
displayWalletEntry: true,
defaultWalletEntryPosition: ParticleAuthModule.WalletEntryPosition.BR,
},
});
const particle = new ParticleAuthModule.ParticleNetwork({
projectId: "",
clientKey: "",
appId: "",
wallet: {
displayWalletEntry: true,
defaultWalletEntryPosition: ParticleAuthModule.WalletEntryPosition.BR,
},
});
```

## Biconomy Configuration Values

Set up instances of Bundler, Paymaster. Alternativedly you can also use the Multi chain Module this way.

```typescript

const bundler: IBundler = new Bundler({
// get from biconomy dashboard https://dashboard.biconomy.io/
bundlerUrl: '',
chainId: ChainId.POLYGON_MUMBAI,// or any supported chain of your choice
entryPointAddress: DEFAULT_ENTRYPOINT_ADDRESS,
})

// get from biconomy dashboard https://dashboard.biconomy.io/
bundlerUrl: "",
chainId: ChainId.POLYGON_MUMBAI, // or any supported chain of your choice
entryPointAddress: DEFAULT_ENTRYPOINT_ADDRESS,
});

const paymaster: IPaymaster = new BiconomyPaymaster({
// get from biconomy dashboard https://dashboard.biconomy.io/
paymasterUrl: ''
})

paymasterUrl: "",
});
```

## Create the Biconomy Smart Account
## Create the Biconomy Smart Account

```typescript

const connect = async () => {
try {
const userInfo = await particle.auth.login();
console.log("Logged in user:", userInfo);
const particleProvider = new ParticleProvider(particle.auth);
const web3Provider = new ethers.providers.Web3Provider(
particleProvider,
"any"
);

const module = await ECDSAOwnershipValidationModule.create({
try {
const userInfo = await particle.auth.login();
console.log("Logged in user:", userInfo);
const particleProvider = new ParticleProvider(particle.auth);
const web3Provider = new ethers.providers.Web3Provider(
particleProvider,
"any"
);

const module = await ECDSAOwnershipValidationModule.create({
signer: web3Provider.getSigner(),
moduleAddress: DEFAULT_ECDSA_OWNERSHIP_MODULE
})

let biconomySmartAccount = await BiconomySmartAccountV2.create({
chainId: ChainId.POLYGON_MUMBAI,
bundler: bundler,
paymaster: paymaster,
entryPointAddress: DEFAULT_ENTRYPOINT_ADDRESS,
defaultValidationModule: module,
activeValidationModule: module
})

const address = await biconomySmartAccount.getAccountAddress()
} catch (error) {
console.error(error);
}
};

```
moduleAddress: DEFAULT_ECDSA_OWNERSHIP_MODULE,
});

let biconomySmartAccount = await BiconomySmartAccountV2.create({
chainId: ChainId.POLYGON_MUMBAI,
bundler: bundler,
paymaster: paymaster,
entryPointAddress: DEFAULT_ENTRYPOINT_ADDRESS,
defaultValidationModule: module,
activeValidationModule: module,
});

const address = await biconomySmartAccount.getAccountAddress();
} catch (error) {
console.error(error);
}
};
```
6 changes: 5 additions & 1 deletion docs/supportedchains/supportedchains.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ List of chains supported by our Paymasters and Bundlers.
11. Chiliz Mainnet
12. Astar Mainnet
13. opBNB Mainnet
14. Manta Mainnet
15. Core Mainnet


## Testnet Chains
Expand All @@ -36,8 +38,10 @@ List of chains supported by our Paymasters and Bundlers.
8. Base Goerli Testnet
9. Linea Testnet
10. Chiliz Spicy Testnet
11. Astar Shibuya testnet
11. Astar Shibuya Testnet
12. opBNB Testnet
13. Manta Pacific Testnet
14. Core Chain Testnet

:::info
Building on Chiliz Mainnet or the Spicy Testnet? Note that the entry point address on Chiliz is different. The entry point contract for this chain was deployed by the Biconomy team. The address of the entry point is : [0x00000061FEfce24A79343c27127435286BB7A4E1](https://scan.chiliz.com/address/0x00000061FEfce24A79343c27127435286BB7A4E1/contracts#address-tabs)
Expand Down

0 comments on commit 960b4c6

Please sign in to comment.