Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ee19f3f
(feat) Add pytest-grpc plugin to mock grpc iteractions
May 22, 2023
0652401
(feat) Refactor Composer to use actual markets and tokens to translat…
May 25, 2023
dd7f18e
(fix) Remove deprecation warning from Denom class since it is still b…
May 26, 2023
78b990f
(fix) Undoing rename changes that impacted proto autogenreated compon…
May 29, 2023
68972ac
(fix) Solved issue preventing executing historical orders request bot…
May 26, 2023
2dad929
(fix) Add bugfix description in the changelog in README file
May 26, 2023
2e0de16
(feat) Refactor Composer to use actual markets and tokens to translat…
May 25, 2023
d9b516a
Merge branch 'dev' into feat/refactor_markets_and_tokens
aarmoa May 29, 2023
44f5c40
(fix) Turned market classes and token class into dataclass with eq an…
May 29, 2023
6fc81f4
(fix) Undoing impact of rename of Market to SpotMarket in grpc autoge…
May 29, 2023
05f6d91
(feat) Included logic to validate INI files metadata against indexer …
May 29, 2023
79c722e
(fix) Fixed INI files to synchronize them with the information for th…
May 29, 2023
541b01a
(fix) Updated examples and the `run-examples.sh` script to enable the…
May 30, 2023
6e837a8
(fix) Remove pysha3 requirement from Pipfile.lock since it is not req…
May 30, 2023
747ff34
(feat) Add pytest-grpc plugin to mock grpc iteractions
May 22, 2023
1b52ba4
(feat) Refactor Composer to use actual markets and tokens to translat…
May 25, 2023
b2192c1
(fix) Remove deprecation warning from Denom class since it is still b…
May 26, 2023
8fa18c1
(feat) Refactor Composer to use actual markets and tokens to translat…
May 25, 2023
b5ccef2
(fix) Turned market classes and token class into dataclass with eq an…
May 29, 2023
0c5683e
(feat) Included logic to validate INI files metadata against indexer …
May 29, 2023
ce896be
(fix) Fixed INI files to synchronize them with the information for th…
May 29, 2023
2d16214
(fix) Updated examples and the `run-examples.sh` script to enable the…
May 30, 2023
115affd
(fix) Regenerated Pipfile.lock after synchronizing the branch with th…
Jun 6, 2023
855a48e
Merge branch 'feat/refactor_markets_and_tokens' of https://github.com…
Jun 6, 2023
3951c1a
(fix) Included __init__.py in the tests folder to make it a python mo…
Jun 6, 2023
6dedca5
(fix) Added extra logic to allow the tokens initialization to accept …
Jun 15, 2023
86484cb
Merge branch 'dev' of https://github.com/InjectiveLabs/sdk-python int…
Jul 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ copy-proto:
done

tests:
pytest -v tests/**
pytest -v

.PHONY: all gen gen-client copy-proto tests
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ websockets = "*"
[dev-packages]
pytest = "*"
pytest-asyncio = "*"
pytest-grpc = "*"
requests-mock = "*"

[requires]
Expand Down
10 changes: 9 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ make tests
```

### Changelogs
**0.7.1**(change before release)
* Refactor Composer to be created with all the markets and tokens. The Composer now uses the real markets and tokens to convert human-readable values to chain format
* The Composer can still be instantiated without markets and tokens. When markets and tokens are not provided the Composer loads the required information from the Denoms used in previous versions
* Change in AsyncClient to be able to create Composer instances for the client network, markets and tokens
* Examples have been adapted to create Composer instances using the AsyncClient

**0.7**
* Removed references to pysha3 library (and also eip712-struct that required it) and replaced it with other implementation to allow the project to work with Python 3.11
* Updated sentry nodes LCD URL, for each sentry node to use its own service
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/0_LocalOrderHash.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/13_MsgIncreasePositionMargin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/15_MsgWithdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
# limitations under the License.

import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -25,10 +23,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/16_MsgSubaccountTransfer.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
6 changes: 2 additions & 4 deletions examples/chain_client/17_MsgBatchUpdateOrders.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down Expand Up @@ -132,7 +130,7 @@ async def main() -> None:
print(sim_res)
return

sim_res_msg = ProtoMsgComposer.MsgResponses(sim_res, simulation=True)
sim_res_msg = composer.MsgResponses(sim_res, simulation=True)
print("---Simulation Response---")
print(sim_res_msg)

Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/18_MsgBid.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -10,10 +8,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/19_MsgGrant.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/1_MsgSend.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,11 +9,11 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
# set custom cookie location (optional) - defaults to current dir
client = AsyncClient(network, insecure=False, chain_cookie_location="/tmp/.chain_cookie")
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
8 changes: 3 additions & 5 deletions examples/chain_client/20_MsgExec.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down Expand Up @@ -63,9 +61,9 @@ async def main() -> None:
print(sim_res)
return

sim_res_msg = ProtoMsgComposer.MsgResponses(sim_res, simulation=True)
sim_res_msg = composer.MsgResponses(sim_res, simulation=True)
data=sim_res_msg[0]
unpacked_msg_res = ProtoMsgComposer.UnpackMsgExecResponse(
unpacked_msg_res = composer.UnpackMsgExecResponse(
msg_type=msg0.__class__.__name__,
data=data
)
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/21_MsgRevoke.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/22_MsgSendToEth.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import asyncio
import logging
import requests

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/23_MsgRelayPriceFeedPrice.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/24_MsgRewardsOptOut.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/25_MsgDelegate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/26_MsgWithdrawDelegatorReward.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
4 changes: 1 addition & 3 deletions examples/chain_client/2_MsgDeposit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import logging

from pyinjective.composer import Composer as ProtoMsgComposer
from pyinjective.async_client import AsyncClient
from pyinjective.transaction import Transaction
from pyinjective.constant import Network
Expand All @@ -11,10 +9,10 @@
async def main() -> None:
# select network: local, testnet, mainnet
network = Network.testnet()
composer = ProtoMsgComposer(network=network.string())

# initialize grpc client
client = AsyncClient(network, insecure=False)
composer = await client.composer()
await client.sync_timeout_height()

# load account
Expand Down
Loading