Skip to content

Conversation

@aarmoa
Copy link
Collaborator

@aarmoa aarmoa commented Apr 16, 2025

  • This PR includes all the messages and queries updates for the chain upgrade to v1.15

Summary by CodeRabbit

  • New Features

    • Introduced support for querying transaction fees and EIP base fee via a new TXFees module and API.
    • Added dynamic gas price fetching and management, enabling more accurate transaction fee estimation.
    • Provided comprehensive heuristic-based gas limit estimation for various transaction types.
    • Added referral system API support and new portfolio, auction, and chart market summary endpoints.
    • Extended protobuf and gRPC definitions for new modules and enhanced existing ones with USD value fields.
  • Enhancements

    • Updated broadcaster and fee calculation logic to allow dynamic gas price updates and multiple estimation strategies.
    • Improved resource management and error handling in client operations.
    • Updated documentation and usage examples for greater accuracy.
  • Bug Fixes

    • Adjusted test cases and data models to support new USD value fields and updated API responses.
  • Chores

    • Upgraded dependencies and protobuf files for compatibility with the latest Injective Core and Indexer versions.
    • Updated OFAC address list.
  • Tests

    • Added and extended tests to cover new gas estimation, transaction fee querying, and USD value fields.

…ccount_orders_message

fix/rename_derivative_subaccount_orders_message
* feat: updated changelog and version number for v1.9.0 release

* fix: updated the oracle stream prices script to send the oracle type always in lowercase

* fix: added quantization in the functions that convert notional values to chain format

* cp-235: updated the gas limit estimator logic to reflect the new logic for gas heuristics in exchange module (chain v1.15)

* cp-235: updated all proto definitions with the candidate indexer and chain core versions for v1.15 chain upgrade

* feat: added a new message based fee calculator supporting the Exchange module gas heuristics

* fix: fix broadcaster creation example scripts

* fix: pointed to the correct injective-core branch for the proto generation

* fix: updated gas heuristics per message gas cost to sync with latest changes on chain

* fix: added cleanup code in AsyncClient for the object destruction phase

* feat: updated proto definitions for chain v1.15 upgrade and Indexer v1.14.48

* feat: made the gas calculator using gas heuristics the default one for the MsgBroadcasterWithPk when broadcasting without simulation

* fix: fixed gas calculation using heuristics to not duplicate the required gas for post only orders
@aarmoa aarmoa requested a review from Copilot April 16, 2025 14:16
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 16, 2025

Walkthrough

This update introduces version 1.10.0 of the Injective Python SDK, featuring major enhancements centered on dynamic gas fee management and integration with the new TXFees module. The core client now supports querying live gas prices and EIP base fees from the blockchain, replacing static gas price constants throughout transaction scripts. A heuristic-based gas limit estimator system was added for accurate gas budgeting. Numerous protobuf files were regenerated to align with Injective core v1.15 and Indexer v1.15.6, introducing new fields and services. Extensive test coverage was added for the new gas estimation logic and TXFees API. Documentation and example scripts were updated to reflect these changes and new file structures.

Changes

File(s) / Path(s) Change Summary
CHANGELOG.md, pyproject.toml Bumped version to 1.10.0 and documented new TXFees module, dynamic gas price support, and protobuf updates.
Makefile, buf.gen.yaml Updated dependency versions for Injective core, Indexer, Cosmos SDK, IBC, Wasmd.
README.md Corrected example script paths and usage instructions.
pyinjective/async_client.py Added TXFees API integration, dynamic gas price querying, resource cleanup methods, improved task cancellation, method renames, and error handling.
pyinjective/core/broadcaster.py Added dynamic gas price updating, multiple broadcaster factory methods, support for gas heuristics, and refactored fee calculator logic.
pyinjective/core/gas_heuristics_gas_limit_estimator.py New: Implements heuristic-based gas limit estimators for various message types.
pyinjective/client/chain/grpc/chain_grpc_txfees_api.py New: Provides async gRPC client for querying TXFees module (params, EIP base fee).
pyinjective/client/chain/grpc/chain_grpc_token_factory_api.py Removed unused tx stub initialization.
pyinjective/client/indexer/grpc/indexer_grpc_portfolio_api.py Portfolio balance query now supports optional USD conversion.
pyinjective/ofac.json Pruned and added Ethereum addresses.
pyinjective/proto/... (multiple files under proto/) Regenerated for Injective v1.15; added new fields (USD values, timestamps), new services (Referral, Chart, TXFees), and updated descriptors.
examples/chain_client/... (many scripts) Replaced static GAS_PRICE with dynamic, chain-fetched gas price; improved JSON output formatting; updated for async client usage and new broadcaster methods.
examples/chain_client/txfees/query/1_GetEipBaseFee.py New: Example script for querying EIP base fee from TXFees module.
examples/exchange_client/derivative_exchange_rpc/13_SubaccountOrdersList.py Switched to derivative-specific subaccount orders fetch method.
examples/exchange_client/portfolio_rpc/1_AccountPortfolio.py Explicitly set USD conversion flag in portfolio balance fetch.
tests/core/test_gas_heuristics_gas_limit_estimator.py New: Comprehensive tests for gas heuristics estimator.
tests/client/chain/grpc/configurable_txfees_query_servicer.py, tests/client/chain/grpc/test_chain_grpc_txfees_api.py New: Test utilities and tests for TXFees API client.
tests/core/test_message_based_transaction_fee_calculator.py Updated to use new ante gas limit constant.
tests/client/indexer/grpc/test_indexer_grpc_* and stream_grpc/test_indexer_grpc_* Extended tests to cover new USD fields, timestamps, and updated proto structures.
tests/client/chain/grpc/test_chain_grpc_exchange_api.py, ... Updated tests for new proto fields and query signatures.

Sequence Diagram(s)

sequenceDiagram
    participant UserScript
    participant AsyncClient
    participant ChainGrpcTxfeesApi
    participant Blockchain

    UserScript->>AsyncClient: current_chain_gas_price()
    AsyncClient->>ChainGrpcTxfeesApi: fetch_eip_base_fee()
    ChainGrpcTxfeesApi->>Blockchain: Query EIP base fee
    Blockchain-->>ChainGrpcTxfeesApi: EIP base fee response
    ChainGrpcTxfeesApi-->>AsyncClient: Return base fee
    AsyncClient-->>UserScript: Return gas price

    UserScript->>MsgBroadcasterWithPk: broadcast_tx(gas_price)
    MsgBroadcasterWithPk->>TransactionFeeCalculator: calculate_fee(gas_price)
    TransactionFeeCalculator-->>MsgBroadcasterWithPk: Fee info
    MsgBroadcasterWithPk->>Blockchain: Broadcast transaction
    Blockchain-->>MsgBroadcasterWithPk: Tx result
    MsgBroadcasterWithPk-->>UserScript: Tx result (formatted JSON)
Loading

Poem

🐇
Version hop, a leap so bright,
Gas fees now fetched in the night.
Heuristics guide each bounding stride,
Protobufs fresh, with fields inside.
Scripts and tests all dance anew,
TXFees queries—rabbits' view!
Hooray for code that hops along,
In fields of Python, swift and strong!

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the chain client examples to work with the new chain upgrade v1.15 by replacing static gas price constants with dynamic retrieval and adjusting module tags for proto generation. Key changes include:

  • Switching from the static GAS_PRICE constant to dynamically retrieved and adjusted gas prices across various transaction examples.
  • Updating proto tag versions in buf.gen.yaml to reflect compatibility with Injective core v1.15.
  • Minor documentation updates in README.md and CHANGELOG.md.

Reviewed Changes

Copilot reviewed 113 out of 114 changed files in this pull request and generated no comments.

Show a summary per file
File Description
examples/chain_client/exchange/11_MsgCreateDerivativeMarketOrder.py Dynamic gas price retrieval for market orders
examples/chain_client/exchange/10_MsgCreateDerivativeLimitOrder.py Dynamic gas price retrieval for limit orders
examples/chain_client/distribution/4_FundCommunityPool.py Dynamic gas price retrieval and JSON formatting of TX responses
examples/chain_client/distribution/3_WithdrawValidatorCommission.py Updated dynamic gas price usage and improved result output
examples/chain_client/distribution/2_WithdrawDelegatorReward.py Updated dynamic gas price usage and improved result output
examples/chain_client/distribution/1_SetWithdrawAddress.py Updated dynamic gas price usage and improved result output
examples/chain_client/bank/1_MsgSend.py Dynamic gas price retrieval for bank transfers
examples/chain_client/authz/3_MsgRevoke.py Dynamic gas price retrieval for revocation messages
examples/chain_client/authz/2_MsgExec.py Dynamic gas price retrieval for execution messages
examples/chain_client/authz/1_MsgGrant.py Dynamic gas price retrieval for grant messages
examples/chain_client/auction/1_MsgBid.py Dynamic gas price retrieval for bid messages
examples/chain_client/6_MessageBroadcasterWithGranteeAccountWithoutSimulation.py Dynamic gas price retrieval and update for grantee account TXs
examples/chain_client/5_MessageBroadcasterWithoutSimulation.py Dynamic gas price retrieval and update for non-simulated TXs
examples/chain_client/4_MessageBroadcasterWithGranteeAccount.py Dynamic gas price retrieval and update for grantee account TXs
examples/chain_client/3_MessageBroadcaster.py Dynamic gas price retrieval and update for simulated TXs
examples/chain_client/1_LocalOrderHash.py Dynamic gas price retrieval in multiple TX building steps
buf.gen.yaml Updated proto tag versions to support the chain upgrade
README.md Command update for running examples
CHANGELOG.md Documented new version and improvements
Files not reviewed (1)
  • Makefile: Language not supported

@socket-security
Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedckzg@​2.0.1 ⏵ 2.1.110010089100100
Updatedbitarray@​3.0.0 ⏵ 3.3.193100100100100
Addedcoincurve@​21.0.0100100100100100
Addedcoincurve@​18.0.09910010010099
Addedcoincurve@​20.0.0100100100100100
Updatedaiohappyeyeballs@​2.4.4 ⏵ 2.6.1100 +7100100100100
Updatedattrs@​24.3.0 ⏵ 25.3.0100 +1100100100100

View full report

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🔭 Outside diff range comments (1)
tests/client/indexer/grpc/test_indexer_grpc_account_api.py (1)

334-371: ⚠️ Potential issue

Duplicate test method with USD value field

There appears to be a duplicate test method named test_fetch_rewards. The second implementation includes the new usd_value field in the rewards Coin message. Consider renaming the second test method to test_fetch_rewards_with_usd_value to clarify its purpose.

-    @pytest.mark.asyncio
-    async def test_fetch_rewards(
+    @pytest.mark.asyncio
+    async def test_fetch_rewards_with_usd_value(
🧰 Tools
🪛 Ruff (0.8.2)

334-334: Redefinition of unused test_fetch_rewards from line 296

(F811)

🧹 Nitpick comments (15)
CHANGELOG.md (1)

5-12: Version 1.10.0 changelog entry accurately captures major SDK updates

The changelog entry properly documents the key changes in this release:

  1. Support for TXFees module queries
  2. Updated gas limit estimator implementation
  3. Updated protobuf compatibility with Injective core v1.15 and Indexer v1.15.6

These changes align with the PR objectives to update the SDK for chain upgrade v1.15.

There's a minor word repetition in line 7. Consider this change:

-### Added
-- Added support for the queries in the new TXFees module
+### Added
+- Support for queries in the new TXFees module
🧰 Tools
🪛 LanguageTool

[duplication] ~6-~6: Possible typo: you repeated a word.
Context: ...his file. ## [1.10.0] - 2025-04-16 ### Added - Added support for the queries in the new TXFe...

(ENGLISH_WORD_REPEAT_RULE)

examples/chain_client/exchange/12_MsgCancelDerivativeOrder.py (1)

62-64: Dynamic gas price retrieval is a good improvement

The code now fetches the current chain gas price dynamically instead of using a static constant, and adds a 10% buffer to accommodate potential gas price changes between retrieval and broadcast time. This approach is more resilient to network conditions and fluctuating gas prices.

This pattern of dynamic gas price retrieval with a buffer enhances transaction reliability across varying network conditions and is well-aligned with best practices for blockchain transaction management.

examples/chain_client/exchange/1_MsgDeposit.py (1)

58-60: Dynamic gas price retrieval is a good improvement

The code now fetches the current chain gas price dynamically instead of using a static constant, and adds a 10% buffer to accommodate potential gas price changes between retrieval and broadcast time. This approach is more resilient to network conditions and fluctuating gas prices.

This pattern of dynamic gas price retrieval with a buffer enhances transaction reliability across varying network conditions and is well-aligned with best practices for blockchain transaction management.

examples/chain_client/exchange/19_MsgLiquidatePosition.py (1)

85-88: Implemented dynamic gas price fetching with safety buffer

The code now asynchronously fetches the current chain gas price and applies a 10% buffer to account for potential price changes between retrieval and broadcast. This is a significant improvement over static gas prices.

Consider extracting the adjustment factor (1.1) into a named constant for better maintainability:

- gas_price = int(gas_price * 1.1)
+ GAS_PRICE_ADJUSTMENT_FACTOR = 1.1
+ gas_price = int(gas_price * GAS_PRICE_ADJUSTMENT_FACTOR)
examples/chain_client/insurance/2_MsgUnderwrite.py (1)

60-63: Implemented dynamic gas price fetching with safety buffer

The code now asynchronously fetches the current chain gas price and applies a 10% buffer to account for potential price changes between retrieval and broadcast. This is a significant improvement over static gas prices.

Consider extracting the adjustment factor (1.1) into a named constant for better maintainability:

- gas_price = int(gas_price * 1.1)
+ GAS_PRICE_ADJUSTMENT_FACTOR = 1.1
+ gas_price = int(gas_price * GAS_PRICE_ADJUSTMENT_FACTOR)
examples/chain_client/exchange/3_MsgInstantSpotMarketLaunch.py (1)

60-65: Consider extracting repeated gas price logic to a helper function.

The gas price fetching and adjustment logic is duplicated before and after the transaction broadcast. Consider extracting this into a helper function for better maintainability.

+async def get_adjusted_gas_price(client):
+    gas_price = await client.current_chain_gas_price()
+    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
+    return int(gas_price * 1.1)

 async def main() -> None:
     # ... existing code ...
-    gas_price = await client.current_chain_gas_price()
-    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
-    gas_price = int(gas_price * 1.1)
+    gas_price = await get_adjusted_gas_price(client)
     
     # ... existing code ...
     
     print(json.dumps(result, indent=2))
     
-    gas_price = await client.current_chain_gas_price()
-    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
-    gas_price = int(gas_price * 1.1)
+    gas_price = await get_adjusted_gas_price(client)
     message_broadcaster.update_gas_price(gas_price=gas_price)
examples/chain_client/distribution/2_WithdrawDelegatorReward.py (1)

49-54: Consider extracting repeated gas price logic to a helper function.

The gas price fetching and adjustment logic is duplicated before and after the transaction broadcast. Consider extracting this into a helper function for better maintainability.

+async def get_adjusted_gas_price(client):
+    gas_price = await client.current_chain_gas_price()
+    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
+    return int(gas_price * 1.1)

 async def main() -> None:
     # ... existing code ...
-    gas_price = await client.current_chain_gas_price()
-    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
-    gas_price = int(gas_price * 1.1)
+    gas_price = await get_adjusted_gas_price(client)
     
     # ... existing code ...
     
     print(json.dumps(result, indent=2))
     
-    gas_price = await client.current_chain_gas_price()
-    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
-    gas_price = int(gas_price * 1.1)
+    gas_price = await get_adjusted_gas_price(client)
     message_broadcaster.update_gas_price(gas_price=gas_price)
examples/chain_client/permissions/2_MsgUpdateNamespace.py (1)

88-93: Consider extracting repeated gas price logic to a helper function.

The gas price fetching and adjustment logic is duplicated before and after the transaction broadcast. Consider extracting this into a helper function for better maintainability.

+async def get_adjusted_gas_price(client):
+    gas_price = await client.current_chain_gas_price()
+    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
+    return int(gas_price * 1.1)

 async def main() -> None:
     # ... existing code ...
-    gas_price = await client.current_chain_gas_price()
-    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
-    gas_price = int(gas_price * 1.1)
+    gas_price = await get_adjusted_gas_price(client)
     
     # ... existing code ...
     
     print(json.dumps(result, indent=2))
     
-    gas_price = await client.current_chain_gas_price()
-    # adjust gas price to make it valid even if it changes between the time it is requested and the TX is broadcasted
-    gas_price = int(gas_price * 1.1)
+    gas_price = await get_adjusted_gas_price(client)
     message_broadcaster.update_gas_price(gas_price=gas_price)
pyinjective/proto/injective/txfees/v1beta1/tx_pb2.py (1)

15-19: Remove unused imports flagged by static analysis.
These imports are not referenced in the code. Please remove them to keep the file clean.

Apply this diff to remove the unused imports:

-from pyinjective.proto.gogoproto import gogo_pb2 as gogoproto_dot_gogo__pb2
-from pyinjective.proto.cosmos.msg.v1 import msg_pb2 as cosmos_dot_msg_dot_v1_dot_msg__pb2
-from pyinjective.proto.cosmos_proto import cosmos_pb2 as cosmos__proto_dot_cosmos__pb2
-from pyinjective.proto.injective.txfees.v1beta1 import txfees_pb2 as injective_dot_txfees_dot_v1beta1_dot_txfees__pb2
-from pyinjective.proto.amino import amino_pb2 as amino_dot_amino__pb2
🧰 Tools
🪛 Ruff (0.8.2)

15-15: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


16-16: pyinjective.proto.cosmos.msg.v1.msg_pb2 imported but unused

Remove unused import: pyinjective.proto.cosmos.msg.v1.msg_pb2

(F401)


17-17: pyinjective.proto.cosmos_proto.cosmos_pb2 imported but unused

Remove unused import: pyinjective.proto.cosmos_proto.cosmos_pb2

(F401)


18-18: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2 imported but unused

Remove unused import: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2

(F401)


19-19: pyinjective.proto.amino.amino_pb2 imported but unused

Remove unused import: pyinjective.proto.amino.amino_pb2

(F401)

tests/core/test_gas_heuristics_gas_limit_estimator.py (2)

152-153: Variable naming inconsistency

There's a naming inconsistency - using spot_market_id variable for what appears to be a derivative market in the test setup.

-        spot_market_id = "0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe"
+        derivative_market_id = "0x0611780ba69656949525013d947713300f56c37b6175e02f26bffa495c3208fe"

154-170: Inconsistent test setup pattern

This test instantiates a new Composer with "testnet" network instead of using the basic_composer fixture like other tests. Consider standardizing the approach across tests.

-        composer = Composer(network="testnet")
+        composer = basic_composer
pyinjective/proto/exchange/injective_chart_rpc_pb2_grpc.py (1)

68-96: Missing implementation in Servicer methods.

All newly added methods are placeholders raising NotImplementedError. This is acceptable for a planned future implementation. Just ensure these placeholders are tracked on your roadmap, so they don't become forgotten.

pyinjective/async_client.py (2)

188-191: Integration of txfees_api instance.

Creating txfees_api using the chain channel is intuitive. A brief docstring around its usage might help future contributors understand fee retrieval logic.


2053-2058: Optional usd parameter for portfolio queries.

Adding usd broadens utility. Just ensure it’s clearly documented or tested so that users of this method know what to expect.

pyinjective/core/gas_heuristics_gas_limit_estimator.py (1)

35-64: Base class design.

GasHeuristicsGasLimitEstimator neatly extends ABC and integrates with GasLimitEstimator for fallback. The _parsed_message approach is straightforward. Including docstrings for the abstract methods would further aid clarity.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 17293cc and 5c1b498.

⛔ Files ignored due to path filters (1)
  • poetry.lock is excluded by !**/*.lock
📒 Files selected for processing (113)
  • CHANGELOG.md (1 hunks)
  • Makefile (1 hunks)
  • README.md (1 hunks)
  • buf.gen.yaml (1 hunks)
  • examples/chain_client/1_LocalOrderHash.py (4 hunks)
  • examples/chain_client/3_MessageBroadcaster.py (3 hunks)
  • examples/chain_client/4_MessageBroadcasterWithGranteeAccount.py (3 hunks)
  • examples/chain_client/5_MessageBroadcasterWithoutSimulation.py (3 hunks)
  • examples/chain_client/6_MessageBroadcasterWithGranteeAccountWithoutSimulation.py (3 hunks)
  • examples/chain_client/auction/1_MsgBid.py (2 hunks)
  • examples/chain_client/authz/1_MsgGrant.py (2 hunks)
  • examples/chain_client/authz/2_MsgExec.py (2 hunks)
  • examples/chain_client/authz/3_MsgRevoke.py (2 hunks)
  • examples/chain_client/bank/1_MsgSend.py (2 hunks)
  • examples/chain_client/distribution/1_SetWithdrawAddress.py (3 hunks)
  • examples/chain_client/distribution/2_WithdrawDelegatorReward.py (3 hunks)
  • examples/chain_client/distribution/3_WithdrawValidatorCommission.py (3 hunks)
  • examples/chain_client/distribution/4_FundCommunityPool.py (3 hunks)
  • examples/chain_client/exchange/10_MsgCreateDerivativeLimitOrder.py (2 hunks)
  • examples/chain_client/exchange/11_MsgCreateDerivativeMarketOrder.py (2 hunks)
  • examples/chain_client/exchange/12_MsgCancelDerivativeOrder.py (2 hunks)
  • examples/chain_client/exchange/13_MsgInstantBinaryOptionsMarketLaunch.py (3 hunks)
  • examples/chain_client/exchange/14_MsgCreateBinaryOptionsLimitOrder.py (2 hunks)
  • examples/chain_client/exchange/15_MsgCreateBinaryOptionsMarketOrder.py (2 hunks)
  • examples/chain_client/exchange/16_MsgCancelBinaryOptionsOrder.py (2 hunks)
  • examples/chain_client/exchange/17_MsgSubaccountTransfer.py (2 hunks)
  • examples/chain_client/exchange/18_MsgExternalTransfer.py (2 hunks)
  • examples/chain_client/exchange/19_MsgLiquidatePosition.py (2 hunks)
  • examples/chain_client/exchange/1_MsgDeposit.py (2 hunks)
  • examples/chain_client/exchange/20_MsgIncreasePositionMargin.py (2 hunks)
  • examples/chain_client/exchange/21_MsgRewardsOptOut.py (2 hunks)
  • examples/chain_client/exchange/22_MsgAdminUpdateBinaryOptionsMarket.py (2 hunks)
  • examples/chain_client/exchange/23_MsgDecreasePositionMargin.py (3 hunks)
  • examples/chain_client/exchange/24_MsgUpdateSpotMarket.py (3 hunks)
  • examples/chain_client/exchange/25_MsgUpdateDerivativeMarket.py (3 hunks)
  • examples/chain_client/exchange/26_MsgAuthorizeStakeGrants.py (3 hunks)
  • examples/chain_client/exchange/27_MsgActivateStakeGrant.py (3 hunks)
  • examples/chain_client/exchange/2_MsgWithdraw.py (2 hunks)
  • examples/chain_client/exchange/3_MsgInstantSpotMarketLaunch.py (3 hunks)
  • examples/chain_client/exchange/4_MsgInstantPerpetualMarketLaunch.py (3 hunks)
  • examples/chain_client/exchange/5_MsgInstantExpiryFuturesMarketLaunch.py (3 hunks)
  • examples/chain_client/exchange/6_MsgCreateSpotLimitOrder.py (2 hunks)
  • examples/chain_client/exchange/7_MsgCreateSpotMarketOrder.py (2 hunks)
  • examples/chain_client/exchange/8_MsgCancelSpotOrder.py (2 hunks)
  • examples/chain_client/exchange/9_MsgBatchUpdateOrders.py (2 hunks)
  • examples/chain_client/ibc/transfer/1_MsgTransfer.py (3 hunks)
  • examples/chain_client/insurance/1_MsgCreateInsuranceFund.py (2 hunks)
  • examples/chain_client/insurance/2_MsgUnderwrite.py (2 hunks)
  • examples/chain_client/insurance/3_MsgRequestRedemption.py (2 hunks)
  • examples/chain_client/oracle/1_MsgRelayPriceFeedPrice.py (2 hunks)
  • examples/chain_client/oracle/2_MsgRelayProviderPrices.py (2 hunks)
  • examples/chain_client/peggy/1_MsgSendToEth.py (2 hunks)
  • examples/chain_client/permissions/1_MsgCreateNamespace.py (3 hunks)
  • examples/chain_client/permissions/2_MsgUpdateNamespace.py (3 hunks)
  • examples/chain_client/permissions/3_MsgUpdateActorRoles.py (3 hunks)
  • examples/chain_client/permissions/4_MsgClaimVoucher.py (3 hunks)
  • examples/chain_client/staking/1_MsgDelegate.py (2 hunks)
  • examples/chain_client/tokenfactory/1_CreateDenom.py (3 hunks)
  • examples/chain_client/tokenfactory/2_MsgMint.py (3 hunks)
  • examples/chain_client/tokenfactory/3_MsgBurn.py (3 hunks)
  • examples/chain_client/tokenfactory/4_MsgChangeAdmin.py (3 hunks)
  • examples/chain_client/tokenfactory/5_MsgSetDenomMetadata.py (3 hunks)
  • examples/chain_client/txfees/query/1_GetEipBaseFee.py (1 hunks)
  • examples/chain_client/wasm/1_MsgExecuteContract.py (2 hunks)
  • examples/chain_client/wasmx/1_MsgExecuteContractCompat.py (2 hunks)
  • examples/exchange_client/derivative_exchange_rpc/13_SubaccountOrdersList.py (1 hunks)
  • examples/exchange_client/portfolio_rpc/1_AccountPortfolio.py (1 hunks)
  • pyinjective/async_client.py (9 hunks)
  • pyinjective/client/chain/grpc/chain_grpc_token_factory_api.py (0 hunks)
  • pyinjective/client/chain/grpc/chain_grpc_txfees_api.py (1 hunks)
  • pyinjective/client/indexer/grpc/indexer_grpc_portfolio_api.py (2 hunks)
  • pyinjective/core/broadcaster.py (11 hunks)
  • pyinjective/core/gas_heuristics_gas_limit_estimator.py (1 hunks)
  • pyinjective/ofac.json (1 hunks)
  • pyinjective/proto/exchange/injective_accounts_rpc_pb2.py (2 hunks)
  • pyinjective/proto/exchange/injective_auction_rpc_pb2.py (2 hunks)
  • pyinjective/proto/exchange/injective_campaign_rpc_pb2.py (2 hunks)
  • pyinjective/proto/exchange/injective_chart_rpc_pb2.py (2 hunks)
  • pyinjective/proto/exchange/injective_chart_rpc_pb2_grpc.py (4 hunks)
  • pyinjective/proto/exchange/injective_explorer_rpc_pb2.py (2 hunks)
  • pyinjective/proto/exchange/injective_portfolio_rpc_pb2.py (2 hunks)
  • pyinjective/proto/exchange/injective_referral_rpc_pb2.py (1 hunks)
  • pyinjective/proto/exchange/injective_referral_rpc_pb2_grpc.py (1 hunks)
  • pyinjective/proto/exchange/injective_spot_exchange_rpc_pb2.py (2 hunks)
  • pyinjective/proto/exchange/injective_trading_rpc_pb2.py (2 hunks)
  • pyinjective/proto/google/rpc/error_details_pb2.py (3 hunks)
  • pyinjective/proto/ibc/core/connection/v1/tx_pb2.py (3 hunks)
  • pyinjective/proto/injective/exchange/v1beta1/exchange_pb2.py (2 hunks)
  • pyinjective/proto/injective/exchange/v1beta1/query_pb2.py (3 hunks)
  • pyinjective/proto/injective/permissions/v1beta1/query_pb2_grpc.py (3 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/genesis_pb2.py (1 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/genesis_pb2_grpc.py (1 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/query_pb2.py (1 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/query_pb2_grpc.py (1 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/tx_pb2.py (1 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/tx_pb2_grpc.py (1 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/txfees_pb2.py (1 hunks)
  • pyinjective/proto/injective/txfees/v1beta1/txfees_pb2_grpc.py (1 hunks)
  • pyinjective/proto/osmosis/txfees/v1beta1/query_pb2.py (1 hunks)
  • pyinjective/proto/osmosis/txfees/v1beta1/query_pb2_grpc.py (1 hunks)
  • pyproject.toml (1 hunks)
  • tests/client/chain/grpc/configurable_txfees_query_servicer.py (1 hunks)
  • tests/client/chain/grpc/test_chain_grpc_exchange_api.py (4 hunks)
  • tests/client/chain/grpc/test_chain_grpc_txfees_api.py (1 hunks)
  • tests/client/indexer/grpc/test_indexer_grpc_account_api.py (6 hunks)
  • tests/client/indexer/grpc/test_indexer_grpc_auction_api.py (4 hunks)
  • tests/client/indexer/grpc/test_indexer_grpc_explorer_api.py (9 hunks)
  • tests/client/indexer/grpc/test_indexer_grpc_portfolio_api.py (7 hunks)
  • tests/client/indexer/grpc/test_indexer_grpc_spot_api.py (2 hunks)
  • tests/client/indexer/stream_grpc/test_indexer_grpc_account_stream.py (2 hunks)
  • tests/client/indexer/stream_grpc/test_indexer_grpc_explorer_stream.py (2 hunks)
  • tests/core/test_gas_heuristics_gas_limit_estimator.py (1 hunks)
  • tests/core/test_message_based_transaction_fee_calculator.py (7 hunks)
💤 Files with no reviewable changes (1)
  • pyinjective/client/chain/grpc/chain_grpc_token_factory_api.py
🧰 Additional context used
🧬 Code Graph Analysis (47)
examples/chain_client/exchange/17_MsgSubaccountTransfer.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/oracle/1_MsgRelayPriceFeedPrice.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/insurance/1_MsgCreateInsuranceFund.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/12_MsgCancelDerivativeOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/11_MsgCreateDerivativeMarketOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/14_MsgCreateBinaryOptionsLimitOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/exchange_client/portfolio_rpc/1_AccountPortfolio.py (2)
pyinjective/client/indexer/grpc/indexer_grpc_portfolio_api.py (1)
  • fetch_account_portfolio_balances (24-30)
pyinjective/async_client.py (1)
  • fetch_account_portfolio_balances (2053-2058)
examples/chain_client/insurance/3_MsgRequestRedemption.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/authz/3_MsgRevoke.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/6_MsgCreateSpotLimitOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/oracle/2_MsgRelayProviderPrices.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/15_MsgCreateBinaryOptionsMarketOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/bank/1_MsgSend.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/9_MsgBatchUpdateOrders.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
pyinjective/client/indexer/grpc/indexer_grpc_portfolio_api.py (1)
pyinjective/async_client.py (1)
  • fetch_account_portfolio_balances (2053-2058)
examples/chain_client/exchange/8_MsgCancelSpotOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/16_MsgCancelBinaryOptionsOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/1_LocalOrderHash.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/distribution/1_SetWithdrawAddress.py (2)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
pyinjective/core/broadcaster.py (2)
  • MsgBroadcasterWithPk (62-411)
  • new_without_simulation (117-144)
examples/chain_client/authz/2_MsgExec.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/2_MsgWithdraw.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/wasmx/1_MsgExecuteContractCompat.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/authz/1_MsgGrant.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/exchange_client/derivative_exchange_rpc/13_SubaccountOrdersList.py (1)
pyinjective/async_client.py (1)
  • fetch_derivative_subaccount_orders_list (1994-2002)
examples/chain_client/exchange/21_MsgRewardsOptOut.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/wasm/1_MsgExecuteContract.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/insurance/2_MsgUnderwrite.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/1_MsgDeposit.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/auction/1_MsgBid.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/19_MsgLiquidatePosition.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/18_MsgExternalTransfer.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/staking/1_MsgDelegate.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/10_MsgCreateDerivativeLimitOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/distribution/3_WithdrawValidatorCommission.py (2)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
pyinjective/core/broadcaster.py (2)
  • MsgBroadcasterWithPk (62-411)
  • new_without_simulation (117-144)
examples/chain_client/exchange/20_MsgIncreasePositionMargin.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/tokenfactory/4_MsgChangeAdmin.py (2)
pyinjective/async_client.py (3)
  • AsyncClient (83-2585)
  • composer (2337-2344)
  • current_chain_gas_price (2346-2358)
pyinjective/core/broadcaster.py (2)
  • MsgBroadcasterWithPk (62-411)
  • new_without_simulation (117-144)
examples/chain_client/exchange/22_MsgAdminUpdateBinaryOptionsMarket.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/exchange/7_MsgCreateSpotMarketOrder.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/peggy/1_MsgSendToEth.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/ibc/transfer/1_MsgTransfer.py (1)
pyinjective/async_client.py (1)
  • current_chain_gas_price (2346-2358)
examples/chain_client/3_MessageBroadcaster.py (2)
pyinjective/async_client.py (3)
  • AsyncClient (83-2585)
  • composer (2337-2344)
  • current_chain_gas_price (2346-2358)
pyinjective/core/broadcaster.py (2)
  • MsgBroadcasterWithPk (62-411)
  • new_using_simulation (82-114)
examples/chain_client/permissions/1_MsgCreateNamespace.py (2)
pyinjective/async_client.py (3)
  • AsyncClient (83-2585)
  • composer (2337-2344)
  • current_chain_gas_price (2346-2358)
pyinjective/core/broadcaster.py (2)
  • MsgBroadcasterWithPk (62-411)
  • new_using_simulation (82-114)
tests/core/test_message_based_transaction_fee_calculator.py (1)
pyinjective/core/broadcaster.py (1)
  • MessageBasedTransactionFeeCalculator (515-581)
tests/client/chain/grpc/test_chain_grpc_txfees_api.py (3)
pyinjective/client/chain/grpc/chain_grpc_txfees_api.py (1)
  • ChainGrpcTxfeesApi (10-28)
pyinjective/core/network.py (2)
  • DisabledCookieAssistant (98-103)
  • devnet (155-170)
tests/client/chain/grpc/configurable_txfees_query_servicer.py (1)
  • ConfigurableTxfeesQueryServicer (6-16)
pyinjective/proto/injective/permissions/v1beta1/query_pb2_grpc.py (1)
tests/client/chain/grpc/configurable_permissions_query_servicer.py (5)
  • ActorsByRole (43-44)
  • RoleManagers (46-47)
  • RoleManager (49-50)
  • PolicyStatuses (52-55)
  • PolicyManagerCapabilities (57-60)
tests/client/chain/grpc/test_chain_grpc_exchange_api.py (2)
tests/client/chain/grpc/configurable_exchange_query_servicer.py (1)
  • MarketBalance (349-350)
pyinjective/proto/injective/exchange/v1beta1/query_pb2_grpc.py (2)
  • MarketBalance (790-795)
  • MarketBalance (2838-2862)
examples/chain_client/exchange/25_MsgUpdateDerivativeMarket.py (2)
pyinjective/async_client.py (2)
  • current_chain_gas_price (2346-2358)
  • composer (2337-2344)
pyinjective/core/broadcaster.py (2)
  • MsgBroadcasterWithPk (62-411)
  • new_using_simulation (82-114)
🪛 Ruff (0.8.2)
pyinjective/proto/injective/txfees/v1beta1/txfees_pb2_grpc.py

3-3: grpc imported but unused

Remove unused import: grpc

(F401)

pyinjective/proto/injective/txfees/v1beta1/genesis_pb2_grpc.py

3-3: grpc imported but unused

Remove unused import: grpc

(F401)

tests/core/test_gas_heuristics_gas_limit_estimator.py

44-44: Redefinition of unused inj_usdt_spot_market from line 37

(F811)


44-44: Redefinition of unused btc_usdt_perp_market from line 34

(F811)


44-44: Redefinition of unused first_match_bet_market from line 35

(F811)


246-246: Redefinition of unused usdt_token from line 39

(F811)


467-467: Redefinition of unused inj_usdt_spot_market from line 37

(F811)


501-501: Redefinition of unused inj_usdt_spot_market from line 37

(F811)


520-520: Redefinition of unused inj_usdt_spot_market from line 37

(F811)


536-536: Redefinition of unused btc_usdt_perp_market from line 34

(F811)


572-572: Redefinition of unused btc_usdt_perp_market from line 34

(F811)


592-592: Redefinition of unused btc_usdt_perp_market from line 34

(F811)


608-608: Redefinition of unused first_match_bet_market from line 35

(F811)


644-644: Redefinition of unused first_match_bet_market from line 35

(F811)


664-664: Redefinition of unused first_match_bet_market from line 35

(F811)


742-742: Redefinition of unused btc_usdt_perp_market from line 34

(F811)


758-758: Redefinition of unused btc_usdt_perp_market from line 34

(F811)

pyinjective/proto/injective/txfees/v1beta1/txfees_pb2.py

15-15: pyinjective.proto.amino.amino_pb2 imported but unused

Remove unused import: pyinjective.proto.amino.amino_pb2

(F401)


16-16: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


17-17: pyinjective.proto.google.api.annotations_pb2 imported but unused

Remove unused import: pyinjective.proto.google.api.annotations_pb2

(F401)

pyinjective/proto/injective/txfees/v1beta1/tx_pb2.py

15-15: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


16-16: pyinjective.proto.cosmos.msg.v1.msg_pb2 imported but unused

Remove unused import: pyinjective.proto.cosmos.msg.v1.msg_pb2

(F401)


17-17: pyinjective.proto.cosmos_proto.cosmos_pb2 imported but unused

Remove unused import: pyinjective.proto.cosmos_proto.cosmos_pb2

(F401)


18-18: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2 imported but unused

Remove unused import: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2

(F401)


19-19: pyinjective.proto.amino.amino_pb2 imported but unused

Remove unused import: pyinjective.proto.amino.amino_pb2

(F401)

pyinjective/proto/injective/txfees/v1beta1/genesis_pb2.py

15-15: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2 imported but unused

Remove unused import: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2

(F401)


16-16: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)

pyinjective/proto/injective/txfees/v1beta1/query_pb2.py

15-15: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


16-16: pyinjective.proto.google.api.annotations_pb2 imported but unused

Remove unused import: pyinjective.proto.google.api.annotations_pb2

(F401)


17-17: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2 imported but unused

Remove unused import: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2

(F401)

pyinjective/proto/osmosis/txfees/v1beta1/query_pb2.py

15-15: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


16-16: pyinjective.proto.google.api.annotations_pb2 imported but unused

Remove unused import: pyinjective.proto.google.api.annotations_pb2

(F401)


17-17: google.protobuf.duration_pb2 imported but unused

Remove unused import: google.protobuf.duration_pb2

(F401)

🪛 LanguageTool
CHANGELOG.md

[duplication] ~6-~6: Possible typo: you repeated a word.
Context: ...his file. ## [1.10.0] - 2025-04-16 ### Added - Added support for the queries in the new TXFe...

(ENGLISH_WORD_REPEAT_RULE)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: run-tests (3.9, windows-latest)
🔇 Additional comments (319)
Makefile (1)

34-34: Version update for injective-indexer aligned with v1.15 chain upgrade

The version change from v1.14.1-RC.6 to v1.15.6 properly synchronizes the SDK with the Injective blockchain v1.15 upgrade. This ensures the protobuf definitions used for code generation match those of the target chain.

pyproject.toml (1)

3-3: Version bump to 1.10.0 for chain v1.15 support

The version increment from 1.9.1 to 1.10.0 follows semantic versioning appropriately for this feature release that introduces TXFees module support and dynamic gas fee management. The version number aligns with the changes described in the PR objectives and changelog.

examples/exchange_client/portfolio_rpc/1_AccountPortfolio.py (1)

12-12: Added explicit USD parameter to portfolio balance query

The addition of the usd=False parameter correctly utilizes the newly supported feature in the fetch_account_portfolio_balances method. This ensures consistent behavior by explicitly requesting balances in native tokens rather than relying on default values that could change in future updates.

examples/exchange_client/derivative_exchange_rpc/13_SubaccountOrdersList.py (1)

17-17: Updated method name to clarify derivative-specific functionality

The method call has been renamed from fetch_subaccount_orders_list to fetch_derivative_subaccount_orders_list, which improves API clarity by explicitly indicating that this method is for derivative markets. This change is part of the broader client API enhancements in this release.

examples/chain_client/authz/2_MsgExec.py (2)

10-10: Update import statement to reflect dynamic gas price approach

The import statement has been updated to remove the static GAS_PRICE constant and only import the buffer amount. This change aligns with the move to dynamic gas price determination.


82-85:

Details

✅ Verification successful

Improved dynamic gas price determination with safety buffer

The code now dynamically fetches the current gas price from the chain instead of using a static constant. Adding a 10% buffer is a good practice to account for potential gas price fluctuations between retrieval and transaction broadcast.

Run the following script to verify similar changes across other example files:


🏁 Script executed:

#!/bin/bash
# Check if the dynamic gas price pattern is consistently implemented across example scripts

# Find all Python files in examples directory that might be using gas prices
echo "Files using current_chain_gas_price():"
rg -l "current_chain_gas_price\(\)" examples/

# Check if there are any remaining static GAS_PRICE imports that should be removed
echo "Files still using static GAS_PRICE constant:"
rg -l "from pyinjective.constant import GAS_PRICE" examples/

Length of output: 3751


Dynamic Gas Price Enhancement Verification Complete

The implementation in examples/chain_client/authz/2_MsgExec.py (Lines 82-85) now correctly fetches the current chain gas price and applies a 10% buffer to account for fluctuations. Verification across the examples directory confirms that:

  • All relevant Python scripts use the dynamic current_chain_gas_price() method.
  • There are no remaining static references to GAS_PRICE.

This cohesive approach improves transaction reliability.

tests/client/indexer/stream_grpc/test_indexer_grpc_account_stream.py (2)

26-27: USD value fields added to SubaccountDeposit

New USD-denominated balance fields have been added to the test's SubaccountDeposit protobuf message, reflecting the updates to the protobuf definitions in the SDK update.


64-65: Expected test results updated for USD value fields

The expected balance update dictionary has been correctly updated to include the new USD value fields, ensuring the test properly validates the new functionality.

examples/chain_client/exchange/10_MsgCreateDerivativeLimitOrder.py (2)

10-10: Update import statement to reflect dynamic gas price approach

The import statement has been updated to remove the static GAS_PRICE constant and only import the buffer amount. This change aligns with the move to dynamic gas price determination.


78-81: Improved dynamic gas price determination with safety buffer

Dynamic gas price fetching replaces the static constant, with a 10% safety margin added to account for potential gas price fluctuations between retrieval and transaction broadcast. This approach provides more accurate gas pricing based on current network conditions.

This implementation leverages the new TXFees module functionality added in this SDK update.

examples/chain_client/exchange/11_MsgCreateDerivativeMarketOrder.py (2)

10-10: Appropriate import change

Good change replacing GAS_PRICE with GAS_FEE_BUFFER_AMOUNT import, aligning with the move to dynamic gas pricing.


77-81: Well-implemented dynamic gas price fetching

Good implementation of dynamic gas price retrieval, which is a significant improvement over static gas prices. The 10% buffer is a smart addition to account for potential price fluctuations between retrieval and broadcast time.

This change aligns with the chain upgrade requirements and improves transaction reliability by adapting to network conditions.

examples/chain_client/exchange/17_MsgSubaccountTransfer.py (2)

9-9: Appropriate import change

Good change replacing GAS_PRICE with GAS_FEE_BUFFER_AMOUNT import, aligning with the move to dynamic gas pricing.


64-67: Well-implemented dynamic gas price fetching

The implementation of dynamic gas price retrieval with a 10% buffer is consistent with the pattern used across other example scripts, ensuring reliable transaction execution across varying network conditions.

examples/chain_client/insurance/3_MsgRequestRedemption.py (2)

8-8: Appropriate import change

Good change replacing GAS_PRICE with GAS_FEE_BUFFER_AMOUNT import, aligning with the move to dynamic gas pricing.


60-63: Well-implemented dynamic gas price fetching

The implementation of dynamic gas price retrieval with a 10% buffer follows the consistent pattern seen across the codebase, ensuring transactions are adaptable to changing network conditions.

examples/chain_client/oracle/1_MsgRelayPriceFeedPrice.py (2)

8-8: Appropriate import change

Good change replacing GAS_PRICE with GAS_FEE_BUFFER_AMOUNT import, aligning with the move to dynamic gas pricing.


60-63: Well-implemented dynamic gas price fetching

The implementation of dynamic gas price retrieval with a 10% buffer maintains the consistent pattern throughout the codebase, ensuring reliable transaction execution and adapting to network conditions.

examples/chain_client/exchange/2_MsgWithdraw.py (2)

8-8: Import updated to remove static GAS_PRICE constant

The import statement has been updated to only import GAS_FEE_BUFFER_AMOUNT and remove the static GAS_PRICE constant, which is now being dynamically fetched from the chain.


56-59: Dynamic gas price fetching implementation looks good

This change improves transaction fee accuracy by dynamically fetching the current gas price from the chain instead of using a static value. The 10% increase provides a buffer against gas price fluctuations between estimation and broadcast time.

#!/bin/bash
# Verify implementation of current_chain_gas_price across examples
rg -A 5 "current_chain_gas_price" examples/chain_client/
examples/chain_client/authz/1_MsgGrant.py (2)

8-8: Import updated to remove static GAS_PRICE constant

The import statement has been updated to only import GAS_FEE_BUFFER_AMOUNT and remove the static GAS_PRICE constant, which is now being dynamically fetched from the chain.


75-78: Dynamic gas price fetching implementation looks good

This change improves transaction fee accuracy by dynamically fetching the current gas price from the chain instead of using a static value. The 10% increase provides a buffer against gas price fluctuations between estimation and broadcast time.

examples/chain_client/exchange/14_MsgCreateBinaryOptionsLimitOrder.py (2)

10-10: Import updated to remove static GAS_PRICE constant

The import statement has been updated to only import GAS_FEE_BUFFER_AMOUNT and remove the static GAS_PRICE constant, which is now being dynamically fetched from the chain.


88-91: Dynamic gas price fetching implementation looks good

This change improves transaction fee accuracy by dynamically fetching the current gas price from the chain instead of using a static value. The 10% increase provides a buffer against gas price fluctuations between estimation and broadcast time.

examples/chain_client/exchange/21_MsgRewardsOptOut.py (2)

8-8: Import updated to remove static GAS_PRICE constant

The import statement has been updated to only import GAS_FEE_BUFFER_AMOUNT and remove the static GAS_PRICE constant, which is now being dynamically fetched from the chain.


55-58: Dynamic gas price fetching implementation looks good

This change improves transaction fee accuracy by dynamically fetching the current gas price from the chain instead of using a static value. The 10% increase provides a buffer against gas price fluctuations between estimation and broadcast time.

examples/chain_client/exchange/6_MsgCreateSpotLimitOrder.py (2)

10-10: Updated import to reflect dynamic gas price usage

The removal of the static GAS_PRICE import aligns with the shift to dynamic gas price fetching. This is a good improvement that makes the example more realistic.


75-79: Good implementation of dynamic gas price fetching

Replacing the static gas price with a dynamically fetched one is a significant improvement. The 10% adjustment provides a safety buffer to account for potential gas price fluctuations between retrieval and transaction broadcast time. This change aligns with best practices for blockchain transaction fee management.

examples/chain_client/exchange/7_MsgCreateSpotMarketOrder.py (2)

10-10: Updated import to reflect dynamic gas price usage

The removal of the static GAS_PRICE import is consistent with the shift to dynamic gas price fetching across all example files.


75-78: Well-implemented dynamic gas price fetching with descriptive comments

The dynamic gas price implementation with a 10% buffer is a good pattern for production code. The descriptive comment clearly explains the reasoning behind the adjustment. This consistent approach across example files helps users understand best practices for gas price management.

examples/chain_client/wasmx/1_MsgExecuteContractCompat.py (2)

9-9: Updated import for dynamic gas price pattern

The import statement has been properly updated to remove the static GAS_PRICE constant, maintaining consistency with other example files.


67-70: Consistent implementation of dynamic gas pricing

The implementation of dynamic gas pricing follows the same pattern used in other transaction examples, demonstrating a comprehensive update to the SDK's approach to gas fee management. The 10% buffer provides safety against gas price fluctuations during transaction processing.

examples/chain_client/peggy/1_MsgSendToEth.py (2)

9-9: Updated import for dynamic gas price approach

The import statement has been properly updated to remove the static GAS_PRICE constant, consistent with other example files.


69-72: Consistently implemented dynamic gas pricing with safety buffer

The dynamic gas price fetching with a 10% buffer follows the same reliable pattern used throughout the SDK examples. This change makes the example more resilient to network conditions and gas price fluctuations, particularly important for cross-chain operations where finality times may be longer.

examples/chain_client/auction/1_MsgBid.py (2)

8-8: Import statement updated correctly.

The import statement has been updated to remove GAS_PRICE constant and keep only GAS_FEE_BUFFER_AMOUNT, which aligns with the dynamic gas price implementation.


55-58: Well-implemented dynamic gas price retrieval.

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for potential gas price fluctuations between retrieval and broadcast time. This is a more robust approach than using a static gas price constant.

examples/chain_client/exchange/15_MsgCreateBinaryOptionsMarketOrder.py (2)

10-10: Import statement updated correctly.

The import statement has been updated to remove GAS_PRICE constant and keep only GAS_FEE_BUFFER_AMOUNT, which aligns with the dynamic gas price implementation.


76-79: Well-implemented dynamic gas price retrieval.

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for potential gas price fluctuations between retrieval and broadcast time. This is a more robust approach than using a static gas price constant.

examples/chain_client/exchange/18_MsgExternalTransfer.py (2)

9-9: Import statement updated correctly.

The import statement has been updated to remove GAS_PRICE constant and keep only GAS_FEE_BUFFER_AMOUNT, which aligns with the dynamic gas price implementation.


64-67: Well-implemented dynamic gas price retrieval.

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for potential gas price fluctuations between retrieval and broadcast time. This is a more robust approach than using a static gas price constant.

examples/chain_client/exchange/9_MsgBatchUpdateOrders.py (2)

10-10: Import statement updated correctly.

The import statement has been updated to remove GAS_PRICE constant and keep only GAS_FEE_BUFFER_AMOUNT, which aligns with the dynamic gas price implementation.


153-156: Well-implemented dynamic gas price retrieval.

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for potential gas price fluctuations between retrieval and broadcast time. This is a more robust approach than using a static gas price constant.

tests/client/indexer/grpc/test_indexer_grpc_spot_api.py (2)

704-713: USD value fields added to Coin messages

The test has been updated to include usd_value fields in the Coin protobuf messages for source_coin and dest_coin. This aligns with the updated protobuf schema for the v1.15 chain upgrade.


754-768: Updated expected results to include USD values

The expected output dictionary has been updated to include the "usdValue" key for coins in test assertions, ensuring that the test validates the new USD value field in the response.

examples/chain_client/exchange/20_MsgIncreasePositionMargin.py (2)

9-9: Good update to import GAS_FEE_BUFFER_AMOUNT instead of GAS_PRICE

The change correctly imports the buffer constant needed for gas limit calculation while removing the static GAS_PRICE constant, aligning with the dynamic gas price implementation.


66-69: Dynamic gas price implementation looks good

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for price fluctuations between request and broadcast time. This is a robust approach that replaces the previous static gas price constant.

examples/chain_client/exchange/8_MsgCancelSpotOrder.py (2)

8-8: Good update to import GAS_FEE_BUFFER_AMOUNT instead of GAS_PRICE

The change correctly imports the buffer constant needed for gas limit calculation while removing the static GAS_PRICE constant, aligning with the dynamic gas price implementation.


62-65: Dynamic gas price implementation looks good

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for price fluctuations between request and broadcast time. This is a robust approach that replaces the previous static gas price constant.

examples/chain_client/exchange/16_MsgCancelBinaryOptionsOrder.py (2)

8-8: Good update to import GAS_FEE_BUFFER_AMOUNT instead of GAS_PRICE

The change correctly imports the buffer constant needed for gas limit calculation while removing the static GAS_PRICE constant, aligning with the dynamic gas price implementation.


65-68: Dynamic gas price implementation looks good

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for price fluctuations between request and broadcast time. This is a robust approach that replaces the previous static gas price constant.

examples/chain_client/staking/1_MsgDelegate.py (2)

8-8: Good update to import GAS_FEE_BUFFER_AMOUNT instead of GAS_PRICE

The change correctly imports the buffer constant needed for gas limit calculation while removing the static GAS_PRICE constant, aligning with the dynamic gas price implementation.


60-63: Dynamic gas price implementation looks good

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for price fluctuations between request and broadcast time. This is a robust approach that replaces the previous static gas price constant.

examples/chain_client/exchange/22_MsgAdminUpdateBinaryOptionsMarket.py (2)

9-9: Import refactored to support dynamic gas pricing

The static GAS_PRICE import has been removed in favor of dynamic gas price retrieval from the chain.


74-77: Dynamic gas price implementation looks good

This implementation properly fetches the current chain gas price and adds a 10% buffer to account for price fluctuations between retrieval and transaction broadcast time. The approach is more resilient than using static gas prices.

examples/chain_client/wasm/1_MsgExecuteContract.py (2)

8-8: Import refactored to support dynamic gas pricing

The static GAS_PRICE import has been removed in favor of dynamic gas price retrieval from the chain.


70-73: Dynamic gas price implementation looks good

This implementation properly fetches the current chain gas price and adds a 10% buffer to account for price fluctuations between retrieval and transaction broadcast time. The approach is more resilient than using static gas prices.

pyinjective/proto/injective/txfees/v1beta1/txfees_pb2_grpc.py (1)

1-4:

Details

✅ Verification successful

Auto-generated gRPC file with unused import

This file was auto-generated by the gRPC Python protocol compiler plugin. The static analysis tool flagged the grpc import as unused, but this is expected in generated stubs that may be populated later with actual service implementations.


🏁 Script executed:

#!/bin/bash
# Check if this is a standard pattern in other generated gRPC files
grep -n "import grpc" pyinjective/proto/**/*_pb2_grpc.py | head -5

Length of output: 1539


Auto-generated gRPC file: Unused grpc import verified as standard

After verifying with similar auto-generated gRPC files across the repository (via grep) it’s clear that the import grpc line is consistently present in generated stubs—even when flagged as unused by static analysis. This is expected behavior, as these stubs may be extended later with actual service implementations. No changes are necessary.

🧰 Tools
🪛 Ruff (0.8.2)

3-3: grpc imported but unused

Remove unused import: grpc

(F401)

examples/chain_client/authz/3_MsgRevoke.py (2)

8-8: Import refactored to support dynamic gas pricing

The static GAS_PRICE import has been removed in favor of dynamic gas price retrieval from the chain.


60-63: Dynamic gas price implementation looks good

This implementation properly fetches the current chain gas price and adds a 10% buffer to account for price fluctuations between retrieval and transaction broadcast time. The approach is more resilient than using static gas prices.

README.md (2)

38-38: Path update correctly reflects the new example script location.

The path has been updated to point to the script in its new location, which matches the reorganized example structure.


42-42: Path update correctly reflects the new directory structure.

The path now includes the "bank" subdirectory, which aligns with the reorganization of example scripts into more specific modules.

examples/chain_client/txfees/query/1_GetEipBaseFee.py (3)

1-6: Clean imports and proper organization.

The imports are clean, well-organized, and include only the necessary dependencies for this example.


8-13: Well-structured async example for querying EIP base fee.

This function provides a clear, concise example of how to query the EIP base fee using the new txfees functionality. The JSON formatting enhances readability of the response.


15-16: Proper async execution boilerplate.

The script correctly uses the asyncio event loop to run the async main function.

examples/chain_client/bank/1_MsgSend.py (2)

8-8: Updated import to use buffer amount instead of static gas price.

The import has been updated to remove the static GAS_PRICE constant and keep only the GAS_FEE_BUFFER_AMOUNT, supporting the transition to dynamic gas pricing.


60-63: Implemented dynamic gas price with safety buffer.

The code now dynamically fetches the current chain gas price and adds a 10% buffer to account for potential price fluctuations between query time and transaction broadcast. This is an excellent improvement over using static gas prices.

pyinjective/proto/injective/txfees/v1beta1/genesis_pb2_grpc.py (1)

1-4:

Details

✅ Verification successful

Auto-generated gRPC stub file with unused import.

This is an auto-generated file by the gRPC Python protocol compiler. The grpc import is currently unused, but this is expected in auto-generated files as they follow a standard template and the import may be needed when services are added in the future.


🏁 Script executed:

#!/bin/bash
# Check other similar auto-generated grpc files to confirm this pattern is consistent
grep -n "import grpc" $(find pyinjective/proto -name "*pb2_grpc.py" | head -n 5)

Length of output: 695


Auto-Generated gRPC Stub File – No Changes Needed

The verification confirms that the import grpc statement is consistently present in other auto-generated gRPC stub files (e.g., pyinjective/proto/amino/amino_pb2_grpc.py, pyinjective/proto/capability/v1/capability_pb2_grpc.py, etc.), following the standard template. This unused import is expected for potential future service additions, so no changes are required.

🧰 Tools
🪛 Ruff (0.8.2)

3-3: grpc imported but unused

Remove unused import: grpc

(F401)

tests/client/indexer/stream_grpc/test_indexer_grpc_explorer_stream.py (2)

92-92: Addition of block_unix_timestamp field aligns with v1.15 protobuf changes

The new block_unix_timestamp field has been properly included in the test data to reflect the schema updates in the v1.15 protobuf definitions. This timestamp field enhances temporal tracking in streamed block data.


123-123: Expected response correctly includes the new timestamp field

The expected response dictionary correctly maps the new field as blockUnixTimestamp with proper string conversion, consistent with how other numeric fields are handled in the response.

tests/client/indexer/grpc/test_indexer_grpc_auction_api.py (4)

24-24: Addition of usd_value field aligns with v1.15 protobuf changes

The new usd_value field has been correctly added to the test data, reflecting the schema updates for the Coin message in the v1.15 protobuf definitions.


58-58: Expected response correctly includes the new USD value field

The expected response dictionary correctly maps the new field as usdValue, maintaining consistency with the API's response format.


79-79: Consistent implementation of usd_value in test data

The usd_value field is consistently implemented across test fixtures, matching the pattern in the previous test case.


103-103: Consistent handling of usdValue in expected outputs

The expected response for the fetch_auctions test correctly includes the usdValue field, ensuring consistency with the API's response format across different endpoints.

examples/chain_client/exchange/19_MsgLiquidatePosition.py (1)

10-10: Removed static GAS_PRICE import in favor of dynamic pricing

This change removes the dependency on a static gas price constant, which is now being replaced with dynamic gas price fetching. This is a good practice for blockchain transactions where gas prices can fluctuate.

examples/chain_client/insurance/2_MsgUnderwrite.py (1)

8-8: Removed static GAS_PRICE import in favor of dynamic pricing

This change removes the dependency on a static gas price constant, which is now being replaced with dynamic gas price fetching. This is a good practice for blockchain transactions where gas prices can fluctuate.

examples/chain_client/oracle/2_MsgRelayProviderPrices.py (2)

8-8: Updated import to remove GAS_PRICE constant

The code now uses dynamic gas price fetching instead of the static constant, making this change appropriate.


65-68: Improved gas price management with dynamic chain pricing

The code now fetches the current gas price from the chain and adds a 10% buffer to handle potential price fluctuations between retrieval and transaction broadcast time. This approach is more robust than using a static constant.

This change aligns with the broader SDK update for the v1.15 chain upgrade, which introduces dynamic gas fee management throughout the codebase.

pyinjective/proto/injective/permissions/v1beta1/query_pb2_grpc.py (8)

98-100: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.


122-124: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.


130-132: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.


138-140: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.


146-148: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.


154-156: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.


162-164: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.


177-179: Improved docstring formatting

The docstring has been reformatted from single-line to multi-line for better readability.

examples/chain_client/1_LocalOrderHash.py (4)

9-9: Updated import to remove GAS_PRICE constant

The code now uses dynamic gas price fetching instead of the static constant, making this change appropriate.


115-118: Improved gas price management with dynamic chain pricing

The code now fetches the current gas price from the chain and adds a 10% buffer to handle potential price fluctuations between retrieval and transaction broadcast time. This approach is more robust than using a static constant.


156-159: Consistent application of dynamic gas pricing

The same dynamic gas pricing approach is applied to the second transaction, maintaining consistency throughout the script.


252-255: Consistent application of dynamic gas pricing

The same dynamic gas pricing approach is applied to the third transaction, ensuring consistent gas price handling throughout the entire script.

examples/chain_client/insurance/1_MsgCreateInsuranceFund.py (2)

8-8: Updated import to remove GAS_PRICE constant

The code now uses dynamic gas price fetching instead of the static constant, making this change appropriate.


64-67: Improved gas price management with dynamic chain pricing

The code now fetches the current gas price from the chain and adds a 10% buffer to handle potential price fluctuations between retrieval and transaction broadcast time. This approach is more robust than using a static constant.

This change is part of the SDK's update to v1.15, which introduces the TXFees module integration and dynamic gas fee management throughout all transaction scripts.

pyinjective/proto/exchange/injective_auction_rpc_pb2.py (2)

17-17: Generated protobuf file updated correctly.

The serialized descriptor now includes the new usd_value field in the Coin message. This update aligns with the chain upgrade to v1.15 requirements.


31-48: Offset adjustments correctly implemented.

The serialized start and end offsets have been properly adjusted to accommodate the new field addition in the Coin message.

examples/chain_client/exchange/3_MsgInstantSpotMarketLaunch.py (3)

2-2: LGTM: JSON module added for improved output formatting.

The addition of the json module allows for better formatted transaction output.


25-29: Dynamic gas price handling implemented.

The code now fetches the current chain gas price dynamically and adds a 10% buffer to account for potential gas price fluctuations during transaction broadcasting.


30-36: Broadcaster constructor updated with dynamic parameters.

The MsgBroadcasterWithPk now receives the dynamic gas price along with client and composer objects directly.

examples/chain_client/distribution/2_WithdrawDelegatorReward.py (2)

2-2: LGTM: JSON module added for improved output formatting.

The addition of the json module allows for better formatted transaction output.


22-25: Dynamic gas price handling implemented.

The code now fetches the current chain gas price dynamically and adds a 10% buffer to account for potential gas price fluctuations during transaction broadcasting.

examples/chain_client/permissions/2_MsgUpdateNamespace.py (4)

2-2: LGTM: JSON module added for improved output formatting.

The addition of the json module allows for better formatted transaction output.


7-7: LGTM: Updated import for AsyncClient.

The import has been updated to use the AsyncClient, which is appropriate for the asynchronous approach being implemented.


19-25: Improved client initialization with async approach.

The code now properly initializes the AsyncClient and retrieves the composer asynchronously, then fetches and adjusts the current chain gas price for a more robust transaction process.


27-33: Broadcaster constructor updated with dynamic parameters.

The MsgBroadcasterWithPk now receives the dynamic gas price along with client and composer objects directly.

examples/chain_client/4_MessageBroadcasterWithGranteeAccount.py (6)

2-2: Good addition of JSON formatting for response output

Importing the json module for pretty-printing transaction responses improves readability and debugging.


25-25: Good implementation of async composer retrieval

The change to use await client.composer() properly aligns with the asynchronous pattern used throughout the client code.


33-36: Improved gas price handling with dynamic retrieval

The dynamic gas price fetching with a 10% buffer is a good approach to handle potential gas price fluctuations between request and transaction broadcast time. This change improves transaction reliability.


40-42: Updated broadcaster initialization with necessary parameters

Correctly passing the dynamic gas price, client, and composer to the broadcaster constructor.


65-65: Improved transaction response formatting

Using JSON pretty-printing enhances readability of transaction responses, making debugging and analysis easier.


67-70: Added gas price updating mechanism

This addition of updating the gas price after the transaction supports long-running applications where the gas price might change over time. Good practice for maintaining gas price accuracy in the broadcaster.

examples/chain_client/ibc/transfer/1_MsgTransfer.py (4)

2-2: Good addition of JSON formatting for response output

Importing the json module to pretty-print transaction responses improves readability and debugging.


26-28: Improved gas price handling with dynamic retrieval

The dynamic gas price fetching with a 10% buffer is a good approach to handle potential gas price fluctuations between request and transaction broadcast time. This change improves transaction reliability.


61-61: Improved transaction response formatting

Using JSON pretty-printing enhances readability of transaction responses, making debugging and analysis easier.


63-66: Added gas price updating mechanism

This addition of updating the gas price after the transaction supports long-running applications where the gas price might change over time. Good practice for maintaining gas price accuracy in the broadcaster.

pyinjective/proto/exchange/injective_explorer_rpc_pb2.py (1)

17-192: Valid updates to protobuf-generated code

These changes to the protobuf descriptor data and offset values align with the updated protobuf schema. This file is auto-generated and the updates properly reflect the evolution of the schema which now includes additional fields like block_unix_timestamp and usd_value in various messages.

Since this is auto-generated code from the protobuf compiler, no manual modifications should be made to this file.

examples/chain_client/distribution/4_FundCommunityPool.py (5)

2-2: Good addition of JSON formatting for response output

Importing the json module to pretty-print transaction responses improves readability and debugging.


22-25: Improved gas price handling with dynamic retrieval

The dynamic gas price fetching with a 10% buffer is a good approach to handle potential gas price fluctuations between request and transaction broadcast time. This change improves transaction reliability.


29-29: Updated broadcaster initialization with dynamic gas price

Correctly passing the dynamically fetched gas price to the broadcaster constructor improves reliability of transaction fee estimation.


49-49: Improved transaction response formatting

Using JSON pretty-printing enhances readability of transaction responses, making debugging and analysis easier.


51-54: Added gas price updating mechanism

This addition of updating the gas price after the transaction supports long-running applications where the gas price might change over time. Good practice for maintaining gas price accuracy in the broadcaster.

examples/chain_client/exchange/23_MsgDecreasePositionMargin.py (4)

2-2: Added JSON import for improved output formatting.

The addition of the json module allows for proper formatting of transaction response output, making it more readable and easier to analyze.


24-27: Improved gas price management with dynamic fetching.

Dynamic gas price fetching replaces static gas prices, enhancing transaction reliability. The 10% adjustment provides a safety buffer for price fluctuations between fetching and broadcasting.


32-34: Updated broadcaster initialization with dynamic gas price.

Passing the dynamically fetched gas price along with client and composer instances to the broadcaster improves transaction reliability and aligns with the new TXFees module integration.


59-64: Enhanced output formatting and gas price refreshing.

The JSON-formatted output improves readability, and refreshing the gas price after transaction ensures subsequent transactions use the most current gas price information.

examples/chain_client/exchange/13_MsgInstantBinaryOptionsMarketLaunch.py (4)

2-2: Added JSON import for improved output formatting.

The addition of the json module allows for proper formatting of transaction response output, making it more readable and easier to analyze.


24-27: Improved gas price management with dynamic fetching.

Dynamic gas price fetching replaces static gas prices, enhancing transaction reliability. The 10% adjustment provides a safety buffer for price fluctuations between fetching and broadcasting.


32-34: Updated broadcaster initialization with dynamic gas price.

Passing the dynamically fetched gas price along with client and composer instances to the broadcaster improves transaction reliability and aligns with the new TXFees module integration.


65-70: Enhanced output formatting and gas price refreshing.

The JSON-formatted output improves readability, and refreshing the gas price after transaction ensures subsequent transactions use the most current gas price information.

examples/chain_client/distribution/1_SetWithdrawAddress.py (4)

2-2: Added JSON import for improved output formatting.

The addition of the json module allows for proper formatting of transaction response output, making it more readable and easier to analyze.


21-23: Implemented dynamic gas price fetching.

The script now dynamically fetches the current chain gas price and applies a 10% adjustment, improving transaction reliability by ensuring gas prices remain valid during network fluctuations.


28-28: Updated broadcaster initialization with dynamic gas price.

Passing the dynamically fetched gas price to the broadcaster during initialization ensures accurate transaction fee calculation from the start.


48-53: Enhanced output formatting and gas price refreshing.

The JSON-formatted output improves readability, and refreshing the gas price after transaction completion ensures any subsequent transactions will use up-to-date gas pricing.

pyinjective/client/indexer/grpc/indexer_grpc_portfolio_api.py (2)

1-1: Added Optional type import to support the enhanced API.

The import of Optional from typing module properly supports the type annotation for the new optional usd parameter.


24-27: Enhanced portfolio API with USD valuation support.

The method signature and implementation now support fetching portfolio balances with optional USD valuation, aligning with the underlying protobuf schema updates in the chain upgrade to v1.15.

buf.gen.yaml (1)

15-28: Version tags updated for chain v1.15 compatibility

The version tags for key dependencies have been updated to align with Injective core v1.15:

  • cosmos-sdk: v0.50.9-inj.5
  • ibc-go: v8.7.0-inj
  • wasmd: v0.53.2-inj.2
  • injective-core: v1.15.0

These updates are necessary for the SDK to work correctly with the upgraded chain version.

examples/chain_client/exchange/27_MsgActivateStakeGrant.py (5)

2-2: LGTM: JSON module added for improved response formatting

The json module is correctly imported to support the improved transaction response formatting.


25-28: Improved gas price handling with dynamic fetching and adjustment

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for potential price fluctuations between request and broadcast time. This is a significant improvement over static gas prices.


32-35: Updated broadcaster initialization with dynamic parameters

The broadcaster now correctly receives the dynamic gas price, client, and composer instances, enabling more flexible transaction fee management.


51-52: Enhanced response readability with JSON formatting

Transaction response is now properly formatted as JSON for improved readability.


53-56: Added post-broadcast gas price update capability

The code now refreshes the gas price after broadcasting and updates the broadcaster, ensuring that subsequent transactions use current gas prices.

tests/core/test_message_based_transaction_fee_calculator.py (1)

62-62: Updated constant references to reflect gas limit implementation changes

All references to TRANSACTION_GAS_LIMIT have been correctly updated to TRANSACTION_ANTE_GAS_LIMIT to align with the core implementation changes. This constant was renamed and its value increased from 60,000 to 105,000 to better reflect ante handler gas costs.

The tests now properly validate the updated gas limit calculation logic across various message types.

Also applies to: 90-90, 112-112, 134-134, 165-165, 197-197, 236-236

examples/chain_client/exchange/26_MsgAuthorizeStakeGrants.py (5)

2-2: LGTM: JSON module added for improved response formatting

The json module is correctly imported to support the improved transaction response formatting.


26-28: Improved gas price handling with dynamic fetching and adjustment

The code now dynamically fetches the current chain gas price and applies a 10% buffer to account for potential price fluctuations between request and broadcast time. This is a significant improvement over static gas prices.


33-35: Updated broadcaster initialization with dynamic parameters

The broadcaster now correctly receives the dynamic gas price, client, and composer instances, enabling more flexible transaction fee management.


54-54: Enhanced response readability with JSON formatting

Transaction response is now properly formatted as JSON for improved readability.


56-59: Added post-broadcast gas price update capability

The code now refreshes the gas price after broadcasting and updates the broadcaster, ensuring that subsequent transactions use current gas prices.

pyinjective/proto/exchange/injective_campaign_rpc_pb2.py (3)

17-17: Updated protobuf serialization descriptor with new field definition.

The serialized protobuf descriptor now includes the new usd_value field (field number 3) in the Coin message, enhancing the API with USD-denominated value representation.


31-32: LGTM: Properly updated serialized descriptor offset for Coin message.

The serialized offsets have been correctly updated to accommodate the new usd_value field in the Coin message.


33-66: LGTM: Correctly adjusted all subsequent serialized offsets.

All subsequent message serialization offsets have been properly adjusted to account for the addition of the new field in the Coin message.

tests/client/chain/grpc/configurable_txfees_query_servicer.py (1)

1-17: Well-structured test servicer for txfees module.

This configurable test servicer implements a clean pattern for mocking gRPC responses in tests. The class:

  1. Properly inherits from the generated QueryServicer
  2. Uses deques to store and retrieve predefined responses
  3. Implements async methods matching the expected service interface

This will enable effective testing of the new txfees API functionality.

examples/chain_client/exchange/24_MsgUpdateSpotMarket.py (4)

2-2: Added json module for improved response formatting.

Good addition for pretty-printing transaction responses.


26-29: Improved gas pricing with dynamic chain-based pricing.

Dynamically fetching the gas price from the chain and adding a 10% buffer is a significant improvement over using static constants. This approach ensures transactions use current network conditions for fee calculations.


33-35: Enhanced broadcaster initialization with explicit dependencies.

Explicitly passing the gas price, client, and composer to the broadcaster ensures consistent usage and avoids unnecessary object recreation.


57-62: Good practice: Updating gas price after transaction.

Updating the broadcaster's gas price after transaction completion ensures subsequent broadcasts use fresh pricing information, improving resilience against network fee changes.

examples/chain_client/distribution/3_WithdrawValidatorCommission.py (4)

2-2: Added json module for improved response formatting.

Good addition for pretty-printing transaction responses.


22-25: Improved gas pricing with dynamic chain-based pricing.

Dynamically fetching the gas price from the chain and adding a 10% buffer is a significant improvement over using static constants. This approach ensures transactions use current network conditions for fee calculations.


29-29: Enhanced broadcaster initialization with explicit gas price.

Passing the dynamically fetched and adjusted gas price to the broadcaster ensures accurate fee estimation.


47-52: Improved transaction result display and gas price update.

The changes improve the transaction output readability with JSON formatting and ensure the broadcaster's gas price stays current for any subsequent operations by fetching and applying a fresh price after broadcasting.

examples/chain_client/5_MessageBroadcasterWithoutSimulation.py (7)

2-2: Appropriate addition of JSON module for improved output formatting.

The addition of the json module enables pretty-printing of transaction results, making debugging and readability much better.


9-9: Good transition to AsyncClient for consistent async operations.

This change properly imports the AsyncClient which is more appropriate for the async workflow being implemented.


21-24: Well-structured client initialization and async composer retrieval.

The code now correctly initializes the AsyncClient and asynchronously obtains the composer, following recommended patterns for async operations in the SDK.


26-28: Good implementation of dynamic gas price management.

The code now fetches the current chain gas price and applies a safety buffer of 10%, which provides resilience against gas price fluctuations between request and broadcast time.


33-35: Proper initialization of the message broadcaster with dynamic parameters.

The code now correctly passes the dynamic gas price, client, and composer to the message broadcaster constructor, enabling effective gas management.


78-78: Enhanced result output with JSON formatting.

The transaction response is now displayed in a structured JSON format, improving readability and debugging.


80-83: Effective implementation of gas price refresh mechanism.

The code now refreshes the gas price after transaction broadcast and updates the broadcaster, ensuring subsequent transactions use the latest gas prices.

pyinjective/proto/injective/txfees/v1beta1/genesis_pb2.py (1)

1-31: Correctly implemented auto-generated protobuf file for txfees module.

This new file correctly implements the GenesisState message structure for the txfees module, which is crucial for the v1.15 chain upgrade support. The file is auto-generated by the protocol buffer compiler and follows standard protobuf patterns.

Note: Static analysis flagged unused imports on lines 15-16, but since this is an auto-generated file, these should not be modified directly.

🧰 Tools
🪛 Ruff (0.8.2)

15-15: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2 imported but unused

Remove unused import: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2

(F401)


16-16: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)

tests/client/chain/grpc/test_chain_grpc_exchange_api.py (4)

63-63: Added support for the new fixed_gas_enabled parameter.

This change correctly adds the fixed_gas_enabled parameter to the Params object, which is part of the txfees module integration in v1.15.


113-113: Properly updated expected_params to include the new fixed_gas_enabled field.

The test expectations are correctly updated to match the modified Params structure with the fixed_gas_enabled field.


2552-2555: Updated MarketBalance implementation to match new protobuf structure.

The code now correctly uses the MarketBalance message structure that includes both market_id and balance fields, matching the updated protobuf definitions in v1.15.


2566-2571: Properly updated expected results to match new MarketBalance structure.

The expected results structure now correctly reflects the nested MarketBalance message with marketId and balance fields.

examples/chain_client/exchange/4_MsgInstantPerpetualMarketLaunch.py (6)

2-2: Appropriate addition of JSON module for improved output formatting.

The addition of the json module enables pretty-printing of transaction results, making debugging and readability much better.


25-25: Removed unnecessary sync_timeout_height call.

The removal of the synchronous timeout height call is appropriate as it's no longer needed with the new async approach.


26-28: Good implementation of dynamic gas price management.

The code now fetches the current chain gas price and applies a safety buffer of 10%, which provides resilience against gas price fluctuations between request and broadcast time.


33-35: Proper initialization of the message broadcaster with dynamic parameters.

The code now correctly passes the dynamic gas price, client, and composer to the message broadcaster constructor, enabling effective gas management.


65-65: Enhanced result output with JSON formatting.

The transaction response is now displayed in a structured JSON format, improving readability and debugging.


67-70: Effective implementation of gas price refresh mechanism.

The code now refreshes the gas price after transaction broadcast and updates the broadcaster, ensuring subsequent transactions use the latest gas prices.

examples/chain_client/exchange/25_MsgUpdateDerivativeMarket.py (5)

2-2: Good addition of JSON module for improved output formatting.

Adding the JSON module allows for pretty-printing the transaction result, making the output much more readable and easier to debug.


25-28: Excellent improvement to dynamic gas price management.

Fetching the current chain gas price dynamically is more reliable than using static constants. The 10% adjustment provides a buffer against gas price fluctuations between retrieval and broadcast time, which helps ensure transactions don't fail due to gas price changes.


33-35: Good optimization passing client and composer instances to the broadcaster.

Passing these instances to the broadcaster constructor avoids redundant object creation and ensures consistency throughout the execution flow.


59-59: Improved output formatting with JSON pretty-printing.

Using json.dumps() with indentation makes the transaction response much more readable than raw printing.


61-64: Smart addition of gas price refresh after transaction.

Updating the gas price after broadcasting prepares the broadcaster for any subsequent transactions, ensuring they use the most current gas price data.

tests/client/indexer/grpc/test_indexer_grpc_portfolio_api.py (3)

24-24: Good test coverage for USD value fields in account portfolio.

The test now properly covers the new USD-related fields added to the portfolio API:

  • usd_value in the Coin message
  • total_balance_usd and available_balance_usd in the SubaccountDeposit message

The corresponding assertions have been correctly updated to verify these fields.

Also applies to: 29-30, 79-79, 89-90


126-126: Complete test coverage for USD values in portfolio balances.

The test now properly validates all USD value fields in the portfolio balances response:

  • usd_value in coin objects
  • total_balance_usd and available_balance_usd in subaccount deposits
  • total_usd at the portfolio level

This ensures proper testing of the USD value calculation functionality.

Also applies to: 131-132, 144-144, 163-163, 173-174, 178-178


155-155: API call correctly updated to request USD values.

The fetch_account_portfolio_balances call now includes the usd=True parameter, which properly tests the API's ability to return USD values when requested.

examples/chain_client/exchange/5_MsgInstantExpiryFuturesMarketLaunch.py (4)

2-2: Good addition of JSON module for improved output formatting.

Adding the JSON module enables pretty-printing of the transaction result, improving readability.


26-28: Excellent improvement to dynamic gas price management.

Fetching the current chain gas price dynamically with a 10% buffer helps ensure transaction success by accounting for gas price fluctuations between retrieval and broadcast time.


33-35: Good optimization passing client and composer instances to the broadcaster.

Passing these instances avoids redundant object creation and ensures consistency throughout the execution flow.


66-71: Smart addition of gas price refresh and broadcaster update.

Refreshing the gas price after broadcasting and updating the broadcaster ensures that any subsequent transactions will use the most current gas price data, improving reliability.

examples/chain_client/3_MessageBroadcaster.py (6)

2-2: Good modernization of imports.

Updating to use AsyncClient and adding JSON for output formatting aligns with the SDK's move toward asynchronous operations and improved output readability.

Also applies to: 9-9


22-24: Excellent update to client initialization pattern.

The new approach using AsyncClient and asynchronously retrieving the composer is more efficient and follows modern async patterns. This provides a better foundation for transaction handling.


25-27: Good implementation of dynamic gas price management.

Fetching the current chain gas price with a 10% buffer helps ensure transaction success by accounting for fluctuations between retrieval and broadcast time.


32-34: Improved broadcaster initialization with necessary components.

Passing gas_price, client, and composer to the broadcaster constructor ensures all components work together consistently and avoids redundant object creation.


77-77: Enhanced output readability with JSON formatting.

Using json.dumps with indentation makes the transaction response much more readable, which is helpful for debugging and understanding the response structure.


79-82: Smart addition of gas price refresh after transaction.

Updating the gas price after broadcasting prepares the broadcaster for any subsequent transactions, ensuring they use the most current gas price data.

examples/chain_client/tokenfactory/2_MsgMint.py (2)

7-7: Well-implemented dynamic gas management strategy

The transition from static gas price to dynamically fetched gas prices with a 10% buffer is an excellent enhancement. This approach helps ensure transactions remain valid even with gas price fluctuations between request and broadcast time.

Also applies to: 20-25, 30-32


50-55: Good practice: Gas price refreshing after transaction

Refreshing the gas price after transaction completion is a solid practice that ensures subsequent transactions will use the most current pricing information.

pyinjective/proto/exchange/injective_spot_exchange_rpc_pb2.py (1)

121-124: Successful protobuf update with USD value fields

The updated serialized descriptor data correctly incorporates the new usd_value field added to the Coin message type. This change aligns with the broader enhancement to include USD-denominated values across multiple exchange-related protobuf definitions.

examples/chain_client/tokenfactory/3_MsgBurn.py (2)

7-7: Well-implemented dynamic gas management strategy

The transition from static gas price to dynamically fetched gas prices with a 10% buffer is an excellent enhancement. This approach helps ensure transactions remain valid even with gas price fluctuations between request and broadcast time.

Also applies to: 20-25, 30-32


50-55: Good practice: Gas price refreshing after transaction

Refreshing the gas price after transaction completion is a solid practice that ensures subsequent transactions will use the most current pricing information.

tests/client/indexer/grpc/test_indexer_grpc_account_api.py (2)

136-137: Test coverage for new USD balance fields

Good job updating the test assertions to verify the new USD-denominated balance fields in the SubaccountDeposit message.

Also applies to: 163-164


180-181: Consistent test updates for multiple test cases

The consistent approach to updating test assertions across multiple test cases ensures comprehensive coverage of the new USD balance fields.

Also applies to: 207-208

examples/chain_client/tokenfactory/4_MsgChangeAdmin.py (5)

2-2: Well-implemented async client pattern with improved imports

The transition to AsyncClient with json module import is well implemented. This change improves code maintainability by using the async client to handle both composition and gas price retrieval.

Also applies to: 7-7, 20-25


23-25: Good dynamic gas price handling with safety margin

The implementation properly fetches current chain gas prices and adds a 10% buffer to account for potential price changes between request time and transaction broadcast. This is a robust approach that helps prevent transaction failures due to insufficient fees.


30-32: Proper parameter passing to broadcaster

Passing the gas_price, client, and composer instances to the broadcaster is good practice as it reuses existing objects and ensures consistency across the transaction pipeline.


48-48: Improved output formatting

Using JSON formatting with indentation improves readability of transaction results, making it easier for developers to understand the response structure.


50-53: Good practice: refreshing gas price after transaction

Refreshing the gas price after broadcasting and updating the broadcaster is excellent practice for applications that may perform multiple transactions, ensuring subsequent transactions use up-to-date gas prices.

examples/chain_client/permissions/4_MsgClaimVoucher.py (5)

2-2: Well-implemented async client pattern with improved imports

The transition to AsyncClient with json module import is well implemented. The code correctly initializes the async client for the devnet network and retrieves both the composer and gas price asynchronously.

Also applies to: 7-7, 20-25


23-25: Good dynamic gas price handling with safety margin

The implementation properly fetches current chain gas prices and adds a 10% buffer to account for potential price changes between request time and transaction broadcast. This approach helps prevent transaction failures due to insufficient fees.


30-32: Proper parameter passing to simulation-based broadcaster

Passing the gas_price, client, and composer instances to the simulation-based broadcaster is good practice. Note that this example uses new_using_simulation (compared to new_without_simulation in other examples), which is appropriate for this specific use case.


49-49: Improved output formatting

Using JSON formatting with indentation improves readability of transaction results, making it easier for developers to understand the response structure.


51-54: Good practice: refreshing gas price after transaction

Refreshing the gas price after broadcasting and updating the broadcaster is excellent practice for applications that may perform multiple transactions, ensuring subsequent transactions use up-to-date gas prices.

examples/chain_client/tokenfactory/1_CreateDenom.py (5)

2-2: Well-implemented async client pattern with improved imports

The transition to AsyncClient with json module import is well implemented. The code correctly initializes the async client for the testnet network and retrieves both the composer and gas price asynchronously.

Also applies to: 7-7, 20-25


23-25: Good dynamic gas price handling with safety margin

The implementation properly fetches current chain gas prices and adds a 10% buffer to account for potential price changes between request time and transaction broadcast. This approach helps prevent transaction failures due to insufficient fees.


30-32: Proper parameter passing to simulation-based broadcaster

Passing the gas_price, client, and composer instances to the simulation-based broadcaster is good practice. This example correctly uses new_using_simulation for more accurate gas estimation when creating a new denom.


51-51: Improved output formatting

Using JSON formatting with indentation improves readability of transaction results, making it easier for developers to understand the response structure.


53-56: Good practice: refreshing gas price after transaction

Refreshing the gas price after broadcasting and updating the broadcaster is excellent practice for applications that may perform multiple transactions, ensuring subsequent transactions use up-to-date gas prices.

examples/chain_client/tokenfactory/5_MsgSetDenomMetadata.py (5)

2-2: Well-implemented async client pattern with improved imports

The transition to AsyncClient with json module import is well implemented. The code correctly initializes the async client for the testnet network and retrieves both the composer and gas price asynchronously.

Also applies to: 7-7, 20-25


23-25: Good dynamic gas price handling with safety margin

The implementation properly fetches current chain gas prices and adds a 10% buffer to account for potential price changes between request time and transaction broadcast. This approach helps prevent transaction failures due to insufficient fees.


30-32: Proper parameter passing to heuristic-based broadcaster

Passing the gas_price, client, and composer instances to the broadcaster is good practice. This example correctly uses new_without_simulation for metadata updates, which is appropriate for this type of transaction.


64-64: Improved output formatting

Using JSON formatting with indentation improves readability of transaction results, making it easier for developers to understand the response structure.


66-69: Good practice: refreshing gas price after transaction

Refreshing the gas price after broadcasting and updating the broadcaster is excellent practice for applications that may perform multiple transactions, ensuring subsequent transactions use up-to-date gas prices.

tests/client/indexer/grpc/test_indexer_grpc_explorer_api.py (2)

63-64: Added support for the new block_unix_timestamp field across all relevant objects.

These changes correctly integrate the new Unix timestamp field into test objects and expected outputs, ensuring compatibility with the v1.15 chain upgrade. The block_unix_timestamp is properly converted to string in the expected dictionaries to match how numbers are represented in API responses.

Also applies to: 153-154, 214-215, 297-298, 358-359, 439-440, 464-465, 498-499, 532-533, 545-546, 593-594, 597-598, 843-844, 896-897, 954-955, 1028-1029


1621-1622: Added support for the new usd_value field in Coin objects.

This adds the USD value representation to coin objects to align with the v1.15 chain upgrade, where coin values now include USD equivalents. The expected output correctly maps this to the camelCase "usdValue" field.

Also applies to: 1663-1664

examples/chain_client/permissions/1_MsgCreateNamespace.py (5)

2-2: Updated imports to support JSON formatting and AsyncClient.

These import changes support the transition from synchronous to asynchronous client usage and improved response formatting. The json module allows for pretty-printing transaction results.

Also applies to: 7-8


19-24: Replaced synchronous Composer with AsyncClient and added dynamic gas price retrieval.

This implementation change properly adopts the new pattern of asynchronously obtaining a composer instance through the client and dynamically fetching the current gas price from the chain. The 10% buffer adds resilience against gas price fluctuations.


29-32: Updated MsgBroadcasterWithPk constructor parameters to include gas price, client, and composer.

This modification properly passes the client, composer and dynamically fetched gas price to the message broadcaster, enabling better transaction fee estimation and management.


105-105: Enhanced transaction response formatting with JSON pretty-printing.

This improvement makes the transaction response more readable in the console output.


107-110: Added post-broadcast gas price refresh for subsequent transactions.

This important addition ensures that if the example is extended to support multiple transactions, each subsequent transaction will use the most current gas price. The update_gas_price method properly refreshes the broadcaster's internal gas price.

examples/chain_client/permissions/3_MsgUpdateActorRoles.py (5)

2-2: Updated imports to support JSON formatting and AsyncClient.

These import changes support the transition from synchronous to asynchronous client usage and improved response formatting, consistent with other example files.

Also applies to: 7-8


19-25: Replaced synchronous Composer with AsyncClient and added dynamic gas price retrieval.

This implementation properly follows the new pattern of asynchronously obtaining a composer instance and dynamically fetching gas prices, with a 10% buffer for resilience against price fluctuations.


30-33: Updated MsgBroadcasterWithPk constructor parameters to include gas price, client, and composer.

This modification properly passes the client, composer, and dynamically fetched gas price to the message broadcaster, enabling better transaction fee estimation and management.


68-68: Enhanced transaction response formatting with JSON pretty-printing.

This improvement makes the transaction response more readable in the console output.


70-73: Added post-broadcast gas price refresh for subsequent transactions.

This important addition ensures that if the example is extended to support multiple transactions, each subsequent transaction will use the most current gas price.

examples/chain_client/6_MessageBroadcasterWithGranteeAccountWithoutSimulation.py (6)

2-2: Added JSON module for improved response formatting.

This change enables pretty-printing of transaction responses for better readability.


25-25: Updated composer instantiation to use the async client.

This change correctly follows the new pattern of asynchronously obtaining a composer instance through the client instead of direct instantiation.


32-35: Added dynamic gas price retrieval from the chain with buffer.

This implementation properly fetches the current gas price dynamically and adds a 10% buffer to account for potential gas price fluctuations between fetching and broadcasting.


39-42: Updated message broadcaster constructor parameters to include gas price, client, and composer.

This modification properly passes the dynamically fetched gas price, client, and composer to the message broadcaster for grantee accounts, enabling better transaction fee estimation.


63-63: Enhanced transaction response formatting with JSON pretty-printing.

This improvement makes the transaction response more readable in the console output.


65-68: Added post-broadcast gas price refresh for subsequent transactions.

This important addition ensures that if multiple transactions are needed, each subsequent transaction will use the most current gas price, keeping the example aligned with best practices.

pyinjective/client/chain/grpc/chain_grpc_txfees_api.py (1)

1-29: Clear and well-structured implementation of the TXFees API client

The ChainGrpcTxfeesApi class is well-designed with a clean separation of concerns. It provides asynchronous methods to interact with the txfees gRPC service, enabling dynamic retrieval of fee-related data from the Injective blockchain. This addition aligns well with the chain upgrade to v1.15.

The implementation follows good practices:

  • Proper typing with type hints
  • Asynchronous methods with clear naming
  • Reuse of the common execution pattern through _execute_call
  • Consistent method signatures returning dictionaries
pyinjective/proto/exchange/injective_portfolio_rpc_pb2.py (1)

17-58: Auto-generated protobuf file with USD value field additions

The changes to this auto-generated file reflect the addition of USD value fields to various message types in the portfolio API. These serialized offsets ensure proper binary encoding/decoding of the protobuf messages.

The modifications enable enhanced financial data representation with USD values, which is valuable for portfolio tracking and financial analysis.

pyinjective/proto/exchange/injective_accounts_rpc_pb2.py (1)

17-118: Auto-generated protobuf file with USD value field additions

The changes to this auto-generated file reflect the addition of USD value fields to various message types in the accounts API. These serialized offsets ensure proper binary encoding/decoding of the protobuf messages.

Similar to the portfolio API changes, these modifications enable enhanced financial data representation with USD values, providing a consistent approach across different APIs.

pyinjective/proto/injective/txfees/v1beta1/txfees_pb2.py (2)

1-59: New protobuf definitions for the TXFees module

This auto-generated file defines the Params message structure for the TXFees module, which is a key component of the chain upgrade to v1.15. The message contains extensive parameters for controlling transaction fee mechanics, including EIP-1559 style dynamic fee adjustments.

The parameters include controls for:

  • Gas limits and thresholds
  • Minimum gas prices
  • Base fee multipliers
  • Fee update intervals and rates
  • Block space targeting
🧰 Tools
🪛 Ruff (0.8.2)

15-15: pyinjective.proto.amino.amino_pb2 imported but unused

Remove unused import: pyinjective.proto.amino.amino_pb2

(F401)


16-16: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


17-17: pyinjective.proto.google.api.annotations_pb2 imported but unused

Remove unused import: pyinjective.proto.google.api.annotations_pb2

(F401)


15-17: Auto-generated import statements

The static analysis tool flagged these imports as unused, but they're required by the protobuf runtime system. Since this is an auto-generated file, these imports should remain untouched.

🧰 Tools
🪛 Ruff (0.8.2)

15-15: pyinjective.proto.amino.amino_pb2 imported but unused

Remove unused import: pyinjective.proto.amino.amino_pb2

(F401)


16-16: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


17-17: pyinjective.proto.google.api.annotations_pb2 imported but unused

Remove unused import: pyinjective.proto.google.api.annotations_pb2

(F401)

pyinjective/proto/ibc/core/connection/v1/tx_pb2.py (4)

22-22: Protocol buffer descriptor updated.

This line shows an updated serialized descriptor for the IBC connection module, reflecting changes to field options in the protobuf definitions. This change is auto-generated and should be treated as atomic with the related field option changes below.


36-37: New nullable field options added to MsgConnectionOpenTry.

These lines add the serialized option b'\030\001' (representing the gogoproto.nullable = false option) to various fields in the MsgConnectionOpenTry message. These proto option changes ensure proper null handling in generated code and are standard serialized options.

Also applies to: 42-45, 47-49


52-53: New nullable field options added to MsgConnectionOpenAck.

Similar to the changes in MsgConnectionOpenTry, these lines add the serialized option b'\030\001' (representing the gogoproto.nullable = false option) to matching fields in the MsgConnectionOpenAck message. This maintains consistency in field option handling between related message types.

Also applies to: 56-59, 61-63


81-97: Updated serialized position offsets.

These changes to the serialized start and end positions are a direct consequence of the updated protobuf descriptor. They ensure proper message deserialization and are automatically generated based on the descriptor changes.

pyinjective/proto/exchange/injective_trading_rpc_pb2.py (2)

17-17: Protocol buffer descriptor updated with StrategyFinalData support.

This updated serialized descriptor adds support for the new StrategyFinalData message type and integrates it with the TradingStrategy message through a new final_data field. This is part of enhancing the trading strategy data representation capabilities.


30-44: Updated serialized position offsets for message types.

These updates to serialized positions reflect the addition of the new StrategyFinalData message type and its integration with existing messages. The positions are automatically calculated based on the updated descriptors.

pyinjective/proto/injective/exchange/v1beta1/exchange_pb2.py (1)

303-416: Updated serialized position offsets for exchange proto messages.

These changes update the serialized start and end positions for various message types within the exchange module. They are automatically generated based on the regenerated protocol buffer descriptors and don't affect the public API or message structures.

pyinjective/proto/osmosis/txfees/v1beta1/query_pb2_grpc.py (4)

1-22: New txfees Query gRPC client stub implementation.

This code adds a new gRPC client stub for querying transaction fees, specifically adding support for the GetEipBaseFee method. This is part of the new dynamic gas fee management feature that allows retrieving current EIP1559-style base fees from the chain.


24-33: New txfees Query gRPC server implementation.

This adds the server-side implementation of the Query service with the GetEipBaseFee RPC method. The method is implemented with a NotImplementedError since this is just the service definition, and actual implementation would be provided by the node.


35-47: Server registration helpers for txfees Query service.

This code provides utility functions to register the Query service with a gRPC server. It sets up the appropriate request/response serialization handling and registers both generic and method-specific handlers.


49-78: Experimental client API for txfees Query.

This implements the client-side interface for the txfees Query service using the experimental gRPC API. This provides a clean interface for applications to query EIP base fees without dealing with the low-level gRPC details directly.

pyinjective/proto/injective/exchange/v1beta1/query_pb2.py (3)

22-22: No issues with the auto-generated descriptor initialization.


300-303: Metadata for newly added enums looks fine.
These lines reflect serialized offsets for the _ORDERSIDE and _CANCELLATIONSTRATEGY enums.


580-595: Consolidated descriptor entries are valid.
All changes in these descriptor offsets appear consistent with new or updated message fields.

pyinjective/proto/injective/txfees/v1beta1/tx_pb2_grpc.py (1)

1-80: New gRPC stubs for the txfees module.
This file appears to be auto-generated. No manual intervention is needed.

pyinjective/proto/injective/txfees/v1beta1/tx_pb2.py (2)

1-14: No issues in the initial message definitions.
All lines appear to be standard boilerplate from the protobuf compiler.


20-45: Remainder of the file looks good.
Proto message and service definitions conform well to the txfees module specification.

pyinjective/proto/google/rpc/error_details_pb2.py (3)

18-18: Auto-generated descriptor updates.
No issues found with the updated descriptor metadata for error details.


29-29: Additional descriptor field.
No concerns. This looks consistent with the extended quota fields.


39-44: Enhanced QuotaFailure violation fields.
All newly added fields for advanced quota tracking appear correct.

pyinjective/proto/injective/txfees/v1beta1/query_pb2_grpc.py (1)

1-124: LGTM: Auto-generated gRPC client/server code for txfees module

This auto-generated file correctly implements the gRPC service for querying transaction fees in the Injective chain v1.15 upgrade. It properly defines the client stub (QueryStub), server interface (QueryServicer), and all necessary registration functions.

tests/client/chain/grpc/test_chain_grpc_txfees_api.py (3)

17-59: Good test coverage for the module parameters query

The test correctly mocks the response structure and verifies that all the expected fields are properly parsed and returned.


61-75: Good test coverage for the EIP base fee query

The test correctly handles the large base fee value and verifies the proper response structure. This is important since gas fees are critical for transaction processing.


77-85: Clean helper method for API instance creation

The _api_instance method properly initializes the API with test configuration and injects the mock servicer.

pyinjective/proto/exchange/injective_chart_rpc_pb2.py (1)

33-52: LGTM: Updated serialized offsets for new market summary messages

These changes update the serialized offsets in the auto-generated protobuf code to accommodate the new market summary message types and service methods. This is expected when expanding the protobuf definitions.

pyinjective/proto/osmosis/txfees/v1beta1/query_pb2.py (1)

1-39: LGTM: Auto-generated protobuf code for Osmosis txfees module

This auto-generated file correctly defines the message types and service for querying EIP base fees from the Osmosis chain. The static analysis flags some unused imports, but these are required for the protobuf compilation process even if not directly referenced in the Python code.

🧰 Tools
🪛 Ruff (0.8.2)

15-15: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


16-16: pyinjective.proto.google.api.annotations_pb2 imported but unused

Remove unused import: pyinjective.proto.google.api.annotations_pb2

(F401)


17-17: google.protobuf.duration_pb2 imported but unused

Remove unused import: google.protobuf.duration_pb2

(F401)

tests/core/test_gas_heuristics_gas_limit_estimator.py (8)

1-41: Well-structured test imports and fixtures

The imports and fixtures are well-organized, properly importing all necessary gas limit constants from the core module and setting up the test fixtures with appropriate market configurations.


59-67: LGTM: Default message estimation test

The test correctly verifies the fallback gas limit behavior for messages without specific gas limit rules.


95-120: LGTM: Batch cancel spot orders gas estimation

The test correctly verifies gas estimation for batch cancellation of spot orders.


211-245: LGTM: Batch update derivative orders test

This test ensures proper gas estimation for batch creation of derivative orders.


246-301: LGTM: Binary options orders gas estimation

The binary options orders gas estimation calculations are correctly implemented and tested.

🧰 Tools
🪛 Ruff (0.8.2)

246-246: Redefinition of unused usdt_token from line 39

(F811)


680-694: LGTM: Deposit gas estimation

The deposit gas estimation test correctly uses the appropriate constant.


695-709: LGTM: Withdraw gas estimation

The withdraw gas estimation test correctly uses the appropriate constant.


810-851: LGTM: Contract and governance gas estimation

The tests for contract execution and governance messages properly apply the appropriate gas limit constants.

pyinjective/proto/exchange/injective_referral_rpc_pb2_grpc.py (2)

1-84: LGTM: Well-structured gRPC service definitions

The gRPC client stub and server class definitions follow best practices for gRPC service implementation. The unimplemented servicer methods correctly set the UNIMPLEMENTED status code and raise NotImplementedError.


86-170: LGTM: Experimental API interface

The experimental static client interface provides a clean way to directly call RPC methods with appropriate parameters, following gRPC best practices.

pyinjective/proto/exchange/injective_referral_rpc_pb2.py (1)

1-41: LGTM: Generated Protobuf code

The generated protobuf code correctly defines the message types and descriptors needed for the referral system. This auto-generated code follows the expected pattern for protobuf Python modules.

pyinjective/proto/injective/txfees/v1beta1/query_pb2.py (2)

1-18: LGTM: TXFees module query protobuf imports

The import structure for the TXFees module query protobuf is well-organized and includes the necessary dependencies.

🧰 Tools
🪛 Ruff (0.8.2)

15-15: pyinjective.proto.gogoproto.gogo_pb2 imported but unused

Remove unused import: pyinjective.proto.gogoproto.gogo_pb2

(F401)


16-16: pyinjective.proto.google.api.annotations_pb2 imported but unused

Remove unused import: pyinjective.proto.google.api.annotations_pb2

(F401)


17-17: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2 imported but unused

Remove unused import: pyinjective.proto.injective.txfees.v1beta1.txfees_pb2

(F401)


19-48: LGTM: Generated Query service definitions

This generated protobuf code correctly defines the message types and Query service for accessing the txfees module parameters and EIP base fee. The field annotations for proper serialization of decimal values are correctly applied.

pyinjective/proto/exchange/injective_chart_rpc_pb2_grpc.py (3)

28-47: Additions to the Stub look consistent.

Your new stubs for SpotMarketSummary, AllSpotMarketSummary, DerivativeMarketSummary, and AllDerivativeMarketSummary are properly defined with request/response serializers. The naming is coherent and indicates clarity of purpose.


111-130: Good addition to RPC method handlers.

The newly registered method handlers correctly link to the servicer’s corresponding methods. The request and response serializers also match up with the new RPC definitions, ensuring consistency.


196-303:

Details

✅ Verification successful

Experimental static client usage.

Using grpc.experimental.unary_unary for these calls is fine, but remember that experimental features may require updates if gRPC changes. Everything appears consistent with your existing pattern.

If you want to confirm external usage references, run:


🏁 Script executed:

#!/bin/bash
rg -A 3 "SpotMarketSummary"
rg -A 3 "AllSpotMarketSummary"
rg -A 3 "DerivativeMarketSummary"
rg -A 3 "AllDerivativeMarketSummary"

Length of output: 38597


EXPERIMENTAL STATIC CLIENT USAGE CONFIRMED

The references for all four methods were found consistently across the codebase, and the use of grpc.experimental.unary_unary remains in line with the established pattern. No additional changes are necessary, though please keep in mind that experimental features may need revisiting if the gRPC API changes.

pyinjective/async_client.py (6)

16-38: New imports for dynamic fee support.

Introducing ChainGrpcTxfeesApi and referencing GAS_PRICE aligns with the new fee module. This import structure is tidy and consistent.


273-275: Destructor approach.

Calling _cancel_timeout_height_sync_task() ensures resource cleanup. However, Python’s garbage collection might not always guarantee __del__() is called. Consider a more explicit shutdown if needed.


276-279: close_exchange_channel method.

Closing the exchange channel and canceling the sync task is a solid approach to avoid dangling resources. Ensure no further code paths assume the channel remains open.


280-283: close_chain_channel method.

Same pattern as close_exchange_channel. This symmetry is good for consistent resource handling.


284-287: close_chain_stream_channel method.

The consistency of closing channels and canceling tasks here is commendable. This avoids potential leaks in asynchronous contexts.


2346-2359: current_chain_gas_price method.

Fetching the chain’s EIP base fee is a solid improvement for dynamic fee calculation. Watch for partial or inconsistent chain responses and handle them as needed.

pyinjective/core/gas_heuristics_gas_limit_estimator.py (3)

1-35: Overall file introduction & constants.

This file’s heuristic-based gas estimation strategy is well-structured. Having clear constants for creation/cancellation/deposit/margin operations allows for quick adjustments later.


95-200: Spot & Derivative single-order estimators.

Detecting post-only vs. standard orders and applying the appropriate gas constants is consistent with your approach. These classes appear cohesive and properly mapped to the new constants.


388-507: Deposit, withdrawal, margin, and MsgExec coverage.

All relevant message types, including MsgExec with nested messages, are accounted for. This comprehensive coverage reduces potential blind spots in the fee estimator.

pyinjective/core/broadcaster.py (26)

4-4: No issues with adding Type import.
This import is used cleanly for the estimator_class parameter, enhancing flexibility.


13-13: Import of GasHeuristicsGasLimitEstimator looks good.
This import correctly references the newly added heuristics-based estimator.


52-60: Abstract update_gas_price method is well-defined.
The clear docstring and parameter type help ensure consistent usage across implementations.


86-86: Optional gas_price parameter introduced here seems appropriate.
This aligns with the customizable gas price feature for simulation-based broadcasting.


90-102: Docstring for new_using_simulation is clear and comprehensive.
It accurately reflects the usage of the optional gas_price parameter for transaction simulation.


106-106: Instantiation of SimulatedTransactionFeeCalculator is correct.
Passing along the optional gas_price ensures fallback to a default if none is provided.


121-124: Extended signature for new_without_simulation effectively incorporates gas_price.
Implementation remains concise and consistent with the docstring.


125-145: Docstring for new_without_simulation is properly updated.
The details about custom gas_price and usage are well explained.


147-184: new_using_gas_heuristics method is a logical addition.
It correctly delegates fee calculation to the heuristics-based approach.


186-214: new_using_estimate_gas method is well-structured.
Links neatly to the message-based gas estimation logic and clarifies usage.


229-229: Optional gas_price for grantee simulation broadcast is consistent.
This maintains parallel behavior with the standard simulation flow.


233-246: Docstring for grantee simulation usage is clear and thorough.
Accurately documents the optional custom gas_price.


265-265: Optional gas_price in new_for_grantee_account_without_simulation is well-aligned.
No issues detected.


269-290: Docstring for new_for_grantee_account_without_simulation is consistent.
It properly conveys how the gas heuristics approach is invoked.


292-329: new_for_grantee_account_using_gas_heuristics method is straightforward.
Construction and delegation to the heuristics-based fee calculator is correct.


331-363: new_for_grantee_account_using_estimated_gas integration is solid.
The docstring and logic match the non-simulation, estimate-based approach.


405-412: update_gas_price in MsgBroadcasterWithPk correctly delegates to fee calculator.
The docstring clarifies the parameter in chain units.


506-513: update_gas_price in SimulatedTransactionFeeCalculator is consistent with the abstract interface.
This method ensures runtime flexibility in adjusting simulation gas pricing.


516-517: Increasing TRANSACTION_ANTE_GAS_LIMIT to 105,000 seems aligned with chain updates.
No immediate concerns; this matches the new budgeting requirements.


518-524: Expanded constructor for MessageBasedTransactionFeeCalculator is clear.
Accepting an estimator_class parameter fosters flexible gas-limit strategies.


528-529: Defaulting _estimator_class to GasLimitEstimator is a good fallback.
Preserves legacy behavior in the absence of heuristics.


530-535: new_using_gas_heuristics class method is a neat way to specialize.
It self-documents the availability of heuristics-based estimation.


536-538: new_using_gas_estimation class method complements heuristics usage gracefully.
Clearly differentiates between standard and advanced estimators.


546-547: Addition of TRANSACTION_ANTE_GAS_LIMIT to message-based gas limit is logical.
This overhead ensures reliable coverage for base transaction costs.


570-570: Delegate to _estimator_class.for_message is an elegant approach.
This ensures the correct gas limit logic is used per message type.


574-582: update_gas_price finalizes consistency for message-based calculation.
The docstring is clear, matching the abstract contract.

Comment on lines +71 to +74
"0x8aa07899eb940f40e514b8effdb3b6af5d1cf7bb",
"0xb9436d76e8fe08859d042e41b4a21c85715e1176",
"0x7bc5cb059f21553af489d2b2df3d40aaae9b44e8",
"0x430ab3c698b3210548b6ac9f72936b43b15ebe9b"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Newly added OFAC-sanctioned addresses

Four new Ethereum addresses have been added to the OFAC sanctions list, which is an important compliance update for the SDK.

It would be good to verify that these addresses are indeed on the official OFAC sanctions list. Can you confirm the source of these addresses or run a check against the official OFAC listings?


🌐 Web query:

Are the Ethereum addresses 0x8aa07899eb940f40e514b8effdb3b6af5d1cf7bb, 0xb9436d76e8fe08859d042e41b4a21c85715e1176, 0x7bc5cb059f21553af489d2b2df3d40aaae9b44e8, and 0x430ab3c698b3210548b6ac9f72936b43b15ebe9b on the OFAC sanctions list?

💡 Result:

Based on the most recent and community-maintained lists of Ethereum addresses sanctioned by the U.S. Treasury Office of Foreign Assets Control (OFAC), the Ethereum addresses you provided do not appear on the current OFAC SDN (Specially Designated Nationals) list as of April 2025[1][3].

Address Verification

Here are the addresses you asked about:

  • 0x8aa07899eb940f40e514b8effdb3b6af5d1cf7bb
  • 0xb9436d76e8fe08859d042e41b4a21c85715e1176
  • 0x7bc5cb059f21553af489d2b2df3d40aaae9b44e8
  • 0x430ab3c698b3210548b6ac9f72936b43b15ebe9b

These were checked against:

  • The community-maintained OFAC Ethereum address list on GitHub, frequently updated to reflect the official U.S. Treasury sanctions[1][3].
  • The official U.S. Treasury/OFAC SDN list, which can be searched directly using the address hash for precision[7].

None of your listed addresses were found among sanctioned Ethereum addresses associated with entities like Tornado Cash, Lazarus Group, or other sanctioned individuals and organizations as of the latest OFAC updates[1][4][8].

How to Double-Check

OFAC provides a Sanctions List Search tool that allows users to paste in any Ethereum address and instantly check for an exact match on the SDN list; this is considered the definitive method for checking compliance[7].

Caveats and Ongoing Compliance

  • New additions can occur: OFAC updates its sanctions lists regularly. For ongoing compliance, you should routinely check addresses against the latest OFAC SDN updates.
  • Use trusted sources: Rely on the OFAC official search tool or reputable, frequently updated community lists for accurate results[1][7].

Conclusion:
As of April 16, 2025, the Ethereum addresses you listed are not on the OFAC sanctions list[1][3]. Always verify addresses before transacting, as the sanctions list is subject to change over time.

Citations:


Action Required: Re-verify OFAC Compliance Data

The four Ethereum addresses added in pyinjective/ofac.json (lines 71-74) are currently not found on the official OFAC SDN list as of April 2025. This discrepancy suggests that they may have been added erroneously as OFAC-sanctioned addresses. Please:

  • Confirm the intended source for these addresses.
  • Double-check them using the official OFAC Sanctions List Search tool.
  • Update the JSON file and documentation accordingly based on the verified compliance data.

Comment on lines +254 to +380
class BatchCreateSpotLimitOrdersGasLimitEstimator(GasHeuristicsGasLimitEstimator):
def __init__(self, message: any_pb2.Any):
self._message = self._parsed_message(message=message)

@classmethod
def applies_to(cls, message: any_pb2.Any):
return cls.message_type(message=message).endswith("MsgBatchCreateSpotLimitOrders")

def gas_limit(self) -> int:
post_only_orders = self._select_post_only_orders(orders=self._message.orders)

total = 0
total += (len(self._message.orders) - len(post_only_orders)) * SPOT_ORDER_CREATION_GAS_LIMIT
total += math.ceil(len(post_only_orders) * POST_ONLY_SPOT_ORDER_CREATION_GAS_LIMIT)

return total

def _message_class(self, message: any_pb2.Any):
return injective_exchange_tx_pb.MsgBatchCreateSpotLimitOrders


class BatchCancelSpotOrdersGasLimitEstimator(GasHeuristicsGasLimitEstimator):
def __init__(self, message: any_pb2.Any):
self._message = self._parsed_message(message=message)

@classmethod
def applies_to(cls, message: any_pb2.Any):
return cls.message_type(message=message).endswith("MsgBatchCancelSpotOrders")

def gas_limit(self) -> int:
total = 0
total += len(self._message.data) * SPOT_ORDER_CANCELATION_GAS_LIMIT

return total

def _message_class(self, message: any_pb2.Any):
return injective_exchange_tx_pb.MsgBatchCancelSpotOrders


class BatchCreateDerivativeLimitOrdersGasLimitEstimator(GasHeuristicsGasLimitEstimator):
def __init__(self, message: any_pb2.Any):
self._message = self._parsed_message(message=message)

@classmethod
def applies_to(cls, message: any_pb2.Any):
return cls.message_type(message=message).endswith("MsgBatchCreateDerivativeLimitOrders")

def gas_limit(self) -> int:
post_only_orders = self._select_post_only_orders(orders=self._message.orders)

total = 0
total += (len(self._message.orders) - len(post_only_orders)) * DERIVATIVE_ORDER_CREATION_GAS_LIMIT
total += math.ceil(len(post_only_orders) * POST_ONLY_DERIVATIVE_ORDER_CREATION_GAS_LIMIT)

return total

def _message_class(self, message: any_pb2.Any):
return injective_exchange_tx_pb.MsgBatchCreateDerivativeLimitOrders


class BatchCancelDerivativeOrdersGasLimitEstimator(GasHeuristicsGasLimitEstimator):
def __init__(self, message: any_pb2.Any):
self._message = self._parsed_message(message=message)

@classmethod
def applies_to(cls, message: any_pb2.Any):
return cls.message_type(message=message).endswith("MsgBatchCancelDerivativeOrders")

def gas_limit(self) -> int:
total = 0
total += len(self._message.data) * DERIVATIVE_ORDER_CANCELATION_GAS_LIMIT

return total

def _message_class(self, message: any_pb2.Any):
return injective_exchange_tx_pb.MsgBatchCancelDerivativeOrders


class BatchUpdateOrdersGasLimitEstimator(GasHeuristicsGasLimitEstimator):
AVERAGE_CANCEL_ALL_AFFECTED_ORDERS = 20

def __init__(self, message: any_pb2.Any):
self._message = self._parsed_message(message=message)

@classmethod
def applies_to(cls, message: any_pb2.Any):
return cls.message_type(message=message).endswith("MsgBatchUpdateOrders")

def gas_limit(self) -> int:
post_only_spot_orders = self._select_post_only_orders(orders=self._message.spot_orders_to_create)
post_only_derivative_orders = self._select_post_only_orders(orders=self._message.derivative_orders_to_create)
post_only_binary_options_orders = self._select_post_only_orders(
orders=self._message.binary_options_orders_to_create
)

total = 0
total += (len(self._message.spot_orders_to_create) - len(post_only_spot_orders)) * SPOT_ORDER_CREATION_GAS_LIMIT
total += (
len(self._message.derivative_orders_to_create) - len(post_only_derivative_orders)
) * DERIVATIVE_ORDER_CREATION_GAS_LIMIT
total += (
len(self._message.binary_options_orders_to_create) - len(post_only_binary_options_orders)
) * BINARY_OPTIONS_ORDER_CREATION_GAS_LIMIT

total += math.ceil(len(post_only_spot_orders) * POST_ONLY_SPOT_ORDER_CREATION_GAS_LIMIT)
total += math.ceil(len(post_only_derivative_orders) * POST_ONLY_DERIVATIVE_ORDER_CREATION_GAS_LIMIT)
total += math.ceil(len(post_only_binary_options_orders) * POST_ONLY_BINARY_OPTIONS_ORDER_CREATION_GAS_LIMIT)

total += len(self._message.spot_orders_to_cancel) * SPOT_ORDER_CANCELATION_GAS_LIMIT
total += len(self._message.derivative_orders_to_cancel) * DERIVATIVE_ORDER_CANCELATION_GAS_LIMIT
total += len(self._message.binary_options_orders_to_cancel) * BINARY_OPTIONS_ORDER_CANCELATION_GAS_LIMIT

total += (
len(self._message.spot_market_ids_to_cancel_all)
* SPOT_ORDER_CANCELATION_GAS_LIMIT
* self.AVERAGE_CANCEL_ALL_AFFECTED_ORDERS
)
total += (
len(self._message.derivative_market_ids_to_cancel_all)
* DERIVATIVE_ORDER_CANCELATION_GAS_LIMIT
* self.AVERAGE_CANCEL_ALL_AFFECTED_ORDERS
)
total += (
len(self._message.binary_options_market_ids_to_cancel_all)
* BINARY_OPTIONS_ORDER_CANCELATION_GAS_LIMIT
* self.AVERAGE_CANCEL_ALL_AFFECTED_ORDERS
)
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Batch order estimators.

Aggregator logic for batch creation/cancellation repeats the single-order logic in a predictable manner. Note that AVERAGE_CANCEL_ALL_AFFECTED_ORDERS is a static estimate, so consider exposing it as a setting if real usage changes drastically.

@aarmoa aarmoa merged commit f9b9b3f into master Apr 16, 2025
12 of 13 checks passed
@aarmoa aarmoa deleted the release/v1_10_for_chain_upgrade_v1_15 branch April 16, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants