fix: TransactionFee model rejects string gasPrice/baseFee/priorityFee from API#136
Open
jacklatourette wants to merge 1 commit intofireblocks:masterfrom
Open
Conversation
…actionFee The Fireblocks API returns gasPrice, baseFee, and priorityFee as strings (e.g. "1", "0.005") in the estimate_transaction_fee response, but the TransactionFee model declares these fields as StrictFloat | StrictInt. Pydantic's StrictFloat/StrictInt reject string inputs without coercion, causing model validation to fail. The SDK then falls back to returning an UnknownBaseModel instead of the expected EstimatedTransactionFeeResponse, breaking downstream attribute access (e.g. response.medium.network_fee). Add StrictStr to the Union type for these three fields so the model validates successfully regardless of whether the API returns numeric or string representations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Fireblocks API returns
gasPrice,baseFee, andpriorityFeeas strings (e.g."1","0.005") in theestimate_transaction_feeresponse. However, theTransactionFeePydantic model declares these fields asOptional[Union[StrictFloat, StrictInt]].StrictFloatandStrictIntreject string inputs without coercion, so Pydantic validation fails with errors like:The SDK then falls back to returning an
UnknownBaseModelinstead ofEstimatedTransactionFeeResponse, which breaks downstream attribute access likeresponse.medium.network_fee.Fix
Add
StrictStrto the union type forgas_price,base_fee, andpriority_fee:This matches the actual API response format while preserving strict validation (no implicit coercion).
Reproduction
Call
estimate_transaction_feefor any EVM-based asset (e.g. Base Sepolia ETH). The API returns string values for gas fields, causing the SDK to emit aUserWarning: Failed to deserialize response of type EstimatedTransactionFeeResponseand return anUnknownBaseModel.