@jup-ag/plugin npm package.
Prerequisites
Before you begin, make sure you have the following installed on your system. Node.js and npm: Download and install from nodejs.orgStep 1: Create a New React Project
Head to your preferred directory and create a new React project usingcreate-react-app with TypeScript template (you can use other templates or methods to start your project too):
Step 2: Add TypeScript Support
Create a type declaration fileplugin.d.ts in your project’s /src/types folder:
Full TypeScript Declaration
Full TypeScript Declaration
Step 3: Embed the Plugin Script
In your/public/index.html, add the Jupiter Plugin script:
Step 4: Initialize Plugin
There are two ways to initialize Jupiter Plugin in a React application:Method 1: Using Window Object
In your/src/App.tsx, use the following code to initialize the plugin.
Method 2: Using @jup-ag/plugin Package
1
Install the package:
2
Initialize the plugin:
- Please test the swap functionality and check the transaction.
- If you require more customizations, check out the Plugin Playground or the Customization documentation.
- If you have any questions or issues, please refer to the FAQ or contact us on Discord.
