@cowprotocol/cow-sdk 6.0.0-RC.9 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/README.md +3 -1
- package/dist/bridging/BridgingSdk/BridgingSdk.d.ts +87 -63
- package/dist/bridging/BridgingSdk/findBridgeProviderFromHook.d.ts +2 -0
- package/dist/bridging/BridgingSdk/getBridgeSignedHook.d.ts +8 -0
- package/dist/bridging/BridgingSdk/getCrossChainOrder.d.ts +16 -0
- package/dist/bridging/BridgingSdk/getQuoteWithBridge.d.ts +3 -0
- package/dist/bridging/BridgingSdk/getQuoteWithoutBridge.d.ts +7 -7
- package/dist/bridging/BridgingSdk/mock/bridgeRequestMocks.d.ts +20 -0
- package/dist/bridging/BridgingSdk/types.d.ts +43 -0
- package/dist/bridging/const.d.ts +4 -2
- package/dist/bridging/errors.d.ts +22 -0
- package/dist/bridging/index.d.ts +8 -5
- package/dist/bridging/providers/across/AcrossApi.d.ts +30 -195
- package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +44 -41
- package/dist/bridging/providers/across/abi.d.ts +154 -154
- package/dist/bridging/providers/across/const/contracts.d.ts +3 -3
- package/dist/bridging/providers/across/const/interfaces.d.ts +3 -0
- package/dist/bridging/providers/across/const/misc.d.ts +2 -0
- package/dist/bridging/providers/across/const/tokens.d.ts +11 -11
- package/dist/bridging/providers/across/createAcrossDepositCall.d.ts +9 -9
- package/dist/bridging/providers/across/getDepositParams.d.ts +4 -0
- package/dist/bridging/providers/across/types.d.ts +242 -0
- package/dist/bridging/providers/across/util.d.ts +43 -39
- package/dist/bridging/providers/bungee/BungeeApi.d.ts +67 -0
- package/dist/bridging/providers/bungee/BungeeBridgeProvider.d.ts +44 -0
- package/dist/bridging/providers/bungee/abi.d.ts +203 -0
- package/dist/bridging/providers/bungee/const/contracts.d.ts +4 -0
- package/dist/bridging/providers/bungee/const/misc.d.ts +8 -0
- package/dist/bridging/providers/bungee/createBungeeDepositCall.d.ts +7 -0
- package/dist/bridging/providers/bungee/getBridgingStatusFromEvents.d.ts +3 -0
- package/dist/bridging/providers/bungee/types.d.ts +267 -0
- package/dist/bridging/providers/bungee/util.d.ts +62 -0
- package/dist/bridging/providers/mock/MockBridgeProvider.d.ts +26 -20
- package/dist/bridging/providers/utils/getGasLimitEstimationForHook.d.ts +4 -0
- package/dist/bridging/types.d.ts +323 -251
- package/dist/bridging/utils.d.ts +9 -6
- package/dist/chains/const/index.d.ts +25 -25
- package/dist/chains/const/path.d.ts +1 -1
- package/dist/chains/details/arbitrum.d.ts +7 -7
- package/dist/chains/details/avalanche.d.ts +2 -0
- package/dist/chains/details/base.d.ts +7 -7
- package/dist/chains/details/gnosis.d.ts +7 -7
- package/dist/chains/details/index.d.ts +8 -0
- package/dist/chains/details/mainnet.d.ts +7 -7
- package/dist/chains/details/optimism.d.ts +2 -2
- package/dist/chains/details/polygon.d.ts +2 -2
- package/dist/chains/details/sepolia.d.ts +7 -7
- package/dist/chains/index.d.ts +4 -3
- package/dist/chains/types.d.ts +127 -122
- package/dist/chains/utils.d.ts +18 -18
- package/dist/common/consts/config.d.ts +9 -9
- package/dist/common/consts/contracts.d.ts +43 -34
- package/dist/common/consts/ipfs.d.ts +2 -2
- package/dist/common/consts/order.d.ts +1 -0
- package/dist/common/consts/path.d.ts +1 -1
- package/dist/common/consts/tokens.d.ts +9 -9
- package/dist/common/generated/CoWShed.d.ts +219 -219
- package/dist/common/generated/CoWShedFactory.d.ts +191 -191
- package/dist/common/generated/ComposableCoW.d.ts +340 -340
- package/dist/common/generated/EthFlow.d.ts +117 -117
- package/dist/common/generated/ExtensibleFallbackHandler.d.ts +282 -282
- package/dist/common/generated/GPv2Settlement.d.ts +107 -107
- package/dist/common/generated/TWAP.d.ts +141 -141
- package/dist/common/generated/common.d.ts +21 -21
- package/dist/common/generated/factories/CoWShedFactory__factory.d.ts +250 -250
- package/dist/common/generated/factories/CoWShed__factory.d.ts +254 -254
- package/dist/common/generated/factories/ComposableCoW__factory.d.ts +475 -475
- package/dist/common/generated/factories/EthFlow__factory.d.ts +124 -124
- package/dist/common/generated/factories/ExtensibleFallbackHandler__factory.d.ts +389 -389
- package/dist/common/generated/factories/GPv2Settlement__factory.d.ts +81 -81
- package/dist/common/generated/factories/TWAP__factory.d.ts +260 -260
- package/dist/common/generated/factories/index.d.ts +7 -7
- package/dist/common/generated/index.d.ts +15 -15
- package/dist/common/index.d.ts +12 -10
- package/dist/common/types/config.d.ts +70 -70
- package/dist/common/types/cow-error.d.ts +4 -4
- package/dist/common/types/ethereum.d.ts +5 -5
- package/dist/common/types/tokens.d.ts +12 -12
- package/dist/common/types/wallets.d.ts +5 -5
- package/dist/common/utils/common.d.ts +1 -0
- package/dist/common/utils/config.d.ts +4 -4
- package/dist/common/utils/log.d.ts +2 -0
- package/dist/common/utils/math.d.ts +19 -0
- package/dist/common/utils/order.d.ts +4 -0
- package/dist/common/utils/serialize.d.ts +1 -1
- package/dist/common/utils/wallet.d.ts +3 -3
- package/dist/composable/ConditionalOrder.d.ts +206 -206
- package/dist/composable/ConditionalOrderFactory.d.ts +19 -19
- package/dist/composable/Multiplexer.d.ts +174 -174
- package/dist/composable/contracts.d.ts +6 -6
- package/dist/composable/generated/ComposableCoW.d.ts +340 -340
- package/dist/composable/generated/ExtensibleFallbackHandler.d.ts +282 -282
- package/dist/composable/generated/TWAP.d.ts +141 -141
- package/dist/composable/generated/common.d.ts +21 -21
- package/dist/composable/generated/factories/ComposableCoW__factory.d.ts +475 -475
- package/dist/composable/generated/factories/ExtensibleFallbackHandler__factory.d.ts +389 -389
- package/dist/composable/generated/factories/TWAP__factory.d.ts +260 -260
- package/dist/composable/generated/factories/index.d.ts +3 -3
- package/dist/composable/generated/index.d.ts +7 -7
- package/dist/composable/index.d.ts +6 -6
- package/dist/composable/orderTypes/Twap.d.ts +242 -242
- package/dist/composable/orderTypes/index.d.ts +3 -3
- package/dist/composable/orderTypes/test/TestConditionalOrder.d.ts +25 -25
- package/dist/composable/types.d.ts +133 -133
- package/dist/composable/utils.d.ts +37 -37
- package/dist/cow-shed/CowShedSdk.d.ts +74 -69
- package/dist/cow-shed/contracts/CoWShedHooks.d.ts +47 -45
- package/dist/cow-shed/contracts/utils.d.ts +4 -4
- package/dist/cow-shed/index.d.ts +3 -2
- package/dist/cow-shed/types.d.ts +17 -17
- package/dist/hooks/utils.d.ts +3 -2
- package/dist/index-847d9333.js +29 -0
- package/dist/index-847d9333.js.map +1 -0
- package/dist/index.d.ts +11 -10
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.module.js +4 -4
- package/dist/index.module.js.map +1 -1
- package/dist/order-book/api.d.ts +235 -235
- package/dist/order-book/generated/index.d.ts +55 -55
- package/dist/order-book/generated/models/Address.d.ts +4 -4
- package/dist/order-book/generated/models/AppData.d.ts +7 -7
- package/dist/order-book/generated/models/AppDataHash.d.ts +6 -6
- package/dist/order-book/generated/models/AppDataObject.d.ts +7 -7
- package/dist/order-book/generated/models/Auction.d.ts +30 -30
- package/dist/order-book/generated/models/AuctionOrder.d.ts +92 -92
- package/dist/order-book/generated/models/AuctionPrices.d.ts +6 -6
- package/dist/order-book/generated/models/BigUint.d.ts +4 -4
- package/dist/order-book/generated/models/BuyTokenDestination.d.ts +7 -7
- package/dist/order-book/generated/models/CallData.d.ts +4 -4
- package/dist/order-book/generated/models/CompetitionAuction.d.ts +14 -14
- package/dist/order-book/generated/models/CompetitionOrderStatus.d.ts +29 -29
- package/dist/order-book/generated/models/EcdsaSignature.d.ts +4 -4
- package/dist/order-book/generated/models/EcdsaSigningScheme.d.ts +7 -7
- package/dist/order-book/generated/models/EthflowData.d.ts +20 -20
- package/dist/order-book/generated/models/ExecutedAmounts.d.ts +5 -5
- package/dist/order-book/generated/models/ExecutedProtocolFee.d.ts +8 -8
- package/dist/order-book/generated/models/FeePolicy.d.ts +7 -7
- package/dist/order-book/generated/models/InteractionData.d.ts +11 -11
- package/dist/order-book/generated/models/NativePriceResponse.d.ts +10 -10
- package/dist/order-book/generated/models/OnchainOrderData.d.ts +24 -24
- package/dist/order-book/generated/models/Order.d.ts +3 -3
- package/dist/order-book/generated/models/OrderCancellation.d.ts +14 -14
- package/dist/order-book/generated/models/OrderCancellationError.d.ts +15 -15
- package/dist/order-book/generated/models/OrderCancellations.d.ts +18 -18
- package/dist/order-book/generated/models/OrderClass.d.ts +8 -8
- package/dist/order-book/generated/models/OrderCreation.d.ts +80 -80
- package/dist/order-book/generated/models/OrderKind.d.ts +7 -7
- package/dist/order-book/generated/models/OrderMetaData.d.ts +100 -100
- package/dist/order-book/generated/models/OrderParameters.d.ts +53 -53
- package/dist/order-book/generated/models/OrderPostError.d.ts +35 -35
- package/dist/order-book/generated/models/OrderQuoteRequest.d.ts +58 -58
- package/dist/order-book/generated/models/OrderQuoteResponse.d.ts +27 -27
- package/dist/order-book/generated/models/OrderQuoteSide.d.ts +26 -26
- package/dist/order-book/generated/models/OrderQuoteSideKindBuy.d.ts +3 -3
- package/dist/order-book/generated/models/OrderQuoteSideKindSell.d.ts +3 -3
- package/dist/order-book/generated/models/OrderQuoteValidity.d.ts +14 -14
- package/dist/order-book/generated/models/OrderStatus.d.ts +10 -10
- package/dist/order-book/generated/models/PreSignature.d.ts +4 -4
- package/dist/order-book/generated/models/PriceEstimationError.d.ts +12 -12
- package/dist/order-book/generated/models/PriceImprovement.d.ts +12 -12
- package/dist/order-book/generated/models/PriceQuality.d.ts +16 -16
- package/dist/order-book/generated/models/Quote.d.ts +19 -19
- package/dist/order-book/generated/models/SellTokenSource.d.ts +8 -8
- package/dist/order-book/generated/models/Signature.d.ts +6 -6
- package/dist/order-book/generated/models/SigningScheme.d.ts +9 -9
- package/dist/order-book/generated/models/SolverCompetitionResponse.d.ts +30 -30
- package/dist/order-book/generated/models/SolverSettlement.d.ts +47 -47
- package/dist/order-book/generated/models/Surplus.d.ts +7 -7
- package/dist/order-book/generated/models/TokenAmount.d.ts +4 -4
- package/dist/order-book/generated/models/TotalSurplus.d.ts +10 -10
- package/dist/order-book/generated/models/Trade.d.ts +57 -57
- package/dist/order-book/generated/models/TransactionHash.d.ts +4 -4
- package/dist/order-book/generated/models/UID.d.ts +8 -8
- package/dist/order-book/generated/models/Volume.d.ts +6 -6
- package/dist/order-book/index.d.ts +5 -5
- package/dist/order-book/mock.d.ts +63 -63
- package/dist/order-book/quoteAmountsAndCostsUtils.d.ts +35 -22
- package/dist/order-book/request.d.ts +49 -49
- package/dist/order-book/transformOrder.d.ts +10 -10
- package/dist/order-book/types.d.ts +74 -74
- package/dist/order-signing/index.d.ts +2 -2
- package/dist/order-signing/orderSigningUtils.d.ts +97 -97
- package/dist/order-signing/types.d.ts +55 -55
- package/dist/order-signing/utils.d.ts +49 -49
- package/dist/package.json +31 -32
- package/dist/schemas/trading/LimitOrderAdvancedSettings.ts +151 -12
- package/dist/schemas/trading/LimitTradeParameters.ts +136 -15
- package/dist/schemas/trading/QuoteResultsSerialized.ts +292 -27
- package/dist/schemas/trading/QuoterParameters.ts +10 -0
- package/dist/schemas/trading/SwapAdvancedSettings.ts +331 -12
- package/dist/schemas/trading/TradeParameters.ts +136 -15
- package/dist/src/trading/README.md +99 -7
- package/dist/subgraph/api.d.ts +77 -77
- package/dist/subgraph/graphql.d.ts +3203 -3203
- package/dist/subgraph/index.d.ts +1 -1
- package/dist/subgraph/queries.d.ts +14 -14
- package/dist/test/utils.d.ts +1 -0
- package/dist/trading/appDataUtils.d.ts +5 -4
- package/dist/trading/calculateUniqueOrderId.d.ts +5 -5
- package/dist/trading/consts.d.ts +6 -14
- package/dist/trading/getEthFlowTransaction.d.ts +12 -7
- package/dist/trading/getOrderToSign.d.ts +11 -8
- package/dist/trading/getOrderTypedData.d.ts +4 -4
- package/dist/trading/getPreSignTransaction.d.ts +4 -4
- package/dist/trading/getQuote.d.ts +26 -14
- package/dist/trading/index.d.ts +21 -19
- package/dist/trading/postCoWProtocolTrade.d.ts +4 -4
- package/dist/trading/postLimitOrder.d.ts +3 -3
- package/dist/trading/postSellNativeCurrencyOrder.d.ts +4 -7
- package/dist/trading/postSwapOrder.d.ts +5 -5
- package/dist/trading/suggestSlippageBps.d.ts +13 -0
- package/dist/trading/suggestSlippageFromFee.d.ts +19 -0
- package/dist/trading/suggestSlippageFromVolume.d.ts +10 -0
- package/dist/trading/tradingSdk.d.ts +26 -26
- package/dist/trading/types.d.ts +221 -190
- package/dist/trading/utils/getPartnerFeeBps.d.ts +2 -0
- package/dist/trading/{utils.d.ts → utils/misc.d.ts} +27 -27
- package/dist/trading/utils/slippage.d.ts +16 -0
- package/dist/utils-09dadb80.js +2 -0
- package/dist/utils-09dadb80.js.map +1 -0
- package/dist/utils-0ff3f95e.js +2 -0
- package/dist/utils-0ff3f95e.js.map +1 -0
- package/dist/utils-ddcfac77.js +2 -0
- package/dist/utils-ddcfac77.js.map +1 -0
- package/dist/utils.d.ts +3 -3
- package/dist/weiroll/index.d.ts +23 -23
- package/package.json +31 -32
- package/dist/bridging/BridgingSdk/getErc20Decimals.d.ts +0 -4
- package/dist/bridging/BridgingSdk/getQuoteWithBridging.d.ts +0 -9
- package/dist/index-317c25f1.js +0 -29
- package/dist/index-317c25f1.js.map +0 -1
- package/dist/utils-204a9cbe.js +0 -2
- package/dist/utils-204a9cbe.js.map +0 -1
- package/dist/utils-762ee9c3.js +0 -2
- package/dist/utils-762ee9c3.js.map +0 -1
- package/dist/utils-de2eb543.js +0 -2
- package/dist/utils-de2eb543.js.map +0 -1
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
export type SupportedBridge = 'across' | 'cctp';
|
|
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
|
+
}
|
|
110
|
+
export declare const BungeeBridgeNames: Record<string, BungeeBridge>;
|
|
111
|
+
export interface BungeeQuote {
|
|
112
|
+
originChainId: number;
|
|
113
|
+
destinationChainId: number;
|
|
114
|
+
userAddress: string;
|
|
115
|
+
receiverAddress: string;
|
|
116
|
+
input: BungeeQuoteAPIResponse['result']['input'];
|
|
117
|
+
route: BungeeQuoteAPIResponse['result']['manualRoutes'][0];
|
|
118
|
+
routeBridge: BungeeBridge;
|
|
119
|
+
quoteTimestamp: number;
|
|
120
|
+
}
|
|
121
|
+
export type BungeeQuoteWithBuildTx = {
|
|
122
|
+
bungeeQuote: BungeeQuote;
|
|
123
|
+
buildTx: BungeeBuildTx;
|
|
124
|
+
};
|
|
125
|
+
export interface BungeeBuildTxAPIResponse {
|
|
126
|
+
success: boolean;
|
|
127
|
+
statusCode: number;
|
|
128
|
+
result: {
|
|
129
|
+
approvalData: {
|
|
130
|
+
spenderAddress: string;
|
|
131
|
+
amount: string;
|
|
132
|
+
tokenAddress: string;
|
|
133
|
+
userAddress: string;
|
|
134
|
+
};
|
|
135
|
+
txData: {
|
|
136
|
+
data: string;
|
|
137
|
+
to: string;
|
|
138
|
+
chainId: number;
|
|
139
|
+
value: string;
|
|
140
|
+
};
|
|
141
|
+
userOp: string;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
export type BungeeBuildTx = BungeeBuildTxAPIResponse['result'];
|
|
145
|
+
export interface InputAmountTxDataBytesIndices {
|
|
146
|
+
inputAmount: {
|
|
147
|
+
bytes_startIndex: number;
|
|
148
|
+
bytes_length: number;
|
|
149
|
+
bytesString_startIndex: number;
|
|
150
|
+
bytesString_length: number;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export interface OutputAmountTxDataBytesIndices {
|
|
154
|
+
outputAmount: {
|
|
155
|
+
bytes_startIndex: number;
|
|
156
|
+
bytes_length: number;
|
|
157
|
+
bytesString_startIndex: number;
|
|
158
|
+
bytesString_length: number;
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
export interface InputOutputAmountTxDataBytesIndices extends InputAmountTxDataBytesIndices, OutputAmountTxDataBytesIndices {
|
|
162
|
+
}
|
|
163
|
+
export type BungeeTxDataBytesIndicesType = {
|
|
164
|
+
[K in BungeeBridge]: {
|
|
165
|
+
[functionSelector: string]: K extends BungeeBridge.Across ? InputOutputAmountTxDataBytesIndices : InputAmountTxDataBytesIndices;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
export type SocketRequest = {
|
|
169
|
+
amount: string;
|
|
170
|
+
recipient: string;
|
|
171
|
+
toChainId: string;
|
|
172
|
+
token: string;
|
|
173
|
+
signature: string;
|
|
174
|
+
};
|
|
175
|
+
export type UserRequestValidation = {
|
|
176
|
+
routeId: string;
|
|
177
|
+
socketRequest: SocketRequest;
|
|
178
|
+
};
|
|
179
|
+
export declare enum BungeeEventStatus {
|
|
180
|
+
COMPLETED = "COMPLETED",
|
|
181
|
+
PENDING = "PENDING"
|
|
182
|
+
}
|
|
183
|
+
export declare enum BungeeBridgeName {
|
|
184
|
+
ACROSS = "across",
|
|
185
|
+
CCTP = "cctp"
|
|
186
|
+
}
|
|
187
|
+
export type BungeeEvent = {
|
|
188
|
+
identifier: string;
|
|
189
|
+
srcTransactionHash?: string;
|
|
190
|
+
bridgeName: BungeeBridgeName;
|
|
191
|
+
fromChainId: number;
|
|
192
|
+
gasUsed: string;
|
|
193
|
+
isCowswapTrade: boolean;
|
|
194
|
+
isSocketTx: boolean;
|
|
195
|
+
metadata: string;
|
|
196
|
+
orderId: string;
|
|
197
|
+
recipient: string;
|
|
198
|
+
sender: string;
|
|
199
|
+
socketContractVersion: string;
|
|
200
|
+
srcAmount: string;
|
|
201
|
+
srcBlockHash: string;
|
|
202
|
+
srcBlockNumber: number;
|
|
203
|
+
srcBlockTimeStamp: number;
|
|
204
|
+
srcTokenAddress: string;
|
|
205
|
+
srcTokenDecimals: number;
|
|
206
|
+
srcTokenLogoURI: string;
|
|
207
|
+
srcTokenName: string;
|
|
208
|
+
srcTokenSymbol: string;
|
|
209
|
+
to: string;
|
|
210
|
+
toChainId: number;
|
|
211
|
+
destTransactionHash?: string;
|
|
212
|
+
destAmount?: string;
|
|
213
|
+
destBlockHash: string;
|
|
214
|
+
destBlockNumber: number;
|
|
215
|
+
destBlockTimeStamp: number;
|
|
216
|
+
destTokenAddress: string;
|
|
217
|
+
destTokenDecimals: number;
|
|
218
|
+
destTokenLogoURI: string;
|
|
219
|
+
destTokenName: string;
|
|
220
|
+
destTokenSymbol: string;
|
|
221
|
+
srcTxStatus: BungeeEventStatus;
|
|
222
|
+
destTxStatus: BungeeEventStatus;
|
|
223
|
+
};
|
|
224
|
+
export type BungeeEventsAPIResponse = {
|
|
225
|
+
success: boolean;
|
|
226
|
+
result: Array<BungeeEvent>;
|
|
227
|
+
};
|
|
228
|
+
export interface AcrossStatusAPIResponse {
|
|
229
|
+
status: 'filled' | 'pending' | 'expired' | 'refunded' | 'slowFillRequested';
|
|
230
|
+
originChainId: string;
|
|
231
|
+
depositId: string;
|
|
232
|
+
depositTxHash?: string;
|
|
233
|
+
fillTx?: string;
|
|
234
|
+
destinationChainId?: string;
|
|
235
|
+
depositRefundTxHash?: string;
|
|
236
|
+
pagination?: {
|
|
237
|
+
currentIndex: number;
|
|
238
|
+
maxIndex: number;
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
export type AcrossStatus = AcrossStatusAPIResponse['status'];
|
|
242
|
+
export type BungeeBuyTokensAPIResponse = {
|
|
243
|
+
success: boolean;
|
|
244
|
+
statusCode: number;
|
|
245
|
+
result: Array<{
|
|
246
|
+
chainId: number;
|
|
247
|
+
address: string;
|
|
248
|
+
decimals: number;
|
|
249
|
+
name?: string;
|
|
250
|
+
symbol?: string;
|
|
251
|
+
logoURI?: string;
|
|
252
|
+
icon?: string;
|
|
253
|
+
}>;
|
|
254
|
+
};
|
|
255
|
+
export type BungeeIntermediateTokensAPIResponse = {
|
|
256
|
+
success: boolean;
|
|
257
|
+
statusCode: number;
|
|
258
|
+
result: Array<{
|
|
259
|
+
chainId: number;
|
|
260
|
+
address: string;
|
|
261
|
+
name: string;
|
|
262
|
+
symbol: string;
|
|
263
|
+
decimals: number;
|
|
264
|
+
logoURI: string;
|
|
265
|
+
icon: string;
|
|
266
|
+
}>;
|
|
267
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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,20 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
2
|
+
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, 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<TokenInfo[]>;
|
|
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
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { QuoteBridgeRequest } from '../../types';
|
|
2
|
+
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
3
|
+
import { CowShedSdk } from '../../../cow-shed';
|
|
4
|
+
export declare function getGasLimitEstimationForHook(cowShedSdk: CowShedSdk, request: QuoteBridgeRequest, provider: JsonRpcProvider): Promise<number>;
|