@cowprotocol/cow-sdk 6.0.0-RC.63 → 6.0.0-RC.64
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/getBridgeSignedHook.d.ts +8 -0
- package/dist/bridging/BridgingSdk/getQuoteWithBridge.d.ts +2 -27
- package/dist/bridging/BridgingSdk/types.d.ts +45 -0
- package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +1 -1
- package/dist/bridging/providers/bungee/BungeeApi.d.ts +13 -2
- package/dist/bridging/providers/bungee/BungeeBridgeProvider.d.ts +2 -2
- package/dist/bridging/providers/bungee/types.d.ts +26 -0
- package/dist/bridging/types.d.ts +1 -1
- package/dist/common/consts/order.d.ts +1 -0
- package/dist/common/utils/order.d.ts +4 -0
- package/dist/cow-shed/CowShedSdk.d.ts +1 -1
- package/dist/index-6602fc47.js +29 -0
- package/dist/index-6602fc47.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.module.js +2 -2
- package/dist/index.module.js.map +1 -1
- package/dist/package.json +2 -1
- package/dist/trading/consts.d.ts +0 -1
- package/dist/{utils-031e4b83.js → utils-55ff51a2.js} +1 -1
- package/dist/{utils-031e4b83.js.map → utils-55ff51a2.js.map} +1 -1
- package/dist/{utils-9e860989.js → utils-7e19f6e7.js} +2 -2
- package/dist/{utils-9e860989.js.map → utils-7e19f6e7.js.map} +1 -1
- package/dist/{utils-e431cca8.js → utils-b828f84d.js} +1 -1
- package/dist/{utils-e431cca8.js.map → utils-b828f84d.js.map} +1 -1
- package/package.json +2 -1
- package/dist/bridging/providers/bungee/const/tokens.d.ts +0 -7
- package/dist/index-3d88c185.js +0 -29
- package/dist/index-3d88c185.js.map +0 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EvmCall } from '../../common';
|
|
2
|
+
import { BridgeHook, BridgeQuoteResult, QuoteBridgeRequest } from '../types';
|
|
3
|
+
import { BridgeResultContext } from './types';
|
|
4
|
+
export declare function getBridgeSignedHook(bridgeRequest: QuoteBridgeRequest, { provider, signer, defaultGasLimit, swapResult, validToOverride }: BridgeResultContext): Promise<{
|
|
5
|
+
hook: BridgeHook;
|
|
6
|
+
unsignedBridgeCall: EvmCall;
|
|
7
|
+
bridgingQuote: BridgeQuoteResult;
|
|
8
|
+
}>;
|
|
@@ -1,28 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
-
* For quote fetching we have to sign bridging hooks.
|
|
23
|
-
* But we won't do that using users wallet and will use some static PK.
|
|
24
|
-
*/
|
|
25
|
-
bridgeHookSigner?: SignerLike;
|
|
26
|
-
};
|
|
1
|
+
import { BridgeQuoteAndPost, BridgeQuoteResult } from '../types';
|
|
2
|
+
import { GetQuoteWithBridgeParams } from './types';
|
|
27
3
|
export declare function getQuoteWithBridge<T extends BridgeQuoteResult>(params: GetQuoteWithBridgeParams<T>): Promise<BridgeQuoteAndPost>;
|
|
28
|
-
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { BridgeHook, BridgeProvider, BridgeQuoteResult, BridgeQuoteResults, QuoteBridgeRequest, QuoteBridgeRequestWithoutAmount } from '../types';
|
|
2
|
+
import { AppDataInfo, QuoteResults, SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
3
|
+
import { SignerLike } from '../../common';
|
|
4
|
+
import { Signer } from '@ethersproject/abstract-signer';
|
|
5
|
+
import { latest } from '@cowprotocol/app-data';
|
|
6
|
+
export type GetQuoteWithBridgeParams<T extends BridgeQuoteResult> = {
|
|
7
|
+
/**
|
|
8
|
+
* Overall request for the swap and the bridge.
|
|
9
|
+
*/
|
|
10
|
+
swapAndBridgeRequest: QuoteBridgeRequest;
|
|
11
|
+
/**
|
|
12
|
+
* Advanced settings for the swap.
|
|
13
|
+
*/
|
|
14
|
+
advancedSettings?: SwapAdvancedSettings;
|
|
15
|
+
/**
|
|
16
|
+
* Provider for the bridge.
|
|
17
|
+
*/
|
|
18
|
+
provider: BridgeProvider<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Trading SDK.
|
|
21
|
+
*/
|
|
22
|
+
tradingSdk: TradingSdk;
|
|
23
|
+
/**
|
|
24
|
+
* For quote fetching we have to sign bridging hooks.
|
|
25
|
+
* But we won't do that using users wallet and will use some static PK.
|
|
26
|
+
*/
|
|
27
|
+
bridgeHookSigner?: SignerLike;
|
|
28
|
+
};
|
|
29
|
+
export interface GetBridgeResultResult {
|
|
30
|
+
bridgeResult: BridgeQuoteResults;
|
|
31
|
+
bridgeHook: BridgeHook;
|
|
32
|
+
appDataInfo: AppDataInfo;
|
|
33
|
+
}
|
|
34
|
+
export interface BridgeResultContext<T extends BridgeQuoteResult = BridgeQuoteResult> {
|
|
35
|
+
swapAndBridgeRequest: QuoteBridgeRequest;
|
|
36
|
+
swapResult: QuoteResults;
|
|
37
|
+
intermediateTokenAmount: bigint;
|
|
38
|
+
bridgeRequestWithoutAmount: QuoteBridgeRequestWithoutAmount;
|
|
39
|
+
provider: BridgeProvider<T>;
|
|
40
|
+
signer: Signer;
|
|
41
|
+
mockedHook: latest.CoWHook;
|
|
42
|
+
validToOverride?: number;
|
|
43
|
+
appDataOverride?: SwapAdvancedSettings['appData'];
|
|
44
|
+
defaultGasLimit?: bigint;
|
|
45
|
+
}
|
|
@@ -28,7 +28,7 @@ export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteR
|
|
|
28
28
|
getQuote(request: QuoteBridgeRequest): Promise<AcrossQuoteResult>;
|
|
29
29
|
getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: AcrossQuoteResult): Promise<EvmCall>;
|
|
30
30
|
getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
|
|
31
|
-
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
31
|
+
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, bridgeHookNonce: string, deadline: bigint, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
32
32
|
decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
|
|
33
33
|
getBridgingParams(chainId: ChainId, provider: JsonRpcProvider, orderUid: string, txHash: string): Promise<BridgingDepositParams | null>;
|
|
34
34
|
getExplorerUrl(bridgingId: string): string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AcrossStatus, BungeeBuildTx, BungeeEvent, BungeeQuote, BungeeQuoteAPIRequest, BungeeQuoteWithBuildTx, SocketRequest, SupportedBridge } from './types';
|
|
2
|
-
import { SignerLike } from '../../../common';
|
|
3
|
-
import { SupportedChainId } from '../../../chains';
|
|
2
|
+
import { SignerLike, TokenInfo } from '../../../common';
|
|
3
|
+
import { SupportedChainId, TargetChainId } from '../../../chains';
|
|
4
4
|
export interface BungeeApiOptions {
|
|
5
5
|
apiBaseUrl?: string;
|
|
6
|
+
manualApiBaseUrl?: string;
|
|
6
7
|
eventsApiBaseUrl?: string;
|
|
7
8
|
acrossApiBaseUrl?: string;
|
|
8
9
|
includeBridges?: SupportedBridge[];
|
|
@@ -12,6 +13,16 @@ export declare class BungeeApi {
|
|
|
12
13
|
readonly SUPPORTED_BRIDGES: SupportedBridge[];
|
|
13
14
|
constructor(options?: BungeeApiOptions);
|
|
14
15
|
validateBridges(includeBridges: SupportedBridge[]): void;
|
|
16
|
+
getBuyTokens(params: {
|
|
17
|
+
targetChainId: TargetChainId;
|
|
18
|
+
includeBridges?: SupportedBridge[];
|
|
19
|
+
}): Promise<TokenInfo[]>;
|
|
20
|
+
getIntermediateTokens(params: {
|
|
21
|
+
fromChainId: SupportedChainId;
|
|
22
|
+
toChainId: TargetChainId;
|
|
23
|
+
toTokenAddress: string;
|
|
24
|
+
includeBridges?: SupportedBridge[];
|
|
25
|
+
}): Promise<TokenInfo[]>;
|
|
15
26
|
/**
|
|
16
27
|
* Makes a GET request to Bungee APIs for quote and build tx
|
|
17
28
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
2
|
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
3
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
3
4
|
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, QuoteBridgeRequest } from '../../types';
|
|
4
5
|
import { ChainId, ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
|
|
5
6
|
import { EvmCall, TokenInfo } from '../../../common';
|
|
6
7
|
import { BungeeApi, BungeeApiOptions } from './BungeeApi';
|
|
7
8
|
import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
|
|
8
9
|
import { BungeeBuildTx, BungeeQuote } from './types';
|
|
9
|
-
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
10
10
|
export declare const BUNGEE_HOOK_DAPP_ID = "cow-sdk://bridging/providers/bungee";
|
|
11
11
|
export declare const BUNGEE_SUPPORTED_NETWORKS: ChainInfo[];
|
|
12
12
|
export interface BungeeBridgeProviderOptions {
|
|
@@ -29,7 +29,7 @@ export declare class BungeeBridgeProvider implements BridgeProvider<BungeeQuoteR
|
|
|
29
29
|
getQuote(request: QuoteBridgeRequest): Promise<BungeeQuoteResult>;
|
|
30
30
|
getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise<EvmCall>;
|
|
31
31
|
getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
|
|
32
|
-
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
32
|
+
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, bridgeHookNonce: string, deadline: bigint, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
33
33
|
getBridgingParams(_chainId: ChainId, _provider: JsonRpcProvider, orderId: string, _txHash: string): Promise<BridgingDepositParams | null>;
|
|
34
34
|
decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
|
|
35
35
|
getBridgingId(_orderUid: string, _settlementTx: string, _logIndex: number): Promise<string>;
|
|
@@ -237,4 +237,30 @@ export interface AcrossStatusAPIResponse {
|
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
239
|
export type AcrossStatus = AcrossStatusAPIResponse['status'];
|
|
240
|
+
export type BungeeBuyTokensAPIResponse = {
|
|
241
|
+
success: boolean;
|
|
242
|
+
statusCode: number;
|
|
243
|
+
result: Array<{
|
|
244
|
+
chainId: number;
|
|
245
|
+
address: string;
|
|
246
|
+
decimals: number;
|
|
247
|
+
name?: string;
|
|
248
|
+
symbol?: string;
|
|
249
|
+
logoURI?: string;
|
|
250
|
+
icon?: string;
|
|
251
|
+
}>;
|
|
252
|
+
};
|
|
253
|
+
export type BungeeIntermediateTokensAPIResponse = {
|
|
254
|
+
success: boolean;
|
|
255
|
+
statusCode: number;
|
|
256
|
+
result: Array<{
|
|
257
|
+
chainId: number;
|
|
258
|
+
address: string;
|
|
259
|
+
name: string;
|
|
260
|
+
symbol: string;
|
|
261
|
+
decimals: number;
|
|
262
|
+
logoURI: string;
|
|
263
|
+
icon: string;
|
|
264
|
+
}>;
|
|
265
|
+
};
|
|
240
266
|
export {};
|
package/dist/bridging/types.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ export interface BridgeProvider<Q extends BridgeQuoteResult> {
|
|
|
169
169
|
*
|
|
170
170
|
* This hook will include the pre-authorization (signature) of the owner of the cow-shed account (the trader).
|
|
171
171
|
*/
|
|
172
|
-
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
172
|
+
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, bridgeHookNonce: string, deadline: bigint, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
173
173
|
/**
|
|
174
174
|
* Decode a bridge hook into a bridge deposit information.
|
|
175
175
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DEFAULT_QUOTE_VALIDITY: number;
|
|
@@ -26,7 +26,7 @@ export interface SignAndEncodeTxArgs {
|
|
|
26
26
|
/**
|
|
27
27
|
* Deadline to use for the transaction. If not provided, the maximum uint256 will be used.
|
|
28
28
|
*/
|
|
29
|
-
deadline
|
|
29
|
+
deadline: bigint;
|
|
30
30
|
/**
|
|
31
31
|
* Default gas limit to use for the transaction. If not provided, it will throw an error if the gas limit cannot be estimated.
|
|
32
32
|
*/
|