-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from InjectiveLabs/update-sdk
Update sdk
- Loading branch information
Showing
11 changed files
with
252 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
examples/exchange_api_examples/accounts_rpc/8_PortfolioRequest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Copyright 2021 Injective Labs | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Injective Exchange API client for Python. Example only.""" | ||
|
||
import asyncio | ||
import logging | ||
|
||
from pyinjective.client import Client | ||
from pyinjective.constant import Network | ||
|
||
|
||
async def main() -> None: | ||
network = Network.testnet() | ||
client = Client(network, insecure=True) | ||
account_address = "inj14au322k9munkmx5wrchz9q30juf5wjgz2cfqku" | ||
portfolio = client.get_portfolio(account_address=account_address) | ||
print(portfolio) | ||
|
||
if __name__ == '__main__': | ||
logging.basicConfig(level=logging.INFO) | ||
asyncio.get_event_loop().run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2021 Injective Labs | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Injective Exchange API client for Python. Example only.""" | ||
|
||
import asyncio | ||
import logging | ||
|
||
from pyinjective.client import Client | ||
from pyinjective.constant import Network | ||
|
||
async def main() -> None: | ||
network = Network.testnet() | ||
client = Client(network, insecure=True) | ||
bid_round = 135 | ||
auction = client.get_auction(bid_round=bid_round) | ||
print(auction) | ||
|
||
if __name__ == '__main__': | ||
logging.basicConfig(level=logging.INFO) | ||
asyncio.get_event_loop().run_until_complete(main()) |
30 changes: 30 additions & 0 deletions
30
examples/exchange_api_examples/auctions_rpc/11_Auctions.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2021 Injective Labs | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Injective Exchange API client for Python. Example only.""" | ||
|
||
import asyncio | ||
import logging | ||
|
||
from pyinjective.client import Client | ||
from pyinjective.constant import Network | ||
|
||
async def main() -> None: | ||
network = Network.testnet() | ||
client = Client(network, insecure=True) | ||
auctions = client.get_auctions() | ||
print(auctions) | ||
|
||
if __name__ == '__main__': | ||
logging.basicConfig(level=logging.INFO) | ||
asyncio.get_event_loop().run_until_complete(main()) |
31 changes: 31 additions & 0 deletions
31
examples/exchange_api_examples/auctions_rpc/9_Streambids.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2021 Injective Labs | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Injective Exchange API client for Python. Example only.""" | ||
|
||
import asyncio | ||
import logging | ||
|
||
from pyinjective.client import Client | ||
from pyinjective.constant import Network | ||
|
||
async def main() -> None: | ||
network = Network.testnet() | ||
client = Client(network, insecure=True) | ||
bids = client.stream_bids() | ||
for bid in bids: | ||
print(bid) | ||
|
||
if __name__ == '__main__': | ||
logging.basicConfig(level=logging.INFO) | ||
asyncio.get_event_loop().run_until_complete(main()) |
31 changes: 31 additions & 0 deletions
31
examples/exchange_api_examples/explorer_rpc/1_GetTxByHash.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright 2021 Injective Labs | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
"""Injective Exchange API client for Python. Example only.""" | ||
|
||
import asyncio | ||
import logging | ||
|
||
from pyinjective.client import Client | ||
from pyinjective.constant import Network | ||
|
||
async def main() -> None: | ||
network = Network.testnet() | ||
client = Client(network, insecure=True) | ||
tx_hash = "0x298c3a789bb53b5978f8140fcfe9ec8a4447211b95618d8b108fcf521625fb1a" | ||
account = client.get_tx_by_hash(tx_hash=tx_hash) | ||
print(account) | ||
|
||
if __name__ == '__main__': | ||
logging.basicConfig(level=logging.INFO) | ||
asyncio.get_event_loop().run_until_complete(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.