Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [1.4.1] - 2024-03-12
### Changed
- Updates example scripts that were still using deprecated methods

## [1.4.0] - 2024-03-11
### Added
- Added support for all queries and messages in the chain 'distribution' module
Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/3_MessageBroadcaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def main() -> None:
]

# prepare tx msg
msg = composer.MsgBatchUpdateOrders(
msg = composer.msg_batch_update_orders(
sender=address.to_acc_bech32(),
spot_orders_to_create=spot_orders_to_create,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async def main() -> None:
]

# prepare tx msg
msg = composer.MsgBatchUpdateOrders(
msg = composer.msg_batch_update_orders(
sender=address.to_acc_bech32(),
spot_orders_to_create=spot_orders_to_create,
)
Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/exchange/8_MsgCancelSpotOrder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def main() -> None:
order_hash = "0x52888d397d5ae821869c8acde5823dfd8018802d2ef642d3aa639e5308173fcf"

# prepare tx msg
msg = composer.MsgCancelSpotOrder(
msg = composer.msg_cancel_spot_order(
sender=address.to_acc_bech32(), market_id=market_id, subaccount_id=subaccount_id, order_hash=order_hash
)

Expand Down
2 changes: 1 addition & 1 deletion examples/chain_client/exchange/9_MsgBatchUpdateOrders.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async def main() -> None:
]

# prepare tx msg
msg = composer.MsgBatchUpdateOrders(
msg = composer.msg_batch_update_orders(
sender=address.to_acc_bech32(),
derivative_orders_to_create=derivative_orders_to_create,
spot_orders_to_create=spot_orders_to_create,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "injective-py"
version = "1.4.0"
version = "1.4.1"
description = "Injective Python SDK, with Exchange API Client"
authors = ["Injective Labs <contact@injectivelabs.org>"]
license = "Apache-2.0"
Expand Down
20 changes: 10 additions & 10 deletions tests/core/test_gas_limit_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def test_estimation_for_batch_update_orders_to_create_spot_orders(self):
order_type="BUY",
),
]
message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders correctly replaces the deprecated method name. This change aligns with the PR's objective to update example scripts and test files to use current method names. However, there's a minor typo in the sender parameter value ("senders" should be "sender").

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(

sender="senders",
derivative_orders_to_create=[],
spot_orders_to_create=orders,
Expand Down Expand Up @@ -194,7 +194,7 @@ def test_estimation_for_batch_update_orders_to_create_derivative_orders(self):
order_type="SELL",
),
]
message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for creating derivative orders is correctly updated. The change is consistent with the PR's goal. The same typo in the sender parameter value is present here as well.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(
sender="sender",

sender="senders",
derivative_orders_to_create=orders,
spot_orders_to_create=[],
Expand Down Expand Up @@ -249,7 +249,7 @@ def test_estimation_for_batch_update_orders_to_create_binary_orders(self, usdt_t
order_type="SELL",
),
]
message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for creating binary options orders is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(

sender="senders",
derivative_orders_to_create=[],
spot_orders_to_create=[],
Expand Down Expand Up @@ -284,7 +284,7 @@ def test_estimation_for_batch_update_orders_to_cancel_spot_orders(self):
order_hash="0x7ee76255d7ca763c56b0eab9828fca89fdd3739645501c8a80f58b62b4f76da5",
),
]
message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for canceling spot orders is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(

sender="senders",
derivative_orders_to_create=[],
spot_orders_to_create=[],
Expand Down Expand Up @@ -318,7 +318,7 @@ def test_estimation_for_batch_update_orders_to_cancel_derivative_orders(self):
order_hash="0x7ee76255d7ca763c56b0eab9828fca89fdd3739645501c8a80f58b62b4f76da5",
),
]
message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for canceling derivative orders is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(
sender="sender",

sender="senders",
derivative_orders_to_create=[],
spot_orders_to_create=[],
Expand Down Expand Up @@ -352,7 +352,7 @@ def test_estimation_for_batch_update_orders_to_cancel_binary_orders(self):
order_hash="0x7ee76255d7ca763c56b0eab9828fca89fdd3739645501c8a80f58b62b4f76da5",
),
]
message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for canceling binary options orders is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(
sender="sender",

sender="senders",
derivative_orders_to_create=[],
spot_orders_to_create=[],
Expand All @@ -371,7 +371,7 @@ def test_estimation_for_batch_update_orders_to_cancel_all_for_spot_market(self):
market_id = "0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe"
composer = Composer(network="testnet")

message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for canceling all orders for a spot market is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(

sender="senders",
subaccount_id="subaccount_id",
spot_market_ids_to_cancel_all=[market_id],
Expand All @@ -391,7 +391,7 @@ def test_estimation_for_batch_update_orders_to_cancel_all_for_derivative_market(
market_id = "0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe"
composer = Composer(network="testnet")

message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for canceling all orders for a derivative market is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(

sender="senders",
subaccount_id="subaccount_id",
derivative_market_ids_to_cancel_all=[market_id],
Expand All @@ -411,7 +411,7 @@ def test_estimation_for_batch_update_orders_to_cancel_all_for_binary_options_mar
market_id = "0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe"
composer = Composer(network="testnet")

message = composer.MsgBatchUpdateOrders(
message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders for canceling all orders for a binary options market is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
message = composer.msg_batch_update_orders(
message = composer.msg_batch_update_orders(
sender="sender",

sender="senders",
subaccount_id="subaccount_id",
binary_options_market_ids_to_cancel_all=[market_id],
Expand Down Expand Up @@ -440,7 +440,7 @@ def test_estimation_for_exec_message(self):
order_type="BUY",
),
]
inner_message = composer.MsgBatchUpdateOrders(
inner_message = composer.msg_batch_update_orders(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method call composer.msg_batch_update_orders within the MsgExec message is correctly updated. This change aligns with the PR's objectives. The typo in the sender parameter value is repeated here.

-            sender="senders",
+            sender="sender",

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
inner_message = composer.msg_batch_update_orders(
inner_message = composer.msg_batch_update_orders(

sender="senders",
derivative_orders_to_create=[],
spot_orders_to_create=orders,
Expand Down
18 changes: 0 additions & 18 deletions tests/test_async_client_deprecation_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,24 +537,6 @@ async def test_stream_keepalive_deprecation_warning(
assert len(deprecation_warnings) == 1
assert str(deprecation_warnings[0].message) == "This method is deprecated. Use listen_keepalive instead"

@pytest.mark.asyncio
async def test_oracle_list_deprecation_warning(
self,
oracle_servicer,
):
client = AsyncClient(
network=Network.local(),
)
client.stubOracle = oracle_servicer
oracle_servicer.oracle_list_responses.append(exchange_oracle_pb.OracleListResponse())

with catch_warnings(record=True) as all_warnings:
await client.get_oracle_list()

deprecation_warnings = [warning for warning in all_warnings if issubclass(warning.category, DeprecationWarning)]
assert len(deprecation_warnings) == 1
assert str(deprecation_warnings[0].message) == "This method is deprecated. Use fetch_oracle_list instead"

@pytest.mark.asyncio
async def test_get_oracle_list_deprecation_warning(
self,
Expand Down
31 changes: 30 additions & 1 deletion tests/test_composer_deprecation_warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,20 @@ def test_msg_withdraw_deprecation_warning(self):
assert len(deprecation_warnings) == 1
assert str(deprecation_warnings[0].message) == "This method is deprecated. Use msg_withdraw instead"

def teste_order_data_deprecation_warning(self):
def test_coin_deprecation_warning(self):
composer = Composer(network=Network.devnet().string())

with warnings.catch_warnings(record=True) as all_warnings:
composer.Coin(
amount=1,
denom="INJ",
)

deprecation_warnings = [warning for warning in all_warnings if issubclass(warning.category, DeprecationWarning)]
assert len(deprecation_warnings) == 1
assert str(deprecation_warnings[0].message) == "This method is deprecated. Use coin instead"

def test_order_data_deprecation_warning(self):
composer = Composer(network=Network.devnet().string())

with warnings.catch_warnings(record=True) as all_warnings:
Expand Down Expand Up @@ -520,3 +533,19 @@ def test_msg_admin_update_binary_options_market_deprecation_warning(self, basic_
str(deprecation_warnings[0].message)
== "This method is deprecated. Use msg_admin_update_binary_options_market instead"
)

def test_msg_withdraw_delegator_reward_deprecation_warning(self):
composer = Composer(network=Network.devnet().string())

with warnings.catch_warnings(record=True) as all_warnings:
composer.MsgWithdrawDelegatorReward(
delegator_address="delegator address",
validator_address="validator address",
)

deprecation_warnings = [warning for warning in all_warnings if issubclass(warning.category, DeprecationWarning)]
assert len(deprecation_warnings) == 1
assert (
str(deprecation_warnings[0].message)
== "This method is deprecated. Use msg_withdraw_delegator_reward instead"
)