@unifi-io/unifi-sdk
v0.0.34
Published
A unified Node.js SDK for cross-chain swap and bridge operations, supporting multiple providers and aggregators.
Downloads
84
Readme
Unifi Node SDK
A unified Node.js SDK for cross-chain swap and bridge operations, supporting multiple providers and aggregators.
📦 Packages
Core
- @unifi-io/core - Core abstractions and types
Bridge Providers
- @unifi-io/provider-flowbridge - FlowBridge implementation
- @unifi-io/provider-lifi - LiFi implementation
- More providers coming soon...
Swap Providers
- @unifi-io/provider-jupiter - Jupiter (Solana)
- @unifi-io/provider-raydium - Raydium (Solana)
- @unifi-io/provider-uniswap - Uniswap (EVM)
- @unifi-io/provider-pancake - PancakeSwap
- More providers coming soon...
Utilities
- @unifi-io/tx-relay - Transaction submission and relay
🚀 Quick Start
Installation
# Install core package
pnpm add @unifi-io/core
# Install specific provider
pnpm add @unifi-io/provider-flowbridgeUsage
import { FlowBridgeProvider } from '@unifi-io/provider-flowbridge';
import { ChainId } from '@unifi-io/core';
// Initialize provider
const bridge = new FlowBridgeProvider({
apiKey: 'your-api-key',
});
// Get quote
const quote = await bridge.quote({
fromChainId: ChainId.ETHEREUM,
toChainId: ChainId.BSC,
fromToken: { /* ... */ },
toToken: { /* ... */ },
amount: '1000000',
userAddress: '0x...',
});
// Execute bridge
const result = await bridge.bridge({
quote,
userAddress: '0x...',
});🏗️ Architecture
This project uses the Factory Pattern to provide a consistent interface across different bridge and swap providers. See ARCHITECTURE.md for detailed design documentation.
Key benefits:
- ✅ Extensible: Easy to add new providers
- ✅ Consistent: Unified interface across all providers
- ✅ Type-safe: Full TypeScript support
- ✅ Modular: Use only what you need
📚 Documentation
- Architecture Guide - Design patterns and project structure
- Contributing Guide - How to contribute
- API Examples - Usage examples
🛠️ Development
Prerequisites
- Node.js >= 20
- pnpm >= 9
Setup
# Clone the repository
git clone https://github.com/unifi-io/unifi-node-sdk.git
cd unifi-node-sdk
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run linter
pnpm lint
# Type check
pnpm typecheckProject Structure
unifi-node-sdk/
├── packages/
│ ├── core/ # Core abstractions
│ ├── providers/ # Provider implementations
│ └── tx-relay/ # Transaction utilities
├── examples/ # Usage examples
└── .github/ # GitHub workflowsAdding Dependencies
# Add to specific package
pnpm add <package> --filter @unifi-io/provider-flowbridge
# Add to all providers
pnpm add <package> --filter "./packages/providers/*"
# Add to workspace root
pnpm add -D <package> -w🤝 Contributing
We welcome contributions! Please see our Contributing Guide for details.
Adding a New Provider
- Create package directory:
packages/providers/new-provider/ - Extend
BridgeProviderorSwapProviderabstract class - Implement required methods
- Add tests and documentation
- Submit a pull request
See ARCHITECTURE.md for detailed steps.
📄 License
MIT
🔗 Links
🙏 Acknowledgments
This project structure is inspired by modern monorepo best practices and uses:
- Turborepo - Build system
- pnpm - Package manager
- Changesets - Version management
- Biome - Linter and formatter
