@metamask-previews/bridge-status-controller 76.3.3-preview-e45297452 → 76.3.3-preview-96dfa0724

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 CHANGED
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Changed
11
11
 
12
- - **BREAKING:** Pass `forceIsGasFeeSponsored` instead of `isGasFeeSponsored` when submitting gasless batch transactions ([#10575](https://github.com/MetaMask/core/pull/10575))
12
+ - Bump `@metamask/bridge-controller` from `^81.3.3` to `81.4.0`. ([#10580](https://github.com/MetaMask/core/pull/10580))
13
13
 
14
14
  ## [76.3.3]
15
15
 
@@ -23,6 +23,10 @@ export type BridgeStatusControllerSubmitIntentAction = {
23
23
  type: `BridgeStatusController:submitIntent`;
24
24
  handler: BridgeStatusController['submitIntent'];
25
25
  };
26
+ export type BridgeStatusControllerSubmitBatchSellAction = {
27
+ type: `BridgeStatusController:submitBatchSell`;
28
+ handler: BridgeStatusController['submitBatchSell'];
29
+ };
26
30
  export type BridgeStatusControllerRestartPollingForFailedAttemptsAction = {
27
31
  type: `BridgeStatusController:restartPollingForFailedAttempts`;
28
32
  handler: BridgeStatusController['restartPollingForFailedAttempts'];
@@ -31,12 +35,8 @@ export type BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction = {
31
35
  type: `BridgeStatusController:getBridgeHistoryItemByTxMetaId`;
32
36
  handler: BridgeStatusController['getBridgeHistoryItemByTxMetaId'];
33
37
  };
34
- export type BridgeStatusControllerSubmitBatchSellAction = {
35
- type: `BridgeStatusController:submitBatchSell`;
36
- handler: BridgeStatusController['submitBatchSell'];
37
- };
38
38
  /**
39
39
  * Union of all BridgeStatusController action types.
40
40
  */
41
- export type BridgeStatusControllerMethodActions = BridgeStatusControllerStartPollingForBridgeTxStatusAction | BridgeStatusControllerWipeBridgeStatusAction | BridgeStatusControllerResetStateAction | BridgeStatusControllerSubmitTxAction | BridgeStatusControllerSubmitIntentAction | BridgeStatusControllerRestartPollingForFailedAttemptsAction | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction | BridgeStatusControllerSubmitBatchSellAction;
41
+ export type BridgeStatusControllerMethodActions = BridgeStatusControllerStartPollingForBridgeTxStatusAction | BridgeStatusControllerWipeBridgeStatusAction | BridgeStatusControllerResetStateAction | BridgeStatusControllerSubmitTxAction | BridgeStatusControllerSubmitIntentAction | BridgeStatusControllerSubmitBatchSellAction | BridgeStatusControllerRestartPollingForFailedAttemptsAction | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction;
42
42
  //# sourceMappingURL=bridge-status-controller-method-action-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-status-controller-method-action-types.d.ts","sourceRoot":"","sources":["../src/bridge-status-controller-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,sBAAsB,CAAC,+BAA+B,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,sBAAsB,CAAC,iCAAiC,CAAC,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,uDAAuD,CAAC;IAC9D,OAAO,EAAE,sBAAsB,CAAC,gCAAgC,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;CACpD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC3C,yDAAyD,GACzD,4CAA4C,GAC5C,sCAAsC,GACtC,oCAAoC,GACpC,wCAAwC,GACxC,2DAA2D,GAC3D,0DAA0D,GAC1D,2CAA2C,CAAC"}
1
+ {"version":3,"file":"bridge-status-controller-method-action-types.d.ts","sourceRoot":"","sources":["../src/bridge-status-controller-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,sBAAsB,CAAC,+BAA+B,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,sCAAsC,GAAG;IACnD,IAAI,EAAE,mCAAmC,CAAC;IAC1C,OAAO,EAAE,sBAAsB,CAAC,YAAY,CAAC,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG;IACjD,IAAI,EAAE,iCAAiC,CAAC;IACxC,OAAO,EAAE,sBAAsB,CAAC,UAAU,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,sBAAsB,CAAC,iCAAiC,CAAC,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,uDAAuD,CAAC;IAC9D,OAAO,EAAE,sBAAsB,CAAC,gCAAgC,CAAC,CAAC;CACnE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC3C,yDAAyD,GACzD,4CAA4C,GAC5C,sCAAsC,GACtC,oCAAoC,GACpC,wCAAwC,GACxC,2CAA2C,GAC3C,2DAA2D,GAC3D,0DAA0D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"bridge-status-controller-method-action-types.js","sourceRoot":"","sources":["../src/bridge-status-controller-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { BridgeStatusController } from './bridge-status-controller.js';\n\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction = {\n type: `BridgeStatusController:startPollingForBridgeTxStatus`;\n handler: BridgeStatusController['startPollingForBridgeTxStatus'];\n};\n\nexport type BridgeStatusControllerWipeBridgeStatusAction = {\n type: `BridgeStatusController:wipeBridgeStatus`;\n handler: BridgeStatusController['wipeBridgeStatus'];\n};\n\nexport type BridgeStatusControllerResetStateAction = {\n type: `BridgeStatusController:resetState`;\n handler: BridgeStatusController['resetState'];\n};\n\nexport type BridgeStatusControllerSubmitTxAction = {\n type: `BridgeStatusController:submitTx`;\n handler: BridgeStatusController['submitTx'];\n};\n\nexport type BridgeStatusControllerSubmitIntentAction = {\n type: `BridgeStatusController:submitIntent`;\n handler: BridgeStatusController['submitIntent'];\n};\n\nexport type BridgeStatusControllerRestartPollingForFailedAttemptsAction = {\n type: `BridgeStatusController:restartPollingForFailedAttempts`;\n handler: BridgeStatusController['restartPollingForFailedAttempts'];\n};\n\nexport type BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction = {\n type: `BridgeStatusController:getBridgeHistoryItemByTxMetaId`;\n handler: BridgeStatusController['getBridgeHistoryItemByTxMetaId'];\n};\n\nexport type BridgeStatusControllerSubmitBatchSellAction = {\n type: `BridgeStatusController:submitBatchSell`;\n handler: BridgeStatusController['submitBatchSell'];\n};\n\n/**\n * Union of all BridgeStatusController action types.\n */\nexport type BridgeStatusControllerMethodActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerSubmitTxAction\n | BridgeStatusControllerSubmitIntentAction\n | BridgeStatusControllerRestartPollingForFailedAttemptsAction\n | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction\n | BridgeStatusControllerSubmitBatchSellAction;\n"]}
1
+ {"version":3,"file":"bridge-status-controller-method-action-types.js","sourceRoot":"","sources":["../src/bridge-status-controller-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { BridgeStatusController } from './bridge-status-controller.js';\n\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction = {\n type: `BridgeStatusController:startPollingForBridgeTxStatus`;\n handler: BridgeStatusController['startPollingForBridgeTxStatus'];\n};\n\nexport type BridgeStatusControllerWipeBridgeStatusAction = {\n type: `BridgeStatusController:wipeBridgeStatus`;\n handler: BridgeStatusController['wipeBridgeStatus'];\n};\n\nexport type BridgeStatusControllerResetStateAction = {\n type: `BridgeStatusController:resetState`;\n handler: BridgeStatusController['resetState'];\n};\n\nexport type BridgeStatusControllerSubmitTxAction = {\n type: `BridgeStatusController:submitTx`;\n handler: BridgeStatusController['submitTx'];\n};\n\nexport type BridgeStatusControllerSubmitIntentAction = {\n type: `BridgeStatusController:submitIntent`;\n handler: BridgeStatusController['submitIntent'];\n};\n\nexport type BridgeStatusControllerSubmitBatchSellAction = {\n type: `BridgeStatusController:submitBatchSell`;\n handler: BridgeStatusController['submitBatchSell'];\n};\n\nexport type BridgeStatusControllerRestartPollingForFailedAttemptsAction = {\n type: `BridgeStatusController:restartPollingForFailedAttempts`;\n handler: BridgeStatusController['restartPollingForFailedAttempts'];\n};\n\nexport type BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction = {\n type: `BridgeStatusController:getBridgeHistoryItemByTxMetaId`;\n handler: BridgeStatusController['getBridgeHistoryItemByTxMetaId'];\n};\n\n/**\n * Union of all BridgeStatusController action types.\n */\nexport type BridgeStatusControllerMethodActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerSubmitTxAction\n | BridgeStatusControllerSubmitIntentAction\n | BridgeStatusControllerSubmitBatchSellAction\n | BridgeStatusControllerRestartPollingForFailedAttemptsAction\n | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction;\n"]}
@@ -24,7 +24,7 @@ export async function* submitBatchSellHandler(args) {
24
24
  // Tx success/failure is independent of other txs in the batch
25
25
  atomic: false,
26
26
  disable7702: shouldDisable7702(gasIncluded7702, gasIncluded, isDelegatedAccount),
27
- forceIsGasFeeSponsored: gasSponsored,
27
+ isGasFeeSponsored: gasSponsored,
28
28
  isGasFeeIncluded: Boolean(gasIncluded7702),
29
29
  batchId: batchIdParam,
30
30
  skipInitialGasEstimate: gasIncluded7702
@@ -1 +1 @@
1
- {"version":3,"file":"batch-sell-strategy.js","sourceRoot":"","sources":["../../src/strategy/batch-sell-strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,qBAAqB,GAAG,CAAC,EAC7B,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,GACd,EAAU,EAAE,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,sBAAsB,CAC3C,IAA2D;IAE3D,MAAM,EACJ,eAAe,EACf,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,OAAO,EAAE,YAAY,GACtB,GAAG,IAAI,CAAC;IAET,MAAM,SAAS,GAAG,yBAAyB,CAAC;QAC1C,cAAc;QACd,eAAe;KAChB,CAAC,CAAC;IAEH,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,eAAe,CAAC;IAEvE,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAChC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,eAAe,CAAC,mBAAmB,CAC3D,EAAE,EAAE,CAAC,EAAE,CAAC;IAET,MAAM,iBAAiB,GAAG,MAAM,4BAA4B,CAAC;QAC3D,SAAS;QACT,SAAS;QACT,eAAe;QACf,kBAAkB;QAClB,8DAA8D;QAC9D,MAAM,EAAE,KAAK;QACb,WAAW,EAAE,iBAAiB,CAC5B,eAAe,EACf,WAAW,EACX,kBAAkB,CACnB;QACD,sBAAsB,EAAE,YAAY;Q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atchSellTradesResponse, TxData } from '@metamask/bridge-controller';\nimport {\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\n\nimport { QuoteAndTxMetadata } from '../types.js';\nimport {\n findAllTransactionsInBatch,\n getAddTransactionBatchParams,\n hasNestedSwapTransactions,\n is7702Tx,\n isTradeTx,\n shouldDisable7702,\n toQuoteAndTxMetadataBatch,\n} from '../utils/transaction.js';\nimport { SubmitStep } from './types.js';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types.js';\n\nconst getHistoryKeyForQuote = ({\n quoteResponse: { quoteId, quote },\n}: QuoteAndTxMetadata): string => quoteId ?? quote.requestId;\n\n/**\n * Submits batch-sell transactions to the TransactionController\n *\n * @param args - The parameters for the transaction\n * @yields The approvalMeta and tradeMeta for the first batch sell transaction\n */\nexport async function* submitBatchSellHandler(\n args: SubmitStrategyParams<TxData, BatchSellTradesResponse>,\n): AsyncGenerator<SubmitStepResult, void, void> {\n const {\n requireApproval,\n quoteResponses,\n messenger,\n addTransactionBatchFn,\n isDelegatedAccount,\n batchSellTrades,\n batchId: batchIdParam,\n } = args;\n\n const tradeData = toQuoteAndTxMetadataBatch({\n quoteResponses,\n batchSellTrades,\n });\n\n const { gasIncluded7702, gasIncluded, gasSponsored } = batchSellTrades;\n\n const gasFeeToken = tradeData.find(\n ({ type }) => type === TransactionType.tokenMethodTransfer,\n )?.tx.to;\n\n const transactionParams = await getAddTransactionBatchParams({\n messenger,\n tradeData,\n requireApproval,\n isDelegatedAccount,\n // Tx success/failure is independent of other txs in the batch\n atomic: false,\n disable7702: shouldDisable7702(\n gasIncluded7702,\n gasIncluded,\n isDelegatedAccount,\n ),\n forceIsGasFeeSponsored: gasSponsored,\n isGasFeeIncluded: Boolean(gasIncluded7702),\n batchId: batchIdParam,\n skipInitialGasEstimate: gasIncluded7702\n ? isDelegatedAccount\n : Boolean(gasFeeToken),\n excludeNativeTokenForFee: !gasFeeToken,\n });\n\n // Submit the batch to the TransactionController\n const { batchId } = await addTransactionBatchFn(transactionParams);\n\n // Find all batch transaction metas and add them to history\n const allTradesInBatch = findAllTransactionsInBatch({\n messenger,\n batchId,\n tradeData,\n }).filter(\n (metadata): metadata is QuoteAndTxMetadata & { txMeta: TransactionMeta } =>\n isTradeTx(metadata.type) && metadata.txMeta !== undefined,\n );\n\n // This is either the delegation tx or the first STX swap in the batch\n const firstTradeWithMetadata = allTradesInBatch.find(\n ({ txMeta }) =>\n txMeta?.type &&\n (isTradeTx(txMeta.type) || hasNestedSwapTransactions(txMeta)),\n );\n const firstTradeMeta = firstTradeWithMetadata?.txMeta;\n if (!firstTradeMeta) {\n throw new Error(\n 'Failed to add BatchSell trade to history: txMeta not found',\n );\n }\n\n yield {\n type: SubmitStep.SetTradeMeta,\n payload: {\n tradeMeta: firstTradeMeta,\n },\n };\n\n // Each quote must be reported to the reconsiler service (through QuoteStatusManager) with the hash of the tx that\n // actually executed it. So the number of distinct txs the batch produced\n // decides how quotes are tracked:\n // - one tx (atomic 7702 batch): all quotes share the single hash.\n // - many txs (e.g. STX/sendBundle): each quote has its own hash.\n // `is7702Tx` only means the account is delegated (true even for many-tx\n // batches), so count the unique txs instead.\n const isSingleBatchTx =\n new Set(allTradesInBatch.map(({ txMeta }) => txMeta.id)).size === 1;\n\n // Nested/7702 batch\n if (\n isSingleBatchTx &&\n (is7702Tx(firstTradeMeta) || hasNestedSwapTransactions(firstTradeMeta))\n ) {\n const quoteIds = Array.from(\n new Set(allTradesInBatch.map(getHistoryKeyForQuote)),\n );\n\n // Create 1 history item for the parent tx, keyed by the txMeta.id\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: firstTradeMeta.id,\n quoteResponse: firstTradeWithMetadata.quoteResponse,\n batchSellData: batchSellTrades,\n quoteIds,\n bridgeTxMeta: firstTradeMeta,\n },\n };\n // Then create a new history item for each nested trade, keyed by quoteId/requestId\n for (const tradeWithMetadata of allTradesInBatch) {\n const { quoteResponse } = tradeWithMetadata;\n\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: getHistoryKeyForQuote(tradeWithMetadata),\n quoteResponse,\n batchSellData: batchSellTrades,\n },\n };\n }\n } else {\n // Each trade has its own txMeta if not submitted via 7702\n // Create a new history item for each one, keyed by txMeta.id\n // Note that the approvalTxId is not tracked in history\n for (const { txMeta, quoteResponse } of allTradesInBatch) {\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: txMeta.id,\n quoteResponse,\n batchSellData: batchSellTrades,\n bridgeTxMeta: txMeta,\n },\n };\n }\n }\n}\n"]}
1
+ {"version":3,"file":"batch-sell-strategy.js","sourceRoot":"","sources":["../../src/strategy/batch-sell-strategy.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,eAAe,GAChB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,MAAM,qBAAqB,GAAG,CAAC,EAC7B,aAAa,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,GACd,EAAU,EAAE,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,sBAAsB,CAC3C,IAA2D;IAE3D,MAAM,EACJ,eAAe,EACf,cAAc,EACd,SAAS,EACT,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,OAAO,EAAE,YAAY,GACtB,GAAG,IAAI,CAAC;IAET,MAAM,SAAS,GAAG,yBAAyB,CAAC;QAC1C,cAAc;QACd,eAAe;KAChB,CAAC,CAAC;IAEH,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,eAAe,CAAC;IAEvE,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAChC,CAAC,E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,6DAA6D;QAC7D,uDAAuD;QACvD,KAAK,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,gBAAgB,EAAE,CAAC;YACzD,MAAM;gBACJ,IAAI,EAAE,UAAU,CAAC,cAAc;gBAC/B,OAAO,EAAE;oBACP,UAAU,EAAE,MAAM,CAAC,EAAE;oBACrB,aAAa;oBACb,aAAa,EAAE,eAAe;oBAC9B,YAAY,EAAE,MAAM;iBACrB;aACF,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { BatchSellTradesResponse, TxData } from '@metamask/bridge-controller';\nimport {\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\n\nimport { QuoteAndTxMetadata } from '../types.js';\nimport {\n findAllTransactionsInBatch,\n getAddTransactionBatchParams,\n hasNestedSwapTransactions,\n is7702Tx,\n isTradeTx,\n shouldDisable7702,\n toQuoteAndTxMetadataBatch,\n} from '../utils/transaction.js';\nimport { SubmitStep } from './types.js';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types.js';\n\nconst getHistoryKeyForQuote = ({\n quoteResponse: { quoteId, quote },\n}: QuoteAndTxMetadata): string => quoteId ?? quote.requestId;\n\n/**\n * Submits batch-sell transactions to the TransactionController\n *\n * @param args - The parameters for the transaction\n * @yields The approvalMeta and tradeMeta for the first batch sell transaction\n */\nexport async function* submitBatchSellHandler(\n args: SubmitStrategyParams<TxData, BatchSellTradesResponse>,\n): AsyncGenerator<SubmitStepResult, void, void> {\n const {\n requireApproval,\n quoteResponses,\n messenger,\n addTransactionBatchFn,\n isDelegatedAccount,\n batchSellTrades,\n batchId: batchIdParam,\n } = args;\n\n const tradeData = toQuoteAndTxMetadataBatch({\n quoteResponses,\n batchSellTrades,\n });\n\n const { gasIncluded7702, gasIncluded, gasSponsored } = batchSellTrades;\n\n const gasFeeToken = tradeData.find(\n ({ type }) => type === TransactionType.tokenMethodTransfer,\n )?.tx.to;\n\n const transactionParams = await getAddTransactionBatchParams({\n messenger,\n tradeData,\n requireApproval,\n isDelegatedAccount,\n // Tx success/failure is independent of other txs in the batch\n atomic: false,\n disable7702: shouldDisable7702(\n gasIncluded7702,\n gasIncluded,\n isDelegatedAccount,\n ),\n isGasFeeSponsored: gasSponsored,\n isGasFeeIncluded: Boolean(gasIncluded7702),\n batchId: batchIdParam,\n skipInitialGasEstimate: gasIncluded7702\n ? isDelegatedAccount\n : Boolean(gasFeeToken),\n excludeNativeTokenForFee: !gasFeeToken,\n });\n\n // Submit the batch to the TransactionController\n const { batchId } = await addTransactionBatchFn(transactionParams);\n\n // Find all batch transaction metas and add them to history\n const allTradesInBatch = findAllTransactionsInBatch({\n messenger,\n batchId,\n tradeData,\n }).filter(\n (metadata): metadata is QuoteAndTxMetadata & { txMeta: TransactionMeta } =>\n isTradeTx(metadata.type) && metadata.txMeta !== undefined,\n );\n\n // This is either the delegation tx or the first STX swap in the batch\n const firstTradeWithMetadata = allTradesInBatch.find(\n ({ txMeta }) =>\n txMeta?.type &&\n (isTradeTx(txMeta.type) || hasNestedSwapTransactions(txMeta)),\n );\n const firstTradeMeta = firstTradeWithMetadata?.txMeta;\n if (!firstTradeMeta) {\n throw new Error(\n 'Failed to add BatchSell trade to history: txMeta not found',\n );\n }\n\n yield {\n type: SubmitStep.SetTradeMeta,\n payload: {\n tradeMeta: firstTradeMeta,\n },\n };\n\n // Each quote must be reported to the reconsiler service (through QuoteStatusManager) with the hash of the tx that\n // actually executed it. So the number of distinct txs the batch produced\n // decides how quotes are tracked:\n // - one tx (atomic 7702 batch): all quotes share the single hash.\n // - many txs (e.g. STX/sendBundle): each quote has its own hash.\n // `is7702Tx` only means the account is delegated (true even for many-tx\n // batches), so count the unique txs instead.\n const isSingleBatchTx =\n new Set(allTradesInBatch.map(({ txMeta }) => txMeta.id)).size === 1;\n\n // Nested/7702 batch\n if (\n isSingleBatchTx &&\n (is7702Tx(firstTradeMeta) || hasNestedSwapTransactions(firstTradeMeta))\n ) {\n const quoteIds = Array.from(\n new Set(allTradesInBatch.map(getHistoryKeyForQuote)),\n );\n\n // Create 1 history item for the parent tx, keyed by the txMeta.id\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: firstTradeMeta.id,\n quoteResponse: firstTradeWithMetadata.quoteResponse,\n batchSellData: batchSellTrades,\n quoteIds,\n bridgeTxMeta: firstTradeMeta,\n },\n };\n // Then create a new history item for each nested trade, keyed by quoteId/requestId\n for (const tradeWithMetadata of allTradesInBatch) {\n const { quoteResponse } = tradeWithMetadata;\n\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: getHistoryKeyForQuote(tradeWithMetadata),\n quoteResponse,\n batchSellData: batchSellTrades,\n },\n };\n }\n } else {\n // Each trade has its own txMeta if not submitted via 7702\n // Create a new history item for each one, keyed by txMeta.id\n // Note that the approvalTxId is not tracked in history\n for (const { txMeta, quoteResponse } of allTradesInBatch) {\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: txMeta.id,\n quoteResponse,\n batchSellData: batchSellTrades,\n bridgeTxMeta: txMeta,\n },\n };\n }\n }\n}\n"]}
@@ -19,7 +19,7 @@ export async function* submitBatchHandler(args) {
19
19
  messenger,
20
20
  atomic: true,
21
21
  disable7702: shouldDisable7702(quoteResponse.quote.gasIncluded7702, quoteResponse.quote.gasIncluded, isDelegatedAccount),
22
- forceIsGasFeeSponsored: Boolean(quoteResponse.quote.gasSponsored),
22
+ isGasFeeSponsored: Boolean(quoteResponse.quote.gasSponsored),
23
23
  isGasFeeIncluded: Boolean(quoteResponse.quote.gasIncluded7702),
24
24
  });
25
25
  const { batchId } = await addTransactionBatchFn(transactionParams);
@@ -1 +1 @@
1
- {"version":3,"file":"batch-strategy.js","sourceRoot":"","sources":["../../src/strategy/batch-strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OA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EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,MAAM,CACnD,EAAE,MAAM,CAAC;IAEV,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,IAAI,EAAE,UAAU,CAAC,YAAY;QAC7B,OAAO,EAAE,EAAE,SAAS,EAAE;KACvB,CAAC;IAEF,MAAM;QACJ,IAAI,EAAE,UAAU,CAAC,cAAc;QAC/B,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,EAAE;YACxB,YAAY,EAAE,YAAY,EAAE,EAAE;YAC9B,YAAY,EAAE;gBACZ,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B;YACD,aAAa;SACd;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { TxData } from '@metamask/bridge-controller';\n\nimport {\n findAllTransactionsInBatch,\n getAddTransactionBatchParams,\n isApprovalTx,\n isTradeTx,\n shouldDisable7702,\n toQuoteAndTxMetadata,\n} from '../utils/transaction.js';\nimport { SubmitStep } from './types.js';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types.js';\n\n/**\n * Submits batched EVM transactions to the TransactionController\n *\n * @param args - The parameters for the transaction\n * @yields The approvalMeta and tradeMeta for the batched transaction\n */\nexport async function* submitBatchHandler(\n args: SubmitStrategyParams<TxData>,\n): AsyncGenerator<SubmitStepResult, void, void> {\n const {\n requireApproval,\n quoteResponses: [quoteResponse],\n messenger,\n isBridgeTx,\n addTransactionBatchFn,\n isDelegatedAccount,\n } = args;\n\n const tradeData = toQuoteAndTxMetadata({\n quoteResponse,\n isBridgeTx,\n });\n\n const transactionParams = await getAddTransactionBatchParams({\n tradeData,\n requireApproval,\n isDelegatedAccount,\n messenger,\n atomic: true,\n disable7702: shouldDisable7702(\n quoteResponse.quote.gasIncluded7702,\n quoteResponse.quote.gasIncluded,\n isDelegatedAccount,\n ),\n forceIsGasFeeSponsored: Boolean(quoteResponse.quote.gasSponsored),\n isGasFeeIncluded: Boolean(quoteResponse.quote.gasIncluded7702),\n });\n\n const { batchId } = await addTransactionBatchFn(transactionParams);\n\n const quoteAndTxMetas = findAllTransactionsInBatch({\n messenger,\n batchId,\n tradeData,\n });\n\n yield {\n type: SubmitStep.UpdateBatchTransactions,\n payload: {\n quoteAndTxMetas,\n },\n };\n\n const tradeMeta = quoteAndTxMetas.find(\n ({ type, txMeta }) => isTradeTx(type) && txMeta,\n )?.txMeta;\n\n const approvalMeta = quoteAndTxMetas.find(\n ({ type, txMeta }) => isApprovalTx(type) && txMeta,\n )?.txMeta;\n\n if (!tradeMeta) {\n throw new Error(\n 'Failed to update cross-chain swap transaction batch: tradeMeta not found',\n );\n }\n\n yield {\n type: SubmitStep.SetTradeMeta,\n payload: { tradeMeta },\n };\n\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: tradeMeta.id,\n approvalTxId: approvalMeta?.id,\n bridgeTxMeta: {\n id: tradeMeta.id,\n hash: tradeMeta.hash,\n batchId: tradeMeta.batchId,\n },\n quoteResponse,\n },\n };\n}\n"]}
1
+ {"version":3,"file":"batch-strategy.js","sourceRoot":"","sources":["../../src/strategy/batch-strategy.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,kBAAkB,CACvC,IAAkC;IAElC,MAAM,EACJ,eAAe,EACf,cAAc,EAAE,CAAC,aAAa,CAAC,EAC/B,SAAS,EACT,UAAU,EACV,qBAAqB,EACrB,kBAAkB,GACnB,GAAG,IAAI,CA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AE,SAAS,EAAE;KACvB,CAAC;IAEF,MAAM;QACJ,IAAI,EAAE,UAAU,CAAC,cAAc;QAC/B,OAAO,EAAE;YACP,UAAU,EAAE,SAAS,CAAC,EAAE;YACxB,YAAY,EAAE,YAAY,EAAE,EAAE;YAC9B,YAAY,EAAE;gBACZ,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,IAAI,EAAE,SAAS,CAAC,IAAI;gBACpB,OAAO,EAAE,SAAS,CAAC,OAAO;aAC3B;YACD,aAAa;SACd;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { TxData } from '@metamask/bridge-controller';\n\nimport {\n findAllTransactionsInBatch,\n getAddTransactionBatchParams,\n isApprovalTx,\n isTradeTx,\n shouldDisable7702,\n toQuoteAndTxMetadata,\n} from '../utils/transaction.js';\nimport { SubmitStep } from './types.js';\nimport type { SubmitStrategyParams, SubmitStepResult } from './types.js';\n\n/**\n * Submits batched EVM transactions to the TransactionController\n *\n * @param args - The parameters for the transaction\n * @yields The approvalMeta and tradeMeta for the batched transaction\n */\nexport async function* submitBatchHandler(\n args: SubmitStrategyParams<TxData>,\n): AsyncGenerator<SubmitStepResult, void, void> {\n const {\n requireApproval,\n quoteResponses: [quoteResponse],\n messenger,\n isBridgeTx,\n addTransactionBatchFn,\n isDelegatedAccount,\n } = args;\n\n const tradeData = toQuoteAndTxMetadata({\n quoteResponse,\n isBridgeTx,\n });\n\n const transactionParams = await getAddTransactionBatchParams({\n tradeData,\n requireApproval,\n isDelegatedAccount,\n messenger,\n atomic: true,\n disable7702: shouldDisable7702(\n quoteResponse.quote.gasIncluded7702,\n quoteResponse.quote.gasIncluded,\n isDelegatedAccount,\n ),\n isGasFeeSponsored: Boolean(quoteResponse.quote.gasSponsored),\n isGasFeeIncluded: Boolean(quoteResponse.quote.gasIncluded7702),\n });\n\n const { batchId } = await addTransactionBatchFn(transactionParams);\n\n const quoteAndTxMetas = findAllTransactionsInBatch({\n messenger,\n batchId,\n tradeData,\n });\n\n yield {\n type: SubmitStep.UpdateBatchTransactions,\n payload: {\n quoteAndTxMetas,\n },\n };\n\n const tradeMeta = quoteAndTxMetas.find(\n ({ type, txMeta }) => isTradeTx(type) && txMeta,\n )?.txMeta;\n\n const approvalMeta = quoteAndTxMetas.find(\n ({ type, txMeta }) => isApprovalTx(type) && txMeta,\n )?.txMeta;\n\n if (!tradeMeta) {\n throw new Error(\n 'Failed to update cross-chain swap transaction batch: tradeMeta not found',\n );\n }\n\n yield {\n type: SubmitStep.SetTradeMeta,\n payload: { tradeMeta },\n };\n\n yield {\n type: SubmitStep.AddHistoryItem,\n payload: {\n historyKey: tradeMeta.id,\n approvalTxId: approvalMeta?.id,\n bridgeTxMeta: {\n id: tradeMeta.id,\n hash: tradeMeta.hash,\n batchId: tradeMeta.batchId,\n },\n quoteResponse,\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/bridge-status-controller",
3
- "version": "76.3.3-preview-e45297452",
3
+ "version": "76.3.3-preview-96dfa0724",
4
4
  "description": "Manages bridge-related status fetching functionality for MetaMask",
5
5
  "keywords": [
6
6
  "Ethereum",
@@ -39,9 +39,10 @@
39
39
  "build:only-clean": "rimraf './dist' './tsconfig.build.tsbuildinfo'",
40
40
  "changelog:update": "../../scripts/update-changelog.sh @metamask/bridge-status-controller",
41
41
  "changelog:validate": "../../scripts/validate-changelog.sh @metamask/bridge-status-controller",
42
- "generate-method-action-types": "tsx ../../packages/messenger/src/generate-action-types/cli.ts",
43
- "lint:tsconfigs": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.ts",
44
- "lint:tsconfigs:fix": "tsx ../../scripts/lint-tsconfigs/lint-tsconfigs.ts --fix",
42
+ "lint:tsconfigs": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../scripts/lint-tsconfigs/lint-tsconfigs.ts",
43
+ "lint:tsconfigs:fix": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../scripts/lint-tsconfigs/lint-tsconfigs.ts --fix",
44
+ "messenger-action-types:check": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --check",
45
+ "messenger-action-types:generate": "node --import ../../scripts/resolver/register.ts --experimental-transform-types ../../packages/messenger-cli/src/cli.ts --formatter oxfmt --esm --generate",
45
46
  "since-latest-release": "../../scripts/since-latest-release.sh",
46
47
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --reporters=jest-silent-reporter",
47
48
  "test:clean": "NODE_OPTIONS=--experimental-vm-modules jest --clearCache",
@@ -51,7 +52,7 @@
51
52
  "dependencies": {
52
53
  "@metamask/accounts-controller": "^40.0.0",
53
54
  "@metamask/base-controller": "^10.0.0",
54
- "@metamask/bridge-controller": "^81.3.3",
55
+ "@metamask/bridge-controller": "^81.4.0",
55
56
  "@metamask/controller-utils": "^13.0.0",
56
57
  "@metamask/gas-fee-controller": "^27.0.0",
57
58
  "@metamask/keyring-controller": "^28.1.0",
@@ -77,7 +78,6 @@
77
78
  "nock": "^13.5.6",
78
79
  "rimraf": "^6.1.3",
79
80
  "ts-jest": "^29.4.14",
80
- "tsx": "^4.23.15",
81
81
  "typedoc": "^0.25.13",
82
82
  "typedoc-plugin-missing-exports": "^2.0.0",
83
83
  "typescript": "npm:@typescript/typescript6@^6.0.2"