@cowprotocol/sdk-cow-shed 0.2.4-beta.0 → 0.2.6-beta.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 +1 -57
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -10,8 +10,6 @@ In essence, CoW Shed acts as a user owned smart contract (1/1 multisig if you wi
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
### Individual Package Usage
|
|
14
|
-
|
|
15
13
|
```ts
|
|
16
14
|
import { ethers } from 'ethers'
|
|
17
15
|
import { CowShedSdk, ICoWShedCall, SupportedChainId } from '@cowprotocol/cow-shed'
|
|
@@ -54,7 +52,7 @@ const preAuthorizedCall = await cowShedSdk.signCalls({
|
|
|
54
52
|
})
|
|
55
53
|
|
|
56
54
|
// Get the details of the pre-authorized call you need to send
|
|
57
|
-
const { signedMulticall, gasLimit
|
|
55
|
+
const { signedMulticall, gasLimit } = preAuthorizedCall
|
|
58
56
|
const { to, data, value } = signedMulticall
|
|
59
57
|
|
|
60
58
|
// Execute the transaction using any wallet. The calldata has been pre-authed, so you don't need any
|
|
@@ -86,57 +84,3 @@ const adapter = new EthersV6Adapter({ provider, signer: wallet })
|
|
|
86
84
|
const cowShedSdk = new CowShedSdk(adapter) // adapter is optional - will use global adapter if not provided
|
|
87
85
|
// ... rest of the usage remains the same
|
|
88
86
|
```
|
|
89
|
-
|
|
90
|
-
### Using with CowSdk Umbrella
|
|
91
|
-
|
|
92
|
-
For a unified experience with all CoW Protocol modules:
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
import { ethers } from 'ethers'
|
|
96
|
-
import { CowSdk, SupportedChainId, ICoWShedCall } from '@cowprotocol/cow-sdk'
|
|
97
|
-
import { EthersV6Adapter } from '@cowprotocol/sdk-ethers-v6-adapter'
|
|
98
|
-
import { JsonRpcProvider, Wallet } from 'ethers'
|
|
99
|
-
|
|
100
|
-
// Proper adapter initialization
|
|
101
|
-
const provider = new JsonRpcProvider('YOUR_RPC_URL')
|
|
102
|
-
const wallet = new Wallet('YOUR_PRIVATE_KEY', provider)
|
|
103
|
-
const adapter = new EthersV6Adapter({ provider, signer: wallet })
|
|
104
|
-
|
|
105
|
-
const cowSdk = new CowSdk({
|
|
106
|
-
adapter,
|
|
107
|
-
chainId: SupportedChainId.MAINNET,
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
// Access cowShed through the umbrella SDK
|
|
111
|
-
const cowShedSdk = cowSdk.cowShed
|
|
112
|
-
|
|
113
|
-
// Prepare the calls you want to execute using the cow-shed account
|
|
114
|
-
const calls: ICoWShedCall[] = [
|
|
115
|
-
{
|
|
116
|
-
target: '<contract-address-1>',
|
|
117
|
-
callData: 'call-data-1',
|
|
118
|
-
value: 0n,
|
|
119
|
-
isDelegateCall: true,
|
|
120
|
-
allowFailure: false,
|
|
121
|
-
},
|
|
122
|
-
]
|
|
123
|
-
|
|
124
|
-
// Sign the calls
|
|
125
|
-
const preAuthorizedCall = await cowShedSdk.signCalls({
|
|
126
|
-
chainId: SupportedChainId.MAINNET,
|
|
127
|
-
calls,
|
|
128
|
-
signer: '<privateKeyOrEthersSigner>', // signer is optional - will use global adapter's signer if not provided
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
// Execute the transaction using any wallet
|
|
132
|
-
const { signedMulticall, gasLimit } = preAuthorizedCall
|
|
133
|
-
const { to, data, value } = signedMulticall
|
|
134
|
-
|
|
135
|
-
let anotherWallet = new ethers.Wallet('<another-private-key>')
|
|
136
|
-
const tx = await anotherWallet.sendTransaction({
|
|
137
|
-
to,
|
|
138
|
-
data,
|
|
139
|
-
value,
|
|
140
|
-
gasLimit,
|
|
141
|
-
})
|
|
142
|
-
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-cow-shed",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6-beta.0",
|
|
4
4
|
"description": "CowProtocol Cow Shed package",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"access": "public"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@cowprotocol/sdk-
|
|
18
|
-
"@cowprotocol/sdk-
|
|
19
|
-
"@cowprotocol/sdk-
|
|
17
|
+
"@cowprotocol/sdk-config": "0.3.3-beta.0",
|
|
18
|
+
"@cowprotocol/sdk-contracts-ts": "2.2.0-beta.0",
|
|
19
|
+
"@cowprotocol/sdk-common": "0.4.0-beta.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/jest": "^29.4.0",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"tsx": "^4.19.4",
|
|
35
35
|
"typescript": "^5.2.2",
|
|
36
36
|
"@cow-sdk/typescript-config": "0.0.0-beta.0",
|
|
37
|
-
"@cowprotocol/sdk-ethers-
|
|
38
|
-
"@cowprotocol/sdk-viem-adapter": "0.
|
|
39
|
-
"@cowprotocol/sdk-ethers-
|
|
37
|
+
"@cowprotocol/sdk-ethers-v6-adapter": "0.2.3-beta.0",
|
|
38
|
+
"@cowprotocol/sdk-viem-adapter": "0.3.0-beta.0",
|
|
39
|
+
"@cowprotocol/sdk-ethers-v5-adapter": "0.2.3-beta.0"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|