@metamask/bridge-status-controller 70.0.0 → 70.0.1

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/bridge-status-controller.cjs +48 -172
  3. package/dist/bridge-status-controller.cjs.map +1 -1
  4. package/dist/bridge-status-controller.d.cts +2 -1
  5. package/dist/bridge-status-controller.d.cts.map +1 -1
  6. package/dist/bridge-status-controller.d.mts +2 -1
  7. package/dist/bridge-status-controller.d.mts.map +1 -1
  8. package/dist/bridge-status-controller.intent.cjs +7 -19
  9. package/dist/bridge-status-controller.intent.cjs.map +1 -1
  10. package/dist/bridge-status-controller.intent.d.cts +2 -10
  11. package/dist/bridge-status-controller.intent.d.cts.map +1 -1
  12. package/dist/bridge-status-controller.intent.d.mts +2 -10
  13. package/dist/bridge-status-controller.intent.d.mts.map +1 -1
  14. package/dist/bridge-status-controller.intent.mjs +7 -19
  15. package/dist/bridge-status-controller.intent.mjs.map +1 -1
  16. package/dist/bridge-status-controller.mjs +51 -175
  17. package/dist/bridge-status-controller.mjs.map +1 -1
  18. package/dist/types.cjs.map +1 -1
  19. package/dist/types.d.cts +10 -4
  20. package/dist/types.d.cts.map +1 -1
  21. package/dist/types.d.mts +10 -4
  22. package/dist/types.d.mts.map +1 -1
  23. package/dist/types.mjs.map +1 -1
  24. package/dist/utils/bridge-status.cjs +17 -1
  25. package/dist/utils/bridge-status.cjs.map +1 -1
  26. package/dist/utils/bridge-status.d.cts +8 -2
  27. package/dist/utils/bridge-status.d.cts.map +1 -1
  28. package/dist/utils/bridge-status.d.mts +8 -2
  29. package/dist/utils/bridge-status.d.mts.map +1 -1
  30. package/dist/utils/bridge-status.mjs +15 -0
  31. package/dist/utils/bridge-status.mjs.map +1 -1
  32. package/dist/utils/gas.cjs +1 -58
  33. package/dist/utils/gas.cjs.map +1 -1
  34. package/dist/utils/gas.d.cts +3 -26
  35. package/dist/utils/gas.d.cts.map +1 -1
  36. package/dist/utils/gas.d.mts +3 -26
  37. package/dist/utils/gas.d.mts.map +1 -1
  38. package/dist/utils/gas.mjs +0 -55
  39. package/dist/utils/gas.mjs.map +1 -1
  40. package/dist/utils/history.cjs +9 -8
  41. package/dist/utils/history.cjs.map +1 -1
  42. package/dist/utils/history.d.cts +3 -2
  43. package/dist/utils/history.d.cts.map +1 -1
  44. package/dist/utils/history.d.mts +3 -2
  45. package/dist/utils/history.d.mts.map +1 -1
  46. package/dist/utils/history.mjs +9 -8
  47. package/dist/utils/history.mjs.map +1 -1
  48. package/dist/utils/intent-api.cjs +26 -26
  49. package/dist/utils/intent-api.cjs.map +1 -1
  50. package/dist/utils/intent-api.d.cts +7 -2
  51. package/dist/utils/intent-api.d.cts.map +1 -1
  52. package/dist/utils/intent-api.d.mts +7 -2
  53. package/dist/utils/intent-api.d.mts.map +1 -1
  54. package/dist/utils/intent-api.mjs +24 -25
  55. package/dist/utils/intent-api.mjs.map +1 -1
  56. package/dist/utils/snaps.cjs +5 -5
  57. package/dist/utils/snaps.cjs.map +1 -1
  58. package/dist/utils/snaps.d.cts +3 -17
  59. package/dist/utils/snaps.d.cts.map +1 -1
  60. package/dist/utils/snaps.d.mts +3 -17
  61. package/dist/utils/snaps.d.mts.map +1 -1
  62. package/dist/utils/snaps.mjs +6 -6
  63. package/dist/utils/snaps.mjs.map +1 -1
  64. package/dist/utils/transaction.cjs +250 -24
  65. package/dist/utils/transaction.cjs.map +1 -1
  66. package/dist/utils/transaction.d.cts +91 -169
  67. package/dist/utils/transaction.d.cts.map +1 -1
  68. package/dist/utils/transaction.d.mts +91 -169
  69. package/dist/utils/transaction.d.mts.map +1 -1
  70. package/dist/utils/transaction.mjs +234 -19
  71. package/dist/utils/transaction.mjs.map +1 -1
  72. package/package.json +3 -3
@@ -1,8 +1,8 @@
1
1
  import { BridgeClientId } from "@metamask/bridge-controller";
2
2
  import type { BridgeStatusControllerMessenger, FetchFunction } from "./types.cjs";
3
3
  import type { BridgeHistoryItem } from "./types.cjs";
4
- import { IntentApi, IntentBridgeStatus, IntentSubmissionParams } from "./utils/intent-api.cjs";
5
- import { IntentStatusResponse, IntentOrderStatus } from "./utils/validators.cjs";
4
+ import { IntentApi, IntentBridgeStatus } from "./utils/intent-api.cjs";
5
+ import { IntentOrderStatus } from "./utils/validators.cjs";
6
6
  type IntentStatuses = {
7
7
  orderStatus: IntentOrderStatus;
8
8
  bridgeStatus: IntentBridgeStatus | null;
@@ -31,14 +31,6 @@ export declare class IntentManager {
31
31
  * @param historyItem - The history item.
32
32
  */
33
33
  syncTransactionFromIntentStatus: (bridgeTxMetaId: string, historyItem: BridgeHistoryItem) => void;
34
- /**
35
- * Submit an intent order.
36
- *
37
- * @param submissionParams - The submission parameters.
38
- * @param clientId - The client ID.
39
- * @returns The intent order.
40
- */
41
- submitIntent: (submissionParams: IntentSubmissionParams, clientId: BridgeClientId) => Promise<IntentStatusResponse>;
42
34
  }
43
35
  export {};
44
36
  //# sourceMappingURL=bridge-status-controller.intent.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-status-controller.intent.d.cts","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,oCAAoC;AAG1E,OAAO,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,oBAAgB;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAgB;AAEjD,OAAO,EACL,SAAS,EAET,kBAAkB,EAClB,sBAAsB,EAEvB,+BAA2B;AAC5B,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,+BAA2B;AAE7E,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,qBAAa,aAAa;;IAGxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAKlB,EACV,SAAS,EACT,sBAAsB,EACtB,OAAO,GACR,EAAE;QACD,SAAS,EAAE,+BAA+B,CAAC;QAC3C,sBAAsB,EAAE,MAAM,CAAC;QAC/B,OAAO,EAAE,aAAa,CAAC;KACxB;IAsCD;;;;;;;OAOG;IAEH,0BAA0B,mBACR,MAAM,cACV,MAAM,YACR,MAAM,YACN,cAAc,WAChB,MAAM,KACb,QAAQ,cAAc,GAAG,SAAS,CAAC,CAuBpC;IAEF;;;;;OAKG;IAEH,+BAA+B,mBACb,MAAM,eACT,iBAAiB,KAC7B,IAAI,CAwEL;IAEF;;;;;;OAMG;IACH,YAAY,qBACQ,sBAAsB,YAC9B,cAAc,KACvB,QAAQ,oBAAoB,CAAC,CAE9B;CACH"}
1
+ {"version":3,"file":"bridge-status-controller.intent.d.cts","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,oCAAoC;AAE1E,OAAO,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,oBAAgB;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAgB;AAEjD,OAAO,EACL,SAAS,EAET,kBAAkB,EAEnB,+BAA2B;AAE5B,OAAO,EAAwB,iBAAiB,EAAE,+BAA2B;AAE7E,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,qBAAa,aAAa;;IAGxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAKlB,EACV,SAAS,EACT,sBAAsB,EACtB,OAAO,GACR,EAAE;QACD,SAAS,EAAE,+BAA+B,CAAC;QAC3C,sBAAsB,EAAE,MAAM,CAAC;QAC/B,OAAO,EAAE,aAAa,CAAC;KACxB;IAsCD;;;;;;;OAOG;IAEH,0BAA0B,mBACR,MAAM,cACV,MAAM,YACR,MAAM,YACN,cAAc,WACf,MAAM,KACd,QAAQ,cAAc,GAAG,SAAS,CAAC,CAuBpC;IAEF;;;;;OAKG;IAEH,+BAA+B,mBACb,MAAM,eACT,iBAAiB,KAC7B,IAAI,CAqEL;CACH"}
@@ -1,8 +1,8 @@
1
1
  import { BridgeClientId } from "@metamask/bridge-controller";
2
2
  import type { BridgeStatusControllerMessenger, FetchFunction } from "./types.mjs";
3
3
  import type { BridgeHistoryItem } from "./types.mjs";
4
- import { IntentApi, IntentBridgeStatus, IntentSubmissionParams } from "./utils/intent-api.mjs";
5
- import { IntentStatusResponse, IntentOrderStatus } from "./utils/validators.mjs";
4
+ import { IntentApi, IntentBridgeStatus } from "./utils/intent-api.mjs";
5
+ import { IntentOrderStatus } from "./utils/validators.mjs";
6
6
  type IntentStatuses = {
7
7
  orderStatus: IntentOrderStatus;
8
8
  bridgeStatus: IntentBridgeStatus | null;
@@ -31,14 +31,6 @@ export declare class IntentManager {
31
31
  * @param historyItem - The history item.
32
32
  */
33
33
  syncTransactionFromIntentStatus: (bridgeTxMetaId: string, historyItem: BridgeHistoryItem) => void;
34
- /**
35
- * Submit an intent order.
36
- *
37
- * @param submissionParams - The submission parameters.
38
- * @param clientId - The client ID.
39
- * @returns The intent order.
40
- */
41
- submitIntent: (submissionParams: IntentSubmissionParams, clientId: BridgeClientId) => Promise<IntentStatusResponse>;
42
34
  }
43
35
  export {};
44
36
  //# sourceMappingURL=bridge-status-controller.intent.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-status-controller.intent.d.mts","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,oCAAoC;AAG1E,OAAO,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,oBAAgB;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAgB;AAEjD,OAAO,EACL,SAAS,EAET,kBAAkB,EAClB,sBAAsB,EAEvB,+BAA2B;AAC5B,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,+BAA2B;AAE7E,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,qBAAa,aAAa;;IAGxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAKlB,EACV,SAAS,EACT,sBAAsB,EACtB,OAAO,GACR,EAAE;QACD,SAAS,EAAE,+BAA+B,CAAC;QAC3C,sBAAsB,EAAE,MAAM,CAAC;QAC/B,OAAO,EAAE,aAAa,CAAC;KACxB;IAsCD;;;;;;;OAOG;IAEH,0BAA0B,mBACR,MAAM,cACV,MAAM,YACR,MAAM,YACN,cAAc,WAChB,MAAM,KACb,QAAQ,cAAc,GAAG,SAAS,CAAC,CAuBpC;IAEF;;;;;OAKG;IAEH,+BAA+B,mBACb,MAAM,eACT,iBAAiB,KAC7B,IAAI,CAwEL;IAEF;;;;;;OAMG;IACH,YAAY,qBACQ,sBAAsB,YAC9B,cAAc,KACvB,QAAQ,oBAAoB,CAAC,CAE9B;CACH"}
1
+ {"version":3,"file":"bridge-status-controller.intent.d.mts","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAe,oCAAoC;AAE1E,OAAO,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,oBAAgB;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAgB;AAEjD,OAAO,EACL,SAAS,EAET,kBAAkB,EAEnB,+BAA2B;AAE5B,OAAO,EAAwB,iBAAiB,EAAE,+BAA2B;AAE7E,KAAK,cAAc,GAAG;IACpB,WAAW,EAAE,iBAAiB,CAAC;IAC/B,YAAY,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC,CAAC;AAEF,qBAAa,aAAa;;IAGxB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAKlB,EACV,SAAS,EACT,sBAAsB,EACtB,OAAO,GACR,EAAE;QACD,SAAS,EAAE,+BAA+B,CAAC;QAC3C,sBAAsB,EAAE,MAAM,CAAC;QAC/B,OAAO,EAAE,aAAa,CAAC;KACxB;IAsCD;;;;;;;OAOG;IAEH,0BAA0B,mBACR,MAAM,cACV,MAAM,YACR,MAAM,YACN,cAAc,WACf,MAAM,KACd,QAAQ,cAAc,GAAG,SAAS,CAAC,CAuBpC;IAEF;;;;;OAKG;IAEH,+BAA+B,mBACb,MAAM,eACT,iBAAiB,KAC7B,IAAI,CAqEL;CACH"}
@@ -13,6 +13,7 @@ var _IntentManager_instances, _IntentManager_messenger, _IntentManager_intentSta
13
13
  import { BridgeClientId, StatusTypes } from "@metamask/bridge-controller";
14
14
  import { getJwt } from "./utils/authentication.mjs";
15
15
  import { IntentApiImpl, translateIntentOrderToBridgeStatus } from "./utils/intent-api.mjs";
16
+ import { getTransactionMetaById, updateTransaction } from "./utils/transaction.mjs";
16
17
  import { IntentOrderStatus } from "./utils/validators.mjs";
17
18
  export class IntentManager {
18
19
  constructor({ messenger, customBridgeApiBaseUrl, fetchFn, }) {
@@ -27,10 +28,10 @@ export class IntentManager {
27
28
  * @param clientId - The client ID.
28
29
  * @returns The intent order mapped status.
29
30
  */
30
- this.getIntentTransactionStatus = async (bridgeTxMetaId, srcChainId, protocol, clientId, txHash = '') => {
31
+ this.getIntentTransactionStatus = async (bridgeTxMetaId, srcChainId, protocol, clientId, txHash) => {
31
32
  try {
32
33
  const orderStatus = await this.intentApi.getOrderStatus(bridgeTxMetaId, protocol, srcChainId, clientId);
33
- return __classPrivateFieldGet(this, _IntentManager_instances, "m", _IntentManager_setIntentStatuses).call(this, bridgeTxMetaId, orderStatus, srcChainId, txHash.toString());
34
+ return __classPrivateFieldGet(this, _IntentManager_instances, "m", _IntentManager_setIntentStatuses).call(this, bridgeTxMetaId, orderStatus, srcChainId, txHash);
34
35
  }
35
36
  catch (error) {
36
37
  if (error instanceof Error) {
@@ -58,8 +59,7 @@ export class IntentManager {
58
59
  }
59
60
  try {
60
61
  // Merge with existing TransactionMeta to avoid wiping required fields
61
- const { transactions } = __classPrivateFieldGet(this, _IntentManager_messenger, "f").call('TransactionController:getState');
62
- const existingTxMeta = transactions.find((tx) => tx.id === originalTxId);
62
+ const existingTxMeta = getTransactionMetaById(__classPrivateFieldGet(this, _IntentManager_messenger, "f"), originalTxId);
63
63
  if (!existingTxMeta) {
64
64
  console.warn('[Intent polling] Skipping update, transaction not found', { originalTxId, bridgeHistoryKey: bridgeTxMetaId });
65
65
  return;
@@ -75,17 +75,15 @@ export class IntentManager {
75
75
  txReceipt: {
76
76
  ...existingTxReceipt,
77
77
  transactionHash: txHash,
78
- status: (isComplete ? '0x1' : '0x0'),
78
+ status: isComplete ? '0x1' : '0x0',
79
79
  },
80
80
  }
81
81
  : {};
82
- const updatedTxMeta = {
83
- ...existingTxMeta,
82
+ updateTransaction(__classPrivateFieldGet(this, _IntentManager_messenger, "f"), existingTxMeta, {
84
83
  status: bridgeStatus?.transactionStatus,
85
84
  ...(txHash ? { hash: txHash } : {}),
86
85
  ...txReceiptUpdate,
87
- };
88
- __classPrivateFieldGet(this, _IntentManager_messenger, "f").call('TransactionController:updateTransaction', updatedTxMeta, `BridgeStatusController - Intent order status updated: ${orderStatus}`);
86
+ }, `BridgeStatusController - Intent order status updated: ${orderStatus}`);
89
87
  if (isFinalStatus) {
90
88
  __classPrivateFieldGet(this, _IntentManager_intentStatusesByBridgeTxMetaId, "f").delete(bridgeTxMetaId);
91
89
  }
@@ -98,16 +96,6 @@ export class IntentManager {
98
96
  });
99
97
  }
100
98
  };
101
- /**
102
- * Submit an intent order.
103
- *
104
- * @param submissionParams - The submission parameters.
105
- * @param clientId - The client ID.
106
- * @returns The intent order.
107
- */
108
- this.submitIntent = async (submissionParams, clientId) => {
109
- return this.intentApi.submitIntent(submissionParams, clientId);
110
- };
111
99
  __classPrivateFieldSet(this, _IntentManager_messenger, messenger, "f");
112
100
  this.intentApi = new IntentApiImpl(customBridgeApiBaseUrl, fetchFn, async () => await getJwt(messenger));
113
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-status-controller.intent.mjs","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,oCAAoC;AAK1E,OAAO,EAAE,MAAM,EAAE,mCAA+B;AAChD,OAAO,EAEL,aAAa,EAGb,kCAAkC,EACnC,+BAA2B;AAC5B,OAAO,EAAwB,iBAAiB,EAAE,+BAA2B;AAO7E,MAAM,OAAO,aAAa;IAQxB,YAAY,EACV,SAAS,EACT,sBAAsB,EACtB,OAAO,GAKR;;QAfQ,2CAA4C;QAI5C,wDACP,IAAI,GAAG,EAAE,EAAC;QAgDZ;;;;;;;WAOG;QAEH,+BAA0B,GAAG,KAAK,EAChC,cAAsB,EACtB,UAAkB,EAClB,QAAgB,EAChB,QAAwB,EACxB,SAAiB,EAAE,EACkB,EAAE;YACvC,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,cAAc,CACrD,cAAc,EACd,QAAQ,EACR,UAAU,EACV,QAAQ,CACT,CAAC;gBAEF,OAAO,uBAAA,IAAI,kEAAmB,MAAvB,IAAI,EACT,cAAc,EACd,WAAW,EACX,UAAU,EACV,MAAM,CAAC,QAAQ,EAAE,CAClB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAc,EAAE,CAAC;gBACxB,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;oBAC3B,MAAM,IAAI,KAAK,CACb,gEAAgE,KAAK,CAAC,OAAO,EAAE,CAChF,CAAC;gBACJ,CAAC;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC,CAAC;QAEF;;;;;WAKG;QAEH,oCAA+B,GAAG,CAChC,cAAsB,EACtB,WAA8B,EACxB,EAAE;YACR,oFAAoF;YACpF,+DAA+D;YAC/D,MAAM,YAAY,GAChB,WAAW,CAAC,qBAAqB,IAAI,WAAW,CAAC,QAAQ,CAA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AAY;KACb,CAAC;IACF,uBAAA,IAAI,qDAAgC,CAAC,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACzE,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { BridgeClientId, StatusTypes } from '@metamask/bridge-controller';\nimport type { TransactionMeta } from '@metamask/transaction-controller';\n\nimport type { BridgeStatusControllerMessenger, FetchFunction } from './types';\nimport type { BridgeHistoryItem } from './types';\nimport { getJwt } from './utils/authentication';\nimport {\n IntentApi,\n IntentApiImpl,\n IntentBridgeStatus,\n IntentSubmissionParams,\n translateIntentOrderToBridgeStatus,\n} from './utils/intent-api';\nimport { IntentStatusResponse, IntentOrderStatus } from './utils/validators';\n\ntype IntentStatuses = {\n orderStatus: IntentOrderStatus;\n bridgeStatus: IntentBridgeStatus | null;\n};\n\nexport class IntentManager {\n readonly #messenger: BridgeStatusControllerMessenger;\n\n readonly intentApi: IntentApi;\n\n readonly #intentStatusesByBridgeTxMetaId: Map<string, IntentStatuses> =\n new Map();\n\n constructor({\n messenger,\n customBridgeApiBaseUrl,\n fetchFn,\n }: {\n messenger: BridgeStatusControllerMessenger;\n customBridgeApiBaseUrl: string;\n fetchFn: FetchFunction;\n }) {\n this.#messenger = messenger;\n this.intentApi = new IntentApiImpl(\n customBridgeApiBaseUrl,\n fetchFn,\n async () => await getJwt(messenger),\n );\n }\n\n /**\n * Set the intent statuses for a given bridge transaction.\n *\n * @param bridgeTxMetaId - The bridge transaction meta ID (key for storage).\n * @param order - The intent order.\n * @param srcChainId - The source chain ID.\n * @param txHash - The transaction hash.\n * @returns The intent statuses.\n */\n\n #setIntentStatuses(\n bridgeTxMetaId: string,\n order: IntentStatusResponse,\n srcChainId: number,\n txHash: string,\n ): IntentStatuses {\n const bridgeStatus = translateIntentOrderToBridgeStatus(\n order,\n srcChainId,\n txHash,\n );\n const intentStatuses: IntentStatuses = {\n orderStatus: order.status,\n bridgeStatus,\n };\n this.#intentStatusesByBridgeTxMetaId.set(bridgeTxMetaId, intentStatuses);\n return intentStatuses;\n }\n\n /**\n * Get the status of an intent order.\n *\n * @param bridgeTxMetaId - The bridge transaction meta ID.\n * @param protocol - The protocol of the intent.\n * @param clientId - The client ID.\n * @returns The intent order mapped status.\n */\n\n getIntentTransactionStatus = async (\n bridgeTxMetaId: string,\n srcChainId: number,\n protocol: string,\n clientId: BridgeClientId,\n txHash: string = '',\n ): Promise<IntentStatuses | undefined> => {\n try {\n const orderStatus = await this.intentApi.getOrderStatus(\n bridgeTxMetaId,\n protocol,\n srcChainId,\n clientId,\n );\n\n return this.#setIntentStatuses(\n bridgeTxMetaId,\n orderStatus,\n srcChainId,\n txHash.toString(),\n );\n } catch (error: unknown) {\n if (error instanceof Error) {\n throw new Error(\n `[Intent polling] Failed to get intent order status from API: ${error.message}`,\n );\n }\n return undefined;\n }\n };\n\n /**\n * Sync the transaction status from the intent status.\n *\n * @param bridgeTxMetaId - The bridge transaction meta ID.\n * @param historyItem - The history item.\n */\n\n syncTransactionFromIntentStatus = (\n bridgeTxMetaId: string,\n historyItem: BridgeHistoryItem,\n ): void => {\n // Update the actual transaction in TransactionController to sync with intent status\n // Use the original transaction ID (not the bridge history key)\n const originalTxId =\n historyItem.originalTransactionId ?? historyItem.txMetaId;\n if (!originalTxId) {\n return;\n }\n\n const intentStatuses =\n this.#intentStatusesByBridgeTxMetaId.get(bridgeTxMetaId);\n if (!intentStatuses) {\n return;\n }\n\n try {\n // Merge with existing TransactionMeta to avoid wiping required fields\n const { transactions } = this.#messenger.call(\n 'TransactionController:getState',\n );\n const existingTxMeta = transactions.find(\n (tx: TransactionMeta) => tx.id === originalTxId,\n );\n if (!existingTxMeta) {\n console.warn(\n '[Intent polling] Skipping update, transaction not found',\n { originalTxId, bridgeHistoryKey: bridgeTxMetaId },\n );\n return;\n }\n const { bridgeStatus, orderStatus } = intentStatuses;\n const txHash = bridgeStatus?.txHash;\n const isComplete = bridgeStatus?.status.status === StatusTypes.COMPLETE;\n const isFinalStatus =\n bridgeStatus?.status.status === StatusTypes.COMPLETE ||\n bridgeStatus?.status.status === StatusTypes.FAILED;\n const existingTxReceipt = (\n existingTxMeta as { txReceipt?: Record<string, unknown> }\n ).txReceipt;\n const txReceiptUpdate = txHash\n ? {\n txReceipt: {\n ...existingTxReceipt,\n transactionHash: txHash,\n status: (isComplete ? '0x1' : '0x0') as unknown as string,\n },\n }\n : {};\n\n const updatedTxMeta: TransactionMeta = {\n ...existingTxMeta,\n status: bridgeStatus?.transactionStatus,\n ...(txHash ? { hash: txHash } : {}),\n ...txReceiptUpdate,\n } as TransactionMeta;\n\n this.#messenger.call(\n 'TransactionController:updateTransaction',\n updatedTxMeta,\n `BridgeStatusController - Intent order status updated: ${orderStatus}`,\n );\n\n if (isFinalStatus) {\n this.#intentStatusesByBridgeTxMetaId.delete(bridgeTxMetaId);\n }\n } catch (error) {\n console.error('[Intent polling] Failed to update transaction status', {\n originalTxId,\n bridgeHistoryKey: bridgeTxMetaId,\n error,\n });\n }\n };\n\n /**\n * Submit an intent order.\n *\n * @param submissionParams - The submission parameters.\n * @param clientId - The client ID.\n * @returns The intent order.\n */\n submitIntent = async (\n submissionParams: IntentSubmissionParams,\n clientId: BridgeClientId,\n ): Promise<IntentStatusResponse> => {\n return this.intentApi.submitIntent(submissionParams, clientId);\n };\n}\n"]}
1
+ {"version":3,"file":"bridge-status-controller.intent.mjs","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,oCAAoC;AAI1E,OAAO,EAAE,MAAM,EAAE,mCAA+B;AAChD,OAAO,EAEL,aAAa,EAEb,kCAAkC,EACnC,+BAA2B;AAC5B,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,gCAA4B;AAChF,OAAO,EAAwB,iBAAiB,EAAE,+BAA2B;AAO7E,MAAM,OAAO,aAAa;IAQxB,YAAY,EACV,SAAS,EACT,sBAAsB,EACtB,OAAO,GAKR;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YACL,CAAC;QACH,CAAC,CAAC;QA5JA,uBAAA,IAAI,4BAAc,SAAS,MAAA,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,IAAI,aAAa,CAChC,sBAAsB,EACtB,OAAO,EACP,KAAK,IAAI,EAAE,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,CACpC,CAAC;IACJ,CAAC;CAuJF;gOA1IG,cAAsB,EACtB,KAA2B,EAC3B,UAAkB,EAClB,MAAe;IAEf,MAAM,YAAY,GAAG,kCAAkC,CACrD,KAAK,EACL,UAAU,EACV,MAAM,CACP,CAAC;IACF,MAAM,cAAc,GAAmB;QACrC,WAAW,EAAE,KAAK,CAAC,MAAM;QACzB,YAAY;KACb,CAAC;IACF,uBAAA,IAAI,qDAAgC,CAAC,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;IACzE,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import { BridgeClientId, StatusTypes } from '@metamask/bridge-controller';\n\nimport type { BridgeStatusControllerMessenger, FetchFunction } from './types';\nimport type { BridgeHistoryItem } from './types';\nimport { getJwt } from './utils/authentication';\nimport {\n IntentApi,\n IntentApiImpl,\n IntentBridgeStatus,\n translateIntentOrderToBridgeStatus,\n} from './utils/intent-api';\nimport { getTransactionMetaById, updateTransaction } from './utils/transaction';\nimport { IntentStatusResponse, IntentOrderStatus } from './utils/validators';\n\ntype IntentStatuses = {\n orderStatus: IntentOrderStatus;\n bridgeStatus: IntentBridgeStatus | null;\n};\n\nexport class IntentManager {\n readonly #messenger: BridgeStatusControllerMessenger;\n\n readonly intentApi: IntentApi;\n\n readonly #intentStatusesByBridgeTxMetaId: Map<string, IntentStatuses> =\n new Map();\n\n constructor({\n messenger,\n customBridgeApiBaseUrl,\n fetchFn,\n }: {\n messenger: BridgeStatusControllerMessenger;\n customBridgeApiBaseUrl: string;\n fetchFn: FetchFunction;\n }) {\n this.#messenger = messenger;\n this.intentApi = new IntentApiImpl(\n customBridgeApiBaseUrl,\n fetchFn,\n async () => await getJwt(messenger),\n );\n }\n\n /**\n * Set the intent statuses for a given bridge transaction.\n *\n * @param bridgeTxMetaId - The bridge transaction meta ID (key for storage).\n * @param order - The intent order.\n * @param srcChainId - The source chain ID.\n * @param txHash - The transaction hash.\n * @returns The intent statuses.\n */\n\n #setIntentStatuses(\n bridgeTxMetaId: string,\n order: IntentStatusResponse,\n srcChainId: number,\n txHash?: string,\n ): IntentStatuses {\n const bridgeStatus = translateIntentOrderToBridgeStatus(\n order,\n srcChainId,\n txHash,\n );\n const intentStatuses: IntentStatuses = {\n orderStatus: order.status,\n bridgeStatus,\n };\n this.#intentStatusesByBridgeTxMetaId.set(bridgeTxMetaId, intentStatuses);\n return intentStatuses;\n }\n\n /**\n * Get the status of an intent order.\n *\n * @param bridgeTxMetaId - The bridge transaction meta ID.\n * @param protocol - The protocol of the intent.\n * @param clientId - The client ID.\n * @returns The intent order mapped status.\n */\n\n getIntentTransactionStatus = async (\n bridgeTxMetaId: string,\n srcChainId: number,\n protocol: string,\n clientId: BridgeClientId,\n txHash?: string,\n ): Promise<IntentStatuses | undefined> => {\n try {\n const orderStatus = await this.intentApi.getOrderStatus(\n bridgeTxMetaId,\n protocol,\n srcChainId,\n clientId,\n );\n\n return this.#setIntentStatuses(\n bridgeTxMetaId,\n orderStatus,\n srcChainId,\n txHash,\n );\n } catch (error: unknown) {\n if (error instanceof Error) {\n throw new Error(\n `[Intent polling] Failed to get intent order status from API: ${error.message}`,\n );\n }\n return undefined;\n }\n };\n\n /**\n * Sync the transaction status from the intent status.\n *\n * @param bridgeTxMetaId - The bridge transaction meta ID.\n * @param historyItem - The history item.\n */\n\n syncTransactionFromIntentStatus = (\n bridgeTxMetaId: string,\n historyItem: BridgeHistoryItem,\n ): void => {\n // Update the actual transaction in TransactionController to sync with intent status\n // Use the original transaction ID (not the bridge history key)\n const originalTxId =\n historyItem.originalTransactionId ?? historyItem.txMetaId;\n if (!originalTxId) {\n return;\n }\n\n const intentStatuses =\n this.#intentStatusesByBridgeTxMetaId.get(bridgeTxMetaId);\n if (!intentStatuses) {\n return;\n }\n\n try {\n // Merge with existing TransactionMeta to avoid wiping required fields\n const existingTxMeta = getTransactionMetaById(\n this.#messenger,\n originalTxId,\n );\n if (!existingTxMeta) {\n console.warn(\n '[Intent polling] Skipping update, transaction not found',\n { originalTxId, bridgeHistoryKey: bridgeTxMetaId },\n );\n return;\n }\n const { bridgeStatus, orderStatus } = intentStatuses;\n const txHash = bridgeStatus?.txHash;\n\n const isComplete = bridgeStatus?.status.status === StatusTypes.COMPLETE;\n const isFinalStatus =\n bridgeStatus?.status.status === StatusTypes.COMPLETE ||\n bridgeStatus?.status.status === StatusTypes.FAILED;\n const existingTxReceipt = (\n existingTxMeta as { txReceipt?: Record<string, unknown> }\n ).txReceipt;\n const txReceiptUpdate = txHash\n ? {\n txReceipt: {\n ...existingTxReceipt,\n transactionHash: txHash as `0x${string}` | undefined,\n status: isComplete ? '0x1' : '0x0',\n },\n }\n : {};\n\n updateTransaction(\n this.#messenger,\n existingTxMeta,\n {\n status: bridgeStatus?.transactionStatus,\n ...(txHash ? { hash: txHash } : {}),\n ...txReceiptUpdate,\n },\n `BridgeStatusController - Intent order status updated: ${orderStatus}`,\n );\n\n if (isFinalStatus) {\n this.#intentStatusesByBridgeTxMetaId.delete(bridgeTxMetaId);\n }\n } catch (error) {\n console.error('[Intent polling] Failed to update transaction status', {\n originalTxId,\n bridgeHistoryKey: bridgeTxMetaId,\n error,\n });\n }\n };\n}\n"]}
@@ -9,11 +9,10 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _BridgeStatusController_pollingTokensByTxMetaId, _BridgeStatusController_intentManager, _BridgeStatusController_clientId, _BridgeStatusController_fetchFn, _BridgeStatusController_config, _BridgeStatusController_addTransactionBatchFn, _BridgeStatusController_trace, _BridgeStatusController_markTxAsFailed, _BridgeStatusController_restartPollingForIncompleteHistoryItems, _BridgeStatusController_addTxToHistory, _BridgeStatusController_rekeyHistoryItem, _BridgeStatusController_startPollingForTxId, _BridgeStatusController_handleFetchFailure, _BridgeStatusController_fetchBridgeTxStatus, _BridgeStatusController_getSrcTxHash, _BridgeStatusController_updateSrcTxHash, _BridgeStatusController_wipeBridgeStatusByChainId, _BridgeStatusController_waitForHashAndReturnFinalTxMeta, _BridgeStatusController_waitForTxConfirmation, _BridgeStatusController_handleApprovalTx, _BridgeStatusController_handleEvmTransaction, _BridgeStatusController_handleUSDTAllowanceReset, _BridgeStatusController_calculateGasFees, _BridgeStatusController_handleEvmTransactionBatch, _BridgeStatusController_trackUnifiedSwapBridgeEvent;
12
+ var _BridgeStatusController_pollingTokensByTxMetaId, _BridgeStatusController_intentManager, _BridgeStatusController_clientId, _BridgeStatusController_fetchFn, _BridgeStatusController_config, _BridgeStatusController_addTransactionBatchFn, _BridgeStatusController_trace, _BridgeStatusController_markTxAsFailed, _BridgeStatusController_restartPollingForIncompleteHistoryItems, _BridgeStatusController_addTxToHistory, _BridgeStatusController_rekeyHistoryItem, _BridgeStatusController_startPollingForTxId, _BridgeStatusController_handleFetchFailure, _BridgeStatusController_fetchBridgeTxStatus, _BridgeStatusController_getSrcTxHash, _BridgeStatusController_updateSrcTxHash, _BridgeStatusController_wipeBridgeStatusByChainId, _BridgeStatusController_handleApprovalTx, _BridgeStatusController_handleEvmTransactionBatch, _BridgeStatusController_trackUnifiedSwapBridgeEvent;
13
13
  import { formatChainIdToHex, isNonEvmChainId, StatusTypes, UnifiedSwapBridgeEventName, isCrossChain, isTronChainId, isEvmTxData, isHardwareWallet, MetricsActionType, MetaMetricsSwapsEventSource, isBitcoinTrade, isTronTrade, PollingStatus } from "@metamask/bridge-controller";
14
- import { toHex } from "@metamask/controller-utils";
15
14
  import { StaticIntervalPollingController } from "@metamask/polling-controller";
16
- import { TransactionStatus, TransactionType } from "@metamask/transaction-controller";
15
+ import { TransactionStatus, TransactionType, TransactionController } from "@metamask/transaction-controller";
17
16
  import { numberToHex } from "@metamask/utils";
18
17
  import { IntentManager } from "./bridge-status-controller.intent.mjs";
19
18
  import { BRIDGE_PROD_API_BASE_URL, BRIDGE_STATUS_CONTROLLER_NAME, DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE, MAX_ATTEMPTS, REFRESH_INTERVAL_MS } from "./constants.mjs";
@@ -22,15 +21,14 @@ import { getAccountByAddress } from "./utils/accounts.mjs";
22
21
  import { getJwt } from "./utils/authentication.mjs";
23
22
  import { stopPollingForQuotes, trackMetricsEvent } from "./utils/bridge.mjs";
24
23
  import { fetchBridgeTxStatus, getStatusRequestWithSrcTxHash, shouldSkipFetchDueToFetchFailures } from "./utils/bridge-status.mjs";
25
- import { getTxGasEstimates } from "./utils/gas.mjs";
26
24
  import { getInitialHistoryItem, rekeyHistoryItemInState, shouldPollHistoryItem } from "./utils/history.mjs";
27
- import { getIntentFromQuote, mapIntentOrderStatusToTransactionStatus } from "./utils/intent-api.mjs";
25
+ import { getIntentFromQuote, mapIntentOrderStatusToTransactionStatus, postSubmitOrder } from "./utils/intent-api.mjs";
28
26
  import { signTypedMessage } from "./utils/keyring.mjs";
29
27
  import { getFinalizedTxProperties, getPriceImpactFromQuote, getRequestMetadataFromHistory, getRequestParamFromHistory, getTradeDataFromHistory, getEVMTxPropertiesFromTransactionMeta, getTxStatusesFromHistory, getPreConfirmationPropertiesFromQuote } from "./utils/metrics.mjs";
30
28
  import { getNetworkClientIdByChainId, getSelectedChainId } from "./utils/network.mjs";
31
29
  import { handleNonEvmTx } from "./utils/snaps.mjs";
32
30
  import { getApprovalTraceParams, getTraceParams } from "./utils/trace.mjs";
33
- import { findAndUpdateTransactionsInBatch, getAddTransactionBatchParams, getStatusRequestParams, handleApprovalDelay, handleMobileHardwareWalletDelay, generateActionId, waitForTxConfirmation } from "./utils/transaction.mjs";
31
+ import { getAddTransactionBatchParams, handleApprovalDelay, handleMobileHardwareWalletDelay, generateActionId, waitForTxConfirmation, getTransactionMetaById, addTransactionBatch, addSyntheticTransaction, getTransactions, submitEvmTransaction, checkIsDelegatedAccount } from "./utils/transaction.mjs";
34
32
  const metadata = {
35
33
  // We want to persist the bridge status state so that we can show the proper data for the Activity list
36
34
  // basically match the behavior of TransactionController
@@ -414,8 +412,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
414
412
  return srcTxHash;
415
413
  }
416
414
  // Look up in TransactionController if txMeta has been updated with the srcTxHash
417
- const txControllerState = this.messenger.call('TransactionController:getState');
418
- const txMeta = txControllerState.transactions.find((tx) => tx.id === bridgeTxMetaId);
415
+ const txMeta = getTransactionMetaById(this.messenger, bridgeTxMetaId);
419
416
  return txMeta?.hash;
420
417
  });
421
418
  _BridgeStatusController_updateSrcTxHash.set(this, (bridgeTxMetaId, srcTxHash) => {
@@ -454,29 +451,18 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
454
451
  * TX SUBMISSION HANDLING
455
452
  *******************************************************
456
453
  */
457
- _BridgeStatusController_waitForHashAndReturnFinalTxMeta.set(this, async (hashPromise) => {
458
- const transactionHash = await hashPromise;
459
- const finalTransactionMeta = this.messenger
460
- .call('TransactionController:getState')
461
- .transactions.find((tx) => tx.hash === transactionHash);
462
- if (!finalTransactionMeta) {
463
- throw new Error('Failed to submit cross-chain swap tx: txMeta for txHash was not found');
464
- }
465
- return finalTransactionMeta;
466
- });
467
- // Waits until a given transaction (by id) reaches confirmed/finalized status or fails/times out.
468
- _BridgeStatusController_waitForTxConfirmation.set(this, async (txId, { timeoutMs = 5 * 60000, // 5 minutes default
469
- pollMs = 3000, } = {}) => {
470
- return await waitForTxConfirmation(this.messenger, txId, {
471
- timeoutMs,
472
- pollMs,
473
- });
474
- });
475
454
  _BridgeStatusController_handleApprovalTx.set(this, async (quoteResponse, isBridgeTx, srcChainId, approval, resetApproval, requireApproval) => {
476
455
  if (approval && isEvmTxData(approval)) {
477
456
  const approveTx = async () => {
478
- await __classPrivateFieldGet(this, _BridgeStatusController_handleUSDTAllowanceReset, "f").call(this, resetApproval);
479
- const approvalTxMeta = await __classPrivateFieldGet(this, _BridgeStatusController_handleEvmTransaction, "f").call(this, {
457
+ if (resetApproval) {
458
+ await submitEvmTransaction({
459
+ messenger: this.messenger,
460
+ transactionType: TransactionType.bridgeApproval,
461
+ trade: resetApproval,
462
+ });
463
+ }
464
+ const approvalTxMeta = await submitEvmTransaction({
465
+ messenger: this.messenger,
480
466
  transactionType: isBridgeTx
481
467
  ? TransactionType.bridgeApproval
482
468
  : TransactionType.swapApproval,
@@ -490,85 +476,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
490
476
  }
491
477
  return undefined;
492
478
  });
493
- /**
494
- * Submits an EVM transaction to the TransactionController
495
- *
496
- * @param params - The parameters for the transaction
497
- * @param params.transactionType - The type of transaction to submit
498
- * @param params.trade - The trade data to confirm
499
- * @param params.requireApproval - Whether to require approval for the transaction
500
- * @param params.txFee - Optional gas fee parameters from the quote (used when gasIncluded is true)
501
- * @param params.txFee.maxFeePerGas - The maximum fee per gas from the quote
502
- * @param params.txFee.maxPriorityFeePerGas - The maximum priority fee per gas from the quote
503
- * @param params.actionId - Optional actionId for pre-submission history (if not provided, one is generated)
504
- * @returns The transaction meta
505
- */
506
- _BridgeStatusController_handleEvmTransaction.set(this, async ({ transactionType, trade, requireApproval = false, txFee, actionId: providedActionId, }) => {
507
- // Use provided actionId (for pre-submission history) or generate one
508
- const actionId = providedActionId ?? generateActionId();
509
- const selectedAccount = getAccountByAddress(this.messenger, trade.from);
510
- if (!selectedAccount) {
511
- throw new Error('Failed to submit cross-chain swap transaction: unknown account in trade data');
512
- }
513
- const hexChainId = formatChainIdToHex(trade.chainId);
514
- const networkClientId = getNetworkClientIdByChainId(this.messenger, hexChainId);
515
- const requestOptions = {
516
- actionId,
517
- networkClientId,
518
- requireApproval,
519
- type: transactionType,
520
- origin: 'metamask',
521
- };
522
- // Exclude gasLimit from trade to avoid type issues (it can be null)
523
- const { gasLimit: tradeGasLimit, ...tradeWithoutGasLimit } = trade;
524
- const transactionParams = {
525
- ...tradeWithoutGasLimit,
526
- chainId: hexChainId,
527
- // Only add gasLimit and gas if they're valid (not undefined/null/zero)
528
- ...(tradeGasLimit &&
529
- tradeGasLimit !== 0 && {
530
- gasLimit: tradeGasLimit.toString(),
531
- gas: tradeGasLimit.toString(),
532
- }),
533
- };
534
- const transactionParamsWithMaxGas = {
535
- ...transactionParams,
536
- ...(await __classPrivateFieldGet(this, _BridgeStatusController_calculateGasFees, "f").call(this, transactionParams, networkClientId, hexChainId, txFee)),
537
- };
538
- const { result } = await this.messenger.call('TransactionController:addTransaction', transactionParamsWithMaxGas, requestOptions);
539
- return await __classPrivateFieldGet(this, _BridgeStatusController_waitForHashAndReturnFinalTxMeta, "f").call(this, result);
540
- });
541
- _BridgeStatusController_handleUSDTAllowanceReset.set(this, async (resetApproval) => {
542
- if (resetApproval) {
543
- await __classPrivateFieldGet(this, _BridgeStatusController_handleEvmTransaction, "f").call(this, {
544
- transactionType: TransactionType.bridgeApproval,
545
- trade: resetApproval,
546
- });
547
- }
548
- });
549
- _BridgeStatusController_calculateGasFees.set(this, async (transactionParams, networkClientId, chainId, txFee) => {
550
- const { gas } = transactionParams;
551
- // If txFee is provided (gasIncluded case), use the quote's gas fees
552
- // Convert to hex since txFee values from the quote are decimal strings
553
- if (txFee) {
554
- return {
555
- maxFeePerGas: toHex(txFee.maxFeePerGas),
556
- maxPriorityFeePerGas: toHex(txFee.maxPriorityFeePerGas),
557
- gas: gas ? toHex(gas) : undefined,
558
- };
559
- }
560
- const { gasFeeEstimates } = this.messenger.call('GasFeeController:getState');
561
- const { estimates: txGasFeeEstimates } = await this.messenger.call('TransactionController:estimateGasFee', { transactionParams, chainId, networkClientId });
562
- const { maxFeePerGas, maxPriorityFeePerGas } = getTxGasEstimates({
563
- networkGasFeeEstimates: gasFeeEstimates,
564
- txGasFeeEstimates,
565
- });
566
- return {
567
- maxFeePerGas,
568
- maxPriorityFeePerGas,
569
- gas: gas ? toHex(gas) : undefined,
570
- };
571
- });
479
+ // TODO simplify and make more readable
572
480
  /**
573
481
  * Submits batched EVM transactions to the TransactionController
574
482
  *
@@ -586,22 +494,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
586
494
  messenger: this.messenger,
587
495
  ...args,
588
496
  });
589
- const txDataByType = {
590
- [TransactionType.bridgeApproval]: transactionParams.transactions.find(({ type }) => type === TransactionType.bridgeApproval)?.params.data,
591
- [TransactionType.swapApproval]: transactionParams.transactions.find(({ type }) => type === TransactionType.swapApproval)?.params.data,
592
- [TransactionType.bridge]: transactionParams.transactions.find(({ type }) => type === TransactionType.bridge)?.params.data,
593
- [TransactionType.swap]: transactionParams.transactions.find(({ type }) => type === TransactionType.swap)?.params.data,
594
- };
595
- const { batchId } = await __classPrivateFieldGet(this, _BridgeStatusController_addTransactionBatchFn, "f").call(this, transactionParams);
596
- const { approvalMeta, tradeMeta } = findAndUpdateTransactionsInBatch({
597
- messenger: this.messenger,
598
- batchId,
599
- txDataByType,
600
- });
601
- if (!tradeMeta) {
602
- throw new Error('Failed to update cross-chain swap transaction batch: tradeMeta not found');
603
- }
604
- return { approvalMeta, tradeMeta };
497
+ return await addTransactionBatch(this.messenger, __classPrivateFieldGet(this, _BridgeStatusController_addTransactionBatchFn, "f"), transactionParams);
605
498
  });
606
499
  /**
607
500
  * Submits a cross-chain swap transaction
@@ -691,19 +584,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
691
584
  // Delegated accounts only allow 1 in-flight tx, so approve + swap
692
585
  // must be batched into a single transaction
693
586
  const hexChainId = formatChainIdToHex(quoteResponse.quote.srcChainId);
694
- isDelegatedAccount = await (async () => {
695
- try {
696
- const atomicBatchSupport = await this.messenger.call('TransactionController:isAtomicBatchSupported', {
697
- address: quoteResponse.trade
698
- .from,
699
- chainIds: [hexChainId],
700
- });
701
- return atomicBatchSupport.some((entry) => entry.isSupported && entry.delegationAddress);
702
- }
703
- catch {
704
- return false;
705
- }
706
- })();
587
+ isDelegatedAccount = await checkIsDelegatedAccount(this.messenger, quoteResponse.trade.from, [hexChainId]);
707
588
  if (isStxEnabledOnClient ||
708
589
  quoteResponse.quote.gasIncluded7702 ||
709
590
  isDelegatedAccount) {
@@ -726,17 +607,21 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
726
607
  ? quoteResponse.approval
727
608
  : undefined, quoteResponse.resetApproval, requireApproval);
728
609
  approvalTxId = approvalTxMeta?.id;
729
- await handleMobileHardwareWalletDelay(requireApproval);
610
+ // Hardware-wallet delay first (Ledger second-prompt spacing), then wait for
611
+ // on-chain approval confirmation so swap gas estimation runs after allowance is set.
612
+ if (requireApproval && approvalTxMeta) {
613
+ await handleMobileHardwareWalletDelay(requireApproval);
614
+ await waitForTxConfirmation(this.messenger, approvalTxMeta.id);
615
+ }
616
+ else {
617
+ await handleMobileHardwareWalletDelay(requireApproval);
618
+ }
730
619
  // Generate actionId for pre-submission history (non-batch EVM only)
731
620
  const actionId = generateActionId().toString();
732
621
  // Add pre-submission history keyed by actionId
733
622
  // This ensures we have quote data available if transaction fails during submission
734
623
  __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
735
624
  accountAddress: selectedAccount.address,
736
- statusRequest: {
737
- ...getStatusRequestParams(quoteResponse),
738
- srcTxHash: '', // Not available yet
739
- },
740
625
  quoteResponse,
741
626
  slippagePercentage: 0,
742
627
  isStxEnabled: isStxEnabledOnClient,
@@ -745,10 +630,12 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
745
630
  location,
746
631
  abTests,
747
632
  activeAbTests,
748
- }, actionId);
633
+ actionId,
634
+ });
749
635
  // Pass txFee when gasIncluded is true to use the quote's gas fees
750
636
  // instead of re-estimating (which would fail for max native token swaps)
751
- const tradeTxMeta = await __classPrivateFieldGet(this, _BridgeStatusController_handleEvmTransaction, "f").call(this, {
637
+ const tradeTxMeta = await submitEvmTransaction({
638
+ messenger: this.messenger,
752
639
  transactionType: isBridgeTx
753
640
  ? TransactionType.bridge
754
641
  : TransactionType.swap,
@@ -776,10 +663,6 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
776
663
  __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
777
664
  accountAddress: selectedAccount.address,
778
665
  bridgeTxMeta: txMeta, // Only the id field is used by the BridgeStatusController
779
- statusRequest: {
780
- ...getStatusRequestParams(quoteResponse),
781
- srcTxHash: txMeta.hash,
782
- },
783
666
  quoteResponse,
784
667
  slippagePercentage: 0, // TODO include slippage provided by quote if using dynamic slippage, or slippage from quote request
785
668
  isStxEnabled: isStxEnabledOnClient,
@@ -820,6 +703,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
820
703
  const { quoteResponse, accountAddress, location, abTests, activeAbTests } = params;
821
704
  // TODO add metrics context
822
705
  stopPollingForQuotes(this.messenger);
706
+ const startTime = Date.now();
823
707
  // Build pre-confirmation properties for error tracking parity with submitTx
824
708
  const account = getAccountByAddress(this.messenger, accountAddress);
825
709
  const isHardwareAccount = Boolean(account) && isHardwareWallet(account);
@@ -834,7 +718,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
834
718
  const approvalTxMeta = await __classPrivateFieldGet(this, _BridgeStatusController_handleApprovalTx, "f").call(this, quoteResponse, isBridgeTx, quoteResponse.quote.srcChainId, quoteResponse.approval, quoteResponse.resetApproval, requireApproval);
835
719
  const approvalTxId = approvalTxMeta?.id;
836
720
  if (approvalTxId) {
837
- await __classPrivateFieldGet(this, _BridgeStatusController_waitForTxConfirmation, "f").call(this, approvalTxId);
721
+ await waitForTxConfirmation(this.messenger, approvalTxId);
838
722
  }
839
723
  const { srcChainId, requestId } = quoteResponse.quote;
840
724
  const signature = await signTypedMessage({
@@ -850,8 +734,13 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
850
734
  userAddress: accountAddress,
851
735
  aggregatorId: intent.protocol,
852
736
  };
853
- const intentOrder = await __classPrivateFieldGet(this, _BridgeStatusController_intentManager, "f").submitIntent(submissionParams, __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f"));
854
- const orderUid = intentOrder.id;
737
+ const { id: orderUid, status } = await postSubmitOrder({
738
+ params: submissionParams,
739
+ clientId: __classPrivateFieldGet(this, _BridgeStatusController_clientId, "f"),
740
+ jwt: await getJwt(this.messenger),
741
+ fetchFn: __classPrivateFieldGet(this, _BridgeStatusController_fetchFn, "f"),
742
+ bridgeApiBaseUrl: __classPrivateFieldGet(this, _BridgeStatusController_config, "f").customBridgeApiBaseUrl,
743
+ });
855
744
  // Determine transaction type: swap for same-chain, bridge for cross-chain
856
745
  const transactionType = isBridgeTx
857
746
  ? /* c8 ignore start */
@@ -872,25 +761,16 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
872
761
  gas: '0x5208', // Minimal gas for display purposes
873
762
  gasPrice: '0x3b9aca00', // 1 Gwei - will be converted to EIP-1559 fees if network supports it
874
763
  };
875
- const { transactionMeta: txMetaPromise } = await this.messenger.call('TransactionController:addTransaction', intentTransactionParams, {
876
- origin: 'metamask',
877
- actionId: generateActionId(),
764
+ const initialTxMeta = await addSyntheticTransaction(this.messenger, intentTransactionParams, {
878
765
  requireApproval: false,
879
- isStateOnly: true,
880
766
  networkClientId,
881
767
  type: transactionType,
882
768
  });
883
- const intentTxMeta = txMetaPromise;
884
- // Map intent order status to TransactionController status
885
- const initialTransactionStatus = mapIntentOrderStatusToTransactionStatus(intentOrder.status);
886
- // Update transaction with proper initial status based on intent order
887
- const statusUpdatedTxMeta = {
888
- ...intentTxMeta,
889
- status: initialTransactionStatus,
890
- };
891
- // Update with actual transaction metadata
769
+ // Update txHistory with actual transaction metadata
892
770
  const syntheticMeta = {
893
- ...statusUpdatedTxMeta,
771
+ ...initialTxMeta,
772
+ // Map intent order status to TransactionController status
773
+ status: mapIntentOrderStatusToTransactionStatus(status),
894
774
  isIntentTx: true,
895
775
  orderUid,
896
776
  };
@@ -904,14 +784,9 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
904
784
  id: bridgeHistoryKey,
905
785
  originalTransactionId: syntheticMeta.id, // Keep original txId for TransactionController updates
906
786
  };
907
- const startTime = Date.now();
908
787
  __classPrivateFieldGet(this, _BridgeStatusController_addTxToHistory, "f").call(this, {
909
788
  accountAddress,
910
789
  bridgeTxMeta: bridgeTxMetaForHistory,
911
- statusRequest: {
912
- ...getStatusRequestParams(quoteResponse),
913
- srcTxHash: syntheticMeta.hash ?? '',
914
- },
915
790
  quoteResponse,
916
791
  slippagePercentage: 0,
917
792
  isStxEnabled: false,
@@ -988,6 +863,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
988
863
  });
989
864
  return;
990
865
  }
866
+ const { featureId, approvalTxId, quote } = historyItem;
991
867
  const requestParamProperties = getRequestParamFromHistory(historyItem);
992
868
  // Always publish StatusValidationFailed event, regardless of featureId
993
869
  if (eventName === UnifiedSwapBridgeEventName.StatusValidationFailed) {
@@ -1006,13 +882,13 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
1006
882
  return;
1007
883
  }
1008
884
  // Skip tracking all other events when featureId is set (i.e. PERPS)
1009
- if (historyItem.featureId) {
885
+ if (featureId) {
1010
886
  return;
1011
887
  }
1012
888
  const selectedAccount = getAccountByAddress(this.messenger, historyItem.account);
1013
- const { transactions } = this.messenger.call('TransactionController:getState');
1014
- const txMeta = transactions?.find((tx) => tx.id === txMetaId);
1015
- const approvalTxMeta = transactions?.find((tx) => tx.id === historyItem.approvalTxId);
889
+ const transactions = getTransactions(this.messenger);
890
+ const txMeta = transactions.find((tx) => tx.id === txMetaId);
891
+ const approvalTxMeta = transactions.find((tx) => tx.id === approvalTxId);
1016
892
  const requiredEventProperties = {
1017
893
  ...baseProperties,
1018
894
  ...requestParamProperties,
@@ -1020,7 +896,7 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
1020
896
  ...getTradeDataFromHistory(historyItem),
1021
897
  ...getTxStatusesFromHistory(historyItem),
1022
898
  ...getFinalizedTxProperties(historyItem, txMeta, approvalTxMeta),
1023
- ...getPriceImpactFromQuote(historyItem.quote),
899
+ ...getPriceImpactFromQuote(quote),
1024
900
  };
1025
901
  trackMetricsEvent({
1026
902
  messenger: this.messenger,
@@ -1095,5 +971,5 @@ export class BridgeStatusController extends StaticIntervalPollingController() {
1095
971
  __classPrivateFieldGet(this, _BridgeStatusController_restartPollingForIncompleteHistoryItems, "f").call(this);
1096
972
  }
1097
973
  }
1098
- _BridgeStatusController_pollingTokensByTxMetaId = new WeakMap(), _BridgeStatusController_intentManager = new WeakMap(), _BridgeStatusController_clientId = new WeakMap(), _BridgeStatusController_fetchFn = new WeakMap(), _BridgeStatusController_config = new WeakMap(), _BridgeStatusController_addTransactionBatchFn = new WeakMap(), _BridgeStatusController_trace = new WeakMap(), _BridgeStatusController_markTxAsFailed = new WeakMap(), _BridgeStatusController_restartPollingForIncompleteHistoryItems = new WeakMap(), _BridgeStatusController_addTxToHistory = new WeakMap(), _BridgeStatusController_rekeyHistoryItem = new WeakMap(), _BridgeStatusController_startPollingForTxId = new WeakMap(), _BridgeStatusController_handleFetchFailure = new WeakMap(), _BridgeStatusController_fetchBridgeTxStatus = new WeakMap(), _BridgeStatusController_getSrcTxHash = new WeakMap(), _BridgeStatusController_updateSrcTxHash = new WeakMap(), _BridgeStatusController_wipeBridgeStatusByChainId = new WeakMap(), _BridgeStatusController_waitForHashAndReturnFinalTxMeta = new WeakMap(), _BridgeStatusController_waitForTxConfirmation = new WeakMap(), _BridgeStatusController_handleApprovalTx = new WeakMap(), _BridgeStatusController_handleEvmTransaction = new WeakMap(), _BridgeStatusController_handleUSDTAllowanceReset = new WeakMap(), _BridgeStatusController_calculateGasFees = new WeakMap(), _BridgeStatusController_handleEvmTransactionBatch = new WeakMap(), _BridgeStatusController_trackUnifiedSwapBridgeEvent = new WeakMap();
974
+ _BridgeStatusController_pollingTokensByTxMetaId = new WeakMap(), _BridgeStatusController_intentManager = new WeakMap(), _BridgeStatusController_clientId = new WeakMap(), _BridgeStatusController_fetchFn = new WeakMap(), _BridgeStatusController_config = new WeakMap(), _BridgeStatusController_addTransactionBatchFn = new WeakMap(), _BridgeStatusController_trace = new WeakMap(), _BridgeStatusController_markTxAsFailed = new WeakMap(), _BridgeStatusController_restartPollingForIncompleteHistoryItems = new WeakMap(), _BridgeStatusController_addTxToHistory = new WeakMap(), _BridgeStatusController_rekeyHistoryItem = new WeakMap(), _BridgeStatusController_startPollingForTxId = new WeakMap(), _BridgeStatusController_handleFetchFailure = new WeakMap(), _BridgeStatusController_fetchBridgeTxStatus = new WeakMap(), _BridgeStatusController_getSrcTxHash = new WeakMap(), _BridgeStatusController_updateSrcTxHash = new WeakMap(), _BridgeStatusController_wipeBridgeStatusByChainId = new WeakMap(), _BridgeStatusController_handleApprovalTx = new WeakMap(), _BridgeStatusController_handleEvmTransactionBatch = new WeakMap(), _BridgeStatusController_trackUnifiedSwapBridgeEvent = new WeakMap();
1099
975
  //# sourceMappingURL=bridge-status-controller.mjs.map