Skip to content

Commit a1d3cf5

Browse files
Merge pull request #65 from InjectiveLabs/update-examples
Update examples
2 parents f6fdbdd + 0dd128d commit a1d3cf5

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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=True)
25+
account_address = "inj13q8u96uftm0d7ljcf6hdp0uj5tyqrwftmxllaq"
26+
epoch = 2
27+
rewards = await client.get_rewards(account_address=account_address, epoch=epoch)
28+
print(rewards)
29+
30+
if __name__ == '__main__':
31+
logging.basicConfig(level=logging.INFO)
32+
asyncio.get_event_loop().run_until_complete(main())
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
account_address = "inj13q8u96uftm0d7ljcf6hdp0uj5tyqrwftmxllaq"
26+
epoch = 2
27+
rewards = client.get_rewards(account_address=account_address, epoch=epoch)
28+
print(rewards)
29+
30+
if __name__ == '__main__':
31+
logging.basicConfig(level=logging.INFO)
32+
asyncio.get_event_loop().run_until_complete(main())

0 commit comments

Comments
 (0)