Description:
When creating derivative orders using ComposerV2 in pyinjective==1.11.0, the composer incorrectly formats Decimal values for price, quantity, and margin. It produces strings with decimal points (e.g., "86485364514190.08618266573839"), which are then passed into the transaction message.
However, the Injective Chain node expects these values to be marshaled as large integers (*big.Int) and cannot parse strings containing decimal points. This results in a transaction decoding failure at the node level, making it impossible to submit derivative orders using ComposerV2.
The issue lies in the _basic_derivative_order method within pyinjective/composer_v2.py. The method uses Token.convert_value_to_extended_decimal_format, which correctly scales the decimal value but does not convert it to an integer string. The subsequent f-string formatting (f"{...normalize():f}") retains the decimal point.
File: pyinjective/composer_v2.py
Method: _basic_derivative_order (lines 1823-1859)
Incorrect Code Snippet (e.g., line 1840):
This generates a string like "100000000000000.0".
In contrast, the legacy composer.py correctly uses market-specific decimal information (market.price_to_chain_format) to produce an integer string (e.g., "100000000000000"), which the chain can correctly unmarshal.
The transaction will fail with the math/big: cannot unmarshal error from the node.