feat(morpho-sdk): add transaction plan#856
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7da4dd011c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
56545a4 to
71e53b9
Compare
Add a TransactionPlan API for semantic transaction review/execution flows on top of the Market V2 action-flow branch. Entity handlers now return lazy TransactionPlan instances while preserving buildTx/getRequirements.
71e53b9 to
93a73c1
Compare
Make Midnight action-flow outputs first-class TransactionPlan instances, add non-previewable final transaction support for signature-dependent maker flows, and broaden plan intents to operatorAuthorization/contractCall for neutral app consumption.
Restore simple-permit option documentation, make TransactionPlan handler accessors prototype-backed and destructuring-safe, guard non-previewable final transaction access, and inline Midnight make-offer transaction construction into the TransactionPlan output.
Move duplicated simple-permit and requirement aliases into transaction-plan types, inline the mixed Blue requirement union at call sites, and keep the review-comment safety changes covered by local build/lint/tests.
Expose signatureRequests and callRequests as the primary app-consumption surface, include the final intent call in callRequests when available, keep previous requirement-oriented fields as deprecated aliases, and rename flow-kind values around requests instead of requirements.
Adds a first-class
TransactionPlanAPI for app-side transaction review and execution flows, stacked onhermes/marketv2-action-flows-implementation.Summary:
TransactionPlan,PreparedTransactionPlan, andExecutableTransactionPlanundersrc/transactionPlan/.TransactionPlaninstances while preservingbuildTx(...)/getRequirements(...)destructuring.signatureRequestsandcallRequests.callRequestscontains viem-compatible calls in execution order and includes the final intent call when it can be previewed. After signatures,prepared.build(signatures).callRequestsalways includes the final intent call last.tokenApproval,operatorAuthorization,contractCall,midnightOfferRootSignature,finalTransaction), request-kind flow values (single_call,call_requests,signature_requests,mixed_requests), sequentialsignAll(), ordered viem-compatible calls, and missing-signature validation.prepared.finalTxbefore it is available throws a typed SDK error.Interface rationale:
SignatureRequest[]plus orderedCallRequest[]. PRsmorpho-org/morpho-apps#3567and#3568had to adapt the SDK output into that shape manually, including appending the final call after prerequisite calls.finalTxis still exposed as a convenience/safety handle for consumers that need the semantic final action (action.type, built tx metadata, guard when not previewable), but it is no longer the main way to submit calls. The main submission surface iscallRequests.Vaults-app transaction-context sketch:
Markets-app action-flow sketch:
Verification:
pnpm --filter @morpho-org/morpho-sdk buildpnpm lint:ciMAINNET_RPC_URL="https://rpc.morpho.dev/cache/evm/1?secret=$RPC_SECRET" pnpm exec vitest run --project morpho-sdk packages/morpho-sdk/src/transactionPlan/TransactionPlan.test.ts packages/morpho-sdk/src/entities/vaultV1/vaultV1.test.ts packages/morpho-sdk/src/entities/vaultV2/vaultV2.test.ts packages/morpho-sdk/src/entities/blue/blue.test.ts packages/morpho-sdk/src/entities/midnight/midnight.test.tsRequested by: <@U03L0SC1JUR>