@cowprotocol/sdk-bridging 1.1.1 → 1.2.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
@@ -49,6 +49,14 @@ interface BridgeQuoteResult {
49
49
  * Provider who implement ReceiverAccountBridgeProvider must return a signature of a quote than will be used to verify the quote deposit address validity
50
50
  */
51
51
  signature?: string;
52
+ /**
53
+ * For ReceiverAccountBridgeProvider, this is the attestation signature from the bridge provider that validates the deposit address. Empty for other provider types.
54
+ */
55
+ attestationSignature?: string;
56
+ /**
57
+ * A stringified JSON of quote which is associated with the order.
58
+ */
59
+ quoteBody?: string;
52
60
  /**
53
61
  * Whether the quote is a sell or buy order.
54
62
  */
@@ -1270,8 +1278,16 @@ declare class NearIntentsApi {
1270
1278
  getAttestation(request: GetAttestationRequest): Promise<GetAttestationResponse>;
1271
1279
  }
1272
1280
 
1281
+ interface DepositAddressContext {
1282
+ address: Address$1;
1283
+ quoteHash: string;
1284
+ stringifiedQuote: string;
1285
+ attestationSignature: string;
1286
+ }
1273
1287
  interface NearIntentsQuoteResult extends BridgeQuoteResult {
1274
1288
  depositAddress: Hex;
1289
+ attestationSignature: string;
1290
+ quoteBody: string;
1275
1291
  }
1276
1292
  interface NearIntentsBridgeProviderOptions {
1277
1293
  cowShedOptions?: CowShedSdkOptions;
@@ -1295,10 +1311,10 @@ declare class NearIntentsBridgeProvider implements ReceiverAccountBridgeProvider
1295
1311
  getStatus(bridgingId: string, _originChainId: SupportedChainId): Promise<BridgeStatusResult>;
1296
1312
  getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
1297
1313
  getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
1298
- recoverDepositAddress({ quote, quoteRequest, timestamp, }: QuoteResponse): Promise<{
1299
- address: Address$1;
1300
- quoteHash: string;
1301
- } | null>;
1314
+ /**
1315
+ * A script to verify depositAddress from appData: https://codesandbox.io/p/sandbox/h7tngy
1316
+ */
1317
+ recoverDepositAddress({ quote, quoteRequest, timestamp, }: QuoteResponse): Promise<DepositAddressContext | null>;
1302
1318
  }
1303
1319
 
1304
1320
  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 MultiQuoteContext, 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
@@ -49,6 +49,14 @@ interface BridgeQuoteResult {
49
49
  * Provider who implement ReceiverAccountBridgeProvider must return a signature of a quote than will be used to verify the quote deposit address validity
50
50
  */
51
51
  signature?: string;
52
+ /**
53
+ * For ReceiverAccountBridgeProvider, this is the attestation signature from the bridge provider that validates the deposit address. Empty for other provider types.
54
+ */
55
+ attestationSignature?: string;
56
+ /**
57
+ * A stringified JSON of quote which is associated with the order.
58
+ */
59
+ quoteBody?: string;
52
60
  /**
53
61
  * Whether the quote is a sell or buy order.
54
62
  */
@@ -1270,8 +1278,16 @@ declare class NearIntentsApi {
1270
1278
  getAttestation(request: GetAttestationRequest): Promise<GetAttestationResponse>;
1271
1279
  }
1272
1280
 
1281
+ interface DepositAddressContext {
1282
+ address: Address$1;
1283
+ quoteHash: string;
1284
+ stringifiedQuote: string;
1285
+ attestationSignature: string;
1286
+ }
1273
1287
  interface NearIntentsQuoteResult extends BridgeQuoteResult {
1274
1288
  depositAddress: Hex;
1289
+ attestationSignature: string;
1290
+ quoteBody: string;
1275
1291
  }
1276
1292
  interface NearIntentsBridgeProviderOptions {
1277
1293
  cowShedOptions?: CowShedSdkOptions;
@@ -1295,10 +1311,10 @@ declare class NearIntentsBridgeProvider implements ReceiverAccountBridgeProvider
1295
1311
  getStatus(bridgingId: string, _originChainId: SupportedChainId): Promise<BridgeStatusResult>;
1296
1312
  getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
1297
1313
  getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
1298
- recoverDepositAddress({ quote, quoteRequest, timestamp, }: QuoteResponse): Promise<{
1299
- address: Address$1;
1300
- quoteHash: string;
1301
- } | null>;
1314
+ /**
1315
+ * A script to verify depositAddress from appData: https://codesandbox.io/p/sandbox/h7tngy
1316
+ */
1317
+ recoverDepositAddress({ quote, quoteRequest, timestamp, }: QuoteResponse): Promise<DepositAddressContext | null>;
1302
1318
  }
1303
1319
 
1304
1320
  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 MultiQuoteContext, 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
@@ -772,6 +772,8 @@ async function getAccountBridgeResult(provider, context) {
772
772
  const bridgeResult = {
773
773
  id: bridgingQuote.id,
774
774
  signature: bridgingQuote.signature,
775
+ attestationSignature: bridgingQuote.attestationSignature,
776
+ quoteBody: bridgingQuote.quoteBody,
775
777
  providerInfo: provider.info,
776
778
  tradeParameters: bridgeRequest,
777
779
  // Just the bridge (not the swap & bridge)
@@ -812,6 +814,10 @@ async function getHookBridgeResult(provider, context) {
812
814
  });
813
815
  const bridgeResult = {
814
816
  providerInfo: provider.info,
817
+ id: bridgingQuote.id,
818
+ signature: bridgingQuote.signature,
819
+ attestationSignature: bridgingQuote.attestationSignature,
820
+ quoteBody: bridgingQuote.quoteBody,
815
821
  tradeParameters: bridgeRequest,
816
822
  // Just the bridge (not the swap & bridge)
817
823
  bridgeCallDetails: {
@@ -833,7 +839,9 @@ function overrideAppDataWithBridgingQuoteDetails(bridgingMetaData, quote) {
833
839
  return {
834
840
  ...bridgingMetaData,
835
841
  ...quote.id ? { quoteId: quote.id } : void 0,
836
- ...quote.signature ? { quoteSignature: quote.signature } : void 0
842
+ ...quote.signature ? { quoteSignature: quote.signature } : void 0,
843
+ ...quote.attestationSignature ? { attestationSignature: quote.attestationSignature } : void 0,
844
+ ...quote.quoteBody ? { quoteBody: quote.quoteBody } : void 0
837
845
  };
838
846
  }
839
847
 
@@ -1580,6 +1588,7 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1580
1588
  var import_sdk_config5 = require("@cowprotocol/sdk-config");
1581
1589
  var import_sdk_order_book4 = require("@cowprotocol/sdk-order-book");
1582
1590
  var import_sdk_common8 = require("@cowprotocol/sdk-common");
1591
+ var import_json_stable_stringify = __toESM(require("json-stable-stringify"));
1583
1592
  var PCT_100_PERCENT = 10n ** 18n;
1584
1593
  function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
1585
1594
  const { kind } = request;
@@ -1587,6 +1596,7 @@ function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
1587
1596
  isSell: kind === import_sdk_order_book4.OrderKind.SELL,
1588
1597
  amountsAndCosts: toAmountsAndCosts(request, slippageBps, suggestedFees),
1589
1598
  quoteTimestamp: Number(suggestedFees.timestamp),
1599
+ quoteBody: (0, import_json_stable_stringify.default)(suggestedFees),
1590
1600
  expectedFillTimeSeconds: Number(suggestedFees.estimatedFillTimeSec),
1591
1601
  fees: {
1592
1602
  bridgeFee: BigInt(suggestedFees.relayerCapitalFee.total),
@@ -3889,6 +3899,7 @@ var BungeeBridgeNames = {
3889
3899
 
3890
3900
  // src/providers/bungee/util.ts
3891
3901
  var import_sdk_order_book6 = require("@cowprotocol/sdk-order-book");
3902
+ var import_json_stable_stringify2 = __toESM(require("json-stable-stringify"));
3892
3903
  function toBridgeQuoteResult2(request, slippageBps, bungeeQuoteWithBuildTx) {
3893
3904
  const { kind } = request;
3894
3905
  const { bungeeQuote, buildTx } = bungeeQuoteWithBuildTx;
@@ -3898,6 +3909,7 @@ function toBridgeQuoteResult2(request, slippageBps, bungeeQuoteWithBuildTx) {
3898
3909
  amountsAndCosts: toAmountsAndCosts2(request, slippageBps, bungeeQuote),
3899
3910
  quoteTimestamp: Number(bungeeQuote.quoteTimestamp),
3900
3911
  expectedFillTimeSeconds: Number(bungeeQuote.route.estimatedTime),
3912
+ quoteBody: (0, import_json_stable_stringify2.default)(bungeeQuote),
3901
3913
  fees: {
3902
3914
  // @note routeFee is taken in the src chain intermediate token
3903
3915
  bridgeFee: BigInt(bungeeQuote.route.routeDetails.routeFee.amount),
@@ -5035,7 +5047,7 @@ var ATTESTION_VERSION_BYTE = "0x00";
5035
5047
  var ATTESTATOR_ADDRESS = "0x0073DD100b51C555E41B2a452E5933ef76F42790";
5036
5048
 
5037
5049
  // src/providers/near-intents/util.ts
5038
- var import_json_stable_stringify = __toESM(require("json-stable-stringify"));
5050
+ var import_json_stable_stringify3 = __toESM(require("json-stable-stringify"));
5039
5051
  var import_sdk_common16 = require("@cowprotocol/sdk-common");
5040
5052
  var import_sdk_config11 = require("@cowprotocol/sdk-config");
5041
5053
  var calculateDeadline = (seconds) => {
@@ -5087,7 +5099,7 @@ var hashQuote = ({
5087
5099
  timestamp
5088
5100
  }) => {
5089
5101
  const adapter = (0, import_sdk_common16.getGlobalAdapter)();
5090
- const data = (0, import_json_stable_stringify.default)({
5102
+ const stringifiedQuote = (0, import_json_stable_stringify3.default)({
5091
5103
  dry: false,
5092
5104
  swapType: quoteRequest.swapType,
5093
5105
  slippageTolerance: quoteRequest.slippageTolerance,
@@ -5100,10 +5112,10 @@ var hashQuote = ({
5100
5112
  recipient: quoteRequest.recipient,
5101
5113
  recipientType: quoteRequest.recipientType,
5102
5114
  deadline: quoteRequest.deadline,
5103
- quoteWaitingTimeMs: !!quoteRequest.quoteWaitingTimeMs ? quoteRequest.quoteWaitingTimeMs : void 0,
5104
- referral: !!quoteRequest.referral ? quoteRequest.referral : void 0,
5105
- virtualChainRecipient: !!quoteRequest.virtualChainRecipient ? quoteRequest.virtualChainRecipient : void 0,
5106
- virtualChainRefundRecipient: !!quoteRequest.virtualChainRefundRecipient ? quoteRequest.virtualChainRefundRecipient : void 0,
5115
+ quoteWaitingTimeMs: quoteRequest.quoteWaitingTimeMs ? quoteRequest.quoteWaitingTimeMs : void 0,
5116
+ referral: quoteRequest.referral ? quoteRequest.referral : void 0,
5117
+ virtualChainRecipient: quoteRequest.virtualChainRecipient ? quoteRequest.virtualChainRecipient : void 0,
5118
+ virtualChainRefundRecipient: quoteRequest.virtualChainRefundRecipient ? quoteRequest.virtualChainRefundRecipient : void 0,
5107
5119
  customRecipientMsg: void 0,
5108
5120
  sessionId: void 0,
5109
5121
  connectedWallets: void 0,
@@ -5118,10 +5130,11 @@ var hashQuote = ({
5118
5130
  minAmountOut: quote.minAmountOut,
5119
5131
  timestamp
5120
5132
  });
5121
- if (!data) {
5133
+ if (!stringifiedQuote) {
5122
5134
  throw new Error("Failed to serialize quote data: quote or quoteRequest may be undefined or invalid");
5123
5135
  }
5124
- return adapter.utils.sha256(adapter.utils.toUtf8Bytes(data));
5136
+ const hash = adapter.utils.sha256(adapter.utils.toUtf8Bytes(stringifiedQuote));
5137
+ return { hash, stringifiedQuote };
5125
5138
  };
5126
5139
 
5127
5140
  // src/providers/near-intents/NearIntentsBridgeProvider.ts
@@ -5232,6 +5245,8 @@ var NearIntentsBridgeProvider = class {
5232
5245
  return {
5233
5246
  id: recoveredDepositAddress.quoteHash,
5234
5247
  signature: quoteResponse.signature,
5248
+ attestationSignature: recoveredDepositAddress.attestationSignature,
5249
+ quoteBody: recoveredDepositAddress.stringifiedQuote,
5235
5250
  isSell: request.kind === import_sdk_order_book8.OrderKind.SELL,
5236
5251
  depositAddress: quote.depositAddress,
5237
5252
  quoteTimestamp: new Date(isoDate).getTime(),
@@ -5339,6 +5354,9 @@ var NearIntentsBridgeProvider = class {
5339
5354
  getRefundBridgingTx(_bridgingId) {
5340
5355
  throw new Error("Not implemented");
5341
5356
  }
5357
+ /**
5358
+ * A script to verify depositAddress from appData: https://codesandbox.io/p/sandbox/h7tngy
5359
+ */
5342
5360
  async recoverDepositAddress({
5343
5361
  quote,
5344
5362
  quoteRequest,
@@ -5348,7 +5366,7 @@ var NearIntentsBridgeProvider = class {
5348
5366
  if (!quote?.depositAddress)
5349
5367
  return null;
5350
5368
  const utils = (0, import_sdk_common17.getGlobalAdapter)().utils;
5351
- const quoteHash = hashQuote({ quote, quoteRequest, timestamp });
5369
+ const { hash: quoteHash, stringifiedQuote } = hashQuote({ quote, quoteRequest, timestamp });
5352
5370
  const depositAddr = utils.getChecksumAddress(quote.depositAddress);
5353
5371
  const { signature } = await this.api.getAttestation({
5354
5372
  quoteHash,
@@ -5361,7 +5379,9 @@ var NearIntentsBridgeProvider = class {
5361
5379
  const hash = utils.keccak256(messageBytes);
5362
5380
  return {
5363
5381
  address: await utils.recoverAddress(hash, signature),
5364
- quoteHash
5382
+ quoteHash,
5383
+ stringifiedQuote,
5384
+ attestationSignature: signature
5365
5385
  };
5366
5386
  } catch {
5367
5387
  return null;
package/dist/index.mjs CHANGED
@@ -715,6 +715,8 @@ async function getAccountBridgeResult(provider, context) {
715
715
  const bridgeResult = {
716
716
  id: bridgingQuote.id,
717
717
  signature: bridgingQuote.signature,
718
+ attestationSignature: bridgingQuote.attestationSignature,
719
+ quoteBody: bridgingQuote.quoteBody,
718
720
  providerInfo: provider.info,
719
721
  tradeParameters: bridgeRequest,
720
722
  // Just the bridge (not the swap & bridge)
@@ -755,6 +757,10 @@ async function getHookBridgeResult(provider, context) {
755
757
  });
756
758
  const bridgeResult = {
757
759
  providerInfo: provider.info,
760
+ id: bridgingQuote.id,
761
+ signature: bridgingQuote.signature,
762
+ attestationSignature: bridgingQuote.attestationSignature,
763
+ quoteBody: bridgingQuote.quoteBody,
758
764
  tradeParameters: bridgeRequest,
759
765
  // Just the bridge (not the swap & bridge)
760
766
  bridgeCallDetails: {
@@ -776,7 +782,9 @@ function overrideAppDataWithBridgingQuoteDetails(bridgingMetaData, quote) {
776
782
  return {
777
783
  ...bridgingMetaData,
778
784
  ...quote.id ? { quoteId: quote.id } : void 0,
779
- ...quote.signature ? { quoteSignature: quote.signature } : void 0
785
+ ...quote.signature ? { quoteSignature: quote.signature } : void 0,
786
+ ...quote.attestationSignature ? { attestationSignature: quote.attestationSignature } : void 0,
787
+ ...quote.quoteBody ? { quoteBody: quote.quoteBody } : void 0
780
788
  };
781
789
  }
782
790
 
@@ -1523,6 +1531,7 @@ var ACROSS_MATH_CONTRACT_ADDRESSES = {
1523
1531
  import { COW_PROTOCOL_SETTLEMENT_CONTRACT_ADDRESS } from "@cowprotocol/sdk-config";
1524
1532
  import { getBigNumber, OrderKind as OrderKind2 } from "@cowprotocol/sdk-order-book";
1525
1533
  import { getGlobalAdapter as getGlobalAdapter5 } from "@cowprotocol/sdk-common";
1534
+ import stringify from "json-stable-stringify";
1526
1535
  var PCT_100_PERCENT = 10n ** 18n;
1527
1536
  function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
1528
1537
  const { kind } = request;
@@ -1530,6 +1539,7 @@ function toBridgeQuoteResult(request, slippageBps, suggestedFees) {
1530
1539
  isSell: kind === OrderKind2.SELL,
1531
1540
  amountsAndCosts: toAmountsAndCosts(request, slippageBps, suggestedFees),
1532
1541
  quoteTimestamp: Number(suggestedFees.timestamp),
1542
+ quoteBody: stringify(suggestedFees),
1533
1543
  expectedFillTimeSeconds: Number(suggestedFees.estimatedFillTimeSec),
1534
1544
  fees: {
1535
1545
  bridgeFee: BigInt(suggestedFees.relayerCapitalFee.total),
@@ -3838,6 +3848,7 @@ var BungeeBridgeNames = {
3838
3848
 
3839
3849
  // src/providers/bungee/util.ts
3840
3850
  import { getBigNumber as getBigNumber2, OrderKind as OrderKind4 } from "@cowprotocol/sdk-order-book";
3851
+ import stringify2 from "json-stable-stringify";
3841
3852
  function toBridgeQuoteResult2(request, slippageBps, bungeeQuoteWithBuildTx) {
3842
3853
  const { kind } = request;
3843
3854
  const { bungeeQuote, buildTx } = bungeeQuoteWithBuildTx;
@@ -3847,6 +3858,7 @@ function toBridgeQuoteResult2(request, slippageBps, bungeeQuoteWithBuildTx) {
3847
3858
  amountsAndCosts: toAmountsAndCosts2(request, slippageBps, bungeeQuote),
3848
3859
  quoteTimestamp: Number(bungeeQuote.quoteTimestamp),
3849
3860
  expectedFillTimeSeconds: Number(bungeeQuote.route.estimatedTime),
3861
+ quoteBody: stringify2(bungeeQuote),
3850
3862
  fees: {
3851
3863
  // @note routeFee is taken in the src chain intermediate token
3852
3864
  bridgeFee: BigInt(bungeeQuote.route.routeDetails.routeFee.amount),
@@ -4993,7 +5005,7 @@ var ATTESTION_VERSION_BYTE = "0x00";
4993
5005
  var ATTESTATOR_ADDRESS = "0x0073DD100b51C555E41B2a452E5933ef76F42790";
4994
5006
 
4995
5007
  // src/providers/near-intents/util.ts
4996
- import stringify from "json-stable-stringify";
5008
+ import stringify3 from "json-stable-stringify";
4997
5009
  import { getGlobalAdapter as getGlobalAdapter11 } from "@cowprotocol/sdk-common";
4998
5010
  import { ETH_ADDRESS as ETH_ADDRESS2 } from "@cowprotocol/sdk-config";
4999
5011
  var calculateDeadline = (seconds) => {
@@ -5045,7 +5057,7 @@ var hashQuote = ({
5045
5057
  timestamp
5046
5058
  }) => {
5047
5059
  const adapter = getGlobalAdapter11();
5048
- const data = stringify({
5060
+ const stringifiedQuote = stringify3({
5049
5061
  dry: false,
5050
5062
  swapType: quoteRequest.swapType,
5051
5063
  slippageTolerance: quoteRequest.slippageTolerance,
@@ -5058,10 +5070,10 @@ var hashQuote = ({
5058
5070
  recipient: quoteRequest.recipient,
5059
5071
  recipientType: quoteRequest.recipientType,
5060
5072
  deadline: quoteRequest.deadline,
5061
- quoteWaitingTimeMs: !!quoteRequest.quoteWaitingTimeMs ? quoteRequest.quoteWaitingTimeMs : void 0,
5062
- referral: !!quoteRequest.referral ? quoteRequest.referral : void 0,
5063
- virtualChainRecipient: !!quoteRequest.virtualChainRecipient ? quoteRequest.virtualChainRecipient : void 0,
5064
- virtualChainRefundRecipient: !!quoteRequest.virtualChainRefundRecipient ? quoteRequest.virtualChainRefundRecipient : void 0,
5073
+ quoteWaitingTimeMs: quoteRequest.quoteWaitingTimeMs ? quoteRequest.quoteWaitingTimeMs : void 0,
5074
+ referral: quoteRequest.referral ? quoteRequest.referral : void 0,
5075
+ virtualChainRecipient: quoteRequest.virtualChainRecipient ? quoteRequest.virtualChainRecipient : void 0,
5076
+ virtualChainRefundRecipient: quoteRequest.virtualChainRefundRecipient ? quoteRequest.virtualChainRefundRecipient : void 0,
5065
5077
  customRecipientMsg: void 0,
5066
5078
  sessionId: void 0,
5067
5079
  connectedWallets: void 0,
@@ -5076,10 +5088,11 @@ var hashQuote = ({
5076
5088
  minAmountOut: quote.minAmountOut,
5077
5089
  timestamp
5078
5090
  });
5079
- if (!data) {
5091
+ if (!stringifiedQuote) {
5080
5092
  throw new Error("Failed to serialize quote data: quote or quoteRequest may be undefined or invalid");
5081
5093
  }
5082
- return adapter.utils.sha256(adapter.utils.toUtf8Bytes(data));
5094
+ const hash = adapter.utils.sha256(adapter.utils.toUtf8Bytes(stringifiedQuote));
5095
+ return { hash, stringifiedQuote };
5083
5096
  };
5084
5097
 
5085
5098
  // src/providers/near-intents/NearIntentsBridgeProvider.ts
@@ -5190,6 +5203,8 @@ var NearIntentsBridgeProvider = class {
5190
5203
  return {
5191
5204
  id: recoveredDepositAddress.quoteHash,
5192
5205
  signature: quoteResponse.signature,
5206
+ attestationSignature: recoveredDepositAddress.attestationSignature,
5207
+ quoteBody: recoveredDepositAddress.stringifiedQuote,
5193
5208
  isSell: request.kind === OrderKind6.SELL,
5194
5209
  depositAddress: quote.depositAddress,
5195
5210
  quoteTimestamp: new Date(isoDate).getTime(),
@@ -5297,6 +5312,9 @@ var NearIntentsBridgeProvider = class {
5297
5312
  getRefundBridgingTx(_bridgingId) {
5298
5313
  throw new Error("Not implemented");
5299
5314
  }
5315
+ /**
5316
+ * A script to verify depositAddress from appData: https://codesandbox.io/p/sandbox/h7tngy
5317
+ */
5300
5318
  async recoverDepositAddress({
5301
5319
  quote,
5302
5320
  quoteRequest,
@@ -5306,7 +5324,7 @@ var NearIntentsBridgeProvider = class {
5306
5324
  if (!quote?.depositAddress)
5307
5325
  return null;
5308
5326
  const utils = getGlobalAdapter12().utils;
5309
- const quoteHash = hashQuote({ quote, quoteRequest, timestamp });
5327
+ const { hash: quoteHash, stringifiedQuote } = hashQuote({ quote, quoteRequest, timestamp });
5310
5328
  const depositAddr = utils.getChecksumAddress(quote.depositAddress);
5311
5329
  const { signature } = await this.api.getAttestation({
5312
5330
  quoteHash,
@@ -5319,7 +5337,9 @@ var NearIntentsBridgeProvider = class {
5319
5337
  const hash = utils.keccak256(messageBytes);
5320
5338
  return {
5321
5339
  address: await utils.recoverAddress(hash, signature),
5322
- quoteHash
5340
+ quoteHash,
5341
+ stringifiedQuote,
5342
+ attestationSignature: signature
5323
5343
  };
5324
5344
  } catch {
5325
5345
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cowprotocol/sdk-bridging",
3
- "version": "1.1.1",
3
+ "version": "1.2.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.4.0",
20
- "@cowprotocol/sdk-cow-shed": "0.2.9",
19
+ "@cowprotocol/sdk-app-data": "4.5.0",
21
20
  "@cowprotocol/sdk-common": "0.4.0",
22
- "@cowprotocol/sdk-order-book": "0.5.0",
23
21
  "@cowprotocol/sdk-contracts-ts": "1.0.0",
24
- "@cowprotocol/sdk-trading": "0.7.3",
25
22
  "@cowprotocol/sdk-config": "0.6.2",
26
- "@cowprotocol/sdk-weiroll": "0.1.11"
23
+ "@cowprotocol/sdk-cow-shed": "0.2.9",
24
+ "@cowprotocol/sdk-trading": "0.8.0",
25
+ "@cowprotocol/sdk-weiroll": "0.1.11",
26
+ "@cowprotocol/sdk-order-book": "0.5.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/jest": "^29.4.0",
@@ -39,10 +39,10 @@
39
39
  "typescript": "^5.2.2",
40
40
  "viem": "^2.28.4",
41
41
  "@cow-sdk/typescript-config": "0.0.0-beta.0",
42
- "@cowprotocol/sdk-ethers-v5-adapter": "0.3.0",
43
42
  "@cowprotocol/sdk-ethers-v6-adapter": "0.3.0",
44
- "@cowprotocol/sdk-viem-adapter": "0.3.0",
45
- "@cowprotocol/sdk-order-signing": "0.1.23"
43
+ "@cowprotocol/sdk-ethers-v5-adapter": "0.3.0",
44
+ "@cowprotocol/sdk-order-signing": "0.1.23",
45
+ "@cowprotocol/sdk-viem-adapter": "0.3.0"
46
46
  },
47
47
  "scripts": {
48
48
  "build": "tsup src/index.ts --format esm,cjs --dts",