UNPKG

@biconomy/abstractjs

Version:

SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.

46 lines 2.19 kB
import { isStaging, isTesting } from "../account/utils/Helpers.js"; import createHttpClient, {} from "./createHttpClient.js"; import { getInfo, meeActions } from "./decorators/mee/index.js"; const isStagingOrTesting = isStaging() || isTesting(); /** * Default URL for the MEE node service */ export const DEFAULT_PATHFINDER_URL = isStagingOrTesting ? "https://staging-network.biconomy.io/v1" : "https://network.biconomy.io/v1"; export const DEFAULT_PATHFINDER_API_KEY = isStagingOrTesting ? "mee_3ZhZhHx3hmKrBQxacr283dHt" : "mee_3ZZmXCSod4xVXDRCZ5k5LTHg"; /** * Constants for sponshorship */ // Sponsorship Nexus Account Address export const DEFAULT_MEE_SPONSORSHIP_PAYMASTER_ACCOUNT = "0x18eAc826f3dD77d065E75E285d3456B751AC80d5"; // Base export const DEFAULT_MEE_SPONSORSHIP_CHAIN_ID = 8453; // USDC export const DEFAULT_MEE_SPONSORSHIP_TOKEN_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"; // Sponsorship Nexus Account Address export const DEFAULT_MEE_TESTNET_SPONSORSHIP_PAYMASTER_ACCOUNT = "0x18eAc826f3dD77d065E75E285d3456B751AC80d5"; // Base Sepolia export const DEFAULT_MEE_TESTNET_SPONSORSHIP_CHAIN_ID = 84532; // USDC export const DEFAULT_MEE_TESTNET_SPONSORSHIP_TOKEN_ADDRESS = "0x036CbD53842c5426634e7929541eC2318f3dCF7e"; export const createMeeClient = async (params) => { const { account, pollingInterval = 1000, url = DEFAULT_PATHFINDER_URL, apiKey = DEFAULT_PATHFINDER_API_KEY } = params; const httpClient = createHttpClient(url, apiKey); const info = await getInfo(httpClient); const baseMeeClient = Object.assign(httpClient, { pollingInterval, account, info }); // Check if the account is supported by the MEE node. Throws if not. const supportedChains = info.supportedChains.map(({ chainId }) => Number(chainId)); const supported = account.deployments.every(({ chain }) => supportedChains.includes(chain.id)); if (!supported) { throw new Error(`Some account chains are not supported by the MEE node. Please check the supported chains and try again. ${supportedChains.join(", ")}`); } return baseMeeClient.extend(meeActions); }; //# sourceMappingURL=createMeeClient.js.map