Skip to content

Commit eadd9d4

Browse files
Merge pull request #126 from InjectiveLabs/f/add_get_tx_tendermint
F/release0.5.7.0
2 parents c9622d5 + 386959a commit eadd9d4

File tree

5 files changed

+55
-317
lines changed

5 files changed

+55
-317
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ Note that the [sync client](https://github.com/InjectiveLabs/sdk-python/blob/mas
7878

7979

8080
### Changelogs
81+
**0.5.7.0**
82+
* Add GetTxRequest Tendermint
83+
* Re-gen ini files
84+
8185
**0.5.6.9**
8286
* Add MsgExternalTransfer to the composer
8387
* Add support for Binary Options

examples/chain_client/37_GetTx.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2021 Injective Labs
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""Injective Exchange API client for Python. Example only."""
15+
16+
import asyncio
17+
import logging
18+
19+
from pyinjective.async_client import AsyncClient
20+
from pyinjective.constant import Network
21+
22+
async def main() -> None:
23+
network = Network.testnet()
24+
client = AsyncClient(network, insecure=False)
25+
tx_hash = "7746BC12EB82B4D59D036FBFF2F67BDCA6F62A20B3DBC25661707DD61D4DC1B7"
26+
tx_logs = await client.get_tx(tx_hash=tx_hash)
27+
print(tx_logs)
28+
29+
if __name__ == '__main__':
30+
logging.basicConfig(level=logging.INFO)
31+
asyncio.get_event_loop().run_until_complete(main())

pyinjective/async_client.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
query_pb2_grpc as tendermint_query_grpc,
1515
query_pb2 as tendermint_query,
1616
)
17+
1718
from .proto.cosmos.auth.v1beta1 import (
1819
query_pb2_grpc as auth_query_grpc,
1920
query_pb2 as auth_query,
@@ -142,6 +143,12 @@ def __init__(
142143
start=True
143144
)
144145

146+
async def get_tx(self, tx_hash):
147+
return await self.stubTx.GetTx(
148+
tx_service.GetTxRequest(
149+
hash=tx_hash )
150+
)
151+
145152
async def close_exchange_channel(self):
146153
await self.exchange_channel.close()
147154

@@ -797,4 +804,3 @@ async def get_binary_options_markets(self, **kwargs):
797804
async def get_binary_options_market(self, market_id: str):
798805
req = derivative_exchange_rpc_pb.BinaryOptionsMarketRequest(market_id=market_id)
799806
return await self.stubDerivativeExchange.BinaryOptionsMarket(req)
800-

0 commit comments

Comments
 (0)