@metamask/bridge-status-controller 65.0.1 → 66.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.
- package/CHANGELOG.md +32 -1
- package/dist/bridge-status-controller.cjs +108 -226
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.intent.cjs +70 -0
- package/dist/bridge-status-controller.intent.cjs.map +1 -0
- package/dist/bridge-status-controller.intent.d.cts +13 -0
- package/dist/bridge-status-controller.intent.d.cts.map +1 -0
- package/dist/bridge-status-controller.intent.d.mts +13 -0
- package/dist/bridge-status-controller.intent.d.mts.map +1 -0
- package/dist/bridge-status-controller.intent.mjs +66 -0
- package/dist/bridge-status-controller.intent.mjs.map +1 -0
- package/dist/bridge-status-controller.mjs +111 -229
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -7
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -7
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/intent-api.cjs +42 -7
- package/dist/utils/intent-api.cjs.map +1 -1
- package/dist/utils/intent-api.d.cts +7 -4
- package/dist/utils/intent-api.d.cts.map +1 -1
- package/dist/utils/intent-api.d.mts +7 -4
- package/dist/utils/intent-api.d.mts.map +1 -1
- package/dist/utils/intent-api.mjs +38 -3
- package/dist/utils/intent-api.mjs.map +1 -1
- package/dist/utils/transaction.cjs +44 -1
- package/dist/utils/transaction.cjs.map +1 -1
- package/dist/utils/transaction.d.cts +9 -0
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +9 -0
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/transaction.mjs +41 -0
- package/dist/utils/transaction.mjs.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-status-controller.intent.cjs","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA0D;AAQ1D,MAAa,mBAAmB;IAK9B,YAAY,EACV,SAAS,EACT,mBAAmB,GAIpB;QAVQ,iDAA4C;QAE5C,2DAA+E;QAaxF,oCAA+B,GAAG,CAChC,cAAsB,EACtB,WAA8B,EAC9B,iBAA0C,EAC1C,iBAAyB,EACnB,EAAE;YACR,oFAAoF;YACpF,+DAA+D;YAC/D,MAAM,YAAY,GAChB,WAAW,CAAC,qBAAqB,IAAI,WAAW,CAAC,QAAQ,CAAC;YAC5D,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,sEAAsE;gBACtE,MAAM,EAAE,YAAY,EAAE,GAAG,uBAAA,IAAI,sCAAW,CAAC,IAAI,CAC3C,gCAAgC,CACjC,CAAC;gBACF,MAAM,cAAc,GAAG,YAAY,CAAC,IAAI,CACtC,CAAC,EAAmB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,YAAY,CAChD,CAAC;gBACF,IAAI,CAAC,cAAc,EAAE,CAAC;oBACpB,OAAO,CAAC,IAAI,CACV,4DAA4D,EAC5D,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,CACnD,CAAC;oBACF,OAAO;gBACT,CAAC;gBAED,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;gBACrC,MAAM,UAAU,GACd,iBAAiB,CAAC,MAAM,CAAC,MAAM,KAAK,+BAAW,CAAC,QAAQ,CAAC;gBAC3D,MAAM,iBAAiB,GACrB,cACD,CAAC,SAAS,CAAC;gBACZ,MAAM,eAAe,GAAG,MAAM;oBAC5B,CAAC,CAAC;wBACE,SAAS,EAAE;4BACT,GAAG,iBAAiB;4BACpB,eAAe,EAAE,MAAM;4BACvB,MAAM,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAsB;yBAC1D;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBAEP,MAAM,aAAa,GAAoB;oBACrC,GAAG,cAAc;oBACjB,MAAM,EAAE,iBAAiB,CAAC,iBAAiB;oBAC3C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACnC,GAAG,eAAe;iBACA,CAAC;gBAErB,uBAAA,IAAI,gDAAqB,MAAzB,IAAI,EACF,aAAa,EACb,yDAAyD,iBAAiB,EAAE,CAC7E,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE;oBACvE,YAAY;oBACZ,gBAAgB,EAAE,cAAc;oBAChC,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QApEA,uBAAA,IAAI,kCAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,4CAAwB,mBAAmB,MAAA,CAAC;IAClD,CAAC;CAmEF;AAjFD,kDAiFC","sourcesContent":["import { StatusTypes } from '@metamask/bridge-controller';\nimport type { TransactionController } from '@metamask/transaction-controller';\nimport { TransactionMeta } from '@metamask/transaction-controller';\n\nimport type { BridgeStatusControllerMessenger } from './types';\nimport type { BridgeHistoryItem } from './types';\nimport { IntentStatusTranslation } from './utils/intent-api';\n\nexport class IntentStatusManager {\n readonly #messenger: BridgeStatusControllerMessenger;\n\n readonly #updateTransactionFn: typeof TransactionController.prototype.updateTransaction;\n\n constructor({\n messenger,\n updateTransactionFn,\n }: {\n messenger: BridgeStatusControllerMessenger;\n updateTransactionFn: typeof TransactionController.prototype.updateTransaction;\n }) {\n this.#messenger = messenger;\n this.#updateTransactionFn = updateTransactionFn;\n }\n\n syncTransactionFromIntentStatus = (\n bridgeTxMetaId: string,\n historyItem: BridgeHistoryItem,\n intentTranslation: IntentStatusTranslation,\n intentOrderStatus: string,\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 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\n const { txHash } = intentTranslation;\n const isComplete =\n intentTranslation.status.status === StatusTypes.COMPLETE;\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: intentTranslation.transactionStatus,\n ...(txHash ? { hash: txHash } : {}),\n ...txReceiptUpdate,\n } as TransactionMeta;\n\n this.#updateTransactionFn(\n updatedTxMeta,\n `BridgeStatusController - Intent order status updated: ${intentOrderStatus}`,\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"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TransactionController } from "@metamask/transaction-controller";
|
|
2
|
+
import type { BridgeStatusControllerMessenger } from "./types.cjs";
|
|
3
|
+
import type { BridgeHistoryItem } from "./types.cjs";
|
|
4
|
+
import { IntentStatusTranslation } from "./utils/intent-api.cjs";
|
|
5
|
+
export declare class IntentStatusManager {
|
|
6
|
+
#private;
|
|
7
|
+
constructor({ messenger, updateTransactionFn, }: {
|
|
8
|
+
messenger: BridgeStatusControllerMessenger;
|
|
9
|
+
updateTransactionFn: typeof TransactionController.prototype.updateTransaction;
|
|
10
|
+
});
|
|
11
|
+
syncTransactionFromIntentStatus: (bridgeTxMetaId: string, historyItem: BridgeHistoryItem, intentTranslation: IntentStatusTranslation, intentOrderStatus: string) => void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=bridge-status-controller.intent.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-status-controller.intent.d.cts","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,yCAAyC;AAG9E,OAAO,KAAK,EAAE,+BAA+B,EAAE,oBAAgB;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAgB;AACjD,OAAO,EAAE,uBAAuB,EAAE,+BAA2B;AAE7D,qBAAa,mBAAmB;;gBAKlB,EACV,SAAS,EACT,mBAAmB,GACpB,EAAE;QACD,SAAS,EAAE,+BAA+B,CAAC;QAC3C,mBAAmB,EAAE,OAAO,qBAAqB,CAAC,SAAS,CAAC,iBAAiB,CAAC;KAC/E;IAKD,+BAA+B,mBACb,MAAM,eACT,iBAAiB,qBACX,uBAAuB,qBACvB,MAAM,KACxB,IAAI,CA2DL;CACH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TransactionController } from "@metamask/transaction-controller";
|
|
2
|
+
import type { BridgeStatusControllerMessenger } from "./types.mjs";
|
|
3
|
+
import type { BridgeHistoryItem } from "./types.mjs";
|
|
4
|
+
import { IntentStatusTranslation } from "./utils/intent-api.mjs";
|
|
5
|
+
export declare class IntentStatusManager {
|
|
6
|
+
#private;
|
|
7
|
+
constructor({ messenger, updateTransactionFn, }: {
|
|
8
|
+
messenger: BridgeStatusControllerMessenger;
|
|
9
|
+
updateTransactionFn: typeof TransactionController.prototype.updateTransaction;
|
|
10
|
+
});
|
|
11
|
+
syncTransactionFromIntentStatus: (bridgeTxMetaId: string, historyItem: BridgeHistoryItem, intentTranslation: IntentStatusTranslation, intentOrderStatus: string) => void;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=bridge-status-controller.intent.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-status-controller.intent.d.mts","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,yCAAyC;AAG9E,OAAO,KAAK,EAAE,+BAA+B,EAAE,oBAAgB;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAgB;AACjD,OAAO,EAAE,uBAAuB,EAAE,+BAA2B;AAE7D,qBAAa,mBAAmB;;gBAKlB,EACV,SAAS,EACT,mBAAmB,GACpB,EAAE;QACD,SAAS,EAAE,+BAA+B,CAAC;QAC3C,mBAAmB,EAAE,OAAO,qBAAqB,CAAC,SAAS,CAAC,iBAAiB,CAAC;KAC/E;IAKD,+BAA+B,mBACb,MAAM,eACT,iBAAiB,qBACX,uBAAuB,qBACvB,MAAM,KACxB,IAAI,CA2DL;CACH"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _IntentStatusManager_messenger, _IntentStatusManager_updateTransactionFn;
|
|
13
|
+
import { StatusTypes } from "@metamask/bridge-controller";
|
|
14
|
+
export class IntentStatusManager {
|
|
15
|
+
constructor({ messenger, updateTransactionFn, }) {
|
|
16
|
+
_IntentStatusManager_messenger.set(this, void 0);
|
|
17
|
+
_IntentStatusManager_updateTransactionFn.set(this, void 0);
|
|
18
|
+
this.syncTransactionFromIntentStatus = (bridgeTxMetaId, historyItem, intentTranslation, intentOrderStatus) => {
|
|
19
|
+
// Update the actual transaction in TransactionController to sync with intent status
|
|
20
|
+
// Use the original transaction ID (not the bridge history key)
|
|
21
|
+
const originalTxId = historyItem.originalTransactionId ?? historyItem.txMetaId;
|
|
22
|
+
if (!originalTxId) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
// Merge with existing TransactionMeta to avoid wiping required fields
|
|
27
|
+
const { transactions } = __classPrivateFieldGet(this, _IntentStatusManager_messenger, "f").call('TransactionController:getState');
|
|
28
|
+
const existingTxMeta = transactions.find((tx) => tx.id === originalTxId);
|
|
29
|
+
if (!existingTxMeta) {
|
|
30
|
+
console.warn('📝 [Intent polling] Skipping update; transaction not found', { originalTxId, bridgeHistoryKey: bridgeTxMetaId });
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const { txHash } = intentTranslation;
|
|
34
|
+
const isComplete = intentTranslation.status.status === StatusTypes.COMPLETE;
|
|
35
|
+
const existingTxReceipt = existingTxMeta.txReceipt;
|
|
36
|
+
const txReceiptUpdate = txHash
|
|
37
|
+
? {
|
|
38
|
+
txReceipt: {
|
|
39
|
+
...existingTxReceipt,
|
|
40
|
+
transactionHash: txHash,
|
|
41
|
+
status: (isComplete ? '0x1' : '0x0'),
|
|
42
|
+
},
|
|
43
|
+
}
|
|
44
|
+
: {};
|
|
45
|
+
const updatedTxMeta = {
|
|
46
|
+
...existingTxMeta,
|
|
47
|
+
status: intentTranslation.transactionStatus,
|
|
48
|
+
...(txHash ? { hash: txHash } : {}),
|
|
49
|
+
...txReceiptUpdate,
|
|
50
|
+
};
|
|
51
|
+
__classPrivateFieldGet(this, _IntentStatusManager_updateTransactionFn, "f").call(this, updatedTxMeta, `BridgeStatusController - Intent order status updated: ${intentOrderStatus}`);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error('📝 [Intent polling] Failed to update transaction status', {
|
|
55
|
+
originalTxId,
|
|
56
|
+
bridgeHistoryKey: bridgeTxMetaId,
|
|
57
|
+
error,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
__classPrivateFieldSet(this, _IntentStatusManager_messenger, messenger, "f");
|
|
62
|
+
__classPrivateFieldSet(this, _IntentStatusManager_updateTransactionFn, updateTransactionFn, "f");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
_IntentStatusManager_messenger = new WeakMap(), _IntentStatusManager_updateTransactionFn = new WeakMap();
|
|
66
|
+
//# sourceMappingURL=bridge-status-controller.intent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge-status-controller.intent.mjs","sourceRoot":"","sources":["../src/bridge-status-controller.intent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,oCAAoC;AAQ1D,MAAM,OAAO,mBAAmB;IAK9B,YAAY,EACV,SAAS,EACT,mBAAmB,GAIpB;QAVQ,iDAA4C;QAE5C,2DAA+E;QAaxF,oCAA+B,GAAG,CAChC,cAAsB,EACtB,WAA8B,EAC9B,iBAA0C,EAC1C,iBAAyB,EACnB,EAAE;YACR,oFAAoF;YACpF,+DAA+D;YAC/D,MAAM,YAAY,GAChB,WAAW,CAAC,qBAAqB,IAAI,WAAW,CAAC,QAAQ,CAAC;YAC5D,IAAI,CAAC,YAAY,EAAE,CAAC;gBAClB,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,sEAAsE;gBACtE,MAAM,EAAE,YAAY,EAAE,GAAG,uBAAA,IAAI,sCAAW,CAAC,IAAI,CAC3C,gCAAgC,CACjC,CAAC;gBACF,MAAM,cAAc,GAAG,YAAY,CAAC,IAAI,CACtC,CAAC,EAAmB,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,YAAY,CAChD,CAAC;gBACF,IAAI,CAAC,cAAc,EAAE,CAAC;oBACpB,OAAO,CAAC,IAAI,CACV,4DAA4D,EAC5D,EAAE,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,CACnD,CAAC;oBACF,OAAO;gBACT,CAAC;gBAED,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC;gBACrC,MAAM,UAAU,GACd,iBAAiB,CAAC,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC,QAAQ,CAAC;gBAC3D,MAAM,iBAAiB,GACrB,cACD,CAAC,SAAS,CAAC;gBACZ,MAAM,eAAe,GAAG,MAAM;oBAC5B,CAAC,CAAC;wBACE,SAAS,EAAE;4BACT,GAAG,iBAAiB;4BACpB,eAAe,EAAE,MAAM;4BACvB,MAAM,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAsB;yBAC1D;qBACF;oBACH,CAAC,CAAC,EAAE,CAAC;gBAEP,MAAM,aAAa,GAAoB;oBACrC,GAAG,cAAc;oBACjB,MAAM,EAAE,iBAAiB,CAAC,iBAAiB;oBAC3C,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACnC,GAAG,eAAe;iBACA,CAAC;gBAErB,uBAAA,IAAI,gDAAqB,MAAzB,IAAI,EACF,aAAa,EACb,yDAAyD,iBAAiB,EAAE,CAC7E,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,KAAK,CAAC,yDAAyD,EAAE;oBACvE,YAAY;oBACZ,gBAAgB,EAAE,cAAc;oBAChC,KAAK;iBACN,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC;QApEA,uBAAA,IAAI,kCAAc,SAAS,MAAA,CAAC;QAC5B,uBAAA,IAAI,4CAAwB,mBAAmB,MAAA,CAAC;IAClD,CAAC;CAmEF","sourcesContent":["import { StatusTypes } from '@metamask/bridge-controller';\nimport type { TransactionController } from '@metamask/transaction-controller';\nimport { TransactionMeta } from '@metamask/transaction-controller';\n\nimport type { BridgeStatusControllerMessenger } from './types';\nimport type { BridgeHistoryItem } from './types';\nimport { IntentStatusTranslation } from './utils/intent-api';\n\nexport class IntentStatusManager {\n readonly #messenger: BridgeStatusControllerMessenger;\n\n readonly #updateTransactionFn: typeof TransactionController.prototype.updateTransaction;\n\n constructor({\n messenger,\n updateTransactionFn,\n }: {\n messenger: BridgeStatusControllerMessenger;\n updateTransactionFn: typeof TransactionController.prototype.updateTransaction;\n }) {\n this.#messenger = messenger;\n this.#updateTransactionFn = updateTransactionFn;\n }\n\n syncTransactionFromIntentStatus = (\n bridgeTxMetaId: string,\n historyItem: BridgeHistoryItem,\n intentTranslation: IntentStatusTranslation,\n intentOrderStatus: string,\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 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\n const { txHash } = intentTranslation;\n const isComplete =\n intentTranslation.status.status === StatusTypes.COMPLETE;\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: intentTranslation.transactionStatus,\n ...(txHash ? { hash: txHash } : {}),\n ...txReceiptUpdate,\n } as TransactionMeta;\n\n this.#updateTransactionFn(\n updatedTxMeta,\n `BridgeStatusController - Intent order status updated: ${intentOrderStatus}`,\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"]}
|