hey team, fixed sign chain id panic, empty-body http ok on errors, and silent query string failure#18
Open
mooncitydev wants to merge 1 commit intoPolymarket:mainfrom
Open
Conversation
…te integrators sign() had expect on chain_id with a comment about authenticate, but sign takes any signer. different signer or signer without with_chain_id used to panic. now it returns a validation error. delete_notifications, update_balance_allowance, and revoke_builder_api_key only did execute() without checking http status, so 401/500 still returned Ok(()). same pattern is now shared with delete_readonly via a request_empty helper. ToQueryParams::query_params had unwrap_or_default on serde_html_form errors, so a struct that failed to encode could turn into an empty query string and hit the wrong server behavior. that path now returns Err. this is a small api break for anyone calling query_params on custom types, but the old silent empty string was worse. cheers Made-with: Cursor
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.
hi, mooncitydev here. was going through the sdk and fixed a few things that seemed worth shipping together.
sign and chain id \sign()\ used \expect\ on \signer.chain_id()\ as if only the authenticated signer could be passed, but any signer is allowed. if someone passed a signer without \with_chain_id, it panicked. it now returns a validation error with a hint to set chain id.
empty response endpoints and http status \delete_notifications, \update_balance_allowance, and
evoke_builder_api_key\ called \execute\ and returned \Ok(())\ even when the server responded 4xx/5xx. \delete_readonly_api_key\ already did the right thing; i added a shared
equest_empty\ in \lib.rs\ and routed the no-body endpoints through it (and refactored delete readonly to use the same path).
query string encoding \ToQueryParams::query_params\ used \unwrap_or_default()\ when \serde_html_form::to_string\ failed, so you could get an empty query string and the wrong request without an error. it now returns \Result\ with an internal error. downstream call sites that build urls from this trait need to handle the result (small breaking change; the old behavior was misleading).
i could not run \cargo test\ on the machine i used (toolchain/linker issue on this box) so please let ci run.
cheers