@metamask/bridge-status-controller 68.1.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.
- package/CHANGELOG.md +30 -1
- package/dist/bridge-status-controller.cjs +123 -221
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +1 -4
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +1 -4
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.intent.cjs +9 -13
- package/dist/bridge-status-controller.intent.cjs.map +1 -1
- package/dist/bridge-status-controller.intent.d.cts +6 -8
- package/dist/bridge-status-controller.intent.d.cts.map +1 -1
- package/dist/bridge-status-controller.intent.d.mts +6 -8
- package/dist/bridge-status-controller.intent.d.mts.map +1 -1
- package/dist/bridge-status-controller.intent.mjs +10 -14
- package/dist/bridge-status-controller.intent.mjs.map +1 -1
- package/dist/bridge-status-controller.mjs +125 -223
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +0 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +2 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +2 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/accounts.cjs +8 -0
- package/dist/utils/accounts.cjs.map +1 -0
- package/dist/utils/accounts.d.cts +36 -0
- package/dist/utils/accounts.d.cts.map +1 -0
- package/dist/utils/accounts.d.mts +36 -0
- package/dist/utils/accounts.d.mts.map +1 -0
- package/dist/utils/accounts.mjs +4 -0
- package/dist/utils/accounts.mjs.map +1 -0
- package/dist/utils/authentication.cjs +15 -0
- package/dist/utils/authentication.cjs.map +1 -0
- package/dist/utils/authentication.d.cts +3 -0
- package/dist/utils/authentication.d.cts.map +1 -0
- package/dist/utils/authentication.d.mts +3 -0
- package/dist/utils/authentication.d.mts.map +1 -0
- package/dist/utils/authentication.mjs +11 -0
- package/dist/utils/authentication.mjs.map +1 -0
- package/dist/utils/bridge-status.cjs +2 -4
- package/dist/utils/bridge-status.cjs.map +1 -1
- package/dist/utils/bridge-status.d.cts.map +1 -1
- package/dist/utils/bridge-status.d.mts.map +1 -1
- package/dist/utils/bridge-status.mjs +2 -4
- package/dist/utils/bridge-status.mjs.map +1 -1
- package/dist/utils/bridge.cjs +16 -0
- package/dist/utils/bridge.cjs.map +1 -0
- package/dist/utils/bridge.d.cts +10 -0
- package/dist/utils/bridge.d.cts.map +1 -0
- package/dist/utils/bridge.d.mts +10 -0
- package/dist/utils/bridge.d.mts.map +1 -0
- package/dist/utils/bridge.mjs +11 -0
- package/dist/utils/bridge.mjs.map +1 -0
- package/dist/utils/gas.cjs +4 -7
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.d.cts +1 -1
- package/dist/utils/gas.d.cts.map +1 -1
- package/dist/utils/gas.d.mts +1 -1
- package/dist/utils/gas.d.mts.map +1 -1
- package/dist/utils/gas.mjs +4 -7
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/history.cjs +97 -0
- package/dist/utils/history.cjs.map +1 -0
- package/dist/utils/history.d.cts +21 -0
- package/dist/utils/history.d.cts.map +1 -0
- package/dist/utils/history.d.mts +21 -0
- package/dist/utils/history.d.mts.map +1 -0
- package/dist/utils/history.mjs +90 -0
- package/dist/utils/history.mjs.map +1 -0
- package/dist/utils/intent-api.cjs +18 -3
- package/dist/utils/intent-api.cjs.map +1 -1
- package/dist/utils/intent-api.d.cts +16 -7
- package/dist/utils/intent-api.d.cts.map +1 -1
- package/dist/utils/intent-api.d.mts +16 -7
- package/dist/utils/intent-api.d.mts.map +1 -1
- package/dist/utils/intent-api.mjs +18 -4
- package/dist/utils/intent-api.mjs.map +1 -1
- package/dist/utils/keyring.cjs +12 -0
- package/dist/utils/keyring.cjs.map +1 -0
- package/dist/utils/keyring.d.cts +8 -0
- package/dist/utils/keyring.d.cts.map +1 -0
- package/dist/utils/keyring.d.mts +8 -0
- package/dist/utils/keyring.d.mts.map +1 -0
- package/dist/utils/keyring.mjs +8 -0
- package/dist/utils/keyring.mjs.map +1 -0
- package/dist/utils/network.cjs +17 -0
- package/dist/utils/network.cjs.map +1 -0
- package/dist/utils/network.d.cts +5 -0
- package/dist/utils/network.d.cts.map +1 -0
- package/dist/utils/network.d.mts +5 -0
- package/dist/utils/network.d.mts.map +1 -0
- package/dist/utils/network.mjs +12 -0
- package/dist/utils/network.mjs.map +1 -0
- package/dist/utils/snaps.cjs +146 -1
- package/dist/utils/snaps.cjs.map +1 -1
- package/dist/utils/snaps.d.cts +62 -0
- package/dist/utils/snaps.d.cts.map +1 -1
- package/dist/utils/snaps.d.mts +62 -0
- package/dist/utils/snaps.d.mts.map +1 -1
- package/dist/utils/snaps.mjs +141 -0
- package/dist/utils/snaps.mjs.map +1 -1
- package/dist/utils/trace.cjs +31 -0
- package/dist/utils/trace.cjs.map +1 -0
- package/dist/utils/trace.d.cts +17 -0
- package/dist/utils/trace.d.cts.map +1 -0
- package/dist/utils/trace.d.mts +17 -0
- package/dist/utils/trace.d.mts.map +1 -0
- package/dist/utils/trace.mjs +26 -0
- package/dist/utils/trace.mjs.map +1 -0
- package/dist/utils/transaction.cjs +31 -193
- package/dist/utils/transaction.cjs.map +1 -1
- package/dist/utils/transaction.d.cts +8 -79
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +8 -79
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/transaction.mjs +31 -187
- package/dist/utils/transaction.mjs.map +1 -1
- package/dist/utils/validators.cjs +5 -5
- package/dist/utils/validators.cjs.map +1 -1
- package/dist/utils/validators.d.cts +6 -11
- package/dist/utils/validators.d.cts.map +1 -1
- package/dist/utils/validators.d.mts +6 -11
- package/dist/utils/validators.d.mts.map +1 -1
- package/dist/utils/validators.mjs +3 -3
- package/dist/utils/validators.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":";;;AACA,mEAOqC;AAQrC,iEAAmD;AACnD,6EAG0C;AAM1C,2CAAsD;AACtD,+BAAkC;AAElC,mCAAyC;AACzC,uCAAyD;AAEzD,gDAAiD;AAO1C,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAAjE,QAAA,gBAAgB,oBAAiD;AAEvE,MAAM,sBAAsB,GAAG,CAAC,aAA4B,EAAE,EAAE;IACrE,OAAO;QACL,QAAQ,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ;QACtC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACtC,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,UAAU;QAC1C,WAAW,EAAE,aAAa,CAAC,KAAK,CAAC,WAAW;QAC5C,KAAK,EAAE,aAAa,CAAC,KAAK;QAC1B,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC;KAC5C,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,sBAAsB,0BASjC;AAEK,MAAM,eAAe,GAAG,CAC7B,aACe,EACf,YAAqB,EAIrB,EAAE;IACF,kFAAkF;IAClF,IAAI,kBAAkB,CAAC;IACvB,IAAI,CAAC;QACH,kBAAkB,GAAG,IAAA,sCAAkB,EAAC,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;QACnE,kBAAkB,GAAG,KAAs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ACH,SAAgB,aAAa,CAC3B,QAA4B,EAC5B,cAAkC;IAElC,MAAM,UAAU,GAAG,QAAQ,IAAI,cAAc,CAAC;IAC9C,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,+EAA+E,CAChF,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAXD,sCAWC;AAED;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,aAA6D;IAE7D,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,KAAK,CAAC;IACvC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AARD,gDAQC","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport {\n ChainId,\n extractTradeData,\n isTronTrade,\n formatChainIdToCaip,\n formatChainIdToHex,\n isCrossChain,\n} from '@metamask/bridge-controller';\nimport type {\n Intent,\n QuoteMetadata,\n QuoteResponse,\n Trade,\n TxData,\n} from '@metamask/bridge-controller';\nimport { toHex } from '@metamask/controller-utils';\nimport {\n TransactionStatus,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type {\n BatchTransactionParams,\n TransactionController,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport { createProjectLogger } from '@metamask/utils';\nimport { v4 as uuid } from 'uuid';\n\nimport { calculateGasFees } from './gas';\nimport { createClientTransactionRequest } from './snaps';\nimport type { TransactionBatchSingleRequest } from '../../../transaction-controller/src/types';\nimport { APPROVAL_DELAY_MS } from '../constants';\nimport type {\n BridgeStatusControllerMessenger,\n SolanaTransactionMeta,\n} from '../types';\nimport type { BridgeStatusControllerState } from '../types';\n\nexport const generateActionId = () => (Date.now() + Math.random()).toString();\n\nexport const getStatusRequestParams = (quoteResponse: QuoteResponse) => {\n return {\n bridgeId: quoteResponse.quote.bridgeId,\n bridge: quoteResponse.quote.bridges[0],\n srcChainId: quoteResponse.quote.srcChainId,\n destChainId: quoteResponse.quote.destChainId,\n quote: quoteResponse.quote,\n refuel: Boolean(quoteResponse.quote.refuel),\n };\n};\n\nexport const getTxMetaFields = (\n quoteResponse: Omit<QuoteResponse<Trade, Trade>, 'approval' | 'trade'> &\n QuoteMetadata,\n approvalTxId?: string,\n): Omit<\n TransactionMeta,\n 'networkClientId' | 'status' | 'time' | 'txParams' | 'id' | 'chainId'\n> => {\n // Handle destination chain ID - should always be convertible for EVM destinations\n let destinationChainId;\n try {\n destinationChainId = formatChainIdToHex(quoteResponse.quote.destChainId);\n } catch {\n // Fallback for non-EVM destination (shouldn't happen for BTC->EVM)\n destinationChainId = '0x1' as `0x${string}`; // Default to mainnet\n }\n\n return {\n destinationChainId,\n sourceTokenAmount: quoteResponse.quote.srcTokenAmount,\n sourceTokenSymbol: quoteResponse.quote.srcAsset.symbol,\n sourceTokenDecimals: quoteResponse.quote.srcAsset.decimals,\n sourceTokenAddress: quoteResponse.quote.srcAsset.address,\n\n destinationTokenAmount: quoteResponse.quote.destTokenAmount,\n destinationTokenSymbol: quoteResponse.quote.destAsset.symbol,\n destinationTokenDecimals: quoteResponse.quote.destAsset.decimals,\n destinationTokenAddress: quoteResponse.quote.destAsset.address,\n\n // chainId is now excluded from this function and handled by the caller\n approvalTxId,\n // this is the decimal (non atomic) amount (not USD value) of source token to swap\n swapTokenValue: quoteResponse.sentAmount.amount,\n };\n};\n\n/**\n * Handles the response from non-EVM transaction submission\n * Works with the new unified ClientRequest:signAndSendTransaction interface\n * Supports Solana, Bitcoin, and other non-EVM chains\n *\n * @param snapResponse - The response from the snap after transaction submission\n * @param quoteResponse - The quote response containing trade details and metadata\n * @param selectedAccount - The selected account information\n * @returns The transaction metadata including non-EVM specific fields\n */\nexport const handleNonEvmTxResponse = (\n snapResponse:\n | string\n | { transactionId: string } // New unified interface response\n | { result: Record<string, string> }\n | { signature: string },\n quoteResponse: Omit<QuoteResponse<Trade>, 'approval'> & QuoteMetadata,\n selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string],\n): TransactionMeta & SolanaTransactionMeta => {\n const selectedAccountAddress = selectedAccount.address;\n const snapId = selectedAccount.metadata.snap?.id;\n let hash;\n // Handle different response formats\n if (typeof snapResponse === 'string') {\n hash = snapResponse;\n } else if (snapResponse && typeof snapResponse === 'object') {\n // Check for new unified interface response format first\n if ('transactionId' in snapResponse && snapResponse.transactionId) {\n hash = snapResponse.transactionId;\n } else if (\n 'result' in snapResponse &&\n snapResponse.result &&\n typeof snapResponse.result === 'object'\n ) {\n // Try to extract signature from common locations in response object\n hash =\n snapResponse.result.signature ||\n snapResponse.result.txid ||\n snapResponse.result.hash ||\n snapResponse.result.txHash;\n } else if (\n 'signature' in snapResponse &&\n snapResponse.signature &&\n typeof snapResponse.signature === 'string'\n ) {\n hash = snapResponse.signature;\n }\n }\n\n const isBridgeTx = isCrossChain(\n quoteResponse.quote.srcChainId,\n quoteResponse.quote.destChainId,\n );\n\n let hexChainId;\n try {\n hexChainId = formatChainIdToHex(quoteResponse.quote.srcChainId);\n } catch {\n // TODO: Fix chain ID activity list handling for Bitcoin\n // Fallback to Ethereum mainnet for now\n hexChainId = '0x1' as `0x${string}`;\n }\n\n // Extract the transaction data for storage\n const tradeData = extractTradeData(quoteResponse.trade);\n\n // Create a transaction meta object with bridge-specific fields\n return {\n ...getTxMetaFields(quoteResponse),\n time: Date.now(),\n id: hash ?? uuid(),\n chainId: hexChainId,\n networkClientId: snapId ?? hexChainId,\n txParams: { from: selectedAccountAddress, data: tradeData },\n type: isBridgeTx ? TransactionType.bridge : TransactionType.swap,\n status: TransactionStatus.submitted,\n hash, // Add the transaction signature as hash\n origin: snapId,\n // Add an explicit flag to mark this as a non-EVM transaction\n isSolana: true, // TODO deprecate this and use chainId to detect non-EVM chains\n isBridgeTx,\n };\n};\n\nexport const handleApprovalDelay = async (\n srcChainId: QuoteResponse['quote']['srcChainId'],\n) => {\n if ([ChainId.LINEA, ChainId.BASE].includes(srcChainId)) {\n const debugLog = createProjectLogger('bridge');\n debugLog(\n 'Delaying submitting bridge tx to make Linea and Base confirmation more likely',\n );\n const waitPromise = new Promise((resolve) =>\n setTimeout(resolve, APPROVAL_DELAY_MS),\n );\n await waitPromise;\n }\n};\n\n/**\n * Adds a delay for hardware wallet transactions on mobile to fix an issue\n * where the Ledger does not get prompted for the 2nd approval.\n * Extension does not have this issue.\n *\n * @param requireApproval - Whether the delay should be applied\n */\nexport const handleMobileHardwareWalletDelay = async (\n requireApproval: boolean,\n) => {\n if (requireApproval) {\n const mobileHardwareWalletDelay = new Promise((resolve) =>\n setTimeout(resolve, 1000),\n );\n await mobileHardwareWalletDelay;\n }\n};\n\n/**\n * Creates a request to sign and send a transaction for non-EVM chains\n * Uses the new unified ClientRequest:signAndSendTransaction interface\n *\n * @param trade - The trade data\n * @param srcChainId - The source chain ID\n * @param selectedAccount - The selected account information\n * @returns The snap request object for signing and sending transaction\n */\nexport const getClientRequest = (\n trade: Trade,\n srcChainId: number,\n selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string],\n) => {\n const scope = formatChainIdToCaip(srcChainId);\n\n const transactionData = extractTradeData(trade);\n\n // Tron trades need the visible flag and contract type to be included in the request options\n const options = isTronTrade(trade)\n ? {\n visible: trade.visible,\n type: trade.raw_data?.contract?.[0]?.type,\n }\n : undefined;\n\n // Use the new unified interface\n return createClientTransactionRequest(\n selectedAccount.metadata.snap?.id as string,\n transactionData,\n scope,\n selectedAccount.id,\n options,\n );\n};\n\nexport const waitForTxConfirmation = async (\n messenger: BridgeStatusControllerMessenger,\n txId: string,\n {\n timeoutMs = 5 * 60_000,\n pollMs = 3_000,\n }: { timeoutMs?: number; pollMs?: number } = {},\n): Promise<TransactionMeta> => {\n const start = Date.now();\n while (true) {\n const { transactions } = messenger.call('TransactionController:getState');\n const meta = transactions.find((tx: TransactionMeta) => tx.id === txId);\n\n if (meta) {\n if (meta.status === TransactionStatus.confirmed) {\n return meta;\n }\n if (\n meta.status === TransactionStatus.failed ||\n meta.status === TransactionStatus.dropped ||\n meta.status === TransactionStatus.rejected\n ) {\n throw new Error('Approval transaction did not confirm');\n }\n }\n\n if (Date.now() - start > timeoutMs) {\n throw new Error('Timed out waiting for approval confirmation');\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollMs));\n }\n};\n\nexport const rekeyHistoryItemInState = (\n state: BridgeStatusControllerState,\n actionId: string,\n txMeta: { id: string; hash?: string },\n): boolean => {\n const historyItem = state.txHistory[actionId];\n if (!historyItem) {\n return false;\n }\n\n state.txHistory[txMeta.id] = {\n ...historyItem,\n txMetaId: txMeta.id,\n originalTransactionId: historyItem.originalTransactionId ?? txMeta.id,\n status: {\n ...historyItem.status,\n srcChain: {\n ...historyItem.status.srcChain,\n txHash: txMeta.hash ?? historyItem.status.srcChain?.txHash,\n },\n },\n };\n delete state.txHistory[actionId];\n return true;\n};\n\nexport const toBatchTxParams = (\n disable7702: boolean,\n { chainId, gasLimit, ...trade }: TxData,\n {\n maxFeePerGas,\n maxPriorityFeePerGas,\n gas,\n }: { maxFeePerGas?: string; maxPriorityFeePerGas?: string; gas?: string },\n): BatchTransactionParams => {\n const params = {\n ...trade,\n data: trade.data as `0x${string}`,\n to: trade.to as `0x${string}`,\n value: trade.value as `0x${string}`,\n };\n if (!disable7702) {\n return params;\n }\n\n return {\n ...params,\n gas: toHex(gas ?? 0),\n maxFeePerGas: toHex(maxFeePerGas ?? 0),\n maxPriorityFeePerGas: toHex(maxPriorityFeePerGas ?? 0),\n };\n};\n\nexport const getAddTransactionBatchParams = async ({\n messenger,\n isBridgeTx,\n approval,\n resetApproval,\n trade,\n quoteResponse: {\n quote: {\n feeData: { txFee },\n gasIncluded,\n gasIncluded7702,\n gasSponsored,\n },\n sentAmount,\n toTokenAmount,\n },\n requireApproval = false,\n estimateGasFeeFn,\n}: {\n messenger: BridgeStatusControllerMessenger;\n isBridgeTx: boolean;\n trade: TxData;\n quoteResponse: Omit<QuoteResponse, 'approval' | 'trade'> &\n Partial<QuoteMetadata>;\n estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee;\n approval?: TxData;\n resetApproval?: TxData;\n requireApproval?: boolean;\n}) => {\n const isGasless = gasIncluded || gasIncluded7702;\n const selectedAccount = messenger.call(\n 'AccountsController:getAccountByAddress',\n trade.from,\n );\n if (!selectedAccount) {\n throw new Error(\n 'Failed to submit cross-chain swap batch transaction: unknown account in trade data',\n );\n }\n const hexChainId = formatChainIdToHex(trade.chainId);\n const networkClientId = messenger.call(\n 'NetworkController:findNetworkClientIdByChainId',\n hexChainId,\n );\n\n // When an active quote has gasIncluded7702 set to true,\n // enable 7702 gasless txs for smart accounts\n const disable7702 = gasIncluded7702 !== true;\n const transactions: TransactionBatchSingleRequest[] = [];\n if (resetApproval) {\n const gasFees = await calculateGasFees(\n disable7702,\n messenger,\n estimateGasFeeFn,\n resetApproval,\n networkClientId,\n hexChainId,\n isGasless ? txFee : undefined,\n );\n transactions.push({\n type: isBridgeTx\n ? TransactionType.bridgeApproval\n : TransactionType.swapApproval,\n params: toBatchTxParams(disable7702, resetApproval, gasFees),\n });\n }\n if (approval) {\n const gasFees = await calculateGasFees(\n disable7702,\n messenger,\n estimateGasFeeFn,\n approval,\n networkClientId,\n hexChainId,\n isGasless ? txFee : undefined,\n );\n transactions.push({\n type: isBridgeTx\n ? TransactionType.bridgeApproval\n : TransactionType.swapApproval,\n params: toBatchTxParams(disable7702, approval, gasFees),\n });\n }\n const gasFees = await calculateGasFees(\n disable7702,\n messenger,\n estimateGasFeeFn,\n trade,\n networkClientId,\n hexChainId,\n isGasless ? txFee : undefined,\n );\n transactions.push({\n type: isBridgeTx ? TransactionType.bridge : TransactionType.swap,\n params: toBatchTxParams(disable7702, trade, gasFees),\n assetsFiatValues: {\n sending: sentAmount?.valueInCurrency?.toString(),\n receiving: toTokenAmount?.valueInCurrency?.toString(),\n },\n });\n const transactionParams: Parameters<\n TransactionController['addTransactionBatch']\n >[0] = {\n disable7702,\n isGasFeeIncluded: Boolean(gasIncluded7702),\n isGasFeeSponsored: Boolean(gasSponsored),\n networkClientId,\n requireApproval,\n origin: 'metamask',\n from: trade.from as `0x${string}`,\n transactions,\n };\n\n return transactionParams;\n};\n\nexport const findAndUpdateTransactionsInBatch = ({\n messenger,\n updateTransactionFn,\n batchId,\n txDataByType,\n}: {\n messenger: BridgeStatusControllerMessenger;\n updateTransactionFn: typeof TransactionController.prototype.updateTransaction;\n batchId: string;\n txDataByType: { [key in TransactionType]?: string };\n}) => {\n const txs = messenger.call('TransactionController:getState').transactions;\n const txBatch: {\n approvalMeta?: TransactionMeta;\n tradeMeta?: TransactionMeta;\n } = {\n approvalMeta: undefined,\n tradeMeta: undefined,\n };\n\n // This is a workaround to update the tx type after the tx is signed\n // TODO: remove this once the tx type for batch txs is preserved in the tx controller\n Object.entries(txDataByType).forEach(([txType, txData]) => {\n // Find transaction by batchId and either matching data or delegation characteristics\n const txMeta = txs.find((tx) => {\n if (tx.batchId !== batchId) {\n return false;\n }\n\n // For 7702 delegated transactions, check for delegation-specific fields\n // These transactions might have authorizationList or delegationAddress\n const is7702Transaction =\n (Array.isArray(tx.txParams.authorizationList) &&\n tx.txParams.authorizationList.length > 0) ||\n Boolean(tx.delegationAddress);\n\n if (is7702Transaction) {\n // For 7702 transactions, we need to match based on transaction type\n // since the data field might be different (batch execute call)\n if (\n txType === TransactionType.swap &&\n tx.type === TransactionType.batch\n ) {\n return true;\n }\n // Also check if it's an approval transaction for 7702\n if (\n txType === TransactionType.swapApproval &&\n tx.txParams.data === txData\n ) {\n return true;\n }\n }\n\n // Default matching logic for non-7702 transactions\n return tx.txParams.data === txData;\n });\n\n if (txMeta) {\n const updatedTx = { ...txMeta, type: txType as TransactionType };\n updateTransactionFn(updatedTx, `Update tx type to ${txType}`);\n txBatch[\n [TransactionType.bridgeApproval, TransactionType.swapApproval].includes(\n txType as TransactionType,\n )\n ? 'approvalMeta'\n : 'tradeMeta'\n ] = updatedTx;\n }\n });\n\n return txBatch;\n};\n\n/**\n * Determines the key to use for storing a bridge history item.\n * Uses actionId for pre-submission tracking, or bridgeTxMetaId for post-submission.\n *\n * @param actionId - The action ID used for pre-submission tracking\n * @param bridgeTxMetaId - The transaction meta ID from bridgeTxMeta\n * @returns The key to use for the history item\n * @throws Error if neither actionId nor bridgeTxMetaId is provided\n */\nexport function getHistoryKey(\n actionId: string | undefined,\n bridgeTxMetaId: string | undefined,\n): string {\n const historyKey = actionId ?? bridgeTxMetaId;\n if (!historyKey) {\n throw new Error(\n 'Cannot add tx to history: either actionId or bridgeTxMeta.id must be provided',\n );\n }\n return historyKey;\n}\n\n/**\n * Extracts and validates the intent data from a quote response.\n *\n * @param quoteResponse - The quote response that may contain intent data\n * @returns The intent data from the quote\n * @throws Error if the quote does not contain intent data\n */\nexport function getIntentFromQuote(\n quoteResponse: QuoteResponse & { quote: { intent?: Intent } },\n): Intent {\n const { intent } = quoteResponse.quote;\n if (!intent) {\n throw new Error('submitIntent: missing intent data');\n }\n return intent;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"transaction.cjs","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,mEAA0E;AAM1E,iEAAmD;AACnD,6EAG0C;AAO1C,2CAAsD;AAEtD,6CAAiD;AACjD,mCAAyC;AACzC,2CAAwD;AACxD,gDAAiD;AAG1C,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AAAjE,QAAA,gBAAgB,oBAAiD;AAEvE,MAAM,sBAAsB,GAAG,CAAC,aAA4B,EAAE,EAAE;IACrE,OAAO;QACL,QAAQ,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ;QACtC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QACtC,UAAU,EAAE,aAAa,CAAC,KAAK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, formatChainIdToHex } from '@metamask/bridge-controller';\nimport type {\n QuoteMetadata,\n QuoteResponse,\n TxData,\n} from '@metamask/bridge-controller';\nimport { toHex } from '@metamask/controller-utils';\nimport {\n TransactionStatus,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type {\n BatchTransactionParams,\n TransactionController,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { TransactionBatchSingleRequest } from '@metamask/transaction-controller';\nimport { createProjectLogger } from '@metamask/utils';\n\nimport { getAccountByAddress } from './accounts';\nimport { calculateGasFees } from './gas';\nimport { getNetworkClientIdByChainId } from './network';\nimport { APPROVAL_DELAY_MS } from '../constants';\nimport type { BridgeStatusControllerMessenger } from '../types';\n\nexport const generateActionId = () => (Date.now() + Math.random()).toString();\n\nexport const getStatusRequestParams = (quoteResponse: QuoteResponse) => {\n return {\n bridgeId: quoteResponse.quote.bridgeId,\n bridge: quoteResponse.quote.bridges[0],\n srcChainId: quoteResponse.quote.srcChainId,\n destChainId: quoteResponse.quote.destChainId,\n quote: quoteResponse.quote,\n refuel: Boolean(quoteResponse.quote.refuel),\n };\n};\n\nexport const handleApprovalDelay = async (\n srcChainId: QuoteResponse['quote']['srcChainId'],\n) => {\n if ([ChainId.LINEA, ChainId.BASE].includes(srcChainId)) {\n const debugLog = createProjectLogger('bridge');\n debugLog(\n 'Delaying submitting bridge tx to make Linea and Base confirmation more likely',\n );\n const waitPromise = new Promise((resolve) =>\n setTimeout(resolve, APPROVAL_DELAY_MS),\n );\n await waitPromise;\n }\n};\n\n/**\n * Adds a delay for hardware wallet transactions on mobile to fix an issue\n * where the Ledger does not get prompted for the 2nd approval.\n * Extension does not have this issue.\n *\n * @param requireApproval - Whether the delay should be applied\n */\nexport const handleMobileHardwareWalletDelay = async (\n requireApproval: boolean,\n) => {\n if (requireApproval) {\n const mobileHardwareWalletDelay = new Promise((resolve) =>\n setTimeout(resolve, 1000),\n );\n await mobileHardwareWalletDelay;\n }\n};\n\nexport const waitForTxConfirmation = async (\n messenger: BridgeStatusControllerMessenger,\n txId: string,\n {\n timeoutMs = 5 * 60_000,\n pollMs = 3_000,\n }: { timeoutMs?: number; pollMs?: number } = {},\n): Promise<TransactionMeta> => {\n const start = Date.now();\n while (true) {\n const { transactions } = messenger.call('TransactionController:getState');\n const meta = transactions.find((tx: TransactionMeta) => tx.id === txId);\n\n if (meta) {\n if (meta.status === TransactionStatus.confirmed) {\n return meta;\n }\n if (\n meta.status === TransactionStatus.failed ||\n meta.status === TransactionStatus.dropped ||\n meta.status === TransactionStatus.rejected\n ) {\n throw new Error('Approval transaction did not confirm');\n }\n }\n\n if (Date.now() - start > timeoutMs) {\n throw new Error('Timed out waiting for approval confirmation');\n }\n\n await new Promise((resolve) => setTimeout(resolve, pollMs));\n }\n};\n\nexport const toBatchTxParams = (\n skipGasFields: boolean,\n { chainId, gasLimit, ...trade }: TxData,\n {\n maxFeePerGas,\n maxPriorityFeePerGas,\n gas,\n }: { maxFeePerGas?: string; maxPriorityFeePerGas?: string; gas?: string },\n): BatchTransactionParams => {\n const params = {\n ...trade,\n data: trade.data as `0x${string}`,\n to: trade.to as `0x${string}`,\n value: trade.value as `0x${string}`,\n };\n if (skipGasFields) {\n return params;\n }\n\n return {\n ...params,\n gas: toHex(gas ?? 0),\n maxFeePerGas: toHex(maxFeePerGas ?? 0),\n maxPriorityFeePerGas: toHex(maxPriorityFeePerGas ?? 0),\n };\n};\n\nexport const getAddTransactionBatchParams = async ({\n messenger,\n isBridgeTx,\n approval,\n resetApproval,\n trade,\n quoteResponse: {\n quote: {\n feeData: { txFee },\n gasIncluded,\n gasIncluded7702,\n gasSponsored,\n },\n sentAmount,\n toTokenAmount,\n },\n requireApproval = false,\n isDelegatedAccount = false,\n}: {\n messenger: BridgeStatusControllerMessenger;\n isBridgeTx: boolean;\n trade: TxData;\n quoteResponse: Omit<QuoteResponse, 'approval' | 'trade'> &\n Partial<QuoteMetadata>;\n approval?: TxData;\n resetApproval?: TxData;\n requireApproval?: boolean;\n isDelegatedAccount?: boolean;\n}) => {\n const isGasless = gasIncluded || gasIncluded7702;\n const selectedAccount = getAccountByAddress(messenger, trade.from);\n if (!selectedAccount) {\n throw new Error(\n 'Failed to submit cross-chain swap batch transaction: unknown account in trade data',\n );\n }\n const hexChainId = formatChainIdToHex(trade.chainId);\n const networkClientId = getNetworkClientIdByChainId(messenger, hexChainId);\n\n // Gas fields should be omitted only when gas is sponsored via 7702\n const skipGasFields = gasIncluded7702 === true;\n // Enable 7702 batching when the quote includes gasless 7702 support,\n // or when the account is already delegated (to avoid the in-flight\n // transaction limit for delegated accounts)\n const disable7702 = !skipGasFields && !isDelegatedAccount;\n const transactions: TransactionBatchSingleRequest[] = [];\n if (resetApproval) {\n const gasFees = await calculateGasFees(\n skipGasFields,\n messenger,\n resetApproval,\n networkClientId,\n hexChainId,\n isGasless ? txFee : undefined,\n );\n transactions.push({\n type: isBridgeTx\n ? TransactionType.bridgeApproval\n : TransactionType.swapApproval,\n params: toBatchTxParams(skipGasFields, resetApproval, gasFees),\n });\n }\n if (approval) {\n const gasFees = await calculateGasFees(\n skipGasFields,\n messenger,\n approval,\n networkClientId,\n hexChainId,\n isGasless ? txFee : undefined,\n );\n transactions.push({\n type: isBridgeTx\n ? TransactionType.bridgeApproval\n : TransactionType.swapApproval,\n params: toBatchTxParams(skipGasFields, approval, gasFees),\n });\n }\n const gasFees = await calculateGasFees(\n skipGasFields,\n messenger,\n trade,\n networkClientId,\n hexChainId,\n isGasless ? txFee : undefined,\n );\n transactions.push({\n type: isBridgeTx ? TransactionType.bridge : TransactionType.swap,\n params: toBatchTxParams(skipGasFields, trade, gasFees),\n assetsFiatValues: {\n sending: sentAmount?.valueInCurrency?.toString(),\n receiving: toTokenAmount?.valueInCurrency?.toString(),\n },\n });\n const transactionParams: Parameters<\n TransactionController['addTransactionBatch']\n >[0] = {\n disable7702,\n isGasFeeIncluded: Boolean(gasIncluded7702),\n isGasFeeSponsored: Boolean(gasSponsored),\n networkClientId,\n requireApproval,\n origin: 'metamask',\n from: trade.from as `0x${string}`,\n transactions,\n };\n\n return transactionParams;\n};\n\nexport const findAndUpdateTransactionsInBatch = ({\n messenger,\n batchId,\n txDataByType,\n}: {\n messenger: BridgeStatusControllerMessenger;\n batchId: string;\n txDataByType: { [key in TransactionType]?: string };\n}) => {\n const txs = messenger.call('TransactionController:getState').transactions;\n const txBatch: {\n approvalMeta?: TransactionMeta;\n tradeMeta?: TransactionMeta;\n } = {\n approvalMeta: undefined,\n tradeMeta: undefined,\n };\n\n // This is a workaround to update the tx type after the tx is signed\n // TODO: remove this once the tx type for batch txs is preserved in the tx controller\n Object.entries(txDataByType).forEach(([txType, txData]) => {\n // Skip types not present in the batch (e.g. swap entry is undefined for bridge txs)\n if (txData === undefined) {\n return;\n }\n\n // Find transaction by batchId and either matching data or delegation characteristics\n const txMeta = txs.find((tx: TransactionMeta) => {\n if (tx.batchId !== batchId) {\n return false;\n }\n\n // For 7702 delegated transactions, check for delegation-specific fields\n // These transactions might have authorizationList or delegationAddress\n const is7702Transaction =\n (Array.isArray(tx.txParams.authorizationList) &&\n tx.txParams.authorizationList.length > 0) ||\n Boolean(tx.delegationAddress);\n\n if (is7702Transaction) {\n // For 7702 transactions, we need to match based on transaction type\n // since the data field might be different (batch execute call)\n if (\n (txType === TransactionType.swap ||\n txType === TransactionType.bridge) &&\n tx.type === TransactionType.batch\n ) {\n return true;\n }\n // Also check if it's an approval transaction for 7702\n if (\n (txType === TransactionType.swapApproval ||\n txType === TransactionType.bridgeApproval) &&\n tx.txParams.data === txData\n ) {\n return true;\n }\n }\n\n // Default matching logic for non-7702 transactions\n return tx.txParams.data === txData;\n });\n\n if (txMeta) {\n const updatedTx = { ...txMeta, type: txType as TransactionType };\n messenger.call(\n 'TransactionController:updateTransaction',\n updatedTx,\n `Update tx type to ${txType}`,\n );\n txBatch[\n [TransactionType.bridgeApproval, TransactionType.swapApproval].includes(\n txType as TransactionType,\n )\n ? 'approvalMeta'\n : 'tradeMeta'\n ] = updatedTx;\n }\n });\n\n return txBatch;\n};\n"]}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Intent, QuoteMetadata, QuoteResponse, Trade, TxData } from "@metamask/bridge-controller";
|
|
1
|
+
import type { QuoteMetadata, QuoteResponse, TxData } from "@metamask/bridge-controller";
|
|
3
2
|
import { TransactionType } from "@metamask/transaction-controller";
|
|
4
|
-
import type { BatchTransactionParams,
|
|
5
|
-
import type { BridgeStatusControllerMessenger
|
|
6
|
-
import type { BridgeStatusControllerState } from "../types.cjs";
|
|
3
|
+
import type { BatchTransactionParams, TransactionMeta } from "@metamask/transaction-controller";
|
|
4
|
+
import type { BridgeStatusControllerMessenger } from "../types.cjs";
|
|
7
5
|
export declare const generateActionId: () => string;
|
|
8
6
|
export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
9
7
|
bridgeId: string;
|
|
@@ -173,24 +171,6 @@ export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
|
173
171
|
};
|
|
174
172
|
refuel: boolean;
|
|
175
173
|
};
|
|
176
|
-
export declare const getTxMetaFields: (quoteResponse: Omit<QuoteResponse<Trade, Trade>, 'approval' | 'trade'> & QuoteMetadata, approvalTxId?: string) => Omit<TransactionMeta, 'networkClientId' | 'status' | 'time' | 'txParams' | 'id' | 'chainId'>;
|
|
177
|
-
/**
|
|
178
|
-
* Handles the response from non-EVM transaction submission
|
|
179
|
-
* Works with the new unified ClientRequest:signAndSendTransaction interface
|
|
180
|
-
* Supports Solana, Bitcoin, and other non-EVM chains
|
|
181
|
-
*
|
|
182
|
-
* @param snapResponse - The response from the snap after transaction submission
|
|
183
|
-
* @param quoteResponse - The quote response containing trade details and metadata
|
|
184
|
-
* @param selectedAccount - The selected account information
|
|
185
|
-
* @returns The transaction metadata including non-EVM specific fields
|
|
186
|
-
*/
|
|
187
|
-
export declare const handleNonEvmTxResponse: (snapResponse: string | {
|
|
188
|
-
transactionId: string;
|
|
189
|
-
} | {
|
|
190
|
-
result: Record<string, string>;
|
|
191
|
-
} | {
|
|
192
|
-
signature: string;
|
|
193
|
-
}, quoteResponse: Omit<QuoteResponse<Trade>, 'approval'> & QuoteMetadata, selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string]) => TransactionMeta & SolanaTransactionMeta;
|
|
194
174
|
export declare const handleApprovalDelay: (srcChainId: QuoteResponse['quote']['srcChainId']) => Promise<void>;
|
|
195
175
|
/**
|
|
196
176
|
* Adds a delay for hardware wallet transactions on mobile to fix an issue
|
|
@@ -200,50 +180,20 @@ export declare const handleApprovalDelay: (srcChainId: QuoteResponse['quote']['s
|
|
|
200
180
|
* @param requireApproval - Whether the delay should be applied
|
|
201
181
|
*/
|
|
202
182
|
export declare const handleMobileHardwareWalletDelay: (requireApproval: boolean) => Promise<void>;
|
|
203
|
-
/**
|
|
204
|
-
* Creates a request to sign and send a transaction for non-EVM chains
|
|
205
|
-
* Uses the new unified ClientRequest:signAndSendTransaction interface
|
|
206
|
-
*
|
|
207
|
-
* @param trade - The trade data
|
|
208
|
-
* @param srcChainId - The source chain ID
|
|
209
|
-
* @param selectedAccount - The selected account information
|
|
210
|
-
* @returns The snap request object for signing and sending transaction
|
|
211
|
-
*/
|
|
212
|
-
export declare const getClientRequest: (trade: Trade, srcChainId: number, selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string]) => {
|
|
213
|
-
snapId: never;
|
|
214
|
-
origin: string;
|
|
215
|
-
handler: never;
|
|
216
|
-
request: {
|
|
217
|
-
id: string;
|
|
218
|
-
jsonrpc: string;
|
|
219
|
-
method: string;
|
|
220
|
-
params: {
|
|
221
|
-
options?: Record<string, unknown> | undefined;
|
|
222
|
-
transaction: string;
|
|
223
|
-
scope: `${string}:${string}`;
|
|
224
|
-
accountId: string;
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
183
|
export declare const waitForTxConfirmation: (messenger: BridgeStatusControllerMessenger, txId: string, { timeoutMs, pollMs, }?: {
|
|
229
184
|
timeoutMs?: number | undefined;
|
|
230
185
|
pollMs?: number | undefined;
|
|
231
186
|
}) => Promise<TransactionMeta>;
|
|
232
|
-
export declare const
|
|
233
|
-
id: string;
|
|
234
|
-
hash?: string;
|
|
235
|
-
}) => boolean;
|
|
236
|
-
export declare const toBatchTxParams: (disable7702: boolean, { chainId, gasLimit, ...trade }: TxData, { maxFeePerGas, maxPriorityFeePerGas, gas, }: {
|
|
187
|
+
export declare const toBatchTxParams: (skipGasFields: boolean, { chainId, gasLimit, ...trade }: TxData, { maxFeePerGas, maxPriorityFeePerGas, gas, }: {
|
|
237
188
|
maxFeePerGas?: string | undefined;
|
|
238
189
|
maxPriorityFeePerGas?: string | undefined;
|
|
239
190
|
gas?: string | undefined;
|
|
240
191
|
}) => BatchTransactionParams;
|
|
241
|
-
export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, approval, resetApproval, trade, quoteResponse: { quote: { feeData: { txFee }, gasIncluded, gasIncluded7702, gasSponsored, }, sentAmount, toTokenAmount, }, requireApproval,
|
|
192
|
+
export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, approval, resetApproval, trade, quoteResponse: { quote: { feeData: { txFee }, gasIncluded, gasIncluded7702, gasSponsored, }, sentAmount, toTokenAmount, }, requireApproval, isDelegatedAccount, }: {
|
|
242
193
|
messenger: BridgeStatusControllerMessenger;
|
|
243
194
|
isBridgeTx: boolean;
|
|
244
195
|
trade: TxData;
|
|
245
196
|
quoteResponse: Omit<QuoteResponse, 'approval' | 'trade'> & Partial<QuoteMetadata>;
|
|
246
|
-
estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee;
|
|
247
197
|
approval?: {
|
|
248
198
|
chainId: number;
|
|
249
199
|
from: string;
|
|
@@ -263,10 +213,10 @@ export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, app
|
|
|
263
213
|
effectiveGas?: number | undefined;
|
|
264
214
|
} | undefined;
|
|
265
215
|
requireApproval?: boolean | undefined;
|
|
216
|
+
isDelegatedAccount?: boolean | undefined;
|
|
266
217
|
}) => Promise<import("@metamask/transaction-controller").TransactionBatchRequest>;
|
|
267
|
-
export declare const findAndUpdateTransactionsInBatch: ({ messenger,
|
|
218
|
+
export declare const findAndUpdateTransactionsInBatch: ({ messenger, batchId, txDataByType, }: {
|
|
268
219
|
messenger: BridgeStatusControllerMessenger;
|
|
269
|
-
updateTransactionFn: typeof TransactionController.prototype.updateTransaction;
|
|
270
220
|
batchId: string;
|
|
271
221
|
txDataByType: {
|
|
272
222
|
batch?: string | undefined;
|
|
@@ -292,6 +242,7 @@ export declare const findAndUpdateTransactionsInBatch: ({ messenger, updateTrans
|
|
|
292
242
|
predictBuy?: string | undefined;
|
|
293
243
|
predictClaim?: string | undefined;
|
|
294
244
|
predictDeposit?: string | undefined;
|
|
245
|
+
predictDepositAndOrder?: string | undefined;
|
|
295
246
|
predictSell?: string | undefined;
|
|
296
247
|
predictWithdraw?: string | undefined;
|
|
297
248
|
predictRelayDeposit?: string | undefined;
|
|
@@ -319,26 +270,4 @@ export declare const findAndUpdateTransactionsInBatch: ({ messenger, updateTrans
|
|
|
319
270
|
approvalMeta?: TransactionMeta | undefined;
|
|
320
271
|
tradeMeta?: TransactionMeta | undefined;
|
|
321
272
|
};
|
|
322
|
-
/**
|
|
323
|
-
* Determines the key to use for storing a bridge history item.
|
|
324
|
-
* Uses actionId for pre-submission tracking, or bridgeTxMetaId for post-submission.
|
|
325
|
-
*
|
|
326
|
-
* @param actionId - The action ID used for pre-submission tracking
|
|
327
|
-
* @param bridgeTxMetaId - The transaction meta ID from bridgeTxMeta
|
|
328
|
-
* @returns The key to use for the history item
|
|
329
|
-
* @throws Error if neither actionId nor bridgeTxMetaId is provided
|
|
330
|
-
*/
|
|
331
|
-
export declare function getHistoryKey(actionId: string | undefined, bridgeTxMetaId: string | undefined): string;
|
|
332
|
-
/**
|
|
333
|
-
* Extracts and validates the intent data from a quote response.
|
|
334
|
-
*
|
|
335
|
-
* @param quoteResponse - The quote response that may contain intent data
|
|
336
|
-
* @returns The intent data from the quote
|
|
337
|
-
* @throws Error if the quote does not contain intent data
|
|
338
|
-
*/
|
|
339
|
-
export declare function getIntentFromQuote(quoteResponse: QuoteResponse & {
|
|
340
|
-
quote: {
|
|
341
|
-
intent?: Intent;
|
|
342
|
-
};
|
|
343
|
-
}): Intent;
|
|
344
273
|
//# sourceMappingURL=transaction.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.cts","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction.d.cts","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,MAAM,EACP,oCAAoC;AAErC,OAAO,EAEL,eAAe,EAChB,yCAAyC;AAC1C,OAAO,KAAK,EACV,sBAAsB,EAEtB,eAAe,EAChB,yCAAyC;AAQ1C,OAAO,KAAK,EAAE,+BAA+B,EAAE,qBAAiB;AAEhE,eAAO,MAAM,gBAAgB,cAAgD,CAAC;AAE9E,eAAO,MAAM,sBAAsB,kBAAmB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASlE,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAClB,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,kBAYjD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,oBACzB,OAAO,kBAQzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,qDAE1B,MAAM;;;MAKX,QAAQ,eAAe,CAyBzB,CAAC;AAEF,eAAO,MAAM,eAAe,kBACX,OAAO,mCACW,MAAM;;;;MAMtC,sBAiBF,CAAC;AAEF,eAAO,MAAM,4BAA4B;;gBAoB3B,OAAO;WACZ,MAAM;mBACE,KAAK,aAAa,EAAE,UAAU,GAAG,OAAO,CAAC,GACtD,QAAQ,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;iFAqFzB,CAAC;AAEF,eAAO,MAAM,gCAAgC;;aAMlC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EhB,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Intent, QuoteMetadata, QuoteResponse, Trade, TxData } from "@metamask/bridge-controller";
|
|
1
|
+
import type { QuoteMetadata, QuoteResponse, TxData } from "@metamask/bridge-controller";
|
|
3
2
|
import { TransactionType } from "@metamask/transaction-controller";
|
|
4
|
-
import type { BatchTransactionParams,
|
|
5
|
-
import type { BridgeStatusControllerMessenger
|
|
6
|
-
import type { BridgeStatusControllerState } from "../types.mjs";
|
|
3
|
+
import type { BatchTransactionParams, TransactionMeta } from "@metamask/transaction-controller";
|
|
4
|
+
import type { BridgeStatusControllerMessenger } from "../types.mjs";
|
|
7
5
|
export declare const generateActionId: () => string;
|
|
8
6
|
export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
9
7
|
bridgeId: string;
|
|
@@ -173,24 +171,6 @@ export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
|
173
171
|
};
|
|
174
172
|
refuel: boolean;
|
|
175
173
|
};
|
|
176
|
-
export declare const getTxMetaFields: (quoteResponse: Omit<QuoteResponse<Trade, Trade>, 'approval' | 'trade'> & QuoteMetadata, approvalTxId?: string) => Omit<TransactionMeta, 'networkClientId' | 'status' | 'time' | 'txParams' | 'id' | 'chainId'>;
|
|
177
|
-
/**
|
|
178
|
-
* Handles the response from non-EVM transaction submission
|
|
179
|
-
* Works with the new unified ClientRequest:signAndSendTransaction interface
|
|
180
|
-
* Supports Solana, Bitcoin, and other non-EVM chains
|
|
181
|
-
*
|
|
182
|
-
* @param snapResponse - The response from the snap after transaction submission
|
|
183
|
-
* @param quoteResponse - The quote response containing trade details and metadata
|
|
184
|
-
* @param selectedAccount - The selected account information
|
|
185
|
-
* @returns The transaction metadata including non-EVM specific fields
|
|
186
|
-
*/
|
|
187
|
-
export declare const handleNonEvmTxResponse: (snapResponse: string | {
|
|
188
|
-
transactionId: string;
|
|
189
|
-
} | {
|
|
190
|
-
result: Record<string, string>;
|
|
191
|
-
} | {
|
|
192
|
-
signature: string;
|
|
193
|
-
}, quoteResponse: Omit<QuoteResponse<Trade>, 'approval'> & QuoteMetadata, selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string]) => TransactionMeta & SolanaTransactionMeta;
|
|
194
174
|
export declare const handleApprovalDelay: (srcChainId: QuoteResponse['quote']['srcChainId']) => Promise<void>;
|
|
195
175
|
/**
|
|
196
176
|
* Adds a delay for hardware wallet transactions on mobile to fix an issue
|
|
@@ -200,50 +180,20 @@ export declare const handleApprovalDelay: (srcChainId: QuoteResponse['quote']['s
|
|
|
200
180
|
* @param requireApproval - Whether the delay should be applied
|
|
201
181
|
*/
|
|
202
182
|
export declare const handleMobileHardwareWalletDelay: (requireApproval: boolean) => Promise<void>;
|
|
203
|
-
/**
|
|
204
|
-
* Creates a request to sign and send a transaction for non-EVM chains
|
|
205
|
-
* Uses the new unified ClientRequest:signAndSendTransaction interface
|
|
206
|
-
*
|
|
207
|
-
* @param trade - The trade data
|
|
208
|
-
* @param srcChainId - The source chain ID
|
|
209
|
-
* @param selectedAccount - The selected account information
|
|
210
|
-
* @returns The snap request object for signing and sending transaction
|
|
211
|
-
*/
|
|
212
|
-
export declare const getClientRequest: (trade: Trade, srcChainId: number, selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string]) => {
|
|
213
|
-
snapId: never;
|
|
214
|
-
origin: string;
|
|
215
|
-
handler: never;
|
|
216
|
-
request: {
|
|
217
|
-
id: string;
|
|
218
|
-
jsonrpc: string;
|
|
219
|
-
method: string;
|
|
220
|
-
params: {
|
|
221
|
-
options?: Record<string, unknown> | undefined;
|
|
222
|
-
transaction: string;
|
|
223
|
-
scope: `${string}:${string}`;
|
|
224
|
-
accountId: string;
|
|
225
|
-
};
|
|
226
|
-
};
|
|
227
|
-
};
|
|
228
183
|
export declare const waitForTxConfirmation: (messenger: BridgeStatusControllerMessenger, txId: string, { timeoutMs, pollMs, }?: {
|
|
229
184
|
timeoutMs?: number | undefined;
|
|
230
185
|
pollMs?: number | undefined;
|
|
231
186
|
}) => Promise<TransactionMeta>;
|
|
232
|
-
export declare const
|
|
233
|
-
id: string;
|
|
234
|
-
hash?: string;
|
|
235
|
-
}) => boolean;
|
|
236
|
-
export declare const toBatchTxParams: (disable7702: boolean, { chainId, gasLimit, ...trade }: TxData, { maxFeePerGas, maxPriorityFeePerGas, gas, }: {
|
|
187
|
+
export declare const toBatchTxParams: (skipGasFields: boolean, { chainId, gasLimit, ...trade }: TxData, { maxFeePerGas, maxPriorityFeePerGas, gas, }: {
|
|
237
188
|
maxFeePerGas?: string | undefined;
|
|
238
189
|
maxPriorityFeePerGas?: string | undefined;
|
|
239
190
|
gas?: string | undefined;
|
|
240
191
|
}) => BatchTransactionParams;
|
|
241
|
-
export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, approval, resetApproval, trade, quoteResponse: { quote: { feeData: { txFee }, gasIncluded, gasIncluded7702, gasSponsored, }, sentAmount, toTokenAmount, }, requireApproval,
|
|
192
|
+
export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, approval, resetApproval, trade, quoteResponse: { quote: { feeData: { txFee }, gasIncluded, gasIncluded7702, gasSponsored, }, sentAmount, toTokenAmount, }, requireApproval, isDelegatedAccount, }: {
|
|
242
193
|
messenger: BridgeStatusControllerMessenger;
|
|
243
194
|
isBridgeTx: boolean;
|
|
244
195
|
trade: TxData;
|
|
245
196
|
quoteResponse: Omit<QuoteResponse, 'approval' | 'trade'> & Partial<QuoteMetadata>;
|
|
246
|
-
estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee;
|
|
247
197
|
approval?: {
|
|
248
198
|
chainId: number;
|
|
249
199
|
from: string;
|
|
@@ -263,10 +213,10 @@ export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, app
|
|
|
263
213
|
effectiveGas?: number | undefined;
|
|
264
214
|
} | undefined;
|
|
265
215
|
requireApproval?: boolean | undefined;
|
|
216
|
+
isDelegatedAccount?: boolean | undefined;
|
|
266
217
|
}) => Promise<import("@metamask/transaction-controller").TransactionBatchRequest>;
|
|
267
|
-
export declare const findAndUpdateTransactionsInBatch: ({ messenger,
|
|
218
|
+
export declare const findAndUpdateTransactionsInBatch: ({ messenger, batchId, txDataByType, }: {
|
|
268
219
|
messenger: BridgeStatusControllerMessenger;
|
|
269
|
-
updateTransactionFn: typeof TransactionController.prototype.updateTransaction;
|
|
270
220
|
batchId: string;
|
|
271
221
|
txDataByType: {
|
|
272
222
|
batch?: string | undefined;
|
|
@@ -292,6 +242,7 @@ export declare const findAndUpdateTransactionsInBatch: ({ messenger, updateTrans
|
|
|
292
242
|
predictBuy?: string | undefined;
|
|
293
243
|
predictClaim?: string | undefined;
|
|
294
244
|
predictDeposit?: string | undefined;
|
|
245
|
+
predictDepositAndOrder?: string | undefined;
|
|
295
246
|
predictSell?: string | undefined;
|
|
296
247
|
predictWithdraw?: string | undefined;
|
|
297
248
|
predictRelayDeposit?: string | undefined;
|
|
@@ -319,26 +270,4 @@ export declare const findAndUpdateTransactionsInBatch: ({ messenger, updateTrans
|
|
|
319
270
|
approvalMeta?: TransactionMeta | undefined;
|
|
320
271
|
tradeMeta?: TransactionMeta | undefined;
|
|
321
272
|
};
|
|
322
|
-
/**
|
|
323
|
-
* Determines the key to use for storing a bridge history item.
|
|
324
|
-
* Uses actionId for pre-submission tracking, or bridgeTxMetaId for post-submission.
|
|
325
|
-
*
|
|
326
|
-
* @param actionId - The action ID used for pre-submission tracking
|
|
327
|
-
* @param bridgeTxMetaId - The transaction meta ID from bridgeTxMeta
|
|
328
|
-
* @returns The key to use for the history item
|
|
329
|
-
* @throws Error if neither actionId nor bridgeTxMetaId is provided
|
|
330
|
-
*/
|
|
331
|
-
export declare function getHistoryKey(actionId: string | undefined, bridgeTxMetaId: string | undefined): string;
|
|
332
|
-
/**
|
|
333
|
-
* Extracts and validates the intent data from a quote response.
|
|
334
|
-
*
|
|
335
|
-
* @param quoteResponse - The quote response that may contain intent data
|
|
336
|
-
* @returns The intent data from the quote
|
|
337
|
-
* @throws Error if the quote does not contain intent data
|
|
338
|
-
*/
|
|
339
|
-
export declare function getIntentFromQuote(quoteResponse: QuoteResponse & {
|
|
340
|
-
quote: {
|
|
341
|
-
intent?: Intent;
|
|
342
|
-
};
|
|
343
|
-
}): Intent;
|
|
344
273
|
//# sourceMappingURL=transaction.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,MAAM,EACP,oCAAoC;AAErC,OAAO,EAEL,eAAe,EAChB,yCAAyC;AAC1C,OAAO,KAAK,EACV,sBAAsB,EAEtB,eAAe,EAChB,yCAAyC;AAQ1C,OAAO,KAAK,EAAE,+BAA+B,EAAE,qBAAiB;AAEhE,eAAO,MAAM,gBAAgB,cAAgD,CAAC;AAE9E,eAAO,MAAM,sBAAsB,kBAAmB,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASlE,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAClB,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC,kBAYjD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,+BAA+B,oBACzB,OAAO,kBAQzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,qDAE1B,MAAM;;;MAKX,QAAQ,eAAe,CAyBzB,CAAC;AAEF,eAAO,MAAM,eAAe,kBACX,OAAO,mCACW,MAAM;;;;MAMtC,sBAiBF,CAAC;AAEF,eAAO,MAAM,4BAA4B;;gBAoB3B,OAAO;WACZ,MAAM;mBACE,KAAK,aAAa,EAAE,UAAU,GAAG,OAAO,CAAC,GACtD,QAAQ,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;iFAqFzB,CAAC;AAEF,eAAO,MAAM,gCAAgC;;aAMlC,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EhB,CAAC"}
|