@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,242 +0,0 @@
1
- import type { TargetChainId } from '../../../chains';
2
- export interface AvailableRoutesRequest {
3
- originChainId: string;
4
- originToken: string;
5
- destinationChainId: string;
6
- destinationToken: string;
7
- }
8
- export interface Route {
9
- originChainId: string;
10
- originToken: string;
11
- destinationChainId: string;
12
- destinationToken: string;
13
- originTokenSymbol: string;
14
- destinationTokenSymbol: string;
15
- }
16
- export interface SuggestedFeesRequest {
17
- token: string;
18
- originChainId: TargetChainId;
19
- destinationChainId: TargetChainId;
20
- /**
21
- * Amount of the token to transfer.
22
- *
23
- * Note that this amount is in the native decimals of the token. So, for WETH, this would be the amount of
24
- * human-readable WETH multiplied by 1e18.
25
- *
26
- * For USDC, you would multiply the number of human-readable USDC by 1e6.
27
- *
28
- * Example: 1000000000000000000
29
- */
30
- amount: bigint;
31
- /**
32
- * Recipient of the deposit. Can be an EOA or a contract. If this is an EOA and message is defined, then the API will throw a 4xx error.
33
- *
34
- * Example: 0xc186fA914353c44b2E33eBE05f21846F1048bEda
35
- */
36
- recipient?: string;
37
- /**
38
- * The quote timestamp used to compute the LP fees. When bridging with across, the user only specifies the quote
39
- * timestamp in their transaction. The relayer then determines the utilization at that timestamp to determine the
40
- * user's fee. This timestamp must be close (within 10 minutes or so) to the current time on the chain where the
41
- * user is depositing funds and it should be <= the current block timestamp on mainnet. This allows the user to know
42
- * exactly what LP fee they will pay before sending the transaction.
43
- *
44
- * If this value isn't provided in the request, the API will assume the latest block timestamp on mainnet.
45
- *
46
- * Example: 1653547649
47
- */
48
- timestamp?: number;
49
- /**
50
- * Optionally override the relayer address used to simulate the fillRelay() call that estimates the gas costs
51
- * needed to fill a deposit. This simulation result impacts the returned suggested-fees. The reason to customize the
52
- * EOA would be primarily if the recipientAddress is a contract and requires a certain relayer to submit the fill,
53
- * or if one specific relayer has the necessary token balance to make the fill.
54
- *
55
- * Example: 0x428AB2BA90Eba0a4Be7aF34C9Ac451ab061AC010
56
- */
57
- relayer?: string;
58
- }
59
- export interface SuggestedFeesLimits {
60
- /**
61
- * The minimum deposit size in the tokens' units.
62
- *
63
- * Note: USDC has 6 decimals, so this value would be the number of USDC multiplied by 1e6. For WETH, that would be 1e18.
64
- */
65
- minDeposit: string;
66
- /**
67
- * The maximum deposit size in the tokens' units. Note: The formatting of this number is the same as minDeposit.
68
- */
69
- maxDeposit: string;
70
- /**
71
- * The max deposit size that can be relayed "instantly" on the destination chain.
72
- *
73
- * Instantly means that there is relayer capital readily available and that a relayer is expected to relay within
74
- * seconds to 5 minutes of the deposit.
75
- */
76
- maxDepositInstant: string;
77
- /**
78
- * The max deposit size that can be relayed with a "short delay" on the destination chain.
79
- *
80
- * This means that there is relayer capital available on mainnet and that a relayer will immediately begin moving
81
- * that capital over the canonical bridge to relay the deposit. Depending on the chain, the time for this can vary.
82
- *
83
- * Polygon is the worst case where it can take between 20 and 35 minutes for the relayer to receive the funds
84
- * and relay.
85
- *
86
- * Arbitrum is much faster, with a range between 5 and 15 minutes. Note: if the transfer size is greater than this,
87
- * the estimate should be between 2-4 hours for a slow relay to be processed from the mainnet pool.
88
- */
89
- maxDepositShortDelay: string;
90
- /**
91
- * The recommended deposit size that can be relayed "instantly" on the destination chain.
92
- *
93
- * Instantly means that there is relayer capital readily available and that a relayer is expected to relay
94
- * within seconds to 5 minutes of the deposit. Value is in the smallest unit of the respective token.
95
- */
96
- recommendedDepositInstant: string;
97
- }
98
- export interface SuggestedFeesResponse {
99
- /**
100
- * Percentage of the transfer amount that should go to the relayer as a fee in total. The value is inclusive of lpFee.pct.
101
- *
102
- * This is the strongly recommended minimum value to ensure a relayer will perform the transfer under the current
103
- * network conditions.
104
- *
105
- * The value returned in this field is guaranteed to be at least 0.03% in order to meet minimum relayer fee requirements
106
- */
107
- totalRelayFee: PctFee;
108
- /**
109
- * The percentage of the transfer amount that should go the relayer as a fee to cover relayer capital costs.
110
- */
111
- relayerCapitalFee: PctFee;
112
- /**
113
- * The percentage of the transfer amount that should go the relayer as a fee to cover relayer gas costs.
114
- */
115
- relayerGasFee: PctFee;
116
- /**
117
- * The percent of the amount that will go to the LPs as a fee for borrowing their funds.
118
- */
119
- lpFee: PctFee;
120
- /**
121
- * The quote timestamp that was used to compute the lpFeePct. To pay the quoted LP fee, the user would need to pass
122
- * this quote timestamp to the protocol when sending their bridge transaction.
123
- */
124
- timestamp: string;
125
- /**
126
- * Is the input amount below the minimum transfer amount.
127
- */
128
- isAmountTooLow: boolean;
129
- /**
130
- * The block used associated with this quote, used to compute lpFeePct.
131
- */
132
- quoteBlock: string;
133
- /**
134
- * The contract address of the origin SpokePool.
135
- */
136
- spokePoolAddress: string;
137
- /**
138
- * The relayer that is suggested to be set as the exclusive relayer for in the depositV3 call for the fastest fill.
139
- *
140
- * Note: when set to "0x0000000000000000000000000000000000000000", relayer exclusivity will be disabled.
141
- * This value is returned in cases where using an exclusive relayer is not recommended.
142
- */
143
- exclusiveRelayer: string;
144
- /**
145
- * The suggested exclusivity period (in seconds) the exclusive relayer should be given to fill before other relayers
146
- * are allowed to take the fill. Note: when set to "0", relayer exclusivity will be disabled.
147
- *
148
- * This value is returned in cases where using an exclusive relayer is not recommended.
149
- */
150
- exclusivityDeadline: string;
151
- /**
152
- * The expected time (in seconds) for a fill to be made. Represents 75th percentile of the 7-day rolling average of times (updated daily). Times are dynamic by origin/destination token/chain for a given amount.
153
- */
154
- estimatedFillTimeSec: string;
155
- /**
156
- * The recommended deadline (UNIX timestamp in seconds) for the relayer to fill the deposit. After this destination chain timestamp, the fill will revert on the destination chain.
157
- */
158
- fillDeadline: string;
159
- limits: SuggestedFeesLimits;
160
- }
161
- export interface PctFee {
162
- /**
163
- * Note: 1% is represented as 1e16, 100% is 1e18, 50% is 5e17, etc. These values are in the same format that the contract understands.
164
- *
165
- * Example: 100200000000000
166
- */
167
- pct: string;
168
- total: string;
169
- }
170
- export interface DepositStatusRequest {
171
- originChainId: string;
172
- depositId: string;
173
- }
174
- export interface DepositStatusResponse {
175
- /**
176
- * Status of the deposit:
177
- * - filled: Deposit has been filled on destination chain (FilledV3Relay event emitted)
178
- * - pending: Deposit not yet filled
179
- * - expired: Deposit expired and will be refunded
180
- * - refunded: Deposit expired and depositor refunded on originChain
181
- * - slowFillRequested: Across' relayer fills without requiring another relayer to front capital
182
- * (requires input token and output token to be the same asset)
183
- */
184
- status: 'filled' | 'pending' | 'expired' | 'refunded' | 'slowFillRequested';
185
- /**
186
- * Origin chain ID where the deposit was made.
187
- */
188
- originChainId: string;
189
- /**
190
- * Unique identifier of the deposit.
191
- */
192
- depositId: string;
193
- /**
194
- * Transaction hash of the deposit on the origin chain.
195
- */
196
- depositTxHash?: string;
197
- /**
198
- * Transaction hash of the fill on the destination chain.
199
- * Only present when fillStatus is 'filled'.
200
- */
201
- fillTx?: string;
202
- /**
203
- * Destination chain ID where the fill transaction will occur.
204
- */
205
- destinationChainId?: string;
206
- /**
207
- * Transaction hash of the refund on the origin chain.
208
- * Only present when fillStatus is 'refunded'.
209
- */
210
- depositRefundTxHash?: string;
211
- /**
212
- * Pagination information for the response.
213
- */
214
- pagination?: {
215
- currentIndex: number;
216
- maxIndex: number;
217
- };
218
- }
219
- export interface AcrossDepositEvent {
220
- inputToken: string;
221
- outputToken: string;
222
- inputAmount: string;
223
- outputAmount: string;
224
- destinationChainId: string;
225
- depositId: string;
226
- quoteTimestamp: string;
227
- fillDeadline: string;
228
- exclusivityDeadline: string;
229
- depositor: string;
230
- recipient: string;
231
- exclusiveRelayer: string;
232
- message: string;
233
- }
234
- export interface CowTradeEvent {
235
- owner: string;
236
- sellToken: string;
237
- buyToken: string;
238
- sellAmount: string;
239
- buyAmount: string;
240
- feeAmount: string;
241
- orderUid: string;
242
- }
@@ -1,43 +0,0 @@
1
- import { Log } from '@ethersproject/providers';
2
- import { BridgeStatus, QuoteBridgeRequest } from '../../types';
3
- import { SupportedChainId, TargetChainId } from '../../../chains';
4
- import { AcrossDepositEvent, CowTradeEvent, DepositStatusResponse, SuggestedFeesResponse } from './types';
5
- import { AcrossQuoteResult } from './AcrossBridgeProvider';
6
- import { AcrossChainConfig } from './const/tokens';
7
- /**
8
- * Return the chain configs
9
- *
10
- * This is a temporary implementation. We should use the Across API to get the intermediate tokens (see this.getAvailableRoutes())
11
- */
12
- export declare function getChainConfigs(sourceChainId: TargetChainId, targetChainId: TargetChainId): {
13
- sourceChainConfig: AcrossChainConfig;
14
- targetChainConfig: AcrossChainConfig;
15
- } | undefined;
16
- export declare function getTokenSymbol(tokenAddress: string, chainConfig: AcrossChainConfig): string | undefined;
17
- export declare function getTokenAddress(tokenSymbol: string, chainConfig: AcrossChainConfig): string | undefined;
18
- export declare function toBridgeQuoteResult(request: QuoteBridgeRequest, slippageBps: number, suggestedFees: SuggestedFeesResponse): AcrossQuoteResult;
19
- /**
20
- * pct represents a percentage.
21
- *
22
- * Note: 1% is represented as 1e16, 100% is 1e18, 50% is 5e17, etc. These values are in the same format that the contract understands.
23
- *
24
- * Bps is a percentage in basis points (1/100th of a percent). For example, 1% is 100 bps.
25
- *
26
- * @param pct - The percentage to convert to bps
27
- * @returns The percentage in bps
28
- * @throws If the percentage is greater than 100% or less than 0%
29
- */
30
- export declare function pctToBps(pct: bigint): number;
31
- /**
32
- * Apply a percentage fee to an amount.
33
- *
34
- * @param amount - The amount to apply the fee to
35
- * @param pct - The percentage fee to apply
36
- * @throws If the percentage fee is greater than 100% or less than 0%
37
- * @returns The amount after the fee has been applied
38
- */
39
- export declare function applyPctFee(amount: bigint, pct: bigint): bigint;
40
- export declare function applyBps(amount: bigint, bps: number): bigint;
41
- export declare function mapAcrossStatusToBridgeStatus(status: DepositStatusResponse['status']): BridgeStatus;
42
- export declare function getAcrossDepositEvents(chainId: SupportedChainId, logs: Log[]): AcrossDepositEvent[];
43
- export declare function getCowTradeEvents(chainId: SupportedChainId, logs: Log[]): CowTradeEvent[];
@@ -1,67 +0,0 @@
1
- import { AcrossStatus, BungeeBuildTx, BungeeEvent, BungeeQuote, BungeeQuoteAPIRequest, BungeeQuoteWithBuildTx, SocketRequest, SupportedBridge } from './types';
2
- import { SignerLike, TokenInfo } from '../../../common';
3
- import { SupportedChainId, TargetChainId } from '../../../chains';
4
- import { BuyTokensParams } from '../../types';
5
- export interface BungeeApiOptions {
6
- apiBaseUrl?: string;
7
- manualApiBaseUrl?: string;
8
- eventsApiBaseUrl?: string;
9
- acrossApiBaseUrl?: string;
10
- includeBridges?: SupportedBridge[];
11
- }
12
- interface IntermediateTokensParams {
13
- fromChainId: SupportedChainId;
14
- toChainId: TargetChainId;
15
- toTokenAddress: string;
16
- includeBridges?: SupportedBridge[];
17
- }
18
- export declare class BungeeApi {
19
- private readonly options;
20
- constructor(options?: BungeeApiOptions);
21
- validateBridges(includeBridges: SupportedBridge[]): void;
22
- getBuyTokens(params: BuyTokensParams, bridgeParams?: {
23
- includeBridges?: SupportedBridge[];
24
- }): Promise<TokenInfo[]>;
25
- getIntermediateTokens(params: IntermediateTokensParams): Promise<TokenInfo[]>;
26
- /**
27
- * Makes a GET request to Bungee APIs for quote and build tx
28
- */
29
- getBungeeQuoteWithBuildTx(params: BungeeQuoteAPIRequest): Promise<BungeeQuoteWithBuildTx>;
30
- /**
31
- * Makes a GET request to Bungee APIs for quote
32
- * https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-quote-v-1
33
- */
34
- getBungeeQuote(params: BungeeQuoteAPIRequest): Promise<BungeeQuote>;
35
- /**
36
- * Makes a GET request to Bungee APIs for build tx
37
- * https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-build-tx-v-1
38
- */
39
- getBungeeBuildTx(quote: BungeeQuote): Promise<BungeeBuildTx>;
40
- /**
41
- * Verifies the build tx data for a quote using the SocketVerifier contract
42
- * @param quote - The quote object
43
- * @param buildTx - The build tx object
44
- * @param signer - The signer object
45
- * @returns True if the build tx data is valid, false otherwise
46
- */
47
- verifyBungeeBuildTx(quote: BungeeQuote, buildTx: BungeeBuildTx, signer: SignerLike): Promise<boolean>;
48
- /**
49
- * Verifies the bungee tx data using the SocketVerifier contract
50
- * @param originChainId - The origin chain id
51
- * @param txData - The tx data
52
- * @param routeId - The route id
53
- * @param expectedSocketRequest - The expected socket request
54
- * @param signer - The signer object
55
- * @returns True if the bungee tx data is valid, false otherwise
56
- */
57
- verifyBungeeBuildTxData(originChainId: SupportedChainId, txData: string, routeId: string, expectedSocketRequest: SocketRequest, signer: SignerLike): Promise<boolean>;
58
- getEvents(params: {
59
- orderId: string;
60
- } | {
61
- txHash: string;
62
- }): Promise<BungeeEvent[]>;
63
- getAcrossStatus(depositTxHash: string): Promise<AcrossStatus>;
64
- private getSupportedBridges;
65
- private makeApiCall;
66
- }
67
- export {};
@@ -1,45 +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 { ChainId, ChainInfo, SupportedChainId } from '../../../chains';
4
- import { EvmCall, TokenInfo } from '../../../common';
5
- import { BungeeApi, BungeeApiOptions } from './BungeeApi';
6
- import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
7
- import { BungeeBuildTx, BungeeQuote } from './types';
8
- import type { JsonRpcProvider } from '@ethersproject/providers';
9
- import type { Signer } from 'ethers';
10
- export declare const BUNGEE_HOOK_DAPP_ID = "cow-sdk://bridging/providers/bungee";
11
- export declare const BUNGEE_SUPPORTED_NETWORKS: ChainInfo[];
12
- export interface BungeeBridgeProviderOptions {
13
- getRpcProvider(chainId: SupportedChainId): JsonRpcProvider;
14
- apiOptions?: BungeeApiOptions;
15
- cowShedOptions?: CowShedSdkOptions;
16
- }
17
- export interface BungeeQuoteResult extends BridgeQuoteResult {
18
- bungeeQuote: BungeeQuote;
19
- buildTx: BungeeBuildTx;
20
- }
21
- export declare class BungeeBridgeProvider implements BridgeProvider<BungeeQuoteResult> {
22
- private options;
23
- protected api: BungeeApi;
24
- protected cowShedSdk: CowShedSdk;
25
- getRpcProvider: (chainId: SupportedChainId) => JsonRpcProvider;
26
- constructor(options: BungeeBridgeProviderOptions);
27
- info: BridgeProviderInfo;
28
- getNetworks(): Promise<ChainInfo[]>;
29
- getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
30
- getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
31
- getQuote(request: QuoteBridgeRequest): Promise<BungeeQuoteResult>;
32
- getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise<EvmCall>;
33
- getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise<number>;
34
- getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number): Promise<BridgeHook>;
35
- getBridgingParams(_chainId: ChainId, orderId: string, _txHash: string): Promise<{
36
- params: BridgingDepositParams;
37
- status: BridgeStatusResult;
38
- } | null>;
39
- decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
40
- getExplorerUrl(bridgingId: string): string;
41
- getStatus(_bridgingId: string): Promise<BridgeStatusResult>;
42
- getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
43
- getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
44
- private isExtraGasRequired;
45
- }
@@ -1,203 +0,0 @@
1
- export declare const ERC20_ABI: string[];
2
- export declare const SOCKET_VERIFIER_ABI: ({
3
- type: string;
4
- inputs: {
5
- name: string;
6
- type: string;
7
- internalType: string;
8
- }[];
9
- stateMutability: string;
10
- name?: undefined;
11
- outputs?: undefined;
12
- anonymous?: undefined;
13
- } | {
14
- type: string;
15
- name: string;
16
- inputs: {
17
- name: string;
18
- type: string;
19
- internalType: string;
20
- }[];
21
- outputs: {
22
- name: string;
23
- type: string;
24
- internalType: string;
25
- components: {
26
- name: string;
27
- type: string;
28
- internalType: string;
29
- }[];
30
- }[];
31
- stateMutability: string;
32
- anonymous?: undefined;
33
- } | {
34
- type: string;
35
- name: string;
36
- inputs: {
37
- name: string;
38
- type: string;
39
- internalType: string;
40
- }[];
41
- outputs: {
42
- name: string;
43
- type: string;
44
- internalType: string;
45
- }[];
46
- stateMutability: string;
47
- anonymous?: undefined;
48
- } | {
49
- type: string;
50
- name: string;
51
- inputs: ({
52
- name: string;
53
- type: string;
54
- internalType: string;
55
- components?: undefined;
56
- } | {
57
- name: string;
58
- type: string;
59
- internalType: string;
60
- components: ({
61
- name: string;
62
- type: string;
63
- internalType: string;
64
- components?: undefined;
65
- } | {
66
- name: string;
67
- type: string;
68
- internalType: string;
69
- components: {
70
- name: string;
71
- type: string;
72
- internalType: string;
73
- }[];
74
- })[];
75
- })[];
76
- outputs: never[];
77
- stateMutability: string;
78
- anonymous?: undefined;
79
- } | {
80
- type: string;
81
- name: string;
82
- inputs: {
83
- name: string;
84
- type: string;
85
- indexed: boolean;
86
- internalType: string;
87
- }[];
88
- anonymous: boolean;
89
- stateMutability?: undefined;
90
- outputs?: undefined;
91
- } | {
92
- type: string;
93
- name: string;
94
- inputs: never[];
95
- stateMutability?: undefined;
96
- outputs?: undefined;
97
- anonymous?: undefined;
98
- })[];
99
- export declare const BUNGEE_COWSWAP_LIB_ABI: ({
100
- inputs: never[];
101
- name: string;
102
- type: string;
103
- outputs?: undefined;
104
- stateMutability?: undefined;
105
- } | {
106
- inputs: {
107
- internalType: string;
108
- name: string;
109
- type: string;
110
- }[];
111
- name: string;
112
- outputs: {
113
- internalType: string;
114
- name: string;
115
- type: string;
116
- }[];
117
- stateMutability: string;
118
- type: string;
119
- })[];
120
- export declare const SOCKET_GATEWAY_ABI: ({
121
- inputs: {
122
- internalType: string;
123
- name: string;
124
- type: string;
125
- }[];
126
- stateMutability: string;
127
- type: string;
128
- name?: undefined;
129
- anonymous?: undefined;
130
- outputs?: undefined;
131
- } | {
132
- inputs: never[];
133
- name: string;
134
- type: string;
135
- stateMutability?: undefined;
136
- anonymous?: undefined;
137
- outputs?: undefined;
138
- } | {
139
- anonymous: boolean;
140
- inputs: {
141
- indexed: boolean;
142
- internalType: string;
143
- name: string;
144
- type: string;
145
- }[];
146
- name: string;
147
- type: string;
148
- stateMutability?: undefined;
149
- outputs?: undefined;
150
- } | {
151
- stateMutability: string;
152
- type: string;
153
- inputs?: undefined;
154
- name?: undefined;
155
- anonymous?: undefined;
156
- outputs?: undefined;
157
- } | {
158
- inputs: {
159
- internalType: string;
160
- name: string;
161
- type: string;
162
- }[];
163
- name: string;
164
- outputs: {
165
- internalType: string;
166
- name: string;
167
- type: string;
168
- }[];
169
- stateMutability: string;
170
- type: string;
171
- anonymous?: undefined;
172
- } | {
173
- inputs: {
174
- components: {
175
- internalType: string;
176
- name: string;
177
- type: string;
178
- }[];
179
- internalType: string;
180
- name: string;
181
- type: string;
182
- }[];
183
- name: string;
184
- outputs: {
185
- internalType: string;
186
- name: string;
187
- type: string;
188
- }[];
189
- stateMutability: string;
190
- type: string;
191
- anonymous?: undefined;
192
- })[];
193
- export declare const BUNGEE_APPROVE_AND_BRIDGE_V1_ABI: {
194
- type: string;
195
- name: string;
196
- inputs: {
197
- name: string;
198
- type: string;
199
- internalType: string;
200
- }[];
201
- outputs: never[];
202
- stateMutability: string;
203
- }[];
@@ -1,4 +0,0 @@
1
- import { TargetChainId } from '../../../../chains';
2
- export declare const BungeeCowswapLibAddresses: Record<TargetChainId, string | undefined>;
3
- export declare const SocketVerifierAddresses: Record<TargetChainId, string | undefined>;
4
- export declare const BungeeApproveAndBridgeV1Addresses: Record<TargetChainId, string | undefined>;
@@ -1,8 +0,0 @@
1
- import { BungeeTxDataBytesIndicesType } from '../types';
2
- export declare const HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
3
- /**
4
- * Mapping of indices of different fields in the calldata for different bridges
5
- * Considers the full SocketGateway calldata eg. calldata that goes via SocketGateway.fallback()
6
- * 0x + routeId (4bytes) + function selector (4bytes) + function input params
7
- */
8
- export declare const BungeeTxDataBytesIndices: BungeeTxDataBytesIndicesType;
@@ -1,7 +0,0 @@
1
- import { EvmCall } from '../../../common';
2
- import { BungeeQuoteResult } from './BungeeBridgeProvider';
3
- import { QuoteBridgeRequest } from '../../types';
4
- export declare function createBungeeDepositCall(params: {
5
- request: QuoteBridgeRequest;
6
- quote: BungeeQuoteResult;
7
- }): Promise<EvmCall>;
@@ -1,3 +0,0 @@
1
- import { BridgeStatusResult } from '../../types';
2
- import { AcrossStatus, BungeeEvent } from './types';
3
- export declare function getBridgingStatusFromEvents(events: BungeeEvent[] | undefined, getAcrossStatus: (depositTxHash: string) => Promise<AcrossStatus>): Promise<BridgeStatusResult>;