A comprehensive multi-chain SDK for decentralized exchange operations on the Solana, Aptos, BSC, SUI, and Base networks. The NeroX SDK provides a unified interface for token swapping, wallet management, and DeFi activities across various blockchain ecosystems. This SDK is designed to simplify the development of decentralized applications by offering a robust and easy-to-use set of tools.
- Multi-chain Support: Interact with Solana, Aptos, BSC, SUI, and Base networks.
- DEX Integration: Supports multiple decentralized exchanges including PancakeSwap, Raydium, Cetus, and more.
- Buy/Sell Orders: Create and manage buy/sell orders with slippage protection.
- Wallet Management: Handle multiple wallets and distribute transactions efficiently.
- Token Operations: Fetch token metadata, balances, and account information.
- Gas Fee Management: Configure gas fees for different chains and operations.
- TypeScript Support: Full TypeScript support with comprehensive type definitions.
- Solana (SOL)
- Aptos (APT)
- Binance Smart Chain (BSC)
- Sui (SUI)
- Base (BASE)
- PumpFun Bonding Curve
- Raydium
- PumpSwap
- Meteora
- Jupiter
- FourMeme Bonding Curve
- PancakeSwap V2
- PancakeSwap V3
- MovePump
- Cetus
- Panora
- Uniswap V3
- Uniswap V2
npm install @nippylabs/nerox-core
# or
yarn add @nippylabs/nerox-coreimport { ChainProvider, ChainId } from '@nippylabs/nerox-core'; // Initialize the chain provider with configuration const chainProvider = new ChainProvider({ [ChainId.SOL]: { rpcConfig: { rpcUrl: 'https://api.mainnet-beta.solana.com', // Add other RPC configurations }, gasFeeConfig: { buy: 0.000005, sell: 0.000005, }, programConfig: { // Add program-specific configurations }, }, // Add configurations for other chains }); // Switch to the desired chain chainProvider.switchChain(ChainId.SOL);
import { createBuyOrder } from '@nippylabs/nerox-core'; const buyOrder = await createBuyOrder({ buyAmount: BigInt('1000000000'), // Raw amount tokenAddress: 'TokenAddressHere', wallets: ['wallet1', 'wallet2'], fee: 5000, // Fee in the smallest unit slippage: '5', // 5% slippage chain: chainProvider.getActiveChain(), routes: [ { route: 'pumpfun', poolAddress: 'poolAddress', poolFee: 10000, tokenIn: 'SOL', tokenOut: 'TokenAddress', }, ], });
import { createSellOrder } from '@nippylabs/nerox-core'; const sellOrder = await createSellOrder({ sellAmount: BigInt('1000000'), // Raw amount tokenAddress: 'TokenAddressHere', tokenDecimals: 9, wallets: [ { address: 'wallet1', tokenAmount: '500000' }, { address: 'wallet2', tokenAmount: '500000' }, ], fee: 5000, slippage: '5', chain: chainProvider.getActiveChain(), routes: [ { route: 'raydium', poolAddress: 'poolAddress', poolFee: 2500, tokenIn: 'TokenAddress', tokenOut: 'SOL', }, ], });
const tokenMetadata = await chainProvider.getActiveChain().getTokenMetadata('tokenAddress'); console.log(tokenMetadata); // Result: // { // tokenAddress: '...', // name: 'Token Name', // symbol: 'SYMBOL', // decimals: 9, // iconUrl: '...', // chainId: 'solana', // isWatched: false // }
const balances = await chainProvider.getActiveChain().getBalances(['wallet1', 'wallet2']); console.log(balances); // Array of balance strings
const tokens = await chainProvider.getActiveChain().getAccountOwnedTokens(['wallet1']); console.log(tokens); // Array of token accounts for each wallet
Each chain requires specific configuration:
const chainConfig = { rpcConfig: { rpcUrl: 'RPC_URL', // Additional RPC configuration }, gasFeeConfig: { buy: 0.000005, // Gas fee for buy operations sell: 0.000005, // Gas fee for sell operations }, programConfig: { packageId: 'packageId', // For non-EVM chains depositDiscriminator: 'discriminator', // For non-EVM chains }, };
The main class for managing multiple chains and operations.
switchChain(chainId: ChainId): Switch to a different blockchaingetChainId(): ChainId: Get the current active chain IDgetActiveChain(): AbstractChain: Get the current active chain instancecreateBuyOrder(params): Create a buy order on the active chaincreateSellOrder(params): Create a sell order on the active chaingetChain(chainId: ChainId): Get a specific chain instancegetNativeToken(chainId: ChainId): Get the native token information for a chaingetNativeTokens(): Get all native tokens across all chains
Creates a buy order for a specific token.
Parameters:
buyAmount: bigint - The raw amount to buytokenAddress: string - The address of the token to buywallets: string[] - An array of wallet addressesfee: NumberLike - The transaction feeslippage: string - The slippage tolerance percentagechain: AbstractChain - The chain instanceroutes: TRoute[] - An array of available routes
Creates a sell order for a specific token.
Parameters:
sellAmount: NumberLike - The raw amount to selltokenAddress: string - The address of the token to selltokenDecimals: number - The number of decimals for the tokenwallets: { address: string; tokenAmount: NumberLike }[] - An array of wallets with token amountsfee: NumberLike - The transaction feeslippage: string - The slippage tolerance percentagechain: AbstractChain - The chain instanceroutes: TRoute[] - An array of available routes
yarn build
yarn testyarn eslint
The project is organized as a monorepo, with individual packages located in the packages directory.
packages/nerox-core: The main package containing the core logic of the SDK.lib/: Contains the original TypeScript source code.web3/chains/: Contains the implementation classes for each supported blockchain (Solana, BSC, Aptos, SUI, Base).web3/swap/: Logic for handling token buy and sell transactions.web3/contracts/: Smart contract definitions and ABIs.
dist/: Contains the compiled JavaScript code, ready for use.