@cowprotocol/sdk-bridging 2.0.0 → 2.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.js CHANGED
@@ -1577,7 +1577,9 @@ var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
1577
1577
  // Not supported chains
1578
1578
  // TODO: This first integration is a draft, some of this chains might be supported, so we will need to update here as we iterate on the provider
1579
1579
  [import_sdk_config4.SupportedChainId.GNOSIS_CHAIN]: void 0,
1580
- [import_sdk_config4.SupportedChainId.AVALANCHE]: void 0
1580
+ [import_sdk_config4.SupportedChainId.AVALANCHE]: void 0,
1581
+ [import_sdk_config4.AdditionalTargetChainId.BITCOIN]: void 0,
1582
+ [import_sdk_config4.AdditionalTargetChainId.SOLANA]: void 0
1581
1583
  };
1582
1584
  var ACROSS_MATH_CONTRACT_ADDRESSES = {
1583
1585
  [import_sdk_config4.SupportedChainId.MAINNET]: "0xf2ae6728b6f146556977Af0A68bFbf5bADA22863",
@@ -1588,7 +1590,6 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1588
1590
  [import_sdk_config4.SupportedChainId.GNOSIS_CHAIN]: void 0,
1589
1591
  [import_sdk_config4.SupportedChainId.SEPOLIA]: void 0,
1590
1592
  [import_sdk_config4.SupportedChainId.POLYGON]: void 0,
1591
- [import_sdk_config4.AdditionalTargetChainId.OPTIMISM]: void 0,
1592
1593
  [import_sdk_config4.SupportedChainId.AVALANCHE]: void 0,
1593
1594
  [import_sdk_config4.SupportedChainId.LENS]: void 0,
1594
1595
  // TODO: confirm
@@ -1598,8 +1599,11 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1598
1599
  // TODO: confirm
1599
1600
  [import_sdk_config4.SupportedChainId.PLASMA]: void 0,
1600
1601
  // TODO: confirm
1601
- [import_sdk_config4.SupportedChainId.INK]: void 0
1602
+ [import_sdk_config4.SupportedChainId.INK]: void 0,
1602
1603
  // TODO: confirm
1604
+ [import_sdk_config4.AdditionalTargetChainId.OPTIMISM]: void 0,
1605
+ [import_sdk_config4.AdditionalTargetChainId.BITCOIN]: void 0,
1606
+ [import_sdk_config4.AdditionalTargetChainId.SOLANA]: void 0
1603
1607
  };
1604
1608
 
1605
1609
  // src/providers/across/util.ts
@@ -3780,6 +3784,9 @@ var AcrossBridgeProvider = class {
3780
3784
  throw new Error("Not implemented");
3781
3785
  }
3782
3786
  async getBridgingParams(chainId, order, txHash) {
3787
+ if (!(0, import_sdk_config6.isSupportedChain)(chainId)) {
3788
+ return null;
3789
+ }
3783
3790
  const orderUid = order.uid;
3784
3791
  const adapter = (0, import_sdk_common13.getGlobalAdapter)();
3785
3792
  const txReceipt = await adapter.getTransactionReceipt(txHash);
@@ -4043,7 +4050,9 @@ var BungeeCowswapLibAddresses = {
4043
4050
  [import_sdk_config7.SupportedChainId.INK]: void 0,
4044
4051
  // TODO: confirm
4045
4052
  [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4046
- [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS
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
4047
4056
  };
4048
4057
  var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
4049
4058
  var SocketVerifierAddresses = {
@@ -4064,7 +4073,9 @@ var SocketVerifierAddresses = {
4064
4073
  [import_sdk_config7.SupportedChainId.INK]: void 0,
4065
4074
  // TODO: confirm
4066
4075
  [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4067
- [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: SOCKET_VERIFIER_ADDRESS
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
4068
4079
  };
4069
4080
  var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
4070
4081
  var BungeeApproveAndBridgeV1Addresses = {
@@ -4085,7 +4096,9 @@ var BungeeApproveAndBridgeV1Addresses = {
4085
4096
  [import_sdk_config7.SupportedChainId.INK]: void 0,
4086
4097
  // TODO: confirm
4087
4098
  [import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
4088
- [import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS
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
4089
4102
  };
4090
4103
 
4091
4104
  // src/providers/bungee/abi.ts
@@ -5115,6 +5128,9 @@ var adaptTokens = (tokens) => tokens.reduce((acc, token) => {
5115
5128
  return acc;
5116
5129
  }, []);
5117
5130
  var getTokenByAddressAndChainId = (tokens, targetTokenAddress, targetTokenChainId) => {
5131
+ if (!(0, import_sdk_config11.isEvmChain)(targetTokenChainId)) {
5132
+ return void 0;
5133
+ }
5118
5134
  return tokens.find((token) => {
5119
5135
  const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
5120
5136
  if (!chainId)
@@ -5171,6 +5187,7 @@ var hashQuote = ({
5171
5187
  };
5172
5188
 
5173
5189
  // src/providers/near-intents/NearIntentsBridgeProvider.ts
5190
+ var import_sdk_config13 = require("@cowprotocol/sdk-config");
5174
5191
  var NEAR_INTENTS_HOOK_DAPP_ID2 = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
5175
5192
  var REFERRAL = "cow";
5176
5193
  var providerType3 = "ReceiverAccountBridgeProvider";
@@ -5340,6 +5357,9 @@ var NearIntentsBridgeProvider = class {
5340
5357
  if (!adaptedInput?.chainId || !adaptedOutput?.chainId) {
5341
5358
  throw new Error("Token not supported");
5342
5359
  }
5360
+ if (!(0, import_sdk_config13.isEvmChain)(adaptedInput.chainId) || !(0, import_sdk_config13.isEvmChain)(adaptedOutput.chainId)) {
5361
+ throw new Error("Non-EVM chains are not supported for BridgingDepositParams");
5362
+ }
5343
5363
  return {
5344
5364
  status: {
5345
5365
  fillTimeInSeconds: quote.timeEstimate,
package/dist/index.mjs CHANGED
@@ -1520,7 +1520,9 @@ var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
1520
1520
  // Not supported chains
1521
1521
  // TODO: This first integration is a draft, some of this chains might be supported, so we will need to update here as we iterate on the provider
1522
1522
  [SupportedChainId2.GNOSIS_CHAIN]: void 0,
1523
- [SupportedChainId2.AVALANCHE]: void 0
1523
+ [SupportedChainId2.AVALANCHE]: void 0,
1524
+ [AdditionalTargetChainId.BITCOIN]: void 0,
1525
+ [AdditionalTargetChainId.SOLANA]: void 0
1524
1526
  };
1525
1527
  var ACROSS_MATH_CONTRACT_ADDRESSES = {
1526
1528
  [SupportedChainId2.MAINNET]: "0xf2ae6728b6f146556977Af0A68bFbf5bADA22863",
@@ -1531,7 +1533,6 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1531
1533
  [SupportedChainId2.GNOSIS_CHAIN]: void 0,
1532
1534
  [SupportedChainId2.SEPOLIA]: void 0,
1533
1535
  [SupportedChainId2.POLYGON]: void 0,
1534
- [AdditionalTargetChainId.OPTIMISM]: void 0,
1535
1536
  [SupportedChainId2.AVALANCHE]: void 0,
1536
1537
  [SupportedChainId2.LENS]: void 0,
1537
1538
  // TODO: confirm
@@ -1541,8 +1542,11 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1541
1542
  // TODO: confirm
1542
1543
  [SupportedChainId2.PLASMA]: void 0,
1543
1544
  // TODO: confirm
1544
- [SupportedChainId2.INK]: void 0
1545
+ [SupportedChainId2.INK]: void 0,
1545
1546
  // TODO: confirm
1547
+ [AdditionalTargetChainId.OPTIMISM]: void 0,
1548
+ [AdditionalTargetChainId.BITCOIN]: void 0,
1549
+ [AdditionalTargetChainId.SOLANA]: void 0
1546
1550
  };
1547
1551
 
1548
1552
  // src/providers/across/util.ts
@@ -3617,7 +3621,8 @@ import {
3617
3621
  base,
3618
3622
  mainnet,
3619
3623
  optimism,
3620
- polygon
3624
+ polygon,
3625
+ isSupportedChain
3621
3626
  } from "@cowprotocol/sdk-config";
3622
3627
  import { CowShedSdk } from "@cowprotocol/sdk-cow-shed";
3623
3628
  import { OrderKind as OrderKind3 } from "@cowprotocol/sdk-order-book";
@@ -3729,6 +3734,9 @@ var AcrossBridgeProvider = class {
3729
3734
  throw new Error("Not implemented");
3730
3735
  }
3731
3736
  async getBridgingParams(chainId, order, txHash) {
3737
+ if (!isSupportedChain(chainId)) {
3738
+ return null;
3739
+ }
3732
3740
  const orderUid = order.uid;
3733
3741
  const adapter = getGlobalAdapter8();
3734
3742
  const txReceipt = await adapter.getTransactionReceipt(txHash);
@@ -3992,7 +4000,9 @@ var BungeeCowswapLibAddresses = {
3992
4000
  [SupportedChainId5.INK]: void 0,
3993
4001
  // TODO: confirm
3994
4002
  [SupportedChainId5.SEPOLIA]: void 0,
3995
- [AdditionalTargetChainId2.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS
4003
+ [AdditionalTargetChainId2.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS,
4004
+ [AdditionalTargetChainId2.BITCOIN]: void 0,
4005
+ [AdditionalTargetChainId2.SOLANA]: void 0
3996
4006
  };
3997
4007
  var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
3998
4008
  var SocketVerifierAddresses = {
@@ -4013,7 +4023,9 @@ var SocketVerifierAddresses = {
4013
4023
  [SupportedChainId5.INK]: void 0,
4014
4024
  // TODO: confirm
4015
4025
  [SupportedChainId5.SEPOLIA]: void 0,
4016
- [AdditionalTargetChainId2.OPTIMISM]: SOCKET_VERIFIER_ADDRESS
4026
+ [AdditionalTargetChainId2.OPTIMISM]: SOCKET_VERIFIER_ADDRESS,
4027
+ [AdditionalTargetChainId2.BITCOIN]: void 0,
4028
+ [AdditionalTargetChainId2.SOLANA]: void 0
4017
4029
  };
4018
4030
  var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
4019
4031
  var BungeeApproveAndBridgeV1Addresses = {
@@ -4034,7 +4046,9 @@ var BungeeApproveAndBridgeV1Addresses = {
4034
4046
  [SupportedChainId5.INK]: void 0,
4035
4047
  // TODO: confirm
4036
4048
  [SupportedChainId5.SEPOLIA]: void 0,
4037
- [AdditionalTargetChainId2.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS
4049
+ [AdditionalTargetChainId2.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
4050
+ [AdditionalTargetChainId2.BITCOIN]: void 0,
4051
+ [AdditionalTargetChainId2.SOLANA]: void 0
4038
4052
  };
4039
4053
 
4040
4054
  // src/providers/bungee/abi.ts
@@ -5040,7 +5054,7 @@ var ATTESTATOR_ADDRESS = "0x0073DD100b51C555E41B2a452E5933ef76F42790";
5040
5054
  // src/providers/near-intents/util.ts
5041
5055
  import stringify3 from "json-stable-stringify";
5042
5056
  import { getGlobalAdapter as getGlobalAdapter11 } from "@cowprotocol/sdk-common";
5043
- import { ETH_ADDRESS as ETH_ADDRESS2 } from "@cowprotocol/sdk-config";
5057
+ import { ETH_ADDRESS as ETH_ADDRESS2, isEvmChain } from "@cowprotocol/sdk-config";
5044
5058
  var calculateDeadline = (seconds) => {
5045
5059
  const secs = Number(seconds);
5046
5060
  if (!Number.isFinite(secs)) {
@@ -5073,6 +5087,9 @@ var adaptTokens = (tokens) => tokens.reduce((acc, token) => {
5073
5087
  return acc;
5074
5088
  }, []);
5075
5089
  var getTokenByAddressAndChainId = (tokens, targetTokenAddress, targetTokenChainId) => {
5090
+ if (!isEvmChain(targetTokenChainId)) {
5091
+ return void 0;
5092
+ }
5076
5093
  return tokens.find((token) => {
5077
5094
  const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
5078
5095
  if (!chainId)
@@ -5129,6 +5146,7 @@ var hashQuote = ({
5129
5146
  };
5130
5147
 
5131
5148
  // src/providers/near-intents/NearIntentsBridgeProvider.ts
5149
+ import { isEvmChain as isEvmChain2 } from "@cowprotocol/sdk-config";
5132
5150
  var NEAR_INTENTS_HOOK_DAPP_ID2 = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
5133
5151
  var REFERRAL = "cow";
5134
5152
  var providerType3 = "ReceiverAccountBridgeProvider";
@@ -5298,6 +5316,9 @@ var NearIntentsBridgeProvider = class {
5298
5316
  if (!adaptedInput?.chainId || !adaptedOutput?.chainId) {
5299
5317
  throw new Error("Token not supported");
5300
5318
  }
5319
+ if (!isEvmChain2(adaptedInput.chainId) || !isEvmChain2(adaptedOutput.chainId)) {
5320
+ throw new Error("Non-EVM chains are not supported for BridgingDepositParams");
5321
+ }
5301
5322
  return {
5302
5323
  status: {
5303
5324
  fillTimeInSeconds: quote.timeEstimate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-bridging",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Bridging for CoW Protocol",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -16,14 +16,14 @@
16
16
  "dependencies": {
17
17
  "@defuse-protocol/one-click-sdk-typescript": "0.1.1-0.2",
18
18
  "json-stable-stringify": "^1.3.0",
19
- "@cowprotocol/sdk-app-data": "4.6.5",
20
- "@cowprotocol/sdk-common": "0.6.2",
21
- "@cowprotocol/sdk-cow-shed": "0.2.19",
22
- "@cowprotocol/sdk-contracts-ts": "1.6.1",
23
- "@cowprotocol/sdk-order-book": "1.0.0",
24
- "@cowprotocol/sdk-config": "0.8.1",
25
- "@cowprotocol/sdk-trading": "1.0.0",
26
- "@cowprotocol/sdk-weiroll": "0.1.19"
19
+ "@cowprotocol/sdk-app-data": "4.6.7",
20
+ "@cowprotocol/sdk-config": "0.10.0",
21
+ "@cowprotocol/sdk-contracts-ts": "1.8.0",
22
+ "@cowprotocol/sdk-common": "0.7.0",
23
+ "@cowprotocol/sdk-cow-shed": "0.2.21",
24
+ "@cowprotocol/sdk-order-book": "1.1.1",
25
+ "@cowprotocol/sdk-trading": "1.0.2",
26
+ "@cowprotocol/sdk-weiroll": "0.1.21"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^29.4.0",
@@ -38,11 +38,11 @@
38
38
  "tsup": "^7.2.0",
39
39
  "typescript": "^5.2.2",
40
40
  "viem": "^2.28.4",
41
- "@cowprotocol/sdk-ethers-v5-adapter": "0.3.8",
42
41
  "@cow-sdk/typescript-config": "0.0.0-beta.0",
43
- "@cowprotocol/sdk-ethers-v6-adapter": "0.3.8",
44
- "@cowprotocol/sdk-viem-adapter": "0.3.8",
45
- "@cowprotocol/sdk-order-signing": "0.1.34"
42
+ "@cowprotocol/sdk-ethers-v5-adapter": "0.3.10",
43
+ "@cowprotocol/sdk-ethers-v6-adapter": "0.3.10",
44
+ "@cowprotocol/sdk-order-signing": "0.1.36",
45
+ "@cowprotocol/sdk-viem-adapter": "0.3.10"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup src/index.ts --format esm,cjs --dts",