@cowprotocol/sdk-bridging 2.1.1 → 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 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) {
@@ -1562,8 +1563,6 @@ var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
1562
1563
  [import_sdk_config4.SupportedChainId.SEPOLIA]: "0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662",
1563
1564
  // https://docs.across.to/reference/contract-addresses/polygon-chain-id-137
1564
1565
  [import_sdk_config4.SupportedChainId.POLYGON]: "0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096",
1565
- // https://docs.across.to/reference/contract-addresses/lens-chain
1566
- [import_sdk_config4.SupportedChainId.LENS]: "0xb234cA484866c811d0e6D3318866F583781ED045",
1567
1566
  // https://docs.across.to/reference/contract-addresses/bnb-smart-chain
1568
1567
  [import_sdk_config4.SupportedChainId.BNB]: "0x4e8E101924eDE233C13e2D8622DC8aED2872d505",
1569
1568
  // https://docs.across.to/reference/contract-addresses/linea-chain-id-59144
@@ -1591,8 +1590,6 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1591
1590
  [import_sdk_config4.SupportedChainId.SEPOLIA]: void 0,
1592
1591
  [import_sdk_config4.SupportedChainId.POLYGON]: void 0,
1593
1592
  [import_sdk_config4.SupportedChainId.AVALANCHE]: void 0,
1594
- [import_sdk_config4.SupportedChainId.LENS]: void 0,
1595
- // TODO: confirm
1596
1593
  [import_sdk_config4.SupportedChainId.BNB]: void 0,
1597
1594
  // TODO: confirm
1598
1595
  [import_sdk_config4.SupportedChainId.LINEA]: void 0,
@@ -1607,7 +1604,6 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1607
1604
  };
1608
1605
 
1609
1606
  // src/providers/across/util.ts
1610
- var import_sdk_config5 = require("@cowprotocol/sdk-config");
1611
1607
  var import_sdk_order_book4 = require("@cowprotocol/sdk-order-book");
1612
1608
  var import_sdk_common9 = require("@cowprotocol/sdk-common");
1613
1609
  var import_json_stable_stringify = __toESM(require("json-stable-stringify"));
@@ -1742,10 +1738,10 @@ function getAcrossDepositEvents(chainId, logs) {
1742
1738
  };
1743
1739
  });
1744
1740
  }
1745
- function getCowTradeEvents(chainId, logs) {
1741
+ function getCowTradeEvents(chainId, logs, settlementContractOverride) {
1746
1742
  const COW_TRADE_EVENT_TOPIC = COW_TRADE_EVENT_INTERFACE().getEventTopic("Trade");
1747
1743
  const cowTradeEvents = logs.filter((log7) => {
1748
- return log7.address.toLowerCase() === import_sdk_config5.COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[chainId].toLowerCase() && log7.topics[0] === COW_TRADE_EVENT_TOPIC;
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;
1749
1745
  });
1750
1746
  return cowTradeEvents.map((event) => {
1751
1747
  const parsedLog = COW_TRADE_EVENT_INTERFACE().parseLog(event);
@@ -3624,12 +3620,12 @@ function createAcrossDepositCall(params) {
3624
3620
 
3625
3621
  // src/providers/across/getDepositParams.ts
3626
3622
  var import_sdk_common11 = require("@cowprotocol/sdk-common");
3627
- async function getDepositParams(chainId, orderId, txReceipt) {
3623
+ async function getDepositParams(chainId, orderId, txReceipt, settlementContractOverride) {
3628
3624
  const depositEvents = getAcrossDepositEvents(chainId, txReceipt.logs);
3629
3625
  if (depositEvents.length === 0) {
3630
3626
  return null;
3631
3627
  }
3632
- const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs);
3628
+ const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs, settlementContractOverride);
3633
3629
  const orderTradeIndex = cowTradeEvents.findIndex((event) => event.orderUid === orderId);
3634
3630
  if (orderTradeIndex < 0)
3635
3631
  return null;
@@ -3673,11 +3669,11 @@ async function getGasLimitEstimationForHook({
3673
3669
 
3674
3670
  // src/providers/across/AcrossBridgeProvider.ts
3675
3671
  var import_sdk_common13 = require("@cowprotocol/sdk-common");
3676
- var import_sdk_config6 = require("@cowprotocol/sdk-config");
3672
+ var import_sdk_config5 = require("@cowprotocol/sdk-config");
3677
3673
  var import_sdk_cow_shed = require("@cowprotocol/sdk-cow-shed");
3678
3674
  var import_sdk_order_book5 = require("@cowprotocol/sdk-order-book");
3679
3675
  var ACROSS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/across`;
3680
- var ACROSS_SUPPORTED_NETWORKS = [import_sdk_config6.mainnet, import_sdk_config6.polygon, import_sdk_config6.arbitrumOne, import_sdk_config6.base, import_sdk_config6.optimism];
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];
3681
3677
  var SLIPPAGE_TOLERANCE_BPS = 0;
3682
3678
  var providerType = "HookBridgeProvider";
3683
3679
  var AcrossBridgeProvider = class {
@@ -3783,8 +3779,8 @@ var AcrossBridgeProvider = class {
3783
3779
  async decodeBridgeHook(_hook) {
3784
3780
  throw new Error("Not implemented");
3785
3781
  }
3786
- async getBridgingParams(chainId, order, txHash) {
3787
- if (!(0, import_sdk_config6.isSupportedChain)(chainId)) {
3782
+ async getBridgingParams(chainId, order, txHash, settlementContractOverride) {
3783
+ if (!(0, import_sdk_config5.isSupportedChain)(chainId)) {
3788
3784
  return null;
3789
3785
  }
3790
3786
  const orderUid = order.uid;
@@ -3792,7 +3788,7 @@ var AcrossBridgeProvider = class {
3792
3788
  const txReceipt = await adapter.getTransactionReceipt(txHash);
3793
3789
  if (!txReceipt)
3794
3790
  return null;
3795
- const params = await getDepositParams(chainId, orderUid, txReceipt);
3791
+ const params = await getDepositParams(chainId, orderUid, txReceipt, settlementContractOverride);
3796
3792
  if (!params)
3797
3793
  return null;
3798
3794
  return {
@@ -4030,75 +4026,69 @@ var getBungeeBridgeFromDisplayName = (displayName) => {
4030
4026
  };
4031
4027
 
4032
4028
  // src/providers/bungee/const/contracts.ts
4033
- var import_sdk_config7 = require("@cowprotocol/sdk-config");
4029
+ var import_sdk_config6 = require("@cowprotocol/sdk-config");
4034
4030
  var BUNGEE_COWSWAP_LIB_ADDRESS = "0x75b6ba5fcab20848ca00f132d253638fea82e598";
4035
4031
  var BungeeCowswapLibAddresses = {
4036
- [import_sdk_config7.SupportedChainId.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
4037
- [import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
4038
- [import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4039
- [import_sdk_config7.SupportedChainId.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4040
- [import_sdk_config7.SupportedChainId.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
4041
- [import_sdk_config7.SupportedChainId.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
4042
- [import_sdk_config7.SupportedChainId.LENS]: void 0,
4043
- // TODO: confirm
4044
- [import_sdk_config7.SupportedChainId.BNB]: void 0,
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,
4045
4039
  // TODO: confirm
4046
- [import_sdk_config7.SupportedChainId.LINEA]: void 0,
4040
+ [import_sdk_config6.SupportedChainId.LINEA]: void 0,
4047
4041
  // TODO: confirm
4048
- [import_sdk_config7.SupportedChainId.PLASMA]: void 0,
4042
+ [import_sdk_config6.SupportedChainId.PLASMA]: void 0,
4049
4043
  // TODO: confirm
4050
- [import_sdk_config7.SupportedChainId.INK]: void 0,
4044
+ [import_sdk_config6.SupportedChainId.INK]: void 0,
4051
4045
  // TODO: confirm
4052
- [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4053
- [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
4054
- [import_sdk_config7.AdditionalTargetChainId.BITCOIN]: void 0,
4055
- [import_sdk_config7.AdditionalTargetChainId.SOLANA]: void 0
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
4056
4050
  };
4057
4051
  var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
4058
4052
  var SocketVerifierAddresses = {
4059
- [import_sdk_config7.SupportedChainId.MAINNET]: SOCKET_VERIFIER_ADDRESS,
4060
- [import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
4061
- [import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
4062
- [import_sdk_config7.SupportedChainId.BASE]: SOCKET_VERIFIER_ADDRESS,
4063
- [import_sdk_config7.SupportedChainId.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
4064
- [import_sdk_config7.SupportedChainId.POLYGON]: SOCKET_VERIFIER_ADDRESS,
4065
- [import_sdk_config7.SupportedChainId.LENS]: void 0,
4066
- // TODO: confirm
4067
- [import_sdk_config7.SupportedChainId.BNB]: void 0,
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,
4068
4060
  // TODO: confirm
4069
- [import_sdk_config7.SupportedChainId.LINEA]: void 0,
4061
+ [import_sdk_config6.SupportedChainId.LINEA]: void 0,
4070
4062
  // TODO: confirm
4071
- [import_sdk_config7.SupportedChainId.PLASMA]: void 0,
4063
+ [import_sdk_config6.SupportedChainId.PLASMA]: void 0,
4072
4064
  // TODO: confirm
4073
- [import_sdk_config7.SupportedChainId.INK]: void 0,
4065
+ [import_sdk_config6.SupportedChainId.INK]: void 0,
4074
4066
  // TODO: confirm
4075
- [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4076
- [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
4077
- [import_sdk_config7.AdditionalTargetChainId.BITCOIN]: void 0,
4078
- [import_sdk_config7.AdditionalTargetChainId.SOLANA]: void 0
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
4079
4071
  };
4080
4072
  var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
4081
4073
  var BungeeApproveAndBridgeV1Addresses = {
4082
- [import_sdk_config7.SupportedChainId.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4083
- [import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4084
- [import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4085
- [import_sdk_config7.SupportedChainId.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4086
- [import_sdk_config7.SupportedChainId.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4087
- [import_sdk_config7.SupportedChainId.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4088
- [import_sdk_config7.SupportedChainId.LENS]: void 0,
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,
4089
4081
  // TODO: confirm
4090
- [import_sdk_config7.SupportedChainId.BNB]: void 0,
4082
+ [import_sdk_config6.SupportedChainId.LINEA]: void 0,
4091
4083
  // TODO: confirm
4092
- [import_sdk_config7.SupportedChainId.LINEA]: void 0,
4084
+ [import_sdk_config6.SupportedChainId.PLASMA]: void 0,
4093
4085
  // TODO: confirm
4094
- [import_sdk_config7.SupportedChainId.PLASMA]: void 0,
4086
+ [import_sdk_config6.SupportedChainId.INK]: void 0,
4095
4087
  // TODO: confirm
4096
- [import_sdk_config7.SupportedChainId.INK]: void 0,
4097
- // TODO: confirm
4098
- [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4099
- [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4100
- [import_sdk_config7.AdditionalTargetChainId.BITCOIN]: void 0,
4101
- [import_sdk_config7.AdditionalTargetChainId.SOLANA]: void 0
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
4102
4092
  };
4103
4093
 
4104
4094
  // src/providers/bungee/abi.ts
@@ -4738,7 +4728,7 @@ var BungeeApi = class {
4738
4728
  };
4739
4729
 
4740
4730
  // src/providers/bungee/createBungeeDepositCall.ts
4741
- var import_sdk_config8 = require("@cowprotocol/sdk-config");
4731
+ var import_sdk_config7 = require("@cowprotocol/sdk-config");
4742
4732
  var import_sdk_common15 = require("@cowprotocol/sdk-common");
4743
4733
  async function createBungeeDepositCall(params) {
4744
4734
  const adapter = (0, import_sdk_common15.getGlobalAdapter)();
@@ -4779,7 +4769,7 @@ async function createBungeeDepositCall(params) {
4779
4769
  fullData
4780
4770
  // data
4781
4771
  ]);
4782
- const value = request.sellTokenAddress.toLowerCase() === import_sdk_config8.ETH_ADDRESS.toLowerCase() ? BigInt(bridgeInputAmount) : 0n;
4772
+ const value = request.sellTokenAddress.toLowerCase() === import_sdk_config7.ETH_ADDRESS.toLowerCase() ? BigInt(bridgeInputAmount) : 0n;
4783
4773
  const finalValue = value + nativeTokenExtraFee;
4784
4774
  const to = BungeeApproveAndBridgeV1Addresses[request.sellTokenChainId];
4785
4775
  if (!to) {
@@ -4828,11 +4818,11 @@ async function getBridgingStatusFromEvents(events, getAcrossStatus) {
4828
4818
  }
4829
4819
 
4830
4820
  // src/providers/bungee/BungeeBridgeProvider.ts
4831
- var import_sdk_config9 = require("@cowprotocol/sdk-config");
4821
+ var import_sdk_config8 = require("@cowprotocol/sdk-config");
4832
4822
  var import_sdk_cow_shed2 = require("@cowprotocol/sdk-cow-shed");
4833
4823
  var import_sdk_common16 = require("@cowprotocol/sdk-common");
4834
4824
  var BUNGEE_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX2}/bungee`;
4835
- var BUNGEE_SUPPORTED_NETWORKS = [import_sdk_config9.mainnet, import_sdk_config9.polygon, import_sdk_config9.arbitrumOne, import_sdk_config9.base, import_sdk_config9.optimism, import_sdk_config9.avalanche, import_sdk_config9.gnosisChain];
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];
4836
4826
  var SLIPPAGE_TOLERANCE_BPS2 = 0;
4837
4827
  var providerType2 = "HookBridgeProvider";
4838
4828
  var BungeeBridgeProvider = class {
@@ -4987,13 +4977,13 @@ var BungeeBridgeProvider = class {
4987
4977
  }
4988
4978
  isExtraGasRequired(request) {
4989
4979
  const { sellTokenChainId, buyTokenChainId } = request;
4990
- return sellTokenChainId === import_sdk_config9.SupportedChainId.MAINNET && buyTokenChainId === import_sdk_config9.SupportedChainId.GNOSIS_CHAIN;
4980
+ return sellTokenChainId === import_sdk_config8.SupportedChainId.MAINNET && buyTokenChainId === import_sdk_config8.SupportedChainId.GNOSIS_CHAIN;
4991
4981
  }
4992
4982
  };
4993
4983
 
4994
4984
  // src/providers/near-intents/NearIntentsBridgeProvider.ts
4995
4985
  var import_sdk_common18 = require("@cowprotocol/sdk-common");
4996
- var import_sdk_config12 = require("@cowprotocol/sdk-config");
4986
+ var import_sdk_config11 = require("@cowprotocol/sdk-config");
4997
4987
  var import_sdk_cow_shed3 = require("@cowprotocol/sdk-cow-shed");
4998
4988
  var import_sdk_order_book8 = require("@cowprotocol/sdk-order-book");
4999
4989
  var import_one_click_sdk_typescript2 = require("@defuse-protocol/one-click-sdk-typescript");
@@ -5055,29 +5045,29 @@ var NearIntentsApi = class {
5055
5045
  };
5056
5046
 
5057
5047
  // src/providers/near-intents/const/index.ts
5058
- var import_sdk_config10 = require("@cowprotocol/sdk-config");
5048
+ var import_sdk_config9 = require("@cowprotocol/sdk-config");
5059
5049
  var NEAR_INTENTS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
5060
5050
  var NEAR_INTENTS_SUPPORTED_NETWORKS = [
5061
- import_sdk_config10.arbitrumOne,
5062
- import_sdk_config10.avalanche,
5063
- import_sdk_config10.base,
5064
- import_sdk_config10.bnb,
5065
- import_sdk_config10.gnosisChain,
5066
- import_sdk_config10.mainnet,
5067
- import_sdk_config10.optimism,
5068
- import_sdk_config10.polygon,
5069
- import_sdk_config10.plasma
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
5070
5060
  ];
5071
5061
  var NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS = {
5072
- arb: import_sdk_config10.arbitrumOne.id,
5073
- avax: import_sdk_config10.avalanche.id,
5074
- base: import_sdk_config10.base.id,
5075
- bsc: import_sdk_config10.bnb.id,
5076
- eth: import_sdk_config10.mainnet.id,
5077
- gnosis: import_sdk_config10.gnosisChain.id,
5078
- op: import_sdk_config10.optimism.id,
5079
- pol: import_sdk_config10.polygon.id,
5080
- plasma: import_sdk_config10.plasma.id
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
5081
5071
  };
5082
5072
  var NEAR_INTENTS_STATUS_TO_COW_STATUS = {
5083
5073
  KNOWN_DEPOSIT_TX: "in_progress" /* IN_PROGRESS */,
@@ -5095,7 +5085,7 @@ var ATTESTATOR_ADDRESS = "0x0073DD100b51C555E41B2a452E5933ef76F42790";
5095
5085
  // src/providers/near-intents/util.ts
5096
5086
  var import_json_stable_stringify3 = __toESM(require("json-stable-stringify"));
5097
5087
  var import_sdk_common17 = require("@cowprotocol/sdk-common");
5098
- var import_sdk_config11 = require("@cowprotocol/sdk-config");
5088
+ var import_sdk_config10 = require("@cowprotocol/sdk-config");
5099
5089
  var calculateDeadline = (seconds) => {
5100
5090
  const secs = Number(seconds);
5101
5091
  if (!Number.isFinite(secs)) {
@@ -5108,7 +5098,7 @@ var adaptToken = (token) => {
5108
5098
  const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
5109
5099
  if (!chainId)
5110
5100
  return null;
5111
- const tokenAddress = token.contractAddress || import_sdk_config11.ETH_ADDRESS;
5101
+ const tokenAddress = token.contractAddress || import_sdk_config10.ETH_ADDRESS;
5112
5102
  if (!tokenAddress)
5113
5103
  return null;
5114
5104
  return {
@@ -5128,17 +5118,17 @@ var adaptTokens = (tokens) => tokens.reduce((acc, token) => {
5128
5118
  return acc;
5129
5119
  }, []);
5130
5120
  var getTokenByAddressAndChainId = (tokens, targetTokenAddress, targetTokenChainId) => {
5131
- if (!(0, import_sdk_config11.isEvmChain)(targetTokenChainId)) {
5121
+ if (!(0, import_sdk_config10.isEvmChain)(targetTokenChainId)) {
5132
5122
  return void 0;
5133
5123
  }
5134
5124
  return tokens.find((token) => {
5135
5125
  const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
5136
5126
  if (!chainId)
5137
5127
  return false;
5138
- if (targetTokenAddress.toLowerCase() === import_sdk_config11.ETH_ADDRESS.toLowerCase()) {
5128
+ if (targetTokenAddress.toLowerCase() === import_sdk_config10.ETH_ADDRESS.toLowerCase()) {
5139
5129
  return chainId === targetTokenChainId && !token.contractAddress;
5140
5130
  }
5141
- const tokenAddress = token.contractAddress || import_sdk_config11.ETH_ADDRESS;
5131
+ const tokenAddress = token.contractAddress || import_sdk_config10.ETH_ADDRESS;
5142
5132
  return tokenAddress?.toLowerCase() === targetTokenAddress.toLowerCase() && chainId === targetTokenChainId;
5143
5133
  });
5144
5134
  };
@@ -5187,7 +5177,7 @@ var hashQuote = ({
5187
5177
  };
5188
5178
 
5189
5179
  // src/providers/near-intents/NearIntentsBridgeProvider.ts
5190
- var import_sdk_config13 = require("@cowprotocol/sdk-config");
5180
+ var import_sdk_config12 = require("@cowprotocol/sdk-config");
5191
5181
  var NEAR_INTENTS_HOOK_DAPP_ID2 = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
5192
5182
  var REFERRAL = "cow";
5193
5183
  var providerType3 = "ReceiverAccountBridgeProvider";
@@ -5357,7 +5347,7 @@ var NearIntentsBridgeProvider = class {
5357
5347
  if (!adaptedInput?.chainId || !adaptedOutput?.chainId) {
5358
5348
  throw new Error("Token not supported");
5359
5349
  }
5360
- if (!(0, import_sdk_config13.isEvmChain)(adaptedInput.chainId) || !(0, import_sdk_config13.isEvmChain)(adaptedOutput.chainId)) {
5350
+ if (!(0, import_sdk_config12.isEvmChain)(adaptedInput.chainId) || !(0, import_sdk_config12.isEvmChain)(adaptedOutput.chainId)) {
5361
5351
  throw new Error("Non-EVM chains are not supported for BridgingDepositParams");
5362
5352
  }
5363
5353
  return {
@@ -5367,8 +5357,8 @@ var NearIntentsBridgeProvider = class {
5367
5357
  fillTxHash: status.swapDetails?.destinationChainTxHashes?.[0]?.hash
5368
5358
  },
5369
5359
  params: {
5370
- inputTokenAddress: inputToken.contractAddress ?? import_sdk_config12.ETH_ADDRESS,
5371
- outputTokenAddress: outputToken.contractAddress ?? import_sdk_config12.ETH_ADDRESS,
5360
+ inputTokenAddress: inputToken.contractAddress ?? import_sdk_config11.ETH_ADDRESS,
5361
+ outputTokenAddress: outputToken.contractAddress ?? import_sdk_config11.ETH_ADDRESS,
5372
5362
  inputAmount: BigInt(quote.amountIn),
5373
5363
  outputAmount: swapDetails.amountOut ? BigInt(swapDetails.amountOut) : BigInt(quote.amountOut),
5374
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) {
@@ -1505,8 +1506,6 @@ var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
1505
1506
  [SupportedChainId2.SEPOLIA]: "0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662",
1506
1507
  // https://docs.across.to/reference/contract-addresses/polygon-chain-id-137
1507
1508
  [SupportedChainId2.POLYGON]: "0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096",
1508
- // https://docs.across.to/reference/contract-addresses/lens-chain
1509
- [SupportedChainId2.LENS]: "0xb234cA484866c811d0e6D3318866F583781ED045",
1510
1509
  // https://docs.across.to/reference/contract-addresses/bnb-smart-chain
1511
1510
  [SupportedChainId2.BNB]: "0x4e8E101924eDE233C13e2D8622DC8aED2872d505",
1512
1511
  // https://docs.across.to/reference/contract-addresses/linea-chain-id-59144
@@ -1534,8 +1533,6 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1534
1533
  [SupportedChainId2.SEPOLIA]: void 0,
1535
1534
  [SupportedChainId2.POLYGON]: void 0,
1536
1535
  [SupportedChainId2.AVALANCHE]: void 0,
1537
- [SupportedChainId2.LENS]: void 0,
1538
- // TODO: confirm
1539
1536
  [SupportedChainId2.BNB]: void 0,
1540
1537
  // TODO: confirm
1541
1538
  [SupportedChainId2.LINEA]: void 0,
@@ -1550,9 +1547,8 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1550
1547
  };
1551
1548
 
1552
1549
  // src/providers/across/util.ts
1553
- import { COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS } from "@cowprotocol/sdk-config";
1554
1550
  import { OrderKind as OrderKind2 } from "@cowprotocol/sdk-order-book";
1555
- import { getGlobalAdapter as getGlobalAdapter5 } from "@cowprotocol/sdk-common";
1551
+ import { areAddressesEqual as areAddressesEqual2, getGlobalAdapter as getGlobalAdapter5, isCoWSettlementContract } from "@cowprotocol/sdk-common";
1556
1552
  import stringify from "json-stable-stringify";
1557
1553
  var PCT_100_PERCENT = 10n ** 18n;
1558
1554
  function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
@@ -1685,10 +1681,10 @@ function getAcrossDepositEvents(chainId, logs) {
1685
1681
  };
1686
1682
  });
1687
1683
  }
1688
- function getCowTradeEvents(chainId, logs) {
1684
+ function getCowTradeEvents(chainId, logs, settlementContractOverride) {
1689
1685
  const COW_TRADE_EVENT_TOPIC = COW_TRADE_EVENT_INTERFACE().getEventTopic("Trade");
1690
1686
  const cowTradeEvents = logs.filter((log7) => {
1691
- return log7.address.toLowerCase() === COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[chainId].toLowerCase() && log7.topics[0] === COW_TRADE_EVENT_TOPIC;
1687
+ return (isCoWSettlementContract(log7.address, chainId) || areAddressesEqual2(settlementContractOverride?.[chainId], log7.address)) && log7.topics[0] === COW_TRADE_EVENT_TOPIC;
1692
1688
  });
1693
1689
  return cowTradeEvents.map((event) => {
1694
1690
  const parsedLog = COW_TRADE_EVENT_INTERFACE().parseLog(event);
@@ -3567,12 +3563,12 @@ function createAcrossDepositCall(params) {
3567
3563
 
3568
3564
  // src/providers/across/getDepositParams.ts
3569
3565
  import { log as log5 } from "@cowprotocol/sdk-common";
3570
- async function getDepositParams(chainId, orderId, txReceipt) {
3566
+ async function getDepositParams(chainId, orderId, txReceipt, settlementContractOverride) {
3571
3567
  const depositEvents = getAcrossDepositEvents(chainId, txReceipt.logs);
3572
3568
  if (depositEvents.length === 0) {
3573
3569
  return null;
3574
3570
  }
3575
- const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs);
3571
+ const cowTradeEvents = getCowTradeEvents(chainId, txReceipt.logs, settlementContractOverride);
3576
3572
  const orderTradeIndex = cowTradeEvents.findIndex((event) => event.orderUid === orderId);
3577
3573
  if (orderTradeIndex < 0)
3578
3574
  return null;
@@ -3733,7 +3729,7 @@ var AcrossBridgeProvider = class {
3733
3729
  async decodeBridgeHook(_hook) {
3734
3730
  throw new Error("Not implemented");
3735
3731
  }
3736
- async getBridgingParams(chainId, order, txHash) {
3732
+ async getBridgingParams(chainId, order, txHash, settlementContractOverride) {
3737
3733
  if (!isSupportedChain(chainId)) {
3738
3734
  return null;
3739
3735
  }
@@ -3742,7 +3738,7 @@ var AcrossBridgeProvider = class {
3742
3738
  const txReceipt = await adapter.getTransactionReceipt(txHash);
3743
3739
  if (!txReceipt)
3744
3740
  return null;
3745
- const params = await getDepositParams(chainId, orderUid, txReceipt);
3741
+ const params = await getDepositParams(chainId, orderUid, txReceipt, settlementContractOverride);
3746
3742
  if (!params)
3747
3743
  return null;
3748
3744
  return {
@@ -3980,72 +3976,66 @@ var getBungeeBridgeFromDisplayName = (displayName) => {
3980
3976
  };
3981
3977
 
3982
3978
  // src/providers/bungee/const/contracts.ts
3983
- import { AdditionalTargetChainId as AdditionalTargetChainId2, SupportedChainId as SupportedChainId5 } from "@cowprotocol/sdk-config";
3979
+ import { AdditionalTargetChainId as AdditionalTargetChainId2, SupportedChainId as SupportedChainId4 } from "@cowprotocol/sdk-config";
3984
3980
  var BUNGEE_COWSWAP_LIB_ADDRESS = "0x75b6ba5fcab20848ca00f132d253638fea82e598";
3985
3981
  var BungeeCowswapLibAddresses = {
3986
- [SupportedChainId5.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
3987
- [SupportedChainId5.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
3988
- [SupportedChainId5.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
3989
- [SupportedChainId5.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
3990
- [SupportedChainId5.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
3991
- [SupportedChainId5.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
3992
- [SupportedChainId5.LENS]: void 0,
3993
- // TODO: confirm
3994
- [SupportedChainId5.BNB]: void 0,
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,
3995
3989
  // TODO: confirm
3996
- [SupportedChainId5.LINEA]: void 0,
3990
+ [SupportedChainId4.LINEA]: void 0,
3997
3991
  // TODO: confirm
3998
- [SupportedChainId5.PLASMA]: void 0,
3992
+ [SupportedChainId4.PLASMA]: void 0,
3999
3993
  // TODO: confirm
4000
- [SupportedChainId5.INK]: void 0,
3994
+ [SupportedChainId4.INK]: void 0,
4001
3995
  // TODO: confirm
4002
- [SupportedChainId5.SEPOLIA]: void 0,
3996
+ [SupportedChainId4.SEPOLIA]: void 0,
4003
3997
  [AdditionalTargetChainId2.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
4004
3998
  [AdditionalTargetChainId2.BITCOIN]: void 0,
4005
3999
  [AdditionalTargetChainId2.SOLANA]: void 0
4006
4000
  };
4007
4001
  var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
4008
4002
  var SocketVerifierAddresses = {
4009
- [SupportedChainId5.MAINNET]: SOCKET_VERIFIER_ADDRESS,
4010
- [SupportedChainId5.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
4011
- [SupportedChainId5.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
4012
- [SupportedChainId5.BASE]: SOCKET_VERIFIER_ADDRESS,
4013
- [SupportedChainId5.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
4014
- [SupportedChainId5.POLYGON]: SOCKET_VERIFIER_ADDRESS,
4015
- [SupportedChainId5.LENS]: void 0,
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,
4016
4010
  // TODO: confirm
4017
- [SupportedChainId5.BNB]: void 0,
4011
+ [SupportedChainId4.LINEA]: void 0,
4018
4012
  // TODO: confirm
4019
- [SupportedChainId5.LINEA]: void 0,
4013
+ [SupportedChainId4.PLASMA]: void 0,
4020
4014
  // TODO: confirm
4021
- [SupportedChainId5.PLASMA]: void 0,
4015
+ [SupportedChainId4.INK]: void 0,
4022
4016
  // TODO: confirm
4023
- [SupportedChainId5.INK]: void 0,
4024
- // TODO: confirm
4025
- [SupportedChainId5.SEPOLIA]: void 0,
4017
+ [SupportedChainId4.SEPOLIA]: void 0,
4026
4018
  [AdditionalTargetChainId2.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
4027
4019
  [AdditionalTargetChainId2.BITCOIN]: void 0,
4028
4020
  [AdditionalTargetChainId2.SOLANA]: void 0
4029
4021
  };
4030
4022
  var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
4031
4023
  var BungeeApproveAndBridgeV1Addresses = {
4032
- [SupportedChainId5.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4033
- [SupportedChainId5.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4034
- [SupportedChainId5.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4035
- [SupportedChainId5.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4036
- [SupportedChainId5.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4037
- [SupportedChainId5.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4038
- [SupportedChainId5.LENS]: void 0,
4039
- // TODO: confirm
4040
- [SupportedChainId5.BNB]: void 0,
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,
4041
4031
  // TODO: confirm
4042
- [SupportedChainId5.LINEA]: void 0,
4032
+ [SupportedChainId4.LINEA]: void 0,
4043
4033
  // TODO: confirm
4044
- [SupportedChainId5.PLASMA]: void 0,
4034
+ [SupportedChainId4.PLASMA]: void 0,
4045
4035
  // TODO: confirm
4046
- [SupportedChainId5.INK]: void 0,
4036
+ [SupportedChainId4.INK]: void 0,
4047
4037
  // TODO: confirm
4048
- [SupportedChainId5.SEPOLIA]: void 0,
4038
+ [SupportedChainId4.SEPOLIA]: void 0,
4049
4039
  [AdditionalTargetChainId2.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4050
4040
  [AdditionalTargetChainId2.BITCOIN]: void 0,
4051
4041
  [AdditionalTargetChainId2.SOLANA]: void 0
@@ -4786,7 +4776,7 @@ import {
4786
4776
  mainnet as mainnet2,
4787
4777
  optimism as optimism2,
4788
4778
  polygon as polygon2,
4789
- SupportedChainId as SupportedChainId6
4779
+ SupportedChainId as SupportedChainId5
4790
4780
  } from "@cowprotocol/sdk-config";
4791
4781
  import { CowShedSdk as CowShedSdk2 } from "@cowprotocol/sdk-cow-shed";
4792
4782
  import { setGlobalAdapter as setGlobalAdapter3 } from "@cowprotocol/sdk-common";
@@ -4946,7 +4936,7 @@ var BungeeBridgeProvider = class {
4946
4936
  }
4947
4937
  isExtraGasRequired(request) {
4948
4938
  const { sellTokenChainId, buyTokenChainId } = request;
4949
- return sellTokenChainId === SupportedChainId6.MAINNET && buyTokenChainId === SupportedChainId6.GNOSIS_CHAIN;
4939
+ return sellTokenChainId === SupportedChainId5.MAINNET && buyTokenChainId === SupportedChainId5.GNOSIS_CHAIN;
4950
4940
  }
4951
4941
  };
4952
4942
 
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-bridging",
3
- "version": "2.1.1",
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.7",
20
- "@cowprotocol/sdk-common": "0.7.0",
21
- "@cowprotocol/sdk-config": "0.10.0",
22
- "@cowprotocol/sdk-contracts-ts": "1.8.0",
23
- "@cowprotocol/sdk-order-book": "1.1.2",
24
- "@cowprotocol/sdk-cow-shed": "0.2.21",
25
- "@cowprotocol/sdk-trading": "1.0.3",
26
- "@cowprotocol/sdk-weiroll": "0.1.21"
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
- "@cowprotocol/sdk-ethers-v5-adapter": "0.3.10",
42
- "@cow-sdk/typescript-config": "0.0.0-beta.0",
43
- "@cowprotocol/sdk-ethers-v6-adapter": "0.3.10",
44
- "@cowprotocol/sdk-order-signing": "0.1.37",
45
- "@cowprotocol/sdk-viem-adapter": "0.3.10"
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
+ }