@@ -19,12 +19,6 @@ import {
1919} from '@metamask/bridge-controller' ;
2020import type { TraceCallback } from '@metamask/controller-utils' ;
2121import { toHex } from '@metamask/controller-utils' ;
22- import type {
23- IntentOrder ,
24- IntentSubmissionParams ,
25- } from '@metamask/intent-manager' ;
26- import { IntentManager } from '@metamask/intent-manager' ;
27- import { IntentOrderStatus } from '@metamask/intent-manager' ;
2822import { StaticIntervalPollingController } from '@metamask/polling-controller' ;
2923import type {
3024 TransactionController ,
@@ -54,6 +48,9 @@ import type {
5448} from './types' ;
5549import { type BridgeStatusControllerMessenger } from './types' ;
5650import { BridgeClientId } from './types' ;
51+ import { IntentApiImpl } from './intent-api' ;
52+ import { IntentOrderStatus } from './intent-order-status' ;
53+ import type { IntentOrder } from './intent-order' ;
5754import {
5855 fetchBridgeTxStatus ,
5956 getStatusRequestWithSrcTxHash ,
@@ -121,8 +118,6 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
121118
122119 readonly #updateTransactionFn: typeof TransactionController . prototype . updateTransaction ;
123120
124- #intentManager?: IntentManager ;
125-
126121 readonly #estimateGasFeeFn: typeof TransactionController . prototype . estimateGasFee ;
127122
128123 readonly #trace: TraceCallback ;
@@ -205,7 +200,6 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
205200 this . getBridgeHistoryItemByTxMetaId . bind ( this ) ,
206201 ) ;
207202
208- this . #intentManager = new IntentManager ( ) ;
209203 // Set interval
210204 this . setIntervalLength ( REFRESH_INTERVAL_MS ) ;
211205
@@ -294,15 +288,6 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
294288 } ) ;
295289 } ;
296290
297- /**
298- * Set the intent manager instance for handling intent operations
299- *
300- * @param intentManager - The intent manager instance
301- */
302- setIntentManager ( intentManager : IntentManager ) : void {
303- this . #intentManager = intentManager ;
304- }
305-
306291 wipeBridgeStatus = ( {
307292 address,
308293 ignoreNetwork,
@@ -710,11 +695,6 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
710695 readonly #fetchIntentOrderStatus = async ( {
711696 bridgeTxMetaId,
712697 } : FetchBridgeTxStatusArgs ) => {
713- if ( ! this . #intentManager) {
714- console . warn ( 'Intent manager not available for status polling' ) ;
715- return ;
716- }
717-
718698 const { txHistory } = this . state ;
719699 const historyItem = txHistory [ bridgeTxMetaId ] ;
720700 if ( ! historyItem ) {
@@ -730,13 +710,17 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
730710 const orderUid = bridgeTxMetaId . replace ( / ^ i n t e n t : / u, '' ) ;
731711 const { srcChainId } = historyItem . quote ;
732712
733- // Extract provider name from order metadata or default to empty and let intent manager throw error
713+ // Extract provider name from order metadata or default to empty
734714 const providerName = historyItem . quote . intent ?. protocol || '' ;
735715
736- const intentOrder = await this . #intentManager. getOrderStatus (
716+ const intentApi = new IntentApiImpl (
717+ this . #config. customBridgeApiBaseUrl ,
718+ this . #fetchFn,
719+ ) ;
720+ const intentOrder = await intentApi . getOrderStatus (
737721 orderUid ,
738722 providerName ,
739- srcChainId ,
723+ srcChainId . toString ( ) ,
740724 ) ;
741725
742726 // Update bridge history with intent order status
@@ -1511,10 +1495,6 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
15111495 } ) : Promise < Pick < TransactionMeta , 'id' | 'chainId' | 'type' | 'status' > > => {
15121496 const { quoteResponse, signature, accountAddress } = params ;
15131497
1514- if ( ! this . #intentManager) {
1515- throw new Error ( 'Intent manager not initialized' ) ;
1516- }
1517-
15181498 // Build pre-confirmation properties for error tracking parity with submitTx
15191499 const account = this . messagingSystem . call (
15201500 'AccountsController:getAccountByAddress' ,
@@ -1576,16 +1556,21 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
15761556 intent ,
15771557 ) ;
15781558
1579- // Submit intent order using the intent manager
1559+ const chainId = quoteResponse . quote . srcChainId ;
1560+
15801561 const submissionParams = {
1581- quote : intentQuote ,
1562+ chainId : chainId . toString ( ) ,
1563+ quoteId : intentQuote . id ,
15821564 signature,
1565+ order : intentQuote . metadata . order ,
15831566 userAddress : accountAddress ,
1584- } as IntentSubmissionParams ;
1585- const intentOrder =
1586- await this . #intentManager. submitIntent ( submissionParams ) ;
1567+ } ;
1568+ const intentApi = new IntentApiImpl (
1569+ this . #config. customBridgeApiBaseUrl ,
1570+ this . #fetchFn,
1571+ ) ;
1572+ const intentOrder = await intentApi . submitIntent ( submissionParams ) ;
15871573
1588- const chainId = quoteResponse . quote . srcChainId ;
15891574 const orderUid = intentOrder . id ;
15901575
15911576 // Determine transaction type: swap for same-chain, bridge for cross-chain
@@ -1673,7 +1658,7 @@ export class BridgeStatusController extends StaticIntervalPollingController<Brid
16731658
16741659 // Record in bridge history with actual transaction metadata
16751660 try {
1676- // Use intent: prefix for intent transactions to route to intent manager
1661+ // Use ' intent:' prefix for intent transactions
16771662 const bridgeHistoryKey = `intent:${ orderUid } ` ;
16781663
16791664 // Create a bridge transaction metadata that includes the original txId
0 commit comments