Getting Started with Terminal
Prerequisites
When integrating Terminal, there are a few integration methods to think about, and choose the one that best fits your application's architecture and requirements.
Ways to Integrate
-
Direct Script Integration (CDN)
- Simplest way to add Terminal.
- Add script tag to HTML:
<script src="https://terminal.jup.ag/main-v4.js" data-preload defer></script>
-
NPM Package Integration
- Recommended for React/Next.js applications.
- Install via NPM:
npm install @jup-ag/terminal
- Import and use as a module.
Wallet Integration
- Standalone Mode: For applications without existing wallet provider.
- Integrated Mode: For applications with existing wallet provider.
Best Practices
- Implement proper error handling
- Consider using environment variables for sensitive data
- Test thoroughly in development before deploying
- Monitor swap success rates and user feedback