@cowprotocol/cow-sdk 6.2.0 → 6.3.0-RC.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/dist/bridging/BridgingSdk/BridgingSdk.d.ts +3 -3
- package/dist/bridging/BridgingSdk/mock/bridgeRequestMocks.d.ts +2 -1
- package/dist/bridging/const.d.ts +1 -0
- package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +2 -2
- package/dist/bridging/providers/bungee/BungeeBridgeProvider.d.ts +3 -2
- package/dist/bridging/providers/bungee/types.d.ts +3 -2
- package/dist/bridging/providers/mock/MockBridgeProvider.d.ts +2 -2
- package/dist/bridging/providers/utils/getGasLimitEstimationForHook.d.ts +1 -1
- package/dist/bridging/types.d.ts +10 -2
- package/dist/{index-7b4950ee.js → index-4e9731af.js} +5 -5
- package/dist/index-4e9731af.js.map +1 -0
- package/dist/index.d.ts +1 -0
- 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/package.json +2 -1
- package/dist/src/bridging/PROVIDER_README.md +56 -80
- package/dist/test/getWallet.d.ts +5 -0
- package/dist/{utils-23bf76fc.js → utils-09b0eb98.js} +1 -1
- package/dist/{utils-23bf76fc.js.map → utils-09b0eb98.js.map} +1 -1
- package/dist/{utils-0027f121.js → utils-9d279cf0.js} +1 -1
- package/dist/{utils-0027f121.js.map → utils-9d279cf0.js.map} +1 -1
- package/dist/{utils-fc43cd05.js → utils-d9f251cf.js} +2 -2
- package/dist/{utils-fc43cd05.js.map → utils-d9f251cf.js.map} +1 -1
- package/package.json +2 -1
- package/dist/index-7b4950ee.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
-
import { BridgeProvider, BridgeQuoteResult, BridgeStatusResult, BuyTokensParams, CrossChainOrder, CrossChainQuoteAndPost, QuoteBridgeRequest } from '../types';
|
|
3
|
-
import { CowEnv
|
|
2
|
+
import { BridgeProvider, BridgeQuoteResult, BridgeStatusResult, BuyTokensParams, CrossChainOrder, CrossChainQuoteAndPost, GetProviderBuyTokens, QuoteBridgeRequest } from '../types';
|
|
3
|
+
import { CowEnv } from '../../common';
|
|
4
4
|
import { ChainInfo, SupportedChainId } from '../../chains';
|
|
5
5
|
import { OrderBookApi } from '../../order-book';
|
|
6
6
|
export interface BridgingSdkOptions {
|
|
@@ -64,7 +64,7 @@ export declare class BridgingSdk {
|
|
|
64
64
|
|
|
65
65
|
* @param params
|
|
66
66
|
*/
|
|
67
|
-
getBuyTokens(params: BuyTokensParams): Promise<
|
|
67
|
+
getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
|
|
68
68
|
/**
|
|
69
69
|
* Get quote details, including a callback function to post the order on-chain.
|
|
70
70
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BridgeCallDetails, BridgeQuoteResult, QuoteBridgeRequest } from '../../types';
|
|
1
|
+
import { BridgeCallDetails, BridgeQuoteResult, BuyTokensParams, QuoteBridgeRequest } from '../../types';
|
|
2
2
|
import { OrderQuoteResponse, QuoteAmountsAndCosts } from '../../../order-book';
|
|
3
3
|
import { AppDataInfo, OrderTypedData, TradeParameters } from '../../../trading';
|
|
4
4
|
import { UnsignedOrder } from '../../../order-signing';
|
|
@@ -18,3 +18,4 @@ export declare const appDataInfo: AppDataInfo;
|
|
|
18
18
|
export declare const tradeParameters: TradeParameters;
|
|
19
19
|
export declare const orderToSign: UnsignedOrder;
|
|
20
20
|
export declare const orderTypedData: OrderTypedData;
|
|
21
|
+
export declare const buyTokensParams: BuyTokensParams;
|
package/dist/bridging/const.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const RAW_PROVIDERS_FILES_PATH = "https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers";
|
|
2
2
|
export declare const DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION = 240000;
|
|
3
|
+
export declare const DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION = 100000;
|
|
3
4
|
export declare const COW_SHED_PROXY_CREATION_GAS = 360000;
|
|
4
5
|
export declare const HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
2
|
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
3
|
-
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, QuoteBridgeRequest } from '../../types';
|
|
3
|
+
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, GetProviderBuyTokens, QuoteBridgeRequest } from '../../types';
|
|
4
4
|
import { ChainId, ChainInfo, SupportedChainId } from '../../../chains';
|
|
5
5
|
import { EvmCall, TokenInfo } from '../../../common';
|
|
6
6
|
import { AcrossApi, AcrossApiOptions } from './AcrossApi';
|
|
@@ -25,7 +25,7 @@ export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteR
|
|
|
25
25
|
constructor(options: AcrossBridgeProviderOptions);
|
|
26
26
|
info: BridgeProviderInfo;
|
|
27
27
|
getNetworks(): Promise<ChainInfo[]>;
|
|
28
|
-
getBuyTokens(params: BuyTokensParams): Promise<
|
|
28
|
+
getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
|
|
29
29
|
getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
|
|
30
30
|
getQuote(request: QuoteBridgeRequest): Promise<AcrossQuoteResult>;
|
|
31
31
|
getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: AcrossQuoteResult): Promise<EvmCall>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
2
|
-
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, QuoteBridgeRequest } from '../../types';
|
|
2
|
+
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, GetProviderBuyTokens, QuoteBridgeRequest } from '../../types';
|
|
3
3
|
import { ChainId, ChainInfo, SupportedChainId } from '../../../chains';
|
|
4
4
|
import { EvmCall, TokenInfo } from '../../../common';
|
|
5
5
|
import { BungeeApi, BungeeApiOptions } from './BungeeApi';
|
|
@@ -26,7 +26,7 @@ export declare class BungeeBridgeProvider implements BridgeProvider<BungeeQuoteR
|
|
|
26
26
|
constructor(options: BungeeBridgeProviderOptions);
|
|
27
27
|
info: BridgeProviderInfo;
|
|
28
28
|
getNetworks(): Promise<ChainInfo[]>;
|
|
29
|
-
getBuyTokens(params: BuyTokensParams): Promise<
|
|
29
|
+
getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
|
|
30
30
|
getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
|
|
31
31
|
getQuote(request: QuoteBridgeRequest): Promise<BungeeQuoteResult>;
|
|
32
32
|
getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise<EvmCall>;
|
|
@@ -41,4 +41,5 @@ export declare class BungeeBridgeProvider implements BridgeProvider<BungeeQuoteR
|
|
|
41
41
|
getStatus(_bridgingId: string): Promise<BridgeStatusResult>;
|
|
42
42
|
getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
43
43
|
getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
44
|
+
private isExtraGasRequired;
|
|
44
45
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type SupportedBridge = 'across' | 'cctp';
|
|
1
|
+
export type SupportedBridge = 'across' | 'cctp' | 'gnosis-native-bridge';
|
|
2
2
|
export interface BungeeQuoteAPIRequest {
|
|
3
3
|
userAddress: string;
|
|
4
4
|
originChainId: string;
|
|
@@ -105,7 +105,8 @@ export interface BungeeQuoteAPIResponse {
|
|
|
105
105
|
}
|
|
106
106
|
export declare enum BungeeBridge {
|
|
107
107
|
'Across' = "across",
|
|
108
|
-
'CircleCCTP' = "cctp"
|
|
108
|
+
'CircleCCTP' = "cctp",
|
|
109
|
+
'GnosisNative' = "gnosis-native-bridge"
|
|
109
110
|
}
|
|
110
111
|
export declare const BungeeBridgeNames: Record<string, BungeeBridge>;
|
|
111
112
|
export interface BungeeQuote {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
2
|
-
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, QuoteBridgeRequest } from '../../types';
|
|
2
|
+
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, GetProviderBuyTokens, QuoteBridgeRequest } from '../../types';
|
|
3
3
|
import { Signer } from '@ethersproject/abstract-signer';
|
|
4
4
|
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
5
5
|
import { ChainId, ChainInfo, SupportedChainId } from '../../../chains';
|
|
@@ -8,7 +8,7 @@ export declare class MockBridgeProvider implements BridgeProvider<BridgeQuoteRes
|
|
|
8
8
|
info: BridgeProviderInfo;
|
|
9
9
|
getRpcProvider(): JsonRpcProvider;
|
|
10
10
|
getNetworks(): Promise<ChainInfo[]>;
|
|
11
|
-
getBuyTokens(params: BuyTokensParams): Promise<
|
|
11
|
+
getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
|
|
12
12
|
getIntermediateTokens({ sellTokenChainId }: QuoteBridgeRequest): Promise<TokenInfo[]>;
|
|
13
13
|
getQuote(_request: QuoteBridgeRequest): Promise<BridgeQuoteResult>;
|
|
14
14
|
getGasLimitEstimationForHook(_request: QuoteBridgeRequest): Promise<number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { QuoteBridgeRequest } from '../../types';
|
|
2
2
|
import type { JsonRpcProvider } from '@ethersproject/providers';
|
|
3
3
|
import { CowShedSdk } from '../../../cow-shed';
|
|
4
|
-
export declare function getGasLimitEstimationForHook(cowShedSdk: CowShedSdk, request: QuoteBridgeRequest, provider: JsonRpcProvider): Promise<number>;
|
|
4
|
+
export declare function getGasLimitEstimationForHook(cowShedSdk: CowShedSdk, request: QuoteBridgeRequest, provider: JsonRpcProvider, extraGas?: number): Promise<number>;
|
package/dist/bridging/types.d.ts
CHANGED
|
@@ -109,6 +109,10 @@ export interface BuyTokensParams {
|
|
|
109
109
|
sellChainId?: SupportedChainId;
|
|
110
110
|
sellTokenAddress?: string;
|
|
111
111
|
}
|
|
112
|
+
export interface GetProviderBuyTokens {
|
|
113
|
+
tokens: TokenInfo[];
|
|
114
|
+
isRouteAvailable: boolean;
|
|
115
|
+
}
|
|
112
116
|
/**
|
|
113
117
|
* A bridge deposit. It includes the provideer information, sell amount and the minimum buy amount.
|
|
114
118
|
*
|
|
@@ -130,7 +134,7 @@ export interface BridgeProvider<Q extends BridgeQuoteResult> {
|
|
|
130
134
|
/**
|
|
131
135
|
* Get supported tokens for a chain
|
|
132
136
|
*/
|
|
133
|
-
getBuyTokens(params: BuyTokensParams): Promise<
|
|
137
|
+
getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
|
|
134
138
|
/**
|
|
135
139
|
* Get intermediate tokens given a quote request.
|
|
136
140
|
*
|
|
@@ -165,8 +169,12 @@ export interface BridgeProvider<Q extends BridgeQuoteResult> {
|
|
|
165
169
|
* 2. The final amount could affect hook gas costs
|
|
166
170
|
*
|
|
167
171
|
* By estimating gas costs independently, we can resolve this dependency cycle.
|
|
172
|
+
* For some providers, the `extraGas` flag adds a 100,000 gas‐unit buffer to the hook
|
|
173
|
+
* (see DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION).
|
|
168
174
|
*/
|
|
169
|
-
getGasLimitEstimationForHook(request: Omit<QuoteBridgeRequest, 'amount'>
|
|
175
|
+
getGasLimitEstimationForHook(request: Omit<QuoteBridgeRequest, 'amount'> & {
|
|
176
|
+
extraGas?: number;
|
|
177
|
+
}): Promise<number>;
|
|
170
178
|
/**
|
|
171
179
|
* Get a pre-authorized hook for initiating a bridge.
|
|
172
180
|
*
|