@cowprotocol/sdk-cow-shed 0.1.0-monorepo.0 → 0.1.0-monorepo.2
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/dist/index.d.mts +30 -14
- package/dist/index.d.ts +30 -14
- package/dist/index.js +42 -20
- package/dist/index.mjs +39 -22
- package/package.json +9 -3
package/dist/index.d.mts
CHANGED
|
@@ -15,7 +15,23 @@ interface ICoWShedCall {
|
|
|
15
15
|
isDelegateCall: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
declare const
|
|
18
|
+
declare const COW_SHED_1_0_0_VERSION = "1.0.0";
|
|
19
|
+
declare const COW_SHED_1_0_1_VERSION = "1.0.1";
|
|
20
|
+
declare const COW_SHED_LATEST_VERSION = "1.0.1";
|
|
21
|
+
type CoWShedVersion = typeof COW_SHED_1_0_0_VERSION | typeof COW_SHED_1_0_1_VERSION;
|
|
22
|
+
declare const COW_SHED_FACTORY: {
|
|
23
|
+
readonly "1.0.0": "0x00E989b87700514118Fa55326CD1cCE82faebEF6";
|
|
24
|
+
readonly "1.0.1": "0x312f92fe5f1710408B20D52A374fa29e099cFA86";
|
|
25
|
+
};
|
|
26
|
+
declare const COW_SHED_IMPLEMENTATION: {
|
|
27
|
+
readonly "1.0.0": "0x2CFFA8cf11B90C9F437567b86352169dF4009F73";
|
|
28
|
+
readonly "1.0.1": "0xa2704cf562ad418bf0453f4b662ebf6a2489ed88";
|
|
29
|
+
};
|
|
30
|
+
declare const COW_SHED_PROXY_INIT_CODE: {
|
|
31
|
+
readonly "1.0.0": "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033";
|
|
32
|
+
readonly "1.0.1": "0x60a03461009557601f61033d38819003918201601f19168301916001600160401b0383118484101761009957808492604094855283398101031261009557610052602061004b836100ad565b92016100ad565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5560405161027b90816100c28239608051818181608b01526101750152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036100955756fe60806040526004361015610018575b3661019757610197565b5f3560e01c8063025b22bc146100375763f851a4400361000e57610116565b346101125760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101125760043573ffffffffffffffffffffffffffffffffffffffff81169081810361011257337f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff160361010d577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a2005b61023d565b5f80fd5b34610112575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011257602061014e61016c565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b33300361010d577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101f0575b1561023d577ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000005f351614156101c3565b5f807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54368280378136915af43d5f803e15610277573d5ff35b3d5ffd";
|
|
33
|
+
};
|
|
34
|
+
|
|
19
35
|
declare const COW_SHED_712_TYPES: {
|
|
20
36
|
ExecuteHooks: {
|
|
21
37
|
type: string;
|
|
@@ -29,7 +45,8 @@ declare const COW_SHED_712_TYPES: {
|
|
|
29
45
|
declare class CowShedHooks {
|
|
30
46
|
private chainId;
|
|
31
47
|
private customOptions?;
|
|
32
|
-
|
|
48
|
+
readonly version: CoWShedVersion;
|
|
49
|
+
constructor(chainId: SupportedChainId, customOptions?: ICoWShedOptions | undefined, version?: CoWShedVersion, adapter?: AbstractProviderAdapter);
|
|
33
50
|
proxyOf(user: string): string;
|
|
34
51
|
encodeExecuteHooksForFactory(calls: ICoWShedCall[], nonce: string, deadline: bigint, ownerAddress: string, signature: string): string;
|
|
35
52
|
signCalls(calls: ICoWShedCall[], nonce: string, deadline: bigint, signingScheme: ContractsEcdsaSigningScheme, owner?: SignerLike): Promise<string>;
|
|
@@ -46,15 +63,9 @@ declare class CowShedHooks {
|
|
|
46
63
|
}[];
|
|
47
64
|
};
|
|
48
65
|
message: {
|
|
49
|
-
calls:
|
|
50
|
-
target: string;
|
|
51
|
-
value: bigint;
|
|
52
|
-
callData: string;
|
|
53
|
-
allowFailure: boolean;
|
|
54
|
-
isDelegateCall: boolean;
|
|
55
|
-
}[];
|
|
66
|
+
calls: ICoWShedCall[];
|
|
56
67
|
nonce: string;
|
|
57
|
-
deadline:
|
|
68
|
+
deadline: bigint;
|
|
58
69
|
};
|
|
59
70
|
};
|
|
60
71
|
getDomain(proxy: string): TypedDataDomain;
|
|
@@ -86,7 +97,11 @@ interface SignAndEncodeTxArgs {
|
|
|
86
97
|
/**
|
|
87
98
|
* Deadline to use for the transaction. If not provided, the maximum uint256 will be used.
|
|
88
99
|
*/
|
|
89
|
-
deadline
|
|
100
|
+
deadline: bigint;
|
|
101
|
+
/**
|
|
102
|
+
* If value is provided, gas won't be estimated and will use the value
|
|
103
|
+
*/
|
|
104
|
+
gasLimit?: bigint;
|
|
90
105
|
/**
|
|
91
106
|
* Default gas limit to use for the transaction. If not provided, it will throw an error if the gas limit cannot be estimated.
|
|
92
107
|
*/
|
|
@@ -113,8 +128,9 @@ interface CowShedSdkOptions {
|
|
|
113
128
|
}
|
|
114
129
|
declare class CowShedSdk {
|
|
115
130
|
private factoryOptions?;
|
|
131
|
+
readonly version: CoWShedVersion;
|
|
116
132
|
protected hooksCache: Map<SupportedChainId, CowShedHooks>;
|
|
117
|
-
constructor(adapter?: AbstractProviderAdapter, factoryOptions?: ICoWShedOptions | undefined);
|
|
133
|
+
constructor(adapter?: AbstractProviderAdapter, factoryOptions?: ICoWShedOptions | undefined, version?: CoWShedVersion);
|
|
118
134
|
getCowShedAccount(chainId: SupportedChainId, ownerAddress: string): string;
|
|
119
135
|
/**
|
|
120
136
|
* Encodes multiple calls into a single pre-authorized call to the cow-shed factory.
|
|
@@ -123,9 +139,9 @@ declare class CowShedSdk {
|
|
|
123
139
|
*
|
|
124
140
|
* @returns pre-authorized multicall details
|
|
125
141
|
*/
|
|
126
|
-
signCalls({ calls, signer: signerParam, chainId, nonce, deadline, defaultGasLimit, signingScheme, }: SignAndEncodeTxArgs): Promise<CowShedCall>;
|
|
142
|
+
signCalls({ calls, signer: signerParam, chainId, nonce, deadline, gasLimit, defaultGasLimit, signingScheme, }: SignAndEncodeTxArgs): Promise<CowShedCall>;
|
|
127
143
|
protected getCowShedHooks(chainId: SupportedChainId, customOptions?: ICoWShedOptions): CowShedHooks;
|
|
128
144
|
protected static getNonce(): string;
|
|
129
145
|
}
|
|
130
146
|
|
|
131
|
-
export { COW_SHED_712_TYPES, COW_SHED_PROXY_INIT_CODE, type CowShedCall, CowShedHooks, CowShedSdk, type CowShedSdkOptions, type ICoWShedCall, type ICoWShedOptions, type SignAndEncodeTxArgs };
|
|
147
|
+
export { COW_SHED_1_0_0_VERSION, COW_SHED_1_0_1_VERSION, COW_SHED_712_TYPES, COW_SHED_FACTORY, COW_SHED_IMPLEMENTATION, COW_SHED_LATEST_VERSION, COW_SHED_PROXY_INIT_CODE, type CoWShedVersion, type CowShedCall, CowShedHooks, CowShedSdk, type CowShedSdkOptions, type ICoWShedCall, type ICoWShedOptions, type SignAndEncodeTxArgs };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,23 @@ interface ICoWShedCall {
|
|
|
15
15
|
isDelegateCall: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
declare const
|
|
18
|
+
declare const COW_SHED_1_0_0_VERSION = "1.0.0";
|
|
19
|
+
declare const COW_SHED_1_0_1_VERSION = "1.0.1";
|
|
20
|
+
declare const COW_SHED_LATEST_VERSION = "1.0.1";
|
|
21
|
+
type CoWShedVersion = typeof COW_SHED_1_0_0_VERSION | typeof COW_SHED_1_0_1_VERSION;
|
|
22
|
+
declare const COW_SHED_FACTORY: {
|
|
23
|
+
readonly "1.0.0": "0x00E989b87700514118Fa55326CD1cCE82faebEF6";
|
|
24
|
+
readonly "1.0.1": "0x312f92fe5f1710408B20D52A374fa29e099cFA86";
|
|
25
|
+
};
|
|
26
|
+
declare const COW_SHED_IMPLEMENTATION: {
|
|
27
|
+
readonly "1.0.0": "0x2CFFA8cf11B90C9F437567b86352169dF4009F73";
|
|
28
|
+
readonly "1.0.1": "0xa2704cf562ad418bf0453f4b662ebf6a2489ed88";
|
|
29
|
+
};
|
|
30
|
+
declare const COW_SHED_PROXY_INIT_CODE: {
|
|
31
|
+
readonly "1.0.0": "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033";
|
|
32
|
+
readonly "1.0.1": "0x60a03461009557601f61033d38819003918201601f19168301916001600160401b0383118484101761009957808492604094855283398101031261009557610052602061004b836100ad565b92016100ad565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5560405161027b90816100c28239608051818181608b01526101750152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036100955756fe60806040526004361015610018575b3661019757610197565b5f3560e01c8063025b22bc146100375763f851a4400361000e57610116565b346101125760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101125760043573ffffffffffffffffffffffffffffffffffffffff81169081810361011257337f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff160361010d577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a2005b61023d565b5f80fd5b34610112575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011257602061014e61016c565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b33300361010d577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101f0575b1561023d577ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000005f351614156101c3565b5f807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54368280378136915af43d5f803e15610277573d5ff35b3d5ffd";
|
|
33
|
+
};
|
|
34
|
+
|
|
19
35
|
declare const COW_SHED_712_TYPES: {
|
|
20
36
|
ExecuteHooks: {
|
|
21
37
|
type: string;
|
|
@@ -29,7 +45,8 @@ declare const COW_SHED_712_TYPES: {
|
|
|
29
45
|
declare class CowShedHooks {
|
|
30
46
|
private chainId;
|
|
31
47
|
private customOptions?;
|
|
32
|
-
|
|
48
|
+
readonly version: CoWShedVersion;
|
|
49
|
+
constructor(chainId: SupportedChainId, customOptions?: ICoWShedOptions | undefined, version?: CoWShedVersion, adapter?: AbstractProviderAdapter);
|
|
33
50
|
proxyOf(user: string): string;
|
|
34
51
|
encodeExecuteHooksForFactory(calls: ICoWShedCall[], nonce: string, deadline: bigint, ownerAddress: string, signature: string): string;
|
|
35
52
|
signCalls(calls: ICoWShedCall[], nonce: string, deadline: bigint, signingScheme: ContractsEcdsaSigningScheme, owner?: SignerLike): Promise<string>;
|
|
@@ -46,15 +63,9 @@ declare class CowShedHooks {
|
|
|
46
63
|
}[];
|
|
47
64
|
};
|
|
48
65
|
message: {
|
|
49
|
-
calls:
|
|
50
|
-
target: string;
|
|
51
|
-
value: bigint;
|
|
52
|
-
callData: string;
|
|
53
|
-
allowFailure: boolean;
|
|
54
|
-
isDelegateCall: boolean;
|
|
55
|
-
}[];
|
|
66
|
+
calls: ICoWShedCall[];
|
|
56
67
|
nonce: string;
|
|
57
|
-
deadline:
|
|
68
|
+
deadline: bigint;
|
|
58
69
|
};
|
|
59
70
|
};
|
|
60
71
|
getDomain(proxy: string): TypedDataDomain;
|
|
@@ -86,7 +97,11 @@ interface SignAndEncodeTxArgs {
|
|
|
86
97
|
/**
|
|
87
98
|
* Deadline to use for the transaction. If not provided, the maximum uint256 will be used.
|
|
88
99
|
*/
|
|
89
|
-
deadline
|
|
100
|
+
deadline: bigint;
|
|
101
|
+
/**
|
|
102
|
+
* If value is provided, gas won't be estimated and will use the value
|
|
103
|
+
*/
|
|
104
|
+
gasLimit?: bigint;
|
|
90
105
|
/**
|
|
91
106
|
* Default gas limit to use for the transaction. If not provided, it will throw an error if the gas limit cannot be estimated.
|
|
92
107
|
*/
|
|
@@ -113,8 +128,9 @@ interface CowShedSdkOptions {
|
|
|
113
128
|
}
|
|
114
129
|
declare class CowShedSdk {
|
|
115
130
|
private factoryOptions?;
|
|
131
|
+
readonly version: CoWShedVersion;
|
|
116
132
|
protected hooksCache: Map<SupportedChainId, CowShedHooks>;
|
|
117
|
-
constructor(adapter?: AbstractProviderAdapter, factoryOptions?: ICoWShedOptions | undefined);
|
|
133
|
+
constructor(adapter?: AbstractProviderAdapter, factoryOptions?: ICoWShedOptions | undefined, version?: CoWShedVersion);
|
|
118
134
|
getCowShedAccount(chainId: SupportedChainId, ownerAddress: string): string;
|
|
119
135
|
/**
|
|
120
136
|
* Encodes multiple calls into a single pre-authorized call to the cow-shed factory.
|
|
@@ -123,9 +139,9 @@ declare class CowShedSdk {
|
|
|
123
139
|
*
|
|
124
140
|
* @returns pre-authorized multicall details
|
|
125
141
|
*/
|
|
126
|
-
signCalls({ calls, signer: signerParam, chainId, nonce, deadline, defaultGasLimit, signingScheme, }: SignAndEncodeTxArgs): Promise<CowShedCall>;
|
|
142
|
+
signCalls({ calls, signer: signerParam, chainId, nonce, deadline, gasLimit, defaultGasLimit, signingScheme, }: SignAndEncodeTxArgs): Promise<CowShedCall>;
|
|
127
143
|
protected getCowShedHooks(chainId: SupportedChainId, customOptions?: ICoWShedOptions): CowShedHooks;
|
|
128
144
|
protected static getNonce(): string;
|
|
129
145
|
}
|
|
130
146
|
|
|
131
|
-
export { COW_SHED_712_TYPES, COW_SHED_PROXY_INIT_CODE, type CowShedCall, CowShedHooks, CowShedSdk, type CowShedSdkOptions, type ICoWShedCall, type ICoWShedOptions, type SignAndEncodeTxArgs };
|
|
147
|
+
export { COW_SHED_1_0_0_VERSION, COW_SHED_1_0_1_VERSION, COW_SHED_712_TYPES, COW_SHED_FACTORY, COW_SHED_IMPLEMENTATION, COW_SHED_LATEST_VERSION, COW_SHED_PROXY_INIT_CODE, type CoWShedVersion, type CowShedCall, CowShedHooks, CowShedSdk, type CowShedSdkOptions, type ICoWShedCall, type ICoWShedOptions, type SignAndEncodeTxArgs };
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
COW_SHED_1_0_0_VERSION: () => COW_SHED_1_0_0_VERSION,
|
|
24
|
+
COW_SHED_1_0_1_VERSION: () => COW_SHED_1_0_1_VERSION,
|
|
23
25
|
COW_SHED_712_TYPES: () => COW_SHED_712_TYPES,
|
|
26
|
+
COW_SHED_FACTORY: () => COW_SHED_FACTORY,
|
|
27
|
+
COW_SHED_IMPLEMENTATION: () => COW_SHED_IMPLEMENTATION,
|
|
28
|
+
COW_SHED_LATEST_VERSION: () => COW_SHED_LATEST_VERSION,
|
|
24
29
|
COW_SHED_PROXY_INIT_CODE: () => COW_SHED_PROXY_INIT_CODE,
|
|
25
30
|
CowShedHooks: () => CowShedHooks,
|
|
26
31
|
CowShedSdk: () => CowShedSdk
|
|
@@ -29,7 +34,6 @@ module.exports = __toCommonJS(src_exports);
|
|
|
29
34
|
|
|
30
35
|
// src/contracts/CoWShedHooks.ts
|
|
31
36
|
var import_sdk_contracts_ts = require("@cowprotocol/sdk-contracts-ts");
|
|
32
|
-
var import_sdk_config = require("@cowprotocol/sdk-config");
|
|
33
37
|
var import_sdk_common = require("@cowprotocol/sdk-common");
|
|
34
38
|
|
|
35
39
|
// src/abi/CowShedFactoryAbi.ts
|
|
@@ -168,8 +172,24 @@ var CowShedFactoryAbi = [
|
|
|
168
172
|
}
|
|
169
173
|
];
|
|
170
174
|
|
|
175
|
+
// src/const.ts
|
|
176
|
+
var COW_SHED_1_0_0_VERSION = "1.0.0";
|
|
177
|
+
var COW_SHED_1_0_1_VERSION = "1.0.1";
|
|
178
|
+
var COW_SHED_LATEST_VERSION = COW_SHED_1_0_1_VERSION;
|
|
179
|
+
var COW_SHED_FACTORY = {
|
|
180
|
+
[COW_SHED_1_0_0_VERSION]: "0x00E989b87700514118Fa55326CD1cCE82faebEF6",
|
|
181
|
+
[COW_SHED_1_0_1_VERSION]: "0x312f92fe5f1710408B20D52A374fa29e099cFA86"
|
|
182
|
+
};
|
|
183
|
+
var COW_SHED_IMPLEMENTATION = {
|
|
184
|
+
[COW_SHED_1_0_0_VERSION]: "0x2CFFA8cf11B90C9F437567b86352169dF4009F73",
|
|
185
|
+
[COW_SHED_1_0_1_VERSION]: "0xa2704cf562ad418bf0453f4b662ebf6a2489ed88"
|
|
186
|
+
};
|
|
187
|
+
var COW_SHED_PROXY_INIT_CODE = {
|
|
188
|
+
[COW_SHED_1_0_0_VERSION]: "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033",
|
|
189
|
+
[COW_SHED_1_0_1_VERSION]: "0x60a03461009557601f61033d38819003918201601f19168301916001600160401b0383118484101761009957808492604094855283398101031261009557610052602061004b836100ad565b92016100ad565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5560405161027b90816100c28239608051818181608b01526101750152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036100955756fe60806040526004361015610018575b3661019757610197565b5f3560e01c8063025b22bc146100375763f851a4400361000e57610116565b346101125760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101125760043573ffffffffffffffffffffffffffffffffffffffff81169081810361011257337f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff160361010d577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a2005b61023d565b5f80fd5b34610112575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011257602061014e61016c565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b33300361010d577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101f0575b1561023d577ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000005f351614156101c3565b5f807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54368280378136915af43d5f803e15610277573d5ff35b3d5ffd"
|
|
190
|
+
};
|
|
191
|
+
|
|
171
192
|
// src/contracts/CoWShedHooks.ts
|
|
172
|
-
var COW_SHED_PROXY_INIT_CODE = "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033";
|
|
173
193
|
var COW_SHED_712_TYPES = {
|
|
174
194
|
ExecuteHooks: [
|
|
175
195
|
{ type: "Call[]", name: "calls" },
|
|
@@ -185,9 +205,10 @@ var COW_SHED_712_TYPES = {
|
|
|
185
205
|
]
|
|
186
206
|
};
|
|
187
207
|
var CowShedHooks = class {
|
|
188
|
-
constructor(chainId, customOptions, adapter) {
|
|
208
|
+
constructor(chainId, customOptions, version = COW_SHED_LATEST_VERSION, adapter) {
|
|
189
209
|
this.chainId = chainId;
|
|
190
210
|
this.customOptions = customOptions;
|
|
211
|
+
this.version = version;
|
|
191
212
|
if (adapter) {
|
|
192
213
|
(0, import_sdk_common.setGlobalAdapter)(adapter);
|
|
193
214
|
}
|
|
@@ -224,34 +245,28 @@ var CowShedHooks = class {
|
|
|
224
245
|
}
|
|
225
246
|
infoToSign(calls, nonce, deadline, proxy) {
|
|
226
247
|
const message = {
|
|
227
|
-
calls
|
|
228
|
-
target: call.target.toLowerCase(),
|
|
229
|
-
value: call.value,
|
|
230
|
-
callData: call.callData,
|
|
231
|
-
allowFailure: call.allowFailure,
|
|
232
|
-
isDelegateCall: call.isDelegateCall
|
|
233
|
-
})),
|
|
248
|
+
calls,
|
|
234
249
|
nonce,
|
|
235
|
-
deadline
|
|
250
|
+
deadline
|
|
236
251
|
};
|
|
237
252
|
return { domain: this.getDomain(proxy), types: COW_SHED_712_TYPES, message };
|
|
238
253
|
}
|
|
239
254
|
getDomain(proxy) {
|
|
240
255
|
return {
|
|
241
256
|
name: "COWShed",
|
|
242
|
-
version:
|
|
243
|
-
chainId:
|
|
244
|
-
verifyingContract: proxy
|
|
257
|
+
version: this.version,
|
|
258
|
+
chainId: this.chainId,
|
|
259
|
+
verifyingContract: proxy
|
|
245
260
|
};
|
|
246
261
|
}
|
|
247
262
|
proxyCreationCode() {
|
|
248
|
-
return this.customOptions?.proxyCreationCode ?? COW_SHED_PROXY_INIT_CODE;
|
|
263
|
+
return this.customOptions?.proxyCreationCode ?? COW_SHED_PROXY_INIT_CODE[this.version];
|
|
249
264
|
}
|
|
250
265
|
getFactoryAddress() {
|
|
251
|
-
return this.customOptions?.factoryAddress ??
|
|
266
|
+
return this.customOptions?.factoryAddress ?? COW_SHED_FACTORY[this.version];
|
|
252
267
|
}
|
|
253
268
|
getImplementationAddress() {
|
|
254
|
-
return this.customOptions?.implementationAddress ??
|
|
269
|
+
return this.customOptions?.implementationAddress ?? COW_SHED_IMPLEMENTATION[this.version];
|
|
255
270
|
}
|
|
256
271
|
};
|
|
257
272
|
|
|
@@ -259,8 +274,9 @@ var CowShedHooks = class {
|
|
|
259
274
|
var import_sdk_contracts_ts2 = require("@cowprotocol/sdk-contracts-ts");
|
|
260
275
|
var import_sdk_common2 = require("@cowprotocol/sdk-common");
|
|
261
276
|
var CowShedSdk = class _CowShedSdk {
|
|
262
|
-
constructor(adapter, factoryOptions) {
|
|
277
|
+
constructor(adapter, factoryOptions, version = COW_SHED_LATEST_VERSION) {
|
|
263
278
|
this.factoryOptions = factoryOptions;
|
|
279
|
+
this.version = version;
|
|
264
280
|
if (adapter) {
|
|
265
281
|
(0, import_sdk_common2.setGlobalAdapter)(adapter);
|
|
266
282
|
}
|
|
@@ -283,6 +299,7 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
283
299
|
chainId,
|
|
284
300
|
nonce = _CowShedSdk.getNonce(),
|
|
285
301
|
deadline = import_sdk_common2.MAX_UINT256,
|
|
302
|
+
gasLimit,
|
|
286
303
|
defaultGasLimit,
|
|
287
304
|
signingScheme = import_sdk_contracts_ts2.ContractsSigningScheme.EIP712
|
|
288
305
|
}) {
|
|
@@ -299,7 +316,7 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
299
316
|
data: callData,
|
|
300
317
|
value: BigInt(0)
|
|
301
318
|
};
|
|
302
|
-
const gasEstimate = await signer.estimateGas(factoryCall).catch((error) => {
|
|
319
|
+
const gasEstimate = gasLimit || await signer.estimateGas(factoryCall).catch((error) => {
|
|
303
320
|
const factoryCallString = JSON.stringify(factoryCall, import_sdk_common2.jsonWithBigintReplacer, 2);
|
|
304
321
|
const errorMessage = `Error estimating gas for the cow-shed call: ${factoryCallString}. Review the factory call`;
|
|
305
322
|
if (defaultGasLimit) {
|
|
@@ -311,7 +328,7 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
311
328
|
return {
|
|
312
329
|
cowShedAccount,
|
|
313
330
|
signedMulticall: factoryCall,
|
|
314
|
-
gasLimit: gasEstimate
|
|
331
|
+
gasLimit: BigInt(gasEstimate.toString())
|
|
315
332
|
};
|
|
316
333
|
}
|
|
317
334
|
getCowShedHooks(chainId, customOptions) {
|
|
@@ -330,7 +347,12 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
330
347
|
};
|
|
331
348
|
// Annotate the CommonJS export names for ESM import in node:
|
|
332
349
|
0 && (module.exports = {
|
|
350
|
+
COW_SHED_1_0_0_VERSION,
|
|
351
|
+
COW_SHED_1_0_1_VERSION,
|
|
333
352
|
COW_SHED_712_TYPES,
|
|
353
|
+
COW_SHED_FACTORY,
|
|
354
|
+
COW_SHED_IMPLEMENTATION,
|
|
355
|
+
COW_SHED_LATEST_VERSION,
|
|
334
356
|
COW_SHED_PROXY_INIT_CODE,
|
|
335
357
|
CowShedHooks,
|
|
336
358
|
CowShedSdk
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// src/contracts/CoWShedHooks.ts
|
|
2
2
|
import { ecdsaSignTypedData } from "@cowprotocol/sdk-contracts-ts";
|
|
3
|
-
import { COW_SHED_FACTORY, COW_SHED_IMPLEMENTATION } from "@cowprotocol/sdk-config";
|
|
4
3
|
import {
|
|
5
4
|
getGlobalAdapter,
|
|
6
5
|
setGlobalAdapter
|
|
@@ -142,8 +141,24 @@ var CowShedFactoryAbi = [
|
|
|
142
141
|
}
|
|
143
142
|
];
|
|
144
143
|
|
|
144
|
+
// src/const.ts
|
|
145
|
+
var COW_SHED_1_0_0_VERSION = "1.0.0";
|
|
146
|
+
var COW_SHED_1_0_1_VERSION = "1.0.1";
|
|
147
|
+
var COW_SHED_LATEST_VERSION = COW_SHED_1_0_1_VERSION;
|
|
148
|
+
var COW_SHED_FACTORY = {
|
|
149
|
+
[COW_SHED_1_0_0_VERSION]: "0x00E989b87700514118Fa55326CD1cCE82faebEF6",
|
|
150
|
+
[COW_SHED_1_0_1_VERSION]: "0x312f92fe5f1710408B20D52A374fa29e099cFA86"
|
|
151
|
+
};
|
|
152
|
+
var COW_SHED_IMPLEMENTATION = {
|
|
153
|
+
[COW_SHED_1_0_0_VERSION]: "0x2CFFA8cf11B90C9F437567b86352169dF4009F73",
|
|
154
|
+
[COW_SHED_1_0_1_VERSION]: "0xa2704cf562ad418bf0453f4b662ebf6a2489ed88"
|
|
155
|
+
};
|
|
156
|
+
var COW_SHED_PROXY_INIT_CODE = {
|
|
157
|
+
[COW_SHED_1_0_0_VERSION]: "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033",
|
|
158
|
+
[COW_SHED_1_0_1_VERSION]: "0x60a03461009557601f61033d38819003918201601f19168301916001600160401b0383118484101761009957808492604094855283398101031261009557610052602061004b836100ad565b92016100ad565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5560405161027b90816100c28239608051818181608b01526101750152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b51906001600160a01b03821682036100955756fe60806040526004361015610018575b3661019757610197565b5f3560e01c8063025b22bc146100375763f851a4400361000e57610116565b346101125760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101125760043573ffffffffffffffffffffffffffffffffffffffff81169081810361011257337f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff160361010d577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b5f80a2005b61023d565b5f80fd5b34610112575f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261011257602061014e61016c565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b33300361010d577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101f0575b1561023d577ff92ee8a9000000000000000000000000000000000000000000000000000000005f5260045ffd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000005f351614156101c3565b5f807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc54368280378136915af43d5f803e15610277573d5ff35b3d5ffd"
|
|
159
|
+
};
|
|
160
|
+
|
|
145
161
|
// src/contracts/CoWShedHooks.ts
|
|
146
|
-
var COW_SHED_PROXY_INIT_CODE = "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033";
|
|
147
162
|
var COW_SHED_712_TYPES = {
|
|
148
163
|
ExecuteHooks: [
|
|
149
164
|
{ type: "Call[]", name: "calls" },
|
|
@@ -159,9 +174,10 @@ var COW_SHED_712_TYPES = {
|
|
|
159
174
|
]
|
|
160
175
|
};
|
|
161
176
|
var CowShedHooks = class {
|
|
162
|
-
constructor(chainId, customOptions, adapter) {
|
|
177
|
+
constructor(chainId, customOptions, version = COW_SHED_LATEST_VERSION, adapter) {
|
|
163
178
|
this.chainId = chainId;
|
|
164
179
|
this.customOptions = customOptions;
|
|
180
|
+
this.version = version;
|
|
165
181
|
if (adapter) {
|
|
166
182
|
setGlobalAdapter(adapter);
|
|
167
183
|
}
|
|
@@ -198,34 +214,28 @@ var CowShedHooks = class {
|
|
|
198
214
|
}
|
|
199
215
|
infoToSign(calls, nonce, deadline, proxy) {
|
|
200
216
|
const message = {
|
|
201
|
-
calls
|
|
202
|
-
target: call.target.toLowerCase(),
|
|
203
|
-
value: call.value,
|
|
204
|
-
callData: call.callData,
|
|
205
|
-
allowFailure: call.allowFailure,
|
|
206
|
-
isDelegateCall: call.isDelegateCall
|
|
207
|
-
})),
|
|
217
|
+
calls,
|
|
208
218
|
nonce,
|
|
209
|
-
deadline
|
|
219
|
+
deadline
|
|
210
220
|
};
|
|
211
221
|
return { domain: this.getDomain(proxy), types: COW_SHED_712_TYPES, message };
|
|
212
222
|
}
|
|
213
223
|
getDomain(proxy) {
|
|
214
224
|
return {
|
|
215
225
|
name: "COWShed",
|
|
216
|
-
version:
|
|
217
|
-
chainId:
|
|
218
|
-
verifyingContract: proxy
|
|
226
|
+
version: this.version,
|
|
227
|
+
chainId: this.chainId,
|
|
228
|
+
verifyingContract: proxy
|
|
219
229
|
};
|
|
220
230
|
}
|
|
221
231
|
proxyCreationCode() {
|
|
222
|
-
return this.customOptions?.proxyCreationCode ?? COW_SHED_PROXY_INIT_CODE;
|
|
232
|
+
return this.customOptions?.proxyCreationCode ?? COW_SHED_PROXY_INIT_CODE[this.version];
|
|
223
233
|
}
|
|
224
234
|
getFactoryAddress() {
|
|
225
|
-
return this.customOptions?.factoryAddress ?? COW_SHED_FACTORY;
|
|
235
|
+
return this.customOptions?.factoryAddress ?? COW_SHED_FACTORY[this.version];
|
|
226
236
|
}
|
|
227
237
|
getImplementationAddress() {
|
|
228
|
-
return this.customOptions?.implementationAddress ?? COW_SHED_IMPLEMENTATION;
|
|
238
|
+
return this.customOptions?.implementationAddress ?? COW_SHED_IMPLEMENTATION[this.version];
|
|
229
239
|
}
|
|
230
240
|
};
|
|
231
241
|
|
|
@@ -234,15 +244,16 @@ import {
|
|
|
234
244
|
ContractsSigningScheme as SigningScheme
|
|
235
245
|
} from "@cowprotocol/sdk-contracts-ts";
|
|
236
246
|
import {
|
|
247
|
+
getGlobalAdapter as getGlobalAdapter2,
|
|
248
|
+
jsonWithBigintReplacer,
|
|
237
249
|
log,
|
|
238
250
|
MAX_UINT256 as NON_EXPIRING_DEADLINE,
|
|
239
|
-
jsonWithBigintReplacer,
|
|
240
|
-
getGlobalAdapter as getGlobalAdapter2,
|
|
241
251
|
setGlobalAdapter as setGlobalAdapter2
|
|
242
252
|
} from "@cowprotocol/sdk-common";
|
|
243
253
|
var CowShedSdk = class _CowShedSdk {
|
|
244
|
-
constructor(adapter, factoryOptions) {
|
|
254
|
+
constructor(adapter, factoryOptions, version = COW_SHED_LATEST_VERSION) {
|
|
245
255
|
this.factoryOptions = factoryOptions;
|
|
256
|
+
this.version = version;
|
|
246
257
|
if (adapter) {
|
|
247
258
|
setGlobalAdapter2(adapter);
|
|
248
259
|
}
|
|
@@ -265,6 +276,7 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
265
276
|
chainId,
|
|
266
277
|
nonce = _CowShedSdk.getNonce(),
|
|
267
278
|
deadline = NON_EXPIRING_DEADLINE,
|
|
279
|
+
gasLimit,
|
|
268
280
|
defaultGasLimit,
|
|
269
281
|
signingScheme = SigningScheme.EIP712
|
|
270
282
|
}) {
|
|
@@ -281,7 +293,7 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
281
293
|
data: callData,
|
|
282
294
|
value: BigInt(0)
|
|
283
295
|
};
|
|
284
|
-
const gasEstimate = await signer.estimateGas(factoryCall).catch((error) => {
|
|
296
|
+
const gasEstimate = gasLimit || await signer.estimateGas(factoryCall).catch((error) => {
|
|
285
297
|
const factoryCallString = JSON.stringify(factoryCall, jsonWithBigintReplacer, 2);
|
|
286
298
|
const errorMessage = `Error estimating gas for the cow-shed call: ${factoryCallString}. Review the factory call`;
|
|
287
299
|
if (defaultGasLimit) {
|
|
@@ -293,7 +305,7 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
293
305
|
return {
|
|
294
306
|
cowShedAccount,
|
|
295
307
|
signedMulticall: factoryCall,
|
|
296
|
-
gasLimit: gasEstimate
|
|
308
|
+
gasLimit: BigInt(gasEstimate.toString())
|
|
297
309
|
};
|
|
298
310
|
}
|
|
299
311
|
getCowShedHooks(chainId, customOptions) {
|
|
@@ -311,7 +323,12 @@ var CowShedSdk = class _CowShedSdk {
|
|
|
311
323
|
}
|
|
312
324
|
};
|
|
313
325
|
export {
|
|
326
|
+
COW_SHED_1_0_0_VERSION,
|
|
327
|
+
COW_SHED_1_0_1_VERSION,
|
|
314
328
|
COW_SHED_712_TYPES,
|
|
329
|
+
COW_SHED_FACTORY,
|
|
330
|
+
COW_SHED_IMPLEMENTATION,
|
|
331
|
+
COW_SHED_LATEST_VERSION,
|
|
315
332
|
COW_SHED_PROXY_INIT_CODE,
|
|
316
333
|
CowShedHooks,
|
|
317
334
|
CowShedSdk
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-cow-shed",
|
|
3
|
-
"version": "0.1.0-monorepo.
|
|
3
|
+
"version": "0.1.0-monorepo.2",
|
|
4
4
|
"description": "CowProtocol Cow Shed package",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -10,14 +10,19 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/**"
|
|
12
12
|
],
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
13
16
|
"scripts": {
|
|
14
17
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
15
18
|
"lint": "eslint src/**/*.ts --quiet",
|
|
16
19
|
"test": "jest",
|
|
17
|
-
"test:coverage": "jest --coverage --json --outputFile=jest.results.json &&
|
|
20
|
+
"test:coverage": "jest --coverage --json --outputFile=jest.results.json && npx coveralls < ./coverage/lcov.info",
|
|
18
21
|
"test:coverage:html": "jest --silent=false --coverage --coverageReporters html",
|
|
22
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
19
23
|
"typecheck": "tsc --noEmit",
|
|
20
|
-
"
|
|
24
|
+
"publish": "npm publish --access public",
|
|
25
|
+
"prepublishOnly": "npm run build"
|
|
21
26
|
},
|
|
22
27
|
"dependencies": {
|
|
23
28
|
"@cowprotocol/sdk-config": "workspace:*",
|
|
@@ -33,6 +38,7 @@
|
|
|
33
38
|
"@types/node": "^20.17.31",
|
|
34
39
|
"@types/semver-sort": "^0.0.1",
|
|
35
40
|
"@ethersproject/constants": "^5.7.0",
|
|
41
|
+
"coveralls": "^3.1.1",
|
|
36
42
|
"ethers-v5": "npm:ethers@^5.7.2",
|
|
37
43
|
"ethers-v6": "npm:ethers@^6.13.7",
|
|
38
44
|
"viem": "^2.28.4",
|