@cowprotocol/sdk-bridging 0.12.1 → 1.0.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
@@ -27,6 +27,10 @@ interface WithBuyToken {
27
27
  }
28
28
  type WithQuoter = Omit<QuoterParameters, 'chainId'>;
29
29
  type WithTrader = Pick<TraderParameters, 'signer'>;
30
+ type WithSwapAndBrideSlippage = Partial<{
31
+ swapSlippageBps: cowAppDataLatestScheme.SlippageBips;
32
+ bridgeSlippageBps: cowAppDataLatestScheme.SlippageBips;
33
+ }>;
30
34
  /**
31
35
  * Parameters for getting a bridge quote
32
36
  */
@@ -34,7 +38,7 @@ type QuoteBridgeRequest = {
34
38
  kind: OrderKind;
35
39
  amount: bigint;
36
40
  owner?: AccountAddress;
37
- } & WithSellToken & WithBuyToken & WithQuoter & WithTrader & TradeOptionalParameters;
41
+ } & WithSellToken & WithBuyToken & WithQuoter & WithTrader & Omit<TradeOptionalParameters, 'slippageBps'> & WithSwapAndBrideSlippage;
38
42
  type QuoteBridgeRequestWithoutAmount = Omit<QuoteBridgeRequest, 'amount'>;
39
43
  interface BridgeQuoteResult {
40
44
  /**
@@ -635,6 +639,7 @@ declare const DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION = 200000;
635
639
  declare const COW_SHED_PROXY_CREATION_GAS = 360000;
636
640
  declare const DEFAULT_EXTRA_GAS_PROXY_CREATION = 400000;
637
641
  declare const HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
642
+ declare const DEFAULT_BRIDGE_SLIPPAGE_BPS = 50;
638
643
 
639
644
  interface GetCrossChainOrderParams {
640
645
  chainId: SupportedChainId;
@@ -1296,4 +1301,4 @@ declare class NearIntentsBridgeProvider implements ReceiverAccountBridgeProvider
1296
1301
  } | null>;
1297
1302
  }
1298
1303
 
1299
- export { AcrossBridgeProvider, type AcrossBridgeProviderOptions, type AcrossQuoteResult, type BestQuoteProgressCallback, type BestQuoteProviderContext, type BridgeCallDetails, type BridgeCosts, type BridgeDeposit, type BridgeHook, BridgeOrderParsingError, type BridgeProvider, BridgeProviderError, type BridgeProviderInfo, BridgeProviderQuoteError, type BridgeProviderType, type BridgeQuoteAmountsAndCosts, type BridgeQuoteAndPost, BridgeQuoteErrorPriorities, BridgeQuoteErrors, type BridgeQuoteResult, type BridgeQuoteResults, BridgeStatus, type BridgeStatusResult, type BridgingDepositParams, BridgingSdk, BungeeBridgeProvider, type BungeeBridgeProviderOptions, type BungeeQuoteResult, type BuyTokensParams, COW_SHED_PROXY_CREATION_GAS, type CrossChainOrder, type CrossChainQuoteAndPost, DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION, DEFAULT_EXTRA_GAS_PROXY_CREATION, DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION, type DefaultBridgeProvider, type GetProviderBuyTokens, HOOK_DAPP_BRIDGE_PROVIDER_PREFIX, type HookBridgeProvider, type MultiQuoteOptions, type MultiQuoteProgressCallback, type MultiQuoteRequest, type MultiQuoteResult, NearIntentsBridgeProvider, type NearIntentsBridgeProviderOptions, type NearIntentsQuoteResult, type ProviderQuoteContext, type QuoteBridgeRequest, type QuoteBridgeRequestWithoutAmount, RAW_PROVIDERS_FILES_PATH, type ReceiverAccountBridgeProvider, assertIsBridgeQuoteAndPost, assertIsQuoteAndPost, getCrossChainOrder, getPostHooks, isAppDoc, isBridgeQuoteAndPost, isHookBridgeProvider, isQuoteAndPost, isReceiverAccountBridgeProvider };
1304
+ export { AcrossBridgeProvider, type AcrossBridgeProviderOptions, type AcrossQuoteResult, type BestQuoteProgressCallback, type BestQuoteProviderContext, type BridgeCallDetails, type BridgeCosts, type BridgeDeposit, type BridgeHook, BridgeOrderParsingError, type BridgeProvider, BridgeProviderError, type BridgeProviderInfo, BridgeProviderQuoteError, type BridgeProviderType, type BridgeQuoteAmountsAndCosts, type BridgeQuoteAndPost, BridgeQuoteErrorPriorities, BridgeQuoteErrors, type BridgeQuoteResult, type BridgeQuoteResults, BridgeStatus, type BridgeStatusResult, type BridgingDepositParams, BridgingSdk, BungeeBridgeProvider, type BungeeBridgeProviderOptions, type BungeeQuoteResult, type BuyTokensParams, COW_SHED_PROXY_CREATION_GAS, type CrossChainOrder, type CrossChainQuoteAndPost, DEFAULT_BRIDGE_SLIPPAGE_BPS, DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION, DEFAULT_EXTRA_GAS_PROXY_CREATION, DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION, type DefaultBridgeProvider, type GetProviderBuyTokens, HOOK_DAPP_BRIDGE_PROVIDER_PREFIX, type HookBridgeProvider, type MultiQuoteOptions, type MultiQuoteProgressCallback, type MultiQuoteRequest, type MultiQuoteResult, NearIntentsBridgeProvider, type NearIntentsBridgeProviderOptions, type NearIntentsQuoteResult, type ProviderQuoteContext, type QuoteBridgeRequest, type QuoteBridgeRequestWithoutAmount, RAW_PROVIDERS_FILES_PATH, type ReceiverAccountBridgeProvider, assertIsBridgeQuoteAndPost, assertIsQuoteAndPost, getCrossChainOrder, getPostHooks, isAppDoc, isBridgeQuoteAndPost, isHookBridgeProvider, isQuoteAndPost, isReceiverAccountBridgeProvider };
package/dist/index.d.ts CHANGED
@@ -27,6 +27,10 @@ interface WithBuyToken {
27
27
  }
28
28
  type WithQuoter = Omit<QuoterParameters, 'chainId'>;
29
29
  type WithTrader = Pick<TraderParameters, 'signer'>;
30
+ type WithSwapAndBrideSlippage = Partial<{
31
+ swapSlippageBps: cowAppDataLatestScheme.SlippageBips;
32
+ bridgeSlippageBps: cowAppDataLatestScheme.SlippageBips;
33
+ }>;
30
34
  /**
31
35
  * Parameters for getting a bridge quote
32
36
  */
@@ -34,7 +38,7 @@ type QuoteBridgeRequest = {
34
38
  kind: OrderKind;
35
39
  amount: bigint;
36
40
  owner?: AccountAddress;
37
- } & WithSellToken & WithBuyToken & WithQuoter & WithTrader & TradeOptionalParameters;
41
+ } & WithSellToken & WithBuyToken & WithQuoter & WithTrader & Omit<TradeOptionalParameters, 'slippageBps'> & WithSwapAndBrideSlippage;
38
42
  type QuoteBridgeRequestWithoutAmount = Omit<QuoteBridgeRequest, 'amount'>;
39
43
  interface BridgeQuoteResult {
40
44
  /**
@@ -635,6 +639,7 @@ declare const DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION = 200000;
635
639
  declare const COW_SHED_PROXY_CREATION_GAS = 360000;
636
640
  declare const DEFAULT_EXTRA_GAS_PROXY_CREATION = 400000;
637
641
  declare const HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
642
+ declare const DEFAULT_BRIDGE_SLIPPAGE_BPS = 50;
638
643
 
639
644
  interface GetCrossChainOrderParams {
640
645
  chainId: SupportedChainId;
@@ -1296,4 +1301,4 @@ declare class NearIntentsBridgeProvider implements ReceiverAccountBridgeProvider
1296
1301
  } | null>;
1297
1302
  }
1298
1303
 
1299
- export { AcrossBridgeProvider, type AcrossBridgeProviderOptions, type AcrossQuoteResult, type BestQuoteProgressCallback, type BestQuoteProviderContext, type BridgeCallDetails, type BridgeCosts, type BridgeDeposit, type BridgeHook, BridgeOrderParsingError, type BridgeProvider, BridgeProviderError, type BridgeProviderInfo, BridgeProviderQuoteError, type BridgeProviderType, type BridgeQuoteAmountsAndCosts, type BridgeQuoteAndPost, BridgeQuoteErrorPriorities, BridgeQuoteErrors, type BridgeQuoteResult, type BridgeQuoteResults, BridgeStatus, type BridgeStatusResult, type BridgingDepositParams, BridgingSdk, BungeeBridgeProvider, type BungeeBridgeProviderOptions, type BungeeQuoteResult, type BuyTokensParams, COW_SHED_PROXY_CREATION_GAS, type CrossChainOrder, type CrossChainQuoteAndPost, DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION, DEFAULT_EXTRA_GAS_PROXY_CREATION, DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION, type DefaultBridgeProvider, type GetProviderBuyTokens, HOOK_DAPP_BRIDGE_PROVIDER_PREFIX, type HookBridgeProvider, type MultiQuoteOptions, type MultiQuoteProgressCallback, type MultiQuoteRequest, type MultiQuoteResult, NearIntentsBridgeProvider, type NearIntentsBridgeProviderOptions, type NearIntentsQuoteResult, type ProviderQuoteContext, type QuoteBridgeRequest, type QuoteBridgeRequestWithoutAmount, RAW_PROVIDERS_FILES_PATH, type ReceiverAccountBridgeProvider, assertIsBridgeQuoteAndPost, assertIsQuoteAndPost, getCrossChainOrder, getPostHooks, isAppDoc, isBridgeQuoteAndPost, isHookBridgeProvider, isQuoteAndPost, isReceiverAccountBridgeProvider };
1304
+ export { AcrossBridgeProvider, type AcrossBridgeProviderOptions, type AcrossQuoteResult, type BestQuoteProgressCallback, type BestQuoteProviderContext, type BridgeCallDetails, type BridgeCosts, type BridgeDeposit, type BridgeHook, BridgeOrderParsingError, type BridgeProvider, BridgeProviderError, type BridgeProviderInfo, BridgeProviderQuoteError, type BridgeProviderType, type BridgeQuoteAmountsAndCosts, type BridgeQuoteAndPost, BridgeQuoteErrorPriorities, BridgeQuoteErrors, type BridgeQuoteResult, type BridgeQuoteResults, BridgeStatus, type BridgeStatusResult, type BridgingDepositParams, BridgingSdk, BungeeBridgeProvider, type BungeeBridgeProviderOptions, type BungeeQuoteResult, type BuyTokensParams, COW_SHED_PROXY_CREATION_GAS, type CrossChainOrder, type CrossChainQuoteAndPost, DEFAULT_BRIDGE_SLIPPAGE_BPS, DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION, DEFAULT_EXTRA_GAS_PROXY_CREATION, DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION, type DefaultBridgeProvider, type GetProviderBuyTokens, HOOK_DAPP_BRIDGE_PROVIDER_PREFIX, type HookBridgeProvider, type MultiQuoteOptions, type MultiQuoteProgressCallback, type MultiQuoteRequest, type MultiQuoteResult, NearIntentsBridgeProvider, type NearIntentsBridgeProviderOptions, type NearIntentsQuoteResult, type ProviderQuoteContext, type QuoteBridgeRequest, type QuoteBridgeRequestWithoutAmount, RAW_PROVIDERS_FILES_PATH, type ReceiverAccountBridgeProvider, assertIsBridgeQuoteAndPost, assertIsQuoteAndPost, getCrossChainOrder, getPostHooks, isAppDoc, isBridgeQuoteAndPost, isHookBridgeProvider, isQuoteAndPost, isReceiverAccountBridgeProvider };
package/dist/index.js CHANGED
@@ -40,6 +40,7 @@ __export(src_exports, {
40
40
  BridgingSdk: () => BridgingSdk,
41
41
  BungeeBridgeProvider: () => BungeeBridgeProvider,
42
42
  COW_SHED_PROXY_CREATION_GAS: () => COW_SHED_PROXY_CREATION_GAS,
43
+ DEFAULT_BRIDGE_SLIPPAGE_BPS: () => DEFAULT_BRIDGE_SLIPPAGE_BPS,
43
44
  DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION: () => DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION,
44
45
  DEFAULT_EXTRA_GAS_PROXY_CREATION: () => DEFAULT_EXTRA_GAS_PROXY_CREATION,
45
46
  DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION: () => DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION,
@@ -164,6 +165,7 @@ var DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION = 2e5;
164
165
  var COW_SHED_PROXY_CREATION_GAS = 36e4;
165
166
  var DEFAULT_EXTRA_GAS_PROXY_CREATION = 4e5;
166
167
  var HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
168
+ var DEFAULT_BRIDGE_SLIPPAGE_BPS = 50;
167
169
 
168
170
  // src/BridgingSdk/findBridgeProviderFromHook.ts
169
171
  function findBridgeProviderFromHook(fullAppData, providers) {
@@ -538,7 +540,9 @@ async function getSwapQuote(params) {
538
540
  sellTokenAddress,
539
541
  buyTokenChainId: _buyTokenChainId,
540
542
  buyTokenAddress: _buyTokenAddress,
543
+ bridgeSlippageBps: _bridgeSlippageBps,
541
544
  amount,
545
+ swapSlippageBps,
542
546
  ...rest
543
547
  } = swapAndBridgeRequest;
544
548
  const { sellTokenAddress: intermediateToken, sellTokenDecimals: intermediaryTokenDecimals } = bridgeRequestWithoutAmount;
@@ -550,6 +554,7 @@ async function getSwapQuote(params) {
550
554
  buyToken: intermediateToken,
551
555
  buyTokenDecimals: intermediaryTokenDecimals,
552
556
  amount: amount.toString(),
557
+ slippageBps: swapSlippageBps,
553
558
  signer
554
559
  };
555
560
  const { signer: _, ...swapParamsToLog } = swapParams;
@@ -5201,7 +5206,7 @@ var NearIntentsBridgeProvider = class {
5201
5206
  const quoteResponse = await this.api.getQuote({
5202
5207
  dry: false,
5203
5208
  swapType: import_one_click_sdk_typescript2.QuoteRequest.swapType.FLEX_INPUT,
5204
- slippageTolerance: request.slippageBps ?? 100,
5209
+ slippageTolerance: request.bridgeSlippageBps ?? DEFAULT_BRIDGE_SLIPPAGE_BPS,
5205
5210
  originAsset: sellToken.assetId,
5206
5211
  depositType: import_one_click_sdk_typescript2.QuoteRequest.depositType.ORIGIN_CHAIN,
5207
5212
  destinationAsset: buyToken.assetId,
@@ -5375,6 +5380,7 @@ var NearIntentsBridgeProvider = class {
5375
5380
  BridgingSdk,
5376
5381
  BungeeBridgeProvider,
5377
5382
  COW_SHED_PROXY_CREATION_GAS,
5383
+ DEFAULT_BRIDGE_SLIPPAGE_BPS,
5378
5384
  DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION,
5379
5385
  DEFAULT_EXTRA_GAS_PROXY_CREATION,
5380
5386
  DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION,
package/dist/index.mjs CHANGED
@@ -104,6 +104,7 @@ var DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION = 2e5;
104
104
  var COW_SHED_PROXY_CREATION_GAS = 36e4;
105
105
  var DEFAULT_EXTRA_GAS_PROXY_CREATION = 4e5;
106
106
  var HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers";
107
+ var DEFAULT_BRIDGE_SLIPPAGE_BPS = 50;
107
108
 
108
109
  // src/BridgingSdk/findBridgeProviderFromHook.ts
109
110
  function findBridgeProviderFromHook(fullAppData, providers) {
@@ -482,7 +483,9 @@ async function getSwapQuote(params) {
482
483
  sellTokenAddress,
483
484
  buyTokenChainId: _buyTokenChainId,
484
485
  buyTokenAddress: _buyTokenAddress,
486
+ bridgeSlippageBps: _bridgeSlippageBps,
485
487
  amount,
488
+ swapSlippageBps,
486
489
  ...rest
487
490
  } = swapAndBridgeRequest;
488
491
  const { sellTokenAddress: intermediateToken, sellTokenDecimals: intermediaryTokenDecimals } = bridgeRequestWithoutAmount;
@@ -494,6 +497,7 @@ async function getSwapQuote(params) {
494
497
  buyToken: intermediateToken,
495
498
  buyTokenDecimals: intermediaryTokenDecimals,
496
499
  amount: amount.toString(),
500
+ slippageBps: swapSlippageBps,
497
501
  signer
498
502
  };
499
503
  const { signer: _, ...swapParamsToLog } = swapParams;
@@ -5160,7 +5164,7 @@ var NearIntentsBridgeProvider = class {
5160
5164
  const quoteResponse = await this.api.getQuote({
5161
5165
  dry: false,
5162
5166
  swapType: QuoteRequest.swapType.FLEX_INPUT,
5163
- slippageTolerance: request.slippageBps ?? 100,
5167
+ slippageTolerance: request.bridgeSlippageBps ?? DEFAULT_BRIDGE_SLIPPAGE_BPS,
5164
5168
  originAsset: sellToken.assetId,
5165
5169
  depositType: QuoteRequest.depositType.ORIGIN_CHAIN,
5166
5170
  destinationAsset: buyToken.assetId,
@@ -5333,6 +5337,7 @@ export {
5333
5337
  BridgingSdk,
5334
5338
  BungeeBridgeProvider,
5335
5339
  COW_SHED_PROXY_CREATION_GAS,
5340
+ DEFAULT_BRIDGE_SLIPPAGE_BPS,
5336
5341
  DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION,
5337
5342
  DEFAULT_EXTRA_GAS_PROXY_CREATION,
5338
5343
  DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-bridging",
3
- "version": "0.12.1",
3
+ "version": "1.0.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-common": "0.4.0",
20
- "@cowprotocol/sdk-contracts-ts": "0.8.1",
21
- "@cowprotocol/sdk-cow-shed": "0.2.8",
22
- "@cowprotocol/sdk-order-book": "0.4.4",
23
- "@cowprotocol/sdk-trading": "0.7.1",
24
- "@cowprotocol/sdk-weiroll": "0.1.11",
19
+ "@cowprotocol/sdk-app-data": "4.3.6",
25
20
  "@cowprotocol/sdk-config": "0.6.2",
26
- "@cowprotocol/sdk-app-data": "4.3.6"
21
+ "@cowprotocol/sdk-contracts-ts": "1.0.0",
22
+ "@cowprotocol/sdk-cow-shed": "0.2.9",
23
+ "@cowprotocol/sdk-order-book": "0.4.4",
24
+ "@cowprotocol/sdk-common": "0.4.0",
25
+ "@cowprotocol/sdk-trading": "0.7.2",
26
+ "@cowprotocol/sdk-weiroll": "0.1.11"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^29.4.0",
@@ -38,10 +38,10 @@
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.0",
42
41
  "@cow-sdk/typescript-config": "0.0.0-beta.0",
42
+ "@cowprotocol/sdk-ethers-v5-adapter": "0.3.0",
43
43
  "@cowprotocol/sdk-ethers-v6-adapter": "0.3.0",
44
- "@cowprotocol/sdk-order-signing": "0.1.21",
44
+ "@cowprotocol/sdk-order-signing": "0.1.22",
45
45
  "@cowprotocol/sdk-viem-adapter": "0.3.0"
46
46
  },
47
47
  "scripts": {