@cowprotocol/sdk-bridging 0.6.0 → 0.7.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/README.md CHANGED
@@ -132,7 +132,7 @@ const parameters: QuoteBridgeRequest = {
132
132
  appCode: 'YOUR_APP_CODE',
133
133
  }
134
134
 
135
- const quoteResult = await sdk.bridging.getQuote(parameters)
135
+ const quoteResult = await bridgingSdk.getQuote(parameters)
136
136
  assertIsBridgeQuoteAndPost(quoteResult)
137
137
  const { swap, bridge, postSwapOrderFromQuote } = quoteResult
138
138
 
@@ -171,7 +171,7 @@ const multiQuoteRequest: MultiQuoteRequest = {
171
171
  }
172
172
 
173
173
  // Get quotes from all providers
174
- const results = await sdk.bridging.getMultiQuotes(multiQuoteRequest)
174
+ const results = await bridgingSdk.getMultiQuotes(multiQuoteRequest)
175
175
 
176
176
  results.forEach((result) => {
177
177
  if (result.quote) {
@@ -210,7 +210,7 @@ const multiQuoteRequest: MultiQuoteRequest = {
210
210
  }
211
211
 
212
212
  // This will return all results once completed (or timed out)
213
- const finalResults = await sdk.bridging.getMultiQuotes(multiQuoteRequest)
213
+ const finalResults = await bridgingSdk.getMultiQuotes(multiQuoteRequest)
214
214
 
215
215
  console.log(`Received ${finalResults.filter(r => r.quote).length} successful quotes out of ${finalResults.length} providers`)
216
216
  ```
@@ -227,7 +227,7 @@ const fetchQuotes = async () => {
227
227
  setQuotes([])
228
228
 
229
229
  try {
230
- const results = await sdk.bridging.getMultiQuotes({
230
+ const results = await bridgingSdk.getMultiQuotes({
231
231
  quoteBridgeRequest: parameters,
232
232
  options: {
233
233
  onQuoteResult: (result) => {
@@ -280,7 +280,7 @@ const isBestQuote = (result: MultiQuoteResult): boolean => {
280
280
  The `getMultiQuotes()` method supports two types of timeouts for fine-grained control:
281
281
 
282
282
  ```typescript
283
- const results = await sdk.bridging.getMultiQuotes({
283
+ const results = await bridgingSdk.getMultiQuotes({
284
284
  quoteBridgeRequest: parameters,
285
285
  options: {
286
286
  // Global timeout: Maximum time to wait for all providers to complete
@@ -312,7 +312,7 @@ The `getBestQuote()` method provides an optimized way to get only the best quote
312
312
  import { MultiQuoteRequest } from '@cowprotocol/sdk-bridging'
313
313
 
314
314
  // Get the best quote from all available providers
315
- const bestQuote = await sdk.bridging.getBestQuote({
315
+ const bestQuote = await bridgingSdk.getBestQuote({
316
316
  quoteBridgeRequest: parameters, // Same parameters as above
317
317
  providerDappIds: ['provider1', 'provider2'], // Optional: specify which providers to query
318
318
  advancedSettings: {
@@ -342,7 +342,7 @@ For real-time updates, you can receive notifications each time a better quote is
342
342
  ```typescript
343
343
  let currentBest: MultiQuoteResult | null = null
344
344
 
345
- const bestQuote = await sdk.bridging.getBestQuote({
345
+ const bestQuote = await bridgingSdk.getBestQuote({
346
346
  quoteBridgeRequest: parameters,
347
347
  options: {
348
348
  // Called whenever a better quote is found
@@ -371,7 +371,7 @@ console.log('Final best quote:', bestQuote)
371
371
  When all providers fail, `getBestQuote()` returns the first provider's error:
372
372
 
373
373
  ```typescript
374
- const bestQuote = await sdk.bridging.getBestQuote({
374
+ const bestQuote = await bridgingSdk.getBestQuote({
375
375
  quoteBridgeRequest: parameters,
376
376
  options: {
377
377
  onQuoteResult: (result) => {
@@ -414,6 +414,75 @@ Choose `getMultiQuotes()` when:
414
414
  - You want to analyze all provider responses
415
415
  - You need to show provider-specific errors or statuses
416
416
 
417
+ ## Provider Management
418
+
419
+ The BridgingSdk provides methods to manage which bridge providers are actively used for quotes and operations.
420
+
421
+ ### Getting Available Providers
422
+
423
+ Use `getAvailableProviders()` to retrieve the list of currently active providers:
424
+
425
+ ```typescript
426
+ // Get all active providers
427
+ const providers = bridgingSdk.getAvailableProviders()
428
+
429
+ providers.forEach((provider) => {
430
+ console.log(`Provider: ${provider.info.name}`)
431
+ console.log(`Dapp ID: ${provider.info.dappId}`)
432
+ console.log(`Networks: ${provider.info.supportedChains.join(', ')}`)
433
+ })
434
+ ```
435
+
436
+ ### Filtering Active Providers
437
+
438
+ Use `setAvailableProviders()` to dynamically filter which providers should be used for bridge operations:
439
+
440
+ ```typescript
441
+ // Initially, all configured providers are available
442
+ const allProviders = bridgingSdk.getAvailableProviders()
443
+ console.log(`Total providers: ${allProviders.length}`)
444
+
445
+ // Filter to use only specific providers
446
+ bridgingSdk.setAvailableProviders(['across', 'hop-protocol'])
447
+
448
+ // Now only the specified providers will be used
449
+ const filteredProviders = bridgingSdk.getAvailableProviders()
450
+ console.log(`Active providers: ${filteredProviders.length}`)
451
+
452
+ // Reset to use all providers again
453
+ bridgingSdk.setAvailableProviders([])
454
+ const resetProviders = bridgingSdk.getAvailableProviders()
455
+ console.log(`Reset to all providers: ${resetProviders.length}`)
456
+ ```
457
+
458
+ ### Dynamic Provider Selection Example
459
+
460
+ ```typescript
461
+ // Example: Let users select their preferred bridge providers
462
+ const [selectedProviders, setSelectedProviders] = useState<string[]>([])
463
+
464
+ // Function to update active providers based on user selection
465
+ const updateActiveProviders = (providerIds: string[]) => {
466
+ bridgingSdk.setAvailableProviders(providerIds)
467
+ setSelectedProviders(providerIds)
468
+
469
+ console.log(`Updated to use ${providerIds.length} provider(s)`)
470
+ }
471
+
472
+ // Get quotes only from selected providers
473
+ const getQuotesFromSelectedProviders = async () => {
474
+ // The SDK will automatically use only the providers set via setAvailableProviders
475
+ const quote = await bridgingSdk.getQuote(parameters)
476
+ // Or for multi-provider quotes
477
+ const multiQuotes = await bridgingSdk.getMultiQuotes({
478
+ quoteBridgeRequest: parameters
479
+ // No need to specify providerDappIds, setAvailableProviders already filtered them
480
+ })
481
+
482
+ return quote
483
+ }
484
+ ```
485
+
417
486
  ## Supported Bridge Providers
418
487
 
419
488
  - Additional bridge providers are being integrated
package/dist/index.d.mts CHANGED
@@ -4,12 +4,16 @@ import { ChainInfo, TargetChainId, SupportedChainId, TokenInfo, ChainId, EvmCall
4
4
  import { QuoterParameters, TraderParameters, TradeOptionalParameters, QuoteAndPost, QuoteResults, SwapAdvancedSettings, SigningStepManager, OrderPostingResult, TradingSdk } from '@cowprotocol/sdk-trading';
5
5
  import { AccountAddress, SignerLike, TTLCache, AbstractProviderAdapter } from '@cowprotocol/sdk-common';
6
6
  import { CowShedSdk, CowShedSdkOptions } from '@cowprotocol/sdk-cow-shed';
7
+ import { TokenResponse, QuoteRequest, QuoteResponse, GetExecutionStatusResponse } from '@defuse-protocol/one-click-sdk-typescript';
8
+ import { Address as Address$1, Hex } from 'viem';
7
9
 
10
+ type BridgeProviderType = 'ReceiverAccountBridgeProvider' | 'HookBridgeProvider';
8
11
  interface BridgeProviderInfo {
9
12
  name: string;
10
13
  logoUrl: string;
11
14
  dappId: string;
12
15
  website: string;
16
+ type: BridgeProviderType;
13
17
  }
14
18
  interface WithSellToken {
15
19
  sellTokenChainId: SupportedChainId;
@@ -128,7 +132,7 @@ interface BridgeDeposit extends Omit<QuoteBridgeRequest, 'amount'> {
128
132
  * It contains the main information about the provider, and the methods to get the quote, the bridging params, the status, the cancelling and the refunding of the bridging.
129
133
  */
130
134
  interface BridgeProvider<Q extends BridgeQuoteResult> {
131
- type: 'ReceiverAccountBridgeProvider' | 'HookBridgeProvider';
135
+ type: BridgeProviderType;
132
136
  info: BridgeProviderInfo;
133
137
  /**
134
138
  * Get basic supported chains
@@ -156,10 +160,10 @@ interface BridgeProvider<Q extends BridgeQuoteResult> {
156
160
  /**
157
161
  * Get the identifier of the bridging transaction from the settlement transaction.
158
162
  * @param chainId
159
- * @param orderUid - The unique identifier of the order
163
+ * @param order - CoW Protocol order
160
164
  * @param txHash - The hash of the settlement transaction in which the bridging post-hook was executed
161
165
  */
162
- getBridgingParams(chainId: ChainId, orderUid: string, txHash: string): Promise<{
166
+ getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
163
167
  params: BridgingDepositParams;
164
168
  status: BridgeStatusResult;
165
169
  } | null>;
@@ -420,6 +424,7 @@ interface BestQuoteProviderContext extends MultiQuoteContext {
420
424
  current: MultiQuoteResult | null;
421
425
  };
422
426
  }
427
+ type DefaultBridgeProvider = BridgeProvider<BridgeQuoteResult>;
423
428
 
424
429
  declare enum BridgeQuoteErrors {
425
430
  NO_INTERMEDIATE_TOKENS = "NO_INTERMEDIATE_TOKENS",
@@ -429,7 +434,8 @@ declare enum BridgeQuoteErrors {
429
434
  TX_BUILD_ERROR = "TX_BUILD_ERROR",
430
435
  QUOTE_ERROR = "QUOTE_ERROR",
431
436
  NO_ROUTES = "NO_ROUTES",
432
- INVALID_BRIDGE = "INVALID_BRIDGE"
437
+ INVALID_BRIDGE = "INVALID_BRIDGE",
438
+ QUOTE_DOES_NOT_MATCH_DEPOSIT_ADDRESS = "QUOTE_DOES_NOT_MATCH_DEPOSIT_ADDRESS"
433
439
  }
434
440
  declare class BridgeProviderQuoteError extends Error {
435
441
  readonly context?: unknown | undefined;
@@ -448,7 +454,7 @@ declare function isBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): quote is B
448
454
  declare function isQuoteAndPost(quote: CrossChainQuoteAndPost): quote is QuoteAndPost;
449
455
  declare function assertIsBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is BridgeQuoteAndPost;
450
456
  declare function assertIsQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is QuoteAndPost;
451
- declare function getPostHooks(fullAppData?: string): cowAppDataLatestScheme.CoWHook[];
457
+ declare function getPostHooks(fullAppData?: string | object): cowAppDataLatestScheme.CoWHook[];
452
458
  declare function isAppDoc(appData: unknown): appData is cowAppDataLatestScheme.AppDataRootSchema;
453
459
  declare function isHookBridgeProvider<Q extends BridgeQuoteResult>(provider: BridgeProvider<Q>): provider is HookBridgeProvider<Q>;
454
460
  declare function isReceiverAccountBridgeProvider<Q extends BridgeQuoteResult>(provider: BridgeProvider<Q>): provider is ReceiverAccountBridgeProvider<Q>;
@@ -523,12 +529,13 @@ declare class BridgingSdk {
523
529
  private singleQuoteStrategy;
524
530
  private multiQuoteStrategy;
525
531
  private bestQuoteStrategy;
532
+ private availableProvidersIds;
526
533
  constructor(options: BridgingSdkOptions, adapter?: AbstractProviderAdapter);
527
- private get provider();
534
+ setAvailableProviders(ids: string[]): void;
528
535
  /**
529
536
  * Get the providers for the bridging.
530
537
  */
531
- getProviders(): BridgeProvider<BridgeQuoteResult>[];
538
+ getAvailableProviders(): DefaultBridgeProvider[];
532
539
  /**
533
540
  * Get the available sources networks for the bridging.
534
541
  */
@@ -592,8 +599,7 @@ declare class BridgingSdk {
592
599
  */
593
600
  getBestQuote(request: MultiQuoteRequest): Promise<MultiQuoteResult | null>;
594
601
  getOrder(params: GetOrderParams): Promise<CrossChainOrder | null>;
595
- getOrderBridgingStatus(bridgingId: string, originChainId: SupportedChainId): Promise<BridgeStatusResult>;
596
- getProviderFromAppData(fullAppData: string): BridgeProvider<BridgeQuoteResult> | undefined;
602
+ getProviderFromAppData(fullAppData: string): DefaultBridgeProvider | undefined;
597
603
  /**
598
604
  * Clear all caches. Useful for testing and debugging.
599
605
  */
@@ -609,7 +615,8 @@ declare class BridgingSdk {
609
615
  intermediateTokens: number;
610
616
  buyTokens: number;
611
617
  };
612
- getProviderByDappId(dappId: string): BridgeProvider<BridgeQuoteResult> | undefined;
618
+ getProviderByDappId(dappId: string): DefaultBridgeProvider | undefined;
619
+ private getBuyTokensFromProvider;
613
620
  }
614
621
 
615
622
  declare const RAW_PROVIDERS_FILES_PATH = "https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers";
@@ -900,7 +907,7 @@ declare class AcrossBridgeProvider implements HookBridgeProvider<AcrossQuoteResu
900
907
  getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise<number>;
901
908
  getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise<BridgeHook>;
902
909
  decodeBridgeHook(_hook: cowAppDataLatestScheme.CoWHook): Promise<BridgeDeposit>;
903
- getBridgingParams(chainId: ChainId, orderUid: string, txHash: string): Promise<{
910
+ getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
904
911
  params: BridgingDepositParams;
905
912
  status: BridgeStatusResult;
906
913
  } | null>;
@@ -1220,7 +1227,7 @@ declare class BungeeBridgeProvider implements HookBridgeProvider<BungeeQuoteResu
1220
1227
  getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise<EvmCall>;
1221
1228
  getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise<number>;
1222
1229
  getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise<BridgeHook>;
1223
- getBridgingParams(_chainId: ChainId, orderId: string, _txHash: string): Promise<{
1230
+ getBridgingParams(_chainId: ChainId, order: EnrichedOrder, _txHash: string): Promise<{
1224
1231
  params: BridgingDepositParams;
1225
1232
  status: BridgeStatusResult;
1226
1233
  } | null>;
@@ -1232,4 +1239,48 @@ declare class BungeeBridgeProvider implements HookBridgeProvider<BungeeQuoteResu
1232
1239
  private isExtraGasRequired;
1233
1240
  }
1234
1241
 
1235
- 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 BridgeQuoteAmountsAndCosts, type BridgeQuoteAndPost, 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 GetProviderBuyTokens, HOOK_DAPP_BRIDGE_PROVIDER_PREFIX, type HookBridgeProvider, type MultiQuoteOptions, type MultiQuoteProgressCallback, type MultiQuoteRequest, type MultiQuoteResult, type ProviderQuoteContext, type QuoteBridgeRequest, type QuoteBridgeRequestWithoutAmount, RAW_PROVIDERS_FILES_PATH, type ReceiverAccountBridgeProvider, assertIsBridgeQuoteAndPost, assertIsQuoteAndPost, getCrossChainOrder, getPostHooks, isAppDoc, isBridgeQuoteAndPost, isHookBridgeProvider, isQuoteAndPost, isReceiverAccountBridgeProvider };
1242
+ interface GetAttestationRequest {
1243
+ depositAddress: Address$1;
1244
+ quoteHash: Hex;
1245
+ }
1246
+ interface GetAttestationResponse {
1247
+ signature: Hex;
1248
+ version: number;
1249
+ }
1250
+ declare class NearIntentsApi {
1251
+ private cachedTokens;
1252
+ getTokens(): Promise<TokenResponse[]>;
1253
+ getQuote(request: QuoteRequest): Promise<QuoteResponse>;
1254
+ getStatus(depositAddress: string): Promise<GetExecutionStatusResponse>;
1255
+ getAttestation(request: GetAttestationRequest): Promise<GetAttestationResponse>;
1256
+ }
1257
+
1258
+ interface NearIntentsQuoteResult extends BridgeQuoteResult {
1259
+ depositAddress: Hex;
1260
+ }
1261
+ interface NearIntentsBridgeProviderOptions {
1262
+ cowShedOptions?: CowShedSdkOptions;
1263
+ }
1264
+ declare class NearIntentsBridgeProvider implements ReceiverAccountBridgeProvider<NearIntentsQuoteResult> {
1265
+ type: "ReceiverAccountBridgeProvider";
1266
+ protected api: NearIntentsApi;
1267
+ protected cowShedSdk: CowShedSdk;
1268
+ info: BridgeProviderInfo;
1269
+ constructor(options?: NearIntentsBridgeProviderOptions, _adapter?: AbstractProviderAdapter);
1270
+ getNetworks(): Promise<ChainInfo[]>;
1271
+ getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
1272
+ getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
1273
+ getQuote(request: QuoteBridgeRequest): Promise<NearIntentsQuoteResult>;
1274
+ getBridgeReceiverOverride(_request: QuoteBridgeRequest, quote: NearIntentsQuoteResult): Promise<string>;
1275
+ getBridgingParams(_chainId: ChainId, order: EnrichedOrder, _txHash: string): Promise<{
1276
+ params: BridgingDepositParams;
1277
+ status: BridgeStatusResult;
1278
+ } | null>;
1279
+ getExplorerUrl(bridgingId: string): string;
1280
+ getStatus(bridgingId: string, _originChainId: SupportedChainId): Promise<BridgeStatusResult>;
1281
+ getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
1282
+ getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
1283
+ recoverDepositAddress({ quote, quoteRequest, timestamp }: QuoteResponse): Promise<Address$1 | null>;
1284
+ }
1285
+
1286
+ 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, 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 };
package/dist/index.d.ts CHANGED
@@ -4,12 +4,16 @@ import { ChainInfo, TargetChainId, SupportedChainId, TokenInfo, ChainId, EvmCall
4
4
  import { QuoterParameters, TraderParameters, TradeOptionalParameters, QuoteAndPost, QuoteResults, SwapAdvancedSettings, SigningStepManager, OrderPostingResult, TradingSdk } from '@cowprotocol/sdk-trading';
5
5
  import { AccountAddress, SignerLike, TTLCache, AbstractProviderAdapter } from '@cowprotocol/sdk-common';
6
6
  import { CowShedSdk, CowShedSdkOptions } from '@cowprotocol/sdk-cow-shed';
7
+ import { TokenResponse, QuoteRequest, QuoteResponse, GetExecutionStatusResponse } from '@defuse-protocol/one-click-sdk-typescript';
8
+ import { Address as Address$1, Hex } from 'viem';
7
9
 
10
+ type BridgeProviderType = 'ReceiverAccountBridgeProvider' | 'HookBridgeProvider';
8
11
  interface BridgeProviderInfo {
9
12
  name: string;
10
13
  logoUrl: string;
11
14
  dappId: string;
12
15
  website: string;
16
+ type: BridgeProviderType;
13
17
  }
14
18
  interface WithSellToken {
15
19
  sellTokenChainId: SupportedChainId;
@@ -128,7 +132,7 @@ interface BridgeDeposit extends Omit<QuoteBridgeRequest, 'amount'> {
128
132
  * It contains the main information about the provider, and the methods to get the quote, the bridging params, the status, the cancelling and the refunding of the bridging.
129
133
  */
130
134
  interface BridgeProvider<Q extends BridgeQuoteResult> {
131
- type: 'ReceiverAccountBridgeProvider' | 'HookBridgeProvider';
135
+ type: BridgeProviderType;
132
136
  info: BridgeProviderInfo;
133
137
  /**
134
138
  * Get basic supported chains
@@ -156,10 +160,10 @@ interface BridgeProvider<Q extends BridgeQuoteResult> {
156
160
  /**
157
161
  * Get the identifier of the bridging transaction from the settlement transaction.
158
162
  * @param chainId
159
- * @param orderUid - The unique identifier of the order
163
+ * @param order - CoW Protocol order
160
164
  * @param txHash - The hash of the settlement transaction in which the bridging post-hook was executed
161
165
  */
162
- getBridgingParams(chainId: ChainId, orderUid: string, txHash: string): Promise<{
166
+ getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
163
167
  params: BridgingDepositParams;
164
168
  status: BridgeStatusResult;
165
169
  } | null>;
@@ -420,6 +424,7 @@ interface BestQuoteProviderContext extends MultiQuoteContext {
420
424
  current: MultiQuoteResult | null;
421
425
  };
422
426
  }
427
+ type DefaultBridgeProvider = BridgeProvider<BridgeQuoteResult>;
423
428
 
424
429
  declare enum BridgeQuoteErrors {
425
430
  NO_INTERMEDIATE_TOKENS = "NO_INTERMEDIATE_TOKENS",
@@ -429,7 +434,8 @@ declare enum BridgeQuoteErrors {
429
434
  TX_BUILD_ERROR = "TX_BUILD_ERROR",
430
435
  QUOTE_ERROR = "QUOTE_ERROR",
431
436
  NO_ROUTES = "NO_ROUTES",
432
- INVALID_BRIDGE = "INVALID_BRIDGE"
437
+ INVALID_BRIDGE = "INVALID_BRIDGE",
438
+ QUOTE_DOES_NOT_MATCH_DEPOSIT_ADDRESS = "QUOTE_DOES_NOT_MATCH_DEPOSIT_ADDRESS"
433
439
  }
434
440
  declare class BridgeProviderQuoteError extends Error {
435
441
  readonly context?: unknown | undefined;
@@ -448,7 +454,7 @@ declare function isBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): quote is B
448
454
  declare function isQuoteAndPost(quote: CrossChainQuoteAndPost): quote is QuoteAndPost;
449
455
  declare function assertIsBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is BridgeQuoteAndPost;
450
456
  declare function assertIsQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is QuoteAndPost;
451
- declare function getPostHooks(fullAppData?: string): cowAppDataLatestScheme.CoWHook[];
457
+ declare function getPostHooks(fullAppData?: string | object): cowAppDataLatestScheme.CoWHook[];
452
458
  declare function isAppDoc(appData: unknown): appData is cowAppDataLatestScheme.AppDataRootSchema;
453
459
  declare function isHookBridgeProvider<Q extends BridgeQuoteResult>(provider: BridgeProvider<Q>): provider is HookBridgeProvider<Q>;
454
460
  declare function isReceiverAccountBridgeProvider<Q extends BridgeQuoteResult>(provider: BridgeProvider<Q>): provider is ReceiverAccountBridgeProvider<Q>;
@@ -523,12 +529,13 @@ declare class BridgingSdk {
523
529
  private singleQuoteStrategy;
524
530
  private multiQuoteStrategy;
525
531
  private bestQuoteStrategy;
532
+ private availableProvidersIds;
526
533
  constructor(options: BridgingSdkOptions, adapter?: AbstractProviderAdapter);
527
- private get provider();
534
+ setAvailableProviders(ids: string[]): void;
528
535
  /**
529
536
  * Get the providers for the bridging.
530
537
  */
531
- getProviders(): BridgeProvider<BridgeQuoteResult>[];
538
+ getAvailableProviders(): DefaultBridgeProvider[];
532
539
  /**
533
540
  * Get the available sources networks for the bridging.
534
541
  */
@@ -592,8 +599,7 @@ declare class BridgingSdk {
592
599
  */
593
600
  getBestQuote(request: MultiQuoteRequest): Promise<MultiQuoteResult | null>;
594
601
  getOrder(params: GetOrderParams): Promise<CrossChainOrder | null>;
595
- getOrderBridgingStatus(bridgingId: string, originChainId: SupportedChainId): Promise<BridgeStatusResult>;
596
- getProviderFromAppData(fullAppData: string): BridgeProvider<BridgeQuoteResult> | undefined;
602
+ getProviderFromAppData(fullAppData: string): DefaultBridgeProvider | undefined;
597
603
  /**
598
604
  * Clear all caches. Useful for testing and debugging.
599
605
  */
@@ -609,7 +615,8 @@ declare class BridgingSdk {
609
615
  intermediateTokens: number;
610
616
  buyTokens: number;
611
617
  };
612
- getProviderByDappId(dappId: string): BridgeProvider<BridgeQuoteResult> | undefined;
618
+ getProviderByDappId(dappId: string): DefaultBridgeProvider | undefined;
619
+ private getBuyTokensFromProvider;
613
620
  }
614
621
 
615
622
  declare const RAW_PROVIDERS_FILES_PATH = "https://raw.githubusercontent.com/cowprotocol/cow-sdk/refs/heads/main/src/bridging/providers";
@@ -900,7 +907,7 @@ declare class AcrossBridgeProvider implements HookBridgeProvider<AcrossQuoteResu
900
907
  getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise<number>;
901
908
  getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise<BridgeHook>;
902
909
  decodeBridgeHook(_hook: cowAppDataLatestScheme.CoWHook): Promise<BridgeDeposit>;
903
- getBridgingParams(chainId: ChainId, orderUid: string, txHash: string): Promise<{
910
+ getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string): Promise<{
904
911
  params: BridgingDepositParams;
905
912
  status: BridgeStatusResult;
906
913
  } | null>;
@@ -1220,7 +1227,7 @@ declare class BungeeBridgeProvider implements HookBridgeProvider<BungeeQuoteResu
1220
1227
  getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise<EvmCall>;
1221
1228
  getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise<number>;
1222
1229
  getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise<BridgeHook>;
1223
- getBridgingParams(_chainId: ChainId, orderId: string, _txHash: string): Promise<{
1230
+ getBridgingParams(_chainId: ChainId, order: EnrichedOrder, _txHash: string): Promise<{
1224
1231
  params: BridgingDepositParams;
1225
1232
  status: BridgeStatusResult;
1226
1233
  } | null>;
@@ -1232,4 +1239,48 @@ declare class BungeeBridgeProvider implements HookBridgeProvider<BungeeQuoteResu
1232
1239
  private isExtraGasRequired;
1233
1240
  }
1234
1241
 
1235
- 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 BridgeQuoteAmountsAndCosts, type BridgeQuoteAndPost, 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 GetProviderBuyTokens, HOOK_DAPP_BRIDGE_PROVIDER_PREFIX, type HookBridgeProvider, type MultiQuoteOptions, type MultiQuoteProgressCallback, type MultiQuoteRequest, type MultiQuoteResult, type ProviderQuoteContext, type QuoteBridgeRequest, type QuoteBridgeRequestWithoutAmount, RAW_PROVIDERS_FILES_PATH, type ReceiverAccountBridgeProvider, assertIsBridgeQuoteAndPost, assertIsQuoteAndPost, getCrossChainOrder, getPostHooks, isAppDoc, isBridgeQuoteAndPost, isHookBridgeProvider, isQuoteAndPost, isReceiverAccountBridgeProvider };
1242
+ interface GetAttestationRequest {
1243
+ depositAddress: Address$1;
1244
+ quoteHash: Hex;
1245
+ }
1246
+ interface GetAttestationResponse {
1247
+ signature: Hex;
1248
+ version: number;
1249
+ }
1250
+ declare class NearIntentsApi {
1251
+ private cachedTokens;
1252
+ getTokens(): Promise<TokenResponse[]>;
1253
+ getQuote(request: QuoteRequest): Promise<QuoteResponse>;
1254
+ getStatus(depositAddress: string): Promise<GetExecutionStatusResponse>;
1255
+ getAttestation(request: GetAttestationRequest): Promise<GetAttestationResponse>;
1256
+ }
1257
+
1258
+ interface NearIntentsQuoteResult extends BridgeQuoteResult {
1259
+ depositAddress: Hex;
1260
+ }
1261
+ interface NearIntentsBridgeProviderOptions {
1262
+ cowShedOptions?: CowShedSdkOptions;
1263
+ }
1264
+ declare class NearIntentsBridgeProvider implements ReceiverAccountBridgeProvider<NearIntentsQuoteResult> {
1265
+ type: "ReceiverAccountBridgeProvider";
1266
+ protected api: NearIntentsApi;
1267
+ protected cowShedSdk: CowShedSdk;
1268
+ info: BridgeProviderInfo;
1269
+ constructor(options?: NearIntentsBridgeProviderOptions, _adapter?: AbstractProviderAdapter);
1270
+ getNetworks(): Promise<ChainInfo[]>;
1271
+ getBuyTokens(params: BuyTokensParams): Promise<GetProviderBuyTokens>;
1272
+ getIntermediateTokens(request: QuoteBridgeRequest): Promise<TokenInfo[]>;
1273
+ getQuote(request: QuoteBridgeRequest): Promise<NearIntentsQuoteResult>;
1274
+ getBridgeReceiverOverride(_request: QuoteBridgeRequest, quote: NearIntentsQuoteResult): Promise<string>;
1275
+ getBridgingParams(_chainId: ChainId, order: EnrichedOrder, _txHash: string): Promise<{
1276
+ params: BridgingDepositParams;
1277
+ status: BridgeStatusResult;
1278
+ } | null>;
1279
+ getExplorerUrl(bridgingId: string): string;
1280
+ getStatus(bridgingId: string, _originChainId: SupportedChainId): Promise<BridgeStatusResult>;
1281
+ getCancelBridgingTx(_bridgingId: string): Promise<EvmCall>;
1282
+ getRefundBridgingTx(_bridgingId: string): Promise<EvmCall>;
1283
+ recoverDepositAddress({ quote, quoteRequest, timestamp }: QuoteResponse): Promise<Address$1 | null>;
1284
+ }
1285
+
1286
+ 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, 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 };