-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
Background
Today the MPC node calls NEAR contract methods using string literals, e.g.:
mpc/node/src/indexer/tx_sender.rs
Line 102 in cd9a595
| method_name: "get_pending_request".to_string(), |
This is error-prone (typos, refactors) and makes it hard to identify the methods our node relies on.
Proposed approach:
- Introduce an enum
ContractInterfaceas the single source of truth for method names. - Provide
as_str()andDisplayfor ergonomic use and logging. - Add an integration test that probes a contract for a method’s availability (e.g., try a call)
- Replace existing string literals at call sites with ContractMethod::X.as_str().
- Centralize all mappings in one module (e.g., node/src/contracts/methods.rs).
User Story
As an MPC node developer/operator, I want contract method names to be defined in a single, typed place.
Acceptance Criteria
- The contract API required by the node is centralized in a single file.
- all existing string literals for method names of the contract are replaced with enum usage.
- an integration test exists, checking if the methods are available on the contract.
Resources & Additional Notes
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels