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:17 (UTC -07:00)
  • X @TABASCOweb3
View GitHub Profile
@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.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 / 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 / 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;