Skip to content

feat: create near-mpc-sdk crate with types for sign requests#2202

Merged
DSharifi merged 33 commits intomainfrom
dsharifi/make-sdk-crate
Feb 23, 2026
Merged

feat: create near-mpc-sdk crate with types for sign requests#2202
DSharifi merged 33 commits intomainfrom
dsharifi/make-sdk-crate

Conversation

@DSharifi
Copy link
Copy Markdown
Contributor

stacked on top of #2199

closes #2159

Creates a new crate, near-mpc-sdk, which is meant for users that want to call the mpc contract.

This PR adds types for building sign request payloads, and deserializing responses.

Testing

  • Unit test added to the sign module in the new crate
  • The sandbox integration tests in for the contract have been changed to use the SDK for building payloads, and responses.

@near near deleted a comment from claude bot Feb 20, 2026
@DSharifi
Copy link
Copy Markdown
Contributor Author

@claude pleas re-review this PR

Base automatically changed from just-bounded-vec to main February 20, 2026 18:56
@DSharifi DSharifi requested review from gilcu3 and netrome and removed request for gilcu3 February 23, 2026 09:41
@gilcu3
Copy link
Copy Markdown
Contributor

gilcu3 commented Feb 23, 2026

@claude pleas re-review this PR

@claude review

gilcu3
gilcu3 previously approved these changes Feb 23, 2026
Copy link
Copy Markdown
Contributor

@gilcu3 gilcu3 left a comment

Choose a reason for hiding this comment

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

LGTM.

Left a questions about the pattern used

@claude
Copy link
Copy Markdown

claude bot commented Feb 23, 2026

Code Review: near-mpc-sdk crate for sign requests

I reviewed the diff against main, checked serialization compatibility, name collision risks, and adherence to engineering standards.

Findings

Serialization compatibility between the new SDK Payload (using BoundedVec<u8, L, U> + hex_serde) and the contract's Payload (using Bytes<L, U>) is fine — both serialize to hex strings with identical bounds. The new SignRequestArgs (non-optional domain_id, no legacy fields) produces JSON the contract accepts correctly via its TryFrom validation.

No critical/blocking issues found. A couple of minor observations:

  • pub use sign::* in contract-interface/src/lib.rs: This adds SignRequestArgs and Payload to the contract_interface::types namespace. Currently no downstream code imports those names from there, so no collision today. But these names are also defined internally in mpc-contract::primitives::signature. If any future code does use contract_interface::types::Payload, they'll get the SDK version (with BoundedVec) rather than the contract version (with Bytes). The types are serialization-compatible, so this is not a bug — just worth being aware of for maintainability. A more explicit re-export (e.g., pub use sign::{SignRequestArgs, Payload};) instead of glob would make the public API surface more intentional.

  • Builder enforces ordering (pathpayloaddomain_id): The typestate pattern is clean but forces a specific call order. This is a design choice, not a bug. If flexibility for callers matters, the methods could be made available on any state where the field isn't yet set. Fine as-is for an initial version.

✅ Approved — no blocking issues.

Copy link
Copy Markdown
Collaborator

@netrome netrome left a comment

Choose a reason for hiding this comment

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

Nice stuff. I think the EDDSA bounds need a better explanation but that's my only blocker.

@DSharifi DSharifi requested review from gilcu3 and netrome February 23, 2026 15:18
@DSharifi DSharifi enabled auto-merge February 23, 2026 15:25
@DSharifi DSharifi added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit 19f7db8 Feb 23, 2026
10 checks passed
@DSharifi DSharifi deleted the dsharifi/make-sdk-crate branch February 23, 2026 16:07
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.

create SDK crate meant developers building on top of MPC contract

3 participants