|
1 |
| -# **Jup-Ag-SDK** |
| 1 | +# **Jup Python SDK** |
2 | 2 |
|
3 | 3 | A Python SDK for interacting with Jupiter Exchange APIs.
|
4 | 4 |
|
5 | 5 | ## **Installation**
|
6 |
| -To install the SDK globally from PyPI, run: |
7 |
| -```sh |
| 6 | + |
| 7 | +To install the SDK in your project, run: |
| 8 | +``` |
| 9 | +sh |
8 | 10 | pip install jup-ag-sdk
|
9 | 11 | ```
|
| 12 | +## **Quick Start** |
10 | 13 |
|
11 |
| -## **Local Development** |
12 |
| -If you want to make changes to the SDK and test it locally: |
13 |
| - |
14 |
| -1. In this project's directory, install the package in editable mode by running: |
15 |
| - ```sh |
16 |
| - pip install -e . |
17 |
| - ``` |
| 14 | +Here's a basic example to help you get started with the Jup Python SDK: |
| 15 | +``` |
| 16 | +python |
| 17 | +from dotenv import load_dotenv |
18 | 18 |
|
19 |
| -2. To use this library in another project while making changes to it, install the package from its local path in that project: |
20 |
| - ```sh |
21 |
| - pip install -e /path/to/jup-ag-sdk |
22 |
| - ``` |
| 19 | +from jup_python_sdk.clients.ultra_api_client import UltraApiClient |
| 20 | +from jup_python_sdk.models.ultra_api.ultra_order_request_model import ( |
| 21 | + UltraOrderRequest, |
| 22 | +) |
23 | 23 |
|
24 |
| - Replace `/path/to/jup-ag-sdk` with the absolute or relative path to this project directory. |
| 24 | +load_dotenv() |
| 25 | +client = UltraApiClient() |
25 | 26 |
|
26 |
| -By installing in editable mode, any changes you make to the SDK will immediately reflect in your tests without needing to reinstall the package. |
| 27 | +order_request = UltraOrderRequest( |
| 28 | + input_mint="So11111111111111111111111111111111111111112", # WSOL |
| 29 | + output_mint="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", # USDC |
| 30 | + amount=10000000, # 0.01 WSOL |
| 31 | + taker=client._get_public_key(), |
| 32 | +) |
27 | 33 |
|
28 |
| -## **Making a New Release** |
29 |
| -To create and publish a new release of the package to PyPI: |
| 34 | +try: |
| 35 | + client_response = client.order_and_execute(order_request) |
| 36 | + signature = str(client_response["signature"]) |
| 37 | + |
| 38 | + print("Order and Execute API Response:") |
| 39 | + print(f" - Transaction Signature: {signature}") |
| 40 | + print(f" - View on Solscan: https://solscan.io/tx/{signature}") |
30 | 41 |
|
31 |
| -1. **Update the Version:** |
32 |
| - - Update the version in your `pyproject.toml` file following [semantic versioning](https://semver.org/), e.g., `0.0.1` → `0.1.0` for a minor update. |
| 42 | +except Exception as e: |
| 43 | + print("Error occurred while processing the order:", str(e)) |
| 44 | +finally: |
| 45 | + client.close() |
| 46 | +``` |
33 | 47 |
|
34 |
| -2. **Commit the Changes:** |
35 |
| - - Commit and push the version update to the main branch: |
36 |
| - ```sh |
37 |
| - git add pyproject.toml |
38 |
| - git commit -m "Bump version to vX.Y.Z" |
39 |
| - git push origin main |
40 |
| - ``` |
| 48 | +## **Setup Instructions** |
41 | 49 |
|
42 |
| -3. **Create a Tag:** |
43 |
| - - Tag the commit with the new version: |
44 |
| - ```sh |
45 |
| - git tag vX.Y.Z |
46 |
| - git push origin vX.Y.Z |
47 |
| - ``` |
| 50 | +Before using the SDK, please ensure you have completed the following steps: |
48 | 51 |
|
49 |
| - Replace `vX.Y.Z` with the actual version number. |
| 52 | +1. **Environment Variables**: |
| 53 | + Set up your required environment variables. |
| 54 | + Example: |
| 55 | + ```sh |
| 56 | + export PRIVATE_KEY=your_private_key_here |
| 57 | + ``` |
50 | 58 |
|
51 |
| -4. **GitHub Actions Workflow:** |
52 |
| - - When the tag is pushed, the `release.yml` GitHub Actions workflow will automatically: |
53 |
| - - Build the package using Poetry. |
54 |
| - - Publish the package to PyPI. |
| 59 | +2. **Python Version**: |
| 60 | + Make sure you are using Python 3.9 or later. |
55 | 61 |
|
56 |
| -5. **Confirm the Release:** |
57 |
| - - Check [PyPI](https://pypi.org/project/jup-ag-sdk/) to ensure the new version has been published successfully. |
| 62 | +3**Configuration**: |
| 63 | + TBD |
58 | 64 |
|
59 | 65 | ## **Disclaimer**
|
60 |
| -🚨 **This project is a work in progress and should not be used in production systems.** |
61 |
| -Expect breaking changes as the SDK evolves. |
| 66 | + |
| 67 | +🚨 **This project is actively worked on.** |
| 68 | +While we don't expect breaking changes as the SDK evolves, we recommend you stay updated with the latest releases. |
| 69 | +Any important updates will be announced in the [Discord server](https://discord.gg/jup). |
0 commit comments