gnosis / cowswap

🐮 CowSwap: First Gnosis Protocol v2 UI
https://gnosis.io
GNU General Public License v3.0
113 stars 55 forks source link

SDK for CoW Protocol #793

Open anxolin opened 3 years ago

anxolin commented 3 years ago

Description There's many utilities, logics defined in CowSwap that are very interesting to extract to a generic SDK.

Context Balancer replicated many of these logics by copy pasting, but long term it would be good to be able to provide a simple to use TS library that contains these basic utilities that every UI and service using JS/TS would need.

Proposal Simple TS SDK that would expose all reusable pieces of code.

Example:

W3stside commented 3 years ago

https://app.zenhub.com/workspaces/gp-ui-600568e698f7c10017853a08/issues/gnosis/cowswap/793 dex-js will become SDK Rename to gp-sdk Drop legacy code Facade for our SDK:

import { Gp } from 'gp-sdk' const gp = new Gp() gp.getPrice(tokenA, tokenB, ...) gp.signOrder(order) gp.postSignedOrder(signedOrder) gp.signCancelOrder(orderId) gp.postSignedCancelOrder(orderId)

alfetopito commented 2 years ago

Update:

A new repo has been created https://github.com/gnosis/cow-sdk

Adding to the list of features, the already partially implemented appData handling (see https://github.com/gnosis/cow-sdk/pull/1) It's a requirement for https://github.com/gnosis/gp-ui/issues/849

anxolin commented 2 years ago

Please, remember this entitle doing some documentation too, we could prepare it in a google docs and later convert it to proper Gitbook pages

We will need a getting started guide easy enough to follow. Also, ideally automatic generation of the JSDocs for GitBook

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you think it shouldn't be closed, speak now or forever hold your peace.