Skip to content

Commit 485a27b

Browse files
authored
Merge pull request #205 from InjectiveLabs/feat/refactor_markets_and_tokens
Feat/refactor markets and tokens
2 parents 308b5fc + 86484cb commit 485a27b

File tree

67 files changed

+1808
-680
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1808
-680
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ copy-proto:
3535
done
3636

3737
tests:
38-
pytest -v tests/**
38+
pytest -v
3939

4040
.PHONY: all gen gen-client copy-proto tests

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ websockets = "*"
2525
[dev-packages]
2626
pytest = "*"
2727
pytest-asyncio = "*"
28+
pytest-grpc = "*"
2829
requests-mock = "*"
2930

3031
[requires]

Pipfile.lock

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ make tests
8787
```
8888

8989
### Changelogs
90+
**0.7.1**(change before release)
91+
* 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
92+
* 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
93+
* Change in AsyncClient to be able to create Composer instances for the client network, markets and tokens
94+
* Examples have been adapted to create Composer instances using the AsyncClient
95+
9096
**0.7**
9197
* 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
9298
* Updated sentry nodes LCD URL, for each sentry node to use its own service

examples/chain_client/0_LocalOrderHash.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import asyncio
2-
import logging
32

4-
from pyinjective.composer import Composer as ProtoMsgComposer
53
from pyinjective.async_client import AsyncClient
64
from pyinjective.transaction import Transaction
75
from pyinjective.constant import Network
@@ -11,10 +9,10 @@
119
async def main() -> None:
1210
# select network: local, testnet, mainnet
1311
network = Network.testnet()
14-
composer = ProtoMsgComposer(network=network.string())
1512

1613
# initialize grpc client
1714
client = AsyncClient(network, insecure=False)
15+
composer = await client.composer()
1816
await client.sync_timeout_height()
1917

2018
# load account

examples/chain_client/13_MsgIncreasePositionMargin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import asyncio
2-
import logging
32

4-
from pyinjective.composer import Composer as ProtoMsgComposer
53
from pyinjective.async_client import AsyncClient
64
from pyinjective.transaction import Transaction
75
from pyinjective.constant import Network
@@ -11,10 +9,10 @@
119
async def main() -> None:
1210
# select network: local, testnet, mainnet
1311
network = Network.testnet()
14-
composer = ProtoMsgComposer(network=network.string())
1512

1613
# initialize grpc client
1714
client = AsyncClient(network, insecure=False)
15+
composer = await client.composer()
1816
await client.sync_timeout_height()
1917

2018
# load account

examples/chain_client/15_MsgWithdraw.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
# limitations under the License.
1414

1515
import asyncio
16-
import logging
1716

18-
from pyinjective.composer import Composer as ProtoMsgComposer
1917
from pyinjective.async_client import AsyncClient
2018
from pyinjective.transaction import Transaction
2119
from pyinjective.constant import Network
@@ -25,10 +23,10 @@
2523
async def main() -> None:
2624
# select network: local, testnet, mainnet
2725
network = Network.testnet()
28-
composer = ProtoMsgComposer(network=network.string())
2926

3027
# initialize grpc client
3128
client = AsyncClient(network, insecure=False)
29+
composer = await client.composer()
3230
await client.sync_timeout_height()
3331

3432
# load account

examples/chain_client/16_MsgSubaccountTransfer.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import asyncio
2-
import logging
32

4-
from pyinjective.composer import Composer as ProtoMsgComposer
53
from pyinjective.async_client import AsyncClient
64
from pyinjective.transaction import Transaction
75
from pyinjective.constant import Network
@@ -11,10 +9,10 @@
119
async def main() -> None:
1210
# select network: local, testnet, mainnet
1311
network = Network.testnet()
14-
composer = ProtoMsgComposer(network=network.string())
1512

1613
# initialize grpc client
1714
client = AsyncClient(network, insecure=False)
15+
composer = await client.composer()
1816
await client.sync_timeout_height()
1917

2018
# load account

examples/chain_client/17_MsgBatchUpdateOrders.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import asyncio
2-
import logging
32

4-
from pyinjective.composer import Composer as ProtoMsgComposer
53
from pyinjective.async_client import AsyncClient
64
from pyinjective.transaction import Transaction
75
from pyinjective.constant import Network
@@ -11,10 +9,10 @@
119
async def main() -> None:
1210
# select network: local, testnet, mainnet
1311
network = Network.testnet()
14-
composer = ProtoMsgComposer(network=network.string())
1512

1613
# initialize grpc client
1714
client = AsyncClient(network, insecure=False)
15+
composer = await client.composer()
1816
await client.sync_timeout_height()
1917

2018
# load account
@@ -132,7 +130,7 @@ async def main() -> None:
132130
print(sim_res)
133131
return
134132

135-
sim_res_msg = ProtoMsgComposer.MsgResponses(sim_res, simulation=True)
133+
sim_res_msg = composer.MsgResponses(sim_res, simulation=True)
136134
print("---Simulation Response---")
137135
print(sim_res_msg)
138136

examples/chain_client/18_MsgBid.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import asyncio
2-
import logging
32

4-
from pyinjective.composer import Composer as ProtoMsgComposer
53
from pyinjective.async_client import AsyncClient
64
from pyinjective.transaction import Transaction
75
from pyinjective.constant import Network
@@ -10,10 +8,10 @@
108
async def main() -> None:
119
# select network: local, testnet, mainnet
1210
network = Network.testnet()
13-
composer = ProtoMsgComposer(network=network.string())
1411

1512
# initialize grpc client
1613
client = AsyncClient(network, insecure=False)
14+
composer = await client.composer()
1715
await client.sync_timeout_height()
1816

1917
# load account

0 commit comments

Comments
 (0)