@@ -7,19 +7,16 @@ A Python SDK for interacting with Jupiter Exchange APIs.
7
7
To install the SDK in your project, run:
8
8
```
9
9
sh
10
- pip install jup-ag -sdk
10
+ pip install jup-python -sdk
11
11
```
12
12
## ** Quick Start**
13
13
14
- Here's a basic example to help you get started with the Jup Python SDK:
14
+ Below is a simple example that shows how to fetch and execute an Ultra order with the Jup Python SDK:
15
15
```
16
16
python
17
17
from dotenv import load_dotenv
18
-
19
18
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
- )
19
+ from jup_python_sdk.models.ultra_api.ultra_order_request_model import UltraOrderRequest
23
20
24
21
load_dotenv()
25
22
client = UltraApiClient()
@@ -34,17 +31,25 @@ order_request = UltraOrderRequest(
34
31
try:
35
32
client_response = client.order_and_execute(order_request)
36
33
signature = str(client_response["signature"])
37
-
34
+
38
35
print("Order and Execute API Response:")
36
+ print(f" - Status: {client_response.get('status')}")
37
+ if client_response.get("status") == "Failed":
38
+ print(f" - Code: {client_response.get('code')}")
39
+ print(f" - Error: {client_response.get('error')}")
40
+
39
41
print(f" - Transaction Signature: {signature}")
40
42
print(f" - View on Solscan: https://solscan.io/tx/{signature}")
41
43
42
44
except Exception as e:
43
- print("Error occurred while processing the order :", str(e))
45
+ print("Error occurred while processing the swap :", str(e))
44
46
finally:
45
47
client.close()
46
48
```
47
49
50
+ You can find additional code examples and advanced usage scenarios in the [ examples] ( ./examples ) folder.
51
+ These examples cover every Ultra API endpoint and should help you get up and running quickly.
52
+
48
53
## ** Setup Instructions**
49
54
50
55
Before using the SDK, please ensure you have completed the following steps:
@@ -56,11 +61,27 @@ Before using the SDK, please ensure you have completed the following steps:
56
61
export PRIVATE_KEY=your_private_key_here
57
62
```
58
63
59
- 2 . ** Python Version** :
60
- Make sure you are using Python 3.9 or later.
64
+ 2 . ** Configuration** :
65
+ Depending on your credentials and setup, you have a couple of options for initializing the ` UltraApiClient ` :
66
+
67
+ - ** Custom Private Key Environment Variable:**
68
+ By default, the SDK looks for your private key in an environment variable named ` PRIVATE_KEY ` .
69
+ If you use a different environment variable name, you can specify it explicitly:
70
+ ``` python
71
+ from jup_python_sdk.clients.ultra_api_client import UltraApiClient
72
+
73
+ client = UltraApiClient(private_key_env_var = " YOUR_CUSTOM_ENV_VAR" )
74
+ ```
75
+ This tells the SDK to read your private key from the environment variable you want.
76
+
77
+ - ** Using an API Key for Enhanced Access:**
78
+ If you have an API key from [the Jupiter Portal](https:// portal.jup.ag/ onboard), you can pass it directly when creating the client:
79
+ ```python
80
+ from jup_python_sdk.clients.ultra_api_client import UltraApiClient
61
81
62
- 3** Configuration** :
63
- TBD
82
+ client = UltraApiClient(api_key = " YOUR_API_KEY" )
83
+ ```
84
+ When you supply an API key, the library will call the `https:// api.jup.ag/ ` API rather than the default `https:// lite- api.jup.ag/ ` API .
64
85
65
86
# # **Disclaimer**
66
87
0 commit comments