@cowprotocol/sdk-contracts-ts 2.0.0-monorepo.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ <p align="center">
2
+ <img width="400" src="https://github.com/cowprotocol/cow-sdk/raw/main/docs/images/CoW.png" />
3
+ </p>
4
+
5
+ # SDK Contracts
6
+
7
+ This package provides TypeScript contract interfaces and utilities for interacting with CoW Protocol smart contracts. It includes type-safe contract wrappers and helper functions for all CoW Protocol contracts.
8
+
9
+ ## Package Origin
10
+
11
+ This package represents a migration and modularization of the TypeScript utilities that were previously located in the [contracts repository](https://github.com/cowprotocol/contracts/tree/main/src/ts). The contract interaction logic has been extracted from the main contracts repository and reorganized into this dedicated SDK package to:
12
+
13
+ - **Improve modularity** - Separate smart contract deployment code from client-side interaction utilities
14
+ - **Enable independent versioning** - Allow contract interfaces to evolve independently from contract deployments
15
+ - **Better developer experience** - Provide a focused package specifically for TypeScript developers
16
+ - **SDK integration** - Seamlessly integrate with the broader CoW Protocol SDK ecosystem
17
+
18
+ ## What's included
19
+
20
+ - **Contract Interfaces** - TypeScript interfaces for all CoW Protocol smart contracts
21
+ - **Contract Utilities** - Helper functions for contract interactions
22
+ - **Type Safety** - Full TypeScript support with proper typing
23
+ - **Multi-Chain Support** - Contract addresses and interfaces for all supported chains
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install @cowprotocol/sdk-contracts-ts
29
+ ```
30
+
31
+ ## Usage
32
+
33
+ ### Individual package usage
34
+
35
+ ```typescript
36
+ import { ContractsTs } from '@cowprotocol/sdk-contracts-ts'
37
+ import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'
38
+ import { JsonRpcProvider, Wallet } from 'ethers'
39
+
40
+ // Configure the adapter
41
+ const provider = new JsonRpcProvider('YOUR_RPC_URL')
42
+ const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
43
+ const adapter = new EthersV6Adapter({ provider, signer: wallet })
44
+
45
+ // Initialize contracts with adapter
46
+ const contracts = new ContractsTs(adapter)
47
+
48
+ // Use contract interfaces
49
+ const settlementContract = contracts.settlement()
50
+ const vaultRelayerContract = contracts.vaultRelayer()
51
+ ```
52
+
53
+ ### Usage with Umbrella SDK
54
+
55
+ When using the umbrella SDK, contract utilities are automatically available:
56
+
57
+ ```typescript
58
+ import {
59
+ CowSdk,
60
+ // Contract functions can be imported directly
61
+ // when using umbrella SDK - adapter is already configured
62
+ } from '@cowprotocol/cow-sdk'
63
+ import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'
64
+ import { JsonRpcProvider, Wallet } from 'ethers'
65
+
66
+ // Configure the adapter
67
+ const provider = new JsonRpcProvider('YOUR_RPC_URL')
68
+ const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
69
+ const adapter = new EthersV6Adapter({ provider, signer: wallet })
70
+
71
+ // Initialize the unified SDK
72
+ const sdk = new CowSdk({
73
+ chainId: SupportedChainId.SEPOLIA,
74
+ adapter,
75
+ })
76
+
77
+ // Access contracts through the SDK
78
+ const settlementContract = sdk.contracts.settlement()
79
+ const vaultRelayerContract = sdk.contracts.vaultRelayer()
80
+ ```
81
+
82
+ ## Available Contracts
83
+
84
+ - **Settlement Contract** - Main CoW Protocol settlement contract
85
+ - **Vault Relayer** - Contract for handling vault interactions
86
+ - **Composable CoW** - Contract for conditional orders
87
+ - **Extensible Fallback Handler** - Safe fallback handler for smart contract wallets
88
+
89
+ > **Note:** This package is primarily designed to provide contract interfaces and is rarely used standalone. Most developers should use the umbrella `@cowprotocol/cow-sdk` package which includes all contract utilities with proper adapter configuration.