nado-protocol 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl
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.
- nado_protocol/client/apis/market/execute.py +146 -0
- nado_protocol/trigger_client/execute.py +227 -2
- nado_protocol/trigger_client/query.py +19 -0
- nado_protocol/trigger_client/types/models.py +50 -9
- nado_protocol/trigger_client/types/query.py +137 -15
- nado_protocol/utils/twap.py +189 -0
- nado_protocol-0.1.5.dist-info/METADATA +309 -0
- {nado_protocol-0.1.4.dist-info → nado_protocol-0.1.5.dist-info}/RECORD +10 -9
- {nado_protocol-0.1.4.dist-info → nado_protocol-0.1.5.dist-info}/WHEEL +1 -1
- nado_protocol-0.1.4.dist-info/METADATA +0 -159
- {nado_protocol-0.1.4.dist-info → nado_protocol-0.1.5.dist-info}/entry_points.txt +0 -0
|
@@ -3,7 +3,7 @@ nado_protocol/client/__init__.py,sha256=kI_dXpRXe8EYpArsaT0aOvr4_LHDj8Tdaa8Qb3a4
|
|
|
3
3
|
nado_protocol/client/apis/__init__.py,sha256=0wEscoemkmvyyTlUAaIM2vSO9LD_yCCVf3loHwasG_4,680
|
|
4
4
|
nado_protocol/client/apis/base.py,sha256=89g6va4wcqbV7XLO0UBkKmmM2C2oDcYSzRjzaUnFcGQ,1807
|
|
5
5
|
nado_protocol/client/apis/market/__init__.py,sha256=uILwdGeWOzQRT7x8bxvof6_u4GpsG9tL9I0VBuDPSoE,1102
|
|
6
|
-
nado_protocol/client/apis/market/execute.py,sha256=
|
|
6
|
+
nado_protocol/client/apis/market/execute.py,sha256=7rVwqZMDf74ashBpr7BpZpPJOejzmuCC1z3Gcpvclkg,13326
|
|
7
7
|
nado_protocol/client/apis/market/query.py,sha256=CmL_btMtqp0iJFqUt_gszkhe-i4LlcNvt3ogtdDaUXk,13509
|
|
8
8
|
nado_protocol/client/apis/perp/__init__.py,sha256=KUGZ86Xo-NB-9uhqEyXkrqoGDhWeex0-AQwCfWfvpsg,742
|
|
9
9
|
nado_protocol/client/apis/perp/query.py,sha256=r4E0tJo7-z9J3HOMufo6BZ9yTYtpCb-ANZeM05lf7rU,1420
|
|
@@ -52,12 +52,12 @@ nado_protocol/indexer_client/types/__init__.py,sha256=r3-jxMjrFNbA1nMRSGZjsE3qyp
|
|
|
52
52
|
nado_protocol/indexer_client/types/models.py,sha256=50VVbO9G0PaDNLgtdUd60KS6g6dkUMZ1mw47DadMIsQ,7500
|
|
53
53
|
nado_protocol/indexer_client/types/query.py,sha256=_alTQ0SqQmZXGpNm3hsfCq4241m4szIskxkORBmeCv4,18859
|
|
54
54
|
nado_protocol/trigger_client/__init__.py,sha256=kD_WJWGOCDwX7GvGF5VGZibWR2uPYRcWpIWht31PYR4,545
|
|
55
|
-
nado_protocol/trigger_client/execute.py,sha256=
|
|
56
|
-
nado_protocol/trigger_client/query.py,sha256=
|
|
55
|
+
nado_protocol/trigger_client/execute.py,sha256=VkVla3SF6MX-ZJC_wZG72em41MPAKX-jv1_Lh4ydezU,15089
|
|
56
|
+
nado_protocol/trigger_client/query.py,sha256=7M7opYEddNo0Wf9VQ7rha-WaoFQVv5F5OI-YLSRWrpk,2705
|
|
57
57
|
nado_protocol/trigger_client/types/__init__.py,sha256=Rj953ymGSNnVdOpDrwRuXmC_jhuPZU17BaSgBrc9cbk,183
|
|
58
58
|
nado_protocol/trigger_client/types/execute.py,sha256=Ij_gCl3ZzhouWF7JxEY_U6hUbe9teOYp1ZfN0PDcOpM,2896
|
|
59
|
-
nado_protocol/trigger_client/types/models.py,sha256=
|
|
60
|
-
nado_protocol/trigger_client/types/query.py,sha256=
|
|
59
|
+
nado_protocol/trigger_client/types/models.py,sha256=ZVDF3MFWoR39JBaTmSOTl1WnRnw46hjX-WN_a-g6zKk,1638
|
|
60
|
+
nado_protocol/trigger_client/types/query.py,sha256=O6qhFLL2IREHc_mf-jFMyuVSzH1RuwjM-8noolLmEaQ,5288
|
|
61
61
|
nado_protocol/utils/__init__.py,sha256=_nsvXmdiO3YmjSk7UG7df9qDoC8bd1H8_Au0lF-TwTA,1418
|
|
62
62
|
nado_protocol/utils/backend.py,sha256=UqmHN_jmTAOnRiUQcUTZUyTGeM7FwjauwSH5h8UxiLQ,3781
|
|
63
63
|
nado_protocol/utils/bytes32.py,sha256=FHeHs9Sf-S7GdFTF6ikuz_sEkM-fpRW-g3kbZawlMd4,5299
|
|
@@ -72,7 +72,8 @@ nado_protocol/utils/nonce.py,sha256=DHNn5mzXdJRope8QLcDCMFe7Bk4PXLoR9VaFopfse7I,
|
|
|
72
72
|
nado_protocol/utils/order.py,sha256=7Tul8pxg1Soxj9tI3HEgZV4bz-bW_b3CGARJKqu3_NM,11251
|
|
73
73
|
nado_protocol/utils/subaccount.py,sha256=WJ7lgU2RekuzJAZH-hhCTbIBlRsl2oHozBm7OEMRV74,495
|
|
74
74
|
nado_protocol/utils/time.py,sha256=tEwmrkc5VdzKLlgkJIAq2ce-nhrduJZNtVPydrrnTHs,360
|
|
75
|
-
nado_protocol
|
|
76
|
-
nado_protocol-0.1.
|
|
77
|
-
nado_protocol-0.1.
|
|
78
|
-
nado_protocol-0.1.
|
|
75
|
+
nado_protocol/utils/twap.py,sha256=hfBVK0CBa8m4uBArxTnNRoJr3o1rJucyopR_8_9gkOo,6197
|
|
76
|
+
nado_protocol-0.1.5.dist-info/METADATA,sha256=Cq6TprBUEk7HFbbu4EAxXSPelOApH6_uioZrqf4vWok,9558
|
|
77
|
+
nado_protocol-0.1.5.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
78
|
+
nado_protocol-0.1.5.dist-info/entry_points.txt,sha256=7xMbwQYtf2zfvzWdBaw5d5hp5TTv5Xia5WPsqxkvKuU,300
|
|
79
|
+
nado_protocol-0.1.5.dist-info/RECORD,,
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: nado-protocol
|
|
3
|
-
Version: 0.1.4
|
|
4
|
-
Summary: Nado Protocol SDK
|
|
5
|
-
Keywords: nado protocol,nado sdk,nado protocol api
|
|
6
|
-
Author: Jeury Mejia
|
|
7
|
-
Author-email: jeury@inkfnd.com
|
|
8
|
-
Maintainer: Frank Jia
|
|
9
|
-
Maintainer-email: frank@inkfnd.com
|
|
10
|
-
Requires-Python: >=3.9,<4.0
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
-
Requires-Dist: eth-account (>=0.8.0,<0.9.0)
|
|
18
|
-
Requires-Dist: pydantic (>=1.10.7,<2.0.0)
|
|
19
|
-
Requires-Dist: web3 (>=6.4.0,<7.0.0)
|
|
20
|
-
Project-URL: Documentation, https://nadohq.github.io/nado-python-sdk/
|
|
21
|
-
Project-URL: Homepage, https://nado.xyz
|
|
22
|
-
Description-Content-Type: text/markdown
|
|
23
|
-
|
|
24
|
-
# Nado Protocol Python SDK
|
|
25
|
-
|
|
26
|
-
This is the Python SDK for the [Nado Protocol API](TODO).
|
|
27
|
-
|
|
28
|
-
See [SDK docs](https://nadohq.github.io/nado-python-sdk/index.html) to get started.
|
|
29
|
-
|
|
30
|
-
## Requirements
|
|
31
|
-
|
|
32
|
-
- Python 3.9 or above
|
|
33
|
-
|
|
34
|
-
## Installation
|
|
35
|
-
|
|
36
|
-
You can install the SDK via pip:
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
pip install nado-protocol
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Basic usage
|
|
43
|
-
|
|
44
|
-
### Import the necessary utilities:
|
|
45
|
-
|
|
46
|
-
```python
|
|
47
|
-
from nado_protocol.client import create_nado_client, NadoClientMode
|
|
48
|
-
from nado_protocol.contracts.types import DepositCollateralParams
|
|
49
|
-
from nado_protocol.engine_client.types.execute import (
|
|
50
|
-
OrderParams,
|
|
51
|
-
PlaceOrderParams,
|
|
52
|
-
SubaccountParams
|
|
53
|
-
)
|
|
54
|
-
from nado_protocol.utils.expiration import OrderType, get_expiration_timestamp
|
|
55
|
-
from nado_protocol.utils.math import to_pow_10, to_x18
|
|
56
|
-
from nado_protocol.utils.nonce import gen_order_nonce
|
|
57
|
-
from nado_protocol.utils.order import build_appendix
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Create the NadoClient providing your private key:
|
|
61
|
-
|
|
62
|
-
```python
|
|
63
|
-
print("setting up nado client...")
|
|
64
|
-
private_key = "xxx"
|
|
65
|
-
client = create_nado_client(NadoClientMode.DEVNET, private_key)
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Perform basic operations:
|
|
69
|
-
|
|
70
|
-
```python
|
|
71
|
-
# Depositing collaterals
|
|
72
|
-
print("approving allowance...")
|
|
73
|
-
approve_allowance_tx_hash = client.spot.approve_allowance(0, to_pow_10(100000, 6))
|
|
74
|
-
print("approve allowance tx hash:", approve_allowance_tx_hash)
|
|
75
|
-
|
|
76
|
-
print("querying my allowance...")
|
|
77
|
-
token_allowance = client.spot.get_token_allowance(0, client.context.signer.address)
|
|
78
|
-
print("token allowance:", token_allowance)
|
|
79
|
-
|
|
80
|
-
print("depositing collateral...")
|
|
81
|
-
deposit_tx_hash = client.spot.deposit(
|
|
82
|
-
DepositCollateralParams(
|
|
83
|
-
subaccount_name="default", product_id=0, amount=to_pow_10(100000, 6)
|
|
84
|
-
)
|
|
85
|
-
)
|
|
86
|
-
print("deposit collateral tx hash:", deposit_tx_hash)
|
|
87
|
-
|
|
88
|
-
# Placing orders
|
|
89
|
-
print("placing order...")
|
|
90
|
-
owner = client.context.engine_client.signer.address
|
|
91
|
-
product_id = 1
|
|
92
|
-
order = OrderParams(
|
|
93
|
-
sender=SubaccountParams(
|
|
94
|
-
subaccount_owner=owner,
|
|
95
|
-
subaccount_name="default",
|
|
96
|
-
),
|
|
97
|
-
priceX18=to_x18(20000),
|
|
98
|
-
amount=to_pow_10(1, 17),
|
|
99
|
-
expiration=get_expiration_timestamp(40),
|
|
100
|
-
nonce=gen_order_nonce(),
|
|
101
|
-
appendix=build_appendix(order_type=OrderType.POST_ONLY)
|
|
102
|
-
)
|
|
103
|
-
res = client.market.place_order({"product_id": product_id, "order": order})
|
|
104
|
-
print("order result:", res.json(indent=2))
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
See [Getting Started](https://nadohq.github.io/nado-python-sdk/getting-started.html) for more.
|
|
108
|
-
|
|
109
|
-
## Running locally
|
|
110
|
-
|
|
111
|
-
1. Clone [github repo](https://github.com/nadohq/nado-python-sdk)
|
|
112
|
-
|
|
113
|
-
2. Install poetry
|
|
114
|
-
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
$ curl -sSL https://install.python-poetry.org | python3 -
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
3. Setup a virtual environment and activate it
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
$ python3 -m venv venv
|
|
126
|
-
$ source ./venv/bin/activate
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
4. Install dependencies via `poetry install`
|
|
131
|
-
5. Setup an `.env` file and set the following envvars
|
|
132
|
-
|
|
133
|
-
```shell
|
|
134
|
-
CLIENT_MODE='devnet'
|
|
135
|
-
SIGNER_PRIVATE_KEY="0x..."
|
|
136
|
-
LINKED_SIGNER_PRIVATE_KEY="0x..." # not required
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Run tests
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
$ poetry run test
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Run sanity checks
|
|
146
|
-
|
|
147
|
-
- `poetry run client-sanity`: runs sanity checks for the top-level client.
|
|
148
|
-
- `poetry run engine-sanity`: runs sanity checks for the `engine-client`.
|
|
149
|
-
- `poetry run indexer-sanity`: runs sanity checks for the `indexer-client`.
|
|
150
|
-
- `poetry run contracts-sanity`: runs sanity checks for the contracts module.
|
|
151
|
-
|
|
152
|
-
### Build Docs
|
|
153
|
-
|
|
154
|
-
To build the docs locally run:
|
|
155
|
-
|
|
156
|
-
```
|
|
157
|
-
$ poetry run sphinx-build docs/source docs/build
|
|
158
|
-
```
|
|
159
|
-
|
|
File without changes
|