Grant Title:
Framework agnostic CoW SDK
Author:
@bleu @yvesfracari @ribeirojose @mendesfabio
About You:
bleu collaborates with companies and DAOs as a web3 technology and user experience partner. We’re passionate about bridging the experience gap we see in blockchain and web3.
Additional Links:
We developed multiple grants with CoW Swap. The ones that are more related to this project are:
- [CoW] Hook dApps: a set of Hook dApps integrated on the CoW Swap frontend. During this project, we developed the
cow-shed
module of the@cowprotocol/cow-sdk
. This module was created to help developers to use CoW Shed to create permissioned hooks. - [CoW] Python SDK (waiting for review): we’re helping CoW put together a Python version of the cow TS SDKs to provide developers with query on-chain data, manage orders, and integrate with the CoW Protocol’s smart contracts. This gives the team a big understanding of all the CoW TS packages.
- [Pike] Pike SDK (in progress): Outside our work with CoW, we also started to create an SDK for Pike, a to-be-launched lending protocol. The project is in its first stages but the design of the SDK followed the same principles of framework agnostic that we’re proposing for this project.
Grant Category:
Core Infrastructure & Developer Tooling
Grant Description:
As described in this RFP, the CoW Protocol ecosystem currently relies heavily on Ethers.js v5 for its blockchain interactions. This grant proposal aims to not only upgrade to Ethers.js v6 but also to fundamentally restructure the SDK architecture to be more composability with framework-agnostic base packages with EVM adapters. We propose a comprehensive overhaul that includes:
- Expanded Scope with EVM Independence: Beyond the core SDK, we will also modernize the
app-data
andcontracts
packages, ensuring framework-agnostic base packages. This means that we will remove the current dependency of ethers v5 of the business logic. - Multiple Adapter Support: We will develop separate adapter packages for:
- Ethers.js v5 (for backward compatibility)
- Ethers.js v6
- Viem
- Wagmi
- Modular Package Architecture: The SDK will be restructured into smaller and modular packages that developers can install based on their specific needs to simplify dependency management.
For a better understanding of the view of the package structure, a demonstration of this architecture with some methods implementations can be found here. In addition, we started to also build a demo of how the adapter would work on this branch.
Grant Goals and Impact:
This grant aims to refactor CoW Protocol ecosystem by creating a more flexible, maintainable, and developer-friendly architecture. By transitioning to a modular and composability with EVM-independent base package design, we will facilitate the integration of new systems. The impact extends beyond mere technical upgrades – it will foster broader adoption of the CoW Protocol by allowing developers to integrate the protocol using their preferred tools and frameworks.
Milestones:
Milestone | Duration | Payment (15k xDAI) |
---|---|---|
SDK Refactoring | 2 weeks | 5k xDAI |
New adapters and CoWSwap Integration | 2 weeks | 5k xDAI |
Deployment and Documentation | 2 weeks | 5k xDAI |
SDK Refactoring (2 weeks)
This milestone focuses on refactoring the SDK packages while maintaining ethers v5. We will implement a modular package system that separates reusable logic from blockchain interactions. The work will continue with this demo structure, implementing proper tooling, and ensuring all existing functionality works within the new architecture (with test replication). This milestone includes refactoring the app-data
and contracts
packages into the new structure, setting the stage for future adapter implementations. Considering the demo structure, we want to deliver on this milestone the following packages:
cow-order-book
cow-app-data
cow-trading
cow-abi
(includes part of the contract logic)cow-shed
cow-composable
cow-common
(includes part of the contract logic)cow-config
cow-order-book
cow-subgraph
cow-ts
cow-order-signing
cow-sdk
(exports all the other packages)cow-sdk-ethers-v5
(includes part of contract logic)
New adapters and Cowswap Integration (2 weeks)
The second milestone centers on creating the viem, ethers v6, and wagmi adapters and integrating the selected ones on the CoW Swap application. We will implement comprehensive testing for the new adapter and update all CoWSwap-related projects (including explorer
and other sub-projects) to work with the new SDK architecture. This will include:
cow-sdk-ethers-v6
cow-sdk-viem
cow-sdk-wagmi
Deployment and Documentation (2 weeks)
The milestone concludes with a fully documented, tested, and production-ready system supporting all three adapters. We will update the existent SDK docs to cover new packages (core, adapters, etc), and provide thorough migration guides for existing users.
This phase includes creating integration examples for each adapter, implementing end-to-end testing across all supported libraries, and preparing the entire system for production deployment. This stage will also include the update of the tutorials on the Learn website.
Funding Request:
We propose that milestone payments be released upon each milestone’s approval.
Budget Breakdown:
The budget includes the hourly rates of a developer during the execution and a project manager on a need basis. The xDAI part of the budget shall be paid after each milestone’s completion.
In addition, we request a 10k COW payment vested over 1 year to cover diluted maintenance and related costs for the same period. The vesting should be created once all the project milestones are completed.
Gnosis Chain Address (to receive the grant):
0x5D40015034DA6cD75411c54dd826135f725c2498
Other Information:
- All the code will be open-source from day 0. We’re open to feedback during PRs as well;
- We’re happy to answer any questions and are open to feedback about this proposal;
Terms and Conditions:
By submitting this grant application, I acknowledge and agree to be bound by the CoW DAO Participation Agreement and the CoW Grant Terms and Conditions.