Skip to content

Commit 3aaf437

Browse files
authored
Merge pull request #1 from deltadefi-protocol/dev
Dev
2 parents 1538135 + 99dfbb8 commit 3aaf437

29 files changed

+2885
-0
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"python.analysis.extraPaths": ["./src"]
3+
}

Makefile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
cov: ## check code coverage
3+
poetry run pytest -n 4 --cov sidan_gin
4+
5+
cov-html: cov ## check code coverage and generate an html report
6+
poetry run coverage html -d cov_html
7+
$(BROWSER) cov_html/index.html
8+
9+
test: ## runs tests
10+
poetry run pytest -vv
11+
12+
clean-test: ## remove test and coverage artifacts
13+
rm -f .coverage
14+
rm -fr cov_html/
15+
rm -fr .pytest_cache
16+
17+
docs: ## build the documentation
18+
poetry export --dev --without-hashes > docs/requirements.txt
19+
rm -r -f docs/build
20+
poetry run sphinx-build docs/source docs/build/html
21+
$(BROWSER) docs/build/html/index.html
22+
23+
format: ## runs code style and formatter
24+
poetry run isort .
25+
poetry run black .
26+
27+
deps:
28+
poetry lock
29+
poetry install

poetry.lock

Lines changed: 2004 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[tool.poetry]
2+
name = "deltadefi-python-sdk"
3+
version = "0.1.0"
4+
classifiers = [
5+
"Intended Audience :: Developers",
6+
"License :: OSI Approved :: Apache Software License",
7+
"Natural Language :: English",
8+
"Programming Language :: Python :: 3",
9+
"Programming Language :: Python :: 3.11",
10+
]
11+
description = "Python SDK for DeltaDeFi protocol."
12+
homepage = "https://github.com/deltadefi-protocol/python-sdk"
13+
documentation = "https://github.com/deltadefi-protocol/python-sdk"
14+
keywords = ["cardano"]
15+
readme = "README.md"
16+
authors = ["HinsonSIDAN <[email protected]>"]
17+
license = "Apache-2.0"
18+
19+
[tool.poetry.dependencies]
20+
python = ">3.11,<4.0.0"
21+
sidan-gin = "0.1.1"
22+
requests = "^2.25"
23+
certifi = "2024.8.30"
24+
charset-normalizer = "3.4.0"
25+
idna = "3.10"
26+
urllib3 = "2.2.3"
27+
pycardano = "^0.12.3"
28+
29+
[tool.poetry.dev-dependencies]
30+
pytest = "^8.2.0"
31+
pytest-xdist = "^3.5.0"
32+
pytest-cov = "^5.0.0"
33+
Sphinx = "^5.0.0"
34+
sphinx-rtd-theme = "^2.0.0"
35+
sphinx-copybutton = "^0.5.0"
36+
flake8 = "^7.0.0"
37+
isort = "^5.11.4"
38+
black = "^24.4.2"
39+
40+
[build-system]
41+
requires = ["poetry-core>=1.0.0"]
42+
build-backend = "poetry.core.masonry.api"
43+
44+
[tool.pytest.ini_options]
45+
testpaths = ["tests"]
46+
pythonpath = ["src"]

src/deltadefi/__init__.py

Whitespace-only changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# flake8: noqa
2+
from .api_config import *
3+
from .auth import *
4+
from .validation import *
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from dataclasses import dataclass
2+
from typing import Optional
3+
4+
from pycardano import ExtendedSigningKey
5+
from sidan_gin import Network
6+
7+
8+
@dataclass
9+
class ApiConfig:
10+
network: Optional[Network]
11+
signingKey: Optional[ExtendedSigningKey]
12+
jwt: Optional[str]
13+
apiKey: Optional[str]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from dataclasses import dataclass
2+
from typing import Optional
3+
4+
5+
@dataclass
6+
class AuthHeaders:
7+
jwt: str
8+
apiKey: str
9+
10+
11+
class ApiHeaders:
12+
__annotations__ = {
13+
"Content-Type": str,
14+
"Authorization": Optional[str],
15+
"X-API-KEY": Optional[str],
16+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# flake8: noqa
2+
from dataclasses import dataclass
3+
from typing import List
4+
5+
from sidan_gin import Asset
6+
7+
"""
8+
* DeltaDeFiOrderInfo is a type that represents the information of a DeltaDeFi order.
9+
* @property {Asset[]} assetsToPay - The assets that are to be paid from orders in current transaction.
10+
* @property {Asset[]} assetsToReturn - The assets that are to be received from orders in current transaction.
11+
* @property {string} txFee - The transaction fee.
12+
* @property {string} tradingFee - The trading fee.
13+
"""
14+
15+
16+
@dataclass
17+
class DeltaDeFiOrderInfo:
18+
assetsToPay: List[Asset]
19+
assetsToReturn: List[Asset]
20+
txFee: str
21+
tradingFee: str
22+
23+
24+
"""
25+
* DeltaDeFiTxInfo is a type that represents the information of a DeltaDeFi transaction.
26+
* @property {Asset[]} accountInput - The assets that are input from the account.
27+
* @property {Asset[]} accountOutput - The assets that are output to the account.
28+
* @property {Asset[]} dexInput - The assets that are input from the DEX.
29+
* @property {Asset[]} dexOutput - The assets that are output to the DEX.
30+
* @property {string} txFee - The transaction fee.
31+
* @property {string} tradingFee - The trading fee.
32+
"""
33+
34+
35+
@dataclass
36+
class DeltaDeFiTxInfo:
37+
accountInput: List[Asset]
38+
accountOutput: List[Asset]
39+
dexInput: List[DeltaDeFiOrderInfo]
40+
dexOutput: List[DeltaDeFiOrderInfo]
41+
txFee: str
42+
tradingFee: str

src/deltadefi/clients/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# flake8: noqa
2+
from .accounts import *
3+
from .app import *
4+
from .clients import *
5+
from .markets import *
6+
from .orders import *

0 commit comments

Comments
 (0)