@cowprotocol/cow-sdk 6.0.0-RC.44 → 6.0.0-RC.46

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 (31) hide show
  1. package/dist/bridging/BridgingSdk/BridgingSdk.d.ts +2 -6
  2. package/dist/bridging/BridgingSdk/getQuoteWithBridge.d.ts +1 -5
  3. package/dist/bridging/index.d.ts +0 -1
  4. package/dist/bridging/providers/across/AcrossApi.d.ts +2 -0
  5. package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +4 -10
  6. package/dist/bridging/providers/mock/MockBridgeProvider.d.ts +1 -1
  7. package/dist/bridging/types.d.ts +1 -2
  8. package/dist/index-d020641c.js +29 -0
  9. package/dist/index-d020641c.js.map +1 -0
  10. package/dist/index.js +4 -4
  11. package/dist/index.js.map +1 -1
  12. package/dist/index.modern.mjs +1 -1
  13. package/dist/index.module.js +4 -4
  14. package/dist/index.module.js.map +1 -1
  15. package/dist/package.json +1 -1
  16. package/dist/trading/consts.d.ts +0 -3
  17. package/dist/trading/getOrderToSign.d.ts +4 -1
  18. package/dist/trading/getQuote.d.ts +1 -0
  19. package/dist/trading/suggestSlippageBps.d.ts +1 -0
  20. package/dist/trading/utils/misc.d.ts +0 -7
  21. package/dist/trading/utils/slippage.d.ts +3 -0
  22. package/dist/{utils-979cfae5.js → utils-26ed0fa2.js} +2 -2
  23. package/dist/{utils-979cfae5.js.map → utils-26ed0fa2.js.map} +1 -1
  24. package/dist/{utils-84b5bba2.js → utils-588822c5.js} +1 -1
  25. package/dist/{utils-84b5bba2.js.map → utils-588822c5.js.map} +1 -1
  26. package/dist/{utils-834caecd.js → utils-cdcbdaa9.js} +1 -1
  27. package/dist/{utils-834caecd.js.map → utils-cdcbdaa9.js.map} +1 -1
  28. package/package.json +1 -1
  29. package/dist/bridging/BridgingSdk/getErc20Decimals.d.ts +0 -4
  30. package/dist/index-ceb19ab3.js +0 -29
  31. package/dist/index-ceb19ab3.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { SwapAdvancedSettings, TradingSdk } from '../../trading';
2
- import { BridgeProvider, BridgeQuoteResult, CrossChainOrder, CrossChainQuoteAndPost, GetErc20Decimals, QuoteBridgeRequest } from '../types';
2
+ import { BridgeProvider, BridgeQuoteResult, CrossChainOrder, CrossChainQuoteAndPost, QuoteBridgeRequest } from '../types';
3
3
  import { CowEnv, TokenInfo } from '../../common';
4
4
  import { ChainInfo, SupportedChainId, TargetChainId } from '../../chains';
5
5
  import { OrderBookApi } from 'src/order-book';
@@ -8,10 +8,6 @@ export interface BridgingSdkOptions {
8
8
  * Providers for the bridging.
9
9
  */
10
10
  providers: BridgeProvider<BridgeQuoteResult>[];
11
- /**
12
- * Function to get the decimals of the ERC20 tokens
13
- */
14
- getErc20Decimals?: GetErc20Decimals;
15
11
  /**
16
12
  * Trading SDK.
17
13
  */
@@ -42,7 +38,7 @@ export interface GetOrderParams {
42
38
  */
43
39
  env?: CowEnv;
44
40
  }
45
- export type BridgingSdkConfig = Required<Omit<BridgingSdkOptions, 'enableLogging' | 'getErc20Decimals'>> & Pick<BridgingSdkOptions, 'getErc20Decimals'>;
41
+ export type BridgingSdkConfig = Required<Omit<BridgingSdkOptions, 'enableLogging'>>;
46
42
  /**
47
43
  * SDK for bridging for swapping tokens between different chains.
48
44
  */
@@ -1,5 +1,5 @@
1
1
  import { SwapAdvancedSettings, TradingSdk } from '../../trading';
2
- import { BridgeProvider, BridgeQuoteAndPost, BridgeQuoteResult, GetErc20Decimals, QuoteBridgeRequest } from '../types';
2
+ import { BridgeProvider, BridgeQuoteAndPost, BridgeQuoteResult, QuoteBridgeRequest } from '../types';
3
3
  import { SignerLike } from '../../common';
4
4
  type GetQuoteWithBridgeParams<T extends BridgeQuoteResult> = {
5
5
  /**
@@ -18,10 +18,6 @@ type GetQuoteWithBridgeParams<T extends BridgeQuoteResult> = {
18
18
  * Trading SDK.
19
19
  */
20
20
  tradingSdk: TradingSdk;
21
- /**
22
- * Function to get the decimals of the ERC20 tokens.
23
- */
24
- getErc20Decimals: GetErc20Decimals;
25
21
  /**
26
22
  * For quote fetching we have to sign bridging hooks.
27
23
  * But we won't do that using users wallet and will use some static PK.
@@ -2,5 +2,4 @@ export * from './types';
2
2
  export * from './errors';
3
3
  export * from './utils';
4
4
  export * from './BridgingSdk/BridgingSdk';
5
- export { MockBridgeProvider } from './providers/mock/MockBridgeProvider';
6
5
  export { AcrossBridgeProvider, AcrossQuoteResult, AcrossBridgeProviderOptions, } from './providers/across/AcrossBridgeProvider';
@@ -1,4 +1,5 @@
1
1
  import { AvailableRoutesRequest, Route, SuggestedFeesRequest, SuggestedFeesResponse } from './types';
2
+ import { TokenInfo } from '../../../common';
2
3
  export interface AcrossApiOptions {
3
4
  apiBaseUrl?: string;
4
5
  }
@@ -23,5 +24,6 @@ export declare class AcrossApi {
23
24
  * * See https://docs.across.to/reference/api-reference#suggested-fees
24
25
  */
25
26
  getSuggestedFees(request: SuggestedFeesRequest): Promise<SuggestedFeesResponse>;
27
+ getSupportedTokens(): Promise<TokenInfo[]>;
26
28
  protected fetchApi<T>(path: string, params: Record<string, string>, isValidResponse?: (response: unknown) => response is T): Promise<T>;
27
29
  }
@@ -1,20 +1,13 @@
1
1
  import { Signer } from 'ethers';
2
2
  import { latest as latestAppData } from '@cowprotocol/app-data';
3
3
  import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, QuoteBridgeRequest } from '../../types';
4
- import { ChainId, ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
4
+ import { ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
5
5
  import { EvmCall, TokenInfo } from '../../../common';
6
6
  import { AcrossApi, AcrossApiOptions } from './AcrossApi';
7
7
  import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
8
8
  import { SuggestedFeesResponse } from './types';
9
9
  export declare const ACROSS_SUPPORTED_NETWORKS: ChainInfo[];
10
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
11
  apiOptions?: AcrossApiOptions;
19
12
  cowShedOptions?: CowShedSdkOptions;
20
13
  }
@@ -22,14 +15,14 @@ export interface AcrossQuoteResult extends BridgeQuoteResult {
22
15
  suggestedFees: SuggestedFeesResponse;
23
16
  }
24
17
  export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteResult> {
25
- private options;
26
18
  protected api: AcrossApi;
27
19
  protected cowShedSdk: CowShedSdk;
20
+ private supportedTokens;
28
21
  constructor(options?: AcrossBridgeProviderOptions);
29
22
  info: BridgeProviderInfo;
30
23
  getNetworks(): Promise<ChainInfo[]>;
31
24
  getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
32
- getIntermediateTokens(request: QuoteBridgeRequest): Promise<string[]>;
25
+ getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
33
26
  getQuote(request: QuoteBridgeRequest): Promise<AcrossQuoteResult>;
34
27
  getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: AcrossQuoteResult): Promise<EvmCall>;
35
28
  getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
@@ -40,4 +33,5 @@ export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteR
40
33
  getStatus(_bridgingId: string): Promise<BridgeStatusResult>;
41
34
  getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
42
35
  getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
36
+ private getSupportedTokensState;
43
37
  }
@@ -7,7 +7,7 @@ export declare class MockBridgeProvider implements BridgeProvider<BridgeQuoteRes
7
7
  info: BridgeProviderInfo;
8
8
  getNetworks(): Promise<ChainInfo[]>;
9
9
  getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
10
- getIntermediateTokens({ sellTokenChainId }: QuoteBridgeRequest): Promise<string[]>;
10
+ getIntermediateTokens({ sellTokenChainId }: QuoteBridgeRequest): Promise<TokenInfo[]>;
11
11
  getQuote(_request: QuoteBridgeRequest): Promise<BridgeQuoteResult>;
12
12
  getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
13
13
  getUnsignedBridgeCall(_request: QuoteBridgeRequest, _quote: BridgeQuoteResult): Promise<EvmCall>;
@@ -117,7 +117,7 @@ export interface BridgeProvider<Q extends BridgeQuoteResult> {
117
117
  *
118
118
  * @param request - The quote request
119
119
  */
120
- getIntermediateTokens(request: QuoteBridgeRequest): Promise<string[]>;
120
+ getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
121
121
  /**
122
122
  * Get a quote for a bridge request.
123
123
  *
@@ -272,7 +272,6 @@ export interface BridgeQuoteResults extends BridgeQuoteResult {
272
272
  */
273
273
  bridgeCallDetails: BridgeCallDetails;
274
274
  }
275
- export type GetErc20Decimals = (chainId: TargetChainId, tokenAddress: string) => Promise<number>;
276
275
  export interface CrossChainOrder {
277
276
  chainId: SupportedChainId;
278
277
  order: EnrichedOrder;