@cowprotocol/cow-sdk 6.0.0-RC.50 → 6.0.0-RC.53
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 +14 -8
- package/dist/bridging/BridgingSdk/findBridgeProviderFromHook.d.ts +2 -0
- package/dist/bridging/BridgingSdk/getCrossChainOrder.d.ts +12 -8
- package/dist/bridging/const.d.ts +1 -0
- package/dist/bridging/errors.d.ts +4 -0
- package/dist/bridging/index.d.ts +1 -0
- package/dist/bridging/providers/across/AcrossApi.d.ts +2 -1
- package/dist/bridging/providers/across/AcrossBridgeProvider.d.ts +6 -4
- package/dist/bridging/providers/across/const/interfaces.d.ts +3 -0
- package/dist/bridging/providers/across/const/misc.d.ts +2 -1
- package/dist/bridging/providers/across/getDepositParams.d.ts +4 -0
- package/dist/bridging/providers/across/types.d.ts +73 -0
- package/dist/bridging/providers/across/util.d.ts +7 -3
- package/dist/bridging/providers/bungee/BungeeApi.d.ts +52 -0
- package/dist/bridging/providers/bungee/BungeeBridgeProvider.d.ts +40 -0
- package/dist/bridging/providers/bungee/abi.d.ts +192 -0
- package/dist/bridging/providers/bungee/const/contracts.d.ts +3 -0
- package/dist/bridging/providers/bungee/const/misc.d.ts +3 -0
- package/dist/bridging/providers/bungee/const/tokens.d.ts +7 -0
- package/dist/bridging/providers/bungee/createBungeeDepositCall.d.ts +9 -0
- package/dist/bridging/providers/bungee/types.d.ts +240 -0
- package/dist/bridging/providers/bungee/util.d.ts +62 -0
- package/dist/bridging/providers/mock/MockBridgeProvider.d.ts +4 -3
- package/dist/bridging/types.d.ts +37 -11
- package/dist/common/utils/common.d.ts +1 -0
- package/dist/index-85766cc0.js +29 -0
- package/dist/index-85766cc0.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/trading/getOrderToSign.d.ts +1 -1
- package/dist/trading/utils/slippage.d.ts +1 -1
- package/dist/{utils-43fc34c6.js → utils-25eba349.js} +2 -2
- package/dist/{utils-43fc34c6.js.map → utils-25eba349.js.map} +1 -1
- package/dist/{utils-df8fc0f3.js → utils-83e816f8.js} +1 -1
- package/dist/{utils-df8fc0f3.js.map → utils-83e816f8.js.map} +1 -1
- package/dist/{utils-304ec4b3.js → utils-e7d4494e.js} +1 -1
- package/dist/{utils-304ec4b3.js.map → utils-e7d4494e.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-ed0fed56.js +0 -29
- package/dist/index-ed0fed56.js.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SwapAdvancedSettings, TradingSdk } from '../../trading';
|
|
2
|
-
import { BridgeProvider, BridgeQuoteResult, CrossChainOrder, CrossChainQuoteAndPost, QuoteBridgeRequest } from '../types';
|
|
2
|
+
import { BridgeProvider, BridgeQuoteResult, BridgeStatusResult, CrossChainOrder, CrossChainQuoteAndPost, QuoteBridgeRequest } from '../types';
|
|
3
3
|
import { CowEnv, TokenInfo } from '../../common';
|
|
4
4
|
import { ChainInfo, SupportedChainId, TargetChainId } from '../../chains';
|
|
5
|
-
import {
|
|
5
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
6
|
+
import { OrderBookApi } from '../../order-book';
|
|
6
7
|
export interface BridgingSdkOptions {
|
|
7
8
|
/**
|
|
8
9
|
* Providers for the bridging.
|
|
@@ -25,14 +26,18 @@ export interface BridgingSdkOptions {
|
|
|
25
26
|
* Parameters for the `getOrder` method.
|
|
26
27
|
*/
|
|
27
28
|
export interface GetOrderParams {
|
|
29
|
+
/**
|
|
30
|
+
* Id of a network where order was settled
|
|
31
|
+
*/
|
|
32
|
+
chainId: SupportedChainId;
|
|
28
33
|
/**
|
|
29
34
|
* The unique identifier of the order.
|
|
30
35
|
*/
|
|
31
36
|
orderId: string;
|
|
32
37
|
/**
|
|
33
|
-
*
|
|
38
|
+
* RPC provider to get order transactions details
|
|
34
39
|
*/
|
|
35
|
-
|
|
40
|
+
rpcProvider: JsonRpcProvider;
|
|
36
41
|
/**
|
|
37
42
|
* The environment of the order
|
|
38
43
|
*/
|
|
@@ -61,9 +66,8 @@ export declare class BridgingSdk {
|
|
|
61
66
|
getTargetNetworks(): Promise<ChainInfo[]>;
|
|
62
67
|
/**
|
|
63
68
|
* Get the available buy tokens for buying in a specific target chain
|
|
64
|
-
|
|
65
|
-
* @param
|
|
66
|
-
* @returns
|
|
69
|
+
|
|
70
|
+
* @param targetChainId
|
|
67
71
|
*/
|
|
68
72
|
getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
|
|
69
73
|
/**
|
|
@@ -82,5 +86,7 @@ export declare class BridgingSdk {
|
|
|
82
86
|
* @throws Error if no path is found
|
|
83
87
|
*/
|
|
84
88
|
getQuote(quoteBridgeRequest: QuoteBridgeRequest, advancedSettings?: SwapAdvancedSettings): Promise<CrossChainQuoteAndPost>;
|
|
85
|
-
getOrder(params: GetOrderParams): Promise<CrossChainOrder>;
|
|
89
|
+
getOrder(params: GetOrderParams): Promise<CrossChainOrder | null>;
|
|
90
|
+
getOrderBridgingStatus(bridgingId: string, originChainId: SupportedChainId): Promise<BridgeStatusResult>;
|
|
91
|
+
getProviderFromAppData(fullAppData: string): BridgeProvider<BridgeQuoteResult> | undefined;
|
|
86
92
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { BridgeProvider, BridgeQuoteResult, CrossChainOrder } from '../types';
|
|
2
|
-
import { SupportedChainId } from '../../chains';
|
|
3
|
-
import { OrderBookApi } from 'src/order-book';
|
|
4
2
|
import { CowEnv } from '../../common';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
orderId: string;
|
|
3
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
4
|
+
import { SupportedChainId } from '../../chains';
|
|
5
|
+
import { OrderBookApi } from '../../order-book';
|
|
6
|
+
interface GetCrossChainOrderParams {
|
|
10
7
|
chainId: SupportedChainId;
|
|
8
|
+
orderId: string;
|
|
9
|
+
rpcProvider: JsonRpcProvider;
|
|
11
10
|
orderBookApi: OrderBookApi;
|
|
12
11
|
providers: BridgeProvider<BridgeQuoteResult>[];
|
|
13
12
|
env: CowEnv;
|
|
14
|
-
}
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Fetch a cross-chain order and its status.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getCrossChainOrder(params: GetCrossChainOrderParams): Promise<CrossChainOrder | null>;
|
|
18
|
+
export {};
|
package/dist/bridging/const.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
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 = 200000;
|
|
3
|
+
export declare const HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
|
|
@@ -2,3 +2,7 @@ export declare class BridgeProviderQuoteError extends Error {
|
|
|
2
2
|
readonly context: unknown;
|
|
3
3
|
constructor(message: string, context: unknown);
|
|
4
4
|
}
|
|
5
|
+
export declare class BridgeOrderParsingError extends Error {
|
|
6
|
+
readonly context?: unknown | undefined;
|
|
7
|
+
constructor(message: string, context?: unknown | undefined);
|
|
8
|
+
}
|
package/dist/bridging/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export * from './errors';
|
|
|
3
3
|
export * from './utils';
|
|
4
4
|
export * from './BridgingSdk/BridgingSdk';
|
|
5
5
|
export { AcrossBridgeProvider, AcrossQuoteResult, AcrossBridgeProviderOptions, } from './providers/across/AcrossBridgeProvider';
|
|
6
|
+
export { BungeeBridgeProvider, BungeeQuoteResult, BungeeBridgeProviderOptions, } from './providers/bungee/BungeeBridgeProvider';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AvailableRoutesRequest, Route, SuggestedFeesRequest, SuggestedFeesResponse } from './types';
|
|
1
|
+
import { AvailableRoutesRequest, DepositStatusRequest, DepositStatusResponse, Route, SuggestedFeesRequest, SuggestedFeesResponse } from './types';
|
|
2
2
|
import { TokenInfo } from '../../../common';
|
|
3
3
|
export interface AcrossApiOptions {
|
|
4
4
|
apiBaseUrl?: string;
|
|
@@ -25,5 +25,6 @@ export declare class AcrossApi {
|
|
|
25
25
|
*/
|
|
26
26
|
getSuggestedFees(request: SuggestedFeesRequest): Promise<SuggestedFeesResponse>;
|
|
27
27
|
getSupportedTokens(): Promise<TokenInfo[]>;
|
|
28
|
+
getDepositStatus(request: DepositStatusRequest): Promise<DepositStatusResponse>;
|
|
28
29
|
protected fetchApi<T>(path: string, params: Record<string, string>, isValidResponse?: (response: unknown) => response is T): Promise<T>;
|
|
29
30
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
2
|
import { latest as latestAppData } from '@cowprotocol/app-data';
|
|
3
|
-
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, QuoteBridgeRequest } from '../../types';
|
|
4
|
-
import { ChainInfo, SupportedChainId, TargetChainId } from '../../../chains';
|
|
3
|
+
import { BridgeDeposit, BridgeHook, BridgeProvider, BridgeProviderInfo, BridgeQuoteResult, BridgeStatusResult, BridgingDepositParams, QuoteBridgeRequest } from '../../types';
|
|
4
|
+
import { ChainId, 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
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
10
|
+
export declare const ACROSS_HOOK_DAPP_ID = "cow-sdk://bridging/providers/across";
|
|
9
11
|
export declare const ACROSS_SUPPORTED_NETWORKS: ChainInfo[];
|
|
10
12
|
export interface AcrossBridgeProviderOptions {
|
|
11
13
|
apiOptions?: AcrossApiOptions;
|
|
@@ -28,9 +30,9 @@ export declare class AcrossBridgeProvider implements BridgeProvider<AcrossQuoteR
|
|
|
28
30
|
getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
|
|
29
31
|
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
30
32
|
decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
|
|
31
|
-
|
|
33
|
+
getBridgingParams(chainId: ChainId, provider: JsonRpcProvider, orderUid: string, txHash: string): Promise<BridgingDepositParams | null>;
|
|
32
34
|
getExplorerUrl(bridgingId: string): string;
|
|
33
|
-
getStatus(
|
|
35
|
+
getStatus(bridgingId: string, originChainId: SupportedChainId): Promise<BridgeStatusResult>;
|
|
34
36
|
getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
35
37
|
getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
36
38
|
private getSupportedTokensState;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const ACROSS_DEPOSIT_EVENT_TOPIC: string;
|
|
2
|
+
export declare const COW_TRADE_EVENT_TOPIC: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TransactionReceipt } from '@ethersproject/abstract-provider';
|
|
2
|
+
import { SupportedChainId } from '../../../chains';
|
|
3
|
+
import { BridgingDepositParams } from '../../types';
|
|
4
|
+
export declare function getDepositParams(chainId: SupportedChainId, orderId: string, txReceipt: TransactionReceipt): Promise<BridgingDepositParams | null>;
|
|
@@ -167,3 +167,76 @@ export interface PctFee {
|
|
|
167
167
|
pct: string;
|
|
168
168
|
total: string;
|
|
169
169
|
}
|
|
170
|
+
export interface DepositStatusRequest {
|
|
171
|
+
originChainId: string;
|
|
172
|
+
depositId: string;
|
|
173
|
+
}
|
|
174
|
+
export interface DepositStatusResponse {
|
|
175
|
+
/**
|
|
176
|
+
* Status of the deposit:
|
|
177
|
+
* - filled: Deposit has been filled on destination chain (FilledV3Relay event emitted)
|
|
178
|
+
* - pending: Deposit not yet filled
|
|
179
|
+
* - expired: Deposit expired and will be refunded
|
|
180
|
+
* - refunded: Deposit expired and depositor refunded on originChain
|
|
181
|
+
* - slowFillRequested: Across' relayer fills without requiring another relayer to front capital
|
|
182
|
+
* (requires input token and output token to be the same asset)
|
|
183
|
+
*/
|
|
184
|
+
status: 'filled' | 'pending' | 'expired' | 'refunded' | 'slowFillRequested';
|
|
185
|
+
/**
|
|
186
|
+
* Origin chain ID where the deposit was made.
|
|
187
|
+
*/
|
|
188
|
+
originChainId: string;
|
|
189
|
+
/**
|
|
190
|
+
* Unique identifier of the deposit.
|
|
191
|
+
*/
|
|
192
|
+
depositId: string;
|
|
193
|
+
/**
|
|
194
|
+
* Transaction hash of the deposit on the origin chain.
|
|
195
|
+
*/
|
|
196
|
+
depositTxHash?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Transaction hash of the fill on the destination chain.
|
|
199
|
+
* Only present when fillStatus is 'filled'.
|
|
200
|
+
*/
|
|
201
|
+
fillTx?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Destination chain ID where the fill transaction will occur.
|
|
204
|
+
*/
|
|
205
|
+
destinationChainId?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Transaction hash of the refund on the origin chain.
|
|
208
|
+
* Only present when fillStatus is 'refunded'.
|
|
209
|
+
*/
|
|
210
|
+
depositRefundTxHash?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Pagination information for the response.
|
|
213
|
+
*/
|
|
214
|
+
pagination?: {
|
|
215
|
+
currentIndex: number;
|
|
216
|
+
maxIndex: number;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
export interface AcrossDepositEvent {
|
|
220
|
+
inputToken: string;
|
|
221
|
+
outputToken: string;
|
|
222
|
+
inputAmount: string;
|
|
223
|
+
outputAmount: string;
|
|
224
|
+
destinationChainId: string;
|
|
225
|
+
depositId: string;
|
|
226
|
+
quoteTimestamp: string;
|
|
227
|
+
fillDeadline: string;
|
|
228
|
+
exclusivityDeadline: string;
|
|
229
|
+
depositor: string;
|
|
230
|
+
recipient: string;
|
|
231
|
+
exclusiveRelayer: string;
|
|
232
|
+
message: string;
|
|
233
|
+
}
|
|
234
|
+
export interface CowTradeEvent {
|
|
235
|
+
owner: string;
|
|
236
|
+
sellToken: string;
|
|
237
|
+
buyToken: string;
|
|
238
|
+
sellAmount: string;
|
|
239
|
+
buyAmount: string;
|
|
240
|
+
feeAmount: string;
|
|
241
|
+
orderUid: string;
|
|
242
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Log } from '@ethersproject/providers';
|
|
2
|
+
import { BridgeStatus, QuoteBridgeRequest } from '../../types';
|
|
3
|
+
import { SupportedChainId, TargetChainId } from '../../../chains';
|
|
4
|
+
import { AcrossDepositEvent, CowTradeEvent, DepositStatusResponse, SuggestedFeesResponse } from './types';
|
|
3
5
|
import { AcrossQuoteResult } from './AcrossBridgeProvider';
|
|
4
6
|
import { AcrossChainConfig } from './const/tokens';
|
|
5
|
-
import { SuggestedFeesResponse } from './types';
|
|
6
7
|
/**
|
|
7
8
|
* Return the chain configs
|
|
8
9
|
*
|
|
@@ -37,3 +38,6 @@ export declare function pctToBps(pct: bigint): number;
|
|
|
37
38
|
*/
|
|
38
39
|
export declare function applyPctFee(amount: bigint, pct: bigint): bigint;
|
|
39
40
|
export declare function applyBps(amount: bigint, bps: number): bigint;
|
|
41
|
+
export declare function mapAcrossStatusToBridgeStatus(status: DepositStatusResponse['status']): BridgeStatus;
|
|
42
|
+
export declare function getAcrossDepositEvents(chainId: SupportedChainId, logs: Log[]): AcrossDepositEvent[];
|
|
43
|
+
export declare function getCowTradeEvents(chainId: SupportedChainId, logs: Log[]): CowTradeEvent[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AcrossStatus, BungeeBuildTx, BungeeEvent, BungeeQuote, BungeeQuoteAPIRequest, BungeeQuoteWithBuildTx, SocketRequest, SupportedBridge } from './types';
|
|
2
|
+
import { SignerLike } from '../../../common';
|
|
3
|
+
import { SupportedChainId } from '../../../chains';
|
|
4
|
+
export interface BungeeApiOptions {
|
|
5
|
+
apiBaseUrl?: string;
|
|
6
|
+
eventsApiBaseUrl?: string;
|
|
7
|
+
acrossApiBaseUrl?: string;
|
|
8
|
+
includeBridges?: SupportedBridge[];
|
|
9
|
+
}
|
|
10
|
+
export declare class BungeeApi {
|
|
11
|
+
private readonly options;
|
|
12
|
+
readonly SUPPORTED_BRIDGES: SupportedBridge[];
|
|
13
|
+
constructor(options?: BungeeApiOptions);
|
|
14
|
+
validateBridges(includeBridges: SupportedBridge[]): void;
|
|
15
|
+
/**
|
|
16
|
+
* Makes a GET request to Bungee APIs for quote and build tx
|
|
17
|
+
*/
|
|
18
|
+
getBungeeQuoteWithBuildTx(params: BungeeQuoteAPIRequest): Promise<BungeeQuoteWithBuildTx>;
|
|
19
|
+
/**
|
|
20
|
+
* Makes a GET request to Bungee APIs for quote
|
|
21
|
+
* https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-quote-v-1
|
|
22
|
+
*/
|
|
23
|
+
getBungeeQuote(params: BungeeQuoteAPIRequest): Promise<BungeeQuote>;
|
|
24
|
+
/**
|
|
25
|
+
* Makes a GET request to Bungee APIs for build tx
|
|
26
|
+
* https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-build-tx-v-1
|
|
27
|
+
*/
|
|
28
|
+
getBungeeBuildTx(quote: BungeeQuote): Promise<BungeeBuildTx>;
|
|
29
|
+
/**
|
|
30
|
+
* Verifies the build tx data for a quote using the SocketVerifier contract
|
|
31
|
+
* @param quote - The quote object
|
|
32
|
+
* @param buildTx - The build tx object
|
|
33
|
+
* @param signer - The signer object
|
|
34
|
+
* @returns True if the build tx data is valid, false otherwise
|
|
35
|
+
*/
|
|
36
|
+
verifyBungeeBuildTx(quote: BungeeQuote, buildTx: BungeeBuildTx, signer: SignerLike): Promise<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Verifies the bungee tx data using the SocketVerifier contract
|
|
39
|
+
* @param originChainId - The origin chain id
|
|
40
|
+
* @param txData - The tx data
|
|
41
|
+
* @param routeId - The route id
|
|
42
|
+
* @param expectedSocketRequest - The expected socket request
|
|
43
|
+
* @param signer - The signer object
|
|
44
|
+
* @returns True if the bungee tx data is valid, false otherwise
|
|
45
|
+
*/
|
|
46
|
+
verifyBungeeBuildTxData(originChainId: SupportedChainId, txData: string, routeId: string, expectedSocketRequest: SocketRequest, signer: SignerLike): Promise<boolean>;
|
|
47
|
+
getEvents(params: {
|
|
48
|
+
orderId: string;
|
|
49
|
+
}): Promise<BungeeEvent[]>;
|
|
50
|
+
getAcrossStatus(depositTxHash: string): Promise<AcrossStatus>;
|
|
51
|
+
private makeApiCall;
|
|
52
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Signer } from 'ethers';
|
|
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';
|
|
5
|
+
import { EvmCall, TokenInfo } from '../../../common';
|
|
6
|
+
import { BungeeApi, BungeeApiOptions } from './BungeeApi';
|
|
7
|
+
import { CowShedSdk, CowShedSdkOptions } from '../../../cow-shed';
|
|
8
|
+
import { BungeeBuildTx, BungeeQuote } from './types';
|
|
9
|
+
import { JsonRpcProvider } from '@ethersproject/providers';
|
|
10
|
+
export declare const BUNGEE_HOOK_DAPP_ID = "cow-sdk://bridging/providers/bungee";
|
|
11
|
+
export declare const BUNGEE_SUPPORTED_NETWORKS: ChainInfo[];
|
|
12
|
+
export interface BungeeBridgeProviderOptions {
|
|
13
|
+
apiOptions?: BungeeApiOptions;
|
|
14
|
+
cowShedOptions?: CowShedSdkOptions;
|
|
15
|
+
}
|
|
16
|
+
export interface BungeeQuoteResult extends BridgeQuoteResult {
|
|
17
|
+
bungeeQuote: BungeeQuote;
|
|
18
|
+
buildTx: BungeeBuildTx;
|
|
19
|
+
}
|
|
20
|
+
export declare class BungeeBridgeProvider implements BridgeProvider<BungeeQuoteResult> {
|
|
21
|
+
private options;
|
|
22
|
+
protected api: BungeeApi;
|
|
23
|
+
protected cowShedSdk: CowShedSdk;
|
|
24
|
+
constructor(options?: BungeeBridgeProviderOptions);
|
|
25
|
+
info: BridgeProviderInfo;
|
|
26
|
+
getNetworks(): Promise<ChainInfo[]>;
|
|
27
|
+
getBuyTokens(targetChainId: TargetChainId): Promise<TokenInfo[]>;
|
|
28
|
+
getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
|
|
29
|
+
getQuote(request: QuoteBridgeRequest): Promise<BungeeQuoteResult>;
|
|
30
|
+
getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise<EvmCall>;
|
|
31
|
+
getGasLimitEstimationForHook(_request: QuoteBridgeRequest): number;
|
|
32
|
+
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, signer: Signer, defaultGasLimit?: bigint): Promise<BridgeHook>;
|
|
33
|
+
getBridgingParams(_chainId: ChainId, _provider: JsonRpcProvider, _orderUid: string, _txHash: string): Promise<BridgingDepositParams | null>;
|
|
34
|
+
decodeBridgeHook(_hook: latestAppData.CoWHook): Promise<BridgeDeposit>;
|
|
35
|
+
getBridgingId(_orderUid: string, _settlementTx: string, _logIndex: number): Promise<string>;
|
|
36
|
+
getExplorerUrl(bridgingId: string): string;
|
|
37
|
+
getStatus(_bridgingId: string): Promise<BridgeStatusResult>;
|
|
38
|
+
getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
39
|
+
getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
|
|
40
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export declare const ERC20_ABI: string[];
|
|
2
|
+
export declare const SOCKET_VERIFIER_ABI: ({
|
|
3
|
+
type: string;
|
|
4
|
+
inputs: {
|
|
5
|
+
name: string;
|
|
6
|
+
type: string;
|
|
7
|
+
internalType: string;
|
|
8
|
+
}[];
|
|
9
|
+
stateMutability: string;
|
|
10
|
+
name?: undefined;
|
|
11
|
+
outputs?: undefined;
|
|
12
|
+
anonymous?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
type: string;
|
|
15
|
+
name: string;
|
|
16
|
+
inputs: {
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
internalType: string;
|
|
20
|
+
}[];
|
|
21
|
+
outputs: {
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
internalType: string;
|
|
25
|
+
components: {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
internalType: string;
|
|
29
|
+
}[];
|
|
30
|
+
}[];
|
|
31
|
+
stateMutability: string;
|
|
32
|
+
anonymous?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
type: string;
|
|
35
|
+
name: string;
|
|
36
|
+
inputs: {
|
|
37
|
+
name: string;
|
|
38
|
+
type: string;
|
|
39
|
+
internalType: string;
|
|
40
|
+
}[];
|
|
41
|
+
outputs: {
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
internalType: string;
|
|
45
|
+
}[];
|
|
46
|
+
stateMutability: string;
|
|
47
|
+
anonymous?: undefined;
|
|
48
|
+
} | {
|
|
49
|
+
type: string;
|
|
50
|
+
name: string;
|
|
51
|
+
inputs: ({
|
|
52
|
+
name: string;
|
|
53
|
+
type: string;
|
|
54
|
+
internalType: string;
|
|
55
|
+
components?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
internalType: string;
|
|
60
|
+
components: ({
|
|
61
|
+
name: string;
|
|
62
|
+
type: string;
|
|
63
|
+
internalType: string;
|
|
64
|
+
components?: undefined;
|
|
65
|
+
} | {
|
|
66
|
+
name: string;
|
|
67
|
+
type: string;
|
|
68
|
+
internalType: string;
|
|
69
|
+
components: {
|
|
70
|
+
name: string;
|
|
71
|
+
type: string;
|
|
72
|
+
internalType: string;
|
|
73
|
+
}[];
|
|
74
|
+
})[];
|
|
75
|
+
})[];
|
|
76
|
+
outputs: never[];
|
|
77
|
+
stateMutability: string;
|
|
78
|
+
anonymous?: undefined;
|
|
79
|
+
} | {
|
|
80
|
+
type: string;
|
|
81
|
+
name: string;
|
|
82
|
+
inputs: {
|
|
83
|
+
name: string;
|
|
84
|
+
type: string;
|
|
85
|
+
indexed: boolean;
|
|
86
|
+
internalType: string;
|
|
87
|
+
}[];
|
|
88
|
+
anonymous: boolean;
|
|
89
|
+
stateMutability?: undefined;
|
|
90
|
+
outputs?: undefined;
|
|
91
|
+
} | {
|
|
92
|
+
type: string;
|
|
93
|
+
name: string;
|
|
94
|
+
inputs: never[];
|
|
95
|
+
stateMutability?: undefined;
|
|
96
|
+
outputs?: undefined;
|
|
97
|
+
anonymous?: undefined;
|
|
98
|
+
})[];
|
|
99
|
+
export declare const BUNGEE_COWSWAP_LIB_ABI: ({
|
|
100
|
+
inputs: never[];
|
|
101
|
+
name: string;
|
|
102
|
+
type: string;
|
|
103
|
+
outputs?: undefined;
|
|
104
|
+
stateMutability?: undefined;
|
|
105
|
+
} | {
|
|
106
|
+
inputs: {
|
|
107
|
+
internalType: string;
|
|
108
|
+
name: string;
|
|
109
|
+
type: string;
|
|
110
|
+
}[];
|
|
111
|
+
name: string;
|
|
112
|
+
outputs: {
|
|
113
|
+
internalType: string;
|
|
114
|
+
name: string;
|
|
115
|
+
type: string;
|
|
116
|
+
}[];
|
|
117
|
+
stateMutability: string;
|
|
118
|
+
type: string;
|
|
119
|
+
})[];
|
|
120
|
+
export declare const SOCKET_GATEWAY_ABI: ({
|
|
121
|
+
inputs: {
|
|
122
|
+
internalType: string;
|
|
123
|
+
name: string;
|
|
124
|
+
type: string;
|
|
125
|
+
}[];
|
|
126
|
+
stateMutability: string;
|
|
127
|
+
type: string;
|
|
128
|
+
name?: undefined;
|
|
129
|
+
anonymous?: undefined;
|
|
130
|
+
outputs?: undefined;
|
|
131
|
+
} | {
|
|
132
|
+
inputs: never[];
|
|
133
|
+
name: string;
|
|
134
|
+
type: string;
|
|
135
|
+
stateMutability?: undefined;
|
|
136
|
+
anonymous?: undefined;
|
|
137
|
+
outputs?: undefined;
|
|
138
|
+
} | {
|
|
139
|
+
anonymous: boolean;
|
|
140
|
+
inputs: {
|
|
141
|
+
indexed: boolean;
|
|
142
|
+
internalType: string;
|
|
143
|
+
name: string;
|
|
144
|
+
type: string;
|
|
145
|
+
}[];
|
|
146
|
+
name: string;
|
|
147
|
+
type: string;
|
|
148
|
+
stateMutability?: undefined;
|
|
149
|
+
outputs?: undefined;
|
|
150
|
+
} | {
|
|
151
|
+
stateMutability: string;
|
|
152
|
+
type: string;
|
|
153
|
+
inputs?: undefined;
|
|
154
|
+
name?: undefined;
|
|
155
|
+
anonymous?: undefined;
|
|
156
|
+
outputs?: undefined;
|
|
157
|
+
} | {
|
|
158
|
+
inputs: {
|
|
159
|
+
internalType: string;
|
|
160
|
+
name: string;
|
|
161
|
+
type: string;
|
|
162
|
+
}[];
|
|
163
|
+
name: string;
|
|
164
|
+
outputs: {
|
|
165
|
+
internalType: string;
|
|
166
|
+
name: string;
|
|
167
|
+
type: string;
|
|
168
|
+
}[];
|
|
169
|
+
stateMutability: string;
|
|
170
|
+
type: string;
|
|
171
|
+
anonymous?: undefined;
|
|
172
|
+
} | {
|
|
173
|
+
inputs: {
|
|
174
|
+
components: {
|
|
175
|
+
internalType: string;
|
|
176
|
+
name: string;
|
|
177
|
+
type: string;
|
|
178
|
+
}[];
|
|
179
|
+
internalType: string;
|
|
180
|
+
name: string;
|
|
181
|
+
type: string;
|
|
182
|
+
}[];
|
|
183
|
+
name: string;
|
|
184
|
+
outputs: {
|
|
185
|
+
internalType: string;
|
|
186
|
+
name: string;
|
|
187
|
+
type: string;
|
|
188
|
+
}[];
|
|
189
|
+
stateMutability: string;
|
|
190
|
+
type: string;
|
|
191
|
+
anonymous?: undefined;
|
|
192
|
+
})[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ChainId } from '../../../../chains/types';
|
|
2
|
+
import { TokenInfo } from '../../../../common';
|
|
3
|
+
/**
|
|
4
|
+
* Chain config for Bungee. Includes all the supported tokens for the chain.
|
|
5
|
+
*/
|
|
6
|
+
export type BungeeChainConfig = Record<ChainId, Record<string, TokenInfo | undefined>>;
|
|
7
|
+
export declare const BUNGEE_CHAIN_TOKENS: BungeeChainConfig;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EvmCall } from '../../../common';
|
|
2
|
+
import { CowShedSdk } from '../../../cow-shed';
|
|
3
|
+
import { BungeeQuoteResult } from './BungeeBridgeProvider';
|
|
4
|
+
import { QuoteBridgeRequest } from '../../types';
|
|
5
|
+
export declare function createBungeeDepositCall(params: {
|
|
6
|
+
request: QuoteBridgeRequest;
|
|
7
|
+
quote: BungeeQuoteResult;
|
|
8
|
+
cowShedSdk: CowShedSdk;
|
|
9
|
+
}): Promise<EvmCall>;
|