Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update particle.mdx #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 17 additions & 22 deletions docs/pages/sdk/signers/particle.mdx
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
# Use Particle Network with ZeroDev

[Particle Network](https://particle.network/) is an intent-centric, modular wallet-as-a-service (WaaS). By utilizing MPC-TSS for key management, Particle can streamline onboarding via familiar Web2 methods such as Google, emails, and phone numbers.
[Particle Network](https://particle.network) provides Wallet Abstraction services that make user onboarding easier.

By combining ZeroDev with Particle, you can use Particle to enable a smooth social login experience, while using ZeroDev as the smart wallet to sponsor gas for users, batch transactions, and more.
Using the [Particle Auth SDK](https://developers.particle.network/api-reference/auth/desktop-sdks/web), you can enable quick, 2-click onboarding through social logins. Users can sign up with familiar Web2 options like Google, email, or phone numbers. Particle ensures both security and convenience by employing MPC-TSS for secure key management.

Integrating ZeroDev with Particle Auth enables a seamless social login experience through Particle, while leveraging ZeroDev as the smart wallet to handle gas fee sponsorship, transaction batching, and additional advanced features.

## Set up

To use Particle Network with ZeroDev, first create an application that integrates with Particle Network.
To integrate Particle Network with ZeroDev, start by creating a Particle Auth application:

- Refer to the [Particle Network documentation site](https://docs.particle.network/) for instructions on setting up an application with the Particle Network.
- For a quick start, Particle Network provides a guide, available [here](https://docs.particle.network/getting-started/get-started).
1. Refer to the [Particle Quickstart guide](https://developers.particle.network/guides/wallet-as-a-service/waas/auth/web-quickstart) to quickly set up a Particle Auth project.

## Integration
Integrating ZeroDev with Particle Network is straightforward after setting up the project. Particle Network provides an Externally Owned Account (EOA) wallet to use as a signer with Kernel.

Integrating ZeroDev with Particle Auth is straightforward after setting up the project. Particle Auth provides an Externally Owned Account (EOA) wallet to use as a signer with Kernel.

### Create the Particle Network object
After following the Particle Network documentation, you will have access to a `ParticleProvider` object as shown below:

Once your Particle Auth project is set up, you will have access to a `provider` object through the `useEthereum()` hook, as shown below.

```typescript
import { ParticleNetwork } from "@particle-network/auth";
import { ParticleProvider } from "@particle-network/provider";

// Param options here will be specific to your project. See the Particle docs for more info.
const particle = new ParticleNetwork({
projectId,
clientKey,
appId,
chainName,
chainId,
});
const particleProvider = new ParticleProvider(particle.auth)
import { useEthereum } from "@particle-network/authkit";

// Inside your component or app function
const { provider } = useEthereum();
```

### Use with ZeroDev

Use the provider from Particle Network to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api).
Use the `provider` from Particle Network to create a smart account signer, which can be passed to a validator. For detailed guidance on using a validator, refer to our documentation on [creating accounts](/sdk/core-api/create-account#api).

```typescript
import { signerToEcdsaValidator } from "@zerodev/ecdsa-validator"
Expand All @@ -43,8 +38,8 @@ import { providerToSmartAccountSigner, ENTRYPOINT_ADDRESS_V07 } from 'permission
import { createPublicClient } from "viem";
import { polygonAmoy } from 'viem/chains';

// Convert the particleProvider to a SmartAccountSigner
const smartAccountSigner = await providerToSmartAccountSigner(particleProvider);
// Convert the Particle provider to a SmartAccountSigner
const smartAccountSigner = await providerToSmartAccountSigner(provider);

const publicClient = createPublicClient({
transport: http('https://rpc-amoy.polygon.technology'),
Expand Down