@cowprotocol/sdk-bridging 0.12.0 → 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 +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +11 -29
- package/dist/index.mjs +10 -29
- package/package.json +8 -7
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;
|
|
@@ -3804,7 +3809,7 @@ var HOOK_DAPP_BRIDGE_PROVIDER_PREFIX2 = "cow-sdk://bridging/providers";
|
|
|
3804
3809
|
var BungeeTxDataBytesIndices = {
|
|
3805
3810
|
across: {
|
|
3806
3811
|
// bridgeERC20To
|
|
3807
|
-
["
|
|
3812
|
+
["0xcc54d224".toLowerCase()]: {
|
|
3808
3813
|
inputAmount: {
|
|
3809
3814
|
bytes_startIndex: 8,
|
|
3810
3815
|
// first 8 bytes are the routeId, followed by the function selector
|
|
@@ -3814,20 +3819,10 @@ var BungeeTxDataBytesIndices = {
|
|
|
3814
3819
|
// first two characters are 0x and 8 bytes = 16 chars for the amount
|
|
3815
3820
|
bytesString_length: 32 * 2
|
|
3816
3821
|
// 32 bytes = 64 chars for the amount
|
|
3817
|
-
},
|
|
3818
|
-
outputAmount: {
|
|
3819
|
-
bytes_startIndex: 488,
|
|
3820
|
-
// outputAmount is part of the AcrossBridgeData struct in SocketGateway AcrossV3 impl
|
|
3821
|
-
bytes_length: 32,
|
|
3822
|
-
// 32 bytes of amount
|
|
3823
|
-
bytesString_startIndex: 2 + 488 * 2,
|
|
3824
|
-
// first two characters are 0x and 484 bytes = 968 chars for the amount
|
|
3825
|
-
bytesString_length: 32 * 2
|
|
3826
|
-
// 32 bytes = 64 chars for the amount
|
|
3827
3822
|
}
|
|
3828
3823
|
},
|
|
3829
3824
|
// bridgeNativeTo
|
|
3830
|
-
["
|
|
3825
|
+
["0xa3b8bfba".toLowerCase()]: {
|
|
3831
3826
|
inputAmount: {
|
|
3832
3827
|
bytes_startIndex: 8,
|
|
3833
3828
|
// first 8 bytes are the routeId, followed by the function selector
|
|
@@ -3837,16 +3832,6 @@ var BungeeTxDataBytesIndices = {
|
|
|
3837
3832
|
// first two characters are 0x and 8 bytes = 16 chars for the amount
|
|
3838
3833
|
bytesString_length: 32 * 2
|
|
3839
3834
|
// 32 bytes = 64 chars for the amount
|
|
3840
|
-
},
|
|
3841
|
-
outputAmount: {
|
|
3842
|
-
bytes_startIndex: 392,
|
|
3843
|
-
// outputAmount is part of the AcrossBridgeData struct in SocketGateway AcrossV3 impl
|
|
3844
|
-
bytes_length: 32,
|
|
3845
|
-
// 32 bytes of amount
|
|
3846
|
-
bytesString_startIndex: 2 + 392 * 2,
|
|
3847
|
-
// first two characters are 0x and 484 bytes = 968 chars for the amount
|
|
3848
|
-
bytesString_length: 32 * 2
|
|
3849
|
-
// 32 bytes = 64 chars for the amount
|
|
3850
3835
|
}
|
|
3851
3836
|
}
|
|
3852
3837
|
},
|
|
@@ -4720,13 +4705,9 @@ async function createBungeeDepositCall(params) {
|
|
|
4720
4705
|
throw new Error(`createBungeeDepositCall() no params for function [${functionSelector}]`);
|
|
4721
4706
|
}
|
|
4722
4707
|
const inputAmountStartIndex = functionParams.inputAmount.bytes_startIndex;
|
|
4723
|
-
|
|
4724
|
-
|
|
4708
|
+
const modifyOutputAmount = false;
|
|
4709
|
+
const outputAmountStartIndex = 0;
|
|
4725
4710
|
const nativeTokenExtraFee = 0n;
|
|
4726
|
-
if (bridge === "across" /* Across */) {
|
|
4727
|
-
modifyOutputAmount = true;
|
|
4728
|
-
outputAmountStartIndex = functionParams.outputAmount.bytes_startIndex;
|
|
4729
|
-
}
|
|
4730
4711
|
const modifyCalldataParams = adapter.utils.encodeAbi(
|
|
4731
4712
|
["uint256", "bool", "uint256"],
|
|
4732
4713
|
[inputAmountStartIndex, modifyOutputAmount, outputAmountStartIndex]
|
|
@@ -5225,7 +5206,7 @@ var NearIntentsBridgeProvider = class {
|
|
|
5225
5206
|
const quoteResponse = await this.api.getQuote({
|
|
5226
5207
|
dry: false,
|
|
5227
5208
|
swapType: import_one_click_sdk_typescript2.QuoteRequest.swapType.FLEX_INPUT,
|
|
5228
|
-
slippageTolerance: request.
|
|
5209
|
+
slippageTolerance: request.bridgeSlippageBps ?? DEFAULT_BRIDGE_SLIPPAGE_BPS,
|
|
5229
5210
|
originAsset: sellToken.assetId,
|
|
5230
5211
|
depositType: import_one_click_sdk_typescript2.QuoteRequest.depositType.ORIGIN_CHAIN,
|
|
5231
5212
|
destinationAsset: buyToken.assetId,
|
|
@@ -5399,6 +5380,7 @@ var NearIntentsBridgeProvider = class {
|
|
|
5399
5380
|
BridgingSdk,
|
|
5400
5381
|
BungeeBridgeProvider,
|
|
5401
5382
|
COW_SHED_PROXY_CREATION_GAS,
|
|
5383
|
+
DEFAULT_BRIDGE_SLIPPAGE_BPS,
|
|
5402
5384
|
DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION,
|
|
5403
5385
|
DEFAULT_EXTRA_GAS_PROXY_CREATION,
|
|
5404
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;
|
|
@@ -3754,7 +3758,7 @@ var HOOK_DAPP_BRIDGE_PROVIDER_PREFIX2 = "cow-sdk://bridging/providers";
|
|
|
3754
3758
|
var BungeeTxDataBytesIndices = {
|
|
3755
3759
|
across: {
|
|
3756
3760
|
// bridgeERC20To
|
|
3757
|
-
["
|
|
3761
|
+
["0xcc54d224".toLowerCase()]: {
|
|
3758
3762
|
inputAmount: {
|
|
3759
3763
|
bytes_startIndex: 8,
|
|
3760
3764
|
// first 8 bytes are the routeId, followed by the function selector
|
|
@@ -3764,20 +3768,10 @@ var BungeeTxDataBytesIndices = {
|
|
|
3764
3768
|
// first two characters are 0x and 8 bytes = 16 chars for the amount
|
|
3765
3769
|
bytesString_length: 32 * 2
|
|
3766
3770
|
// 32 bytes = 64 chars for the amount
|
|
3767
|
-
},
|
|
3768
|
-
outputAmount: {
|
|
3769
|
-
bytes_startIndex: 488,
|
|
3770
|
-
// outputAmount is part of the AcrossBridgeData struct in SocketGateway AcrossV3 impl
|
|
3771
|
-
bytes_length: 32,
|
|
3772
|
-
// 32 bytes of amount
|
|
3773
|
-
bytesString_startIndex: 2 + 488 * 2,
|
|
3774
|
-
// first two characters are 0x and 484 bytes = 968 chars for the amount
|
|
3775
|
-
bytesString_length: 32 * 2
|
|
3776
|
-
// 32 bytes = 64 chars for the amount
|
|
3777
3771
|
}
|
|
3778
3772
|
},
|
|
3779
3773
|
// bridgeNativeTo
|
|
3780
|
-
["
|
|
3774
|
+
["0xa3b8bfba".toLowerCase()]: {
|
|
3781
3775
|
inputAmount: {
|
|
3782
3776
|
bytes_startIndex: 8,
|
|
3783
3777
|
// first 8 bytes are the routeId, followed by the function selector
|
|
@@ -3787,16 +3781,6 @@ var BungeeTxDataBytesIndices = {
|
|
|
3787
3781
|
// first two characters are 0x and 8 bytes = 16 chars for the amount
|
|
3788
3782
|
bytesString_length: 32 * 2
|
|
3789
3783
|
// 32 bytes = 64 chars for the amount
|
|
3790
|
-
},
|
|
3791
|
-
outputAmount: {
|
|
3792
|
-
bytes_startIndex: 392,
|
|
3793
|
-
// outputAmount is part of the AcrossBridgeData struct in SocketGateway AcrossV3 impl
|
|
3794
|
-
bytes_length: 32,
|
|
3795
|
-
// 32 bytes of amount
|
|
3796
|
-
bytesString_startIndex: 2 + 392 * 2,
|
|
3797
|
-
// first two characters are 0x and 484 bytes = 968 chars for the amount
|
|
3798
|
-
bytesString_length: 32 * 2
|
|
3799
|
-
// 32 bytes = 64 chars for the amount
|
|
3800
3784
|
}
|
|
3801
3785
|
}
|
|
3802
3786
|
},
|
|
@@ -4670,13 +4654,9 @@ async function createBungeeDepositCall(params) {
|
|
|
4670
4654
|
throw new Error(`createBungeeDepositCall() no params for function [${functionSelector}]`);
|
|
4671
4655
|
}
|
|
4672
4656
|
const inputAmountStartIndex = functionParams.inputAmount.bytes_startIndex;
|
|
4673
|
-
|
|
4674
|
-
|
|
4657
|
+
const modifyOutputAmount = false;
|
|
4658
|
+
const outputAmountStartIndex = 0;
|
|
4675
4659
|
const nativeTokenExtraFee = 0n;
|
|
4676
|
-
if (bridge === "across" /* Across */) {
|
|
4677
|
-
modifyOutputAmount = true;
|
|
4678
|
-
outputAmountStartIndex = functionParams.outputAmount.bytes_startIndex;
|
|
4679
|
-
}
|
|
4680
4660
|
const modifyCalldataParams = adapter.utils.encodeAbi(
|
|
4681
4661
|
["uint256", "bool", "uint256"],
|
|
4682
4662
|
[inputAmountStartIndex, modifyOutputAmount, outputAmountStartIndex]
|
|
@@ -5184,7 +5164,7 @@ var NearIntentsBridgeProvider = class {
|
|
|
5184
5164
|
const quoteResponse = await this.api.getQuote({
|
|
5185
5165
|
dry: false,
|
|
5186
5166
|
swapType: QuoteRequest.swapType.FLEX_INPUT,
|
|
5187
|
-
slippageTolerance: request.
|
|
5167
|
+
slippageTolerance: request.bridgeSlippageBps ?? DEFAULT_BRIDGE_SLIPPAGE_BPS,
|
|
5188
5168
|
originAsset: sellToken.assetId,
|
|
5189
5169
|
depositType: QuoteRequest.depositType.ORIGIN_CHAIN,
|
|
5190
5170
|
destinationAsset: buyToken.assetId,
|
|
@@ -5357,6 +5337,7 @@ export {
|
|
|
5357
5337
|
BridgingSdk,
|
|
5358
5338
|
BungeeBridgeProvider,
|
|
5359
5339
|
COW_SHED_PROXY_CREATION_GAS,
|
|
5340
|
+
DEFAULT_BRIDGE_SLIPPAGE_BPS,
|
|
5360
5341
|
DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION,
|
|
5361
5342
|
DEFAULT_EXTRA_GAS_PROXY_CREATION,
|
|
5362
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.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Bridging for CoW Protocol",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"@defuse-protocol/one-click-sdk-typescript": "0.1.1-0.2",
|
|
18
18
|
"json-stable-stringify": "^1.3.0",
|
|
19
19
|
"@cowprotocol/sdk-app-data": "4.3.6",
|
|
20
|
-
"@cowprotocol/sdk-common": "0.4.0",
|
|
21
|
-
"@cowprotocol/sdk-contracts-ts": "0.8.1",
|
|
22
20
|
"@cowprotocol/sdk-config": "0.6.2",
|
|
21
|
+
"@cowprotocol/sdk-contracts-ts": "1.0.0",
|
|
22
|
+
"@cowprotocol/sdk-cow-shed": "0.2.9",
|
|
23
23
|
"@cowprotocol/sdk-order-book": "0.4.4",
|
|
24
|
-
"@cowprotocol/sdk-
|
|
25
|
-
"@cowprotocol/sdk-
|
|
24
|
+
"@cowprotocol/sdk-common": "0.4.0",
|
|
25
|
+
"@cowprotocol/sdk-trading": "0.7.2",
|
|
26
26
|
"@cowprotocol/sdk-weiroll": "0.1.11"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
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-order-signing": "0.1.
|
|
44
|
+
"@cowprotocol/sdk-order-signing": "0.1.22",
|
|
45
45
|
"@cowprotocol/sdk-viem-adapter": "0.3.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"test": "jest",
|
|
52
52
|
"test:coverage": "jest --coverage --json --outputFile=jest.results.json && npx coveralls < ./coverage/lcov.info",
|
|
53
53
|
"test:coverage:html": "jest --silent=false --coverage --coverageReporters html",
|
|
54
|
-
"test:bungeeGnosisBridge": "
|
|
54
|
+
"test:bungeeGnosisBridge": "jest --testPathPattern=BungeeGnosisBridge",
|
|
55
|
+
"test:bungeeAcrossBridge": "jest --testPathPattern=BungeeAcrossBridge",
|
|
55
56
|
"typecheck": "tsc --noEmit"
|
|
56
57
|
}
|
|
57
58
|
}
|