@cowprotocol/cow-sdk 6.0.0-RC.6 → 6.0.0-RC.9
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 +7 -1
- package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +2 -2
- package/dist/bridging/types.d.ts +28 -20
- package/dist/bridging/utils.d.ts +4 -0
- package/dist/index-317c25f1.js +29 -0
- package/dist/index-317c25f1.js.map +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 +1 -1
- package/dist/src/bridging/README.md +19 -9
- package/dist/{utils-d299b316.js → utils-204a9cbe.js} +1 -1
- package/dist/{utils-d299b316.js.map → utils-204a9cbe.js.map} +1 -1
- package/dist/{utils-a5c348d5.js → utils-762ee9c3.js} +2 -2
- package/dist/{utils-a5c348d5.js.map → utils-762ee9c3.js.map} +1 -1
- package/dist/{utils-15f2794a.js → utils-de2eb543.js} +1 -1
- package/dist/{utils-15f2794a.js.map → utils-de2eb543.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-0b60dcd5.js +0 -29
- package/dist/index-0b60dcd5.js.map +0 -1
|
@@ -49,7 +49,13 @@ export declare class BridgingSdk {
|
|
|
49
49
|
*
|
|
50
50
|
* This method support both, cross-chain swaps and single-chain swap.
|
|
51
51
|
*
|
|
52
|
-
* The return type will be either `QuoteAndPost` or `BridgeQuoteAndPost`.
|
|
52
|
+
* The return type will be either `QuoteAndPost` or `BridgeQuoteAndPost`.
|
|
53
|
+
*
|
|
54
|
+
* To safely assert the type in Typescript, you can use:
|
|
55
|
+
* - `isBridgeQuoteAndPost(result)` utility.
|
|
56
|
+
* - `isQuoteAndPost(result)` utility.
|
|
57
|
+
* - `assertIsBridgeQuoteAndPost(result)` assertion.
|
|
58
|
+
* - `assertIsQuoteAndPost(result)` assertion.
|
|
53
59
|
*
|
|
54
60
|
* @throws Error if no path is found
|
|
55
61
|
*/
|
|
@@ -12,7 +12,7 @@ export interface AcrossBridgeProviderOptions {
|
|
|
12
12
|
* @param addresses - The addresses of the tokens to get the info for
|
|
13
13
|
* @returns The token infos
|
|
14
14
|
*/
|
|
15
|
-
getTokenInfos
|
|
15
|
+
getTokenInfos?: (chainId: ChainId, addresses: string[]) => Promise<TokenInfo[]>;
|
|
16
16
|
apiOptions?: AcrossApiOptions;
|
|
17
17
|
cowShedOptions?: CowShedSdkOptions;
|
|
18
18
|
}
|
|
@@ -23,7 +23,7 @@ export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteR
|
|
|
23
23
|
private options;
|
|
24
24
|
protected api: AcrossApi;
|
|
25
25
|
protected cowShedSdk: CowShedSdk;
|
|
26
|
-
constructor(options
|
|
26
|
+
constructor(options?: AcrossBridgeProviderOptions);
|
|
27
27
|
info: BridgeProviderInfo;
|
|
28
28
|
getNetworks(): Promise<ChainInfo[]>;
|
|
29
29
|
getBuyTokens(param: GetBuyTokensParams): Promise<TokenInfo[]>;
|
package/dist/bridging/types.d.ts
CHANGED
|
@@ -9,29 +9,28 @@ export interface BridgeProviderInfo {
|
|
|
9
9
|
name: string;
|
|
10
10
|
logoUrl: string;
|
|
11
11
|
}
|
|
12
|
-
export interface WithSellToken {
|
|
12
|
+
export interface GetBuyTokensParams extends Partial<WithSellToken> {
|
|
13
|
+
targetChainId: TargetChainId;
|
|
14
|
+
}
|
|
15
|
+
interface WithSellToken {
|
|
13
16
|
sellTokenChainId: SupportedChainId;
|
|
14
17
|
sellTokenAddress: Address;
|
|
15
18
|
sellTokenDecimals: number;
|
|
16
19
|
}
|
|
17
|
-
|
|
20
|
+
interface WithBuyToken {
|
|
18
21
|
buyTokenChainId: TargetChainId;
|
|
19
22
|
buyTokenAddress: Address;
|
|
20
23
|
buyTokenDecimals: number;
|
|
21
24
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
+
type WithQuoter = Omit<QuoterParameters, 'chainId'>;
|
|
26
|
+
type WithTrader = Pick<TraderParameters, 'signer'>;
|
|
25
27
|
/**
|
|
26
28
|
* Parameters for getting a bridge quote
|
|
27
29
|
*/
|
|
28
|
-
export
|
|
30
|
+
export type QuoteBridgeRequest = {
|
|
29
31
|
kind: OrderKind.SELL;
|
|
30
32
|
amount: bigint;
|
|
31
|
-
|
|
32
|
-
feeBps?: number;
|
|
33
|
-
feeRecipient?: string;
|
|
34
|
-
}
|
|
33
|
+
} & WithSellToken & WithBuyToken & WithQuoter & WithTrader & TradeOptionalParameters;
|
|
35
34
|
export type QuoteBridgeRequestWithoutAmount = Omit<QuoteBridgeRequest, 'amount'>;
|
|
36
35
|
export interface BridgeQuoteResult {
|
|
37
36
|
/**
|
|
@@ -199,7 +198,6 @@ export interface BridgeCosts<T = bigint> {
|
|
|
199
198
|
amountInSellCurrency: T;
|
|
200
199
|
amountInBuyCurrency: T;
|
|
201
200
|
};
|
|
202
|
-
slippageBps: number;
|
|
203
201
|
}
|
|
204
202
|
export interface BridgeQuoteAmountsAndCosts<T = bigint> {
|
|
205
203
|
/**
|
|
@@ -220,6 +218,10 @@ export interface BridgeQuoteAmountsAndCosts<T = bigint> {
|
|
|
220
218
|
* It includes the fees and the slippage tolerance, so its the minimum amount that the user will receive.
|
|
221
219
|
*/
|
|
222
220
|
afterSlippage: Amounts<T>;
|
|
221
|
+
/**
|
|
222
|
+
* The slippage tolerance in basis points.
|
|
223
|
+
*/
|
|
224
|
+
slippageBps: number;
|
|
223
225
|
}
|
|
224
226
|
export interface BridgeQuoteResults extends BridgeQuoteResult {
|
|
225
227
|
/**
|
|
@@ -227,17 +229,23 @@ export interface BridgeQuoteResults extends BridgeQuoteResult {
|
|
|
227
229
|
*/
|
|
228
230
|
providerInfo: BridgeProviderInfo;
|
|
229
231
|
/**
|
|
230
|
-
*
|
|
232
|
+
* Trade parameters
|
|
231
233
|
*/
|
|
232
|
-
|
|
234
|
+
tradeParameters: QuoteBridgeRequest;
|
|
233
235
|
/**
|
|
234
|
-
*
|
|
235
|
-
* CoW Protocol Trampoline contract after settling the swap order that buys the intermediate token.
|
|
236
|
+
* Bridge call details
|
|
236
237
|
*/
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
238
|
+
bridgeCallDetails: {
|
|
239
|
+
/**
|
|
240
|
+
* Unsigned call to initiate the bridge. This call should be executed in the context of user's cow-shed account.
|
|
241
|
+
*/
|
|
242
|
+
unsignedBridgeCall: EvmCall;
|
|
243
|
+
/**
|
|
244
|
+
* Pre-authorized hook to initiate the bridge. This hook has been signed, and is ready to be executed by the
|
|
245
|
+
* CoW Protocol Trampoline contract after settling the swap order that buys the intermediate token.
|
|
246
|
+
*/
|
|
247
|
+
preAuthorizedBridgingHook: BridgeHook;
|
|
248
|
+
};
|
|
242
249
|
}
|
|
243
250
|
export type GetErc20Decimals = (chainId: TargetChainId, tokenAddress: string) => Promise<number>;
|
|
251
|
+
export {};
|
package/dist/bridging/utils.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
import { QuoteAndPost } from '../trading';
|
|
1
2
|
import { BridgeQuoteAndPost, CrossChainQuoteAndPost } from './types';
|
|
2
3
|
export declare function isBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): quote is BridgeQuoteAndPost;
|
|
4
|
+
export declare function isQuoteAndPost(quote: CrossChainQuoteAndPost): quote is QuoteAndPost;
|
|
5
|
+
export declare function assertIsBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is BridgeQuoteAndPost;
|
|
6
|
+
export declare function assertIsQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is QuoteAndPost;
|