@cowprotocol/sdk-bridging 0.10.1 → 0.11.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 +224 -101
- package/dist/index.mjs +186 -63
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -220,7 +220,7 @@ async function getCrossChainOrder(params) {
|
|
|
220
220
|
// src/BridgingSdk/BridgingSdk.ts
|
|
221
221
|
var import_sdk_trading2 = require("@cowprotocol/sdk-trading");
|
|
222
222
|
var import_sdk_order_book2 = require("@cowprotocol/sdk-order-book");
|
|
223
|
-
var
|
|
223
|
+
var import_sdk_config3 = require("@cowprotocol/sdk-config");
|
|
224
224
|
var import_sdk_common5 = require("@cowprotocol/sdk-common");
|
|
225
225
|
|
|
226
226
|
// src/BridgingSdk/helpers.ts
|
|
@@ -293,6 +293,128 @@ function getHookMockForCostEstimation(gasLimit) {
|
|
|
293
293
|
|
|
294
294
|
// src/BridgingSdk/getIntermediateSwapResult.ts
|
|
295
295
|
var import_sdk_common3 = require("@cowprotocol/sdk-common");
|
|
296
|
+
|
|
297
|
+
// src/BridgingSdk/tokenPriority.ts
|
|
298
|
+
var import_sdk_config2 = require("@cowprotocol/sdk-config");
|
|
299
|
+
var PRIORITY_STABLECOIN_TOKENS = {
|
|
300
|
+
[import_sdk_config2.SupportedChainId.MAINNET]: /* @__PURE__ */ new Set([
|
|
301
|
+
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
302
|
+
// USDC
|
|
303
|
+
"0xdac17f958d2ee523a2206206994597c13d831ec7"
|
|
304
|
+
// USDT
|
|
305
|
+
]),
|
|
306
|
+
[import_sdk_config2.SupportedChainId.BNB]: /* @__PURE__ */ new Set([
|
|
307
|
+
"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
308
|
+
// USDC
|
|
309
|
+
"0x55d398326f99059ff775485246999027b3197955"
|
|
310
|
+
// USDT
|
|
311
|
+
]),
|
|
312
|
+
[import_sdk_config2.SupportedChainId.GNOSIS_CHAIN]: /* @__PURE__ */ new Set([
|
|
313
|
+
"0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
|
|
314
|
+
// USDC
|
|
315
|
+
"0x2a22f9c3b484c3629090feed35f17ff8f88f76f0",
|
|
316
|
+
// USDC.e
|
|
317
|
+
"0x4ecaba5870353805a9f068101a40e0f32ed605c6"
|
|
318
|
+
// USDT
|
|
319
|
+
]),
|
|
320
|
+
[import_sdk_config2.SupportedChainId.POLYGON]: /* @__PURE__ */ new Set([
|
|
321
|
+
"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
|
|
322
|
+
// USDC
|
|
323
|
+
"0xc2132d05d31c914a87c6611c10748aeb04b58e8f"
|
|
324
|
+
// USDT
|
|
325
|
+
]),
|
|
326
|
+
[import_sdk_config2.SupportedChainId.BASE]: /* @__PURE__ */ new Set([
|
|
327
|
+
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
328
|
+
// USDC
|
|
329
|
+
"0xfde4c96c8593536e31f229ea8f37b2ada2699bb2"
|
|
330
|
+
// USDT
|
|
331
|
+
]),
|
|
332
|
+
[import_sdk_config2.SupportedChainId.ARBITRUM_ONE]: /* @__PURE__ */ new Set([
|
|
333
|
+
"0xaf88d065e77c8cc2239327c5edb3a432268e5831",
|
|
334
|
+
// USDC
|
|
335
|
+
"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
|
|
336
|
+
// USDT
|
|
337
|
+
]),
|
|
338
|
+
[import_sdk_config2.SupportedChainId.AVALANCHE]: /* @__PURE__ */ new Set([
|
|
339
|
+
"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
340
|
+
// USDC
|
|
341
|
+
"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7"
|
|
342
|
+
// USDT
|
|
343
|
+
]),
|
|
344
|
+
[import_sdk_config2.SupportedChainId.LINEA]: /* @__PURE__ */ new Set([
|
|
345
|
+
"0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
|
|
346
|
+
// USDC
|
|
347
|
+
"0xA219439258ca9da29E9Cc4cE5596924745e12B93"
|
|
348
|
+
// USDT
|
|
349
|
+
]),
|
|
350
|
+
[import_sdk_config2.SupportedChainId.SEPOLIA]: /* @__PURE__ */ new Set([
|
|
351
|
+
"0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"
|
|
352
|
+
// USDC
|
|
353
|
+
])
|
|
354
|
+
};
|
|
355
|
+
function isStablecoinPriorityToken(chainId, tokenAddress) {
|
|
356
|
+
const chainTokens = PRIORITY_STABLECOIN_TOKENS[chainId];
|
|
357
|
+
if (!chainTokens)
|
|
358
|
+
return false;
|
|
359
|
+
return chainTokens.has(tokenAddress.toLowerCase());
|
|
360
|
+
}
|
|
361
|
+
function isCorrelatedToken(tokenAddress, correlatedTokens) {
|
|
362
|
+
return correlatedTokens.has(tokenAddress.toLowerCase());
|
|
363
|
+
}
|
|
364
|
+
function isNativeToken(tokenAddress) {
|
|
365
|
+
return tokenAddress.toLowerCase() === import_sdk_config2.NATIVE_CURRENCY_ADDRESS.toLowerCase();
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// src/BridgingSdk/determineIntermediateToken.ts
|
|
369
|
+
async function determineIntermediateToken(sourceChainId, intermediateTokens, getCorrelatedTokens) {
|
|
370
|
+
const firstToken = intermediateTokens[0];
|
|
371
|
+
if (intermediateTokens.length === 0 || !firstToken) {
|
|
372
|
+
throw new BridgeProviderQuoteError("NO_INTERMEDIATE_TOKENS" /* NO_INTERMEDIATE_TOKENS */, { intermediateTokens });
|
|
373
|
+
}
|
|
374
|
+
if (intermediateTokens.length === 1) {
|
|
375
|
+
return firstToken;
|
|
376
|
+
}
|
|
377
|
+
const correlatedTokens = await resolveCorrelatedTokens(sourceChainId, getCorrelatedTokens);
|
|
378
|
+
const tokensWithPriority = intermediateTokens.map((token) => {
|
|
379
|
+
if (isStablecoinPriorityToken(token.chainId, token.address)) {
|
|
380
|
+
return { token, priority: 4 /* HIGHEST */ };
|
|
381
|
+
}
|
|
382
|
+
if (isCorrelatedToken(token.address, correlatedTokens)) {
|
|
383
|
+
return { token, priority: 3 /* HIGH */ };
|
|
384
|
+
}
|
|
385
|
+
if (isNativeToken(token.address)) {
|
|
386
|
+
return { token, priority: 2 /* MEDIUM */ };
|
|
387
|
+
}
|
|
388
|
+
return { token, priority: 1 /* LOW */ };
|
|
389
|
+
});
|
|
390
|
+
tokensWithPriority.sort((a, b) => {
|
|
391
|
+
if (a.priority !== b.priority) {
|
|
392
|
+
return b.priority - a.priority;
|
|
393
|
+
}
|
|
394
|
+
return intermediateTokens.indexOf(a.token) - intermediateTokens.indexOf(b.token);
|
|
395
|
+
});
|
|
396
|
+
const result = tokensWithPriority[0]?.token;
|
|
397
|
+
if (!result) {
|
|
398
|
+
throw new BridgeProviderQuoteError("NO_INTERMEDIATE_TOKENS" /* NO_INTERMEDIATE_TOKENS */, { intermediateTokens });
|
|
399
|
+
}
|
|
400
|
+
return result;
|
|
401
|
+
}
|
|
402
|
+
async function resolveCorrelatedTokens(sourceChainId, getCorrelatedTokens) {
|
|
403
|
+
if (getCorrelatedTokens) {
|
|
404
|
+
try {
|
|
405
|
+
const tokens = await getCorrelatedTokens(sourceChainId);
|
|
406
|
+
return new Set(tokens.map((t) => t.toLowerCase()));
|
|
407
|
+
} catch (error) {
|
|
408
|
+
console.warn(
|
|
409
|
+
"[determineIntermediateToken] Failed to fetch correlated tokens, falling back to basic priority",
|
|
410
|
+
error
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return /* @__PURE__ */ new Set();
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
// src/BridgingSdk/getIntermediateSwapResult.ts
|
|
296
418
|
async function getIntermediateSwapResult({
|
|
297
419
|
provider,
|
|
298
420
|
params,
|
|
@@ -318,11 +440,12 @@ async function getIntermediateSwapResult({
|
|
|
318
440
|
quoteBridgeRequest: swapAndBridgeRequest,
|
|
319
441
|
intermediateTokensCache: params.intermediateTokensCache
|
|
320
442
|
});
|
|
321
|
-
const intermediateToken =
|
|
443
|
+
const intermediateToken = await determineIntermediateToken(
|
|
444
|
+
sellTokenChainId,
|
|
445
|
+
intermediateTokens,
|
|
446
|
+
params.advancedSettings?.getCorrelatedTokens
|
|
447
|
+
);
|
|
322
448
|
(0, import_sdk_common3.log)(`Using ${intermediateToken?.name ?? intermediateToken?.address} as intermediate tokens`);
|
|
323
|
-
if (!intermediateToken) {
|
|
324
|
-
throw new BridgeProviderQuoteError("NO_INTERMEDIATE_TOKENS" /* NO_INTERMEDIATE_TOKENS */, { intermediateTokens });
|
|
325
|
-
}
|
|
326
449
|
const bridgeRequestWithoutAmount = {
|
|
327
450
|
...swapAndBridgeRequest,
|
|
328
451
|
sellTokenAddress: intermediateToken.address,
|
|
@@ -1073,7 +1196,7 @@ var BridgingSdk = class {
|
|
|
1073
1196
|
* Get the available sources networks for the bridging.
|
|
1074
1197
|
*/
|
|
1075
1198
|
async getSourceNetworks() {
|
|
1076
|
-
return
|
|
1199
|
+
return import_sdk_config3.ALL_SUPPORTED_CHAINS;
|
|
1077
1200
|
}
|
|
1078
1201
|
/**
|
|
1079
1202
|
* Get the available target networks for the bridging.
|
|
@@ -1368,55 +1491,55 @@ var COW_TRADE_EVENT_INTERFACE = () => {
|
|
|
1368
1491
|
};
|
|
1369
1492
|
|
|
1370
1493
|
// src/providers/across/const/contracts.ts
|
|
1371
|
-
var
|
|
1494
|
+
var import_sdk_config4 = require("@cowprotocol/sdk-config");
|
|
1372
1495
|
var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
|
|
1373
1496
|
// https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
|
|
1374
|
-
[
|
|
1497
|
+
[import_sdk_config4.SupportedChainId.MAINNET]: "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
|
|
1375
1498
|
// https://docs.across.to/reference/contract-addresses/arbitrum-chain-id-42161-1
|
|
1376
|
-
[
|
|
1499
|
+
[import_sdk_config4.SupportedChainId.ARBITRUM_ONE]: "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a",
|
|
1377
1500
|
// https://docs.across.to/reference/contract-addresses/base-chain-id-8453
|
|
1378
|
-
[
|
|
1501
|
+
[import_sdk_config4.SupportedChainId.BASE]: "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64",
|
|
1379
1502
|
// // https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
|
|
1380
|
-
[
|
|
1503
|
+
[import_sdk_config4.SupportedChainId.SEPOLIA]: "0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662",
|
|
1381
1504
|
// https://docs.across.to/reference/contract-addresses/polygon-chain-id-137
|
|
1382
|
-
[
|
|
1505
|
+
[import_sdk_config4.SupportedChainId.POLYGON]: "0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096",
|
|
1383
1506
|
// https://docs.across.to/reference/contract-addresses/lens-chain-id-232
|
|
1384
|
-
[
|
|
1507
|
+
[import_sdk_config4.SupportedChainId.LENS]: "0xe7cb3e167e7475dE1331Cf6E0CEb187654619E12",
|
|
1385
1508
|
// https://docs.across.to/reference/contract-addresses/bnb-smart-chain
|
|
1386
|
-
[
|
|
1509
|
+
[import_sdk_config4.SupportedChainId.BNB]: "0x4e8E101924eDE233C13e2D8622DC8aED2872d505",
|
|
1387
1510
|
// https://docs.across.to/reference/contract-addresses/linea-chain-id-59144
|
|
1388
|
-
[
|
|
1511
|
+
[import_sdk_config4.SupportedChainId.LINEA]: "0xE0BCff426509723B18D6b2f0D8F4602d143bE3e0",
|
|
1389
1512
|
// https://docs.across.to/reference/contract-addresses/plasma
|
|
1390
|
-
[
|
|
1513
|
+
[import_sdk_config4.SupportedChainId.PLASMA]: "0x50039fAEfebef707cFD94D6d462fE6D10B39207a",
|
|
1391
1514
|
// Not supported chains
|
|
1392
1515
|
// 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
|
|
1393
|
-
[
|
|
1394
|
-
[
|
|
1395
|
-
[
|
|
1516
|
+
[import_sdk_config4.SupportedChainId.GNOSIS_CHAIN]: void 0,
|
|
1517
|
+
[import_sdk_config4.SupportedChainId.AVALANCHE]: void 0,
|
|
1518
|
+
[import_sdk_config4.AdditionalTargetChainId.OPTIMISM]: void 0
|
|
1396
1519
|
};
|
|
1397
1520
|
var ACROSS_MATH_CONTRACT_ADDRESSES = {
|
|
1398
|
-
[
|
|
1399
|
-
[
|
|
1400
|
-
[
|
|
1521
|
+
[import_sdk_config4.SupportedChainId.MAINNET]: "0xf2ae6728b6f146556977Af0A68bFbf5bADA22863",
|
|
1522
|
+
[import_sdk_config4.SupportedChainId.ARBITRUM_ONE]: "0x5771A4b4029832e79a75De7B485E5fBbec28848f",
|
|
1523
|
+
[import_sdk_config4.SupportedChainId.BASE]: "0xd4e943dc6ddc885f6229ce33c2e3dfe402a12c81",
|
|
1401
1524
|
// Not supported chains
|
|
1402
1525
|
// 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
|
|
1403
|
-
[
|
|
1404
|
-
[
|
|
1405
|
-
[
|
|
1406
|
-
[
|
|
1407
|
-
[
|
|
1408
|
-
[
|
|
1526
|
+
[import_sdk_config4.SupportedChainId.GNOSIS_CHAIN]: void 0,
|
|
1527
|
+
[import_sdk_config4.SupportedChainId.SEPOLIA]: void 0,
|
|
1528
|
+
[import_sdk_config4.SupportedChainId.POLYGON]: void 0,
|
|
1529
|
+
[import_sdk_config4.AdditionalTargetChainId.OPTIMISM]: void 0,
|
|
1530
|
+
[import_sdk_config4.SupportedChainId.AVALANCHE]: void 0,
|
|
1531
|
+
[import_sdk_config4.SupportedChainId.LENS]: void 0,
|
|
1409
1532
|
// TODO: confirm
|
|
1410
|
-
[
|
|
1533
|
+
[import_sdk_config4.SupportedChainId.BNB]: void 0,
|
|
1411
1534
|
// TODO: confirm
|
|
1412
|
-
[
|
|
1535
|
+
[import_sdk_config4.SupportedChainId.LINEA]: void 0,
|
|
1413
1536
|
// TODO: confirm
|
|
1414
|
-
[
|
|
1537
|
+
[import_sdk_config4.SupportedChainId.PLASMA]: void 0
|
|
1415
1538
|
// TODO: confirm
|
|
1416
1539
|
};
|
|
1417
1540
|
|
|
1418
1541
|
// src/providers/across/util.ts
|
|
1419
|
-
var
|
|
1542
|
+
var import_sdk_config5 = require("@cowprotocol/sdk-config");
|
|
1420
1543
|
var import_sdk_order_book3 = require("@cowprotocol/sdk-order-book");
|
|
1421
1544
|
var import_sdk_common8 = require("@cowprotocol/sdk-common");
|
|
1422
1545
|
var PCT_100_PERCENT = 10n ** 18n;
|
|
@@ -1553,7 +1676,7 @@ function getAcrossDepositEvents(chainId, logs) {
|
|
|
1553
1676
|
function getCowTradeEvents(chainId, logs) {
|
|
1554
1677
|
const COW_TRADE_EVENT_TOPIC = COW_TRADE_EVENT_INTERFACE().getEventTopic("Trade");
|
|
1555
1678
|
const cowTradeEvents = logs.filter((log7) => {
|
|
1556
|
-
return log7.address.toLowerCase() ===
|
|
1679
|
+
return log7.address.toLowerCase() === import_sdk_config5.COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS[chainId].toLowerCase() && log7.topics[0] === COW_TRADE_EVENT_TOPIC;
|
|
1557
1680
|
});
|
|
1558
1681
|
return cowTradeEvents.map((event) => {
|
|
1559
1682
|
const parsedLog = COW_TRADE_EVENT_INTERFACE().parseLog(event);
|
|
@@ -3481,11 +3604,11 @@ async function getGasLimitEstimationForHook({
|
|
|
3481
3604
|
|
|
3482
3605
|
// src/providers/across/AcrossBridgeProvider.ts
|
|
3483
3606
|
var import_sdk_common12 = require("@cowprotocol/sdk-common");
|
|
3484
|
-
var
|
|
3607
|
+
var import_sdk_config6 = require("@cowprotocol/sdk-config");
|
|
3485
3608
|
var import_sdk_cow_shed = require("@cowprotocol/sdk-cow-shed");
|
|
3486
3609
|
var import_sdk_order_book4 = require("@cowprotocol/sdk-order-book");
|
|
3487
3610
|
var ACROSS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/across`;
|
|
3488
|
-
var ACROSS_SUPPORTED_NETWORKS = [
|
|
3611
|
+
var ACROSS_SUPPORTED_NETWORKS = [import_sdk_config6.mainnet, import_sdk_config6.polygon, import_sdk_config6.arbitrumOne, import_sdk_config6.base, import_sdk_config6.optimism];
|
|
3489
3612
|
var SLIPPAGE_TOLERANCE_BPS = 0;
|
|
3490
3613
|
var providerType = "HookBridgeProvider";
|
|
3491
3614
|
var AcrossBridgeProvider = class {
|
|
@@ -3854,63 +3977,63 @@ var getBungeeBridgeFromDisplayName = (displayName) => {
|
|
|
3854
3977
|
};
|
|
3855
3978
|
|
|
3856
3979
|
// src/providers/bungee/const/contracts.ts
|
|
3857
|
-
var
|
|
3980
|
+
var import_sdk_config7 = require("@cowprotocol/sdk-config");
|
|
3858
3981
|
var BUNGEE_COWSWAP_LIB_ADDRESS = "0x75b6ba5fcab20848ca00f132d253638fea82e598";
|
|
3859
3982
|
var BungeeCowswapLibAddresses = {
|
|
3860
|
-
[
|
|
3861
|
-
[
|
|
3862
|
-
[
|
|
3863
|
-
[
|
|
3864
|
-
[
|
|
3865
|
-
[
|
|
3866
|
-
[
|
|
3983
|
+
[import_sdk_config7.SupportedChainId.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3984
|
+
[import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3985
|
+
[import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3986
|
+
[import_sdk_config7.SupportedChainId.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3987
|
+
[import_sdk_config7.SupportedChainId.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3988
|
+
[import_sdk_config7.SupportedChainId.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3989
|
+
[import_sdk_config7.SupportedChainId.LENS]: void 0,
|
|
3867
3990
|
// TODO: confirm
|
|
3868
|
-
[
|
|
3991
|
+
[import_sdk_config7.SupportedChainId.BNB]: void 0,
|
|
3869
3992
|
// TODO: confirm
|
|
3870
|
-
[
|
|
3993
|
+
[import_sdk_config7.SupportedChainId.LINEA]: void 0,
|
|
3871
3994
|
// TODO: confirm
|
|
3872
|
-
[
|
|
3995
|
+
[import_sdk_config7.SupportedChainId.PLASMA]: void 0,
|
|
3873
3996
|
// TODO: confirm
|
|
3874
|
-
[
|
|
3875
|
-
[
|
|
3997
|
+
[import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
|
|
3998
|
+
[import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS
|
|
3876
3999
|
};
|
|
3877
4000
|
var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
|
|
3878
4001
|
var SocketVerifierAddresses = {
|
|
3879
|
-
[
|
|
3880
|
-
[
|
|
3881
|
-
[
|
|
3882
|
-
[
|
|
3883
|
-
[
|
|
3884
|
-
[
|
|
3885
|
-
[
|
|
4002
|
+
[import_sdk_config7.SupportedChainId.MAINNET]: SOCKET_VERIFIER_ADDRESS,
|
|
4003
|
+
[import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
|
|
4004
|
+
[import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
|
|
4005
|
+
[import_sdk_config7.SupportedChainId.BASE]: SOCKET_VERIFIER_ADDRESS,
|
|
4006
|
+
[import_sdk_config7.SupportedChainId.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
|
|
4007
|
+
[import_sdk_config7.SupportedChainId.POLYGON]: SOCKET_VERIFIER_ADDRESS,
|
|
4008
|
+
[import_sdk_config7.SupportedChainId.LENS]: void 0,
|
|
3886
4009
|
// TODO: confirm
|
|
3887
|
-
[
|
|
4010
|
+
[import_sdk_config7.SupportedChainId.BNB]: void 0,
|
|
3888
4011
|
// TODO: confirm
|
|
3889
|
-
[
|
|
4012
|
+
[import_sdk_config7.SupportedChainId.LINEA]: void 0,
|
|
3890
4013
|
// TODO: confirm
|
|
3891
|
-
[
|
|
4014
|
+
[import_sdk_config7.SupportedChainId.PLASMA]: void 0,
|
|
3892
4015
|
// TODO: confirm
|
|
3893
|
-
[
|
|
3894
|
-
[
|
|
4016
|
+
[import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
|
|
4017
|
+
[import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: SOCKET_VERIFIER_ADDRESS
|
|
3895
4018
|
};
|
|
3896
4019
|
var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
|
|
3897
4020
|
var BungeeApproveAndBridgeV1Addresses = {
|
|
3898
|
-
[
|
|
3899
|
-
[
|
|
3900
|
-
[
|
|
3901
|
-
[
|
|
3902
|
-
[
|
|
3903
|
-
[
|
|
3904
|
-
[
|
|
4021
|
+
[import_sdk_config7.SupportedChainId.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4022
|
+
[import_sdk_config7.SupportedChainId.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4023
|
+
[import_sdk_config7.SupportedChainId.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4024
|
+
[import_sdk_config7.SupportedChainId.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4025
|
+
[import_sdk_config7.SupportedChainId.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4026
|
+
[import_sdk_config7.SupportedChainId.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
4027
|
+
[import_sdk_config7.SupportedChainId.LENS]: void 0,
|
|
3905
4028
|
// TODO: confirm
|
|
3906
|
-
[
|
|
4029
|
+
[import_sdk_config7.SupportedChainId.BNB]: void 0,
|
|
3907
4030
|
// TODO: confirm
|
|
3908
|
-
[
|
|
4031
|
+
[import_sdk_config7.SupportedChainId.LINEA]: void 0,
|
|
3909
4032
|
// TODO: confirm
|
|
3910
|
-
[
|
|
4033
|
+
[import_sdk_config7.SupportedChainId.PLASMA]: void 0,
|
|
3911
4034
|
// TODO: confirm
|
|
3912
|
-
[
|
|
3913
|
-
[
|
|
4035
|
+
[import_sdk_config7.SupportedChainId.SEPOLIA]: void 0,
|
|
4036
|
+
[import_sdk_config7.AdditionalTargetChainId.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS
|
|
3914
4037
|
};
|
|
3915
4038
|
|
|
3916
4039
|
// src/providers/bungee/abi.ts
|
|
@@ -4550,7 +4673,7 @@ var BungeeApi = class {
|
|
|
4550
4673
|
};
|
|
4551
4674
|
|
|
4552
4675
|
// src/providers/bungee/createBungeeDepositCall.ts
|
|
4553
|
-
var
|
|
4676
|
+
var import_sdk_config8 = require("@cowprotocol/sdk-config");
|
|
4554
4677
|
var import_sdk_common14 = require("@cowprotocol/sdk-common");
|
|
4555
4678
|
async function createBungeeDepositCall(params) {
|
|
4556
4679
|
const adapter = (0, import_sdk_common14.getGlobalAdapter)();
|
|
@@ -4595,7 +4718,7 @@ async function createBungeeDepositCall(params) {
|
|
|
4595
4718
|
fullData
|
|
4596
4719
|
// data
|
|
4597
4720
|
]);
|
|
4598
|
-
const value = request.sellTokenAddress.toLowerCase() ===
|
|
4721
|
+
const value = request.sellTokenAddress.toLowerCase() === import_sdk_config8.ETH_ADDRESS.toLowerCase() ? BigInt(bridgeInputAmount) : 0n;
|
|
4599
4722
|
const finalValue = value + nativeTokenExtraFee;
|
|
4600
4723
|
const to = BungeeApproveAndBridgeV1Addresses[request.sellTokenChainId];
|
|
4601
4724
|
if (!to) {
|
|
@@ -4644,11 +4767,11 @@ async function getBridgingStatusFromEvents(events, getAcrossStatus) {
|
|
|
4644
4767
|
}
|
|
4645
4768
|
|
|
4646
4769
|
// src/providers/bungee/BungeeBridgeProvider.ts
|
|
4647
|
-
var
|
|
4770
|
+
var import_sdk_config9 = require("@cowprotocol/sdk-config");
|
|
4648
4771
|
var import_sdk_cow_shed2 = require("@cowprotocol/sdk-cow-shed");
|
|
4649
4772
|
var import_sdk_common15 = require("@cowprotocol/sdk-common");
|
|
4650
4773
|
var BUNGEE_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX2}/bungee`;
|
|
4651
|
-
var BUNGEE_SUPPORTED_NETWORKS = [
|
|
4774
|
+
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];
|
|
4652
4775
|
var SLIPPAGE_TOLERANCE_BPS2 = 0;
|
|
4653
4776
|
var providerType2 = "HookBridgeProvider";
|
|
4654
4777
|
var BungeeBridgeProvider = class {
|
|
@@ -4803,13 +4926,13 @@ var BungeeBridgeProvider = class {
|
|
|
4803
4926
|
}
|
|
4804
4927
|
isExtraGasRequired(request) {
|
|
4805
4928
|
const { sellTokenChainId, buyTokenChainId } = request;
|
|
4806
|
-
return sellTokenChainId ===
|
|
4929
|
+
return sellTokenChainId === import_sdk_config9.SupportedChainId.MAINNET && buyTokenChainId === import_sdk_config9.SupportedChainId.GNOSIS_CHAIN;
|
|
4807
4930
|
}
|
|
4808
4931
|
};
|
|
4809
4932
|
|
|
4810
4933
|
// src/providers/near-intents/NearIntentsBridgeProvider.ts
|
|
4811
4934
|
var import_sdk_common17 = require("@cowprotocol/sdk-common");
|
|
4812
|
-
var
|
|
4935
|
+
var import_sdk_config12 = require("@cowprotocol/sdk-config");
|
|
4813
4936
|
var import_sdk_cow_shed3 = require("@cowprotocol/sdk-cow-shed");
|
|
4814
4937
|
var import_sdk_order_book7 = require("@cowprotocol/sdk-order-book");
|
|
4815
4938
|
var import_one_click_sdk_typescript2 = require("@defuse-protocol/one-click-sdk-typescript");
|
|
@@ -4847,27 +4970,27 @@ var NearIntentsApi = class {
|
|
|
4847
4970
|
};
|
|
4848
4971
|
|
|
4849
4972
|
// src/providers/near-intents/const/index.ts
|
|
4850
|
-
var
|
|
4973
|
+
var import_sdk_config10 = require("@cowprotocol/sdk-config");
|
|
4851
4974
|
var NEAR_INTENTS_HOOK_DAPP_ID = `${HOOK_DAPP_BRIDGE_PROVIDER_PREFIX}/near-intents`;
|
|
4852
4975
|
var NEAR_INTENTS_SUPPORTED_NETWORKS = [
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4976
|
+
import_sdk_config10.arbitrumOne,
|
|
4977
|
+
import_sdk_config10.avalanche,
|
|
4978
|
+
import_sdk_config10.base,
|
|
4979
|
+
import_sdk_config10.bnb,
|
|
4980
|
+
import_sdk_config10.gnosisChain,
|
|
4981
|
+
import_sdk_config10.mainnet,
|
|
4982
|
+
import_sdk_config10.optimism,
|
|
4983
|
+
import_sdk_config10.polygon
|
|
4861
4984
|
];
|
|
4862
4985
|
var NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS = {
|
|
4863
|
-
arb:
|
|
4864
|
-
avax:
|
|
4865
|
-
base:
|
|
4866
|
-
bsc:
|
|
4867
|
-
eth:
|
|
4868
|
-
gnosis:
|
|
4869
|
-
op:
|
|
4870
|
-
pol:
|
|
4986
|
+
arb: import_sdk_config10.arbitrumOne.id,
|
|
4987
|
+
avax: import_sdk_config10.avalanche.id,
|
|
4988
|
+
base: import_sdk_config10.base.id,
|
|
4989
|
+
bsc: import_sdk_config10.bnb.id,
|
|
4990
|
+
eth: import_sdk_config10.mainnet.id,
|
|
4991
|
+
gnosis: import_sdk_config10.gnosisChain.id,
|
|
4992
|
+
op: import_sdk_config10.optimism.id,
|
|
4993
|
+
pol: import_sdk_config10.polygon.id
|
|
4871
4994
|
};
|
|
4872
4995
|
var NEAR_INTENTS_STATUS_TO_COW_STATUS = {
|
|
4873
4996
|
KNOWN_DEPOSIT_TX: "in_progress" /* IN_PROGRESS */,
|
|
@@ -4885,7 +5008,7 @@ var ATTESTATOR_ADDRESS = "0x0073DD100b51C555E41B2a452E5933ef76F42790";
|
|
|
4885
5008
|
// src/providers/near-intents/util.ts
|
|
4886
5009
|
var import_json_stable_stringify = __toESM(require("json-stable-stringify"));
|
|
4887
5010
|
var import_sdk_common16 = require("@cowprotocol/sdk-common");
|
|
4888
|
-
var
|
|
5011
|
+
var import_sdk_config11 = require("@cowprotocol/sdk-config");
|
|
4889
5012
|
var calculateDeadline = (seconds) => {
|
|
4890
5013
|
const secs = Number(seconds);
|
|
4891
5014
|
if (!Number.isFinite(secs)) {
|
|
@@ -4898,7 +5021,7 @@ var adaptToken = (token) => {
|
|
|
4898
5021
|
const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
|
|
4899
5022
|
if (!chainId)
|
|
4900
5023
|
return null;
|
|
4901
|
-
const tokenAddress = token.contractAddress ||
|
|
5024
|
+
const tokenAddress = token.contractAddress || import_sdk_config11.ETH_ADDRESS;
|
|
4902
5025
|
if (!tokenAddress)
|
|
4903
5026
|
return null;
|
|
4904
5027
|
return {
|
|
@@ -4922,10 +5045,10 @@ var getTokenByAddressAndChainId = (tokens, targetTokenAddress, targetTokenChainI
|
|
|
4922
5045
|
const chainId = NEAR_INTENTS_BLOCKCHAIN_CHAIN_IDS[token.blockchain];
|
|
4923
5046
|
if (!chainId)
|
|
4924
5047
|
return false;
|
|
4925
|
-
if (targetTokenAddress.toLowerCase() ===
|
|
5048
|
+
if (targetTokenAddress.toLowerCase() === import_sdk_config11.ETH_ADDRESS.toLowerCase()) {
|
|
4926
5049
|
return chainId === targetTokenChainId && !token.contractAddress;
|
|
4927
5050
|
}
|
|
4928
|
-
const tokenAddress = token.contractAddress ||
|
|
5051
|
+
const tokenAddress = token.contractAddress || import_sdk_config11.ETH_ADDRESS;
|
|
4929
5052
|
return tokenAddress?.toLowerCase() === targetTokenAddress.toLowerCase() && chainId === targetTokenChainId;
|
|
4930
5053
|
});
|
|
4931
5054
|
};
|
|
@@ -5149,8 +5272,8 @@ var NearIntentsBridgeProvider = class {
|
|
|
5149
5272
|
fillTxHash: status.swapDetails?.destinationChainTxHashes?.[0]?.hash
|
|
5150
5273
|
},
|
|
5151
5274
|
params: {
|
|
5152
|
-
inputTokenAddress: inputToken.contractAddress ??
|
|
5153
|
-
outputTokenAddress: outputToken.contractAddress ??
|
|
5275
|
+
inputTokenAddress: inputToken.contractAddress ?? import_sdk_config12.ETH_ADDRESS,
|
|
5276
|
+
outputTokenAddress: outputToken.contractAddress ?? import_sdk_config12.ETH_ADDRESS,
|
|
5154
5277
|
inputAmount: BigInt(quote.amountIn),
|
|
5155
5278
|
outputAmount: swapDetails.amountOut ? BigInt(swapDetails.amountOut) : BigInt(quote.amountOut),
|
|
5156
5279
|
owner: order.owner,
|
package/dist/index.mjs
CHANGED
|
@@ -238,6 +238,128 @@ function getHookMockForCostEstimation(gasLimit) {
|
|
|
238
238
|
|
|
239
239
|
// src/BridgingSdk/getIntermediateSwapResult.ts
|
|
240
240
|
import { getGlobalAdapter as getGlobalAdapter2, jsonWithBigintReplacer as jsonWithBigintReplacer2, log as log2 } from "@cowprotocol/sdk-common";
|
|
241
|
+
|
|
242
|
+
// src/BridgingSdk/tokenPriority.ts
|
|
243
|
+
import { NATIVE_CURRENCY_ADDRESS, SupportedChainId } from "@cowprotocol/sdk-config";
|
|
244
|
+
var PRIORITY_STABLECOIN_TOKENS = {
|
|
245
|
+
[SupportedChainId.MAINNET]: /* @__PURE__ */ new Set([
|
|
246
|
+
"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
247
|
+
// USDC
|
|
248
|
+
"0xdac17f958d2ee523a2206206994597c13d831ec7"
|
|
249
|
+
// USDT
|
|
250
|
+
]),
|
|
251
|
+
[SupportedChainId.BNB]: /* @__PURE__ */ new Set([
|
|
252
|
+
"0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
|
|
253
|
+
// USDC
|
|
254
|
+
"0x55d398326f99059ff775485246999027b3197955"
|
|
255
|
+
// USDT
|
|
256
|
+
]),
|
|
257
|
+
[SupportedChainId.GNOSIS_CHAIN]: /* @__PURE__ */ new Set([
|
|
258
|
+
"0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
|
|
259
|
+
// USDC
|
|
260
|
+
"0x2a22f9c3b484c3629090feed35f17ff8f88f76f0",
|
|
261
|
+
// USDC.e
|
|
262
|
+
"0x4ecaba5870353805a9f068101a40e0f32ed605c6"
|
|
263
|
+
// USDT
|
|
264
|
+
]),
|
|
265
|
+
[SupportedChainId.POLYGON]: /* @__PURE__ */ new Set([
|
|
266
|
+
"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
|
|
267
|
+
// USDC
|
|
268
|
+
"0xc2132d05d31c914a87c6611c10748aeb04b58e8f"
|
|
269
|
+
// USDT
|
|
270
|
+
]),
|
|
271
|
+
[SupportedChainId.BASE]: /* @__PURE__ */ new Set([
|
|
272
|
+
"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
273
|
+
// USDC
|
|
274
|
+
"0xfde4c96c8593536e31f229ea8f37b2ada2699bb2"
|
|
275
|
+
// USDT
|
|
276
|
+
]),
|
|
277
|
+
[SupportedChainId.ARBITRUM_ONE]: /* @__PURE__ */ new Set([
|
|
278
|
+
"0xaf88d065e77c8cc2239327c5edb3a432268e5831",
|
|
279
|
+
// USDC
|
|
280
|
+
"0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
|
|
281
|
+
// USDT
|
|
282
|
+
]),
|
|
283
|
+
[SupportedChainId.AVALANCHE]: /* @__PURE__ */ new Set([
|
|
284
|
+
"0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e",
|
|
285
|
+
// USDC
|
|
286
|
+
"0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7"
|
|
287
|
+
// USDT
|
|
288
|
+
]),
|
|
289
|
+
[SupportedChainId.LINEA]: /* @__PURE__ */ new Set([
|
|
290
|
+
"0x176211869ca2b568f2a7d4ee941e073a821ee1ff",
|
|
291
|
+
// USDC
|
|
292
|
+
"0xA219439258ca9da29E9Cc4cE5596924745e12B93"
|
|
293
|
+
// USDT
|
|
294
|
+
]),
|
|
295
|
+
[SupportedChainId.SEPOLIA]: /* @__PURE__ */ new Set([
|
|
296
|
+
"0x1c7d4b196cb0c7b01d743fbc6116a902379c7238"
|
|
297
|
+
// USDC
|
|
298
|
+
])
|
|
299
|
+
};
|
|
300
|
+
function isStablecoinPriorityToken(chainId, tokenAddress) {
|
|
301
|
+
const chainTokens = PRIORITY_STABLECOIN_TOKENS[chainId];
|
|
302
|
+
if (!chainTokens)
|
|
303
|
+
return false;
|
|
304
|
+
return chainTokens.has(tokenAddress.toLowerCase());
|
|
305
|
+
}
|
|
306
|
+
function isCorrelatedToken(tokenAddress, correlatedTokens) {
|
|
307
|
+
return correlatedTokens.has(tokenAddress.toLowerCase());
|
|
308
|
+
}
|
|
309
|
+
function isNativeToken(tokenAddress) {
|
|
310
|
+
return tokenAddress.toLowerCase() === NATIVE_CURRENCY_ADDRESS.toLowerCase();
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// src/BridgingSdk/determineIntermediateToken.ts
|
|
314
|
+
async function determineIntermediateToken(sourceChainId, intermediateTokens, getCorrelatedTokens) {
|
|
315
|
+
const firstToken = intermediateTokens[0];
|
|
316
|
+
if (intermediateTokens.length === 0 || !firstToken) {
|
|
317
|
+
throw new BridgeProviderQuoteError("NO_INTERMEDIATE_TOKENS" /* NO_INTERMEDIATE_TOKENS */, { intermediateTokens });
|
|
318
|
+
}
|
|
319
|
+
if (intermediateTokens.length === 1) {
|
|
320
|
+
return firstToken;
|
|
321
|
+
}
|
|
322
|
+
const correlatedTokens = await resolveCorrelatedTokens(sourceChainId, getCorrelatedTokens);
|
|
323
|
+
const tokensWithPriority = intermediateTokens.map((token) => {
|
|
324
|
+
if (isStablecoinPriorityToken(token.chainId, token.address)) {
|
|
325
|
+
return { token, priority: 4 /* HIGHEST */ };
|
|
326
|
+
}
|
|
327
|
+
if (isCorrelatedToken(token.address, correlatedTokens)) {
|
|
328
|
+
return { token, priority: 3 /* HIGH */ };
|
|
329
|
+
}
|
|
330
|
+
if (isNativeToken(token.address)) {
|
|
331
|
+
return { token, priority: 2 /* MEDIUM */ };
|
|
332
|
+
}
|
|
333
|
+
return { token, priority: 1 /* LOW */ };
|
|
334
|
+
});
|
|
335
|
+
tokensWithPriority.sort((a, b) => {
|
|
336
|
+
if (a.priority !== b.priority) {
|
|
337
|
+
return b.priority - a.priority;
|
|
338
|
+
}
|
|
339
|
+
return intermediateTokens.indexOf(a.token) - intermediateTokens.indexOf(b.token);
|
|
340
|
+
});
|
|
341
|
+
const result = tokensWithPriority[0]?.token;
|
|
342
|
+
if (!result) {
|
|
343
|
+
throw new BridgeProviderQuoteError("NO_INTERMEDIATE_TOKENS" /* NO_INTERMEDIATE_TOKENS */, { intermediateTokens });
|
|
344
|
+
}
|
|
345
|
+
return result;
|
|
346
|
+
}
|
|
347
|
+
async function resolveCorrelatedTokens(sourceChainId, getCorrelatedTokens) {
|
|
348
|
+
if (getCorrelatedTokens) {
|
|
349
|
+
try {
|
|
350
|
+
const tokens = await getCorrelatedTokens(sourceChainId);
|
|
351
|
+
return new Set(tokens.map((t) => t.toLowerCase()));
|
|
352
|
+
} catch (error) {
|
|
353
|
+
console.warn(
|
|
354
|
+
"[determineIntermediateToken] Failed to fetch correlated tokens, falling back to basic priority",
|
|
355
|
+
error
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return /* @__PURE__ */ new Set();
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// src/BridgingSdk/getIntermediateSwapResult.ts
|
|
241
363
|
async function getIntermediateSwapResult({
|
|
242
364
|
provider,
|
|
243
365
|
params,
|
|
@@ -263,11 +385,12 @@ async function getIntermediateSwapResult({
|
|
|
263
385
|
quoteBridgeRequest: swapAndBridgeRequest,
|
|
264
386
|
intermediateTokensCache: params.intermediateTokensCache
|
|
265
387
|
});
|
|
266
|
-
const intermediateToken =
|
|
388
|
+
const intermediateToken = await determineIntermediateToken(
|
|
389
|
+
sellTokenChainId,
|
|
390
|
+
intermediateTokens,
|
|
391
|
+
params.advancedSettings?.getCorrelatedTokens
|
|
392
|
+
);
|
|
267
393
|
log2(`Using ${intermediateToken?.name ?? intermediateToken?.address} as intermediate tokens`);
|
|
268
|
-
if (!intermediateToken) {
|
|
269
|
-
throw new BridgeProviderQuoteError("NO_INTERMEDIATE_TOKENS" /* NO_INTERMEDIATE_TOKENS */, { intermediateTokens });
|
|
270
|
-
}
|
|
271
394
|
const bridgeRequestWithoutAmount = {
|
|
272
395
|
...swapAndBridgeRequest,
|
|
273
396
|
sellTokenAddress: intermediateToken.address,
|
|
@@ -1313,50 +1436,50 @@ var COW_TRADE_EVENT_INTERFACE = () => {
|
|
|
1313
1436
|
};
|
|
1314
1437
|
|
|
1315
1438
|
// src/providers/across/const/contracts.ts
|
|
1316
|
-
import { AdditionalTargetChainId, SupportedChainId } from "@cowprotocol/sdk-config";
|
|
1439
|
+
import { AdditionalTargetChainId, SupportedChainId as SupportedChainId2 } from "@cowprotocol/sdk-config";
|
|
1317
1440
|
var ACROSS_SPOOK_CONTRACT_ADDRESSES = {
|
|
1318
1441
|
// https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
|
|
1319
|
-
[
|
|
1442
|
+
[SupportedChainId2.MAINNET]: "0x5c7BCd6E7De5423a257D81B442095A1a6ced35C5",
|
|
1320
1443
|
// https://docs.across.to/reference/contract-addresses/arbitrum-chain-id-42161-1
|
|
1321
|
-
[
|
|
1444
|
+
[SupportedChainId2.ARBITRUM_ONE]: "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a",
|
|
1322
1445
|
// https://docs.across.to/reference/contract-addresses/base-chain-id-8453
|
|
1323
|
-
[
|
|
1446
|
+
[SupportedChainId2.BASE]: "0x09aea4b2242abC8bb4BB78D537A67a245A7bEC64",
|
|
1324
1447
|
// // https://docs.across.to/reference/contract-addresses/mainnet-chain-id-1
|
|
1325
|
-
[
|
|
1448
|
+
[SupportedChainId2.SEPOLIA]: "0x5ef6C01E11889d86803e0B23e3cB3F9E9d97B662",
|
|
1326
1449
|
// https://docs.across.to/reference/contract-addresses/polygon-chain-id-137
|
|
1327
|
-
[
|
|
1450
|
+
[SupportedChainId2.POLYGON]: "0x9295ee1d8C5b022Be115A2AD3c30C72E34e7F096",
|
|
1328
1451
|
// https://docs.across.to/reference/contract-addresses/lens-chain-id-232
|
|
1329
|
-
[
|
|
1452
|
+
[SupportedChainId2.LENS]: "0xe7cb3e167e7475dE1331Cf6E0CEb187654619E12",
|
|
1330
1453
|
// https://docs.across.to/reference/contract-addresses/bnb-smart-chain
|
|
1331
|
-
[
|
|
1454
|
+
[SupportedChainId2.BNB]: "0x4e8E101924eDE233C13e2D8622DC8aED2872d505",
|
|
1332
1455
|
// https://docs.across.to/reference/contract-addresses/linea-chain-id-59144
|
|
1333
|
-
[
|
|
1456
|
+
[SupportedChainId2.LINEA]: "0xE0BCff426509723B18D6b2f0D8F4602d143bE3e0",
|
|
1334
1457
|
// https://docs.across.to/reference/contract-addresses/plasma
|
|
1335
|
-
[
|
|
1458
|
+
[SupportedChainId2.PLASMA]: "0x50039fAEfebef707cFD94D6d462fE6D10B39207a",
|
|
1336
1459
|
// Not supported chains
|
|
1337
1460
|
// 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
|
|
1338
|
-
[
|
|
1339
|
-
[
|
|
1461
|
+
[SupportedChainId2.GNOSIS_CHAIN]: void 0,
|
|
1462
|
+
[SupportedChainId2.AVALANCHE]: void 0,
|
|
1340
1463
|
[AdditionalTargetChainId.OPTIMISM]: void 0
|
|
1341
1464
|
};
|
|
1342
1465
|
var ACROSS_MATH_CONTRACT_ADDRESSES = {
|
|
1343
|
-
[
|
|
1344
|
-
[
|
|
1345
|
-
[
|
|
1466
|
+
[SupportedChainId2.MAINNET]: "0xf2ae6728b6f146556977Af0A68bFbf5bADA22863",
|
|
1467
|
+
[SupportedChainId2.ARBITRUM_ONE]: "0x5771A4b4029832e79a75De7B485E5fBbec28848f",
|
|
1468
|
+
[SupportedChainId2.BASE]: "0xd4e943dc6ddc885f6229ce33c2e3dfe402a12c81",
|
|
1346
1469
|
// Not supported chains
|
|
1347
1470
|
// 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
|
|
1348
|
-
[
|
|
1349
|
-
[
|
|
1350
|
-
[
|
|
1471
|
+
[SupportedChainId2.GNOSIS_CHAIN]: void 0,
|
|
1472
|
+
[SupportedChainId2.SEPOLIA]: void 0,
|
|
1473
|
+
[SupportedChainId2.POLYGON]: void 0,
|
|
1351
1474
|
[AdditionalTargetChainId.OPTIMISM]: void 0,
|
|
1352
|
-
[
|
|
1353
|
-
[
|
|
1475
|
+
[SupportedChainId2.AVALANCHE]: void 0,
|
|
1476
|
+
[SupportedChainId2.LENS]: void 0,
|
|
1354
1477
|
// TODO: confirm
|
|
1355
|
-
[
|
|
1478
|
+
[SupportedChainId2.BNB]: void 0,
|
|
1356
1479
|
// TODO: confirm
|
|
1357
|
-
[
|
|
1480
|
+
[SupportedChainId2.LINEA]: void 0,
|
|
1358
1481
|
// TODO: confirm
|
|
1359
|
-
[
|
|
1482
|
+
[SupportedChainId2.PLASMA]: void 0
|
|
1360
1483
|
// TODO: confirm
|
|
1361
1484
|
};
|
|
1362
1485
|
|
|
@@ -3805,62 +3928,62 @@ var getBungeeBridgeFromDisplayName = (displayName) => {
|
|
|
3805
3928
|
};
|
|
3806
3929
|
|
|
3807
3930
|
// src/providers/bungee/const/contracts.ts
|
|
3808
|
-
import { AdditionalTargetChainId as AdditionalTargetChainId2, SupportedChainId as
|
|
3931
|
+
import { AdditionalTargetChainId as AdditionalTargetChainId2, SupportedChainId as SupportedChainId5 } from "@cowprotocol/sdk-config";
|
|
3809
3932
|
var BUNGEE_COWSWAP_LIB_ADDRESS = "0x75b6ba5fcab20848ca00f132d253638fea82e598";
|
|
3810
3933
|
var BungeeCowswapLibAddresses = {
|
|
3811
|
-
[
|
|
3812
|
-
[
|
|
3813
|
-
[
|
|
3814
|
-
[
|
|
3815
|
-
[
|
|
3816
|
-
[
|
|
3817
|
-
[
|
|
3934
|
+
[SupportedChainId5.MAINNET]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3935
|
+
[SupportedChainId5.GNOSIS_CHAIN]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3936
|
+
[SupportedChainId5.ARBITRUM_ONE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3937
|
+
[SupportedChainId5.BASE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3938
|
+
[SupportedChainId5.AVALANCHE]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3939
|
+
[SupportedChainId5.POLYGON]: BUNGEE_COWSWAP_LIB_ADDRESS,
|
|
3940
|
+
[SupportedChainId5.LENS]: void 0,
|
|
3818
3941
|
// TODO: confirm
|
|
3819
|
-
[
|
|
3942
|
+
[SupportedChainId5.BNB]: void 0,
|
|
3820
3943
|
// TODO: confirm
|
|
3821
|
-
[
|
|
3944
|
+
[SupportedChainId5.LINEA]: void 0,
|
|
3822
3945
|
// TODO: confirm
|
|
3823
|
-
[
|
|
3946
|
+
[SupportedChainId5.PLASMA]: void 0,
|
|
3824
3947
|
// TODO: confirm
|
|
3825
|
-
[
|
|
3948
|
+
[SupportedChainId5.SEPOLIA]: void 0,
|
|
3826
3949
|
[AdditionalTargetChainId2.OPTIMISM]: BUNGEE_COWSWAP_LIB_ADDRESS
|
|
3827
3950
|
};
|
|
3828
3951
|
var SOCKET_VERIFIER_ADDRESS = "0xa27A3f5A96DF7D8Be26EE2790999860C00eb688D";
|
|
3829
3952
|
var SocketVerifierAddresses = {
|
|
3830
|
-
[
|
|
3831
|
-
[
|
|
3832
|
-
[
|
|
3833
|
-
[
|
|
3834
|
-
[
|
|
3835
|
-
[
|
|
3836
|
-
[
|
|
3953
|
+
[SupportedChainId5.MAINNET]: SOCKET_VERIFIER_ADDRESS,
|
|
3954
|
+
[SupportedChainId5.GNOSIS_CHAIN]: SOCKET_VERIFIER_ADDRESS,
|
|
3955
|
+
[SupportedChainId5.ARBITRUM_ONE]: SOCKET_VERIFIER_ADDRESS,
|
|
3956
|
+
[SupportedChainId5.BASE]: SOCKET_VERIFIER_ADDRESS,
|
|
3957
|
+
[SupportedChainId5.AVALANCHE]: SOCKET_VERIFIER_ADDRESS,
|
|
3958
|
+
[SupportedChainId5.POLYGON]: SOCKET_VERIFIER_ADDRESS,
|
|
3959
|
+
[SupportedChainId5.LENS]: void 0,
|
|
3837
3960
|
// TODO: confirm
|
|
3838
|
-
[
|
|
3961
|
+
[SupportedChainId5.BNB]: void 0,
|
|
3839
3962
|
// TODO: confirm
|
|
3840
|
-
[
|
|
3963
|
+
[SupportedChainId5.LINEA]: void 0,
|
|
3841
3964
|
// TODO: confirm
|
|
3842
|
-
[
|
|
3965
|
+
[SupportedChainId5.PLASMA]: void 0,
|
|
3843
3966
|
// TODO: confirm
|
|
3844
|
-
[
|
|
3967
|
+
[SupportedChainId5.SEPOLIA]: void 0,
|
|
3845
3968
|
[AdditionalTargetChainId2.OPTIMISM]: SOCKET_VERIFIER_ADDRESS
|
|
3846
3969
|
};
|
|
3847
3970
|
var BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS = "0xD06a673fe1fa27B1b9E5BA0be980AB15Dbce85cc";
|
|
3848
3971
|
var BungeeApproveAndBridgeV1Addresses = {
|
|
3849
|
-
[
|
|
3850
|
-
[
|
|
3851
|
-
[
|
|
3852
|
-
[
|
|
3853
|
-
[
|
|
3854
|
-
[
|
|
3855
|
-
[
|
|
3972
|
+
[SupportedChainId5.MAINNET]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
3973
|
+
[SupportedChainId5.GNOSIS_CHAIN]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
3974
|
+
[SupportedChainId5.ARBITRUM_ONE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
3975
|
+
[SupportedChainId5.BASE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
3976
|
+
[SupportedChainId5.AVALANCHE]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
3977
|
+
[SupportedChainId5.POLYGON]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS,
|
|
3978
|
+
[SupportedChainId5.LENS]: void 0,
|
|
3856
3979
|
// TODO: confirm
|
|
3857
|
-
[
|
|
3980
|
+
[SupportedChainId5.BNB]: void 0,
|
|
3858
3981
|
// TODO: confirm
|
|
3859
|
-
[
|
|
3982
|
+
[SupportedChainId5.LINEA]: void 0,
|
|
3860
3983
|
// TODO: confirm
|
|
3861
|
-
[
|
|
3984
|
+
[SupportedChainId5.PLASMA]: void 0,
|
|
3862
3985
|
// TODO: confirm
|
|
3863
|
-
[
|
|
3986
|
+
[SupportedChainId5.SEPOLIA]: void 0,
|
|
3864
3987
|
[AdditionalTargetChainId2.OPTIMISM]: BUNGEE_APPROVE_AND_BRIDGE_V1_ADDRESS
|
|
3865
3988
|
};
|
|
3866
3989
|
|
|
@@ -4603,7 +4726,7 @@ import {
|
|
|
4603
4726
|
mainnet as mainnet2,
|
|
4604
4727
|
optimism as optimism2,
|
|
4605
4728
|
polygon as polygon2,
|
|
4606
|
-
SupportedChainId as
|
|
4729
|
+
SupportedChainId as SupportedChainId6
|
|
4607
4730
|
} from "@cowprotocol/sdk-config";
|
|
4608
4731
|
import { CowShedSdk as CowShedSdk2 } from "@cowprotocol/sdk-cow-shed";
|
|
4609
4732
|
import { setGlobalAdapter as setGlobalAdapter3 } from "@cowprotocol/sdk-common";
|
|
@@ -4763,7 +4886,7 @@ var BungeeBridgeProvider = class {
|
|
|
4763
4886
|
}
|
|
4764
4887
|
isExtraGasRequired(request) {
|
|
4765
4888
|
const { sellTokenChainId, buyTokenChainId } = request;
|
|
4766
|
-
return sellTokenChainId ===
|
|
4889
|
+
return sellTokenChainId === SupportedChainId6.MAINNET && buyTokenChainId === SupportedChainId6.GNOSIS_CHAIN;
|
|
4767
4890
|
}
|
|
4768
4891
|
};
|
|
4769
4892
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cowprotocol/sdk-bridging",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.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-
|
|
19
|
+
"@cowprotocol/sdk-app-data": "4.3.5",
|
|
20
20
|
"@cowprotocol/sdk-common": "0.4.0",
|
|
21
|
-
"@cowprotocol/sdk-contracts-ts": "0.
|
|
22
|
-
"@cowprotocol/sdk-
|
|
21
|
+
"@cowprotocol/sdk-contracts-ts": "0.8.0",
|
|
22
|
+
"@cowprotocol/sdk-config": "0.6.1",
|
|
23
23
|
"@cowprotocol/sdk-order-book": "0.4.3",
|
|
24
|
-
"@cowprotocol/sdk-
|
|
25
|
-
"@cowprotocol/sdk-
|
|
26
|
-
"@cowprotocol/sdk-
|
|
24
|
+
"@cowprotocol/sdk-cow-shed": "0.2.7",
|
|
25
|
+
"@cowprotocol/sdk-trading": "0.7.0",
|
|
26
|
+
"@cowprotocol/sdk-weiroll": "0.1.10"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/jest": "^29.4.0",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"@cow-sdk/typescript-config": "0.0.0-beta.0",
|
|
42
42
|
"@cowprotocol/sdk-ethers-v5-adapter": "0.3.0",
|
|
43
43
|
"@cowprotocol/sdk-ethers-v6-adapter": "0.3.0",
|
|
44
|
-
"@cowprotocol/sdk-
|
|
45
|
-
"@cowprotocol/sdk-
|
|
44
|
+
"@cowprotocol/sdk-order-signing": "0.1.20",
|
|
45
|
+
"@cowprotocol/sdk-viem-adapter": "0.3.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|