@cowprotocol/cow-sdk 5.7.0 → 5.7.1-next

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.
Files changed (136) hide show
  1. package/package.json +3 -4
  2. package/LICENSE-APACHE +0 -201
  3. package/LICENSE-MIT +0 -21
  4. package/dist/README.md +0 -245
  5. package/dist/common/chains.d.ts +0 -11
  6. package/dist/common/configs.d.ts +0 -78
  7. package/dist/common/consts.d.ts +0 -29
  8. package/dist/common/cow-error.d.ts +0 -5
  9. package/dist/common/generated/CoWShed.d.ts +0 -219
  10. package/dist/common/generated/CoWShedFactory.d.ts +0 -191
  11. package/dist/common/generated/ComposableCoW.d.ts +0 -340
  12. package/dist/common/generated/ExtensibleFallbackHandler.d.ts +0 -282
  13. package/dist/common/generated/TWAP.d.ts +0 -141
  14. package/dist/common/generated/common.d.ts +0 -21
  15. package/dist/common/generated/factories/CoWShedFactory__factory.d.ts +0 -250
  16. package/dist/common/generated/factories/CoWShed__factory.d.ts +0 -254
  17. package/dist/common/generated/factories/ComposableCoW__factory.d.ts +0 -475
  18. package/dist/common/generated/factories/ExtensibleFallbackHandler__factory.d.ts +0 -389
  19. package/dist/common/generated/factories/TWAP__factory.d.ts +0 -260
  20. package/dist/common/generated/factories/index.d.ts +0 -5
  21. package/dist/common/generated/index.d.ts +0 -11
  22. package/dist/common/index.d.ts +0 -5
  23. package/dist/common/ipfs.d.ts +0 -2
  24. package/dist/composable/ConditionalOrder.d.ts +0 -206
  25. package/dist/composable/ConditionalOrderFactory.d.ts +0 -9
  26. package/dist/composable/Multiplexer.d.ts +0 -174
  27. package/dist/composable/contracts.d.ts +0 -6
  28. package/dist/composable/generated/ComposableCoW.d.ts +0 -340
  29. package/dist/composable/generated/ExtensibleFallbackHandler.d.ts +0 -282
  30. package/dist/composable/generated/TWAP.d.ts +0 -141
  31. package/dist/composable/generated/common.d.ts +0 -21
  32. package/dist/composable/generated/factories/ComposableCoW__factory.d.ts +0 -475
  33. package/dist/composable/generated/factories/ExtensibleFallbackHandler__factory.d.ts +0 -389
  34. package/dist/composable/generated/factories/TWAP__factory.d.ts +0 -260
  35. package/dist/composable/generated/factories/index.d.ts +0 -3
  36. package/dist/composable/generated/index.d.ts +0 -7
  37. package/dist/composable/index.d.ts +0 -6
  38. package/dist/composable/orderTypes/Twap.d.ts +0 -242
  39. package/dist/composable/orderTypes/index.d.ts +0 -3
  40. package/dist/composable/orderTypes/test/TestConditionalOrder.d.ts +0 -25
  41. package/dist/composable/types.d.ts +0 -133
  42. package/dist/composable/utils.d.ts +0 -36
  43. package/dist/cow-shed/CoWShedHooks.d.ts +0 -35
  44. package/dist/cow-shed/contracts.d.ts +0 -4
  45. package/dist/cow-shed/index.d.ts +0 -4
  46. package/dist/cow-shed/proxyInitCode.d.ts +0 -1
  47. package/dist/cow-shed/types.d.ts +0 -33
  48. package/dist/index-5ea4bd62.js +0 -29
  49. package/dist/index-5ea4bd62.js.map +0 -1
  50. package/dist/index.d.ts +0 -6
  51. package/dist/index.js +0 -29
  52. package/dist/index.js.map +0 -1
  53. package/dist/index.modern.mjs +0 -2
  54. package/dist/index.modern.mjs.map +0 -1
  55. package/dist/index.module.js +0 -29
  56. package/dist/index.module.js.map +0 -1
  57. package/dist/order-book/api.d.ts +0 -235
  58. package/dist/order-book/generated/index.d.ts +0 -56
  59. package/dist/order-book/generated/models/Address.d.ts +0 -4
  60. package/dist/order-book/generated/models/AppData.d.ts +0 -7
  61. package/dist/order-book/generated/models/AppDataHash.d.ts +0 -6
  62. package/dist/order-book/generated/models/AppDataObject.d.ts +0 -7
  63. package/dist/order-book/generated/models/Auction.d.ts +0 -39
  64. package/dist/order-book/generated/models/AuctionOrder.d.ts +0 -92
  65. package/dist/order-book/generated/models/AuctionPrices.d.ts +0 -9
  66. package/dist/order-book/generated/models/BigUint.d.ts +0 -4
  67. package/dist/order-book/generated/models/BuyTokenDestination.d.ts +0 -7
  68. package/dist/order-book/generated/models/CallData.d.ts +0 -4
  69. package/dist/order-book/generated/models/CompetitionAuction.d.ts +0 -14
  70. package/dist/order-book/generated/models/CompetitionOrderStatus.d.ts +0 -27
  71. package/dist/order-book/generated/models/EcdsaSignature.d.ts +0 -4
  72. package/dist/order-book/generated/models/EcdsaSigningScheme.d.ts +0 -7
  73. package/dist/order-book/generated/models/EthflowData.d.ts +0 -20
  74. package/dist/order-book/generated/models/ExecutedAmounts.d.ts +0 -5
  75. package/dist/order-book/generated/models/ExecutedProtocolFee.d.ts +0 -14
  76. package/dist/order-book/generated/models/FeePolicy.d.ts +0 -7
  77. package/dist/order-book/generated/models/InteractionData.d.ts +0 -11
  78. package/dist/order-book/generated/models/NativePriceResponse.d.ts +0 -10
  79. package/dist/order-book/generated/models/OnchainOrderData.d.ts +0 -30
  80. package/dist/order-book/generated/models/Order.d.ts +0 -3
  81. package/dist/order-book/generated/models/OrderCancellation.d.ts +0 -14
  82. package/dist/order-book/generated/models/OrderCancellationError.d.ts +0 -15
  83. package/dist/order-book/generated/models/OrderCancellations.d.ts +0 -18
  84. package/dist/order-book/generated/models/OrderClass.d.ts +0 -8
  85. package/dist/order-book/generated/models/OrderCreation.d.ts +0 -88
  86. package/dist/order-book/generated/models/OrderKind.d.ts +0 -7
  87. package/dist/order-book/generated/models/OrderMetaData.d.ts +0 -97
  88. package/dist/order-book/generated/models/OrderParameters.d.ts +0 -54
  89. package/dist/order-book/generated/models/OrderPostError.d.ts +0 -35
  90. package/dist/order-book/generated/models/OrderQuoteRequest.d.ts +0 -54
  91. package/dist/order-book/generated/models/OrderQuoteResponse.d.ts +0 -28
  92. package/dist/order-book/generated/models/OrderQuoteSide.d.ts +0 -27
  93. package/dist/order-book/generated/models/OrderQuoteSideKindBuy.d.ts +0 -3
  94. package/dist/order-book/generated/models/OrderQuoteSideKindSell.d.ts +0 -3
  95. package/dist/order-book/generated/models/OrderQuoteValidity.d.ts +0 -14
  96. package/dist/order-book/generated/models/OrderStatus.d.ts +0 -10
  97. package/dist/order-book/generated/models/PreSignature.d.ts +0 -4
  98. package/dist/order-book/generated/models/PriceEstimationError.d.ts +0 -12
  99. package/dist/order-book/generated/models/PriceImprovement.d.ts +0 -12
  100. package/dist/order-book/generated/models/PriceQuality.d.ts +0 -15
  101. package/dist/order-book/generated/models/ProtocolAppData.d.ts +0 -1
  102. package/dist/order-book/generated/models/Quote.d.ts +0 -19
  103. package/dist/order-book/generated/models/SellTokenSource.d.ts +0 -8
  104. package/dist/order-book/generated/models/Signature.d.ts +0 -6
  105. package/dist/order-book/generated/models/SigningScheme.d.ts +0 -9
  106. package/dist/order-book/generated/models/SolverCompetitionResponse.d.ts +0 -30
  107. package/dist/order-book/generated/models/SolverSettlement.d.ts +0 -42
  108. package/dist/order-book/generated/models/Surplus.d.ts +0 -7
  109. package/dist/order-book/generated/models/TokenAmount.d.ts +0 -4
  110. package/dist/order-book/generated/models/TotalSurplus.d.ts +0 -10
  111. package/dist/order-book/generated/models/Trade.d.ts +0 -57
  112. package/dist/order-book/generated/models/TransactionHash.d.ts +0 -4
  113. package/dist/order-book/generated/models/UID.d.ts +0 -7
  114. package/dist/order-book/generated/models/Volume.d.ts +0 -6
  115. package/dist/order-book/index.d.ts +0 -5
  116. package/dist/order-book/mock.d.ts +0 -63
  117. package/dist/order-book/quoteAmountsAndCostsUtils.d.ts +0 -11
  118. package/dist/order-book/request.d.ts +0 -49
  119. package/dist/order-book/transformOrder.d.ts +0 -10
  120. package/dist/order-book/types.d.ts +0 -38
  121. package/dist/order-signing/index.d.ts +0 -2
  122. package/dist/order-signing/orderSigningUtils.d.ts +0 -87
  123. package/dist/order-signing/types.d.ts +0 -55
  124. package/dist/order-signing/utils.d.ts +0 -39
  125. package/dist/package.json +0 -103
  126. package/dist/subgraph/api.d.ts +0 -77
  127. package/dist/subgraph/graphql.d.ts +0 -3203
  128. package/dist/subgraph/index.d.ts +0 -1
  129. package/dist/subgraph/queries.d.ts +0 -14
  130. package/dist/utils-28261b03.js +0 -2
  131. package/dist/utils-28261b03.js.map +0 -1
  132. package/dist/utils-67d54330.js +0 -2
  133. package/dist/utils-67d54330.js.map +0 -1
  134. package/dist/utils-81055c83.js +0 -2
  135. package/dist/utils-81055c83.js.map +0 -1
  136. package/dist/utils.d.ts +0 -3
@@ -1,242 +0,0 @@
1
- import { BigNumber } from 'ethers';
2
- import { ConditionalOrder } from '../ConditionalOrder';
3
- import { ConditionalOrderArguments, ConditionalOrderParams, ContextFactory, OwnerContext, IsValidResult, PollParams, PollResultErrors } from '../types';
4
- import { GPv2Order } from '../../common/generated/ComposableCoW';
5
- export declare const TWAP_ADDRESS = "0x6cF1e9cA41f7611dEf408122793c358a3d11E5a5";
6
- /**
7
- * The address of the `CurrentBlockTimestampFactory` contract
8
- *
9
- * **NOTE**: This is used in the event that TWAP's have a `t0` of `0`.
10
- */
11
- export declare const CURRENT_BLOCK_TIMESTAMP_FACTORY_ADDRESS = "0x52eD56Da04309Aca4c3FECC595298d80C2f16BAc";
12
- export declare const MAX_UINT32: BigNumber;
13
- export declare const MAX_FREQUENCY: BigNumber;
14
- /**
15
- * Base parameters for a TWAP order. Shared by:
16
- * - TwapStruct (modelling the contract's struct used for `staticInput`).
17
- * - TwapData (modelling the friendly SDK interface).
18
- */
19
- export type TwapDataBase = {
20
- /**
21
- * which token to sell
22
- */
23
- readonly sellToken: string;
24
- /**
25
- * which token to buy
26
- */
27
- readonly buyToken: string;
28
- /**
29
- * who to send the tokens to
30
- */
31
- readonly receiver: string;
32
- /**
33
- * Meta-data associated with the order. Normally would be the keccak256 hash of the document generated in http://github.com/cowprotocol/app-data
34
- *
35
- * This hash should have been uploaded to the API https://api.cow.fi/docs/#/default/put_api_v1_app_data__app_data_hash_ and potentially to other data availability protocols like IPFS.
36
- *
37
- */
38
- readonly appData: string;
39
- };
40
- /**
41
- * Parameters for a TWAP order, as expected by the contract's `staticInput`.
42
- */
43
- export interface TwapStruct extends TwapDataBase {
44
- /**
45
- * amount of sellToken to sell in each part
46
- */
47
- readonly partSellAmount: BigNumber;
48
- /**
49
- * minimum amount of buyToken that must be bought in each part
50
- */
51
- readonly minPartLimit: BigNumber;
52
- /**
53
- * start time of the TWAP
54
- */
55
- readonly t0: BigNumber;
56
- /**
57
- * number of parts
58
- */
59
- readonly n: BigNumber;
60
- /**
61
- * duration of the TWAP interval
62
- */
63
- readonly t: BigNumber;
64
- /**
65
- * whether the TWAP is valid for the entire interval or not
66
- */
67
- readonly span: BigNumber;
68
- }
69
- /**
70
- * Parameters for a TWAP order, made a little more user-friendly for SDK users.
71
- *
72
- * @see {@link TwapStruct} for the native struct.
73
- */
74
- export interface TwapData extends TwapDataBase {
75
- /**
76
- * total amount of sellToken to sell across the entire TWAP
77
- */
78
- readonly sellAmount: BigNumber;
79
- /**
80
- * minimum amount of buyToken that must be bought across the entire TWAP
81
- */
82
- readonly buyAmount: BigNumber;
83
- /**
84
- * start time of the TWAP
85
- */
86
- readonly startTime?: StartTime;
87
- /**
88
- * number of parts
89
- */
90
- readonly numberOfParts: BigNumber;
91
- /**
92
- * duration of the TWAP interval
93
- */
94
- readonly timeBetweenParts: BigNumber;
95
- /**
96
- * whether the TWAP is valid for the entire interval or not
97
- */
98
- readonly durationOfPart?: DurationOfPart;
99
- }
100
- export type DurationOfPart = {
101
- durationType: DurationType.AUTO;
102
- } | {
103
- durationType: DurationType.LIMIT_DURATION;
104
- duration: BigNumber;
105
- };
106
- export declare enum DurationType {
107
- AUTO = "AUTO",
108
- LIMIT_DURATION = "LIMIT_DURATION"
109
- }
110
- export type StartTime = {
111
- startType: StartTimeValue.AT_MINING_TIME;
112
- } | {
113
- startType: StartTimeValue.AT_EPOCH;
114
- epoch: BigNumber;
115
- };
116
- export declare enum StartTimeValue {
117
- AT_MINING_TIME = "AT_MINING_TIME",
118
- AT_EPOCH = "AT_EPOCH"
119
- }
120
- /**
121
- * `ComposableCoW` implementation of a TWAP order.
122
- * @author mfw78 <mfw78@rndlabs.xyz>
123
- */
124
- export declare class Twap extends ConditionalOrder<TwapData, TwapStruct> {
125
- isSingleOrder: boolean;
126
- /**
127
- * @see {@link ConditionalOrder.constructor}
128
- * @throws If the TWAP order is invalid.
129
- * @throws If the TWAP order is not ABI-encodable.
130
- * @throws If the handler is not the TWAP address.
131
- */
132
- constructor(params: ConditionalOrderArguments<TwapData>);
133
- /**
134
- * Create a TWAP order with sound defaults.
135
- * @param data The TWAP order parameters in a more user-friendly format.
136
- * @returns An instance of the TWAP order.
137
- */
138
- static fromData(data: TwapData, salt?: string): Twap;
139
- /**
140
- * Create a TWAP order with sound defaults.
141
- * @param data The TWAP order parameters in a more user-friendly format.
142
- * @returns An instance of the TWAP order.
143
- */
144
- static fromParams(params: ConditionalOrderParams): Twap;
145
- /**
146
- * Enforces that TWAPs will commence at the beginning of a block by use of the
147
- * `CurrentBlockTimestampFactory` contract to provide the current block timestamp
148
- * as the start time of the TWAP.
149
- */
150
- get context(): ContextFactory | undefined;
151
- /**
152
- * @inheritdoc {@link ConditionalOrder.orderType}
153
- */
154
- get orderType(): string;
155
- /**
156
- * Validate the TWAP order.
157
- * @param data The TWAP order to validate.
158
- * @returns Whether the TWAP order is valid.
159
- * @throws If the TWAP order is invalid.
160
- * @see {@link TwapStruct} for the native struct.
161
- */
162
- isValid(): IsValidResult;
163
- protected startTimestamp(params: OwnerContext): Promise<number>;
164
- /**
165
- * Given the start timestamp of the TWAP, calculate the end timestamp.
166
- * @dev As usually the `endTimestamp` is used when determining a TWAP's validity, we don't
167
- * do any lookup to the blockchain to determine the start timestamp, as this has likely
168
- * already been done during the verification flow.
169
- * @dev Beware to handle the case of `span != 0` ie. `durationOfPart.durationType !== DurationType.AUTO`.
170
- * @param startTimestamp The start timestamp of the TWAP.
171
- * @returns The timestamp at which the TWAP will end.
172
- */
173
- protected endTimestamp(startTimestamp: number): number;
174
- /**
175
- * Checks if the owner authorized the conditional order.
176
- *
177
- * @param owner The owner of the conditional order.
178
- * @param chain Which chain to use for the ComposableCoW contract.
179
- * @param provider An RPC provider for the chain.
180
- * @returns true if the owner authorized the order, false otherwise.
181
- */
182
- protected pollValidate(params: PollParams): Promise<PollResultErrors | undefined>;
183
- /**
184
- * Handles the error when the order is already present in the orderbook.
185
- *
186
- * Given the current part is in the book, it will signal to Watch Tower what to do:
187
- * - Wait until the next part starts
188
- * - Don't try again if current part is the last one
189
- *
190
- * NOTE: The error messages will refer to the parts 1-indexed, so first part is 1, second part is 2, etc.
191
- */
192
- protected handlePollFailedAlreadyPresent(_orderUid: string, _order: GPv2Order.DataStruct, params: PollParams): Promise<PollResultErrors | undefined>;
193
- /**
194
- * Serialize the TWAP order into it's ABI-encoded form.
195
- * @returns {string} The ABI-encoded TWAP order.
196
- */
197
- serialize(): string;
198
- /**
199
- * Get the encoded static input for the TWAP order.
200
- * @returns {string} The ABI-encoded TWAP order.
201
- */
202
- encodeStaticInput(): string;
203
- /**
204
- * Deserialize a TWAP order from it's ABI-encoded form.
205
- * @param {string} twapSerialized ABI-encoded TWAP order to deserialize.
206
- * @returns A deserialized TWAP order.
207
- */
208
- static deserialize(twapSerialized: string): Twap;
209
- /**
210
- * Create a human-readable string representation of the TWAP order.
211
- * @returns {string} A human-readable string representation of the TWAP order.
212
- */
213
- toString(): string;
214
- /**
215
- * Transform parameters into a native struct.
216
- *
217
- * @param {TwapData} data As passed by the consumer of the API.
218
- * @returns {TwapStruct} A formatted struct as expected by the smart contract.
219
- */
220
- transformDataToStruct(data: TwapData): TwapStruct;
221
- /**
222
- * Transform parameters into a TWAP order struct.
223
- *
224
- * @param {TwapData} params As passed by the consumer of the API.
225
- * @returns {TwapStruct} A formatted struct as expected by the smart contract.
226
- */
227
- transformStructToData(struct: TwapStruct): TwapData;
228
- }
229
- /**
230
- * Transform parameters into a native struct.
231
- *
232
- * @param {TwapData} data As passed by the consumer of the API.
233
- * @returns {TwapStruct} A formatted struct as expected by the smart contract.
234
- */
235
- export declare function transformDataToStruct(data: TwapData): TwapStruct;
236
- /**
237
- * Transform parameters into a TWAP order struct.
238
- *
239
- * @param {TwapData} params As passed by the consumer of the API.
240
- * @returns {TwapStruct} A formatted struct as expected by the smart contract.
241
- */
242
- export declare function transformStructToData(struct: TwapStruct): TwapData;
@@ -1,3 +0,0 @@
1
- import { ConditionalOrderRegistry } from '../ConditionalOrderFactory';
2
- export * from './Twap';
3
- export declare const DEFAULT_CONDITIONAL_ORDER_REGISTRY: ConditionalOrderRegistry;
@@ -1,25 +0,0 @@
1
- import { GPv2Order } from '../../../common/generated/ComposableCoW';
2
- import { ConditionalOrder } from '../../ConditionalOrder';
3
- import { IsValidResult, PollParams, PollResultErrors } from '../../types';
4
- export declare const DEFAULT_ORDER_PARAMS: TestConditionalOrderParams;
5
- export type TestConditionalOrderParams = {
6
- handler: string;
7
- salt?: string;
8
- data: string;
9
- isSingleOrder: boolean;
10
- };
11
- export declare class TestConditionalOrder extends ConditionalOrder<string, string> {
12
- isSingleOrder: boolean;
13
- constructor(params: TestConditionalOrderParams);
14
- get orderType(): string;
15
- encodeStaticInput(): string;
16
- testEncodeStaticInput(): string;
17
- transformStructToData(params: string): string;
18
- transformDataToStruct(params: string): string;
19
- protected pollValidate(_params: PollParams): Promise<PollResultErrors | undefined>;
20
- protected handlePollFailedAlreadyPresent(_orderUid: string, _order: GPv2Order.DataStruct, _params: PollParams): Promise<PollResultErrors | undefined>;
21
- isValid(): IsValidResult;
22
- serialize(): string;
23
- toString(): string;
24
- }
25
- export declare const createTestConditionalOrder: (params?: Partial<TestConditionalOrderParams>) => TestConditionalOrder;
@@ -1,133 +0,0 @@
1
- import { OrderBookApi } from '../order-book';
2
- import { SupportedChainId } from '../common';
3
- import { GPv2Order } from '../common/generated/ComposableCoW';
4
- import { providers } from 'ethers';
5
- export interface ConditionalOrderArguments<T> {
6
- handler: string;
7
- data: T;
8
- salt?: string;
9
- hasOffChainInput?: boolean;
10
- }
11
- export type ConditionalOrderParams = {
12
- readonly handler: string;
13
- readonly salt: string;
14
- readonly staticInput: string;
15
- };
16
- export declare enum ProofLocation {
17
- PRIVATE = 0,
18
- EMITTED = 1,
19
- SWARM = 2,
20
- WAKU = 3,
21
- RESERVED = 4,
22
- IPFS = 5
23
- }
24
- /**
25
- * A factory and it's arguments that are called at transaction mining time to generate the context
26
- * for a conditional order(s).
27
- *
28
- * This allows to support the case where conditional orders may want to *commence* validity at the
29
- * time of transaction mining, like in the case of a `TWAP` executed by a DAO or `Safe` that takes
30
- * a reasonable amount of time to aggregate signatures or collect votes.
31
- *
32
- * @remarks This is used in conjunction with `setRootWithContext` or `createWithContext`.
33
- */
34
- export type ContextFactory = {
35
- address: string;
36
- factoryArgs?: {
37
- args: unknown[];
38
- argsType: string[];
39
- };
40
- };
41
- /**
42
- * A struct for a proof that can be used with `setRoot` and `setRootWithContext` on a
43
- * ComposableCoW-enabled Safe.
44
- */
45
- export type ProofStruct = {
46
- location: ProofLocation;
47
- data: string | '0x';
48
- };
49
- /**
50
- * Payload for emitting a merkle root to a ComposableCoW-enabled Safe.
51
- *
52
- * If setting `ProofLocation.EMITTED`, this type should be used as the `data` in the `Proof` struct.
53
- */
54
- export type PayloadLocationEmitted = {
55
- proofs: ProofWithParams[];
56
- };
57
- /**
58
- * A proof for a conditional order and it's parameters.
59
- */
60
- export type ProofWithParams = {
61
- proof: string[];
62
- params: ConditionalOrderParams;
63
- };
64
- export type OwnerContext = {
65
- owner: string;
66
- chainId: SupportedChainId;
67
- provider: providers.Provider;
68
- };
69
- export type PollParams = OwnerContext & {
70
- orderBookApi: OrderBookApi;
71
- offchainInput?: string;
72
- proof?: string[];
73
- /**
74
- * If present, it can be used for custom conditional order validations. If not present, the orders will need to get the block info themselves
75
- */
76
- blockInfo?: BlockInfo;
77
- };
78
- export type BlockInfo = {
79
- blockNumber: number;
80
- blockTimestamp: number;
81
- };
82
- export type PollResult = PollResultSuccess | PollResultErrors;
83
- export type PollResultErrors = PollResultTryNextBlock | PollResultTryOnBlock | PollResultTryAtEpoch | PollResultUnexpectedError | PollResultDontTryAgain;
84
- export declare enum PollResultCode {
85
- SUCCESS = "SUCCESS",
86
- UNEXPECTED_ERROR = "UNEXPECTED_ERROR",
87
- TRY_NEXT_BLOCK = "TRY_NEXT_BLOCK",
88
- TRY_ON_BLOCK = "TRY_ON_BLOCK",
89
- TRY_AT_EPOCH = "TRY_AT_EPOCH",
90
- DONT_TRY_AGAIN = "DONT_TRY_AGAIN"
91
- }
92
- export interface PollResultSuccess {
93
- readonly result: PollResultCode.SUCCESS;
94
- readonly order: GPv2Order.DataStruct;
95
- readonly signature: string;
96
- }
97
- export interface PollResultUnexpectedError {
98
- readonly result: PollResultCode.UNEXPECTED_ERROR;
99
- readonly error: unknown;
100
- reason?: string;
101
- }
102
- export interface PollResultTryNextBlock {
103
- readonly result: PollResultCode.TRY_NEXT_BLOCK;
104
- reason?: string;
105
- }
106
- export interface PollResultTryOnBlock {
107
- readonly result: PollResultCode.TRY_ON_BLOCK;
108
- readonly blockNumber: number;
109
- reason?: string;
110
- }
111
- export interface PollResultTryAtEpoch {
112
- readonly result: PollResultCode.TRY_AT_EPOCH;
113
- /**
114
- * The epoch after which it is ok to retry to to poll this order.
115
- * The value is expressed as a Unix timestamp (in seconds).
116
- *
117
- * This epoch will be inclusive, meaning that it is ok to retry at the block mined precisely at this epoch or later.
118
- */
119
- readonly epoch: number;
120
- reason?: string;
121
- }
122
- export interface PollResultDontTryAgain {
123
- readonly result: PollResultCode.DONT_TRY_AGAIN;
124
- reason?: string;
125
- }
126
- export type IsValidResult = IsValid | IsNotValid;
127
- export interface IsValid {
128
- isValid: true;
129
- }
130
- export interface IsNotValid {
131
- isValid: false;
132
- reason: string;
133
- }
@@ -1,36 +0,0 @@
1
- import { utils, providers, BigNumber } from 'ethers';
2
- import { SupportedChainId } from '../common';
3
- import { BlockInfo, ConditionalOrderParams } from './types';
4
- import { Order } from '@cowprotocol/contracts';
5
- import { GPv2Order } from '../common/generated/ComposableCoW';
6
- export declare const CONDITIONAL_ORDER_PARAMS_ABI: string[];
7
- export declare const DEFAULT_TOKEN_FORMATTER: (address: string, amount: BigNumber) => string;
8
- export declare function isExtensibleFallbackHandler(handler: string, chainId: SupportedChainId): boolean;
9
- export declare function isComposableCow(handler: string, chainId: SupportedChainId): boolean;
10
- export declare function getDomainVerifier(safe: string, domain: string, chainId: SupportedChainId, provider: providers.Provider): Promise<string>;
11
- export declare function createSetDomainVerifierTx(domain: string, verifier: string): string;
12
- /**
13
- * Encode the `ConditionalOrderParams` for the conditional order.
14
- *
15
- * @param params The `ConditionalOrderParams` struct representing the conditional order as taken from a merkle tree.
16
- * @returns The ABI-encoded conditional order.
17
- * @see ConditionalOrderParams
18
- */
19
- export declare function encodeParams(params: ConditionalOrderParams): string;
20
- /**
21
- * Decode the `ConditionalOrderParams` for the conditional order.
22
- *
23
- * @param encoded The encoded conditional order.
24
- * @returns The decoded conditional order.
25
- */
26
- export declare function decodeParams(encoded: string): ConditionalOrderParams;
27
- /**
28
- * Helper method for validating ABI types.
29
- * @param types ABI types to validate against.
30
- * @param values The values to validate.
31
- * @returns {boolean} Whether the values are valid ABI for the given types.
32
- */
33
- export declare function isValidAbi(types: readonly (string | utils.ParamType)[], values: any[]): boolean;
34
- export declare function getBlockInfo(provider: providers.Provider): Promise<BlockInfo>;
35
- export declare function formatEpoch(epoch: number): string;
36
- export declare function fromStructToOrder(order: GPv2Order.DataStruct): Order;
@@ -1,35 +0,0 @@
1
- import { SupportedChainId } from 'src/common';
2
- import { ICoWShedCall, ICoWShedOptions } from './types';
3
- import type { Signer } from '@ethersproject/abstract-signer';
4
- import { TypedDataDomain } from 'ethers';
5
- import { EcdsaSigningScheme } from '@cowprotocol/contracts';
6
- export declare class CowShedHooks {
7
- private chainId;
8
- private customOptions?;
9
- constructor(chainId: SupportedChainId, customOptions?: ICoWShedOptions | undefined);
10
- proxyOf(user: string): string;
11
- encodeExecuteHooksForFactory(calls: ICoWShedCall[], nonce: string, deadline: bigint, user: string, signature: string): string;
12
- signCalls(calls: ICoWShedCall[], nonce: string, deadline: bigint, signer: Signer, signingScheme: EcdsaSigningScheme): Promise<string>;
13
- infoToSign(calls: ICoWShedCall[], nonce: string, deadline: bigint, proxy: string): {
14
- domain: TypedDataDomain;
15
- types: {
16
- ExecuteHooks: {
17
- type: string;
18
- name: string;
19
- }[];
20
- Call: {
21
- type: string;
22
- name: string;
23
- }[];
24
- };
25
- message: {
26
- calls: ICoWShedCall[];
27
- nonce: string;
28
- deadline: bigint;
29
- };
30
- };
31
- getDomain(proxy: string): TypedDataDomain;
32
- proxyCreationCode(): string;
33
- getFactoryAddress(): string;
34
- getImplementationAddress(): string;
35
- }
@@ -1,4 +0,0 @@
1
- import { CoWShedInterface } from 'src/common/generated/CoWShed';
2
- import { CoWShedFactoryInterface } from 'src/common/generated/CoWShedFactory';
3
- export declare function getCoWShedInterface(): CoWShedInterface;
4
- export declare function getCoWShedFactoryInterface(): CoWShedFactoryInterface;
@@ -1,4 +0,0 @@
1
- export * from './types';
2
- export * from './CoWShedHooks';
3
- export * from './contracts';
4
- export * from './proxyInitCode';
@@ -1 +0,0 @@
1
- export declare const COW_SHED_PROXY_INIT_CODE = "0x60a034608e57601f61037138819003918201601f19168301916001600160401b038311848410176093578084926040948552833981010312608e57604b602060458360a9565b920160a9565b6080527f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc556040516102b490816100bd8239608051818181608f01526101720152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203608e5756fe60806040526004361015610018575b3661019457610194565b6000803560e01c908163025b22bc1461003b575063f851a4400361000e5761010d565b3461010a5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261010a5773ffffffffffffffffffffffffffffffffffffffff60043581811691828203610106577f0000000000000000000000000000000000000000000000000000000000000000163314600014610101577f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc557fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b8280a280f35b61023d565b8380fd5b80fd5b346101645760007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc360112610164576020610146610169565b73ffffffffffffffffffffffffffffffffffffffff60405191168152f35b600080fd5b333003610101577f000000000000000000000000000000000000000000000000000000000000000090565b60ff7f68df44b1011761f481358c0f49a711192727fb02c377d697bcb0ea8ff8393ac0541615806101ef575b1561023d5760046040517ff92ee8a9000000000000000000000000000000000000000000000000000000008152fd5b507f400ada75000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000006000351614156101c0565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546000808092368280378136915af43d82803e1561027a573d90f35b3d90fdfea2646970667358221220c7c26ff3040b96a28e96d6d27b743972943aeaef81cc821544c5fe1e24f9b17264736f6c63430008190033";
@@ -1,33 +0,0 @@
1
- export interface ICoWShedOptions {
2
- factoryAddress: string;
3
- proxyCreationCode?: string;
4
- implementationAddress: string;
5
- }
6
- export interface ICoWShedCall {
7
- target: string;
8
- value: bigint;
9
- callData: string;
10
- allowFailure: boolean;
11
- isDelegateCall: boolean;
12
- }
13
- export interface ICoWShedOptions {
14
- factoryAddress: string;
15
- proxyCreationCode?: string;
16
- implementationAddress: string;
17
- }
18
- export declare const DOMAIN_TYPE: {
19
- EIP712Domain: {
20
- type: string;
21
- name: string;
22
- }[];
23
- };
24
- export declare const COW_SHED_712_TYPES: {
25
- ExecuteHooks: {
26
- type: string;
27
- name: string;
28
- }[];
29
- Call: {
30
- type: string;
31
- name: string;
32
- }[];
33
- };