@cowprotocol/sdk-bridging 3.0.0 → 3.1.0
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/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +92 -92
- package/dist/index.mjs +49 -49
- package/package.json +34 -28
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cowAppDataLatestScheme } from '@cowprotocol/sdk-app-data';
|
|
2
2
|
import { Amounts, OrderKind, Address, EnrichedOrder, OrderBookApi } from '@cowprotocol/sdk-order-book';
|
|
3
|
-
import { ChainInfo, TargetChainId, SupportedChainId, TokenInfo, ChainId, EvmCall, CowEnv } from '@cowprotocol/sdk-config';
|
|
3
|
+
import { ChainInfo, TargetChainId, SupportedChainId, TokenInfo, ChainId, AddressPerChain, EvmCall, CowEnv } from '@cowprotocol/sdk-config';
|
|
4
4
|
import { QuoterParameters, TraderParameters, TradeOptionalParameters, QuoteAndPost, QuoteResults, SwapAdvancedSettings, SigningStepManager, OrderPostingResult, TradingSdk } from '@cowprotocol/sdk-trading';
|
|
5
5
|
import { AccountAddress, SignerLike, TTLCache, AbstractProviderAdapter } from '@cowprotocol/sdk-common';
|
|
6
6
|
import { CowShedSdk, CowShedSdkOptions } from '@cowprotocol/sdk-cow-shed';
|
|
@@ -182,8 +182,9 @@ interface BridgeProvider<Q extends BridgeQuoteResult> {
|
|
|
182
182
|
* @param chainId
|
|
183
183
|
* @param order - CoW Protocol order
|
|
184
184
|
* @param txHash - The hash of the settlement transaction in which the bridging post-hook was executed
|
|
185
|
+
* @param settlementContractOverride - Custom settlement contract address
|
|
185
186
|
*/
|
|
186
|
-
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
|
|
187
|
+
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string, settlementContractOverride?: Partial<AddressPerChain>): Promise<{
|
|
187
188
|
params: BridgingDepositParams;
|
|
188
189
|
status: BridgeStatusResult;
|
|
189
190
|
} | null>;
|
|
@@ -537,6 +538,10 @@ interface GetOrderParams {
|
|
|
537
538
|
* The environment of the order
|
|
538
539
|
*/
|
|
539
540
|
env?: CowEnv;
|
|
541
|
+
/**
|
|
542
|
+
* Custom settlement contract address
|
|
543
|
+
*/
|
|
544
|
+
settlementContractOverride?: Partial<AddressPerChain>;
|
|
540
545
|
}
|
|
541
546
|
|
|
542
547
|
/**
|
|
@@ -655,6 +660,7 @@ interface GetCrossChainOrderParams {
|
|
|
655
660
|
orderBookApi: OrderBookApi;
|
|
656
661
|
providers: BridgeProvider<BridgeQuoteResult>[];
|
|
657
662
|
env: CowEnv;
|
|
663
|
+
settlementContractOverride?: Partial<AddressPerChain>;
|
|
658
664
|
}
|
|
659
665
|
/**
|
|
660
666
|
* Fetch a cross-chain order and its status.
|
|
@@ -930,7 +936,7 @@ declare class AcrossBridgeProvider implements HookBridgeProvider<AcrossQuoteResu
|
|
|
930
936
|
getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise<number>;
|
|
931
937
|
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise<BridgeHook>;
|
|
932
938
|
decodeBridgeHook(_hook: cowAppDataLatestScheme.CoWHook): Promise<BridgeDeposit>;
|
|
933
|
-
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
|
|
939
|
+
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string, settlementContractOverride?: Partial<AddressPerChain>): Promise<{
|
|
934
940
|
params: BridgingDepositParams;
|
|
935
941
|
status: BridgeStatusResult;
|
|
936
942
|
} | null>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cowAppDataLatestScheme } from '@cowprotocol/sdk-app-data';
|
|
2
2
|
import { Amounts, OrderKind, Address, EnrichedOrder, OrderBookApi } from '@cowprotocol/sdk-order-book';
|
|
3
|
-
import { ChainInfo, TargetChainId, SupportedChainId, TokenInfo, ChainId, EvmCall, CowEnv } from '@cowprotocol/sdk-config';
|
|
3
|
+
import { ChainInfo, TargetChainId, SupportedChainId, TokenInfo, ChainId, AddressPerChain, EvmCall, CowEnv } from '@cowprotocol/sdk-config';
|
|
4
4
|
import { QuoterParameters, TraderParameters, TradeOptionalParameters, QuoteAndPost, QuoteResults, SwapAdvancedSettings, SigningStepManager, OrderPostingResult, TradingSdk } from '@cowprotocol/sdk-trading';
|
|
5
5
|
import { AccountAddress, SignerLike, TTLCache, AbstractProviderAdapter } from '@cowprotocol/sdk-common';
|
|
6
6
|
import { CowShedSdk, CowShedSdkOptions } from '@cowprotocol/sdk-cow-shed';
|
|
@@ -182,8 +182,9 @@ interface BridgeProvider<Q extends BridgeQuoteResult> {
|
|
|
182
182
|
* @param chainId
|
|
183
183
|
* @param order - CoW Protocol order
|
|
184
184
|
* @param txHash - The hash of the settlement transaction in which the bridging post-hook was executed
|
|
185
|
+
* @param settlementContractOverride - Custom settlement contract address
|
|
185
186
|
*/
|
|
186
|
-
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
|
|
187
|
+
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string, settlementContractOverride?: Partial<AddressPerChain>): Promise<{
|
|
187
188
|
params: BridgingDepositParams;
|
|
188
189
|
status: BridgeStatusResult;
|
|
189
190
|
} | null>;
|
|
@@ -537,6 +538,10 @@ interface GetOrderParams {
|
|
|
537
538
|
* The environment of the order
|
|
538
539
|
*/
|
|
539
540
|
env?: CowEnv;
|
|
541
|
+
/**
|
|
542
|
+
* Custom settlement contract address
|
|
543
|
+
*/
|
|
544
|
+
settlementContractOverride?: Partial<AddressPerChain>;
|
|
540
545
|
}
|
|
541
546
|
|
|
542
547
|
/**
|
|
@@ -655,6 +660,7 @@ interface GetCrossChainOrderParams {
|
|
|
655
660
|
orderBookApi: OrderBookApi;
|
|
656
661
|
providers: BridgeProvider<BridgeQuoteResult>[];
|
|
657
662
|
env: CowEnv;
|
|
663
|
+
settlementContractOverride?: Partial<AddressPerChain>;
|
|
658
664
|
}
|
|
659
665
|
/**
|
|
660
666
|
* Fetch a cross-chain order and its status.
|
|
@@ -930,7 +936,7 @@ declare class AcrossBridgeProvider implements HookBridgeProvider<AcrossQuoteResu
|
|
|
930
936
|
getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise<number>;
|
|
931
937
|
getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise<BridgeHook>;
|
|
932
938
|
decodeBridgeHook(_hook: cowAppDataLatestScheme.CoWHook): Promise<BridgeDeposit>;
|
|
933
|
-
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
|
|
939
|
+
getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string, settlementContractOverride?: Partial<AddressPerChain>): Promise<{
|
|
934
940
|
params: BridgingDepositParams;
|
|
935
941
|
status: BridgeStatusResult;
|
|
936
942
|
} | null>;
|
package/dist/index.js
CHANGED
|
@@ -186,7 +186,7 @@ function findBridgeProviderFromHook(fullAppData, providers) {
|
|
|
186
186
|
|
|
187
187
|
// src/BridgingSdk/getCrossChainOrder.ts
|
|
188
188
|
async function getCrossChainOrder(params) {
|
|
189
|
-
const { chainId, orderId, orderBookApi, providers, env } = params;
|
|
189
|
+
const { chainId, orderId, orderBookApi, providers, env, settlementContractOverride } = params;
|
|
190
190
|
const chainContext = { chainId, env };
|
|
191
191
|
const order = await orderBookApi.getOrder(orderId, chainContext);
|
|
192
192
|
const provider = order.fullAppData && findBridgeProviderFromHook(order.fullAppData, providers);
|
|
@@ -204,7 +204,7 @@ async function getCrossChainOrder(params) {
|
|
|
204
204
|
`No tx hash found for order ${orderId} . First trade, with log index ${firstTrade?.logIndex}`
|
|
205
205
|
);
|
|
206
206
|
}
|
|
207
|
-
const { params: bridgingParams, status: statusResult } = await provider.getBridgingParams(chainId, order, tradeTxHash) || {};
|
|
207
|
+
const { params: bridgingParams, status: statusResult } = await provider.getBridgingParams(chainId, order, tradeTxHash, settlementContractOverride) || {};
|
|
208
208
|
if (!bridgingParams || !statusResult) {
|
|
209
209
|
throw new BridgeOrderParsingError(`Bridging params cannot be derived from transaction: ${tradeTxHash}`);
|
|
210
210
|
}
|
|
@@ -1205,7 +1205,7 @@ var BridgingSdk = class {
|
|
|
1205
1205
|
if (options.enableLogging !== void 0) {
|
|
1206
1206
|
(0, import_sdk_common6.enableLogging)(options.enableLogging);
|
|
1207
1207
|
}
|
|
1208
|
-
const tradingSdk = options.tradingSdk ?? new import_sdk_trading2.TradingSdk();
|
|
1208
|
+
const tradingSdk = options.tradingSdk ?? new import_sdk_trading2.TradingSdk({}, { enableLogging: options.enableLogging });
|
|
1209
1209
|
const orderBookApi = tradingSdk?.options.orderBookApi ?? new import_sdk_order_book3.OrderBookApi();
|
|
1210
1210
|
this.config = {
|
|
1211
1211
|
...restOptions,
|
|
@@ -1373,13 +1373,14 @@ var BridgingSdk = class {
|
|
|
1373
1373
|
}
|
|
1374
1374
|
async getOrder(params) {
|
|
1375
1375
|
const { orderBookApi } = this.config;
|
|
1376
|
-
const { chainId, orderId, env = orderBookApi.context.env } = params;
|
|
1376
|
+
const { chainId, orderId, env = orderBookApi.context.env, settlementContractOverride } = params;
|
|
1377
1377
|
return getCrossChainOrder({
|
|
1378
1378
|
chainId,
|
|
1379
1379
|
orderId,
|
|
1380
1380
|
orderBookApi,
|
|
1381
1381
|
env,
|
|
1382
|
-
providers: this.getAvailableProviders()
|
|
1382
|
+
providers: this.getAvailableProviders(),
|
|
1383
|
+
settlementContractOverride
|
|
1383
1384
|
});
|
|
1384
1385
|
}
|
|
1385
1386
|
getProviderFromAppData(fullAppData) {
|
|
@@ -1603,7 +1604,6 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
|
|
|
1603
1604
|
};
|
|
1604
1605
|
|
|
1605
1606
|
// src/providers/across/util.ts
|
|
1606
|
-
var import_sdk_config5 = require("@cowprotocol/sdk-config");
|
|
1607
1607
|
var import_sdk_order_book4 = require("@cowprotocol/sdk-order-book");
|
|
1608
1608
|
var import_sdk_common9 = require("@cowprotocol/sdk-common");
|
|
1609
1609
|
var import_json_stable_stringify = __toESM(require("json-stable-stringify"));
|
|
@@ -1738,10 +1738,10 @@ function getAcrossDepositEvents(chainId, logs) {
|
|
|
1738
1738
|
};
|
|
1739
1739
|
});
|
|
1740
1740
|
}
|
|
1741
|
-
function getCowTradeEvents(chainId, logs) {
|
|
1741
|
+
function getCowTradeEvents(chainId, logs, settlementContractOverride) {
|
|
1742
1742
|
const COW_TRADE_EVENT_TOPIC = COW_TRADE_EVENT_INTERFACE().getEventTopic("Trade");
|
|
1743
1743
|
const cowTradeEvents = logs.filter((log7) => {
|
|
1744
|
-
return log7.address
|
|
1744
|
+
return ((0, import_sdk_common9.isCoWSettlementContract)(log7.address, chainId) || (0, import_sdk_common9.areAddressesEqual)(settlementContractOverride?.[chainId], log7.address)) && log7.topics[0] === COW_TRADE_EVENT_TOPIC;
|
|
1745
1745
|
});
|
|
1746
1746
|
return cowTradeEvents.map((event) => {
|
|
1747
1747
|
const parsedLog = COW_TRADE_EVENT_INTERFACE().parseLog(event);
|
|
@@ -3620,12 +3620,12 @@ function createAcrossDepositCall(params) {
|
|
|
3620
3620
|
|
|
3621
3621
|
// src/providers/across/getDepositParams.ts
|
|
3622
3622
|
var import_sdk_common11 = require("@cowprotocol/sdk-common");
|
|
3623
|
-
async function getDepositParams(chainId, orderId, txReceipt) {
|
|
3623
|
+
async function getDepositParams(chainId, orderId, txReceipt, settlementContractOverride) {
|
|
3624
3624
|
const depositEvents = getAcrossDepositEvents(chainId, txReceipt.logs);
|
|
3625
3625
|
if (depositEvents.length === 0) {
|
|
3626
3626
|
return null;
|
|
3627
3627
|
}
|
|
3628
|
-
const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs);
|
|
3628
|
+
const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs, settlementContractOverride);
|
|
3629
3629
|
const orderTradeIndex = cowTradeEvents.findIndex((event) => event.orderUid === orderId);
|
|
3630
3630
|
if (orderTradeIndex < 0)
|
|
3631
3631
|
return null;
|
|
@@ -3669,11 +3669,11 @@ async function getGasLimitEstimationForHook({
|
|
|
3669
3669
|
|
|
3670
3670
|
// src/providers/across/AcrossBridgeProvider.ts
|
|
3671
3671
|
var import_sdk_common13 = require("@cowprotocol/sdk-common");
|
|
3672
|
-
var
|
|
3672
|
+
var import_sdk_config5 = require("@cowprotocol/sdk-config");
|
|
3673
3673
|
var import_sdk_cow_shed = require("@cowprotocol/sdk-cow-shed");
|
|
3674
3674
|
var import_sdk_order_book5 = require("@cowprotocol/sdk-order-book");
|
|
3675
3675
|
var ACROSS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/across`;
|
|
3676
|
-
var ACROSS_SUPPORTED_NETWORKS = [
|
|
3676
|
+
var ACROSS_SUPPORTED_NETWORKS = [import_sdk_config5.mainnet, import_sdk_config5.polygon, import_sdk_config5.arbitrumOne, import_sdk_config5.base, import_sdk_config5.optimism];
|
|
3677
3677
|
var SLIPPAGE_TOLERANCE_BPS = 0;
|
|
3678
3678
|
var providerType = "HookBridgeProvider";
|
|
3679
3679
|
var AcrossBridgeProvider = class {
|
|
@@ -3779,8 +3779,8 @@ var AcrossBridgeProvider = class {
|
|
|
3779
3779
|
async decodeBridgeHook(_hook) {
|
|
3780
3780
|
throw new Error("Not implemented");
|
|
3781
3781
|
}
|
|
3782
|
-
async getBridgingParams(chainId, order, txHash) {
|
|
3783
|
-
if (!(0,
|
|
3782
|
+
async getBridgingParams(chainId, order, txHash, settlementContractOverride) {
|
|
3783
|
+
if (!(0, import_sdk_config5.isSupportedChain)(chainId)) {
|
|
3784
3784
|
return null;
|
|
3785
3785
|
}
|
|
3786
3786
|
const orderUid = order.uid;
|
|
@@ -3788,7 +3788,7 @@ var AcrossBridgeProvider = class {
|
|
|
3788
3788
|
const txReceipt = await adapter.getTransactionReceipt(txHash);
|
|
3789
3789
|
if (!txReceipt)
|
|
3790
3790
|
return null;
|
|
3791
|
-
const params = await getDepositParams(chainId, orderUid, txReceipt);
|
|
3791
|
+
const params = await getDepositParams(chainId, orderUid, txReceipt, settlementContractOverride);
|
|
3792
3792
|
if (!params)
|
|
3793
3793
|
return null;
|
|
3794
3794
|
return {
|
|
@@ -4026,69 +4026,69 @@ var getBungeeBridgeFromDisplayName = (displayName) => {
|
|
|
4026
4026
|
};
|
|
4027
4027
|
|
|
4028
4028
|
// src/providers/bungee/const/contracts.ts
|
|
4029
|
-
var
|
|
4029
|
+
var import_sdk_config6 = require("@cowprotocol/sdk-config");
|
|
4030
4030
|
var BUNGEE_COWSWAP_LIB_ADDRESS = "0x75b6ba5fcab20848ca00f132d253638fea82e598";
|
|
4031
4031
|
var BungeeCowswapLibAddresses = {
|
|
4032
|
-
[
|
|
4033
|
-
[
|
|
4034
|
-
[
|
|
4035
|
-
[
|
|
4036
|
-
[
|
|
4037
|
-
[
|
|
4038
|
-
[
|
|
4032
|
+
[import_sdk_config6.SupportedChainId.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
4033
|
+
[import_sdk_config6.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
4034
|
+
[import_sdk_config6.SupportedChainId.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
4035
|
+
[import_sdk_config6.SupportedChainId.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
4036
|
+
[import_sdk_config6.SupportedChainId.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
4037
|
+
[import_sdk_config6.SupportedChainId.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
4038
|
+
[import_sdk_config6.SupportedChainId.BNB]: void 0,
|
|
4039
4039
|
// TODO: confirm
|
|
4040
|
-
[
|
|
4040
|
+
[import_sdk_config6.SupportedChainId.LINEA]: void 0,
|
|
4041
4041
|
// TODO: confirm
|
|
4042
|
-
[
|
|
4042
|
+
[import_sdk_config6.SupportedChainId.PLASMA]: void 0,
|
|
4043
4043
|
// TODO: confirm
|
|
4044
|
-
[
|
|
4044
|
+
[import_sdk_config6.SupportedChainId.INK]: void 0,
|
|
4045
4045
|
// TODO: confirm
|
|
4046
|
-
[
|
|
4047
|
-
[
|
|
4048
|
-
[
|
|
4049
|
-
[
|
|
4046
|
+
[import_sdk_config6.SupportedChainId.SEPOLIA]: void 0,
|
|
4047
|
+
[import_sdk_config6.AdditionalTargetChainId.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
4048
|
+
[import_sdk_config6.AdditionalTargetChainId.BITCOIN]: void 0,
|
|
4049
|
+
[import_sdk_config6.AdditionalTargetChainId.SOLANA]: void 0
|
|
4050
4050
|
};
|
|
4051
4051
|
var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
|
|
4052
4052
|
var SocketVerifierAddresses = {
|
|
4053
|
-
[
|
|
4054
|
-
[
|
|
4055
|
-
[
|
|
4056
|
-
[
|
|
4057
|
-
[
|
|
4058
|
-
[
|
|
4059
|
-
[
|
|
4053
|
+
[import_sdk_config6.SupportedChainId.MAINNET]: SOCKET_VERIFIER_ADDRESS,
|
|
4054
|
+
[import_sdk_config6.SupportedChainId.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
|
|
4055
|
+
[import_sdk_config6.SupportedChainId.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
|
|
4056
|
+
[import_sdk_config6.SupportedChainId.BASE]: SOCKET_VERIFIER_ADDRESS,
|
|
4057
|
+
[import_sdk_config6.SupportedChainId.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
|
|
4058
|
+
[import_sdk_config6.SupportedChainId.POLYGON]: SOCKET_VERIFIER_ADDRESS,
|
|
4059
|
+
[import_sdk_config6.SupportedChainId.BNB]: void 0,
|
|
4060
4060
|
// TODO: confirm
|
|
4061
|
-
[
|
|
4061
|
+
[import_sdk_config6.SupportedChainId.LINEA]: void 0,
|
|
4062
4062
|
// TODO: confirm
|
|
4063
|
-
[
|
|
4063
|
+
[import_sdk_config6.SupportedChainId.PLASMA]: void 0,
|
|
4064
4064
|
// TODO: confirm
|
|
4065
|
-
[
|
|
4065
|
+
[import_sdk_config6.SupportedChainId.INK]: void 0,
|
|
4066
4066
|
// TODO: confirm
|
|
4067
|
-
[
|
|
4068
|
-
[
|
|
4069
|
-
[
|
|
4070
|
-
[
|
|
4067
|
+
[import_sdk_config6.SupportedChainId.SEPOLIA]: void 0,
|
|
4068
|
+
[import_sdk_config6.AdditionalTargetChainId.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
|
|
4069
|
+
[import_sdk_config6.AdditionalTargetChainId.BITCOIN]: void 0,
|
|
4070
|
+
[import_sdk_config6.AdditionalTargetChainId.SOLANA]: void 0
|
|
4071
4071
|
};
|
|
4072
4072
|
var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
|
|
4073
4073
|
var BungeeApproveAndBridgeV1Addresses = {
|
|
4074
|
-
[
|
|
4075
|
-
[
|
|
4076
|
-
[
|
|
4077
|
-
[
|
|
4078
|
-
[
|
|
4079
|
-
[
|
|
4080
|
-
[
|
|
4074
|
+
[import_sdk_config6.SupportedChainId.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4075
|
+
[import_sdk_config6.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4076
|
+
[import_sdk_config6.SupportedChainId.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4077
|
+
[import_sdk_config6.SupportedChainId.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4078
|
+
[import_sdk_config6.SupportedChainId.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4079
|
+
[import_sdk_config6.SupportedChainId.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4080
|
+
[import_sdk_config6.SupportedChainId.BNB]: void 0,
|
|
4081
4081
|
// TODO: confirm
|
|
4082
|
-
[
|
|
4082
|
+
[import_sdk_config6.SupportedChainId.LINEA]: void 0,
|
|
4083
4083
|
// TODO: confirm
|
|
4084
|
-
[
|
|
4084
|
+
[import_sdk_config6.SupportedChainId.PLASMA]: void 0,
|
|
4085
4085
|
// TODO: confirm
|
|
4086
|
-
[
|
|
4086
|
+
[import_sdk_config6.SupportedChainId.INK]: void 0,
|
|
4087
4087
|
// TODO: confirm
|
|
4088
|
-
[
|
|
4089
|
-
[
|
|
4090
|
-
[
|
|
4091
|
-
[
|
|
4088
|
+
[import_sdk_config6.SupportedChainId.SEPOLIA]: void 0,
|
|
4089
|
+
[import_sdk_config6.AdditionalTargetChainId.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4090
|
+
[import_sdk_config6.AdditionalTargetChainId.BITCOIN]: void 0,
|
|
4091
|
+
[import_sdk_config6.AdditionalTargetChainId.SOLANA]: void 0
|
|
4092
4092
|
};
|
|
4093
4093
|
|
|
4094
4094
|
// src/providers/bungee/abi.ts
|
|
@@ -4728,7 +4728,7 @@ var BungeeApi = class {
|
|
|
4728
4728
|
};
|
|
4729
4729
|
|
|
4730
4730
|
// src/providers/bungee/createBungeeDepositCall.ts
|
|
4731
|
-
var
|
|
4731
|
+
var import_sdk_config7 = require("@cowprotocol/sdk-config");
|
|
4732
4732
|
var import_sdk_common15 = require("@cowprotocol/sdk-common");
|
|
4733
4733
|
async function createBungeeDepositCall(params) {
|
|
4734
4734
|
const adapter = (0, import_sdk_common15.getGlobalAdapter)();
|
|
@@ -4769,7 +4769,7 @@ async function createBungeeDepositCall(params) {
|
|
|
4769
4769
|
fullData
|
|
4770
4770
|
// data
|
|
4771
4771
|
]);
|
|
4772
|
-
const value = request.sellTokenAddress.toLowerCase() ===
|
|
4772
|
+
const value = request.sellTokenAddress.toLowerCase() === import_sdk_config7.ETH_ADDRESS.toLowerCase() ? BigInt(bridgeInputAmount) : 0n;
|
|
4773
4773
|
const finalValue = value + nativeTokenExtraFee;
|
|
4774
4774
|
const to = BungeeApproveAndBridgeV1Addresses[request.sellTokenChainId];
|
|
4775
4775
|
if (!to) {
|
|
@@ -4818,11 +4818,11 @@ async function getBridgingStatusFromEvents(events, getAcrossStatus) {
|
|
|
4818
4818
|
}
|
|
4819
4819
|
|
|
4820
4820
|
// src/providers/bungee/BungeeBridgeProvider.ts
|
|
4821
|
-
var
|
|
4821
|
+
var import_sdk_config8 = require("@cowprotocol/sdk-config");
|
|
4822
4822
|
var import_sdk_cow_shed2 = require("@cowprotocol/sdk-cow-shed");
|
|
4823
4823
|
var import_sdk_common16 = require("@cowprotocol/sdk-common");
|
|
4824
4824
|
var BUNGEE_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX2}/bungee`;
|
|
4825
|
-
var BUNGEE_SUPPORTED_NETWORKS = [
|
|
4825
|
+
var BUNGEE_SUPPORTED_NETWORKS = [import_sdk_config8.mainnet, import_sdk_config8.polygon, import_sdk_config8.arbitrumOne, import_sdk_config8.base, import_sdk_config8.optimism, import_sdk_config8.avalanche, import_sdk_config8.gnosisChain];
|
|
4826
4826
|
var SLIPPAGE_TOLERANCE_BPS2 = 0;
|
|
4827
4827
|
var providerType2 = "HookBridgeProvider";
|
|
4828
4828
|
var BungeeBridgeProvider = class {
|
|
@@ -4977,13 +4977,13 @@ var BungeeBridgeProvider = class {
|
|
|
4977
4977
|
}
|
|
4978
4978
|
isExtraGasRequired(request) {
|
|
4979
4979
|
const { sellTokenChainId, buyTokenChainId } = request;
|
|
4980
|
-
return sellTokenChainId ===
|
|
4980
|
+
return sellTokenChainId === import_sdk_config8.SupportedChainId.MAINNET && buyTokenChainId === import_sdk_config8.SupportedChainId.GNOSIS_CHAIN;
|
|
4981
4981
|
}
|
|
4982
4982
|
};
|
|
4983
4983
|
|
|
4984
4984
|
// src/providers/near-intents/NearIntentsBridgeProvider.ts
|
|
4985
4985
|
var import_sdk_common18 = require("@cowprotocol/sdk-common");
|
|
4986
|
-
var
|
|
4986
|
+
var import_sdk_config11 = require("@cowprotocol/sdk-config");
|
|
4987
4987
|
var import_sdk_cow_shed3 = require("@cowprotocol/sdk-cow-shed");
|
|
4988
4988
|
var import_sdk_order_book8 = require("@cowprotocol/sdk-order-book");
|
|
4989
4989
|
var import_one_click_sdk_typescript2 = require("@defuse-protocol/one-click-sdk-typescript");
|
|
@@ -5045,29 +5045,29 @@ var NearIntentsApi = class {
|
|
|
5045
5045
|
};
|
|
5046
5046
|
|
|
5047
5047
|
// src/providers/near-intents/const/index.ts
|
|
5048
|
-
var
|
|
5048
|
+
var import_sdk_config9 = require("@cowprotocol/sdk-config");
|
|
5049
5049
|
var NEAR_INTENTS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
|
|
5050
5050
|
var NEAR_INTENTS_SUPPORTED_NETWORKS = [
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5051
|
+
import_sdk_config9.arbitrumOne,
|
|
5052
|
+
import_sdk_config9.avalanche,
|
|
5053
|
+
import_sdk_config9.base,
|
|
5054
|
+
import_sdk_config9.bnb,
|
|
5055
|
+
import_sdk_config9.gnosisChain,
|
|
5056
|
+
import_sdk_config9.mainnet,
|
|
5057
|
+
import_sdk_config9.optimism,
|
|
5058
|
+
import_sdk_config9.polygon,
|
|
5059
|
+
import_sdk_config9.plasma
|
|
5060
5060
|
];
|
|
5061
5061
|
var NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS = {
|
|
5062
|
-
arb:
|
|
5063
|
-
avax:
|
|
5064
|
-
base:
|
|
5065
|
-
bsc:
|
|
5066
|
-
eth:
|
|
5067
|
-
gnosis:
|
|
5068
|
-
op:
|
|
5069
|
-
pol:
|
|
5070
|
-
plasma:
|
|
5062
|
+
arb: import_sdk_config9.arbitrumOne.id,
|
|
5063
|
+
avax: import_sdk_config9.avalanche.id,
|
|
5064
|
+
base: import_sdk_config9.base.id,
|
|
5065
|
+
bsc: import_sdk_config9.bnb.id,
|
|
5066
|
+
eth: import_sdk_config9.mainnet.id,
|
|
5067
|
+
gnosis: import_sdk_config9.gnosisChain.id,
|
|
5068
|
+
op: import_sdk_config9.optimism.id,
|
|
5069
|
+
pol: import_sdk_config9.polygon.id,
|
|
5070
|
+
plasma: import_sdk_config9.plasma.id
|
|
5071
5071
|
};
|
|
5072
5072
|
var NEAR_INTENTS_STATUS_TO_COW_STATUS = {
|
|
5073
5073
|
KNOWN_DEPOSIT_TX: "in_progress" /* IN_PROGRESS */,
|
|
@@ -5085,7 +5085,7 @@ var ATTESTATOR_ADDRESS = "0x0073DD100b51C555E41B2a452E5933ef76F42790";
|
|
|
5085
5085
|
// src/providers/near-intents/util.ts
|
|
5086
5086
|
var import_json_stable_stringify3 = __toESM(require("json-stable-stringify"));
|
|
5087
5087
|
var import_sdk_common17 = require("@cowprotocol/sdk-common");
|
|
5088
|
-
var
|
|
5088
|
+
var import_sdk_config10 = require("@cowprotocol/sdk-config");
|
|
5089
5089
|
var calculateDeadline = (seconds) => {
|
|
5090
5090
|
const secs = Number(seconds);
|
|
5091
5091
|
if (!Number.isFinite(secs)) {
|
|
@@ -5098,7 +5098,7 @@ var adaptToken = (token) => {
|
|
|
5098
5098
|
const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
|
|
5099
5099
|
if (!chainId)
|
|
5100
5100
|
return null;
|
|
5101
|
-
const tokenAddress = token.contractAddress ||
|
|
5101
|
+
const tokenAddress = token.contractAddress || import_sdk_config10.ETH_ADDRESS;
|
|
5102
5102
|
if (!tokenAddress)
|
|
5103
5103
|
return null;
|
|
5104
5104
|
return {
|
|
@@ -5118,17 +5118,17 @@ var adaptTokens = (tokens) => tokens.reduce((acc, token) => {
|
|
|
5118
5118
|
return acc;
|
|
5119
5119
|
}, []);
|
|
5120
5120
|
var getTokenByAddressAndChainId = (tokens, targetTokenAddress, targetTokenChainId) => {
|
|
5121
|
-
if (!(0,
|
|
5121
|
+
if (!(0, import_sdk_config10.isEvmChain)(targetTokenChainId)) {
|
|
5122
5122
|
return void 0;
|
|
5123
5123
|
}
|
|
5124
5124
|
return tokens.find((token) => {
|
|
5125
5125
|
const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
|
|
5126
5126
|
if (!chainId)
|
|
5127
5127
|
return false;
|
|
5128
|
-
if (targetTokenAddress.toLowerCase() ===
|
|
5128
|
+
if (targetTokenAddress.toLowerCase() === import_sdk_config10.ETH_ADDRESS.toLowerCase()) {
|
|
5129
5129
|
return chainId === targetTokenChainId && !token.contractAddress;
|
|
5130
5130
|
}
|
|
5131
|
-
const tokenAddress = token.contractAddress ||
|
|
5131
|
+
const tokenAddress = token.contractAddress || import_sdk_config10.ETH_ADDRESS;
|
|
5132
5132
|
return tokenAddress?.toLowerCase() === targetTokenAddress.toLowerCase() && chainId === targetTokenChainId;
|
|
5133
5133
|
});
|
|
5134
5134
|
};
|
|
@@ -5177,7 +5177,7 @@ var hashQuote = ({
|
|
|
5177
5177
|
};
|
|
5178
5178
|
|
|
5179
5179
|
// src/providers/near-intents/NearIntentsBridgeProvider.ts
|
|
5180
|
-
var
|
|
5180
|
+
var import_sdk_config12 = require("@cowprotocol/sdk-config");
|
|
5181
5181
|
var NEAR_INTENTS_HOOK_DAPP_ID2 = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
|
|
5182
5182
|
var REFERRAL = "cow";
|
|
5183
5183
|
var providerType3 = "ReceiverAccountBridgeProvider";
|
|
@@ -5347,7 +5347,7 @@ var NearIntentsBridgeProvider = class {
|
|
|
5347
5347
|
if (!adaptedInput?.chainId || !adaptedOutput?.chainId) {
|
|
5348
5348
|
throw new Error("Token not supported");
|
|
5349
5349
|
}
|
|
5350
|
-
if (!(0,
|
|
5350
|
+
if (!(0, import_sdk_config12.isEvmChain)(adaptedInput.chainId) || !(0, import_sdk_config12.isEvmChain)(adaptedOutput.chainId)) {
|
|
5351
5351
|
throw new Error("Non-EVM chains are not supported for BridgingDepositParams");
|
|
5352
5352
|
}
|
|
5353
5353
|
return {
|
|
@@ -5357,8 +5357,8 @@ var NearIntentsBridgeProvider = class {
|
|
|
5357
5357
|
fillTxHash: status.swapDetails?.destinationChainTxHashes?.[0]?.hash
|
|
5358
5358
|
},
|
|
5359
5359
|
params: {
|
|
5360
|
-
inputTokenAddress: inputToken.contractAddress ??
|
|
5361
|
-
outputTokenAddress: outputToken.contractAddress ??
|
|
5360
|
+
inputTokenAddress: inputToken.contractAddress ?? import_sdk_config11.ETH_ADDRESS,
|
|
5361
|
+
outputTokenAddress: outputToken.contractAddress ?? import_sdk_config11.ETH_ADDRESS,
|
|
5362
5362
|
inputAmount: BigInt(quote.amountIn),
|
|
5363
5363
|
outputAmount: swapDetails.amountOut ? BigInt(swapDetails.amountOut) : BigInt(quote.amountOut),
|
|
5364
5364
|
owner: order.owner,
|
package/dist/index.mjs
CHANGED
|
@@ -125,7 +125,7 @@ function findBridgeProviderFromHook(fullAppData, providers) {
|
|
|
125
125
|
|
|
126
126
|
// src/BridgingSdk/getCrossChainOrder.ts
|
|
127
127
|
async function getCrossChainOrder(params) {
|
|
128
|
-
const { chainId, orderId, orderBookApi, providers, env } = params;
|
|
128
|
+
const { chainId, orderId, orderBookApi, providers, env, settlementContractOverride } = params;
|
|
129
129
|
const chainContext = { chainId, env };
|
|
130
130
|
const order = await orderBookApi.getOrder(orderId, chainContext);
|
|
131
131
|
const provider = order.fullAppData && findBridgeProviderFromHook(order.fullAppData, providers);
|
|
@@ -143,7 +143,7 @@ async function getCrossChainOrder(params) {
|
|
|
143
143
|
`No tx hash found for order ${orderId} . First trade, with log index ${firstTrade?.logIndex}`
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
|
-
const { params: bridgingParams, status: statusResult } = await provider.getBridgingParams(chainId, order, tradeTxHash) || {};
|
|
146
|
+
const { params: bridgingParams, status: statusResult } = await provider.getBridgingParams(chainId, order, tradeTxHash, settlementContractOverride) || {};
|
|
147
147
|
if (!bridgingParams || !statusResult) {
|
|
148
148
|
throw new BridgeOrderParsingError(`Bridging params cannot be derived from transaction: ${tradeTxHash}`);
|
|
149
149
|
}
|
|
@@ -1148,7 +1148,7 @@ var BridgingSdk = class {
|
|
|
1148
1148
|
if (options.enableLogging !== void 0) {
|
|
1149
1149
|
enableLogging(options.enableLogging);
|
|
1150
1150
|
}
|
|
1151
|
-
const tradingSdk = options.tradingSdk ?? new TradingSdk();
|
|
1151
|
+
const tradingSdk = options.tradingSdk ?? new TradingSdk({}, { enableLogging: options.enableLogging });
|
|
1152
1152
|
const orderBookApi = tradingSdk?.options.orderBookApi ?? new OrderBookApi2();
|
|
1153
1153
|
this.config = {
|
|
1154
1154
|
...restOptions,
|
|
@@ -1316,13 +1316,14 @@ var BridgingSdk = class {
|
|
|
1316
1316
|
}
|
|
1317
1317
|
async getOrder(params) {
|
|
1318
1318
|
const { orderBookApi } = this.config;
|
|
1319
|
-
const { chainId, orderId, env = orderBookApi.context.env } = params;
|
|
1319
|
+
const { chainId, orderId, env = orderBookApi.context.env, settlementContractOverride } = params;
|
|
1320
1320
|
return getCrossChainOrder({
|
|
1321
1321
|
chainId,
|
|
1322
1322
|
orderId,
|
|
1323
1323
|
orderBookApi,
|
|
1324
1324
|
env,
|
|
1325
|
-
providers: this.getAvailableProviders()
|
|
1325
|
+
providers: this.getAvailableProviders(),
|
|
1326
|
+
settlementContractOverride
|
|
1326
1327
|
});
|
|
1327
1328
|
}
|
|
1328
1329
|
getProviderFromAppData(fullAppData) {
|
|
@@ -1546,9 +1547,8 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
|
|
|
1546
1547
|
};
|
|
1547
1548
|
|
|
1548
1549
|
// src/providers/across/util.ts
|
|
1549
|
-
import { COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS } from "@cowprotocol/sdk-config";
|
|
1550
1550
|
import { OrderKind as OrderKind2 } from "@cowprotocol/sdk-order-book";
|
|
1551
|
-
import { getGlobalAdapter as getGlobalAdapter5 } from "@cowprotocol/sdk-common";
|
|
1551
|
+
import { areAddressesEqual as areAddressesEqual2, getGlobalAdapter as getGlobalAdapter5, isCoWSettlementContract } from "@cowprotocol/sdk-common";
|
|
1552
1552
|
import stringify from "json-stable-stringify";
|
|
1553
1553
|
var PCT_100_PERCENT = 10n ** 18n;
|
|
1554
1554
|
function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
|
|
@@ -1681,10 +1681,10 @@ function getAcrossDepositEvents(chainId, logs) {
|
|
|
1681
1681
|
};
|
|
1682
1682
|
});
|
|
1683
1683
|
}
|
|
1684
|
-
function getCowTradeEvents(chainId, logs) {
|
|
1684
|
+
function getCowTradeEvents(chainId, logs, settlementContractOverride) {
|
|
1685
1685
|
const COW_TRADE_EVENT_TOPIC = COW_TRADE_EVENT_INTERFACE().getEventTopic("Trade");
|
|
1686
1686
|
const cowTradeEvents = logs.filter((log7) => {
|
|
1687
|
-
return log7.address
|
|
1687
|
+
return (isCoWSettlementContract(log7.address, chainId) || areAddressesEqual2(settlementContractOverride?.[chainId], log7.address)) && log7.topics[0] === COW_TRADE_EVENT_TOPIC;
|
|
1688
1688
|
});
|
|
1689
1689
|
return cowTradeEvents.map((event) => {
|
|
1690
1690
|
const parsedLog = COW_TRADE_EVENT_INTERFACE().parseLog(event);
|
|
@@ -3563,12 +3563,12 @@ function createAcrossDepositCall(params) {
|
|
|
3563
3563
|
|
|
3564
3564
|
// src/providers/across/getDepositParams.ts
|
|
3565
3565
|
import { log as log5 } from "@cowprotocol/sdk-common";
|
|
3566
|
-
async function getDepositParams(chainId, orderId, txReceipt) {
|
|
3566
|
+
async function getDepositParams(chainId, orderId, txReceipt, settlementContractOverride) {
|
|
3567
3567
|
const depositEvents = getAcrossDepositEvents(chainId, txReceipt.logs);
|
|
3568
3568
|
if (depositEvents.length === 0) {
|
|
3569
3569
|
return null;
|
|
3570
3570
|
}
|
|
3571
|
-
const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs);
|
|
3571
|
+
const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs, settlementContractOverride);
|
|
3572
3572
|
const orderTradeIndex = cowTradeEvents.findIndex((event) => event.orderUid === orderId);
|
|
3573
3573
|
if (orderTradeIndex < 0)
|
|
3574
3574
|
return null;
|
|
@@ -3729,7 +3729,7 @@ var AcrossBridgeProvider = class {
|
|
|
3729
3729
|
async decodeBridgeHook(_hook) {
|
|
3730
3730
|
throw new Error("Not implemented");
|
|
3731
3731
|
}
|
|
3732
|
-
async getBridgingParams(chainId, order, txHash) {
|
|
3732
|
+
async getBridgingParams(chainId, order, txHash, settlementContractOverride) {
|
|
3733
3733
|
if (!isSupportedChain(chainId)) {
|
|
3734
3734
|
return null;
|
|
3735
3735
|
}
|
|
@@ -3738,7 +3738,7 @@ var AcrossBridgeProvider = class {
|
|
|
3738
3738
|
const txReceipt = await adapter.getTransactionReceipt(txHash);
|
|
3739
3739
|
if (!txReceipt)
|
|
3740
3740
|
return null;
|
|
3741
|
-
const params = await getDepositParams(chainId, orderUid, txReceipt);
|
|
3741
|
+
const params = await getDepositParams(chainId, orderUid, txReceipt, settlementContractOverride);
|
|
3742
3742
|
if (!params)
|
|
3743
3743
|
return null;
|
|
3744
3744
|
return {
|
|
@@ -3976,66 +3976,66 @@ var getBungeeBridgeFromDisplayName = (displayName) => {
|
|
|
3976
3976
|
};
|
|
3977
3977
|
|
|
3978
3978
|
// src/providers/bungee/const/contracts.ts
|
|
3979
|
-
import { AdditionalTargetChainId as AdditionalTargetChainId2, SupportedChainId as
|
|
3979
|
+
import { AdditionalTargetChainId as AdditionalTargetChainId2, SupportedChainId as SupportedChainId4 } from "@cowprotocol/sdk-config";
|
|
3980
3980
|
var BUNGEE_COWSWAP_LIB_ADDRESS = "0x75b6ba5fcab20848ca00f132d253638fea82e598";
|
|
3981
3981
|
var BungeeCowswapLibAddresses = {
|
|
3982
|
-
[
|
|
3983
|
-
[
|
|
3984
|
-
[
|
|
3985
|
-
[
|
|
3986
|
-
[
|
|
3987
|
-
[
|
|
3988
|
-
[
|
|
3982
|
+
[SupportedChainId4.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3983
|
+
[SupportedChainId4.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3984
|
+
[SupportedChainId4.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3985
|
+
[SupportedChainId4.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3986
|
+
[SupportedChainId4.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3987
|
+
[SupportedChainId4.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3988
|
+
[SupportedChainId4.BNB]: void 0,
|
|
3989
3989
|
// TODO: confirm
|
|
3990
|
-
[
|
|
3990
|
+
[SupportedChainId4.LINEA]: void 0,
|
|
3991
3991
|
// TODO: confirm
|
|
3992
|
-
[
|
|
3992
|
+
[SupportedChainId4.PLASMA]: void 0,
|
|
3993
3993
|
// TODO: confirm
|
|
3994
|
-
[
|
|
3994
|
+
[SupportedChainId4.INK]: void 0,
|
|
3995
3995
|
// TODO: confirm
|
|
3996
|
-
[
|
|
3996
|
+
[SupportedChainId4.SEPOLIA]: void 0,
|
|
3997
3997
|
[AdditionalTargetChainId2.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3998
3998
|
[AdditionalTargetChainId2.BITCOIN]: void 0,
|
|
3999
3999
|
[AdditionalTargetChainId2.SOLANA]: void 0
|
|
4000
4000
|
};
|
|
4001
4001
|
var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
|
|
4002
4002
|
var SocketVerifierAddresses = {
|
|
4003
|
-
[
|
|
4004
|
-
[
|
|
4005
|
-
[
|
|
4006
|
-
[
|
|
4007
|
-
[
|
|
4008
|
-
[
|
|
4009
|
-
[
|
|
4003
|
+
[SupportedChainId4.MAINNET]: SOCKET_VERIFIER_ADDRESS,
|
|
4004
|
+
[SupportedChainId4.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
|
|
4005
|
+
[SupportedChainId4.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
|
|
4006
|
+
[SupportedChainId4.BASE]: SOCKET_VERIFIER_ADDRESS,
|
|
4007
|
+
[SupportedChainId4.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
|
|
4008
|
+
[SupportedChainId4.POLYGON]: SOCKET_VERIFIER_ADDRESS,
|
|
4009
|
+
[SupportedChainId4.BNB]: void 0,
|
|
4010
4010
|
// TODO: confirm
|
|
4011
|
-
[
|
|
4011
|
+
[SupportedChainId4.LINEA]: void 0,
|
|
4012
4012
|
// TODO: confirm
|
|
4013
|
-
[
|
|
4013
|
+
[SupportedChainId4.PLASMA]: void 0,
|
|
4014
4014
|
// TODO: confirm
|
|
4015
|
-
[
|
|
4015
|
+
[SupportedChainId4.INK]: void 0,
|
|
4016
4016
|
// TODO: confirm
|
|
4017
|
-
[
|
|
4017
|
+
[SupportedChainId4.SEPOLIA]: void 0,
|
|
4018
4018
|
[AdditionalTargetChainId2.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
|
|
4019
4019
|
[AdditionalTargetChainId2.BITCOIN]: void 0,
|
|
4020
4020
|
[AdditionalTargetChainId2.SOLANA]: void 0
|
|
4021
4021
|
};
|
|
4022
4022
|
var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
|
|
4023
4023
|
var BungeeApproveAndBridgeV1Addresses = {
|
|
4024
|
-
[
|
|
4025
|
-
[
|
|
4026
|
-
[
|
|
4027
|
-
[
|
|
4028
|
-
[
|
|
4029
|
-
[
|
|
4030
|
-
[
|
|
4024
|
+
[SupportedChainId4.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4025
|
+
[SupportedChainId4.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4026
|
+
[SupportedChainId4.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4027
|
+
[SupportedChainId4.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4028
|
+
[SupportedChainId4.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4029
|
+
[SupportedChainId4.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4030
|
+
[SupportedChainId4.BNB]: void 0,
|
|
4031
4031
|
// TODO: confirm
|
|
4032
|
-
[
|
|
4032
|
+
[SupportedChainId4.LINEA]: void 0,
|
|
4033
4033
|
// TODO: confirm
|
|
4034
|
-
[
|
|
4034
|
+
[SupportedChainId4.PLASMA]: void 0,
|
|
4035
4035
|
// TODO: confirm
|
|
4036
|
-
[
|
|
4036
|
+
[SupportedChainId4.INK]: void 0,
|
|
4037
4037
|
// TODO: confirm
|
|
4038
|
-
[
|
|
4038
|
+
[SupportedChainId4.SEPOLIA]: void 0,
|
|
4039
4039
|
[AdditionalTargetChainId2.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4040
4040
|
[AdditionalTargetChainId2.BITCOIN]: void 0,
|
|
4041
4041
|
[AdditionalTargetChainId2.SOLANA]: void 0
|
|
@@ -4776,7 +4776,7 @@ import {
|
|
|
4776
4776
|
mainnet as mainnet2,
|
|
4777
4777
|
optimism as optimism2,
|
|
4778
4778
|
polygon as polygon2,
|
|
4779
|
-
SupportedChainId as
|
|
4779
|
+
SupportedChainId as SupportedChainId5
|
|
4780
4780
|
} from "@cowprotocol/sdk-config";
|
|
4781
4781
|
import { CowShedSdk as CowShedSdk2 } from "@cowprotocol/sdk-cow-shed";
|
|
4782
4782
|
import { setGlobalAdapter as setGlobalAdapter3 } from "@cowprotocol/sdk-common";
|
|
@@ -4936,7 +4936,7 @@ var BungeeBridgeProvider = class {
|
|
|
4936
4936
|
}
|
|
4937
4937
|
isExtraGasRequired(request) {
|
|
4938
4938
|
const { sellTokenChainId, buyTokenChainId } = request;
|
|
4939
|
-
return sellTokenChainId ===
|
|
4939
|
+
return sellTokenChainId === SupportedChainId5.MAINNET && buyTokenChainId === SupportedChainId5.GNOSIS_CHAIN;
|
|
4940
4940
|
}
|
|
4941
4941
|
};
|
|
4942
4942
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-bridging",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Bridging for CoW Protocol",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/cowprotocol/cow-sdk.git",
|
|
8
|
+
"directory": "packages/bridging"
|
|
9
|
+
},
|
|
5
10
|
"main": "./dist/index.js",
|
|
6
11
|
"module": "./dist/index.mjs",
|
|
7
12
|
"types": "./dist/index.d.ts",
|
|
@@ -13,19 +18,36 @@
|
|
|
13
18
|
"publishConfig": {
|
|
14
19
|
"access": "public"
|
|
15
20
|
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
23
|
+
"lint": "eslint src/**/*.ts",
|
|
24
|
+
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"test:coverage": "jest --coverage --json --outputFile=jest.results.json && npx coveralls < ./coverage/lcov.info",
|
|
27
|
+
"test:coverage:html": "jest --silent=false --coverage --coverageReporters html",
|
|
28
|
+
"test:bungeeGnosisBridge": "jest --testPathPattern=BungeeGnosisBridge",
|
|
29
|
+
"test:bungeeAcrossBridge": "jest --testPathPattern=BungeeAcrossBridge",
|
|
30
|
+
"typecheck": "tsc --noEmit",
|
|
31
|
+
"prepublishOnly": "npm run build"
|
|
32
|
+
},
|
|
16
33
|
"dependencies": {
|
|
34
|
+
"@cowprotocol/sdk-app-data": "workspace:*",
|
|
35
|
+
"@cowprotocol/sdk-common": "workspace:*",
|
|
36
|
+
"@cowprotocol/sdk-config": "workspace:*",
|
|
37
|
+
"@cowprotocol/sdk-contracts-ts": "workspace:*",
|
|
38
|
+
"@cowprotocol/sdk-cow-shed": "workspace:*",
|
|
39
|
+
"@cowprotocol/sdk-order-book": "workspace:*",
|
|
40
|
+
"@cowprotocol/sdk-trading": "workspace:*",
|
|
41
|
+
"@cowprotocol/sdk-weiroll": "workspace:*",
|
|
17
42
|
"@defuse-protocol/one-click-sdk-typescript": "0.1.1-0.2",
|
|
18
|
-
"json-stable-stringify": "^1.3.0"
|
|
19
|
-
"@cowprotocol/sdk-app-data": "4.6.8",
|
|
20
|
-
"@cowprotocol/sdk-config": "1.0.0",
|
|
21
|
-
"@cowprotocol/sdk-common": "0.7.1",
|
|
22
|
-
"@cowprotocol/sdk-contracts-ts": "2.0.0",
|
|
23
|
-
"@cowprotocol/sdk-cow-shed": "0.2.22",
|
|
24
|
-
"@cowprotocol/sdk-order-book": "2.0.0",
|
|
25
|
-
"@cowprotocol/sdk-trading": "1.0.4",
|
|
26
|
-
"@cowprotocol/sdk-weiroll": "0.1.22"
|
|
43
|
+
"json-stable-stringify": "^1.3.0"
|
|
27
44
|
},
|
|
28
45
|
"devDependencies": {
|
|
46
|
+
"@cow-sdk/typescript-config": "workspace:*",
|
|
47
|
+
"@cowprotocol/sdk-ethers-v5-adapter": "workspace:*",
|
|
48
|
+
"@cowprotocol/sdk-ethers-v6-adapter": "workspace:*",
|
|
49
|
+
"@cowprotocol/sdk-order-signing": "workspace:*",
|
|
50
|
+
"@cowprotocol/sdk-viem-adapter": "workspace:*",
|
|
29
51
|
"@types/jest": "^29.4.0",
|
|
30
52
|
"@types/node": "^20.17.31",
|
|
31
53
|
"coveralls": "^3.1.1",
|
|
@@ -37,22 +59,6 @@
|
|
|
37
59
|
"ts-jest": "^29.0.0",
|
|
38
60
|
"tsup": "^7.2.0",
|
|
39
61
|
"typescript": "^5.2.2",
|
|
40
|
-
"viem": "^2.28.4"
|
|
41
|
-
"@cow-sdk/typescript-config": "0.0.0-beta.0",
|
|
42
|
-
"@cowprotocol/sdk-ethers-v5-adapter": "0.3.11",
|
|
43
|
-
"@cowprotocol/sdk-ethers-v6-adapter": "0.3.11",
|
|
44
|
-
"@cowprotocol/sdk-order-signing": "0.1.38",
|
|
45
|
-
"@cowprotocol/sdk-viem-adapter": "0.3.11"
|
|
46
|
-
},
|
|
47
|
-
"scripts": {
|
|
48
|
-
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
49
|
-
"lint": "eslint src/**/*.ts",
|
|
50
|
-
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
51
|
-
"test": "jest",
|
|
52
|
-
"test:coverage": "jest --coverage --json --outputFile=jest.results.json && npx coveralls < ./coverage/lcov.info",
|
|
53
|
-
"test:coverage:html": "jest --silent=false --coverage --coverageReporters html",
|
|
54
|
-
"test:bungeeGnosisBridge": "jest --testPathPattern=BungeeGnosisBridge",
|
|
55
|
-
"test:bungeeAcrossBridge": "jest --testPathPattern=BungeeAcrossBridge",
|
|
56
|
-
"typecheck": "tsc --noEmit"
|
|
62
|
+
"viem": "^2.28.4"
|
|
57
63
|
}
|
|
58
|
-
}
|
|
64
|
+
}
|