@metamask/bridge-status-controller 69.0.0 → 70.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/bridge-status-controller.cjs +77 -192
  3. package/dist/bridge-status-controller.cjs.map +1 -1
  4. package/dist/bridge-status-controller.d.cts +1 -4
  5. package/dist/bridge-status-controller.d.cts.map +1 -1
  6. package/dist/bridge-status-controller.d.mts +1 -4
  7. package/dist/bridge-status-controller.d.mts.map +1 -1
  8. package/dist/bridge-status-controller.intent.cjs +6 -7
  9. package/dist/bridge-status-controller.intent.cjs.map +1 -1
  10. package/dist/bridge-status-controller.intent.d.cts +2 -5
  11. package/dist/bridge-status-controller.intent.d.cts.map +1 -1
  12. package/dist/bridge-status-controller.intent.d.mts +2 -5
  13. package/dist/bridge-status-controller.intent.d.mts.map +1 -1
  14. package/dist/bridge-status-controller.intent.mjs +6 -7
  15. package/dist/bridge-status-controller.intent.mjs.map +1 -1
  16. package/dist/bridge-status-controller.mjs +79 -194
  17. package/dist/bridge-status-controller.mjs.map +1 -1
  18. package/dist/index.cjs +1 -3
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +0 -1
  21. package/dist/index.d.cts.map +1 -1
  22. package/dist/index.d.mts +0 -1
  23. package/dist/index.d.mts.map +1 -1
  24. package/dist/index.mjs +0 -1
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/types.cjs.map +1 -1
  27. package/dist/types.d.cts +2 -2
  28. package/dist/types.d.cts.map +1 -1
  29. package/dist/types.d.mts +2 -2
  30. package/dist/types.d.mts.map +1 -1
  31. package/dist/types.mjs.map +1 -1
  32. package/dist/utils/accounts.cjs +8 -0
  33. package/dist/utils/accounts.cjs.map +1 -0
  34. package/dist/utils/accounts.d.cts +36 -0
  35. package/dist/utils/accounts.d.cts.map +1 -0
  36. package/dist/utils/accounts.d.mts +36 -0
  37. package/dist/utils/accounts.d.mts.map +1 -0
  38. package/dist/utils/accounts.mjs +4 -0
  39. package/dist/utils/accounts.mjs.map +1 -0
  40. package/dist/utils/authentication.cjs +15 -0
  41. package/dist/utils/authentication.cjs.map +1 -0
  42. package/dist/utils/authentication.d.cts +3 -0
  43. package/dist/utils/authentication.d.cts.map +1 -0
  44. package/dist/utils/authentication.d.mts +3 -0
  45. package/dist/utils/authentication.d.mts.map +1 -0
  46. package/dist/utils/authentication.mjs +11 -0
  47. package/dist/utils/authentication.mjs.map +1 -0
  48. package/dist/utils/bridge.cjs +16 -0
  49. package/dist/utils/bridge.cjs.map +1 -0
  50. package/dist/utils/bridge.d.cts +10 -0
  51. package/dist/utils/bridge.d.cts.map +1 -0
  52. package/dist/utils/bridge.d.mts +10 -0
  53. package/dist/utils/bridge.d.mts.map +1 -0
  54. package/dist/utils/bridge.mjs +11 -0
  55. package/dist/utils/bridge.mjs.map +1 -0
  56. package/dist/utils/gas.cjs +3 -6
  57. package/dist/utils/gas.cjs.map +1 -1
  58. package/dist/utils/gas.d.cts +1 -1
  59. package/dist/utils/gas.d.cts.map +1 -1
  60. package/dist/utils/gas.d.mts +1 -1
  61. package/dist/utils/gas.d.mts.map +1 -1
  62. package/dist/utils/gas.mjs +3 -6
  63. package/dist/utils/gas.mjs.map +1 -1
  64. package/dist/utils/history.cjs +97 -0
  65. package/dist/utils/history.cjs.map +1 -0
  66. package/dist/utils/history.d.cts +21 -0
  67. package/dist/utils/history.d.cts.map +1 -0
  68. package/dist/utils/history.d.mts +21 -0
  69. package/dist/utils/history.d.mts.map +1 -0
  70. package/dist/utils/history.mjs +90 -0
  71. package/dist/utils/history.mjs.map +1 -0
  72. package/dist/utils/intent-api.cjs +16 -1
  73. package/dist/utils/intent-api.cjs.map +1 -1
  74. package/dist/utils/intent-api.d.cts +9 -1
  75. package/dist/utils/intent-api.d.cts.map +1 -1
  76. package/dist/utils/intent-api.d.mts +9 -1
  77. package/dist/utils/intent-api.d.mts.map +1 -1
  78. package/dist/utils/intent-api.mjs +14 -0
  79. package/dist/utils/intent-api.mjs.map +1 -1
  80. package/dist/utils/keyring.cjs +12 -0
  81. package/dist/utils/keyring.cjs.map +1 -0
  82. package/dist/utils/keyring.d.cts +8 -0
  83. package/dist/utils/keyring.d.cts.map +1 -0
  84. package/dist/utils/keyring.d.mts +8 -0
  85. package/dist/utils/keyring.d.mts.map +1 -0
  86. package/dist/utils/keyring.mjs +8 -0
  87. package/dist/utils/keyring.mjs.map +1 -0
  88. package/dist/utils/network.cjs +17 -0
  89. package/dist/utils/network.cjs.map +1 -0
  90. package/dist/utils/network.d.cts +5 -0
  91. package/dist/utils/network.d.cts.map +1 -0
  92. package/dist/utils/network.d.mts +5 -0
  93. package/dist/utils/network.d.mts.map +1 -0
  94. package/dist/utils/network.mjs +12 -0
  95. package/dist/utils/network.mjs.map +1 -0
  96. package/dist/utils/snaps.cjs +146 -1
  97. package/dist/utils/snaps.cjs.map +1 -1
  98. package/dist/utils/snaps.d.cts +62 -0
  99. package/dist/utils/snaps.d.cts.map +1 -1
  100. package/dist/utils/snaps.d.mts +62 -0
  101. package/dist/utils/snaps.d.mts.map +1 -1
  102. package/dist/utils/snaps.mjs +141 -0
  103. package/dist/utils/snaps.mjs.map +1 -1
  104. package/dist/utils/trace.cjs +31 -0
  105. package/dist/utils/trace.cjs.map +1 -0
  106. package/dist/utils/trace.d.cts +17 -0
  107. package/dist/utils/trace.d.cts.map +1 -0
  108. package/dist/utils/trace.d.mts +17 -0
  109. package/dist/utils/trace.d.mts.map +1 -0
  110. package/dist/utils/trace.mjs +26 -0
  111. package/dist/utils/trace.mjs.map +1 -0
  112. package/dist/utils/transaction.cjs +12 -183
  113. package/dist/utils/transaction.cjs.map +1 -1
  114. package/dist/utils/transaction.d.cts +5 -78
  115. package/dist/utils/transaction.d.cts.map +1 -1
  116. package/dist/utils/transaction.d.mts +5 -78
  117. package/dist/utils/transaction.d.mts.map +1 -1
  118. package/dist/utils/transaction.mjs +12 -177
  119. package/dist/utils/transaction.mjs.map +1 -1
  120. package/dist/utils/validators.d.cts +2 -2
  121. package/dist/utils/validators.d.mts +2 -2
  122. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAqCA,+CAA4D;AAG5D,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAyCD,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,wBAAR,QAAQ,QAanB;AA8DD,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport type { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n quote: Quote;\n status: StatusResponse;\n startTime?: number; // timestamp in ms\n estimatedProcessingTimeInSeconds: number;\n slippagePercentage: number;\n completionTime?: number; // timestamp in ms\n pricingData?: {\n /**\n * The actual amount sent by user in non-atomic decimal form\n */\n amountSent: QuoteMetadata['sentAmount']['amount'];\n amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];\n quotedGasInUsd?: QuoteMetadata['gasFee']['effective']['usd'];\n quotedGasAmount?: QuoteMetadata['gasFee']['effective']['amount'];\n quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n};\n\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: TransactionMeta;\n statusRequest: StatusRequest;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime?: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location?: BridgeHistoryItem['location'];\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n};\n\n/**\n * Chrome: The BigNumber values are automatically serialized to strings when sent to the background\n * Firefox: The BigNumber values are not serialized to strings when sent to the background,\n * so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action\n */\nexport type StartPollingForBridgeTxStatusArgsSerialized = Omit<\n StartPollingForBridgeTxStatusArgs,\n 'quoteResponse'\n> & {\n quoteResponse: QuoteResponse & Partial<QuoteMetadata>;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<'startPollingForBridgeTxStatus'>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<'wipeBridgeStatus'>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<'resetState'>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<'submitTx'>;\n\nexport type BridgeStatusControllerSubmitIntentAction =\n BridgeStatusControllerAction<'submitIntent'>;\n\nexport type BridgeStatusControllerRestartPollingForFailedAttemptsAction =\n BridgeStatusControllerAction<'restartPollingForFailedAttempts'>;\n\nexport type BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction =\n BridgeStatusControllerAction<'getBridgeHistoryItemByTxMetaId'>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction\n | BridgeStatusControllerSubmitIntentAction\n | BridgeStatusControllerRestartPollingForFailedAttemptsAction\n | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAwCA,+CAA4D;AAG5D,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAyCD,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,wBAAR,QAAQ,QAanB;AA8DD,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport type { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n quote: Quote;\n status: StatusResponse;\n startTime?: number; // timestamp in ms\n estimatedProcessingTimeInSeconds: number;\n slippagePercentage: number;\n completionTime?: number; // timestamp in ms\n pricingData?: {\n /**\n * The actual amount sent by user in non-atomic decimal form\n */\n amountSent: QuoteMetadata['sentAmount']['amount'];\n amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];\n quotedGasInUsd?: QuoteMetadata['gasFee']['effective']['usd'];\n quotedGasAmount?: QuoteMetadata['gasFee']['effective']['amount'];\n quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n};\n\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: TransactionMeta;\n statusRequest: StatusRequest;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime?: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location?: BridgeHistoryItem['location'];\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n};\n\n/**\n * Chrome: The BigNumber values are automatically serialized to strings when sent to the background\n * Firefox: The BigNumber values are not serialized to strings when sent to the background,\n * so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action\n */\nexport type StartPollingForBridgeTxStatusArgsSerialized = Omit<\n StartPollingForBridgeTxStatusArgs,\n 'quoteResponse'\n> & {\n quoteResponse: QuoteResponse & Partial<QuoteMetadata>;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<'startPollingForBridgeTxStatus'>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<'wipeBridgeStatus'>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<'resetState'>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<'submitTx'>;\n\nexport type BridgeStatusControllerSubmitIntentAction =\n BridgeStatusControllerAction<'submitIntent'>;\n\nexport type BridgeStatusControllerRestartPollingForFailedAttemptsAction =\n BridgeStatusControllerAction<'restartPollingForFailedAttempts'>;\n\nexport type BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction =\n BridgeStatusControllerAction<'getBridgeHistoryItemByTxMetaId'>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction\n | BridgeStatusControllerSubmitIntentAction\n | BridgeStatusControllerRestartPollingForFailedAttemptsAction\n | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
package/dist/types.d.cts CHANGED
@@ -9,7 +9,7 @@ import type { AuthenticationControllerGetBearerTokenAction } from "@metamask/pro
9
9
  import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
10
10
  import type { HandleSnapRequest } from "@metamask/snaps-controllers";
11
11
  import type { Infer } from "@metamask/superstruct";
12
- import type { TransactionControllerGetStateAction, TransactionControllerIsAtomicBatchSupportedAction, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionFailedEvent, TransactionMeta } from "@metamask/transaction-controller";
12
+ import type { TransactionControllerAddTransactionAction, TransactionControllerEstimateGasFeeAction, TransactionControllerGetStateAction, TransactionControllerIsAtomicBatchSupportedAction, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionFailedEvent, TransactionControllerUpdateTransactionAction, TransactionMeta } from "@metamask/transaction-controller";
13
13
  import type { CaipAssetType } from "@metamask/utils";
14
14
  import type { BridgeStatusController } from "./bridge-status-controller.cjs";
15
15
  import { BRIDGE_STATUS_CONTROLLER_NAME } from "./constants.cjs";
@@ -218,7 +218,7 @@ export type BridgeStatusControllerEvents = BridgeStatusControllerStateChangeEven
218
218
  /**
219
219
  * The external actions available to the BridgeStatusController.
220
220
  */
221
- type AllowedActions = NetworkControllerFindNetworkClientIdByChainIdAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | HandleSnapRequest | TransactionControllerGetStateAction | TransactionControllerIsAtomicBatchSupportedAction | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT> | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES> | GetGasFeeState | AccountsControllerGetAccountByAddressAction | RemoteFeatureFlagControllerGetStateAction | AuthenticationControllerGetBearerTokenAction | KeyringControllerSignTypedMessageAction;
221
+ type AllowedActions = NetworkControllerFindNetworkClientIdByChainIdAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | HandleSnapRequest | TransactionControllerGetStateAction | TransactionControllerUpdateTransactionAction | TransactionControllerAddTransactionAction | TransactionControllerEstimateGasFeeAction | TransactionControllerIsAtomicBatchSupportedAction | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT> | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES> | GetGasFeeState | AccountsControllerGetAccountByAddressAction | RemoteFeatureFlagControllerGetStateAction | AuthenticationControllerGetBearerTokenAction | KeyringControllerSignTypedMessageAction;
222
222
  /**
223
223
  * The external events available to the BridgeStatusController.
224
224
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2CAA2C,EAAE,sCAAsC;AACjG,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,EACP,SAAS,EACT,KAAK,EACL,aAAa,EACb,aAAa,EACb,2BAA2B,EAC5B,oCAAoC;AACrC,OAAO,KAAK,EAA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2D,GAC3D,0DAA0D,CAAC;AAG/D,MAAM,MAAM,sCAAsC,GAAG,0BAA0B,CAC7E,OAAO,6BAA6B,EACpC,2BAA2B,CAC5B,CAAC;AACF;;;GAGG;AACH,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,CAAC,aAAa,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GACpC,sCAAsC,GACtC,0DAA0D,CAAC;AAE/D;;GAEG;AACH,KAAK,cAAc,GACf,mDAAmD,GACnD,+BAA+B,GAC/B,2CAA2C,GAC3C,iBAAiB,GACjB,mCAAmC,GACnC,4CAA4C,GAC5C,yCAAyC,GACzC,yCAAyC,GACzC,iDAAiD,GACjD,sBAAsB,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,GACtE,sBAAsB,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,GACtE,cAAc,GACd,2CAA2C,GAC3C,yCAAyC,GACzC,4CAA4C,GAC5C,uCAAuC,CAAC;AAE5C;;GAEG;AACH,KAAK,aAAa,GACd,2CAA2C,GAC3C,8CAA8C,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,SAAS,CACrD,OAAO,6BAA6B,EACpC,6BAA6B,GAAG,cAAc,EAC9C,4BAA4B,GAAG,aAAa,CAC7C,CAAC"}
package/dist/types.d.mts CHANGED
@@ -9,7 +9,7 @@ import type { AuthenticationControllerGetBearerTokenAction } from "@metamask/pro
9
9
  import type { RemoteFeatureFlagControllerGetStateAction } from "@metamask/remote-feature-flag-controller";
10
10
  import type { HandleSnapRequest } from "@metamask/snaps-controllers";
11
11
  import type { Infer } from "@metamask/superstruct";
12
- import type { TransactionControllerGetStateAction, TransactionControllerIsAtomicBatchSupportedAction, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionFailedEvent, TransactionMeta } from "@metamask/transaction-controller";
12
+ import type { TransactionControllerAddTransactionAction, TransactionControllerEstimateGasFeeAction, TransactionControllerGetStateAction, TransactionControllerIsAtomicBatchSupportedAction, TransactionControllerTransactionConfirmedEvent, TransactionControllerTransactionFailedEvent, TransactionControllerUpdateTransactionAction, TransactionMeta } from "@metamask/transaction-controller";
13
13
  import type { CaipAssetType } from "@metamask/utils";
14
14
  import type { BridgeStatusController } from "./bridge-status-controller.mjs";
15
15
  import { BRIDGE_STATUS_CONTROLLER_NAME } from "./constants.mjs";
@@ -218,7 +218,7 @@ export type BridgeStatusControllerEvents = BridgeStatusControllerStateChangeEven
218
218
  /**
219
219
  * The external actions available to the BridgeStatusController.
220
220
  */
221
- type AllowedActions = NetworkControllerFindNetworkClientIdByChainIdAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | HandleSnapRequest | TransactionControllerGetStateAction | TransactionControllerIsAtomicBatchSupportedAction | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT> | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES> | GetGasFeeState | AccountsControllerGetAccountByAddressAction | RemoteFeatureFlagControllerGetStateAction | AuthenticationControllerGetBearerTokenAction | KeyringControllerSignTypedMessageAction;
221
+ type AllowedActions = NetworkControllerFindNetworkClientIdByChainIdAction | NetworkControllerGetStateAction | NetworkControllerGetNetworkClientByIdAction | HandleSnapRequest | TransactionControllerGetStateAction | TransactionControllerUpdateTransactionAction | TransactionControllerAddTransactionAction | TransactionControllerEstimateGasFeeAction | TransactionControllerIsAtomicBatchSupportedAction | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT> | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES> | GetGasFeeState | AccountsControllerGetAccountByAddressAction | RemoteFeatureFlagControllerGetStateAction | AuthenticationControllerGetBearerTokenAction | KeyringControllerSignTypedMessageAction;
222
222
  /**
223
223
  * The external events available to the BridgeStatusController.
224
224
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","sourceRoot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CA,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AAG5D,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAyCD,MAAM,CAAN,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,KAAR,QAAQ,QAanB;AA8DD,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport type { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n quote: Quote;\n status: StatusResponse;\n startTime?: number; // timestamp in ms\n estimatedProcessingTimeInSeconds: number;\n slippagePercentage: number;\n completionTime?: number; // timestamp in ms\n pricingData?: {\n /**\n * The actual amount sent by user in non-atomic decimal form\n */\n amountSent: QuoteMetadata['sentAmount']['amount'];\n amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];\n quotedGasInUsd?: QuoteMetadata['gasFee']['effective']['usd'];\n quotedGasAmount?: QuoteMetadata['gasFee']['effective']['amount'];\n quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n};\n\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: TransactionMeta;\n statusRequest: StatusRequest;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime?: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location?: BridgeHistoryItem['location'];\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n};\n\n/**\n * Chrome: The BigNumber values are automatically serialized to strings when sent to the background\n * Firefox: The BigNumber values are not serialized to strings when sent to the background,\n * so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action\n */\nexport type StartPollingForBridgeTxStatusArgsSerialized = Omit<\n StartPollingForBridgeTxStatusArgs,\n 'quoteResponse'\n> & {\n quoteResponse: QuoteResponse & Partial<QuoteMetadata>;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<'startPollingForBridgeTxStatus'>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<'wipeBridgeStatus'>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<'resetState'>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<'submitTx'>;\n\nexport type BridgeStatusControllerSubmitIntentAction =\n BridgeStatusControllerAction<'submitIntent'>;\n\nexport type BridgeStatusControllerRestartPollingForFailedAttemptsAction =\n BridgeStatusControllerAction<'restartPollingForFailedAttempts'>;\n\nexport type BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction =\n BridgeStatusControllerAction<'getBridgeHistoryItemByTxMetaId'>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction\n | BridgeStatusControllerSubmitIntentAction\n | BridgeStatusControllerRestartPollingForFailedAttemptsAction\n | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AAG5D,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAyCD,MAAM,CAAN,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,KAAR,QAAQ,QAanB;AA8DD,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { HandleSnapRequest } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport type { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n quote: Quote;\n status: StatusResponse;\n startTime?: number; // timestamp in ms\n estimatedProcessingTimeInSeconds: number;\n slippagePercentage: number;\n completionTime?: number; // timestamp in ms\n pricingData?: {\n /**\n * The actual amount sent by user in non-atomic decimal form\n */\n amountSent: QuoteMetadata['sentAmount']['amount'];\n amountSentInUsd?: QuoteMetadata['sentAmount']['usd'];\n quotedGasInUsd?: QuoteMetadata['gasFee']['effective']['usd'];\n quotedGasAmount?: QuoteMetadata['gasFee']['effective']['amount'];\n quotedReturnInUsd?: QuoteMetadata['toTokenAmount']['usd'];\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n};\n\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: TransactionMeta;\n statusRequest: StatusRequest;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime?: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location?: BridgeHistoryItem['location'];\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n};\n\n/**\n * Chrome: The BigNumber values are automatically serialized to strings when sent to the background\n * Firefox: The BigNumber values are not serialized to strings when sent to the background,\n * so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action\n */\nexport type StartPollingForBridgeTxStatusArgsSerialized = Omit<\n StartPollingForBridgeTxStatusArgs,\n 'quoteResponse'\n> & {\n quoteResponse: QuoteResponse & Partial<QuoteMetadata>;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n};\n\n// Actions\ntype BridgeStatusControllerAction<\n FunctionName extends keyof BridgeStatusController,\n> = {\n type: `${typeof BRIDGE_STATUS_CONTROLLER_NAME}:${FunctionName}`;\n handler: BridgeStatusController[FunctionName];\n};\n\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\n// Maps to BridgeController function names\nexport type BridgeStatusControllerStartPollingForBridgeTxStatusAction =\n BridgeStatusControllerAction<'startPollingForBridgeTxStatus'>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<'wipeBridgeStatus'>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<'resetState'>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<'submitTx'>;\n\nexport type BridgeStatusControllerSubmitIntentAction =\n BridgeStatusControllerAction<'submitIntent'>;\n\nexport type BridgeStatusControllerRestartPollingForFailedAttemptsAction =\n BridgeStatusControllerAction<'restartPollingForFailedAttempts'>;\n\nexport type BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction =\n BridgeStatusControllerAction<'getBridgeHistoryItemByTxMetaId'>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction\n | BridgeStatusControllerSubmitIntentAction\n | BridgeStatusControllerRestartPollingForFailedAttemptsAction\n | BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionFailedEvent\n | TransactionControllerTransactionConfirmedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAccountByAddress = void 0;
4
+ const getAccountByAddress = (messenger, address) => {
5
+ return messenger.call('AccountsController:getAccountByAddress', address);
6
+ };
7
+ exports.getAccountByAddress = getAccountByAddress;
8
+ //# sourceMappingURL=accounts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.cjs","sourceRoot":"","sources":["../../src/utils/accounts.ts"],"names":[],"mappings":";;;AAGO,MAAM,mBAAmB,GAAG,CACjC,SAA0C,EAC1C,OAAe,EACf,EAAE;IACF,OAAO,SAAS,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;AAC3E,CAAC,CAAC;AALW,QAAA,mBAAmB,uBAK9B","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { BridgeStatusControllerMessenger } from '../types';\n\nexport const getAccountByAddress = (\n messenger: BridgeStatusControllerMessenger,\n address: string,\n) => {\n return messenger.call('AccountsController:getAccountByAddress', address);\n};\n"]}
@@ -0,0 +1,36 @@
1
+ import { BridgeStatusControllerMessenger } from "../types.cjs";
2
+ export declare const getAccountByAddress: (messenger: BridgeStatusControllerMessenger, address: string) => {
3
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
4
+ id: string;
5
+ options: Record<string, import("@metamask/utils").Json> & {
6
+ entropy?: {
7
+ type: "mnemonic";
8
+ id: string;
9
+ derivationPath: string;
10
+ groupIndex: number;
11
+ } | {
12
+ type: "private-key";
13
+ } | {
14
+ type: "custom";
15
+ } | undefined;
16
+ exportable?: boolean | undefined;
17
+ };
18
+ metadata: {
19
+ name: string;
20
+ importTime: number;
21
+ keyring: {
22
+ type: string;
23
+ };
24
+ snap?: {
25
+ name: string;
26
+ id: string;
27
+ enabled: boolean;
28
+ } | undefined;
29
+ nameLastUpdatedAt?: number | undefined;
30
+ lastSelected?: number | undefined;
31
+ };
32
+ address: string;
33
+ scopes: `${string}:${string}`[];
34
+ methods: string[];
35
+ } | undefined;
36
+ //# sourceMappingURL=accounts.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.cts","sourceRoot":"","sources":["../../src/utils/accounts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,qBAAiB;AAE3D,eAAO,MAAM,mBAAmB,wDAErB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAGhB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { BridgeStatusControllerMessenger } from "../types.mjs";
2
+ export declare const getAccountByAddress: (messenger: BridgeStatusControllerMessenger, address: string) => {
3
+ type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2pkh" | "bip122:p2sh" | "bip122:p2wpkh" | "bip122:p2tr" | "solana:data-account" | "tron:eoa" | "any:account";
4
+ id: string;
5
+ options: Record<string, import("@metamask/utils").Json> & {
6
+ entropy?: {
7
+ type: "mnemonic";
8
+ id: string;
9
+ derivationPath: string;
10
+ groupIndex: number;
11
+ } | {
12
+ type: "private-key";
13
+ } | {
14
+ type: "custom";
15
+ } | undefined;
16
+ exportable?: boolean | undefined;
17
+ };
18
+ metadata: {
19
+ name: string;
20
+ importTime: number;
21
+ keyring: {
22
+ type: string;
23
+ };
24
+ snap?: {
25
+ name: string;
26
+ id: string;
27
+ enabled: boolean;
28
+ } | undefined;
29
+ nameLastUpdatedAt?: number | undefined;
30
+ lastSelected?: number | undefined;
31
+ };
32
+ address: string;
33
+ scopes: `${string}:${string}`[];
34
+ methods: string[];
35
+ } | undefined;
36
+ //# sourceMappingURL=accounts.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.mts","sourceRoot":"","sources":["../../src/utils/accounts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,qBAAiB;AAE3D,eAAO,MAAM,mBAAmB,wDAErB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAGhB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export const getAccountByAddress = (messenger, address) => {
2
+ return messenger.call('AccountsController:getAccountByAddress', address);
3
+ };
4
+ //# sourceMappingURL=accounts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.mjs","sourceRoot":"","sources":["../../src/utils/accounts.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,SAA0C,EAC1C,OAAe,EACf,EAAE;IACF,OAAO,SAAS,CAAC,IAAI,CAAC,wCAAwC,EAAE,OAAO,CAAC,CAAC;AAC3E,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { BridgeStatusControllerMessenger } from '../types';\n\nexport const getAccountByAddress = (\n messenger: BridgeStatusControllerMessenger,\n address: string,\n) => {\n return messenger.call('AccountsController:getAccountByAddress', address);\n};\n"]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getJwt = void 0;
4
+ const getJwt = async (messenger) => {
5
+ try {
6
+ const token = await messenger.call('AuthenticationController:getBearerToken');
7
+ return token;
8
+ }
9
+ catch (error) {
10
+ console.error('Error getting JWT token for bridge-api request', error);
11
+ return undefined;
12
+ }
13
+ };
14
+ exports.getJwt = getJwt;
15
+ //# sourceMappingURL=authentication.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.cjs","sourceRoot":"","sources":["../../src/utils/authentication.ts"],"names":[],"mappings":";;;AAEO,MAAM,MAAM,GAAG,KAAK,EACzB,SAA0C,EACb,EAAE;IAC/B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,IAAI,CAChC,yCAAyC,CAC1C,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gDAAgD,EAAE,KAAK,CAAC,CAAC;QACvE,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,MAAM,UAYjB","sourcesContent":["import type { BridgeStatusControllerMessenger } from '../types';\n\nexport const getJwt = async (\n messenger: BridgeStatusControllerMessenger,\n): Promise<string | undefined> => {\n try {\n const token = await messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return token;\n } catch (error) {\n console.error('Error getting JWT token for bridge-api request', error);\n return undefined;\n }\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import type { BridgeStatusControllerMessenger } from "../types.cjs";
2
+ export declare const getJwt: (messenger: BridgeStatusControllerMessenger) => Promise<string | undefined>;
3
+ //# sourceMappingURL=authentication.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.d.cts","sourceRoot":"","sources":["../../src/utils/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,qBAAiB;AAEhE,eAAO,MAAM,MAAM,kDAEhB,QAAQ,MAAM,GAAG,SAAS,CAU5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { BridgeStatusControllerMessenger } from "../types.mjs";
2
+ export declare const getJwt: (messenger: BridgeStatusControllerMessenger) => Promise<string | undefined>;
3
+ //# sourceMappingURL=authentication.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.d.mts","sourceRoot":"","sources":["../../src/utils/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,qBAAiB;AAEhE,eAAO,MAAM,MAAM,kDAEhB,QAAQ,MAAM,GAAG,SAAS,CAU5B,CAAC"}
@@ -0,0 +1,11 @@
1
+ export const getJwt = async (messenger) => {
2
+ try {
3
+ const token = await messenger.call('AuthenticationController:getBearerToken');
4
+ return token;
5
+ }
6
+ catch (error) {
7
+ console.error('Error getting JWT token for bridge-api request', error);
8
+ return undefined;
9
+ }
10
+ };
11
+ //# sourceMappingURL=authentication.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.mjs","sourceRoot":"","sources":["../../src/utils/authentication.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EACzB,SAA0C,EACb,EAAE;IAC/B,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,IAAI,CAChC,yCAAyC,CAC1C,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,gDAAgD,EAAE,KAAK,CAAC,CAAC;QACvE,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import type { BridgeStatusControllerMessenger } from '../types';\n\nexport const getJwt = async (\n messenger: BridgeStatusControllerMessenger,\n): Promise<string | undefined> => {\n try {\n const token = await messenger.call(\n 'AuthenticationController:getBearerToken',\n );\n return token;\n } catch (error) {\n console.error('Error getting JWT token for bridge-api request', error);\n return undefined;\n }\n};\n"]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.trackMetricsEvent = exports.stopPollingForQuotes = void 0;
4
+ const bridge_controller_1 = require("@metamask/bridge-controller");
5
+ const stopPollingForQuotes = (messenger, featureId, metricsContext) => {
6
+ messenger.call('BridgeController:stopPollingForQuotes', bridge_controller_1.AbortReason.TransactionSubmitted,
7
+ // If trade is submitted before all quotes are loaded, the QuotesReceived event is published
8
+ // If the trade has a featureId, it means it was submitted outside of the Unified Swap and Bridge experience, so no QuotesReceived event is published
9
+ featureId ? undefined : metricsContext);
10
+ };
11
+ exports.stopPollingForQuotes = stopPollingForQuotes;
12
+ const trackMetricsEvent = ({ messenger, eventName, properties, }) => {
13
+ messenger.call('BridgeController:trackUnifiedSwapBridgeEvent', eventName, properties);
14
+ };
15
+ exports.trackMetricsEvent = trackMetricsEvent;
16
+ //# sourceMappingURL=bridge.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.cjs","sourceRoot":"","sources":["../../src/utils/bridge.ts"],"names":[],"mappings":";;;AAAA,mEAIqC;AAK9B,MAAM,oBAAoB,GAAG,CAClC,SAA0C,EAC1C,SAAqB,EACrB,cAA0F,EACpF,EAAE;IACR,SAAS,CAAC,IAAI,CACZ,uCAAuC,EACvC,+BAAW,CAAC,oBAAoB;IAChC,4FAA4F;IAC5F,qJAAqJ;IACrJ,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CACvC,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,oBAAoB,wBAY/B;AAEK,MAAM,iBAAiB,GAAG,CAAC,EAChC,SAAS,EACT,SAAS,EACT,UAAU,GAKX,EAAQ,EAAE;IACT,SAAS,CAAC,IAAI,CACZ,8CAA8C,EAC9C,SAAS,EACT,UAAU,CACX,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B","sourcesContent":["import {\n AbortReason,\n FeatureId,\n UnifiedSwapBridgeEventName,\n} from '@metamask/bridge-controller';\nimport type { RequiredEventContextFromClient } from '@metamask/bridge-controller';\n\nimport { BridgeStatusControllerMessenger } from '../types';\n\nexport const stopPollingForQuotes = (\n messenger: BridgeStatusControllerMessenger,\n featureId?: FeatureId,\n metricsContext?: RequiredEventContextFromClient[UnifiedSwapBridgeEventName.QuotesReceived],\n): void => {\n messenger.call(\n 'BridgeController:stopPollingForQuotes',\n AbortReason.TransactionSubmitted,\n // If trade is submitted before all quotes are loaded, the QuotesReceived event is published\n // If the trade has a featureId, it means it was submitted outside of the Unified Swap and Bridge experience, so no QuotesReceived event is published\n featureId ? undefined : metricsContext,\n );\n};\n\nexport const trackMetricsEvent = ({\n messenger,\n eventName,\n properties,\n}: {\n messenger: BridgeStatusControllerMessenger;\n eventName: UnifiedSwapBridgeEventName;\n properties: RequiredEventContextFromClient[UnifiedSwapBridgeEventName];\n}): void => {\n messenger.call(\n 'BridgeController:trackUnifiedSwapBridgeEvent',\n eventName,\n properties,\n );\n};\n"]}
@@ -0,0 +1,10 @@
1
+ import { FeatureId, UnifiedSwapBridgeEventName } from "@metamask/bridge-controller";
2
+ import type { RequiredEventContextFromClient } from "@metamask/bridge-controller";
3
+ import { BridgeStatusControllerMessenger } from "../types.cjs";
4
+ export declare const stopPollingForQuotes: (messenger: BridgeStatusControllerMessenger, featureId?: FeatureId, metricsContext?: RequiredEventContextFromClient[UnifiedSwapBridgeEventName.QuotesReceived]) => void;
5
+ export declare const trackMetricsEvent: ({ messenger, eventName, properties, }: {
6
+ messenger: BridgeStatusControllerMessenger;
7
+ eventName: UnifiedSwapBridgeEventName;
8
+ properties: RequiredEventContextFromClient[UnifiedSwapBridgeEventName];
9
+ }) => void;
10
+ //# sourceMappingURL=bridge.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.cts","sourceRoot":"","sources":["../../src/utils/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,0BAA0B,EAC3B,oCAAoC;AACrC,OAAO,KAAK,EAAE,8BAA8B,EAAE,oCAAoC;AAElF,OAAO,EAAE,+BAA+B,EAAE,qBAAiB;AAE3D,eAAO,MAAM,oBAAoB,2DAEnB,SAAS,mBACJ,8BAA8B,CAAC,2BAA2B,cAAc,CAAC,KACzF,IAQF,CAAC;AAEF,eAAO,MAAM,iBAAiB;;eAMjB,0BAA0B;gBACzB,8BAA8B,CAAC,0BAA0B,CAAC;MACpE,IAMH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { FeatureId, UnifiedSwapBridgeEventName } from "@metamask/bridge-controller";
2
+ import type { RequiredEventContextFromClient } from "@metamask/bridge-controller";
3
+ import { BridgeStatusControllerMessenger } from "../types.mjs";
4
+ export declare const stopPollingForQuotes: (messenger: BridgeStatusControllerMessenger, featureId?: FeatureId, metricsContext?: RequiredEventContextFromClient[UnifiedSwapBridgeEventName.QuotesReceived]) => void;
5
+ export declare const trackMetricsEvent: ({ messenger, eventName, properties, }: {
6
+ messenger: BridgeStatusControllerMessenger;
7
+ eventName: UnifiedSwapBridgeEventName;
8
+ properties: RequiredEventContextFromClient[UnifiedSwapBridgeEventName];
9
+ }) => void;
10
+ //# sourceMappingURL=bridge.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.mts","sourceRoot":"","sources":["../../src/utils/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,0BAA0B,EAC3B,oCAAoC;AACrC,OAAO,KAAK,EAAE,8BAA8B,EAAE,oCAAoC;AAElF,OAAO,EAAE,+BAA+B,EAAE,qBAAiB;AAE3D,eAAO,MAAM,oBAAoB,2DAEnB,SAAS,mBACJ,8BAA8B,CAAC,2BAA2B,cAAc,CAAC,KACzF,IAQF,CAAC;AAEF,eAAO,MAAM,iBAAiB;;eAMjB,0BAA0B;gBACzB,8BAA8B,CAAC,0BAA0B,CAAC;MACpE,IAMH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { AbortReason, FeatureId, UnifiedSwapBridgeEventName } from "@metamask/bridge-controller";
2
+ export const stopPollingForQuotes = (messenger, featureId, metricsContext) => {
3
+ messenger.call('BridgeController:stopPollingForQuotes', AbortReason.TransactionSubmitted,
4
+ // If trade is submitted before all quotes are loaded, the QuotesReceived event is published
5
+ // If the trade has a featureId, it means it was submitted outside of the Unified Swap and Bridge experience, so no QuotesReceived event is published
6
+ featureId ? undefined : metricsContext);
7
+ };
8
+ export const trackMetricsEvent = ({ messenger, eventName, properties, }) => {
9
+ messenger.call('BridgeController:trackUnifiedSwapBridgeEvent', eventName, properties);
10
+ };
11
+ //# sourceMappingURL=bridge.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.mjs","sourceRoot":"","sources":["../../src/utils/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,0BAA0B,EAC3B,oCAAoC;AAKrC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,SAA0C,EAC1C,SAAqB,EACrB,cAA0F,EACpF,EAAE;IACR,SAAS,CAAC,IAAI,CACZ,uCAAuC,EACvC,WAAW,CAAC,oBAAoB;IAChC,4FAA4F;IAC5F,qJAAqJ;IACrJ,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,CACvC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAChC,SAAS,EACT,SAAS,EACT,UAAU,GAKX,EAAQ,EAAE;IACT,SAAS,CAAC,IAAI,CACZ,8CAA8C,EAC9C,SAAS,EACT,UAAU,CACX,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import {\n AbortReason,\n FeatureId,\n UnifiedSwapBridgeEventName,\n} from '@metamask/bridge-controller';\nimport type { RequiredEventContextFromClient } from '@metamask/bridge-controller';\n\nimport { BridgeStatusControllerMessenger } from '../types';\n\nexport const stopPollingForQuotes = (\n messenger: BridgeStatusControllerMessenger,\n featureId?: FeatureId,\n metricsContext?: RequiredEventContextFromClient[UnifiedSwapBridgeEventName.QuotesReceived],\n): void => {\n messenger.call(\n 'BridgeController:stopPollingForQuotes',\n AbortReason.TransactionSubmitted,\n // If trade is submitted before all quotes are loaded, the QuotesReceived event is published\n // If the trade has a featureId, it means it was submitted outside of the Unified Swap and Bridge experience, so no QuotesReceived event is published\n featureId ? undefined : metricsContext,\n );\n};\n\nexport const trackMetricsEvent = ({\n messenger,\n eventName,\n properties,\n}: {\n messenger: BridgeStatusControllerMessenger;\n eventName: UnifiedSwapBridgeEventName;\n properties: RequiredEventContextFromClient[UnifiedSwapBridgeEventName];\n}): void => {\n messenger.call(\n 'BridgeController:trackUnifiedSwapBridgeEvent',\n eventName,\n properties,\n );\n};\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.calcActualGasUsed = exports.calculateGasFees = exports.getTxGasEstimates = void 0;
4
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
4
5
  const bridge_controller_1 = require("@metamask/bridge-controller");
5
6
  const controller_utils_1 = require("@metamask/controller-utils");
6
7
  const bignumber_js_1 = require("bignumber.js");
@@ -30,7 +31,7 @@ const getTxGasEstimates = ({ txGasFeeEstimates, networkGasFeeEstimates, }) => {
30
31
  return getTransaction1559GasFeeEstimates(txGasFeeEstimates, estimatedBaseFee);
31
32
  };
32
33
  exports.getTxGasEstimates = getTxGasEstimates;
33
- const calculateGasFees = async (skipGasFields, messenger, estimateGasFeeFn, { chainId: _, gasLimit, ...trade }, networkClientId, chainId, txFee) => {
34
+ const calculateGasFees = async (skipGasFields, messenger, { chainId: _, gasLimit, ...trade }, networkClientId, chainId, txFee) => {
34
35
  if (skipGasFields) {
35
36
  return {};
36
37
  }
@@ -45,11 +46,7 @@ const calculateGasFees = async (skipGasFields, messenger, estimateGasFeeFn, { ch
45
46
  value: trade.value,
46
47
  };
47
48
  const { gasFeeEstimates } = messenger.call('GasFeeController:getState');
48
- const { estimates: txGasFeeEstimates } = await estimateGasFeeFn({
49
- transactionParams,
50
- chainId,
51
- networkClientId,
52
- });
49
+ const { estimates: txGasFeeEstimates } = await messenger.call('TransactionController:estimateGasFee', { transactionParams, chainId, networkClientId });
53
50
  const { maxFeePerGas, maxPriorityFeePerGas } = (0, exports.getTxGasEstimates)({
54
51
  networkGasFeeEstimates: gasFeeEstimates,
55
52
  txGasFeeEstimates,
@@ -1 +1 @@
1
- {"version":3,"file":"gas.cjs","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":";;;AAAA,mEAA4E;AAE5E,iEAAmD;AAWnD,+CAAyC;AAOzC,MAAM,iCAAiC,GAAG,CACxC,iBAA2C,EAC3C,gBAAwB,EACxB,EAAE;IACF,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAC1C,iBAAiB,EAAE,CAAC,iDAA6B,CAAC,IAAI,EAAE,CAAC;IAE3D,MAAM,wBAAwB,GAAG,oBAAoB;QACnD,CAAC,CAAC,IAAI,wBAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC;aAChC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;aACd,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC;QACnC,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,wBAAwB;QACxB,YAAY;QACZ,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAChC,iBAAiB,EACjB,sBAAsB,GAMvB,EAAE,EAAE;IACH,MAAM,EAAE,gBAAgB,GAAG,GAAG,EAAE,GAAG,sBAAyC,CAAC;IAC7E,OAAO,iCAAiC,CACtC,iBAAwD,EACxD,gBAAgB,CACjB,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B;AAEK,MAAM,gBAAgB,GAAG,KAAK,EACnC,aAAsB,EACtB,SAA0C,EAC1C,gBAAuE,EACvE,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAU,EAC1C,eAA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CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACI,MAAM,iBAAiB,GAAG,CAC/B,EAAE,WAAW,EAAqB,EAClC,SAA8B,EAC9B,iBAAsC,EACa,EAAE;IACrD,MAAM,eAAe,GACnB,WAAW,EAAE,cAAc,IAAI,WAAW,EAAE,eAAe;QACzD,CAAC,CAAC,IAAI,wBAAS,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,GAAG,CAC5C,WAAW,CAAC,eAAe,CAC5B;QACH,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,iBAAiB,GAAG,eAAe,CACvC,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,iBAAiB,CAC7B,EAAE,IAAI,CACL,eAAe,CACb,iBAAiB,EAAE,OAAO,EAC1B,iBAAiB,EAAE,iBAAiB,CACrC,IAAI,CAAC,CACP,CAAC;IAEF,MAAM,iBAAiB,GAAG,iBAAiB;QACzC,EAAE,GAAG,CAAC,IAAI,wBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SAC/B,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEhB,OAAO,iBAAiB,IAAI,iBAAiB;QAC3C,CAAC,CAAC;YACE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtC,GAAG,EACD,eAAe,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI;SACxE;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAjCW,QAAA,iBAAiB,qBAiC5B","sourcesContent":["import { BRIDGE_PREFERRED_GAS_ESTIMATE } from '@metamask/bridge-controller';\nimport type { TokenAmountValues, TxData } from '@metamask/bridge-controller';\nimport { toHex } from '@metamask/controller-utils';\nimport type {\n GasFeeEstimates,\n GasFeeState,\n} from '@metamask/gas-fee-controller';\nimport type {\n FeeMarketGasFeeEstimates,\n TransactionController,\n TransactionReceipt,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\nimport { BigNumber } from 'bignumber.js';\n\nimport type {\n BridgeHistoryItem,\n BridgeStatusControllerMessenger,\n} from '../types';\n\nconst getTransaction1559GasFeeEstimates = (\n txGasFeeEstimates: FeeMarketGasFeeEstimates,\n estimatedBaseFee: string,\n) => {\n const { maxFeePerGas, maxPriorityFeePerGas } =\n txGasFeeEstimates?.[BRIDGE_PREFERRED_GAS_ESTIMATE] ?? {};\n\n const baseAndPriorityFeePerGas = maxPriorityFeePerGas\n ? new BigNumber(estimatedBaseFee, 10)\n .times(10 ** 9)\n .plus(maxPriorityFeePerGas, 16)\n : undefined;\n\n return {\n baseAndPriorityFeePerGas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n};\n\n/**\n * Get the gas fee estimates for a transaction\n *\n * @param params - The parameters for the gas fee estimates\n * @param params.txGasFeeEstimates - The gas fee estimates for the transaction (TransactionController)\n * @param params.networkGasFeeEstimates - The gas fee estimates for the network (GasFeeController)\n * @returns The gas fee estimates for the transaction\n */\nexport const getTxGasEstimates = ({\n txGasFeeEstimates,\n networkGasFeeEstimates,\n}: {\n txGasFeeEstimates: Awaited<\n ReturnType<TransactionController['estimateGasFee']>\n >['estimates'];\n networkGasFeeEstimates: GasFeeState['gasFeeEstimates'];\n}) => {\n const { estimatedBaseFee = '0' } = networkGasFeeEstimates as GasFeeEstimates;\n return getTransaction1559GasFeeEstimates(\n txGasFeeEstimates as unknown as FeeMarketGasFeeEstimates,\n estimatedBaseFee,\n );\n};\n\nexport const calculateGasFees = async (\n skipGasFields: boolean,\n messenger: BridgeStatusControllerMessenger,\n estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee,\n { chainId: _, gasLimit, ...trade }: TxData,\n networkClientId: string,\n chainId: Hex,\n txFee?: { maxFeePerGas: string; maxPriorityFeePerGas: string },\n) => {\n if (skipGasFields) {\n return {};\n }\n if (txFee) {\n return { ...txFee, gas: gasLimit?.toString() };\n }\n const transactionParams = {\n ...trade,\n gas: gasLimit?.toString(),\n data: trade.data as `0x${string}`,\n to: trade.to as `0x${string}`,\n value: trade.value as `0x${string}`,\n };\n const { gasFeeEstimates } = messenger.call('GasFeeController:getState');\n const { estimates: txGasFeeEstimates } = await estimateGasFeeFn({\n transactionParams,\n chainId,\n networkClientId,\n });\n const { maxFeePerGas, maxPriorityFeePerGas } = getTxGasEstimates({\n networkGasFeeEstimates: gasFeeEstimates,\n txGasFeeEstimates,\n });\n const maxGasLimit = toHex(transactionParams.gas ?? 0);\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n gas: maxGasLimit,\n };\n};\n\nconst calcGasInHexWei = (gasLimit?: string, gasPrice?: string) => {\n return gasLimit && gasPrice\n ? new BigNumber(gasLimit, 16).times(new BigNumber(gasPrice, 16))\n : null;\n};\n\n/**\n * Calculate the effective gas used for a transaction and its approval tx\n *\n * @param bridgeHistoryItem - The bridge history item\n * @param bridgeHistoryItem.pricingData - pricing data from the submitted quote\n * @param txReceipt - tx receipt from the txMeta\n * @param approvalTxReceipt - tx receipt from the approvalTxMeta\n * @returns The actual gas used for the transaction in Wei and its value in USD\n */\nexport const calcActualGasUsed = (\n { pricingData }: BridgeHistoryItem,\n txReceipt?: TransactionReceipt,\n approvalTxReceipt?: TransactionReceipt,\n): Omit<TokenAmountValues, 'valueInCurrency'> | null => {\n const usdExchangeRate =\n pricingData?.quotedGasInUsd && pricingData?.quotedGasAmount\n ? new BigNumber(pricingData?.quotedGasInUsd).div(\n pricingData.quotedGasAmount,\n )\n : null;\n\n const actualGasInHexWei = calcGasInHexWei(\n txReceipt?.gasUsed,\n txReceipt?.effectiveGasPrice,\n )?.plus(\n calcGasInHexWei(\n approvalTxReceipt?.gasUsed,\n approvalTxReceipt?.effectiveGasPrice,\n ) ?? 0,\n );\n\n const actualGasInDecEth = actualGasInHexWei\n ?.div(new BigNumber(10).pow(18))\n .toString(10);\n\n return actualGasInHexWei && actualGasInDecEth\n ? {\n amount: actualGasInHexWei.toString(10),\n usd:\n usdExchangeRate?.multipliedBy(actualGasInDecEth).toString(10) ?? null,\n }\n : null;\n};\n"]}
1
+ {"version":3,"file":"gas.cjs","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,mEAA4E;AAE5E,iEAAmD;AAWnD,+CAAyC;AAOzC,MAAM,iCAAiC,GAAG,CACxC,iBAA2C,EAC3C,gBAAwB,EACxB,EAAE;IACF,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAC1C,iBAAiB,EAAE,CAAC,iDAA6B,CAAC,IAAI,EAAE,CAAC;IAE3D,MAAM,wBAAwB,GAAG,oBAAoB;QACnD,CAAC,CAAC,IAAI,wBAAS,CAAC,gBAAgB,EAAE,EAAE,CAAC;aAChC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;aACd,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC;QACnC,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACL,wBAAwB;QACxB,YAAY;QACZ,oBAAoB;KACrB,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACI,MAAM,iBAAiB,GAAG,CAAC,EAChC,iBAAiB,EACjB,sBAAsB,GAMvB,EAAE,EAAE;IACH,MAAM,EAAE,gBAAgB,GAAG,GAAG,EAAE,GAAG,sBAAyC,CAAC;IAC7E,OAAO,iCAAiC,CACtC,iBAAwD,EACxD,gBAAgB,CACjB,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,iBAAiB,qBAc5B;AAEK,MAAM,gBAAgB,GAAG,KAAK,EACnC,aAAsB,EACtB,SAA0C,EAC1C,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAU,EAC1C,eAAuB,EACvB,OAAY,EACZ,KAA8D,EAC9D,EAAE;IACF,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,KAAK,EAA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qB,EAClC,SAA8B,EAC9B,iBAAsC,EACa,EAAE;IACrD,MAAM,eAAe,GACnB,WAAW,EAAE,cAAc,IAAI,WAAW,EAAE,eAAe;QACzD,CAAC,CAAC,IAAI,wBAAS,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,GAAG,CAC5C,WAAW,CAAC,eAAe,CAC5B;QACH,CAAC,CAAC,IAAI,CAAC;IAEX,MAAM,iBAAiB,GAAG,eAAe,CACvC,SAAS,EAAE,OAAO,EAClB,SAAS,EAAE,iBAAiB,CAC7B,EAAE,IAAI,CACL,eAAe,CACb,iBAAiB,EAAE,OAAO,EAC1B,iBAAiB,EAAE,iBAAiB,CACrC,IAAI,CAAC,CACP,CAAC;IAEF,MAAM,iBAAiB,GAAG,iBAAiB;QACzC,EAAE,GAAG,CAAC,IAAI,wBAAS,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;SAC/B,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEhB,OAAO,iBAAiB,IAAI,iBAAiB;QAC3C,CAAC,CAAC;YACE,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtC,GAAG,EACD,eAAe,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI;SACxE;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC,CAAC;AAjCW,QAAA,iBAAiB,qBAiC5B","sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport { BRIDGE_PREFERRED_GAS_ESTIMATE } from '@metamask/bridge-controller';\nimport type { TokenAmountValues, TxData } from '@metamask/bridge-controller';\nimport { toHex } from '@metamask/controller-utils';\nimport type {\n GasFeeEstimates,\n GasFeeState,\n} from '@metamask/gas-fee-controller';\nimport type {\n FeeMarketGasFeeEstimates,\n TransactionController,\n TransactionReceipt,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\nimport { BigNumber } from 'bignumber.js';\n\nimport type {\n BridgeHistoryItem,\n BridgeStatusControllerMessenger,\n} from '../types';\n\nconst getTransaction1559GasFeeEstimates = (\n txGasFeeEstimates: FeeMarketGasFeeEstimates,\n estimatedBaseFee: string,\n) => {\n const { maxFeePerGas, maxPriorityFeePerGas } =\n txGasFeeEstimates?.[BRIDGE_PREFERRED_GAS_ESTIMATE] ?? {};\n\n const baseAndPriorityFeePerGas = maxPriorityFeePerGas\n ? new BigNumber(estimatedBaseFee, 10)\n .times(10 ** 9)\n .plus(maxPriorityFeePerGas, 16)\n : undefined;\n\n return {\n baseAndPriorityFeePerGas,\n maxFeePerGas,\n maxPriorityFeePerGas,\n };\n};\n\n/**\n * Get the gas fee estimates for a transaction\n *\n * @param params - The parameters for the gas fee estimates\n * @param params.txGasFeeEstimates - The gas fee estimates for the transaction (TransactionController)\n * @param params.networkGasFeeEstimates - The gas fee estimates for the network (GasFeeController)\n * @returns The gas fee estimates for the transaction\n */\nexport const getTxGasEstimates = ({\n txGasFeeEstimates,\n networkGasFeeEstimates,\n}: {\n txGasFeeEstimates: Awaited<\n ReturnType<TransactionController['estimateGasFee']>\n >['estimates'];\n networkGasFeeEstimates: GasFeeState['gasFeeEstimates'];\n}) => {\n const { estimatedBaseFee = '0' } = networkGasFeeEstimates as GasFeeEstimates;\n return getTransaction1559GasFeeEstimates(\n txGasFeeEstimates as unknown as FeeMarketGasFeeEstimates,\n estimatedBaseFee,\n );\n};\n\nexport const calculateGasFees = async (\n skipGasFields: boolean,\n messenger: BridgeStatusControllerMessenger,\n { chainId: _, gasLimit, ...trade }: TxData,\n networkClientId: string,\n chainId: Hex,\n txFee?: { maxFeePerGas: string; maxPriorityFeePerGas: string },\n) => {\n if (skipGasFields) {\n return {};\n }\n if (txFee) {\n return { ...txFee, gas: gasLimit?.toString() };\n }\n const transactionParams = {\n ...trade,\n gas: gasLimit?.toString(),\n data: trade.data as `0x${string}`,\n to: trade.to as `0x${string}`,\n value: trade.value as `0x${string}`,\n };\n const { gasFeeEstimates } = messenger.call('GasFeeController:getState');\n const { estimates: txGasFeeEstimates } = await messenger.call(\n 'TransactionController:estimateGasFee',\n { transactionParams, chainId, networkClientId },\n );\n const { maxFeePerGas, maxPriorityFeePerGas } = getTxGasEstimates({\n networkGasFeeEstimates: gasFeeEstimates,\n txGasFeeEstimates,\n });\n const maxGasLimit = toHex(transactionParams.gas ?? 0);\n\n return {\n maxFeePerGas,\n maxPriorityFeePerGas,\n gas: maxGasLimit,\n };\n};\n\nconst calcGasInHexWei = (gasLimit?: string, gasPrice?: string) => {\n return gasLimit && gasPrice\n ? new BigNumber(gasLimit, 16).times(new BigNumber(gasPrice, 16))\n : null;\n};\n\n/**\n * Calculate the effective gas used for a transaction and its approval tx\n *\n * @param bridgeHistoryItem - The bridge history item\n * @param bridgeHistoryItem.pricingData - pricing data from the submitted quote\n * @param txReceipt - tx receipt from the txMeta\n * @param approvalTxReceipt - tx receipt from the approvalTxMeta\n * @returns The actual gas used for the transaction in Wei and its value in USD\n */\nexport const calcActualGasUsed = (\n { pricingData }: BridgeHistoryItem,\n txReceipt?: TransactionReceipt,\n approvalTxReceipt?: TransactionReceipt,\n): Omit<TokenAmountValues, 'valueInCurrency'> | null => {\n const usdExchangeRate =\n pricingData?.quotedGasInUsd && pricingData?.quotedGasAmount\n ? new BigNumber(pricingData?.quotedGasInUsd).div(\n pricingData.quotedGasAmount,\n )\n : null;\n\n const actualGasInHexWei = calcGasInHexWei(\n txReceipt?.gasUsed,\n txReceipt?.effectiveGasPrice,\n )?.plus(\n calcGasInHexWei(\n approvalTxReceipt?.gasUsed,\n approvalTxReceipt?.effectiveGasPrice,\n ) ?? 0,\n );\n\n const actualGasInDecEth = actualGasInHexWei\n ?.div(new BigNumber(10).pow(18))\n .toString(10);\n\n return actualGasInHexWei && actualGasInDecEth\n ? {\n amount: actualGasInHexWei.toString(10),\n usd:\n usdExchangeRate?.multipliedBy(actualGasInDecEth).toString(10) ?? null,\n }\n : null;\n};\n"]}
@@ -20,7 +20,7 @@ export declare const getTxGasEstimates: ({ txGasFeeEstimates, networkGasFeeEstim
20
20
  maxFeePerGas: `0x${string}`;
21
21
  maxPriorityFeePerGas: `0x${string}`;
22
22
  };
23
- export declare const calculateGasFees: (skipGasFields: boolean, messenger: BridgeStatusControllerMessenger, estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee, { chainId: _, gasLimit, ...trade }: TxData, networkClientId: string, chainId: Hex, txFee?: {
23
+ export declare const calculateGasFees: (skipGasFields: boolean, messenger: BridgeStatusControllerMessenger, { chainId: _, gasLimit, ...trade }: TxData, networkClientId: string, chainId: Hex, txFee?: {
24
24
  maxFeePerGas: string;
25
25
  maxPriorityFeePerGas: string;
26
26
  }) => Promise<{}>;
@@ -1 +1 @@
1
- {"version":3,"file":"gas.d.cts","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,oCAAoC;AAE7E,OAAO,KAAK,EAEV,WAAW,EACZ,qCAAqC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACrB,kBAAkB,EACnB,yCAAyC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAC3C,OAAO,EAAE,SAAS,EAAE,qBAAqB;AAEzC,OAAO,KAAK,EACV,iBAAiB,EACjB,+BAA+B,EAChC,qBAAiB;AAsBlB;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;uBAIT,QACjB,WAAW,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,CACpD,CAAC,WAAW,CAAC;4BACU,WAAW,CAAC,iBAAiB,CAAC;;;;;CAOvD,CAAC;AAEF,eAAO,MAAM,gBAAgB,kBACZ,OAAO,gEAEJ,OAAO,sBAAsB,SAAS,CAAC,cAAc,sCACnC,MAAM,mBACzB,MAAM,WACd,GAAG,UACJ;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,oBAAoB,EAAE,MAAM,CAAA;CAAE,gBAgC/D,CAAC;AAQF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,oBACX,iBAAiB,cACtB,kBAAkB,sBACV,kBAAkB,KACrC,KAAK,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,IA6B/C,CAAC"}
1
+ {"version":3,"file":"gas.d.cts","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,EAAE,oCAAoC;AAE7E,OAAO,KAAK,EAEV,WAAW,EACZ,qCAAqC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACrB,kBAAkB,EACnB,yCAAyC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAC3C,OAAO,EAAE,SAAS,EAAE,qBAAqB;AAEzC,OAAO,KAAK,EACV,iBAAiB,EACjB,+BAA+B,EAChC,qBAAiB;AAsBlB;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;uBAIT,QACjB,WAAW,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,CACpD,CAAC,WAAW,CAAC;4BACU,WAAW,CAAC,iBAAiB,CAAC;;;;;CAOvD,CAAC;AAEF,eAAO,MAAM,gBAAgB,kBACZ,OAAO,kFAEc,MAAM,mBACzB,MAAM,WACd,GAAG,UACJ;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,oBAAoB,EAAE,MAAM,CAAA;CAAE,gBA+B/D,CAAC;AAQF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,oBACX,iBAAiB,cACtB,kBAAkB,sBACV,kBAAkB,KACrC,KAAK,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,IA6B/C,CAAC"}
@@ -20,7 +20,7 @@ export declare const getTxGasEstimates: ({ txGasFeeEstimates, networkGasFeeEstim
20
20
  maxFeePerGas: `0x${string}`;
21
21
  maxPriorityFeePerGas: `0x${string}`;
22
22
  };
23
- export declare const calculateGasFees: (skipGasFields: boolean, messenger: BridgeStatusControllerMessenger, estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee, { chainId: _, gasLimit, ...trade }: TxData, networkClientId: string, chainId: Hex, txFee?: {
23
+ export declare const calculateGasFees: (skipGasFields: boolean, messenger: BridgeStatusControllerMessenger, { chainId: _, gasLimit, ...trade }: TxData, networkClientId: string, chainId: Hex, txFee?: {
24
24
  maxFeePerGas: string;
25
25
  maxPriorityFeePerGas: string;
26
26
  }) => Promise<{}>;