@cowprotocol/cow-sdk 6.0.0-RC.71 → 6.0.0-RC.73

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.
@@ -1,7 +1,7 @@
1
1
  import { SwapAdvancedSettings, TradingSdk } from '../../trading';
2
- import { BridgeProvider, BridgeQuoteResult, BridgeStatusResult, CrossChainOrder, CrossChainQuoteAndPost, QuoteBridgeRequest } from '../types';
2
+ import { BridgeProvider, BridgeQuoteResult, BridgeStatusResult, BuyTokensParams, CrossChainOrder, CrossChainQuoteAndPost, QuoteBridgeRequest } from '../types';
3
3
  import { CowEnv, TokenInfo } from '../../common';
4
- import { ChainInfo, SupportedChainId, TargetChainId } from '../../chains';
4
+ import { ChainInfo, SupportedChainId } from '../../chains';
5
5
  import { OrderBookApi } from '../../order-book';
6
6
  export interface BridgingSdkOptions {
7
7
  /**
@@ -62,9 +62,9 @@ export declare class BridgingSdk {
62
62
  /**
63
63
  * Get the available buy tokens for buying in a specific target chain
64
64
 
65
- * @param targetChainId
65
+ * @param params
66
66
  */
67
- getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
67
+ getBuyTokens(params: BuyTokensParams): Promise<TokenInfo[]>;
68
68
  /**
69
69
  * Get quote details, including a callback function to post the order on-chain.
70
70
  *
@@ -1,4 +1,4 @@
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 COW_SHED_PROXY_CREATION_GAS = 260000;
3
+ export declare const COW_SHED_PROXY_CREATION_GAS = 360000;
4
4
  export declare const HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
@@ -1,7 +1,7 @@
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, QuoteBridgeRequest } from '../../types';
4
- import { ChainId, ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
3
+ import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, QuoteBridgeRequest } from '../../types';
4
+ import { ChainId, ChainInfo, SupportedChainId } from '../../../chains';
5
5
  import { EvmCall, TokenInfo } from '../../../common';
6
6
  import { AcrossApi, AcrossApiOptions } from './AcrossApi';
7
7
  import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
@@ -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(targetChainId: TargetChainId): Promise<TokenInfo[]>;
28
+ getBuyTokens(params: BuyTokensParams): Promise<TokenInfo[]>;
29
29
  getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
30
30
  getQuote(request: QuoteBridgeRequest): Promise<AcrossQuoteResult>;
31
31
  getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: AcrossQuoteResult): Promise<EvmCall>;
@@ -1,6 +1,7 @@
1
1
  import { AcrossStatus, BungeeBuildTx, BungeeEvent, BungeeQuote, BungeeQuoteAPIRequest, BungeeQuoteWithBuildTx, SocketRequest, SupportedBridge } from './types';
2
2
  import { SignerLike, TokenInfo } from '../../../common';
3
3
  import { SupportedChainId, TargetChainId } from '../../../chains';
4
+ import { BuyTokensParams } from '../../types';
4
5
  export interface BungeeApiOptions {
5
6
  apiBaseUrl?: string;
6
7
  manualApiBaseUrl?: string;
@@ -8,20 +9,20 @@ export interface BungeeApiOptions {
8
9
  acrossApiBaseUrl?: string;
9
10
  includeBridges?: SupportedBridge[];
10
11
  }
12
+ interface IntermediateTokensParams {
13
+ fromChainId: SupportedChainId;
14
+ toChainId: TargetChainId;
15
+ toTokenAddress: string;
16
+ includeBridges?: SupportedBridge[];
17
+ }
11
18
  export declare class BungeeApi {
12
19
  private readonly options;
13
20
  constructor(options?: BungeeApiOptions);
14
21
  validateBridges(includeBridges: SupportedBridge[]): void;
15
- getBuyTokens(params: {
16
- targetChainId: TargetChainId;
17
- includeBridges?: SupportedBridge[];
18
- }): Promise<TokenInfo[]>;
19
- getIntermediateTokens(params: {
20
- fromChainId: SupportedChainId;
21
- toChainId: TargetChainId;
22
- toTokenAddress: string;
22
+ getBuyTokens(params: BuyTokensParams, bridgeParams?: {
23
23
  includeBridges?: SupportedBridge[];
24
24
  }): Promise<TokenInfo[]>;
25
+ getIntermediateTokens(params: IntermediateTokensParams): Promise<TokenInfo[]>;
25
26
  /**
26
27
  * Makes a GET request to Bungee APIs for quote and build tx
27
28
  */
@@ -61,3 +62,4 @@ export declare class BungeeApi {
61
62
  private getSupportedBridges;
62
63
  private makeApiCall;
63
64
  }
65
+ export {};
@@ -1,8 +1,8 @@
1
1
  import { Signer } from 'ethers';
2
2
  import { latest as latestAppData } from '@cowprotocol/app-data';
3
3
  import { JsonRpcProvider } from '@ethersproject/providers';
4
- import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, QuoteBridgeRequest } from '../../types';
5
- import { ChainId, ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
4
+ import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, BuyTokensParams, QuoteBridgeRequest } from '../../types';
5
+ import { ChainId, ChainInfo, SupportedChainId } from '../../../chains';
6
6
  import { EvmCall, TokenInfo } from '../../../common';
7
7
  import { BungeeApi, BungeeApiOptions } from './BungeeApi';
8
8
  import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
@@ -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(targetChainId: TargetChainId): Promise<TokenInfo[]>;
29
+ getBuyTokens(params: BuyTokensParams): Promise<TokenInfo[]>;
30
30
  getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
31
31
  getQuote(request: QuoteBridgeRequest): Promise<BungeeQuoteResult>;
32
32
  getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise<EvmCall>;
@@ -4,7 +4,7 @@ import { TokenInfo } from '../common/types/tokens';
4
4
  import { Address, Amounts, EnrichedOrder, OrderKind } from '../order-book';
5
5
  import { EvmCall } from '../common/types/ethereum';
6
6
  import type { AccountAddress } from '../common/types/wallets';
7
- import { OrderPostingResult, QuoteAndPost, QuoteResults, QuoterParameters, SwapAdvancedSettings, TradeOptionalParameters, TraderParameters } from '../trading';
7
+ import { OrderPostingResult, QuoteAndPost, QuoteResults, QuoterParameters, SigningStepManager, SwapAdvancedSettings, TradeOptionalParameters, TraderParameters } from '../trading';
8
8
  import { Signer } from '@ethersproject/abstract-signer';
9
9
  import { JsonRpcProvider } from '@ethersproject/providers';
10
10
  export interface BridgeProviderInfo {
@@ -100,6 +100,15 @@ export interface BridgeStatusResult {
100
100
  */
101
101
  fillTxHash?: string;
102
102
  }
103
+ /**
104
+ * When sellChainId and/or sellTokenAddress are specified
105
+ * then the buy tokens list will be additionally filtered
106
+ */
107
+ export interface BuyTokensParams {
108
+ buyChainId: TargetChainId;
109
+ sellChainId?: SupportedChainId;
110
+ sellTokenAddress?: string;
111
+ }
103
112
  /**
104
113
  * A bridge deposit. It includes the provideer information, sell amount and the minimum buy amount.
105
114
  *
@@ -121,7 +130,7 @@ export interface BridgeProvider<Q extends BridgeQuoteResult> {
121
130
  /**
122
131
  * Get supported tokens for a chain
123
132
  */
124
- getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
133
+ getBuyTokens(params: BuyTokensParams): Promise<TokenInfo[]>;
125
134
  /**
126
135
  * Get intermediate tokens given a quote request.
127
136
  *
@@ -225,7 +234,7 @@ export interface BridgeQuoteAndPost {
225
234
  /**
226
235
  * Callback to post the swap order.
227
236
  */
228
- postSwapOrderFromQuote(advancedSettings?: SwapAdvancedSettings): Promise<OrderPostingResult>;
237
+ postSwapOrderFromQuote(advancedSettings?: SwapAdvancedSettings, signingStepManager?: SigningStepManager): Promise<OrderPostingResult>;
229
238
  }
230
239
  export interface BridgeCosts<T = bigint> {
231
240
  bridgingFee: {