@cowprotocol/cow-sdk 6.0.0-RC.39 → 6.0.0-RC.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bridging/BridgingSdk/BridgingSdk.d.ts +90 -90
- package/dist/bridging/BridgingSdk/getCrossChainOrder.d.ts +14 -14
- package/dist/bridging/BridgingSdk/getErc20Decimals.d.ts +4 -4
- package/dist/bridging/BridgingSdk/getQuoteWithBridge.d.ts +32 -32
- package/dist/bridging/BridgingSdk/getQuoteWithoutBridge.d.ts +7 -7
- package/dist/bridging/BridgingSdk/mock/bridgeRequestMocks.d.ts +20 -20
- package/dist/bridging/const.d.ts +2 -2
- package/dist/bridging/errors.d.ts +4 -4
- package/dist/bridging/index.d.ts +6 -6
- package/dist/bridging/providers/across/AcrossApi.d.ts +27 -27
- package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +43 -43
- 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/misc.d.ts +1 -1
- 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/types.d.ts +169 -169
- package/dist/bridging/providers/across/util.d.ts +39 -39
- package/dist/bridging/providers/mock/MockBridgeProvider.d.ts +21 -21
- package/dist/bridging/types.d.ts +287 -287
- package/dist/bridging/utils.d.ts +9 -9
- 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 -2
- package/dist/chains/details/base.d.ts +7 -7
- package/dist/chains/details/gnosis.d.ts +7 -7
- 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 +3 -3
- package/dist/chains/types.d.ts +123 -123
- package/dist/chains/utils.d.ts +18 -18
- package/dist/common/consts/config.d.ts +9 -9
- package/dist/common/consts/contracts.d.ts +34 -34
- package/dist/common/consts/ipfs.d.ts +2 -2
- 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 -12
- 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/config.d.ts +4 -4
- package/dist/common/utils/log.d.ts +2 -2
- package/dist/common/utils/math.d.ts +19 -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 +69 -69
- package/dist/cow-shed/contracts/CoWShedHooks.d.ts +45 -45
- package/dist/cow-shed/contracts/utils.d.ts +4 -4
- package/dist/cow-shed/index.d.ts +3 -3
- package/dist/cow-shed/types.d.ts +17 -17
- package/dist/hooks/utils.d.ts +3 -3
- package/dist/index-03853adc.js +29 -0
- package/dist/index-03853adc.js.map +1 -0
- package/dist/index.d.ts +11 -11
- 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 +21 -22
- package/dist/schemas/trading/LimitTradeParameters.ts +1 -1
- package/dist/schemas/trading/QuoteResultsSerialized.ts +6 -1
- package/dist/schemas/trading/TradeParameters.ts +1 -1
- 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 -1
- package/dist/trading/appDataUtils.d.ts +5 -5
- package/dist/trading/calculateUniqueOrderId.d.ts +5 -5
- package/dist/trading/consts.d.ts +10 -10
- package/dist/trading/getEthFlowTransaction.d.ts +12 -12
- package/dist/trading/getOrderToSign.d.ts +8 -8
- package/dist/trading/getOrderTypedData.d.ts +4 -4
- package/dist/trading/getPreSignTransaction.d.ts +4 -4
- package/dist/trading/getQuote.d.ts +25 -14
- package/dist/trading/index.d.ts +20 -19
- package/dist/trading/postCoWProtocolTrade.d.ts +4 -4
- package/dist/trading/postLimitOrder.d.ts +3 -3
- package/dist/trading/postSellNativeCurrencyOrder.d.ts +4 -4
- package/dist/trading/postSwapOrder.d.ts +5 -5
- package/dist/trading/sample.d.ts +1 -0
- package/dist/trading/suggestSlippageBps.d.ts +12 -0
- package/dist/trading/suggestSlippageFromFee.d.ts +17 -0
- package/dist/trading/suggestSlippageFromVolume.d.ts +10 -0
- package/dist/trading/tradingSdk.d.ts +26 -26
- package/dist/trading/types.d.ts +210 -201
- package/dist/trading/{utils.d.ts → utils/misc.d.ts} +27 -27
- package/dist/trading/utils/slippage.d.ts +14 -0
- package/dist/{utils-520905ea.js → utils-655d1f34.js} +1 -1
- package/dist/utils-655d1f34.js.map +1 -0
- package/dist/{utils-3d227fef.js → utils-6c6631d7.js} +1 -1
- package/dist/utils-6c6631d7.js.map +1 -0
- package/dist/{utils-802f717e.js → utils-728f2693.js} +2 -2
- package/dist/utils-728f2693.js.map +1 -0
- package/dist/utils.d.ts +3 -3
- package/dist/weiroll/index.d.ts +23 -23
- package/package.json +21 -22
- package/dist/index-8f962c6b.js +0 -29
- package/dist/index-8f962c6b.js.map +0 -1
- package/dist/utils-3d227fef.js.map +0 -1
- package/dist/utils-520905ea.js.map +0 -1
- package/dist/utils-802f717e.js.map +0 -1
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
import { SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
-
import { BridgeProvider, BridgeQuoteResult, CrossChainOrder, CrossChainQuoteAndPost, GetErc20Decimals, QuoteBridgeRequest } from '../types';
|
|
3
|
-
import { CowEnv, TokenInfo } from '../../common';
|
|
4
|
-
import { ChainInfo, SupportedChainId, TargetChainId } from '../../chains';
|
|
5
|
-
import { OrderBookApi } from 'src/order-book';
|
|
6
|
-
export interface BridgingSdkOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Providers for the bridging.
|
|
9
|
-
*/
|
|
10
|
-
providers: BridgeProvider<BridgeQuoteResult>[];
|
|
11
|
-
/**
|
|
12
|
-
* Function to get the decimals of the ERC20 tokens
|
|
13
|
-
*/
|
|
14
|
-
getErc20Decimals?: GetErc20Decimals;
|
|
15
|
-
/**
|
|
16
|
-
* Trading SDK.
|
|
17
|
-
*/
|
|
18
|
-
tradingSdk?: TradingSdk;
|
|
19
|
-
/**
|
|
20
|
-
* Order book API.
|
|
21
|
-
*/
|
|
22
|
-
orderBookApi?: OrderBookApi;
|
|
23
|
-
/**
|
|
24
|
-
* Enable logging for the bridging SDK.
|
|
25
|
-
*/
|
|
26
|
-
enableLogging?: boolean;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Parameters for the `getOrder` method.
|
|
30
|
-
*/
|
|
31
|
-
export interface GetOrderParams {
|
|
32
|
-
/**
|
|
33
|
-
* The unique identifier of the order.
|
|
34
|
-
*/
|
|
35
|
-
orderId: string;
|
|
36
|
-
/**
|
|
37
|
-
* The chain ID of the order.
|
|
38
|
-
*/
|
|
39
|
-
chainId: SupportedChainId;
|
|
40
|
-
/**
|
|
41
|
-
* The environment of the order
|
|
42
|
-
*/
|
|
43
|
-
env?: CowEnv;
|
|
44
|
-
}
|
|
45
|
-
export type BridgingSdkConfig = Required<Omit<BridgingSdkOptions, 'enableLogging' | 'getErc20Decimals'>> & Pick<BridgingSdkOptions, 'getErc20Decimals'>;
|
|
46
|
-
/**
|
|
47
|
-
* SDK for bridging for swapping tokens between different chains.
|
|
48
|
-
*/
|
|
49
|
-
export declare class BridgingSdk {
|
|
50
|
-
readonly options: BridgingSdkOptions;
|
|
51
|
-
protected config: BridgingSdkConfig;
|
|
52
|
-
constructor(options: BridgingSdkOptions);
|
|
53
|
-
private get provider();
|
|
54
|
-
/**
|
|
55
|
-
* Get the providers for the bridging.
|
|
56
|
-
*/
|
|
57
|
-
getProviders(): BridgeProvider<BridgeQuoteResult>[];
|
|
58
|
-
/**
|
|
59
|
-
* Get the available sources networks for the bridging.
|
|
60
|
-
*/
|
|
61
|
-
getSourceNetworks(): Promise<ChainInfo[]>;
|
|
62
|
-
/**
|
|
63
|
-
* Get the available target networks for the bridging.
|
|
64
|
-
*/
|
|
65
|
-
getTargetNetworks(): Promise<ChainInfo[]>;
|
|
66
|
-
/**
|
|
67
|
-
* Get the available buy tokens for buying in a specific target chain
|
|
68
|
-
*
|
|
69
|
-
* @param param
|
|
70
|
-
* @returns
|
|
71
|
-
*/
|
|
72
|
-
getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
|
|
73
|
-
/**
|
|
74
|
-
* Get quote details, including a callback function to post the order on-chain.
|
|
75
|
-
*
|
|
76
|
-
* This method support both, cross-chain swaps and single-chain swap.
|
|
77
|
-
*
|
|
78
|
-
* The return type will be either `QuoteAndPost` or `BridgeQuoteAndPost`.
|
|
79
|
-
*
|
|
80
|
-
* To safely assert the type in Typescript, you can use:
|
|
81
|
-
* - `isBridgeQuoteAndPost(result)` utility.
|
|
82
|
-
* - `isQuoteAndPost(result)` utility.
|
|
83
|
-
* - `assertIsBridgeQuoteAndPost(result)` assertion.
|
|
84
|
-
* - `assertIsQuoteAndPost(result)` assertion.
|
|
85
|
-
*
|
|
86
|
-
* @throws Error if no path is found
|
|
87
|
-
*/
|
|
88
|
-
getQuote(quoteBridgeRequest: QuoteBridgeRequest, advancedSettings?: SwapAdvancedSettings): Promise<CrossChainQuoteAndPost>;
|
|
89
|
-
getOrder(params: GetOrderParams): Promise<CrossChainOrder>;
|
|
90
|
-
}
|
|
1
|
+
import { SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
+
import { BridgeProvider, BridgeQuoteResult, CrossChainOrder, CrossChainQuoteAndPost, GetErc20Decimals, QuoteBridgeRequest } from '../types';
|
|
3
|
+
import { CowEnv, TokenInfo } from '../../common';
|
|
4
|
+
import { ChainInfo, SupportedChainId, TargetChainId } from '../../chains';
|
|
5
|
+
import { OrderBookApi } from 'src/order-book';
|
|
6
|
+
export interface BridgingSdkOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Providers for the bridging.
|
|
9
|
+
*/
|
|
10
|
+
providers: BridgeProvider<BridgeQuoteResult>[];
|
|
11
|
+
/**
|
|
12
|
+
* Function to get the decimals of the ERC20 tokens
|
|
13
|
+
*/
|
|
14
|
+
getErc20Decimals?: GetErc20Decimals;
|
|
15
|
+
/**
|
|
16
|
+
* Trading SDK.
|
|
17
|
+
*/
|
|
18
|
+
tradingSdk?: TradingSdk;
|
|
19
|
+
/**
|
|
20
|
+
* Order book API.
|
|
21
|
+
*/
|
|
22
|
+
orderBookApi?: OrderBookApi;
|
|
23
|
+
/**
|
|
24
|
+
* Enable logging for the bridging SDK.
|
|
25
|
+
*/
|
|
26
|
+
enableLogging?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parameters for the `getOrder` method.
|
|
30
|
+
*/
|
|
31
|
+
export interface GetOrderParams {
|
|
32
|
+
/**
|
|
33
|
+
* The unique identifier of the order.
|
|
34
|
+
*/
|
|
35
|
+
orderId: string;
|
|
36
|
+
/**
|
|
37
|
+
* The chain ID of the order.
|
|
38
|
+
*/
|
|
39
|
+
chainId: SupportedChainId;
|
|
40
|
+
/**
|
|
41
|
+
* The environment of the order
|
|
42
|
+
*/
|
|
43
|
+
env?: CowEnv;
|
|
44
|
+
}
|
|
45
|
+
export type BridgingSdkConfig = Required<Omit<BridgingSdkOptions, 'enableLogging' | 'getErc20Decimals'>> & Pick<BridgingSdkOptions, 'getErc20Decimals'>;
|
|
46
|
+
/**
|
|
47
|
+
* SDK for bridging for swapping tokens between different chains.
|
|
48
|
+
*/
|
|
49
|
+
export declare class BridgingSdk {
|
|
50
|
+
readonly options: BridgingSdkOptions;
|
|
51
|
+
protected config: BridgingSdkConfig;
|
|
52
|
+
constructor(options: BridgingSdkOptions);
|
|
53
|
+
private get provider();
|
|
54
|
+
/**
|
|
55
|
+
* Get the providers for the bridging.
|
|
56
|
+
*/
|
|
57
|
+
getProviders(): BridgeProvider<BridgeQuoteResult>[];
|
|
58
|
+
/**
|
|
59
|
+
* Get the available sources networks for the bridging.
|
|
60
|
+
*/
|
|
61
|
+
getSourceNetworks(): Promise<ChainInfo[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Get the available target networks for the bridging.
|
|
64
|
+
*/
|
|
65
|
+
getTargetNetworks(): Promise<ChainInfo[]>;
|
|
66
|
+
/**
|
|
67
|
+
* Get the available buy tokens for buying in a specific target chain
|
|
68
|
+
*
|
|
69
|
+
* @param param
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
|
|
73
|
+
/**
|
|
74
|
+
* Get quote details, including a callback function to post the order on-chain.
|
|
75
|
+
*
|
|
76
|
+
* This method support both, cross-chain swaps and single-chain swap.
|
|
77
|
+
*
|
|
78
|
+
* The return type will be either `QuoteAndPost` or `BridgeQuoteAndPost`.
|
|
79
|
+
*
|
|
80
|
+
* To safely assert the type in Typescript, you can use:
|
|
81
|
+
* - `isBridgeQuoteAndPost(result)` utility.
|
|
82
|
+
* - `isQuoteAndPost(result)` utility.
|
|
83
|
+
* - `assertIsBridgeQuoteAndPost(result)` assertion.
|
|
84
|
+
* - `assertIsQuoteAndPost(result)` assertion.
|
|
85
|
+
*
|
|
86
|
+
* @throws Error if no path is found
|
|
87
|
+
*/
|
|
88
|
+
getQuote(quoteBridgeRequest: QuoteBridgeRequest, advancedSettings?: SwapAdvancedSettings): Promise<CrossChainQuoteAndPost>;
|
|
89
|
+
getOrder(params: GetOrderParams): Promise<CrossChainOrder>;
|
|
90
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { BridgeProvider, BridgeQuoteResult, CrossChainOrder } from '../types';
|
|
2
|
-
import { SupportedChainId } from '../../chains';
|
|
3
|
-
import { OrderBookApi } from 'src/order-book';
|
|
4
|
-
import { CowEnv } from '../../common';
|
|
5
|
-
/**
|
|
6
|
-
* Fetch a cross-chain order and its status.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getCrossChainOrder(params: {
|
|
9
|
-
orderId: string;
|
|
10
|
-
chainId: SupportedChainId;
|
|
11
|
-
orderBookApi: OrderBookApi;
|
|
12
|
-
providers: BridgeProvider<BridgeQuoteResult>[];
|
|
13
|
-
env: CowEnv;
|
|
14
|
-
}): Promise<CrossChainOrder>;
|
|
1
|
+
import { BridgeProvider, BridgeQuoteResult, CrossChainOrder } from '../types';
|
|
2
|
+
import { SupportedChainId } from '../../chains';
|
|
3
|
+
import { OrderBookApi } from 'src/order-book';
|
|
4
|
+
import { CowEnv } from '../../common';
|
|
5
|
+
/**
|
|
6
|
+
* Fetch a cross-chain order and its status.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCrossChainOrder(params: {
|
|
9
|
+
orderId: string;
|
|
10
|
+
chainId: SupportedChainId;
|
|
11
|
+
orderBookApi: OrderBookApi;
|
|
12
|
+
providers: BridgeProvider<BridgeQuoteResult>[];
|
|
13
|
+
env: CowEnv;
|
|
14
|
+
}): Promise<CrossChainOrder>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Provider } from '@ethersproject/providers';
|
|
2
|
-
import { Signer } from '@ethersproject/abstract-signer';
|
|
3
|
-
import { GetErc20Decimals } from '../types';
|
|
4
|
-
export declare function factoryGetErc20Decimals(provider: Signer | Provider): GetErc20Decimals;
|
|
1
|
+
import { Provider } from '@ethersproject/providers';
|
|
2
|
+
import { Signer } from '@ethersproject/abstract-signer';
|
|
3
|
+
import { GetErc20Decimals } from '../types';
|
|
4
|
+
export declare function factoryGetErc20Decimals(provider: Signer | Provider): GetErc20Decimals;
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
-
import { BridgeProvider, BridgeQuoteAndPost, BridgeQuoteResult, GetErc20Decimals, QuoteBridgeRequest } from '../types';
|
|
3
|
-
import { SignerLike } from '../../common';
|
|
4
|
-
type GetQuoteWithBridgeParams<T extends BridgeQuoteResult> = {
|
|
5
|
-
/**
|
|
6
|
-
* Overall request for the swap and the bridge.
|
|
7
|
-
*/
|
|
8
|
-
swapAndBridgeRequest: QuoteBridgeRequest;
|
|
9
|
-
/**
|
|
10
|
-
* Advanced settings for the swap.
|
|
11
|
-
*/
|
|
12
|
-
advancedSettings?: SwapAdvancedSettings;
|
|
13
|
-
/**
|
|
14
|
-
* Provider for the bridge.
|
|
15
|
-
*/
|
|
16
|
-
provider: BridgeProvider<T>;
|
|
17
|
-
/**
|
|
18
|
-
* Trading SDK.
|
|
19
|
-
*/
|
|
20
|
-
tradingSdk: TradingSdk;
|
|
21
|
-
/**
|
|
22
|
-
* Function to get the decimals of the ERC20 tokens.
|
|
23
|
-
*/
|
|
24
|
-
getErc20Decimals: GetErc20Decimals;
|
|
25
|
-
/**
|
|
26
|
-
* For quote fetching we have to sign bridging hooks.
|
|
27
|
-
* But we won't do that using users wallet and will use some static PK.
|
|
28
|
-
*/
|
|
29
|
-
bridgeHookSigner?: SignerLike;
|
|
30
|
-
};
|
|
31
|
-
export declare function getQuoteWithBridge<T extends BridgeQuoteResult>(params: GetQuoteWithBridgeParams<T>): Promise<BridgeQuoteAndPost>;
|
|
32
|
-
export {};
|
|
1
|
+
import { SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
+
import { BridgeProvider, BridgeQuoteAndPost, BridgeQuoteResult, GetErc20Decimals, QuoteBridgeRequest } from '../types';
|
|
3
|
+
import { SignerLike } from '../../common';
|
|
4
|
+
type GetQuoteWithBridgeParams<T extends BridgeQuoteResult> = {
|
|
5
|
+
/**
|
|
6
|
+
* Overall request for the swap and the bridge.
|
|
7
|
+
*/
|
|
8
|
+
swapAndBridgeRequest: QuoteBridgeRequest;
|
|
9
|
+
/**
|
|
10
|
+
* Advanced settings for the swap.
|
|
11
|
+
*/
|
|
12
|
+
advancedSettings?: SwapAdvancedSettings;
|
|
13
|
+
/**
|
|
14
|
+
* Provider for the bridge.
|
|
15
|
+
*/
|
|
16
|
+
provider: BridgeProvider<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Trading SDK.
|
|
19
|
+
*/
|
|
20
|
+
tradingSdk: TradingSdk;
|
|
21
|
+
/**
|
|
22
|
+
* Function to get the decimals of the ERC20 tokens.
|
|
23
|
+
*/
|
|
24
|
+
getErc20Decimals: GetErc20Decimals;
|
|
25
|
+
/**
|
|
26
|
+
* For quote fetching we have to sign bridging hooks.
|
|
27
|
+
* But we won't do that using users wallet and will use some static PK.
|
|
28
|
+
*/
|
|
29
|
+
bridgeHookSigner?: SignerLike;
|
|
30
|
+
};
|
|
31
|
+
export declare function getQuoteWithBridge<T extends BridgeQuoteResult>(params: GetQuoteWithBridgeParams<T>): Promise<BridgeQuoteAndPost>;
|
|
32
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QuoteAndPost, SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
-
import { QuoteBridgeRequest } from '../types';
|
|
3
|
-
export declare function getQuoteWithoutBridge(params: {
|
|
4
|
-
quoteBridgeRequest: QuoteBridgeRequest;
|
|
5
|
-
advancedSettings?: SwapAdvancedSettings;
|
|
6
|
-
tradingSdk: TradingSdk;
|
|
7
|
-
}): Promise<QuoteAndPost>;
|
|
1
|
+
import { QuoteAndPost, SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
+
import { QuoteBridgeRequest } from '../types';
|
|
3
|
+
export declare function getQuoteWithoutBridge(params: {
|
|
4
|
+
quoteBridgeRequest: QuoteBridgeRequest;
|
|
5
|
+
advancedSettings?: SwapAdvancedSettings;
|
|
6
|
+
tradingSdk: TradingSdk;
|
|
7
|
+
}): Promise<QuoteAndPost>;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { BridgeCallDetails, BridgeQuoteResult, QuoteBridgeRequest } from '../../types';
|
|
2
|
-
import { OrderQuoteResponse, QuoteAmountsAndCosts } from '../../../order-book';
|
|
3
|
-
import { AppDataInfo, OrderTypedData, TradeParameters } from '../../../trading';
|
|
4
|
-
import { UnsignedOrder } from '../../../order-signing';
|
|
5
|
-
import { Wallet } from '@ethersproject/wallet';
|
|
6
|
-
export declare const intermediateToken = "0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB";
|
|
7
|
-
export declare const intermediateTokenDecimals = 18;
|
|
8
|
-
export declare const mockSigner: Wallet;
|
|
9
|
-
export declare const cowShedForAccount = "0x1111111111111111111111111111111111111111";
|
|
10
|
-
export declare const bridgeQuoteTimestamp = 1742906914061;
|
|
11
|
-
export declare const bridgeExpectedFillTimeSeconds = 100;
|
|
12
|
-
export declare const quoteBridgeRequest: QuoteBridgeRequest;
|
|
13
|
-
export declare const orderQuoteResponse: OrderQuoteResponse;
|
|
14
|
-
export declare const amountsAndCosts: QuoteAmountsAndCosts;
|
|
15
|
-
export declare const bridgeQuoteResult: BridgeQuoteResult;
|
|
16
|
-
export declare const bridgeCallDetails: BridgeCallDetails;
|
|
17
|
-
export declare const appDataInfo: AppDataInfo;
|
|
18
|
-
export declare const tradeParameters: TradeParameters;
|
|
19
|
-
export declare const orderToSign: UnsignedOrder;
|
|
20
|
-
export declare const orderTypedData: OrderTypedData;
|
|
1
|
+
import { BridgeCallDetails, BridgeQuoteResult, QuoteBridgeRequest } from '../../types';
|
|
2
|
+
import { OrderQuoteResponse, QuoteAmountsAndCosts } from '../../../order-book';
|
|
3
|
+
import { AppDataInfo, OrderTypedData, TradeParameters } from '../../../trading';
|
|
4
|
+
import { UnsignedOrder } from '../../../order-signing';
|
|
5
|
+
import { Wallet } from '@ethersproject/wallet';
|
|
6
|
+
export declare const intermediateToken = "0xDEf1CA1fb7FBcDC777520aa7f396b4E015F497aB";
|
|
7
|
+
export declare const intermediateTokenDecimals = 18;
|
|
8
|
+
export declare const mockSigner: Wallet;
|
|
9
|
+
export declare const cowShedForAccount = "0x1111111111111111111111111111111111111111";
|
|
10
|
+
export declare const bridgeQuoteTimestamp = 1742906914061;
|
|
11
|
+
export declare const bridgeExpectedFillTimeSeconds = 100;
|
|
12
|
+
export declare const quoteBridgeRequest: QuoteBridgeRequest;
|
|
13
|
+
export declare const orderQuoteResponse: OrderQuoteResponse;
|
|
14
|
+
export declare const amountsAndCosts: QuoteAmountsAndCosts;
|
|
15
|
+
export declare const bridgeQuoteResult: BridgeQuoteResult;
|
|
16
|
+
export declare const bridgeCallDetails: BridgeCallDetails;
|
|
17
|
+
export declare const appDataInfo: AppDataInfo;
|
|
18
|
+
export declare const tradeParameters: TradeParameters;
|
|
19
|
+
export declare const orderToSign: UnsignedOrder;
|
|
20
|
+
export declare const orderTypedData: OrderTypedData;
|
package/dist/bridging/const.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const RAW_PROVIDERS_FILES_PATH
|
|
2
|
-
export declare const DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION = 110000;
|
|
1
|
+
export declare const RAW_PROVIDERS_FILES_PATH = "https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers";
|
|
2
|
+
export declare const DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION = 110000;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare class BridgeProviderQuoteError extends Error {
|
|
2
|
-
readonly context:
|
|
3
|
-
constructor(message: string, context:
|
|
4
|
-
}
|
|
1
|
+
export declare class BridgeProviderQuoteError extends Error {
|
|
2
|
+
readonly context: unknown;
|
|
3
|
+
constructor(message: string, context: unknown);
|
|
4
|
+
}
|
package/dist/bridging/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './errors';
|
|
3
|
-
export * from './utils';
|
|
4
|
-
export * from './BridgingSdk/BridgingSdk';
|
|
5
|
-
export { MockBridgeProvider } from './providers/mock/MockBridgeProvider';
|
|
6
|
-
export { AcrossBridgeProvider, AcrossQuoteResult, AcrossBridgeProviderOptions, } from './providers/across/AcrossBridgeProvider';
|
|
1
|
+
export * from './types';
|
|
2
|
+
export * from './errors';
|
|
3
|
+
export * from './utils';
|
|
4
|
+
export * from './BridgingSdk/BridgingSdk';
|
|
5
|
+
export { MockBridgeProvider } from './providers/mock/MockBridgeProvider';
|
|
6
|
+
export { AcrossBridgeProvider, AcrossQuoteResult, AcrossBridgeProviderOptions, } from './providers/across/AcrossBridgeProvider';
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { AvailableRoutesRequest, Route, SuggestedFeesRequest, SuggestedFeesResponse } from './types';
|
|
2
|
-
export interface AcrossApiOptions {
|
|
3
|
-
apiBaseUrl?: string;
|
|
4
|
-
}
|
|
5
|
-
export declare class AcrossApi {
|
|
6
|
-
private readonly options;
|
|
7
|
-
constructor(options?: AcrossApiOptions);
|
|
8
|
-
/**
|
|
9
|
-
* Retrieve available routes for transfers
|
|
10
|
-
*
|
|
11
|
-
* Returns available routes based on specified parameters. If no parameters are provided, available routes on all
|
|
12
|
-
* chains are returned.
|
|
13
|
-
*
|
|
14
|
-
* See https://docs.across.to/reference/api-reference#available-routes
|
|
15
|
-
*/
|
|
16
|
-
getAvailableRoutes({ originChainId, originToken, destinationChainId, destinationToken, }: AvailableRoutesRequest): Promise<Route[]>;
|
|
17
|
-
/**
|
|
18
|
-
* Retrieve suggested fee quote for a deposit.
|
|
19
|
-
*
|
|
20
|
-
* Returns suggested fees based inputToken+outputToken, originChainId, destinationChainId, and amount.
|
|
21
|
-
* Also includes data used to compute the fees.
|
|
22
|
-
*
|
|
23
|
-
* * See https://docs.across.to/reference/api-reference#suggested-fees
|
|
24
|
-
*/
|
|
25
|
-
getSuggestedFees(request: SuggestedFeesRequest): Promise<SuggestedFeesResponse>;
|
|
26
|
-
protected fetchApi<T>(path: string, params: Record<string, string>, isValidResponse?: (response: unknown) => response is T): Promise<T>;
|
|
27
|
-
}
|
|
1
|
+
import { AvailableRoutesRequest, Route, SuggestedFeesRequest, SuggestedFeesResponse } from './types';
|
|
2
|
+
export interface AcrossApiOptions {
|
|
3
|
+
apiBaseUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class AcrossApi {
|
|
6
|
+
private readonly options;
|
|
7
|
+
constructor(options?: AcrossApiOptions);
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve available routes for transfers
|
|
10
|
+
*
|
|
11
|
+
* Returns available routes based on specified parameters. If no parameters are provided, available routes on all
|
|
12
|
+
* chains are returned.
|
|
13
|
+
*
|
|
14
|
+
* See https://docs.across.to/reference/api-reference#available-routes
|
|
15
|
+
*/
|
|
16
|
+
getAvailableRoutes({ originChainId, originToken, destinationChainId, destinationToken, }: AvailableRoutesRequest): Promise<Route[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Retrieve suggested fee quote for a deposit.
|
|
19
|
+
*
|
|
20
|
+
* Returns suggested fees based inputToken+outputToken, originChainId, destinationChainId, and amount.
|
|
21
|
+
* Also includes data used to compute the fees.
|
|
22
|
+
*
|
|
23
|
+
* * See https://docs.across.to/reference/api-reference#suggested-fees
|
|
24
|
+
*/
|
|
25
|
+
getSuggestedFees(request: SuggestedFeesRequest): Promise<SuggestedFeesResponse>;
|
|
26
|
+
protected fetchApi<T>(path: string, params: Record<string, string>, isValidResponse?: (response: unknown) => response is T): Promise<T>;
|
|
27
|
+
}
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import { Signer } from 'ethers';
|
|
2
|
-
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
3
|
-
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, QuoteBridgeRequest } from '../../types';
|
|
4
|
-
import { ChainId, ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
|
|
5
|
-
import { EvmCall, TokenInfo } from '../../../common';
|
|
6
|
-
import { AcrossApi, AcrossApiOptions } from './AcrossApi';
|
|
7
|
-
import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
|
|
8
|
-
import { SuggestedFeesResponse } from './types';
|
|
9
|
-
export declare const ACROSS_SUPPORTED_NETWORKS: ChainInfo[];
|
|
10
|
-
export interface AcrossBridgeProviderOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Token info provider
|
|
13
|
-
* @param chainId - The chain ID
|
|
14
|
-
* @param addresses - The addresses of the tokens to get the info for
|
|
15
|
-
* @returns The token infos
|
|
16
|
-
*/
|
|
17
|
-
getTokenInfos?: (chainId: ChainId, addresses: string[]) => Promise<TokenInfo[]>;
|
|
18
|
-
apiOptions?: AcrossApiOptions;
|
|
19
|
-
cowShedOptions?: CowShedSdkOptions;
|
|
20
|
-
}
|
|
21
|
-
export interface AcrossQuoteResult extends BridgeQuoteResult {
|
|
22
|
-
suggestedFees: SuggestedFeesResponse;
|
|
23
|
-
}
|
|
24
|
-
export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteResult> {
|
|
25
|
-
private options;
|
|
26
|
-
protected api: AcrossApi;
|
|
27
|
-
protected cowShedSdk: CowShedSdk;
|
|
28
|
-
constructor(options?: AcrossBridgeProviderOptions);
|
|
29
|
-
info: BridgeProviderInfo;
|
|
30
|
-
getNetworks(): Promise<ChainInfo[]>;
|
|
31
|
-
getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
|
|
32
|
-
getIntermediateTokens(request: QuoteBridgeRequest): Promise<string[]>;
|
|
33
|
-
getQuote(request: QuoteBridgeRequest): Promise<AcrossQuoteResult>;
|
|
34
|
-
getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: AcrossQuoteResult): Promise<EvmCall>;
|
|
35
|
-
getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
|
|
36
|
-
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer): Promise<BridgeHook>;
|
|
37
|
-
decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
|
|
38
|
-
getBridgingId(_orderUid: string, _settlementTx: string, _logIndex: number): Promise<string>;
|
|
39
|
-
getExplorerUrl(bridgingId: string): string;
|
|
40
|
-
getStatus(_bridgingId: string): Promise<BridgeStatusResult>;
|
|
41
|
-
getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
42
|
-
getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
43
|
-
}
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
3
|
+
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, QuoteBridgeRequest } from '../../types';
|
|
4
|
+
import { ChainId, ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
|
|
5
|
+
import { EvmCall, TokenInfo } from '../../../common';
|
|
6
|
+
import { AcrossApi, AcrossApiOptions } from './AcrossApi';
|
|
7
|
+
import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
|
|
8
|
+
import { SuggestedFeesResponse } from './types';
|
|
9
|
+
export declare const ACROSS_SUPPORTED_NETWORKS: ChainInfo[];
|
|
10
|
+
export interface AcrossBridgeProviderOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Token info provider
|
|
13
|
+
* @param chainId - The chain ID
|
|
14
|
+
* @param addresses - The addresses of the tokens to get the info for
|
|
15
|
+
* @returns The token infos
|
|
16
|
+
*/
|
|
17
|
+
getTokenInfos?: (chainId: ChainId, addresses: string[]) => Promise<TokenInfo[]>;
|
|
18
|
+
apiOptions?: AcrossApiOptions;
|
|
19
|
+
cowShedOptions?: CowShedSdkOptions;
|
|
20
|
+
}
|
|
21
|
+
export interface AcrossQuoteResult extends BridgeQuoteResult {
|
|
22
|
+
suggestedFees: SuggestedFeesResponse;
|
|
23
|
+
}
|
|
24
|
+
export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteResult> {
|
|
25
|
+
private options;
|
|
26
|
+
protected api: AcrossApi;
|
|
27
|
+
protected cowShedSdk: CowShedSdk;
|
|
28
|
+
constructor(options?: AcrossBridgeProviderOptions);
|
|
29
|
+
info: BridgeProviderInfo;
|
|
30
|
+
getNetworks(): Promise<ChainInfo[]>;
|
|
31
|
+
getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
|
|
32
|
+
getIntermediateTokens(request: QuoteBridgeRequest): Promise<string[]>;
|
|
33
|
+
getQuote(request: QuoteBridgeRequest): Promise<AcrossQuoteResult>;
|
|
34
|
+
getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: AcrossQuoteResult): Promise<EvmCall>;
|
|
35
|
+
getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
|
|
36
|
+
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer): Promise<BridgeHook>;
|
|
37
|
+
decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
|
|
38
|
+
getBridgingId(_orderUid: string, _settlementTx: string, _logIndex: number): Promise<string>;
|
|
39
|
+
getExplorerUrl(bridgingId: string): string;
|
|
40
|
+
getStatus(_bridgingId: string): Promise<BridgeStatusResult>;
|
|
41
|
+
getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
42
|
+
getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
43
|
+
}
|