feat(trading): add signer-less presign calldata - #965
Conversation
📝 WalkthroughWalkthroughThe trading package adds ChangesSignerless pre-signature calldata
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ExternalWalletStack
participant TradingSdk
participant getPreSignCallData
participant SettlementContract
ExternalWalletStack->>TradingSdk: Request pre-sign calldata
TradingSdk->>getPreSignCallData: Resolve order and settlement configuration
getPreSignCallData->>SettlementContract: Encode setPreSignature(orderUid, true)
SettlementContract-->>TradingSdk: Return unsigned transaction data
TradingSdk-->>ExternalWalletStack: Submit calldata for execution
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📦 GitHub Packages PublishedLast updated: Aug 7, 2026, 07:51:20 AM UTC The following packages have been published to GitHub Packages with pre-release version
InstallationThese packages require authentication to install from GitHub Packages. First, create a # Create .npmrc file in your project root
echo "@cowprotocol:registry=https://npm.pkg.github.com" > .npmrc
echo "//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN" >> .npmrcTo get your GitHub token:
Then install any of the packages above, either by exact version (i.e. # Yarn
yarn add npm:@cowprotocol/cow-sdk@pr-965
# pnpm
pnpm install npm:@cowprotocol/cow-sdk@pr-965
# NPM
npm install npm:@cowprotocol/cow-sdk@pr-965Update to the latest version (only if you used the tag)Every commit will publish a new package. To upgrade to the latest version, run: # Yarn
yarn upgrade @cowprotocol/cow-sdk
# pnpm
pnpm update @cowprotocol/cow-sdk
# NPM
npm update @cowprotocol/cow-sdkView PackagesYou can view the published packages at: https://github.com/cowprotocol/cow-sdk/packages |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/trading/src/README.md`:
- Around line 379-390: Update the “Build pre-sign calldata without a signer”
example to configure the required global adapter before calling
TradingSdk.getPreSignCallData, or explicitly state that callers must configure
one first; preserve the signerless behavior and submission flow.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: b08110c4-5d9b-4110-99ef-db59659467a0
📒 Files selected for processing (10)
packages/trading/README.mdpackages/trading/src/README.mdpackages/trading/src/getPreSignCallData.test.tspackages/trading/src/getPreSignCallData.tspackages/trading/src/getPreSignTransaction.tspackages/trading/src/getSettlementContract.tspackages/trading/src/index.tspackages/trading/src/tradingSdk.test.tspackages/trading/src/tradingSdk.tspackages/trading/tests/setup.ts
| #### Build pre-sign calldata without a signer | ||
|
|
||
| For a Safe, multisig, or custody flow, request the raw transaction data and submit it through your own stack: | ||
|
|
||
| ```typescript | ||
| const preSignCallData = sdk.getPreSignCallData({ orderUid: orderId }) | ||
|
|
||
| // Returns { to, data, value } and does not estimate gas. | ||
| await yourMultisigOrCustodyStack.submitTransaction(preSignCallData) | ||
| ``` | ||
|
|
||
| The helper does not access a signer or make an RPC call. The final transaction must be executed by the order owner encoded in the order UID—for a Safe-owned order, the Safe itself must call the settlement contract. |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Configure an adapter in this signerless flow.
getPreSignCallData still calls getGlobalAdapter() for ABI encoding. The shown TradingSdk setup does not configure an adapter. Add signerless adapter setup to the example, or state that callers must configure a global adapter before this call.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/trading/src/README.md` around lines 379 - 390, Update the “Build
pre-sign calldata without a signer” example to configure the required global
adapter before calling TradingSdk.getPreSignCallData, or explicitly state that
callers must configure one first; preserve the signerless behavior and
submission flow.
azebuado
left a comment
There was a problem hiding this comment.
Looks good!
Only one question: would it make sense to update also the examples as you did in the previous PR, to show how to use it with various providers like viem and ethers?
Adds a signerless pre-sign path (the P1 milestone): build the
setPreSignature(orderUid, true)calldata for aPRESIGNorder without handing a signer to the SDK, so a Safe, multisig, or custody stack can submit the transaction itself.getPreSignTransactionalready covered pre-signing, but it resolves an SDK signer and estimates gas with it — which doesn't fit setups where the SDK never holds a signer and the submitting stack estimates gas in its own execution context.Fixes FE-439
Project: https://linear.app/cowswap/project/sdk-external-signer-less-order-signing-b006c53af4e0
sdk.getPreSignCallData({ orderUid, chainId?, env?, settlementContractOverride? })— returns{ to, data, value }, synchronously.chainId/envfall back to the trader params and order-book context; nosignerorappCodeneeded. Also available standalone asgetPreSignCallData(chainId, orderUid, options?), plus aPreSignCallDatatype.getPreSignTransactionnow buildsto/datafrom the same helper; output unchanged.Summary by CodeRabbit
New Features
Documentation