|
| 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.client import Client |
| 20 | +from pyinjective.constant import Network |
| 21 | + |
| 22 | +async def main() -> None: |
| 23 | + network = Network.testnet() |
| 24 | + client = Client(network, insecure=True) |
| 25 | + granter = "inj14au322k9munkmx5wrchz9q30juf5wjgz2cfqku" |
| 26 | + grantee = "inj1hkhdaj2a2clmq5jq6mspsggqs32vynpk228q3r" |
| 27 | + msg_type_url = "/injective.exchange.v1beta1.MsgCreateDerivativeLimitOrder" |
| 28 | + authorizations = client.get_grants(granter=granter, grantee=grantee, msg_type_url=msg_type_url) |
| 29 | + print(authorizations) |
| 30 | + |
| 31 | +if __name__ == '__main__': |
| 32 | + logging.basicConfig(level=logging.INFO) |
| 33 | + asyncio.get_event_loop().run_until_complete(main()) |
0 commit comments