@cowprotocol/cow-sdk 6.3.2-RC.2 → 7.0.0-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.
Files changed (246) hide show
  1. package/README.md +276 -192
  2. package/dist/CHANGELOG.md +24 -0
  3. package/dist/README.md +276 -192
  4. package/dist/index.d.mts +73 -0
  5. package/dist/index.d.ts +73 -11
  6. package/dist/index.js +86 -27
  7. package/dist/index.mjs +49 -0
  8. package/dist/package.json +71 -91
  9. package/package.json +71 -91
  10. package/LICENSE-APACHE +0 -201
  11. package/LICENSE-MIT +0 -21
  12. package/dist/COPYRIGHT.md +0 -13
  13. package/dist/bridging/BridgingSdk/BridgingSdk.d.ts +0 -87
  14. package/dist/bridging/BridgingSdk/findBridgeProviderFromHook.d.ts +0 -2
  15. package/dist/bridging/BridgingSdk/getBridgeSignedHook.d.ts +0 -8
  16. package/dist/bridging/BridgingSdk/getCrossChainOrder.d.ts +0 -16
  17. package/dist/bridging/BridgingSdk/getQuoteWithBridge.d.ts +0 -3
  18. package/dist/bridging/BridgingSdk/getQuoteWithoutBridge.d.ts +0 -7
  19. package/dist/bridging/BridgingSdk/mock/bridgeRequestMocks.d.ts +0 -21
  20. package/dist/bridging/BridgingSdk/types.d.ts +0 -43
  21. package/dist/bridging/const.d.ts +0 -6
  22. package/dist/bridging/errors.d.ts +0 -22
  23. package/dist/bridging/index.d.ts +0 -8
  24. package/dist/bridging/providers/across/AcrossApi.d.ts +0 -30
  25. package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +0 -44
  26. package/dist/bridging/providers/across/abi.d.ts +0 -154
  27. package/dist/bridging/providers/across/const/contracts.d.ts +0 -3
  28. package/dist/bridging/providers/across/const/interfaces.d.ts +0 -3
  29. package/dist/bridging/providers/across/const/misc.d.ts +0 -2
  30. package/dist/bridging/providers/across/const/tokens.d.ts +0 -11
  31. package/dist/bridging/providers/across/createAcrossDepositCall.d.ts +0 -9
  32. package/dist/bridging/providers/across/getDepositParams.d.ts +0 -4
  33. package/dist/bridging/providers/across/types.d.ts +0 -242
  34. package/dist/bridging/providers/across/util.d.ts +0 -43
  35. package/dist/bridging/providers/bungee/BungeeApi.d.ts +0 -67
  36. package/dist/bridging/providers/bungee/BungeeBridgeProvider.d.ts +0 -45
  37. package/dist/bridging/providers/bungee/abi.d.ts +0 -203
  38. package/dist/bridging/providers/bungee/const/contracts.d.ts +0 -4
  39. package/dist/bridging/providers/bungee/const/misc.d.ts +0 -8
  40. package/dist/bridging/providers/bungee/createBungeeDepositCall.d.ts +0 -7
  41. package/dist/bridging/providers/bungee/getBridgingStatusFromEvents.d.ts +0 -3
  42. package/dist/bridging/providers/bungee/types.d.ts +0 -268
  43. package/dist/bridging/providers/bungee/util.d.ts +0 -62
  44. package/dist/bridging/providers/mock/MockBridgeProvider.d.ts +0 -26
  45. package/dist/bridging/providers/utils/getGasLimitEstimationForHook.d.ts +0 -10
  46. package/dist/bridging/types.d.ts +0 -333
  47. package/dist/bridging/utils.d.ts +0 -9
  48. package/dist/chains/const/index.d.ts +0 -25
  49. package/dist/chains/const/path.d.ts +0 -1
  50. package/dist/chains/details/arbitrum.d.ts +0 -7
  51. package/dist/chains/details/avalanche.d.ts +0 -2
  52. package/dist/chains/details/base.d.ts +0 -7
  53. package/dist/chains/details/bnb.d.ts +0 -2
  54. package/dist/chains/details/gnosis.d.ts +0 -7
  55. package/dist/chains/details/index.d.ts +0 -10
  56. package/dist/chains/details/lens.d.ts +0 -2
  57. package/dist/chains/details/mainnet.d.ts +0 -7
  58. package/dist/chains/details/optimism.d.ts +0 -2
  59. package/dist/chains/details/polygon.d.ts +0 -2
  60. package/dist/chains/details/sepolia.d.ts +0 -7
  61. package/dist/chains/index.d.ts +0 -4
  62. package/dist/chains/types.d.ts +0 -133
  63. package/dist/chains/utils.d.ts +0 -19
  64. package/dist/common/consts/config.d.ts +0 -9
  65. package/dist/common/consts/contracts.d.ts +0 -45
  66. package/dist/common/consts/ipfs.d.ts +0 -2
  67. package/dist/common/consts/order.d.ts +0 -1
  68. package/dist/common/consts/path.d.ts +0 -1
  69. package/dist/common/consts/tokens.d.ts +0 -9
  70. package/dist/common/generated/CoWShed.d.ts +0 -219
  71. package/dist/common/generated/CoWShedFactory.d.ts +0 -191
  72. package/dist/common/generated/ComposableCoW.d.ts +0 -340
  73. package/dist/common/generated/EthFlow.d.ts +0 -117
  74. package/dist/common/generated/ExtensibleFallbackHandler.d.ts +0 -282
  75. package/dist/common/generated/GPv2Settlement.d.ts +0 -107
  76. package/dist/common/generated/TWAP.d.ts +0 -141
  77. package/dist/common/generated/common.d.ts +0 -21
  78. package/dist/common/generated/factories/CoWShedFactory__factory.d.ts +0 -250
  79. package/dist/common/generated/factories/CoWShed__factory.d.ts +0 -254
  80. package/dist/common/generated/factories/ComposableCoW__factory.d.ts +0 -475
  81. package/dist/common/generated/factories/EthFlow__factory.d.ts +0 -124
  82. package/dist/common/generated/factories/ExtensibleFallbackHandler__factory.d.ts +0 -389
  83. package/dist/common/generated/factories/GPv2Settlement__factory.d.ts +0 -81
  84. package/dist/common/generated/factories/TWAP__factory.d.ts +0 -260
  85. package/dist/common/generated/factories/index.d.ts +0 -7
  86. package/dist/common/generated/index.d.ts +0 -15
  87. package/dist/common/index.d.ts +0 -12
  88. package/dist/common/types/config.d.ts +0 -70
  89. package/dist/common/types/cow-error.d.ts +0 -4
  90. package/dist/common/types/ethereum.d.ts +0 -5
  91. package/dist/common/types/tokens.d.ts +0 -12
  92. package/dist/common/types/wallets.d.ts +0 -5
  93. package/dist/common/utils/common.d.ts +0 -1
  94. package/dist/common/utils/config.d.ts +0 -4
  95. package/dist/common/utils/log.d.ts +0 -2
  96. package/dist/common/utils/math.d.ts +0 -19
  97. package/dist/common/utils/order.d.ts +0 -4
  98. package/dist/common/utils/serialize.d.ts +0 -1
  99. package/dist/common/utils/wallet.d.ts +0 -3
  100. package/dist/composable/ConditionalOrder.d.ts +0 -206
  101. package/dist/composable/ConditionalOrderFactory.d.ts +0 -19
  102. package/dist/composable/Multiplexer.d.ts +0 -174
  103. package/dist/composable/contracts.d.ts +0 -6
  104. package/dist/composable/generated/ComposableCoW.d.ts +0 -340
  105. package/dist/composable/generated/ExtensibleFallbackHandler.d.ts +0 -282
  106. package/dist/composable/generated/TWAP.d.ts +0 -141
  107. package/dist/composable/generated/common.d.ts +0 -21
  108. package/dist/composable/generated/factories/ComposableCoW__factory.d.ts +0 -475
  109. package/dist/composable/generated/factories/ExtensibleFallbackHandler__factory.d.ts +0 -389
  110. package/dist/composable/generated/factories/TWAP__factory.d.ts +0 -260
  111. package/dist/composable/generated/factories/index.d.ts +0 -3
  112. package/dist/composable/generated/index.d.ts +0 -7
  113. package/dist/composable/index.d.ts +0 -6
  114. package/dist/composable/orderTypes/Twap.d.ts +0 -242
  115. package/dist/composable/orderTypes/index.d.ts +0 -3
  116. package/dist/composable/orderTypes/test/TestConditionalOrder.d.ts +0 -25
  117. package/dist/composable/types.d.ts +0 -133
  118. package/dist/composable/utils.d.ts +0 -37
  119. package/dist/cow-shed/CowShedSdk.d.ts +0 -74
  120. package/dist/cow-shed/contracts/CoWShedHooks.d.ts +0 -46
  121. package/dist/cow-shed/contracts/utils.d.ts +0 -4
  122. package/dist/cow-shed/index.d.ts +0 -3
  123. package/dist/cow-shed/types.d.ts +0 -17
  124. package/dist/docs/architecture.md +0 -353
  125. package/dist/examples/cra/README.md +0 -21
  126. package/dist/hooks/utils.d.ts +0 -3
  127. package/dist/index-30eefcb8.js +0 -29
  128. package/dist/index-30eefcb8.js.map +0 -1
  129. package/dist/index.js.map +0 -1
  130. package/dist/index.modern.mjs +0 -2
  131. package/dist/index.modern.mjs.map +0 -1
  132. package/dist/index.module.js +0 -29
  133. package/dist/index.module.js.map +0 -1
  134. package/dist/order-book/api.d.ts +0 -235
  135. package/dist/order-book/generated/index.d.ts +0 -55
  136. package/dist/order-book/generated/models/Address.d.ts +0 -4
  137. package/dist/order-book/generated/models/AppData.d.ts +0 -7
  138. package/dist/order-book/generated/models/AppDataHash.d.ts +0 -6
  139. package/dist/order-book/generated/models/AppDataObject.d.ts +0 -7
  140. package/dist/order-book/generated/models/Auction.d.ts +0 -30
  141. package/dist/order-book/generated/models/AuctionOrder.d.ts +0 -92
  142. package/dist/order-book/generated/models/AuctionPrices.d.ts +0 -6
  143. package/dist/order-book/generated/models/BigUint.d.ts +0 -4
  144. package/dist/order-book/generated/models/BuyTokenDestination.d.ts +0 -7
  145. package/dist/order-book/generated/models/CallData.d.ts +0 -4
  146. package/dist/order-book/generated/models/CompetitionAuction.d.ts +0 -14
  147. package/dist/order-book/generated/models/CompetitionOrderStatus.d.ts +0 -29
  148. package/dist/order-book/generated/models/EcdsaSignature.d.ts +0 -4
  149. package/dist/order-book/generated/models/EcdsaSigningScheme.d.ts +0 -7
  150. package/dist/order-book/generated/models/EthflowData.d.ts +0 -20
  151. package/dist/order-book/generated/models/ExecutedAmounts.d.ts +0 -5
  152. package/dist/order-book/generated/models/ExecutedProtocolFee.d.ts +0 -8
  153. package/dist/order-book/generated/models/FeePolicy.d.ts +0 -7
  154. package/dist/order-book/generated/models/InteractionData.d.ts +0 -11
  155. package/dist/order-book/generated/models/NativePriceResponse.d.ts +0 -10
  156. package/dist/order-book/generated/models/OnchainOrderData.d.ts +0 -24
  157. package/dist/order-book/generated/models/Order.d.ts +0 -3
  158. package/dist/order-book/generated/models/OrderCancellation.d.ts +0 -14
  159. package/dist/order-book/generated/models/OrderCancellationError.d.ts +0 -15
  160. package/dist/order-book/generated/models/OrderCancellations.d.ts +0 -18
  161. package/dist/order-book/generated/models/OrderClass.d.ts +0 -8
  162. package/dist/order-book/generated/models/OrderCreation.d.ts +0 -80
  163. package/dist/order-book/generated/models/OrderKind.d.ts +0 -7
  164. package/dist/order-book/generated/models/OrderMetaData.d.ts +0 -100
  165. package/dist/order-book/generated/models/OrderParameters.d.ts +0 -53
  166. package/dist/order-book/generated/models/OrderPostError.d.ts +0 -35
  167. package/dist/order-book/generated/models/OrderQuoteRequest.d.ts +0 -58
  168. package/dist/order-book/generated/models/OrderQuoteResponse.d.ts +0 -27
  169. package/dist/order-book/generated/models/OrderQuoteSide.d.ts +0 -26
  170. package/dist/order-book/generated/models/OrderQuoteSideKindBuy.d.ts +0 -3
  171. package/dist/order-book/generated/models/OrderQuoteSideKindSell.d.ts +0 -3
  172. package/dist/order-book/generated/models/OrderQuoteValidity.d.ts +0 -14
  173. package/dist/order-book/generated/models/OrderStatus.d.ts +0 -10
  174. package/dist/order-book/generated/models/PreSignature.d.ts +0 -4
  175. package/dist/order-book/generated/models/PriceEstimationError.d.ts +0 -12
  176. package/dist/order-book/generated/models/PriceImprovement.d.ts +0 -12
  177. package/dist/order-book/generated/models/PriceQuality.d.ts +0 -16
  178. package/dist/order-book/generated/models/Quote.d.ts +0 -19
  179. package/dist/order-book/generated/models/SellTokenSource.d.ts +0 -8
  180. package/dist/order-book/generated/models/Signature.d.ts +0 -6
  181. package/dist/order-book/generated/models/SigningScheme.d.ts +0 -9
  182. package/dist/order-book/generated/models/SolverCompetitionResponse.d.ts +0 -30
  183. package/dist/order-book/generated/models/SolverSettlement.d.ts +0 -47
  184. package/dist/order-book/generated/models/Surplus.d.ts +0 -7
  185. package/dist/order-book/generated/models/TokenAmount.d.ts +0 -4
  186. package/dist/order-book/generated/models/TotalSurplus.d.ts +0 -10
  187. package/dist/order-book/generated/models/Trade.d.ts +0 -57
  188. package/dist/order-book/generated/models/TransactionHash.d.ts +0 -4
  189. package/dist/order-book/generated/models/UID.d.ts +0 -8
  190. package/dist/order-book/generated/models/Volume.d.ts +0 -6
  191. package/dist/order-book/index.d.ts +0 -5
  192. package/dist/order-book/mock.d.ts +0 -63
  193. package/dist/order-book/quoteAmountsAndCostsUtils.d.ts +0 -35
  194. package/dist/order-book/request.d.ts +0 -49
  195. package/dist/order-book/transformOrder.d.ts +0 -10
  196. package/dist/order-book/types.d.ts +0 -74
  197. package/dist/order-signing/index.d.ts +0 -2
  198. package/dist/order-signing/orderSigningUtils.d.ts +0 -97
  199. package/dist/order-signing/types.d.ts +0 -55
  200. package/dist/order-signing/utils.d.ts +0 -49
  201. package/dist/schemas/trading/LimitOrderAdvancedSettings.ts +0 -422
  202. package/dist/schemas/trading/LimitTradeParameters.ts +0 -229
  203. package/dist/schemas/trading/QuoteResultsSerialized.ts +0 -1151
  204. package/dist/schemas/trading/QuoterParameters.ts +0 -43
  205. package/dist/schemas/trading/SwapAdvancedSettings.ts +0 -708
  206. package/dist/schemas/trading/TradeParameters.ts +0 -217
  207. package/dist/src/bridging/PROVIDER_README.md +0 -796
  208. package/dist/src/bridging/README.md +0 -718
  209. package/dist/src/cow-shed/README.md +0 -60
  210. package/dist/src/trading/README.md +0 -544
  211. package/dist/src/weiroll/README.md +0 -58
  212. package/dist/subgraph/api.d.ts +0 -77
  213. package/dist/subgraph/graphql.d.ts +0 -3203
  214. package/dist/subgraph/index.d.ts +0 -1
  215. package/dist/subgraph/queries.d.ts +0 -14
  216. package/dist/test/getWallet.d.ts +0 -5
  217. package/dist/test/utils.d.ts +0 -1
  218. package/dist/trading/appDataUtils.d.ts +0 -5
  219. package/dist/trading/calculateUniqueOrderId.d.ts +0 -5
  220. package/dist/trading/consts.d.ts +0 -6
  221. package/dist/trading/getEthFlowTransaction.d.ts +0 -12
  222. package/dist/trading/getOrderToSign.d.ts +0 -11
  223. package/dist/trading/getOrderTypedData.d.ts +0 -4
  224. package/dist/trading/getPreSignTransaction.d.ts +0 -4
  225. package/dist/trading/getQuote.d.ts +0 -26
  226. package/dist/trading/index.d.ts +0 -21
  227. package/dist/trading/postCoWProtocolTrade.d.ts +0 -4
  228. package/dist/trading/postLimitOrder.d.ts +0 -3
  229. package/dist/trading/postSellNativeCurrencyOrder.d.ts +0 -4
  230. package/dist/trading/postSwapOrder.d.ts +0 -5
  231. package/dist/trading/suggestSlippageBps.d.ts +0 -13
  232. package/dist/trading/suggestSlippageFromFee.d.ts +0 -19
  233. package/dist/trading/suggestSlippageFromVolume.d.ts +0 -10
  234. package/dist/trading/tradingSdk.d.ts +0 -26
  235. package/dist/trading/types.d.ts +0 -221
  236. package/dist/trading/utils/getPartnerFeeBps.d.ts +0 -2
  237. package/dist/trading/utils/misc.d.ts +0 -27
  238. package/dist/trading/utils/slippage.d.ts +0 -16
  239. package/dist/utils-9f8a0370.js +0 -2
  240. package/dist/utils-9f8a0370.js.map +0 -1
  241. package/dist/utils-a846dcac.js +0 -2
  242. package/dist/utils-a846dcac.js.map +0 -1
  243. package/dist/utils-ea990520.js +0 -2
  244. package/dist/utils-ea990520.js.map +0 -1
  245. package/dist/utils.d.ts +0 -3
  246. package/dist/weiroll/index.d.ts +0 -23
@@ -1,268 +0,0 @@
1
- export type SupportedBridge = 'across' | 'cctp' | 'gnosis-native-bridge';
2
- export interface BungeeQuoteAPIRequest {
3
- userAddress: string;
4
- originChainId: string;
5
- destinationChainId: string;
6
- inputToken: string;
7
- inputAmount: string;
8
- receiverAddress: string;
9
- outputToken: string;
10
- enableManual: true;
11
- disableSwapping: true;
12
- disableAuto: true;
13
- includeBridges?: SupportedBridge[];
14
- }
15
- export interface BungeeQuoteAPIResponse {
16
- success: boolean;
17
- statusCode: number;
18
- result: {
19
- originChainId: number;
20
- destinationChainId: number;
21
- userAddress: string;
22
- receiverAddress: string;
23
- input: {
24
- token: {
25
- chainId: number;
26
- address: string;
27
- name: string;
28
- symbol: string;
29
- decimals: number;
30
- logoURI: string;
31
- icon: string;
32
- };
33
- amount: string;
34
- priceInUsd: number;
35
- valueInUsd: number;
36
- };
37
- destinationExec: unknown;
38
- autoRoute: unknown;
39
- manualRoutes: Array<{
40
- quoteId: string;
41
- quoteExpiry: number;
42
- output: {
43
- token: {
44
- chainId: number;
45
- address: string;
46
- name: string;
47
- symbol: string;
48
- decimals: number;
49
- logoURI: string;
50
- icon: string;
51
- };
52
- amount: string;
53
- priceInUsd: number;
54
- valueInUsd: number;
55
- minAmountOut: string;
56
- effectiveReceivedInUsd: number;
57
- };
58
- affiliateFee: unknown;
59
- approvalData: {
60
- spenderAddress: string;
61
- amount: string;
62
- tokenAddress: string;
63
- userAddress: string;
64
- };
65
- gasFee: {
66
- gasToken: {
67
- chainId: number;
68
- address: string;
69
- symbol: string;
70
- name: string;
71
- decimals: number;
72
- icon: string;
73
- logoURI: string;
74
- chainAgnosticId: unknown;
75
- };
76
- gasLimit: string;
77
- gasPrice: string;
78
- estimatedFee: string;
79
- feeInUsd: number;
80
- };
81
- slippage: number;
82
- estimatedTime: number;
83
- routeDetails: {
84
- name: string;
85
- logoURI: string;
86
- routeFee: {
87
- token: {
88
- chainId: number;
89
- address: string;
90
- name: string;
91
- symbol: string;
92
- decimals: number;
93
- logoURI: string;
94
- icon: string;
95
- };
96
- amount: string;
97
- feeInUsd: number;
98
- priceInUsd: number;
99
- };
100
- dexDetails: unknown;
101
- };
102
- refuel: unknown;
103
- }>;
104
- };
105
- }
106
- export declare enum BungeeBridge {
107
- 'Across' = "across",
108
- 'CircleCCTP' = "cctp",
109
- 'GnosisNative' = "gnosis-native-bridge"
110
- }
111
- export declare const BungeeBridgeNames: Record<string, BungeeBridge>;
112
- export interface BungeeQuote {
113
- originChainId: number;
114
- destinationChainId: number;
115
- userAddress: string;
116
- receiverAddress: string;
117
- input: BungeeQuoteAPIResponse['result']['input'];
118
- route: BungeeQuoteAPIResponse['result']['manualRoutes'][0];
119
- routeBridge: BungeeBridge;
120
- quoteTimestamp: number;
121
- }
122
- export type BungeeQuoteWithBuildTx = {
123
- bungeeQuote: BungeeQuote;
124
- buildTx: BungeeBuildTx;
125
- };
126
- export interface BungeeBuildTxAPIResponse {
127
- success: boolean;
128
- statusCode: number;
129
- result: {
130
- approvalData: {
131
- spenderAddress: string;
132
- amount: string;
133
- tokenAddress: string;
134
- userAddress: string;
135
- };
136
- txData: {
137
- data: string;
138
- to: string;
139
- chainId: number;
140
- value: string;
141
- };
142
- userOp: string;
143
- };
144
- }
145
- export type BungeeBuildTx = BungeeBuildTxAPIResponse['result'];
146
- export interface InputAmountTxDataBytesIndices {
147
- inputAmount: {
148
- bytes_startIndex: number;
149
- bytes_length: number;
150
- bytesString_startIndex: number;
151
- bytesString_length: number;
152
- };
153
- }
154
- export interface OutputAmountTxDataBytesIndices {
155
- outputAmount: {
156
- bytes_startIndex: number;
157
- bytes_length: number;
158
- bytesString_startIndex: number;
159
- bytesString_length: number;
160
- };
161
- }
162
- export interface InputOutputAmountTxDataBytesIndices extends InputAmountTxDataBytesIndices, OutputAmountTxDataBytesIndices {
163
- }
164
- export type BungeeTxDataBytesIndicesType = {
165
- [K in BungeeBridge]: {
166
- [functionSelector: string]: K extends BungeeBridge.Across ? InputOutputAmountTxDataBytesIndices : InputAmountTxDataBytesIndices;
167
- };
168
- };
169
- export type SocketRequest = {
170
- amount: string;
171
- recipient: string;
172
- toChainId: string;
173
- token: string;
174
- signature: string;
175
- };
176
- export type UserRequestValidation = {
177
- routeId: string;
178
- socketRequest: SocketRequest;
179
- };
180
- export declare enum BungeeEventStatus {
181
- COMPLETED = "COMPLETED",
182
- PENDING = "PENDING"
183
- }
184
- export declare enum BungeeBridgeName {
185
- ACROSS = "across",
186
- CCTP = "cctp"
187
- }
188
- export type BungeeEvent = {
189
- identifier: string;
190
- srcTransactionHash?: string;
191
- bridgeName: BungeeBridgeName;
192
- fromChainId: number;
193
- gasUsed: string;
194
- isCowswapTrade: boolean;
195
- isSocketTx: boolean;
196
- metadata: string;
197
- orderId: string;
198
- recipient: string;
199
- sender: string;
200
- socketContractVersion: string;
201
- srcAmount: string;
202
- srcBlockHash: string;
203
- srcBlockNumber: number;
204
- srcBlockTimeStamp: number;
205
- srcTokenAddress: string;
206
- srcTokenDecimals: number;
207
- srcTokenLogoURI: string;
208
- srcTokenName: string;
209
- srcTokenSymbol: string;
210
- to: string;
211
- toChainId: number;
212
- destTransactionHash?: string;
213
- destAmount?: string;
214
- destBlockHash: string;
215
- destBlockNumber: number;
216
- destBlockTimeStamp: number;
217
- destTokenAddress: string;
218
- destTokenDecimals: number;
219
- destTokenLogoURI: string;
220
- destTokenName: string;
221
- destTokenSymbol: string;
222
- srcTxStatus: BungeeEventStatus;
223
- destTxStatus: BungeeEventStatus;
224
- };
225
- export type BungeeEventsAPIResponse = {
226
- success: boolean;
227
- result: Array<BungeeEvent>;
228
- };
229
- export interface AcrossStatusAPIResponse {
230
- status: 'filled' | 'pending' | 'expired' | 'refunded' | 'slowFillRequested';
231
- originChainId: string;
232
- depositId: string;
233
- depositTxHash?: string;
234
- fillTx?: string;
235
- destinationChainId?: string;
236
- depositRefundTxHash?: string;
237
- pagination?: {
238
- currentIndex: number;
239
- maxIndex: number;
240
- };
241
- }
242
- export type AcrossStatus = AcrossStatusAPIResponse['status'];
243
- export type BungeeBuyTokensAPIResponse = {
244
- success: boolean;
245
- statusCode: number;
246
- result: Array<{
247
- chainId: number;
248
- address: string;
249
- decimals: number;
250
- name?: string;
251
- symbol?: string;
252
- logoURI?: string;
253
- icon?: string;
254
- }>;
255
- };
256
- export type BungeeIntermediateTokensAPIResponse = {
257
- success: boolean;
258
- statusCode: number;
259
- result: Array<{
260
- chainId: number;
261
- address: string;
262
- name: string;
263
- symbol: string;
264
- decimals: number;
265
- logoURI: string;
266
- icon: string;
267
- }>;
268
- };
@@ -1,62 +0,0 @@
1
- import { BungeeQuoteResult } from './BungeeBridgeProvider';
2
- import { BungeeQuoteWithBuildTx } from './types';
3
- import { ethers, Signer } from 'ethers';
4
- import { BungeeBridge } from './types';
5
- import { QuoteBridgeRequest } from '../../types';
6
- import { SignerLike } from '../../../common';
7
- /**
8
- * Convert a QuoteBridgeRequest to a BungeeQuoteResult
9
- * @param request - The QuoteBridgeRequest to convert
10
- * @param slippageBps
11
- * @param bungeeQuoteWithBuildTx
12
- * @returns The BungeeQuoteResult
13
- */
14
- export declare function toBridgeQuoteResult(request: QuoteBridgeRequest, slippageBps: number, bungeeQuoteWithBuildTx: BungeeQuoteWithBuildTx): BungeeQuoteResult;
15
- /**
16
- * Decodes the txData from Bungee API
17
- * @param txData - The txData to decode
18
- * @returns The routeId and encoded function data
19
- */
20
- export declare function decodeBungeeBridgeTxData(txData: string): {
21
- routeId: string;
22
- encodedFunctionData: string;
23
- functionSelector: string;
24
- };
25
- export declare function applyBps(amount: bigint, bps: number): bigint;
26
- export declare function calculateFeeBps(feeAmountBig: bigint, amountBig: bigint): number;
27
- /**
28
- * Converts an object to URLSearchParams, handling arrays by joining values with commas
29
- * @param params Object to convert to URLSearchParams
30
- * @returns URLSearchParams instance
31
- *
32
- * @example
33
- * const params = {
34
- * userAddress: '0x123',
35
- * includeBridges: ['across', 'cctp']
36
- * }
37
- * const searchParams = objectToSearchParams(params)
38
- * Results in: ?userAddress=0x123&includeBridges=across,cctp
39
- */
40
- export declare function objectToSearchParams(params: object): URLSearchParams;
41
- export declare function getSignerForChainId(chainId: number, signer: SignerLike): Promise<Signer>;
42
- export declare function fetchTokenAllowance(params: {
43
- chainId: number;
44
- tokenAddress: string;
45
- ownerAddress: string;
46
- spenderAddress: string;
47
- signer: SignerLike;
48
- }): Promise<bigint>;
49
- export declare function getErc20Contract(tokenAddress: string, signer?: ethers.Signer | ethers.providers.Provider): ethers.Contract;
50
- export declare const getBungeeBridgeFromDisplayName: (displayName: string) => BungeeBridge | undefined;
51
- export declare const getDisplayNameFromBungeeBridge: (bridge: BungeeBridge) => string | undefined;
52
- export declare const decodeAmountsBungeeTxData: (txData: string, bridge: BungeeBridge) => {
53
- inputAmountBytes: string;
54
- inputAmountBigNumber: ethers.BigNumber;
55
- outputAmountBytes: string;
56
- outputAmountBigNumber: ethers.BigNumber;
57
- } | {
58
- inputAmountBytes: string;
59
- inputAmountBigNumber: ethers.BigNumber;
60
- outputAmountBytes?: undefined;
61
- outputAmountBigNumber?: undefined;
62
- };
@@ -1,26 +0,0 @@
1
- import { latest as latestAppData } from '@cowprotocol/app-data';
2
- import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, GetProviderBuyTokens, QuoteBridgeRequest } from '../../types';
3
- import { Signer } from '@ethersproject/abstract-signer';
4
- import { JsonRpcProvider } from '@ethersproject/providers';
5
- import { ChainId, ChainInfo, SupportedChainId } from '../../../chains';
6
- import { EvmCall, TokenInfo } from '../../../common';
7
- export declare class MockBridgeProvider implements BridgeProvider<BridgeQuoteResult> {
8
- info: BridgeProviderInfo;
9
- getRpcProvider(): JsonRpcProvider;
10
- getNetworks(): Promise<ChainInfo[]>;
11
- getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
12
- getIntermediateTokens({ sellTokenChainId }: QuoteBridgeRequest): Promise<TokenInfo[]>;
13
- getQuote(_request: QuoteBridgeRequest): Promise<BridgeQuoteResult>;
14
- getGasLimitEstimationForHook(_request: QuoteBridgeRequest): Promise<number>;
15
- getUnsignedBridgeCall(_request: QuoteBridgeRequest, _quote: BridgeQuoteResult): Promise<EvmCall>;
16
- getSignedHook(_chainId: SupportedChainId, _unsignedCall: EvmCall, _signer: Signer): Promise<BridgeHook>;
17
- decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
18
- getBridgingParams(_chainId: ChainId, _orderUid: string, _txHash: string): Promise<{
19
- params: BridgingDepositParams;
20
- status: BridgeStatusResult;
21
- }>;
22
- getExplorerUrl(bridgingId: string): string;
23
- getStatus(_bridgingId: string): Promise<BridgeStatusResult>;
24
- getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
25
- getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
26
- }
@@ -1,10 +0,0 @@
1
- import { QuoteBridgeRequest } from '../../types';
2
- import type { JsonRpcProvider } from '@ethersproject/providers';
3
- import { CowShedSdk } from '../../../cow-shed';
4
- export declare function getGasLimitEstimationForHook({ cowShedSdk, request, provider, extraGas, extraGasProxyCreation, }: {
5
- cowShedSdk: CowShedSdk;
6
- request: QuoteBridgeRequest;
7
- provider: JsonRpcProvider;
8
- extraGas?: number;
9
- extraGasProxyCreation?: number;
10
- }): Promise<number>;
@@ -1,333 +0,0 @@
1
- import { latest as latestAppData } from '@cowprotocol/app-data';
2
- import { ChainId, ChainInfo, SupportedChainId, TargetChainId } from '../chains';
3
- import { TokenInfo } from '../common/types/tokens';
4
- import { Address, Amounts, EnrichedOrder, OrderKind } from '../order-book';
5
- import { EvmCall } from '../common/types/ethereum';
6
- import type { AccountAddress } from '../common/types/wallets';
7
- import { OrderPostingResult, QuoteAndPost, QuoteResults, QuoterParameters, SigningStepManager, SwapAdvancedSettings, TradeOptionalParameters, TraderParameters } from '../trading';
8
- import { Signer } from '@ethersproject/abstract-signer';
9
- import { JsonRpcProvider } from '@ethersproject/providers';
10
- export interface BridgeProviderInfo {
11
- name: string;
12
- logoUrl: string;
13
- dappId: string;
14
- website: string;
15
- }
16
- interface WithSellToken {
17
- sellTokenChainId: SupportedChainId;
18
- sellTokenAddress: Address;
19
- sellTokenDecimals: number;
20
- }
21
- interface WithBuyToken {
22
- buyTokenChainId: TargetChainId;
23
- buyTokenAddress: Address;
24
- buyTokenDecimals: number;
25
- }
26
- type WithQuoter = Omit<QuoterParameters, 'chainId'>;
27
- type WithTrader = Pick<TraderParameters, 'signer'>;
28
- /**
29
- * Parameters for getting a bridge quote
30
- */
31
- export type QuoteBridgeRequest = {
32
- kind: OrderKind;
33
- amount: bigint;
34
- owner?: AccountAddress;
35
- } & WithSellToken & WithBuyToken & WithQuoter & WithTrader & TradeOptionalParameters;
36
- export type QuoteBridgeRequestWithoutAmount = Omit<QuoteBridgeRequest, 'amount'>;
37
- export interface BridgeQuoteResult {
38
- /**
39
- * Whether the quote is a sell or buy order.
40
- */
41
- isSell: boolean;
42
- /**
43
- * Costs and amounts of the bridging.
44
- */
45
- amountsAndCosts: BridgeQuoteAmountsAndCosts;
46
- /**
47
- * The estimated time in seconds it takes to fill the order.
48
- */
49
- expectedFillTimeSeconds?: number;
50
- /**
51
- * The timestamp of the quote.
52
- */
53
- quoteTimestamp: number;
54
- fees: {
55
- /**
56
- * The amount that should go to the relayer as a fee to cover relayer capital costs.
57
- * In token atoms.
58
- */
59
- bridgeFee: bigint;
60
- /**
61
- * The amount that should go to the relayer as a fee to cover relayer gas costs.
62
- * In token atoms.
63
- */
64
- destinationGasFee: bigint;
65
- };
66
- limits: {
67
- /**
68
- * The minimum amount that should be deposited in the source chain.
69
- * In token atoms.
70
- */
71
- minDeposit: bigint;
72
- /**
73
- * The maximum amount that can be deposited in the source chain.
74
- * In token atoms.
75
- */
76
- maxDeposit: bigint;
77
- };
78
- }
79
- export interface BridgeHook {
80
- postHook: latestAppData.CoWHook;
81
- recipient: string;
82
- }
83
- export declare enum BridgeStatus {
84
- IN_PROGRESS = "in_progress",
85
- EXECUTED = "executed",
86
- EXPIRED = "expired",
87
- REFUND = "refund",
88
- UNKNOWN = "unknown"
89
- }
90
- export interface BridgeStatusResult {
91
- status: BridgeStatus;
92
- fillTimeInSeconds?: number;
93
- /**
94
- * Transaction hash of the deposit on the origin chain.
95
- */
96
- depositTxHash?: string;
97
- /**
98
- * Transaction hash of the fill on the destination chain.
99
- * Only present when fillStatus is 'filled'.
100
- */
101
- fillTxHash?: string;
102
- }
103
- /**
104
- * When sellChainId and/or sellTokenAddress are specified
105
- * then the buy tokens list will be additionally filtered
106
- */
107
- export interface BuyTokensParams {
108
- buyChainId: TargetChainId;
109
- sellChainId?: SupportedChainId;
110
- sellTokenAddress?: string;
111
- }
112
- export interface GetProviderBuyTokens {
113
- tokens: TokenInfo[];
114
- isRouteAvailable: boolean;
115
- }
116
- /**
117
- * A bridge deposit. It includes the provideer information, sell amount and the minimum buy amount.
118
- *
119
- * It models the minimal information for a bridging order.
120
- *
121
- */
122
- export interface BridgeDeposit extends Omit<QuoteBridgeRequest, 'amount'> {
123
- readonly provider: BridgeProviderInfo;
124
- sellTokenAmount: string;
125
- minBuyAmount: string;
126
- }
127
- export interface BridgeProvider<Q extends BridgeQuoteResult> {
128
- info: BridgeProviderInfo;
129
- getRpcProvider(chainId: SupportedChainId): JsonRpcProvider;
130
- /**
131
- * Get basic supported chains
132
- */
133
- getNetworks(): Promise<ChainInfo[]>;
134
- /**
135
- * Get supported tokens for a chain
136
- */
137
- getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
138
- /**
139
- * Get intermediate tokens given a quote request.
140
- *
141
- * An intermediate token, is a token in the source chain, that could be used to bridge the tokens to the destination chain.
142
- * This method returns a sorted list of tokens, they are sorted by priority, so first tokens are more likely to be more liquid.
143
- *
144
- * @param request - The quote request
145
- */
146
- getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
147
- /**
148
- * Get a quote for a bridge request.
149
- *
150
- * @param request - The quote request
151
- */
152
- getQuote(request: QuoteBridgeRequest): Promise<Q>;
153
- /**
154
- * Get an unsigned bridge call for a quote.
155
- *
156
- * The transaction details should be executed in the context of cow-shed account.
157
- *
158
- * @param request - The quote request
159
- * @param quote - The quote
160
- * @returns The unsigned transaction details that cow-shed needs to sign
161
- */
162
- getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: Q): Promise<EvmCall>;
163
- /**
164
- * Returns the estimated gas cost for executing the bridge hook.
165
- *
166
- * This method helps calculate the final amount of tokens the user will receive more accurately.
167
- * The estimation is done without the amount parameter to break a circular dependency:
168
- * 1. Hook gas costs affect the final amount
169
- * 2. The final amount could affect hook gas costs
170
- *
171
- * By estimating gas costs independently, we can resolve this dependency cycle.
172
- * For some providers, the `extraGas` parameter adds additional gas‐unit buffer to the hook
173
- * and `extraGasProxyCreation` parameter adds additional gas‐unit buffer for the proxy creation
174
- * (see DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION and DEFAULT_EXTRA_GAS_PROXY_CREATION).
175
- */
176
- getGasLimitEstimationForHook(request: Omit<QuoteBridgeRequest, 'amount'> & {
177
- extraGas?: number;
178
- extraGasProxyCreation?: number;
179
- }): Promise<number>;
180
- /**
181
- * Get a pre-authorized hook for initiating a bridge.
182
- *
183
- * The hook contains the ethereum call that the trampoline contract will need to execute during the settlement to initate the bridge.
184
- *
185
- * Typically, this hook will:
186
- * - Get the balance of cow-shed account
187
- * - Ensure the approval for the bridge lock contract is set
188
- * - Deposit into the bridge contract
189
- *
190
- * This hook will include the pre-authorization (signature) of the owner of the cow-shed account (the trader).
191
- */
192
- getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number): Promise<BridgeHook>;
193
- /**
194
- * Decode a bridge hook into a bridge deposit information.
195
- *
196
- * This method is used to recover the information about the limit order placed into the bridge locking contract.
197
- * This allows to load an order from the orderbook and decode the bridging hook and understand what was the minimum buy amount the user signed to receive in the destination chain.
198
- *
199
- * @param hook - The bridge hook
200
- */
201
- decodeBridgeHook(hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
202
- /**
203
- * Get the identifier of the bridging transaction from the settlement transaction.
204
- * @param chainId
205
- * @param orderUid - The unique identifier of the order
206
- * @param txHash - The hash of the settlement transaction in which the bridging post-hook was executed
207
- */
208
- getBridgingParams(chainId: ChainId, orderUid: string, txHash: string): Promise<{
209
- params: BridgingDepositParams;
210
- status: BridgeStatusResult;
211
- } | null>;
212
- /**
213
- * Get the explorer url for a bridging id.
214
- *
215
- * @param bridgingId - The bridging id
216
- */
217
- getExplorerUrl(bridgingId: string): string;
218
- /**
219
- * Get the status of a bridging transaction.
220
- *
221
- * @param bridgingId - The bridging id
222
- * @param originChainId - id of network where funds were deposited
223
- */
224
- getStatus(bridgingId: string, originChainId: SupportedChainId): Promise<BridgeStatusResult>;
225
- getCancelBridgingTx(bridgingId: string): Promise<EvmCall>;
226
- getRefundBridgingTx(bridgingId: string): Promise<EvmCall>;
227
- }
228
- /**
229
- * A quote and post for a cross-chain swap.
230
- *
231
- * If the order happens in a single chain, it returns the quote and post details for CoW Protocol.
232
- * If the order happens in multiple chains, it returns the quote and post details for CoW Protocol, the bridging
233
- * details, and a summary of the overall multi-step order.
234
- */
235
- export type CrossChainQuoteAndPost = QuoteAndPost | BridgeQuoteAndPost;
236
- export interface BridgeQuoteAndPost {
237
- /**
238
- * The quote results for the CoW Protocol order.
239
- */
240
- swap: QuoteResults;
241
- /**
242
- * The quote results for the bridging.
243
- *
244
- * Includes the bridging details.
245
- */
246
- bridge: BridgeQuoteResults;
247
- /**
248
- * Callback to post the swap order.
249
- */
250
- postSwapOrderFromQuote(advancedSettings?: SwapAdvancedSettings, signingStepManager?: SigningStepManager): Promise<OrderPostingResult>;
251
- }
252
- export interface BridgeCosts<T = bigint> {
253
- bridgingFee: {
254
- feeBps: number;
255
- amountInSellCurrency: T;
256
- amountInBuyCurrency: T;
257
- };
258
- }
259
- export interface BridgeQuoteAmountsAndCosts<T = bigint> {
260
- /**
261
- * Costs of the bridging.
262
- */
263
- costs: BridgeCosts<T>;
264
- /**
265
- * Amounts before fees
266
- */
267
- beforeFee: Amounts<T>;
268
- /**
269
- * Amounts after fees.
270
- */
271
- afterFee: Amounts<T>;
272
- /**
273
- * Amounts after slippage tolerance.
274
- *
275
- * It includes the fees and the slippage tolerance, so its the minimum amount that the user will receive.
276
- */
277
- afterSlippage: Amounts<T>;
278
- /**
279
- * The slippage tolerance in basis points.
280
- */
281
- slippageBps: number;
282
- }
283
- /**
284
- * Details about the bridge call.
285
- */
286
- export interface BridgeCallDetails {
287
- /**
288
- * Unsigned call to initiate the bridge. This call should be executed in the context of user's cow-shed account.
289
- */
290
- unsignedBridgeCall: EvmCall;
291
- /**
292
- * Pre-authorized hook to initiate the bridge. This hook has been signed, and is ready to be executed by the
293
- * CoW Protocol Trampoline contract after settling the swap order that buys the intermediate token.
294
- */
295
- preAuthorizedBridgingHook: BridgeHook;
296
- }
297
- export interface BridgeQuoteResults extends BridgeQuoteResult {
298
- /**
299
- * Bridge provider information
300
- */
301
- providerInfo: BridgeProviderInfo;
302
- /**
303
- * Trade parameters
304
- */
305
- tradeParameters: QuoteBridgeRequest;
306
- /**
307
- * Bridge call details
308
- */
309
- bridgeCallDetails: BridgeCallDetails;
310
- }
311
- export interface BridgingDepositParams {
312
- inputTokenAddress: Address;
313
- outputTokenAddress: Address;
314
- inputAmount: bigint;
315
- outputAmount: bigint | null;
316
- owner: Address;
317
- quoteTimestamp: number | null;
318
- fillDeadline: number | null;
319
- recipient: Address;
320
- sourceChainId: number;
321
- destinationChainId: number;
322
- bridgingId: string;
323
- }
324
- export interface CrossChainOrder {
325
- provider: BridgeProvider<BridgeQuoteResult>;
326
- chainId: SupportedChainId;
327
- order: EnrichedOrder;
328
- statusResult: BridgeStatusResult;
329
- bridgingParams: BridgingDepositParams;
330
- tradeTxHash: string;
331
- explorerUrl?: string;
332
- }
333
- export {};