Skip to content

Instantly share code, notes, and snippets.

View TABASCOatw's full-sized avatar
💜
At Particle, we're building Modular Chain Abstraction Infrastructure.

TABASCO TABASCOatw

💜
At Particle, we're building Modular Chain Abstraction Infrastructure.
  • Particle Network
  • Denver, CO
  • 06:19 (UTC -07:00)
  • X @TABASCOweb3
View GitHub Profile
@TABASCOatw
TABASCOatw / particleWagmiWallet.ts
Created May 18, 2024 05:42
Rough draft - AA-enabled Wagmi connector, hard-coded values + debugging
import { type ConnectParam, type EIP1193Provider } from '@particle-network/auth-core';
import { ChainNotConfiguredError, createConnector, normalizeChainId } from '@wagmi/core';
import { SmartAccount, AAWrapProvider, SendTransactionMode } from '@particle-network/aa';
import { SwitchChainError, UserRejectedRequestError, getAddress, numberToHex, type ProviderRpcError } from 'viem';
import { ethers } from 'ethers';
particleWagmiWallet.type = 'particleWallet' as const;
export function particleWagmiWallet(param?: ConnectParam) {
type Provider = EIP1193Provider;
@TABASCOatw
TABASCOatw / index.js.map
Created April 25, 2024 17:24
ChainInfo Object Values
{
"version": 3,
"sources": ["../src/index.ts", "../src/chains.ts"],
"sourcesContent": ["import { type ChainInfo } from './types';\n\nexport * as chains from './chains';\nexport * from './types';\n\n// template code start\nexport const Ethereum: ChainInfo = {\n id: 1,\n name: 'Ethereum',\n chainType: 'evm',\n icon: 'https://static.particle.network/token-list/ethereum/native.png',\n nativeIcon: '',\n fullname: 'Ethereum Mainnet',\n network: 'Mainnet',\n website: 'https://ethereum.org',\n nativeCurrency: {\n name: 'Ether',\n symbol: 'ETH',\n decimals: 18,\n },\n rpcUrl: 'https://ethereum.publicnode.com',\n blockExplorerUrl: 'https://etherscan.io',\n features: [{ name: 'EIP1559' }],\n};\n\nexport const Optimism: ChainInfo = {\n id: 10,\n name: 'Optimism',\n chainType: 'evm',\n icon: 'https://static.particle.network/token-list/optimism/native.png',\n nativeIcon: '',\n fullname: 'Optimism Mainnet',\n network: 'Mainnet',\n webs
@TABASCOatw
TABASCOatw / index.d.ts
Created April 25, 2024 17:23
ChainInfo List (@particle-network/chains)
import { type ChainInfo } from './types';
export * as chains from './chains';
export * from './types';
export declare const Ethereum: ChainInfo;
export declare const Optimism: ChainInfo;
export declare const ThunderCoreTestnet: ChainInfo;
export declare const Cronos: ChainInfo;
export declare const BNBChain: ChainInfo;
export declare const OKTCTestnet: ChainInfo;
export declare const OKTC: ChainInfo;
@TABASCOatw
TABASCOatw / App.tsx
Created April 24, 2024 22:26
XLayer Demo App.tsx (Smart Wallet-as-a-Service)
import React, { useState, useEffect } from 'react';
import { XLayer, XLayerTestnet } from '@particle-network/chains';
import { AAWrapProvider, SendTransactionMode, SmartAccount } from '@particle-network/aa';
import { useEthereum, useConnect, useAuthCore } from '@particle-network/auth-core-modal';
import { ethers } from 'ethers';
import { notification } from 'antd';
import './App.css';
const App = () => {
@TABASCOatw
TABASCOatw / index.css
Created February 21, 2024 23:58
Particle Connect CSS
/* src/styles/root.css */
.particle-connect-ui-theme-ligth {
--bg-color: #FFFFFF;
--font-color1: #000000;
--font-color2: rgba(60, 66, 66, 0.6);
--font-color3: rgba(107, 113, 146, 1);
--scoll-bar-color: rgba(0, 0, 0, 0.3);
--hover-color: rgba(0, 0, 0, 0.3);
--hover-color2: rgba(81, 119, 249, 0.05);
--active-color: rgba(0, 0, 0, 1);
@TABASCOatw
TABASCOatw / index.tsx
Last active February 2, 2024 15:19
Example of leveraging Particle Auth Core alongside Particle's AA SDK to onboard users into smart accounts and execute transactions on Berachain Artio.
import React, { useState, useEffect } from 'react';
import ReactDOM from 'react-dom/client';
import { ethers } from 'ethers';
import { notification } from 'antd';
import { useEthereum, useConnect, useAuthCore, AuthCoreContextProvider } from '@particle-network/auth-core-modal';
import { AAWrapProvider, SmartAccount, SendTransactionMode } from '@particle-network/aa';
import { BerachainArtio } from '@particle-network/chains';
import './App.css';
const App = () => {
@TABASCOatw
TABASCOatw / particleConnector.ts
Created January 18, 2024 05:49
ParticleConnector class used within @particle-network/rainbowkit-ext
import type { AuthType } from '@particle-network/auth';
import type { ParticleProvider } from '@particle-network/provider';
import type { Chain } from '@rainbow-me/rainbowkit';
import { Address, Connector, ConnectorData } from 'wagmi';
declare type ParticleAuth = ConstructorParameters<typeof ParticleProvider>[0];
declare type ParticleOptions = {
auth?: ParticleAuth;
authType?: AuthType;
};
export declare class ParticleConnector extends Connector<ParticleProvider, ParticleOptions> {
@TABASCOatw
TABASCOatw / App.tsx
Created November 7, 2023 21:28
Gist example for Leveraging Viction within Particle Network's Smart Wallet-as-a-Service
import React, { useState, useEffect } from 'react';
import { ParticleNetwork } from '@particle-network/auth';
import { ParticleProvider } from '@particle-network/provider';
import { Viction } from '@particle-network/chains';
import { AAWrapProvider, SmartAccount } from '@particle-network/aa';
import { ethers } from 'ethers';
const config = {
projectId: process.env.REACT_APP_PROJECT_ID,
clientKey: process.env.REACT_APP_CLIENT_KEY,
@TABASCOatw
TABASCOatw / App.tsx
Created October 28, 2023 15:44
Ethereum Goerli Particle Smart WaaS SimpleAccount
import React, { useState, useEffect } from 'react';
import { ParticleNetwork } from '@particle-network/auth';
import { ParticleProvider } from '@particle-network/provider';
import { EthereumGoerli } from '@particle-network/chains';
import { AAWrapProvider, SmartAccount, SendTransactionMode } from '@particle-network/aa';
import { ethers } from 'ethers';
const config = {
projectId: process.env.REACT_APP_PROJECT_ID,
clientKey: process.env.REACT_APP_CLIENT_KEY,
@TABASCOatw
TABASCOatw / App.tsx
Created October 25, 2023 07:10
Avalanche Mainnet Biconomy smart account implementation with Smart WaaS (modular SA update)
import React, { useState, useEffect } from 'react';
import { ParticleNetwork } from '@particle-network/auth';
import { ParticleProvider } from '@particle-network/provider';
import { Avalanche } from '@particle-network/chains';
import { AAWrapProvider, SmartAccount, SendTransactionMode } from '@particle-network/aa';
import { ethers } from 'ethers';
const config = {
projectId: process.env.REACT_APP_PROJECT_ID,
clientKey: process.env.REACT_APP_CLIENT_KEY,