@metamask-previews/bridge-status-controller 33.0.0-preview-6fc9506d → 34.0.0-preview-52f43d2
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 +13 -1
- package/dist/bridge-status-controller.cjs +104 -77
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +3 -1
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +3 -1
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +106 -79
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +1 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/gas.cjs +34 -1
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.d.cts +7 -0
- package/dist/utils/gas.d.cts.map +1 -1
- package/dist/utils/gas.d.mts +7 -0
- package/dist/utils/gas.d.mts.map +1 -1
- package/dist/utils/gas.mjs +32 -0
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/metrics.cjs +9 -4
- package/dist/utils/metrics.cjs.map +1 -1
- package/dist/utils/metrics.d.cts +1 -1
- package/dist/utils/metrics.d.cts.map +1 -1
- package/dist/utils/metrics.d.mts +1 -1
- package/dist/utils/metrics.d.mts.map +1 -1
- package/dist/utils/metrics.mjs +9 -4
- package/dist/utils/metrics.mjs.map +1 -1
- package/dist/utils/transaction.cjs +100 -1
- package/dist/utils/transaction.cjs.map +1 -1
- package/dist/utils/transaction.d.cts +80 -2
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +80 -2
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/transaction.mjs +96 -1
- package/dist/utils/transaction.mjs.map +1 -1
- package/package.json +1 -1
package/dist/types.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAsCA,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AA0CD,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;AAiCD,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\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 TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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; // Need this to handle STX that might not have a txHash immediately\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']['usd'];\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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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};\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<string | TxData> & 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<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\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 = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAsCA,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AA0CD,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;AAkCD,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,kCAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\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 TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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; // Need this to handle STX that might not have a txHash immediately\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']['usd'];\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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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};\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<string | TxData> & 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<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\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 = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
package/dist/types.d.cts
CHANGED
@@ -60,6 +60,7 @@ export type StatusResponse = Infer<typeof StatusResponseSchema>;
|
|
60
60
|
export type RefuelStatusResponse = object & StatusResponse;
|
61
61
|
export type BridgeHistoryItem = {
|
62
62
|
txMetaId: string;
|
63
|
+
batchId?: string;
|
63
64
|
quote: Quote;
|
64
65
|
status: StatusResponse;
|
65
66
|
startTime?: number;
|
package/dist/types.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2CAA2C,EAC3C,oDAAoD,EACrD,sCAAsC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACpB,kCAAkC;AACnC,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,MAAM,EACP,oCAAoC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,qCAAqC;AACnE,OAAO,KAAK,EACV,mDAAmD,EACnD,2CAA2C,EAC3C,+BAA+B,EAChC,qCAAqC;AACtC,OAAO,KAAK,EAAE,yCAAyC,EAAE,iDAAiD;AAC1G,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AACnD,OAAO,KAAK,EACV,mCAAmC,EACnC,8CAA8C,EAC9C,2CAA2C,EAC3C,eAAe,EAChB,yCAAyC;AAE1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,uCAAmC;AACzE,OAAO,KAAK,EAAE,6BAA6B,EAAE,wBAAoB;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,+BAA2B;AAK/D,oBAAY,cAAc;IACxB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,aAAa,GAAG,CAC1B,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,W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mts
CHANGED
@@ -60,6 +60,7 @@ export type StatusResponse = Infer<typeof StatusResponseSchema>;
|
|
60
60
|
export type RefuelStatusResponse = object & StatusResponse;
|
61
61
|
export type BridgeHistoryItem = {
|
62
62
|
txMetaId: string;
|
63
|
+
batchId?: string;
|
63
64
|
quote: Quote;
|
64
65
|
status: StatusResponse;
|
65
66
|
startTime?: number;
|
package/dist/types.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2CAA2C,EAC3C,oDAAoD,EACrD,sCAAsC;AACvC,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC1B,mBAAmB,EACpB,kCAAkC;AACnC,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,MAAM,EACP,oCAAoC;AACrC,OAAO,KAAK,EAAE,cAAc,EAAE,qCAAqC;AACnE,OAAO,KAAK,EACV,mDAAmD,EACnD,2CAA2C,EAC3C,+BAA+B,EAChC,qCAAqC;AACtC,OAAO,KAAK,EAAE,yCAAyC,EAAE,iDAAiD;AAC1G,OAAO,KAAK,EAAE,iBAAiB,EAAE,oCAAoC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AACnD,OAAO,KAAK,EACV,mCAAmC,EACnC,8CAA8C,EAC9C,2CAA2C,EAC3C,eAAe,EAChB,yCAAyC;AAE1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,uCAAmC;AACzE,OAAO,KAAK,EAAE,6BAA6B,EAAE,wBAAoB;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,+BAA2B;AAK/D,oBAAY,cAAc;IACxB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,MAAM,MAAM,aAAa,GAAG,CAC1B,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC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dist/types.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAsCA,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AA0CD,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;AAiCD,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\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 TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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; // Need this to handle STX that might not have a txHash immediately\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']['usd'];\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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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};\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<string | TxData> & 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<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\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 = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAsCA,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AA0CD,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;AAkCD,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,0FAAoE,CAAA;IACpE,6DAAuC,CAAA;IACvC,4CAAsB,CAAA;IACtB,gDAA0B,CAAA;IAC1B,4CAAsB,CAAA;AACxB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B","sourcesContent":["import type {\n AccountsControllerGetAccountByAddressAction,\n AccountsControllerGetSelectedMultichainAccountAction,\n} from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n RestrictedMessenger,\n} from '@metamask/base-controller';\nimport type {\n BridgeBackgroundAction,\n BridgeControllerAction,\n ChainId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\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 TransactionControllerTransactionConfirmedEvent,\n TransactionControllerTransactionFailedEvent,\n TransactionMeta,\n} from '@metamask/transaction-controller';\n\nimport type { BridgeStatusController } from './bridge-status-controller';\nimport type { 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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\n) => Promise<any>;\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; // Need this to handle STX that might not have a txHash immediately\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']['usd'];\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 isStxEnabled?: boolean;\n};\n\nexport enum BridgeStatusAction {\n START_POLLING_FOR_BRIDGE_TX_STATUS = 'startPollingForBridgeTxStatus',\n WIPE_BRIDGE_STATUS = 'wipeBridgeStatus',\n GET_STATE = 'getState',\n RESET_STATE = 'resetState',\n SUBMIT_TX = 'submitTx',\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};\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<string | TxData> & 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<BridgeStatusAction.START_POLLING_FOR_BRIDGE_TX_STATUS>;\n\nexport type BridgeStatusControllerWipeBridgeStatusAction =\n BridgeStatusControllerAction<BridgeStatusAction.WIPE_BRIDGE_STATUS>;\n\nexport type BridgeStatusControllerResetStateAction =\n BridgeStatusControllerAction<BridgeStatusAction.RESET_STATE>;\n\nexport type BridgeStatusControllerSubmitTxAction =\n BridgeStatusControllerAction<BridgeStatusAction.SUBMIT_TX>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerStartPollingForBridgeTxStatusAction\n | BridgeStatusControllerWipeBridgeStatusAction\n | BridgeStatusControllerResetStateAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerEvents =\n BridgeStatusControllerStateChangeEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | AccountsControllerGetSelectedMultichainAccountAction\n | HandleSnapRequest\n | TransactionControllerGetStateAction\n | BridgeControllerAction<BridgeBackgroundAction.GET_BRIDGE_ERC20_ALLOWANCE>\n | BridgeControllerAction<BridgeBackgroundAction.TRACK_METAMETRICS_EVENT>\n | BridgeControllerAction<BridgeBackgroundAction.STOP_POLLING_FOR_QUOTES>\n | GetGasFeeState\n | AccountsControllerGetAccountByAddressAction\n | RemoteFeatureFlagControllerGetStateAction;\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 = RestrictedMessenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n>;\n"]}
|
package/dist/utils/gas.cjs
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getTxGasEstimates = void 0;
|
3
|
+
exports.calculateGasFees = exports.getTxGasEstimates = void 0;
|
4
|
+
const controller_utils_1 = require("@metamask/controller-utils");
|
4
5
|
const bignumber_js_1 = require("bignumber.js");
|
5
6
|
const getTransaction1559GasFeeEstimates = (txGasFeeEstimates, estimatedBaseFee) => {
|
6
7
|
const { maxFeePerGas, maxPriorityFeePerGas } = txGasFeeEstimates?.high ?? {};
|
@@ -28,4 +29,36 @@ const getTxGasEstimates = ({ txGasFeeEstimates, networkGasFeeEstimates, }) => {
|
|
28
29
|
return getTransaction1559GasFeeEstimates(txGasFeeEstimates, estimatedBaseFee);
|
29
30
|
};
|
30
31
|
exports.getTxGasEstimates = getTxGasEstimates;
|
32
|
+
const calculateGasFees = async (disable7702, messagingSystem, estimateGasFeeFn, { chainId: _, gasLimit, ...trade }, networkClientId, chainId, txFee) => {
|
33
|
+
if (!disable7702) {
|
34
|
+
return {};
|
35
|
+
}
|
36
|
+
if (txFee) {
|
37
|
+
return { ...txFee, gas: gasLimit?.toString() };
|
38
|
+
}
|
39
|
+
const transactionParams = {
|
40
|
+
...trade,
|
41
|
+
gas: gasLimit?.toString(),
|
42
|
+
data: trade.data,
|
43
|
+
to: trade.to,
|
44
|
+
value: trade.value,
|
45
|
+
};
|
46
|
+
const { gasFeeEstimates } = messagingSystem.call('GasFeeController:getState');
|
47
|
+
const { estimates: txGasFeeEstimates } = await estimateGasFeeFn({
|
48
|
+
transactionParams,
|
49
|
+
chainId,
|
50
|
+
networkClientId,
|
51
|
+
});
|
52
|
+
const { maxFeePerGas, maxPriorityFeePerGas } = (0, exports.getTxGasEstimates)({
|
53
|
+
networkGasFeeEstimates: gasFeeEstimates,
|
54
|
+
txGasFeeEstimates,
|
55
|
+
});
|
56
|
+
const maxGasLimit = (0, controller_utils_1.toHex)(transactionParams.gas ?? 0);
|
57
|
+
return {
|
58
|
+
maxFeePerGas,
|
59
|
+
maxPriorityFeePerGas,
|
60
|
+
gas: maxGasLimit,
|
61
|
+
};
|
62
|
+
};
|
63
|
+
exports.calculateGasFees = calculateGasFees;
|
31
64
|
//# sourceMappingURL=gas.cjs.map
|
package/dist/utils/gas.cjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gas.cjs","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"gas.cjs","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":";;;AACA,iEAAmD;AAUnD,+CAAyC;AAIzC,MAAM,iCAAiC,GAAG,CACxC,iBAA2C,EAC3C,gBAAwB,EACxB,EAAE;IACF,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC;IAE7E,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,WAAoB,EACpB,eAAgD,EAChD,gBAAuE,EACvE,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAU,EAC1C,eAAuB,EACvB,OAAY,EACZ,KAA8D,EAC9D,EAAE;IACF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,KAAK,EAAE;QACT,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC;KAChD;IACD,MAAM,iBAAiB,GAAG;QACxB,GAAG,KAAK;QACR,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE;QACzB,IAAI,EAAE,KAAK,CAAC,IAAqB;QACjC,EAAE,EAAE,KAAK,CAAC,EAAmB;QAC7B,KAAK,EAAE,KAAK,CAAC,KAAsB;KACpC,CAAC;IACF,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC9E,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,MAAM,gBAAgB,CAAC;QAC9D,iBAAiB;QACjB,OAAO;QACP,eAAe;KAChB,CAAC,CAAC;IACH,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,IAAA,yBAAiB,EAAC;QAC/D,sBAAsB,EAAE,eAAe;QACvC,iBAAiB;KAClB,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,IAAA,wBAAK,EAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAEtD,OAAO;QACL,YAAY;QACZ,oBAAoB;QACpB,GAAG,EAAE,WAAW;KACjB,CAAC;AACJ,CAAC,CAAC;AAvCW,QAAA,gBAAgB,oBAuC3B","sourcesContent":["import type { 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} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\nimport { BigNumber } from 'bignumber.js';\n\nimport type { BridgeStatusControllerMessenger } from '../types';\n\nconst getTransaction1559GasFeeEstimates = (\n txGasFeeEstimates: FeeMarketGasFeeEstimates,\n estimatedBaseFee: string,\n) => {\n const { maxFeePerGas, maxPriorityFeePerGas } = txGasFeeEstimates?.high ?? {};\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 disable7702: boolean,\n messagingSystem: 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 (!disable7702) {\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 } = messagingSystem.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"]}
|
package/dist/utils/gas.d.cts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
import type { TxData } from "@metamask/bridge-controller";
|
1
2
|
import type { GasFeeState } from "@metamask/gas-fee-controller";
|
2
3
|
import type { TransactionController } from "@metamask/transaction-controller";
|
4
|
+
import type { Hex } from "@metamask/utils";
|
3
5
|
import { BigNumber } from "bignumber.js";
|
6
|
+
import type { BridgeStatusControllerMessenger } from "../types.cjs";
|
4
7
|
/**
|
5
8
|
* Get the gas fee estimates for a transaction
|
6
9
|
*
|
@@ -17,4 +20,8 @@ export declare const getTxGasEstimates: ({ txGasFeeEstimates, networkGasFeeEstim
|
|
17
20
|
maxFeePerGas: `0x${string}`;
|
18
21
|
maxPriorityFeePerGas: `0x${string}`;
|
19
22
|
};
|
23
|
+
export declare const calculateGasFees: (disable7702: boolean, messagingSystem: BridgeStatusControllerMessenger, estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee, { chainId: _, gasLimit, ...trade }: TxData, networkClientId: string, chainId: Hex, txFee?: {
|
24
|
+
maxFeePerGas: string;
|
25
|
+
maxPriorityFeePerGas: string;
|
26
|
+
}) => Promise<{}>;
|
20
27
|
//# sourceMappingURL=gas.d.cts.map
|
package/dist/utils/gas.d.cts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gas.d.cts","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACZ,qCAAqC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACtB,yCAAyC;AAC1C,OAAO,EAAE,SAAS,EAAE,qBAAqB;
|
1
|
+
{"version":3,"file":"gas.d.cts","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,oCAAoC;AAE1D,OAAO,KAAK,EAEV,WAAW,EACZ,qCAAqC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACtB,yCAAyC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAC3C,OAAO,EAAE,SAAS,EAAE,qBAAqB;AAEzC,OAAO,KAAK,EAAE,+BAA+B,EAAE,qBAAiB;AAqBhE;;;;;;;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,gBACd,OAAO,sEAEF,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"}
|
package/dist/utils/gas.d.mts
CHANGED
@@ -1,6 +1,9 @@
|
|
1
|
+
import type { TxData } from "@metamask/bridge-controller";
|
1
2
|
import type { GasFeeState } from "@metamask/gas-fee-controller";
|
2
3
|
import type { TransactionController } from "@metamask/transaction-controller";
|
4
|
+
import type { Hex } from "@metamask/utils";
|
3
5
|
import { BigNumber } from "bignumber.js";
|
6
|
+
import type { BridgeStatusControllerMessenger } from "../types.mjs";
|
4
7
|
/**
|
5
8
|
* Get the gas fee estimates for a transaction
|
6
9
|
*
|
@@ -17,4 +20,8 @@ export declare const getTxGasEstimates: ({ txGasFeeEstimates, networkGasFeeEstim
|
|
17
20
|
maxFeePerGas: `0x${string}`;
|
18
21
|
maxPriorityFeePerGas: `0x${string}`;
|
19
22
|
};
|
23
|
+
export declare const calculateGasFees: (disable7702: boolean, messagingSystem: BridgeStatusControllerMessenger, estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee, { chainId: _, gasLimit, ...trade }: TxData, networkClientId: string, chainId: Hex, txFee?: {
|
24
|
+
maxFeePerGas: string;
|
25
|
+
maxPriorityFeePerGas: string;
|
26
|
+
}) => Promise<{}>;
|
20
27
|
//# sourceMappingURL=gas.d.mts.map
|
package/dist/utils/gas.d.mts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gas.d.mts","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACZ,qCAAqC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACtB,yCAAyC;AAC1C,OAAO,EAAE,SAAS,EAAE,qBAAqB;
|
1
|
+
{"version":3,"file":"gas.d.mts","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,oCAAoC;AAE1D,OAAO,KAAK,EAEV,WAAW,EACZ,qCAAqC;AACtC,OAAO,KAAK,EAEV,qBAAqB,EACtB,yCAAyC;AAC1C,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAC3C,OAAO,EAAE,SAAS,EAAE,qBAAqB;AAEzC,OAAO,KAAK,EAAE,+BAA+B,EAAE,qBAAiB;AAqBhE;;;;;;;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,gBACd,OAAO,sEAEF,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"}
|
package/dist/utils/gas.mjs
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import { toHex } from "@metamask/controller-utils";
|
1
2
|
import { BigNumber } from "bignumber.js";
|
2
3
|
const getTransaction1559GasFeeEstimates = (txGasFeeEstimates, estimatedBaseFee) => {
|
3
4
|
const { maxFeePerGas, maxPriorityFeePerGas } = txGasFeeEstimates?.high ?? {};
|
@@ -24,4 +25,35 @@ export const getTxGasEstimates = ({ txGasFeeEstimates, networkGasFeeEstimates, }
|
|
24
25
|
const { estimatedBaseFee = '0' } = networkGasFeeEstimates;
|
25
26
|
return getTransaction1559GasFeeEstimates(txGasFeeEstimates, estimatedBaseFee);
|
26
27
|
};
|
28
|
+
export const calculateGasFees = async (disable7702, messagingSystem, estimateGasFeeFn, { chainId: _, gasLimit, ...trade }, networkClientId, chainId, txFee) => {
|
29
|
+
if (!disable7702) {
|
30
|
+
return {};
|
31
|
+
}
|
32
|
+
if (txFee) {
|
33
|
+
return { ...txFee, gas: gasLimit?.toString() };
|
34
|
+
}
|
35
|
+
const transactionParams = {
|
36
|
+
...trade,
|
37
|
+
gas: gasLimit?.toString(),
|
38
|
+
data: trade.data,
|
39
|
+
to: trade.to,
|
40
|
+
value: trade.value,
|
41
|
+
};
|
42
|
+
const { gasFeeEstimates } = messagingSystem.call('GasFeeController:getState');
|
43
|
+
const { estimates: txGasFeeEstimates } = await estimateGasFeeFn({
|
44
|
+
transactionParams,
|
45
|
+
chainId,
|
46
|
+
networkClientId,
|
47
|
+
});
|
48
|
+
const { maxFeePerGas, maxPriorityFeePerGas } = getTxGasEstimates({
|
49
|
+
networkGasFeeEstimates: gasFeeEstimates,
|
50
|
+
txGasFeeEstimates,
|
51
|
+
});
|
52
|
+
const maxGasLimit = toHex(transactionParams.gas ?? 0);
|
53
|
+
return {
|
54
|
+
maxFeePerGas,
|
55
|
+
maxPriorityFeePerGas,
|
56
|
+
gas: maxGasLimit,
|
57
|
+
};
|
58
|
+
};
|
27
59
|
//# sourceMappingURL=gas.mjs.map
|
package/dist/utils/gas.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"gas.mjs","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"gas.mjs","sourceRoot":"","sources":["../../src/utils/gas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,mCAAmC;AAUnD,OAAO,EAAE,SAAS,EAAE,qBAAqB;AAIzC,MAAM,iCAAiC,GAAG,CACxC,iBAA2C,EAC3C,gBAAwB,EACxB,EAAE;IACF,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,iBAAiB,EAAE,IAAI,IAAI,EAAE,CAAC;IAE7E,MAAM,wBAAwB,GAAG,oBAAoB;QACnD,CAAC,CAAC,IAAI,SAAS,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;AACH,MAAM,CAAC,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;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EACnC,WAAoB,EACpB,eAAgD,EAChD,gBAAuE,EACvE,EAAE,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAU,EAC1C,eAAuB,EACvB,OAAY,EACZ,KAA8D,EAC9D,EAAE;IACF,IAAI,CAAC,WAAW,EAAE;QAChB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,KAAK,EAAE;QACT,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC;KAChD;IACD,MAAM,iBAAiB,GAAG;QACxB,GAAG,KAAK;QACR,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE;QACzB,IAAI,EAAE,KAAK,CAAC,IAAqB;QACjC,EAAE,EAAE,KAAK,CAAC,EAAmB;QAC7B,KAAK,EAAE,KAAK,CAAC,KAAsB;KACpC,CAAC;IACF,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;IAC9E,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,MAAM,gBAAgB,CAAC;QAC9D,iBAAiB;QACjB,OAAO;QACP,eAAe;KAChB,CAAC,CAAC;IACH,MAAM,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,iBAAiB,CAAC;QAC/D,sBAAsB,EAAE,eAAe;QACvC,iBAAiB;KAClB,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAEtD,OAAO;QACL,YAAY;QACZ,oBAAoB;QACpB,GAAG,EAAE,WAAW;KACjB,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { 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} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\nimport { BigNumber } from 'bignumber.js';\n\nimport type { BridgeStatusControllerMessenger } from '../types';\n\nconst getTransaction1559GasFeeEstimates = (\n txGasFeeEstimates: FeeMarketGasFeeEstimates,\n estimatedBaseFee: string,\n) => {\n const { maxFeePerGas, maxPriorityFeePerGas } = txGasFeeEstimates?.high ?? {};\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 disable7702: boolean,\n messagingSystem: 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 (!disable7702) {\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 } = messagingSystem.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"]}
|
package/dist/utils/metrics.cjs
CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getEVMTxPropertiesFromTransactionMeta = exports.getRequestMetadataFromHistory = exports.getTradeDataFromHistory = exports.getPriceImpactFromQuote = exports.getTradeDataFromQuote = exports.getRequestParamFromHistory = exports.getFinalizedTxProperties = exports.getTxStatusesFromHistory = void 0;
|
4
4
|
const bridge_controller_1 = require("@metamask/bridge-controller");
|
5
5
|
const transaction_controller_1 = require("@metamask/transaction-controller");
|
6
|
-
const getTxStatusesFromHistory = ({ status, hasApprovalTx, quote, }) => {
|
6
|
+
const getTxStatusesFromHistory = ({ status, hasApprovalTx, approvalTxId, quote, }) => {
|
7
7
|
const source_transaction = status.srcChain.txHash
|
8
8
|
? bridge_controller_1.StatusTypes.COMPLETE
|
9
9
|
: bridge_controller_1.StatusTypes.PENDING;
|
@@ -22,7 +22,7 @@ const getTxStatusesFromHistory = ({ status, hasApprovalTx, quote, }) => {
|
|
22
22
|
allowance_reset_transaction: isEthUsdtTx
|
23
23
|
? allowance_reset_transaction
|
24
24
|
: undefined,
|
25
|
-
approval_transaction: hasApprovalTx ? approval_transaction : undefined,
|
25
|
+
approval_transaction: hasApprovalTx || approvalTxId ? approval_transaction : undefined,
|
26
26
|
source_transaction,
|
27
27
|
destination_transaction: status.status === bridge_controller_1.StatusTypes.FAILED
|
28
28
|
? bridge_controller_1.StatusTypes.FAILED
|
@@ -98,7 +98,11 @@ exports.getRequestMetadataFromHistory = getRequestMetadataFromHistory;
|
|
98
98
|
*/
|
99
99
|
const getEVMTxPropertiesFromTransactionMeta = (transactionMeta) => {
|
100
100
|
return {
|
101
|
-
source_transaction:
|
101
|
+
source_transaction: [
|
102
|
+
transaction_controller_1.TransactionStatus.failed,
|
103
|
+
transaction_controller_1.TransactionStatus.dropped,
|
104
|
+
transaction_controller_1.TransactionStatus.rejected,
|
105
|
+
].includes(transactionMeta.status)
|
102
106
|
? bridge_controller_1.StatusTypes.FAILED
|
103
107
|
: bridge_controller_1.StatusTypes.COMPLETE,
|
104
108
|
error_message: transactionMeta.error?.message
|
@@ -114,7 +118,8 @@ const getEVMTxPropertiesFromTransactionMeta = (transactionMeta) => {
|
|
114
118
|
token_address_destination: (0, bridge_controller_1.formatAddressToAssetId)(transactionMeta.destinationTokenAddress ?? '', transactionMeta.chainId) ?? '',
|
115
119
|
custom_slippage: false,
|
116
120
|
is_hardware_wallet: false,
|
117
|
-
swap_type: transactionMeta.type
|
121
|
+
swap_type: transactionMeta.type &&
|
122
|
+
[transaction_controller_1.TransactionType.swap, transaction_controller_1.TransactionType.swapApproval].includes(transactionMeta.type)
|
118
123
|
? bridge_controller_1.MetricsSwapType.SINGLE
|
119
124
|
: bridge_controller_1.MetricsSwapType.CROSSCHAIN,
|
120
125
|
security_warnings: [],
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"metrics.cjs","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":";;;AAMA,mEAgBqC;AACrC,6EAI0C;AAMnC,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,aAAa,EACb,KAAK,GACa,EAAgB,EAAE;IACpC,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QAC/C,CAAC,CAAC,+BAAW,CAAC,QAAQ;QACtB,CAAC,CAAC,+BAAW,CAAC,OAAO,CAAC;IACxB,MAAM,uBAAuB,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM;QACtD,CAAC,CAAC,MAA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3B,iBAAiB,EAAE,CAAC;QACpB,cAAc,EAAE,CAAC;QACjB,WAAW,EAAE,qCAAiB,CAAC,aAAa;KAC7C,CAAC;AACJ,CAAC,CAAC;AA/CW,QAAA,qCAAqC,yCA+ChD","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n QuoteResponse,\n TxData,\n QuoteMetadata,\n} from '@metamask/bridge-controller';\nimport {\n type TxStatusData,\n StatusTypes,\n formatChainIdToHex,\n isEthUsdt,\n type RequestParams,\n formatChainIdToCaip,\n type TradeData,\n formatProviderLabel,\n type RequestMetadata,\n isCustomSlippage,\n getSwapType,\n isHardwareWallet,\n formatAddressToAssetId,\n MetricsActionType,\n MetricsSwapType,\n} from '@metamask/bridge-controller';\nimport {\n TransactionStatus,\n TransactionType,\n type TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\nimport type { BridgeHistoryItem } from 'src/types';\n\nimport type { QuoteFetchData } from '../../../bridge-controller/src/utils/metrics/types';\n\nexport const getTxStatusesFromHistory = ({\n status,\n hasApprovalTx,\n quote,\n}: BridgeHistoryItem): TxStatusData => {\n const source_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n const destination_transaction = status.destChain?.txHash\n ? status.status\n : StatusTypes.PENDING;\n\n const hexChainId = formatChainIdToHex(quote.srcChainId);\n const isEthUsdtTx = isEthUsdt(hexChainId, quote.srcAsset.address);\n const allowance_reset_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : undefined;\n const approval_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n\n return {\n allowance_reset_transaction: isEthUsdtTx\n ? allowance_reset_transaction\n : undefined,\n approval_transaction: hasApprovalTx ? approval_transaction : undefined,\n source_transaction,\n destination_transaction:\n status.status === StatusTypes.FAILED\n ? StatusTypes.FAILED\n : destination_transaction,\n };\n};\n\nexport const getFinalizedTxProperties = (historyItem: BridgeHistoryItem) => {\n return {\n actual_time_minutes:\n historyItem.completionTime && historyItem.startTime\n ? (historyItem.completionTime - historyItem.startTime) / 60000\n : 0,\n usd_actual_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0), // TODO calculate based on USD price at completion time\n usd_actual_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0), // TODO calculate based on USD price at completion time\n quote_vs_execution_ratio: 1, // TODO calculate based on USD price at completion time\n quoted_vs_used_gas_ratio: 1, // TODO calculate based on USD price at completion time\n };\n};\n\nexport const getRequestParamFromHistory = (\n historyItem: BridgeHistoryItem,\n): RequestParams => {\n return {\n chain_id_source: formatChainIdToCaip(historyItem.quote.srcChainId),\n token_symbol_source: historyItem.quote.srcAsset.symbol,\n token_address_source: historyItem.quote.srcAsset.assetId,\n chain_id_destination: formatChainIdToCaip(historyItem.quote.destChainId),\n token_symbol_destination: historyItem.quote.destAsset.symbol,\n token_address_destination: historyItem.quote.destAsset.assetId,\n };\n};\n\nexport const getTradeDataFromQuote = (\n quoteResponse: QuoteResponse<TxData | string> & QuoteMetadata,\n): TradeData => {\n return {\n usd_quoted_gas: Number(quoteResponse.gasFee?.usd ?? 0),\n gas_included: quoteResponse.quote.gasIncluded ?? false,\n provider: formatProviderLabel(quoteResponse.quote),\n quoted_time_minutes: Number(\n quoteResponse.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(quoteResponse.adjustedReturn?.usd ?? 0),\n };\n};\n\nexport const getPriceImpactFromQuote = (\n quote: QuoteResponse['quote'],\n): Pick<QuoteFetchData, 'price_impact'> => {\n return { price_impact: Number(quote.priceData?.priceImpact ?? '0') };\n};\n\nexport const getTradeDataFromHistory = (\n historyItem: BridgeHistoryItem,\n): TradeData => {\n return {\n usd_quoted_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0),\n gas_included: historyItem.quote.gasIncluded ?? false,\n provider: formatProviderLabel(historyItem.quote),\n quoted_time_minutes: Number(\n historyItem.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0),\n };\n};\n\nexport const getRequestMetadataFromHistory = (\n historyItem: BridgeHistoryItem,\n account?: AccountsControllerState['internalAccounts']['accounts'][string],\n): RequestMetadata => {\n const { quote, slippagePercentage, isStxEnabled } = historyItem;\n\n return {\n slippage_limit: slippagePercentage,\n custom_slippage: isCustomSlippage(slippagePercentage),\n usd_amount_source: Number(historyItem.pricingData?.amountSentInUsd ?? 0),\n swap_type: getSwapType(quote.srcChainId, quote.destChainId),\n is_hardware_wallet: isHardwareWallet(account),\n stx_enabled: isStxEnabled ?? false,\n security_warnings: [],\n };\n};\n\n/**\n * Get the properties for a swap transaction that is not in the txHistory\n *\n * @param transactionMeta - The transaction meta\n * @returns The properties for the swap transaction\n */\nexport const getEVMTxPropertiesFromTransactionMeta = (\n transactionMeta: TransactionMeta,\n) => {\n return {\n source_transaction:\n transactionMeta.status === TransactionStatus.failed\n ? StatusTypes.FAILED\n : StatusTypes.COMPLETE,\n error_message: transactionMeta.error?.message\n ? 'Failed to finalize swap tx'\n : undefined,\n chain_id_source: formatChainIdToCaip(transactionMeta.chainId),\n chain_id_destination: formatChainIdToCaip(transactionMeta.chainId),\n token_symbol_source: transactionMeta.sourceTokenSymbol ?? '',\n token_symbol_destination: transactionMeta.destinationTokenSymbol ?? '',\n usd_amount_source: 100,\n stx_enabled: false,\n token_address_source:\n formatAddressToAssetId(\n transactionMeta.sourceTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n token_address_destination:\n formatAddressToAssetId(\n transactionMeta.destinationTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n custom_slippage: false,\n is_hardware_wallet: false,\n swap_type:\n transactionMeta.type === TransactionType.swap\n ? MetricsSwapType.SINGLE\n : MetricsSwapType.CROSSCHAIN,\n security_warnings: [],\n price_impact: 0,\n usd_quoted_gas: 0,\n gas_included: false,\n quoted_time_minutes: 0,\n usd_quoted_return: 0,\n provider: '' as `${string}_${string}`,\n actual_time_minutes: 0,\n quote_vs_execution_ratio: 0,\n quoted_vs_used_gas_ratio: 0,\n usd_actual_return: 0,\n usd_actual_gas: 0,\n action_type: MetricsActionType.SWAPBRIDGE_V1,\n };\n};\n"]}
|
1
|
+
{"version":3,"file":"metrics.cjs","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":";;;AAMA,mEAgBqC;AACrC,6EAI0C;AAMnC,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,aAAa,EACb,YAAY,EACZ,KAAK,GACa,EAAgB,EAAE;IACpC,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QAC/C,CAAC,CAAC,+BAAW,CAAC,QAAQ;QACtB,CAAC,CAAC,+BAAW,CAAC,OAAO,CAAC;IACxB,MAAM,uBAAuB,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM;QACtD,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,+BAAW,CAAC,OAAO,CAAC;IAExB,MAAM,UAAU,GAAG,IAAA,sCAAkB,EAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,WAAW,GAAG,IAAA,6BAAS,EAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClE,MAAM,2BAA2B,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QACxD,CAAC,CAAC,+BAAW,CAAC,QAAQ;QACtB,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,oBAAoB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QACjD,CAAC,CAAC,+BAAW,CAAC,QAAQ;QACtB,CAAC,CAAC,+BAAW,CAAC,OAAO,CAAC;IAExB,OAAO;QACL,2BAA2B,EAAE,WAAW;YACtC,CAAC,CAAC,2BAA2B;YAC7B,CAAC,CAAC,SAAS;QACb,oBAAoB,EAClB,aAAa,IAAI,YAAY,C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ACtB,WAAW,EAAE,KAAK;QAClB,oBAAoB,EAClB,IAAA,0CAAsB,EACpB,eAAe,CAAC,kBAAkB,IAAI,EAAE,EACxC,eAAe,CAAC,OAAO,CACxB,IAAK,EAAoB;QAC5B,yBAAyB,EACvB,IAAA,0CAAsB,EACpB,eAAe,CAAC,uBAAuB,IAAI,EAAE,EAC7C,eAAe,CAAC,OAAO,CACxB,IAAK,EAAoB;QAC5B,eAAe,EAAE,KAAK;QACtB,kBAAkB,EAAE,KAAK;QACzB,SAAS,EACP,eAAe,CAAC,IAAI;YACpB,CAAC,wCAAe,CAAC,IAAI,EAAE,wCAAe,CAAC,YAAY,CAAC,CAAC,QAAQ,CAC3D,eAAe,CAAC,IAAI,CACrB;YACC,CAAC,CAAC,mCAAe,CAAC,MAAM;YACxB,CAAC,CAAC,mCAAe,CAAC,UAAU;QAChC,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,CAAC;QACjB,YAAY,EAAE,KAAK;QACnB,mBAAmB,EAAE,CAAC;QACtB,iBAAiB,EAAE,CAAC;QACpB,QAAQ,EAAE,EAA2B;QACrC,mBAAmB,EAAE,CAAC;QACtB,wBAAwB,EAAE,CAAC;QAC3B,wBAAwB,EAAE,CAAC;QAC3B,iBAAiB,EAAE,CAAC;QACpB,cAAc,EAAE,CAAC;QACjB,WAAW,EAAE,qCAAiB,CAAC,aAAa;KAC7C,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,qCAAqC,yCAqDhD","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n QuoteResponse,\n TxData,\n QuoteMetadata,\n} from '@metamask/bridge-controller';\nimport {\n type TxStatusData,\n StatusTypes,\n formatChainIdToHex,\n isEthUsdt,\n type RequestParams,\n formatChainIdToCaip,\n type TradeData,\n formatProviderLabel,\n type RequestMetadata,\n isCustomSlippage,\n getSwapType,\n isHardwareWallet,\n formatAddressToAssetId,\n MetricsActionType,\n MetricsSwapType,\n} from '@metamask/bridge-controller';\nimport {\n TransactionStatus,\n TransactionType,\n type TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\nimport type { BridgeHistoryItem } from 'src/types';\n\nimport type { QuoteFetchData } from '../../../bridge-controller/src/utils/metrics/types';\n\nexport const getTxStatusesFromHistory = ({\n status,\n hasApprovalTx,\n approvalTxId,\n quote,\n}: BridgeHistoryItem): TxStatusData => {\n const source_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n const destination_transaction = status.destChain?.txHash\n ? status.status\n : StatusTypes.PENDING;\n\n const hexChainId = formatChainIdToHex(quote.srcChainId);\n const isEthUsdtTx = isEthUsdt(hexChainId, quote.srcAsset.address);\n const allowance_reset_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : undefined;\n const approval_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n\n return {\n allowance_reset_transaction: isEthUsdtTx\n ? allowance_reset_transaction\n : undefined,\n approval_transaction:\n hasApprovalTx || approvalTxId ? approval_transaction : undefined,\n source_transaction,\n destination_transaction:\n status.status === StatusTypes.FAILED\n ? StatusTypes.FAILED\n : destination_transaction,\n };\n};\n\nexport const getFinalizedTxProperties = (historyItem: BridgeHistoryItem) => {\n return {\n actual_time_minutes:\n historyItem.completionTime && historyItem.startTime\n ? (historyItem.completionTime - historyItem.startTime) / 60000\n : 0,\n usd_actual_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0), // TODO calculate based on USD price at completion time\n usd_actual_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0), // TODO calculate based on USD price at completion time\n quote_vs_execution_ratio: 1, // TODO calculate based on USD price at completion time\n quoted_vs_used_gas_ratio: 1, // TODO calculate based on USD price at completion time\n };\n};\n\nexport const getRequestParamFromHistory = (\n historyItem: BridgeHistoryItem,\n): RequestParams => {\n return {\n chain_id_source: formatChainIdToCaip(historyItem.quote.srcChainId),\n token_symbol_source: historyItem.quote.srcAsset.symbol,\n token_address_source: historyItem.quote.srcAsset.assetId,\n chain_id_destination: formatChainIdToCaip(historyItem.quote.destChainId),\n token_symbol_destination: historyItem.quote.destAsset.symbol,\n token_address_destination: historyItem.quote.destAsset.assetId,\n };\n};\n\nexport const getTradeDataFromQuote = (\n quoteResponse: QuoteResponse<TxData | string> & QuoteMetadata,\n): TradeData => {\n return {\n usd_quoted_gas: Number(quoteResponse.gasFee?.usd ?? 0),\n gas_included: quoteResponse.quote.gasIncluded ?? false,\n provider: formatProviderLabel(quoteResponse.quote),\n quoted_time_minutes: Number(\n quoteResponse.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(quoteResponse.adjustedReturn?.usd ?? 0),\n };\n};\n\nexport const getPriceImpactFromQuote = (\n quote: QuoteResponse['quote'],\n): Pick<QuoteFetchData, 'price_impact'> => {\n return { price_impact: Number(quote.priceData?.priceImpact ?? '0') };\n};\n\nexport const getTradeDataFromHistory = (\n historyItem: BridgeHistoryItem,\n): TradeData => {\n return {\n usd_quoted_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0),\n gas_included: historyItem.quote.gasIncluded ?? false,\n provider: formatProviderLabel(historyItem.quote),\n quoted_time_minutes: Number(\n historyItem.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0),\n };\n};\n\nexport const getRequestMetadataFromHistory = (\n historyItem: BridgeHistoryItem,\n account?: AccountsControllerState['internalAccounts']['accounts'][string],\n): RequestMetadata => {\n const { quote, slippagePercentage, isStxEnabled } = historyItem;\n\n return {\n slippage_limit: slippagePercentage,\n custom_slippage: isCustomSlippage(slippagePercentage),\n usd_amount_source: Number(historyItem.pricingData?.amountSentInUsd ?? 0),\n swap_type: getSwapType(quote.srcChainId, quote.destChainId),\n is_hardware_wallet: isHardwareWallet(account),\n stx_enabled: isStxEnabled ?? false,\n security_warnings: [],\n };\n};\n\n/**\n * Get the properties for a swap transaction that is not in the txHistory\n *\n * @param transactionMeta - The transaction meta\n * @returns The properties for the swap transaction\n */\nexport const getEVMTxPropertiesFromTransactionMeta = (\n transactionMeta: TransactionMeta,\n) => {\n return {\n source_transaction: [\n TransactionStatus.failed,\n TransactionStatus.dropped,\n TransactionStatus.rejected,\n ].includes(transactionMeta.status)\n ? StatusTypes.FAILED\n : StatusTypes.COMPLETE,\n error_message: transactionMeta.error?.message\n ? 'Failed to finalize swap tx'\n : undefined,\n chain_id_source: formatChainIdToCaip(transactionMeta.chainId),\n chain_id_destination: formatChainIdToCaip(transactionMeta.chainId),\n token_symbol_source: transactionMeta.sourceTokenSymbol ?? '',\n token_symbol_destination: transactionMeta.destinationTokenSymbol ?? '',\n usd_amount_source: 100,\n stx_enabled: false,\n token_address_source:\n formatAddressToAssetId(\n transactionMeta.sourceTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n token_address_destination:\n formatAddressToAssetId(\n transactionMeta.destinationTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n custom_slippage: false,\n is_hardware_wallet: false,\n swap_type:\n transactionMeta.type &&\n [TransactionType.swap, TransactionType.swapApproval].includes(\n transactionMeta.type,\n )\n ? MetricsSwapType.SINGLE\n : MetricsSwapType.CROSSCHAIN,\n security_warnings: [],\n price_impact: 0,\n usd_quoted_gas: 0,\n gas_included: false,\n quoted_time_minutes: 0,\n usd_quoted_return: 0,\n provider: '' as `${string}_${string}`,\n actual_time_minutes: 0,\n quote_vs_execution_ratio: 0,\n quoted_vs_used_gas_ratio: 0,\n usd_actual_return: 0,\n usd_actual_gas: 0,\n action_type: MetricsActionType.SWAPBRIDGE_V1,\n };\n};\n"]}
|
package/dist/utils/metrics.d.cts
CHANGED
@@ -4,7 +4,7 @@ import { type TxStatusData, StatusTypes, type RequestParams, type TradeData, typ
|
|
4
4
|
import { type TransactionMeta } from "@metamask/transaction-controller";
|
5
5
|
import type { BridgeHistoryItem } from "src/types";
|
6
6
|
import type { QuoteFetchData } from "../../../bridge-controller/src/utils/metrics/types.cjs";
|
7
|
-
export declare const getTxStatusesFromHistory: ({ status, hasApprovalTx, quote, }: BridgeHistoryItem) => TxStatusData;
|
7
|
+
export declare const getTxStatusesFromHistory: ({ status, hasApprovalTx, approvalTxId, quote, }: BridgeHistoryItem) => TxStatusData;
|
8
8
|
export declare const getFinalizedTxProperties: (historyItem: BridgeHistoryItem) => {
|
9
9
|
actual_time_minutes: number;
|
10
10
|
usd_actual_return: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"metrics.d.cts","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,aAAa,EACd,oCAAoC;AACrC,OAAO,EACL,KAAK,YAAY,EACjB,WAAW,EAGX,KAAK,aAAa,EAElB,KAAK,SAAS,EAEd,KAAK,eAAe,EAKpB,iBAAiB,EACjB,eAAe,EAChB,oCAAoC;AACrC,OAAO,EAGL,KAAK,eAAe,EACrB,yCAAyC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,+DAA2D;AAEzF,eAAO,MAAM,wBAAwB,
|
1
|
+
{"version":3,"file":"metrics.d.cts","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,aAAa,EACd,oCAAoC;AACrC,OAAO,EACL,KAAK,YAAY,EACjB,WAAW,EAGX,KAAK,aAAa,EAElB,KAAK,SAAS,EAEd,KAAK,eAAe,EAKpB,iBAAiB,EACjB,eAAe,EAChB,oCAAoC;AACrC,OAAO,EAGL,KAAK,eAAe,EACrB,yCAAyC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,+DAA2D;AAEzF,eAAO,MAAM,wBAAwB,oDAKlC,iBAAiB,KAAG,YA6BtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBAAiB,iBAAiB;;;;;;CAWtE,CAAC;AAEF,eAAO,MAAM,0BAA0B,gBACxB,iBAAiB,KAC7B,aASF,CAAC;AAEF,eAAO,MAAM,qBAAqB,kBACjB,cAAc,MAAM,GAAG,MAAM,CAAC,GAAG,aAAa,KAC5D,SAUF,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAC3B,aAAa,CAAC,OAAO,CAAC,KAC5B,KAAK,cAAc,EAAE,cAAc,CAErC,CAAC;AAEF,eAAO,MAAM,uBAAuB,gBACrB,iBAAiB,KAC7B,SAUF,CAAC;AAEF,eAAO,MAAM,6BAA6B,gBAC3B,iBAAiB,YACpB,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KACxE,eAYF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC,oBAC/B,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDjC,CAAC"}
|
package/dist/utils/metrics.d.mts
CHANGED
@@ -4,7 +4,7 @@ import { type TxStatusData, StatusTypes, type RequestParams, type TradeData, typ
|
|
4
4
|
import { type TransactionMeta } from "@metamask/transaction-controller";
|
5
5
|
import type { BridgeHistoryItem } from "src/types";
|
6
6
|
import type { QuoteFetchData } from "../../../bridge-controller/src/utils/metrics/types.mjs";
|
7
|
-
export declare const getTxStatusesFromHistory: ({ status, hasApprovalTx, quote, }: BridgeHistoryItem) => TxStatusData;
|
7
|
+
export declare const getTxStatusesFromHistory: ({ status, hasApprovalTx, approvalTxId, quote, }: BridgeHistoryItem) => TxStatusData;
|
8
8
|
export declare const getFinalizedTxProperties: (historyItem: BridgeHistoryItem) => {
|
9
9
|
actual_time_minutes: number;
|
10
10
|
usd_actual_return: number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"metrics.d.mts","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,aAAa,EACd,oCAAoC;AACrC,OAAO,EACL,KAAK,YAAY,EACjB,WAAW,EAGX,KAAK,aAAa,EAElB,KAAK,SAAS,EAEd,KAAK,eAAe,EAKpB,iBAAiB,EACjB,eAAe,EAChB,oCAAoC;AACrC,OAAO,EAGL,KAAK,eAAe,EACrB,yCAAyC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,+DAA2D;AAEzF,eAAO,MAAM,wBAAwB,
|
1
|
+
{"version":3,"file":"metrics.d.mts","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,aAAa,EACd,oCAAoC;AACrC,OAAO,EACL,KAAK,YAAY,EACjB,WAAW,EAGX,KAAK,aAAa,EAElB,KAAK,SAAS,EAEd,KAAK,eAAe,EAKpB,iBAAiB,EACjB,eAAe,EAChB,oCAAoC;AACrC,OAAO,EAGL,KAAK,eAAe,EACrB,yCAAyC;AAE1C,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB;AAEnD,OAAO,KAAK,EAAE,cAAc,EAAE,+DAA2D;AAEzF,eAAO,MAAM,wBAAwB,oDAKlC,iBAAiB,KAAG,YA6BtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,gBAAiB,iBAAiB;;;;;;CAWtE,CAAC;AAEF,eAAO,MAAM,0BAA0B,gBACxB,iBAAiB,KAC7B,aASF,CAAC;AAEF,eAAO,MAAM,qBAAqB,kBACjB,cAAc,MAAM,GAAG,MAAM,CAAC,GAAG,aAAa,KAC5D,SAUF,CAAC;AAEF,eAAO,MAAM,uBAAuB,UAC3B,aAAa,CAAC,OAAO,CAAC,KAC5B,KAAK,cAAc,EAAE,cAAc,CAErC,CAAC;AAEF,eAAO,MAAM,uBAAuB,gBACrB,iBAAiB,KAC7B,SAUF,CAAC;AAEF,eAAO,MAAM,6BAA6B,gBAC3B,iBAAiB,YACpB,uBAAuB,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KACxE,eAYF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qCAAqC,oBAC/B,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDjC,CAAC"}
|
package/dist/utils/metrics.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { StatusTypes, formatChainIdToHex, isEthUsdt, formatChainIdToCaip, formatProviderLabel, isCustomSlippage, getSwapType, isHardwareWallet, formatAddressToAssetId, MetricsActionType, MetricsSwapType } from "@metamask/bridge-controller";
|
2
2
|
import { TransactionStatus, TransactionType } from "@metamask/transaction-controller";
|
3
|
-
export const getTxStatusesFromHistory = ({ status, hasApprovalTx, quote, }) => {
|
3
|
+
export const getTxStatusesFromHistory = ({ status, hasApprovalTx, approvalTxId, quote, }) => {
|
4
4
|
const source_transaction = status.srcChain.txHash
|
5
5
|
? StatusTypes.COMPLETE
|
6
6
|
: StatusTypes.PENDING;
|
@@ -19,7 +19,7 @@ export const getTxStatusesFromHistory = ({ status, hasApprovalTx, quote, }) => {
|
|
19
19
|
allowance_reset_transaction: isEthUsdtTx
|
20
20
|
? allowance_reset_transaction
|
21
21
|
: undefined,
|
22
|
-
approval_transaction: hasApprovalTx ? approval_transaction : undefined,
|
22
|
+
approval_transaction: hasApprovalTx || approvalTxId ? approval_transaction : undefined,
|
23
23
|
source_transaction,
|
24
24
|
destination_transaction: status.status === StatusTypes.FAILED
|
25
25
|
? StatusTypes.FAILED
|
@@ -88,7 +88,11 @@ export const getRequestMetadataFromHistory = (historyItem, account) => {
|
|
88
88
|
*/
|
89
89
|
export const getEVMTxPropertiesFromTransactionMeta = (transactionMeta) => {
|
90
90
|
return {
|
91
|
-
source_transaction:
|
91
|
+
source_transaction: [
|
92
|
+
TransactionStatus.failed,
|
93
|
+
TransactionStatus.dropped,
|
94
|
+
TransactionStatus.rejected,
|
95
|
+
].includes(transactionMeta.status)
|
92
96
|
? StatusTypes.FAILED
|
93
97
|
: StatusTypes.COMPLETE,
|
94
98
|
error_message: transactionMeta.error?.message
|
@@ -104,7 +108,8 @@ export const getEVMTxPropertiesFromTransactionMeta = (transactionMeta) => {
|
|
104
108
|
token_address_destination: formatAddressToAssetId(transactionMeta.destinationTokenAddress ?? '', transactionMeta.chainId) ?? '',
|
105
109
|
custom_slippage: false,
|
106
110
|
is_hardware_wallet: false,
|
107
|
-
swap_type: transactionMeta.type
|
111
|
+
swap_type: transactionMeta.type &&
|
112
|
+
[TransactionType.swap, TransactionType.swapApproval].includes(transactionMeta.type)
|
108
113
|
? MetricsSwapType.SINGLE
|
109
114
|
: MetricsSwapType.CROSSCHAIN,
|
110
115
|
security_warnings: [],
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"metrics.mjs","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,WAAW,EACX,kBAAkB,EAClB,SAAS,EAET,mBAAmB,EAEnB,mBAAmB,EAEnB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EAChB,oCAAoC;AACrC,OAAO,EACL,iBAAiB,EACjB,eAAe,EAEhB,yCAAyC;AAM1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,aAAa,EACb,KAAK,GACa,EAAgB,EAAE;IACpC,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QAC/C,CAAC,CAAC,WAAW,CAAC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a;KAC7C,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n QuoteResponse,\n TxData,\n QuoteMetadata,\n} from '@metamask/bridge-controller';\nimport {\n type TxStatusData,\n StatusTypes,\n formatChainIdToHex,\n isEthUsdt,\n type RequestParams,\n formatChainIdToCaip,\n type TradeData,\n formatProviderLabel,\n type RequestMetadata,\n isCustomSlippage,\n getSwapType,\n isHardwareWallet,\n formatAddressToAssetId,\n MetricsActionType,\n MetricsSwapType,\n} from '@metamask/bridge-controller';\nimport {\n TransactionStatus,\n TransactionType,\n type TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\nimport type { BridgeHistoryItem } from 'src/types';\n\nimport type { QuoteFetchData } from '../../../bridge-controller/src/utils/metrics/types';\n\nexport const getTxStatusesFromHistory = ({\n status,\n hasApprovalTx,\n quote,\n}: BridgeHistoryItem): TxStatusData => {\n const source_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n const destination_transaction = status.destChain?.txHash\n ? status.status\n : StatusTypes.PENDING;\n\n const hexChainId = formatChainIdToHex(quote.srcChainId);\n const isEthUsdtTx = isEthUsdt(hexChainId, quote.srcAsset.address);\n const allowance_reset_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : undefined;\n const approval_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n\n return {\n allowance_reset_transaction: isEthUsdtTx\n ? allowance_reset_transaction\n : undefined,\n approval_transaction: hasApprovalTx ? approval_transaction : undefined,\n source_transaction,\n destination_transaction:\n status.status === StatusTypes.FAILED\n ? StatusTypes.FAILED\n : destination_transaction,\n };\n};\n\nexport const getFinalizedTxProperties = (historyItem: BridgeHistoryItem) => {\n return {\n actual_time_minutes:\n historyItem.completionTime && historyItem.startTime\n ? (historyItem.completionTime - historyItem.startTime) / 60000\n : 0,\n usd_actual_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0), // TODO calculate based on USD price at completion time\n usd_actual_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0), // TODO calculate based on USD price at completion time\n quote_vs_execution_ratio: 1, // TODO calculate based on USD price at completion time\n quoted_vs_used_gas_ratio: 1, // TODO calculate based on USD price at completion time\n };\n};\n\nexport const getRequestParamFromHistory = (\n historyItem: BridgeHistoryItem,\n): RequestParams => {\n return {\n chain_id_source: formatChainIdToCaip(historyItem.quote.srcChainId),\n token_symbol_source: historyItem.quote.srcAsset.symbol,\n token_address_source: historyItem.quote.srcAsset.assetId,\n chain_id_destination: formatChainIdToCaip(historyItem.quote.destChainId),\n token_symbol_destination: historyItem.quote.destAsset.symbol,\n token_address_destination: historyItem.quote.destAsset.assetId,\n };\n};\n\nexport const getTradeDataFromQuote = (\n quoteResponse: QuoteResponse<TxData | string> & QuoteMetadata,\n): TradeData => {\n return {\n usd_quoted_gas: Number(quoteResponse.gasFee?.usd ?? 0),\n gas_included: quoteResponse.quote.gasIncluded ?? false,\n provider: formatProviderLabel(quoteResponse.quote),\n quoted_time_minutes: Number(\n quoteResponse.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(quoteResponse.adjustedReturn?.usd ?? 0),\n };\n};\n\nexport const getPriceImpactFromQuote = (\n quote: QuoteResponse['quote'],\n): Pick<QuoteFetchData, 'price_impact'> => {\n return { price_impact: Number(quote.priceData?.priceImpact ?? '0') };\n};\n\nexport const getTradeDataFromHistory = (\n historyItem: BridgeHistoryItem,\n): TradeData => {\n return {\n usd_quoted_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0),\n gas_included: historyItem.quote.gasIncluded ?? false,\n provider: formatProviderLabel(historyItem.quote),\n quoted_time_minutes: Number(\n historyItem.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0),\n };\n};\n\nexport const getRequestMetadataFromHistory = (\n historyItem: BridgeHistoryItem,\n account?: AccountsControllerState['internalAccounts']['accounts'][string],\n): RequestMetadata => {\n const { quote, slippagePercentage, isStxEnabled } = historyItem;\n\n return {\n slippage_limit: slippagePercentage,\n custom_slippage: isCustomSlippage(slippagePercentage),\n usd_amount_source: Number(historyItem.pricingData?.amountSentInUsd ?? 0),\n swap_type: getSwapType(quote.srcChainId, quote.destChainId),\n is_hardware_wallet: isHardwareWallet(account),\n stx_enabled: isStxEnabled ?? false,\n security_warnings: [],\n };\n};\n\n/**\n * Get the properties for a swap transaction that is not in the txHistory\n *\n * @param transactionMeta - The transaction meta\n * @returns The properties for the swap transaction\n */\nexport const getEVMTxPropertiesFromTransactionMeta = (\n transactionMeta: TransactionMeta,\n) => {\n return {\n source_transaction:\n transactionMeta.status === TransactionStatus.failed\n ? StatusTypes.FAILED\n : StatusTypes.COMPLETE,\n error_message: transactionMeta.error?.message\n ? 'Failed to finalize swap tx'\n : undefined,\n chain_id_source: formatChainIdToCaip(transactionMeta.chainId),\n chain_id_destination: formatChainIdToCaip(transactionMeta.chainId),\n token_symbol_source: transactionMeta.sourceTokenSymbol ?? '',\n token_symbol_destination: transactionMeta.destinationTokenSymbol ?? '',\n usd_amount_source: 100,\n stx_enabled: false,\n token_address_source:\n formatAddressToAssetId(\n transactionMeta.sourceTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n token_address_destination:\n formatAddressToAssetId(\n transactionMeta.destinationTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n custom_slippage: false,\n is_hardware_wallet: false,\n swap_type:\n transactionMeta.type === TransactionType.swap\n ? MetricsSwapType.SINGLE\n : MetricsSwapType.CROSSCHAIN,\n security_warnings: [],\n price_impact: 0,\n usd_quoted_gas: 0,\n gas_included: false,\n quoted_time_minutes: 0,\n usd_quoted_return: 0,\n provider: '' as `${string}_${string}`,\n actual_time_minutes: 0,\n quote_vs_execution_ratio: 0,\n quoted_vs_used_gas_ratio: 0,\n usd_actual_return: 0,\n usd_actual_gas: 0,\n action_type: MetricsActionType.SWAPBRIDGE_V1,\n };\n};\n"]}
|
1
|
+
{"version":3,"file":"metrics.mjs","sourceRoot":"","sources":["../../src/utils/metrics.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,WAAW,EACX,kBAAkB,EAClB,SAAS,EAET,mBAAmB,EAEnB,mBAAmB,EAEnB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EAChB,oCAAoC;AACrC,OAAO,EACL,iBAAiB,EACjB,eAAe,EAEhB,yCAAyC;AAM1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,aAAa,EACb,YAAY,EACZ,KAAK,GACa,EAAgB,EAAE;IACpC,MAAM,kBAAkB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QAC/C,CAAC,CAAC,WAAW,CAAC,QAAQ;QACtB,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC;IACxB,MAAM,uBAAuB,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM;QACtD,CAAC,CAAC,MAAM,CAAC,MAAM;QACf,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC;IAExB,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,WAAW,GAAG,SAAS,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAClE,MAAM,2BAA2B,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QACxD,CAAC,CAAC,WAAW,CAAC,QAAQ;QACtB,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,oBAAoB,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM;QACjD,CAAC,CAAC,WAAW,CAAC,QAAQ;QACtB,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC;IAExB,OAAO;QACL,2BAA2B,EAAE,WAAW;YACtC,CAAC,CAAC,2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OAAO,CACxB,IAAK,EAAoB;QAC5B,yBAAyB,EACvB,sBAAsB,CACpB,eAAe,CAAC,uBAAuB,IAAI,EAAE,EAC7C,eAAe,CAAC,OAAO,CACxB,IAAK,EAAoB;QAC5B,eAAe,EAAE,KAAK;QACtB,kBAAkB,EAAE,KAAK;QACzB,SAAS,EACP,eAAe,CAAC,IAAI;YACpB,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC,QAAQ,CAC3D,eAAe,CAAC,IAAI,CACrB;YACC,CAAC,CAAC,eAAe,CAAC,MAAM;YACxB,CAAC,CAAC,eAAe,CAAC,UAAU;QAChC,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,CAAC;QACjB,YAAY,EAAE,KAAK;QACnB,mBAAmB,EAAE,CAAC;QACtB,iBAAiB,EAAE,CAAC;QACpB,QAAQ,EAAE,EAA2B;QACrC,mBAAmB,EAAE,CAAC;QACtB,wBAAwB,EAAE,CAAC;QAC3B,wBAAwB,EAAE,CAAC;QAC3B,iBAAiB,EAAE,CAAC;QACpB,cAAc,EAAE,CAAC;QACjB,WAAW,EAAE,iBAAiB,CAAC,aAAa;KAC7C,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n QuoteResponse,\n TxData,\n QuoteMetadata,\n} from '@metamask/bridge-controller';\nimport {\n type TxStatusData,\n StatusTypes,\n formatChainIdToHex,\n isEthUsdt,\n type RequestParams,\n formatChainIdToCaip,\n type TradeData,\n formatProviderLabel,\n type RequestMetadata,\n isCustomSlippage,\n getSwapType,\n isHardwareWallet,\n formatAddressToAssetId,\n MetricsActionType,\n MetricsSwapType,\n} from '@metamask/bridge-controller';\nimport {\n TransactionStatus,\n TransactionType,\n type TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\nimport type { BridgeHistoryItem } from 'src/types';\n\nimport type { QuoteFetchData } from '../../../bridge-controller/src/utils/metrics/types';\n\nexport const getTxStatusesFromHistory = ({\n status,\n hasApprovalTx,\n approvalTxId,\n quote,\n}: BridgeHistoryItem): TxStatusData => {\n const source_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n const destination_transaction = status.destChain?.txHash\n ? status.status\n : StatusTypes.PENDING;\n\n const hexChainId = formatChainIdToHex(quote.srcChainId);\n const isEthUsdtTx = isEthUsdt(hexChainId, quote.srcAsset.address);\n const allowance_reset_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : undefined;\n const approval_transaction = status.srcChain.txHash\n ? StatusTypes.COMPLETE\n : StatusTypes.PENDING;\n\n return {\n allowance_reset_transaction: isEthUsdtTx\n ? allowance_reset_transaction\n : undefined,\n approval_transaction:\n hasApprovalTx || approvalTxId ? approval_transaction : undefined,\n source_transaction,\n destination_transaction:\n status.status === StatusTypes.FAILED\n ? StatusTypes.FAILED\n : destination_transaction,\n };\n};\n\nexport const getFinalizedTxProperties = (historyItem: BridgeHistoryItem) => {\n return {\n actual_time_minutes:\n historyItem.completionTime && historyItem.startTime\n ? (historyItem.completionTime - historyItem.startTime) / 60000\n : 0,\n usd_actual_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0), // TODO calculate based on USD price at completion time\n usd_actual_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0), // TODO calculate based on USD price at completion time\n quote_vs_execution_ratio: 1, // TODO calculate based on USD price at completion time\n quoted_vs_used_gas_ratio: 1, // TODO calculate based on USD price at completion time\n };\n};\n\nexport const getRequestParamFromHistory = (\n historyItem: BridgeHistoryItem,\n): RequestParams => {\n return {\n chain_id_source: formatChainIdToCaip(historyItem.quote.srcChainId),\n token_symbol_source: historyItem.quote.srcAsset.symbol,\n token_address_source: historyItem.quote.srcAsset.assetId,\n chain_id_destination: formatChainIdToCaip(historyItem.quote.destChainId),\n token_symbol_destination: historyItem.quote.destAsset.symbol,\n token_address_destination: historyItem.quote.destAsset.assetId,\n };\n};\n\nexport const getTradeDataFromQuote = (\n quoteResponse: QuoteResponse<TxData | string> & QuoteMetadata,\n): TradeData => {\n return {\n usd_quoted_gas: Number(quoteResponse.gasFee?.usd ?? 0),\n gas_included: quoteResponse.quote.gasIncluded ?? false,\n provider: formatProviderLabel(quoteResponse.quote),\n quoted_time_minutes: Number(\n quoteResponse.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(quoteResponse.adjustedReturn?.usd ?? 0),\n };\n};\n\nexport const getPriceImpactFromQuote = (\n quote: QuoteResponse['quote'],\n): Pick<QuoteFetchData, 'price_impact'> => {\n return { price_impact: Number(quote.priceData?.priceImpact ?? '0') };\n};\n\nexport const getTradeDataFromHistory = (\n historyItem: BridgeHistoryItem,\n): TradeData => {\n return {\n usd_quoted_gas: Number(historyItem.pricingData?.quotedGasInUsd ?? 0),\n gas_included: historyItem.quote.gasIncluded ?? false,\n provider: formatProviderLabel(historyItem.quote),\n quoted_time_minutes: Number(\n historyItem.estimatedProcessingTimeInSeconds / 60,\n ),\n usd_quoted_return: Number(historyItem.pricingData?.quotedReturnInUsd ?? 0),\n };\n};\n\nexport const getRequestMetadataFromHistory = (\n historyItem: BridgeHistoryItem,\n account?: AccountsControllerState['internalAccounts']['accounts'][string],\n): RequestMetadata => {\n const { quote, slippagePercentage, isStxEnabled } = historyItem;\n\n return {\n slippage_limit: slippagePercentage,\n custom_slippage: isCustomSlippage(slippagePercentage),\n usd_amount_source: Number(historyItem.pricingData?.amountSentInUsd ?? 0),\n swap_type: getSwapType(quote.srcChainId, quote.destChainId),\n is_hardware_wallet: isHardwareWallet(account),\n stx_enabled: isStxEnabled ?? false,\n security_warnings: [],\n };\n};\n\n/**\n * Get the properties for a swap transaction that is not in the txHistory\n *\n * @param transactionMeta - The transaction meta\n * @returns The properties for the swap transaction\n */\nexport const getEVMTxPropertiesFromTransactionMeta = (\n transactionMeta: TransactionMeta,\n) => {\n return {\n source_transaction: [\n TransactionStatus.failed,\n TransactionStatus.dropped,\n TransactionStatus.rejected,\n ].includes(transactionMeta.status)\n ? StatusTypes.FAILED\n : StatusTypes.COMPLETE,\n error_message: transactionMeta.error?.message\n ? 'Failed to finalize swap tx'\n : undefined,\n chain_id_source: formatChainIdToCaip(transactionMeta.chainId),\n chain_id_destination: formatChainIdToCaip(transactionMeta.chainId),\n token_symbol_source: transactionMeta.sourceTokenSymbol ?? '',\n token_symbol_destination: transactionMeta.destinationTokenSymbol ?? '',\n usd_amount_source: 100,\n stx_enabled: false,\n token_address_source:\n formatAddressToAssetId(\n transactionMeta.sourceTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n token_address_destination:\n formatAddressToAssetId(\n transactionMeta.destinationTokenAddress ?? '',\n transactionMeta.chainId,\n ) ?? ('' as CaipAssetType),\n custom_slippage: false,\n is_hardware_wallet: false,\n swap_type:\n transactionMeta.type &&\n [TransactionType.swap, TransactionType.swapApproval].includes(\n transactionMeta.type,\n )\n ? MetricsSwapType.SINGLE\n : MetricsSwapType.CROSSCHAIN,\n security_warnings: [],\n price_impact: 0,\n usd_quoted_gas: 0,\n gas_included: false,\n quoted_time_minutes: 0,\n usd_quoted_return: 0,\n provider: '' as `${string}_${string}`,\n actual_time_minutes: 0,\n quote_vs_execution_ratio: 0,\n quoted_vs_used_gas_ratio: 0,\n usd_actual_return: 0,\n usd_actual_gas: 0,\n action_type: MetricsActionType.SWAPBRIDGE_V1,\n };\n};\n"]}
|