ostium-python-sdk 0.1.8__tar.gz → 0.1.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/PKG-INFO +1 -1
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/sdk.py +16 -7
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk.egg-info/PKG-INFO +1 -1
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/setup.py +1 -1
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/README.md +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/__init__.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/abi.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/balance.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/config.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/constants.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/formulae.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/formulae_wrapper.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/ostium.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/price.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/subgraph.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk/utils.py +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk.egg-info/SOURCES.txt +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk.egg-info/dependency_links.txt +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk.egg-info/requires.txt +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk.egg-info/top_level.txt +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/pyproject.toml +0 -0
- {ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ostium-python-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: A python based SDK developed for interacting with Ostium, a leveraged trading application for trading currencies, commodities, indices, crypto and more.
|
|
5
5
|
Home-page: https://github.com/0xOstium/ostium-python-sdk
|
|
6
6
|
Author: ami@ostium.io
|
|
@@ -3,10 +3,11 @@ import os
|
|
|
3
3
|
from web3 import Web3
|
|
4
4
|
from .ostium import Ostium
|
|
5
5
|
from .config import NetworkConfig
|
|
6
|
+
from typing import Union
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
class OstiumSDK:
|
|
9
|
-
def __init__(self, network
|
|
10
|
+
def __init__(self, network: Union[str, NetworkConfig], private_key: str = None, rpc_url: str = None):
|
|
10
11
|
load_dotenv()
|
|
11
12
|
self.private_key = private_key or os.getenv('PRIVATE_KEY')
|
|
12
13
|
if not self.private_key:
|
|
@@ -15,20 +16,28 @@ class OstiumSDK:
|
|
|
15
16
|
|
|
16
17
|
self.rpc_url = rpc_url or os.getenv('RPC_URL')
|
|
17
18
|
if not self.rpc_url:
|
|
19
|
+
network_name = "mainnet" if isinstance(
|
|
20
|
+
network, str) and network == "mainnet" else "testnet"
|
|
18
21
|
raise ValueError(
|
|
19
|
-
f"No RPC URL provided for {
|
|
22
|
+
f"No RPC URL provided for {network_name}. Please provide via constructor or RPC_URL environment variable")
|
|
20
23
|
|
|
21
24
|
# Initialize Web3
|
|
22
25
|
self.w3 = Web3(Web3.HTTPProvider(self.rpc_url))
|
|
23
26
|
|
|
24
27
|
# Get network configuration
|
|
25
|
-
if network
|
|
26
|
-
self.network_config =
|
|
27
|
-
elif network
|
|
28
|
-
|
|
28
|
+
if isinstance(network, NetworkConfig):
|
|
29
|
+
self.network_config = network
|
|
30
|
+
elif isinstance(network, str):
|
|
31
|
+
if network == "mainnet":
|
|
32
|
+
self.network_config = NetworkConfig.mainnet()
|
|
33
|
+
elif network == "testnet":
|
|
34
|
+
self.network_config = NetworkConfig.testnet()
|
|
35
|
+
else:
|
|
36
|
+
raise ValueError(
|
|
37
|
+
f"Unsupported network: {network}. Use 'mainnet' or 'testnet'")
|
|
29
38
|
else:
|
|
30
39
|
raise ValueError(
|
|
31
|
-
|
|
40
|
+
"Network must be either a NetworkConfig instance or a string ('mainnet' or 'testnet')")
|
|
32
41
|
|
|
33
42
|
# Initialize Ostium instance
|
|
34
43
|
self.ostium = Ostium(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ostium-python-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: A python based SDK developed for interacting with Ostium, a leveraged trading application for trading currencies, commodities, indices, crypto and more.
|
|
5
5
|
Home-page: https://github.com/0xOstium/ostium-python-sdk
|
|
6
6
|
Author: ami@ostium.io
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{ostium_python_sdk-0.1.8 → ostium_python_sdk-0.1.9}/ostium_python_sdk.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|