Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
5e1a525
chore: switch to pnpm and update Node.js to v20
jeffersonBastos May 23, 2025
cdc8d1a
chore: reorganize project structure under packages/cow-sdk
jeffersonBastos May 23, 2025
b54db28
feat: init monorepo structure with Turborepo
jeffersonBastos May 23, 2025
7c5d531
chore: format codebase with pnpm script
jeffersonBastos May 23, 2025
0203727
chore: eslint config.
jeffersonBastos May 26, 2025
074778b
chore: update lint config, .npmrc, and VSCode settings
jeffersonBastos May 27, 2025
70ef622
feat: copy entire src, tests folders, and package/tsconfig files from…
jeffersonBastos May 27, 2025
7601c21
feat: add typescript-config
jeffersonBastos May 27, 2025
5e99f36
feat: create common package with abstract adapter and context classes
jeffersonBastos May 27, 2025
1231f7c
feat: implement adapters for ethers v5, ethers v6, and viem
jeffersonBastos May 27, 2025
bbb0b3c
chore: update pnpm-lock
jean-neiverth May 28, 2025
3e814a5
chore: remove appdata and cow-sdk from build
jean-neiverth May 28, 2025
212c4a7
feat: create config package
jean-neiverth May 28, 2025
41b7ac7
chore: fix eslint tsconfig path
jean-neiverth May 28, 2025
f7fcf73
feat: refactor config
jean-neiverth May 28, 2025
420181c
chore: update pnpm-lock
jean-neiverth May 28, 2025
af47c0c
feat: add contracts-ts package
jean-neiverth May 28, 2025
b441360
feat: refactor contracts-ts
jean-neiverth May 28, 2025
fc94704
feat: update adapters with new contracts-ts features
jean-neiverth May 28, 2025
9d6a4b8
feat: add tests for contracts-ts
jean-neiverth May 28, 2025
c60daab
feat: move order-signing to new package
jean-neiverth May 28, 2025
8e28d1b
feat: refactor order-signing
jean-neiverth May 28, 2025
555d55f
feat: add new order-signing features to adapters
jean-neiverth May 28, 2025
2d99282
feat: refactor order-signing tests
jean-neiverth May 28, 2025
422afd2
feat: implement adapter usage in app-data; update app-data config and…
jeffersonBastos May 28, 2025
0257ac6
chore: update pnpm-lock file
jeffersonBastos May 28, 2025
46decb7
chore: fix lint and remove cow-sdk from lint.
jeffersonBastos May 28, 2025
003f020
Merge pull request #15 from bleu/jefferson/cow-468-integrate-new-mono…
jeffersonBastos May 28, 2025
8666af4
chore: update sdk-config tsconfig
jean-neiverth May 29, 2025
780a60f
feat: add contracts-ts package
jean-neiverth May 28, 2025
2e14272
feat: refactor contracts-ts
jean-neiverth May 28, 2025
aadd9a7
feat: update adapters with new contracts-ts features
jean-neiverth May 28, 2025
4f39d4d
feat: add tests for contracts-ts
jean-neiverth May 28, 2025
68360fc
chore: update contracts-ts config
jean-neiverth May 29, 2025
1bd47c4
Merge pull request #19 from bleu/feat/create-app-data-package
jean-neiverth May 29, 2025
724c165
Merge branch 'bleu/refactor' into jean/add-config-package
jean-neiverth May 29, 2025
3d8d340
Merge pull request #16 from bleu/jean/add-config-package
jean-neiverth May 29, 2025
9978f0f
Merge branch 'bleu/refactor' into jean/add-contracts-ts-package
jean-neiverth May 29, 2025
06adbc0
Merge pull request #17 from bleu/jean/add-contracts-ts-package
jean-neiverth May 29, 2025
fd2dea1
chore(order-book): move order-book to monorepo package
jeffersonBastos May 29, 2025
a0159cf
restore: bring back deleted type files with their history
jeffersonBastos May 29, 2025
066749b
restore: bring back deleted config and path files with their history
jeffersonBastos May 29, 2025
4a7e5d6
refactor: move cow-error and wallets.ts and remove duplicate types
jeffersonBastos May 29, 2025
6ff4954
feat(order-book): setup order-book package, jest and tsconfig
jeffersonBastos May 29, 2025
fd74389
feat(order-book): refact order-book
jeffersonBastos May 29, 2025
23dc2a5
feat(monorepo-config): adjust all package.json and scripts
jeffersonBastos May 29, 2025
881e345
chore(lint): lint
jeffersonBastos May 29, 2025
017d146
chore(subgraph): move subgraph to monorepo package
jeffersonBastos May 29, 2025
0255736
chore(subgraph): create package, tsconfig and jest config
jeffersonBastos May 29, 2025
84d6f26
feat(subgraph): refactor subgraph package
jeffersonBastos May 29, 2025
3f8144b
chore(subgraph): update pnpm-lock and run lint
jeffersonBastos May 29, 2025
05425c9
Merge branch feat/create-order-book-package into jean/add-order-signi…
jean-neiverth May 29, 2025
acc8d66
Merge pull request #21 from bleu/feat/create-subgraph-package
jean-neiverth May 29, 2025
f8692c1
chore: add hashDomain to abstract utils
jean-neiverth May 29, 2025
9a6b120
Merge pull request #18 from bleu/jean/add-order-signing-package
jean-neiverth May 29, 2025
a462634
feat: move composable package from original sdk to refactor sdk
jean-neiverth May 30, 2025
2e7b27a
chore(subgraph): move cow-shed to monorepo package
jeffersonBastos Jun 2, 2025
d187b04
chore(cow-shed): copy wallets.ts
jeffersonBastos Jun 3, 2025
2548f17
feat(cow-shed): create package.json and tsconfig.json
jeffersonBastos Jun 3, 2025
fbb626a
feat(cow-shed): add estimateGas method to SignerAdapters
jeffersonBastos Jun 3, 2025
55032a2
feat: refactor composable module to be framework-agnostic
jean-neiverth Jun 4, 2025
8691d42
feat: enhance adapters and utils with composable features
jean-neiverth Jun 4, 2025
9ab599a
chore: move composable tests file to composable/tests
jean-neiverth Jun 4, 2025
42a6e5d
feat: update tests to work with ethersV5 adapter
jean-neiverth Jun 4, 2025
7d1bd77
feat: enhance composable to test the 3 adapters
jean-neiverth Jun 5, 2025
ce11a98
chore: remove console logs
jean-neiverth Jun 5, 2025
4be05aa
feat(cow-shed): refact on common and contract-ts
jeffersonBastos Jun 3, 2025
4bf22a6
chore(cow-shed): rename CowShedHooks test file
jeffersonBastos Jun 6, 2025
25b0986
feat(cow-shed): refact cow-she to use adapters and fix tests
jeffersonBastos Jun 6, 2025
76ab995
fix(cow-shed): fix adapters - estimateGas and encodeAbi
jeffersonBastos Jun 6, 2025
8f1d0a5
chore: lint files
jean-neiverth Jun 6, 2025
c1336c3
chore: move constants to sdk-common
jean-neiverth Jun 9, 2025
bf3f864
Merge pull request #22 from bleu/jean/add-composable-package
jean-neiverth Jun 9, 2025
37106f7
feat: update Node.js to version 22
jeffersonBastos Jun 9, 2025
f94e49a
chore: align settings.json with .editorconfig configuration.
jeffersonBastos Jun 9, 2025
8939f46
Merge pull request #24 from bleu/jefferson/cow-468-integrate-new-mono…
jeffersonBastos Jun 10, 2025
812d18c
chore: adjust cow-shed hooks test
jeffersonBastos Jun 10, 2025
5558b86
chore: add check to verify if the signature is the same across all th…
jeffersonBastos Jun 10, 2025
2ff0f7c
chore: apply PR suggestions
jeffersonBastos Jun 10, 2025
84f1173
Merge branch 'bleu/refactor' into jefferson/cow-458-create-cow-shed-p…
jeffersonBastos Jun 10, 2025
9ff32c4
Merge pull request #23 from bleu/jefferson/cow-458-create-cow-shed-pa…
jeffersonBastos Jun 10, 2025
894cd19
chore: update pnpm-lock.json
jeffersonBastos Jun 10, 2025
c5698dd
fix: viemUtils encodeAbi
jeffersonBastos Jun 10, 2025
11f81f2
Merge pull request #25 from bleu/jefferson/cow-458-create-cow-shed-pa…
jeffersonBastos Jun 10, 2025
b6f8a08
Merge branch 'SDK-AGNOSTIC-LIB' into bleu/refactor
jeffersonBastos Jun 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import unusedImports from 'eslint-plugin-unused-imports'

export default [
{
ignores: ['**/generated/*'],
ignores: ['**/generated/*', '**/jest.config.ts', '**/generated/**/*'],
},
eslint.configs.recommended,
...tseslint.configs.recommended,
Expand All @@ -16,12 +16,12 @@ export default [
languageOptions: {
parser: tseslint.parser,
parserOptions: {
project: './tsconfig.json',
project: ['./packages/*/tsconfig.json', './packages/providers/*/tsconfig.json'],
},
},
rules: {
'@typescript-eslint/no-non-null-assertion': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'no-prototype-builtins': 'off',
'unused-imports/no-unused-imports': 'error',
'unused-imports/no-unused-vars': [
Expand All @@ -45,6 +45,14 @@ export default [
ignoreRestSiblings: true,
},
],
'@typescript-eslint/no-unused-expressions': [
'error',
{
allowShortCircuit: true,
allowTernary: true,
allowTaggedTemplates: true,
},
],
'eol-last': ['error', 'always'],
},
},
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"private": true,
"type": "module",
"scripts": {
"build": "turbo run build",
"build": "turbo run build --filter='!@cowprotocol/cow-sdk'",
"dev": "turbo run dev",
"lint": "turbo run lint --filter=!@cowprotocol/cow-sdk -- --fix",
"test": "turbo run test",
"format": "prettier --write \"**/*.{ts,tsx,md}\""
"test": "turbo run test --filter=!@cowprotocol/cow-sdk",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"clean": "turbo run clean --filter=!@cowprotocol/cow-sdk && rm -rf .turbo"
},
"devDependencies": {
"@eslint/js": "^9.18.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/app-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"schemas/**"
],
"scripts": {
"clean": "rm -rf dist/* && rm -rf src/generatedTypes/* && rm -rf schemas/",
"clean": "rm -rf dist/* && rm -rf .turbo && rm -rf node_modules && rm -rf schemas/",
"compile": "tsx src/scripts/compile.ts",
"prebuild": "pnpm run clean && pnpm run compile",
"prebuild": "pnpm run clean && pnpm install && pnpm run compile",
"build": "tsup src/index.ts --format esm,cjs --dts --external multiformats",
"dev": "pnpm run compile && tsup src/index.ts --format esm,cjs --watch --dts --external multiformats",
"lint": "eslint src/**/*.ts",
Expand Down
31 changes: 16 additions & 15 deletions packages/app-data/src/generatedTypes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ import * as v1_2_0 from './v1.2.0'
import * as v1_3_0 from './v1.3.0'
import * as v1_4_0 from './v1.4.0'

export * from './latest'
export * from './latest'

export const LATEST_APP_DATA_VERSION = '1.4.0'
export const LATEST_QUOTE_METADATA_VERSION = '1.1.0'
export const LATEST_REFERRER_METADATA_VERSION = '0.2.0'
export const LATEST_ORDER_CLASS_METADATA_VERSION = '0.3.0'
export const LATEST_UTM_METADATA_VERSION = '0.2.0'
export const LATEST_HOOKS_METADATA_VERSION = '0.2.0'
export const LATEST_SIGNER_METADATA_VERSION = '0.1.0'
export const LATEST_WIDGET_METADATA_VERSION = '0.1.0'
export const LATEST_PARTNER_FEE_METADATA_VERSION = '1.0.0'
export const LATEST_REPLACED_ORDER_METADATA_VERSION = '0.1.0'
export const LATEST_APP_DATA_VERSION = '1.4.0'
export const LATEST_QUOTE_METADATA_VERSION = '1.1.0'
export const LATEST_REFERRER_METADATA_VERSION = '0.2.0'
export const LATEST_ORDER_CLASS_METADATA_VERSION = '0.3.0'
export const LATEST_UTM_METADATA_VERSION = '0.2.0'
export const LATEST_HOOKS_METADATA_VERSION = '0.2.0'
export const LATEST_SIGNER_METADATA_VERSION = '0.1.0'
export const LATEST_WIDGET_METADATA_VERSION = '0.1.0'
export const LATEST_PARTNER_FEE_METADATA_VERSION = '1.0.0'
export const LATEST_REPLACED_ORDER_METADATA_VERSION = '0.1.0'

export type LatestAppDataDocVersion = v1_4_0.AppDataRootSchema
export type AnyAppDataDocVersion =
export type LatestAppDataDocVersion = v1_4_0.AppDataRootSchema
export type AnyAppDataDocVersion =
| v1_4_0.AppDataRootSchema
| v1_3_0.AppDataRootSchema
| v1_2_0.AppDataRootSchema
Expand All @@ -49,7 +49,7 @@ export type AnyAppDataDocVersion =
| v0_2_0.AppDataRootSchema
| v0_1_0.AppDataRootSchema

export {
export {
v1_4_0,
v1_3_0,
v1_2_0,
Expand All @@ -66,4 +66,5 @@ export {
v0_3_0,
v0_2_0,
v0_1_0
}
}

3 changes: 0 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"@types/node": "^20.17.31",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"eslint": "^9.27.0",
"tsup": "^7.2.0",
"typescript": "^5.2.2"
}
Expand Down
28 changes: 26 additions & 2 deletions packages/common/src/adapters/AbstractProviderAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
import type { AdapterUtils } from './types'
import { AbstractSigner } from './AbstractSigner'
import type { AdapterTypes, AdapterUtils, Block, ReadContractParams, TransactionParams } from './types'

/**
* AbstractProviderAdapter defines the common interface that all provider-specific
* implementations must follow. This ensures consistent interaction with different
* Ethereum libraries throughout the SDK.
*/
export abstract class AbstractProviderAdapter {
export abstract class AbstractProviderAdapter<T extends AdapterTypes = AdapterTypes> {
public abstract utils: AdapterUtils

public ZERO_ADDRESS!: T['Address']

public abstract Signer: new (signer: any) => AbstractSigner
public abstract TypedDataVersionedSigner: new (signer: any, version: any) => AbstractSigner
public abstract TypedDataV3Signer: new (signer: any) => AbstractSigner
public abstract IntChainIdTypedDataV4Signer: new (signer: any) => AbstractSigner

// Core functionality
abstract getChainId(): Promise<number>
abstract getAddress(): Promise<string>

// Signing operations
abstract signMessage(message: string | Uint8Array): Promise<string>
abstract signTypedData(
domain: T['TypedDataDomain'],
types: T['TypedDataTypes'],
value: Record<string, unknown>,
): Promise<string>

// reading functionality
abstract getStorageAt(address: T['Address'], slot: unknown): Promise<unknown>

// blockcahin interaction
abstract call(txParams: TransactionParams, provider?: T['Provider']): Promise<string>
abstract readContract(params: ReadContractParams, provider?: T['Provider']): Promise<unknown>
abstract getBlock(blockTag: string, provider?: T['Provider']): Promise<Block>
}
14 changes: 14 additions & 0 deletions packages/common/src/adapters/AbstractSigner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { TransactionParams, TransactionResponse } from './types'

/**
* AbstractSignerAdapter defines the minimal interface that all signer-specific
* implementations must follow, focusing only on signing operations.
*/
export abstract class AbstractSigner {
abstract getAddress(): Promise<string>
abstract signMessage(message: string | Uint8Array): Promise<string>
abstract signTransaction(txParams: TransactionParams): Promise<string>
abstract signTypedData(domain: unknown, types: unknown, value: Record<string, unknown>): Promise<string>
abstract sendTransaction(txParams: TransactionParams): Promise<TransactionResponse>
abstract estimateGas(txParams: TransactionParams): Promise<bigint>
}
5 changes: 5 additions & 0 deletions packages/common/src/adapters/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
export const ZERO = BigInt(0)
export const ONE = BigInt(1)
export const ZERO_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000'
export const MAX_UINT32 = BigInt(2) ** BigInt(32) - BigInt(1) // 2^32 - 1
2 changes: 2 additions & 0 deletions packages/common/src/adapters/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export * from './AbstractProviderAdapter'
export * from './types'
export * from './context'
export * from './AbstractSigner'
export * from './constants'
Loading