@metamask-previews/bridge-status-controller 74.3.0-preview-41e84b094 → 74.3.0-preview-02ebbf830
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 +0 -2
- package/dist/bridge-status-controller.cjs +1 -11
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +5 -4
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +5 -4
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +2 -12
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/quote-status-manager/validators.d.cts +24 -24
- package/dist/quote-status-manager/validators.d.mts +24 -24
- package/dist/strategy/types.cjs.map +1 -1
- package/dist/strategy/types.d.cts +3 -3
- package/dist/strategy/types.d.cts.map +1 -1
- package/dist/strategy/types.d.mts +3 -3
- package/dist/strategy/types.d.mts.map +1 -1
- package/dist/strategy/types.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +6 -6
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +6 -6
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/bridge-status.cjs.map +1 -1
- package/dist/utils/bridge-status.d.cts +3 -3
- package/dist/utils/bridge-status.d.cts.map +1 -1
- package/dist/utils/bridge-status.d.mts +3 -3
- package/dist/utils/bridge-status.d.mts.map +1 -1
- package/dist/utils/bridge-status.mjs.map +1 -1
- package/dist/utils/intent-api.cjs.map +1 -1
- package/dist/utils/intent-api.d.cts +2 -2
- package/dist/utils/intent-api.d.cts.map +1 -1
- package/dist/utils/intent-api.d.mts +2 -2
- package/dist/utils/intent-api.d.mts.map +1 -1
- package/dist/utils/intent-api.mjs.map +1 -1
- package/dist/utils/metrics.cjs.map +1 -1
- package/dist/utils/metrics.d.cts +4 -4
- package/dist/utils/metrics.d.cts.map +1 -1
- package/dist/utils/metrics.d.mts +4 -4
- package/dist/utils/metrics.d.mts.map +1 -1
- package/dist/utils/metrics.mjs.map +1 -1
- package/dist/utils/snaps.cjs.map +1 -1
- package/dist/utils/snaps.d.cts +4 -4
- package/dist/utils/snaps.d.cts.map +1 -1
- package/dist/utils/snaps.d.mts +4 -4
- package/dist/utils/snaps.d.mts.map +1 -1
- package/dist/utils/snaps.mjs.map +1 -1
- package/dist/utils/trace.cjs.map +1 -1
- package/dist/utils/trace.d.cts +3 -3
- package/dist/utils/trace.d.cts.map +1 -1
- package/dist/utils/trace.d.mts +3 -3
- package/dist/utils/trace.d.mts.map +1 -1
- package/dist/utils/trace.mjs.map +1 -1
- package/dist/utils/transaction.cjs.map +1 -1
- package/dist/utils/transaction.d.cts +4 -4
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +4 -4
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/transaction.mjs.map +1 -1
- package/dist/utils/validators.d.cts +24 -24
- package/dist/utils/validators.d.mts +24 -24
- package/package.json +1 -1
|
@@ -27,12 +27,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
27
27
|
token?: {} | {
|
|
28
28
|
symbol: string;
|
|
29
29
|
chainId: number;
|
|
30
|
-
|
|
30
|
+
address: string;
|
|
31
31
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
32
|
+
name: string;
|
|
32
33
|
decimals: number;
|
|
33
|
-
address: string;
|
|
34
|
-
iconUrl?: string | null | undefined;
|
|
35
34
|
icon?: string | null | undefined;
|
|
35
|
+
iconUrl?: string | null | undefined;
|
|
36
36
|
} | undefined;
|
|
37
37
|
};
|
|
38
38
|
destChain?: {
|
|
@@ -42,12 +42,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
42
42
|
token?: {} | {
|
|
43
43
|
symbol: string;
|
|
44
44
|
chainId: number;
|
|
45
|
-
|
|
45
|
+
address: string;
|
|
46
46
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
47
|
+
name: string;
|
|
47
48
|
decimals: number;
|
|
48
|
-
address: string;
|
|
49
|
-
iconUrl?: string | null | undefined;
|
|
50
49
|
icon?: string | null | undefined;
|
|
50
|
+
iconUrl?: string | null | undefined;
|
|
51
51
|
} | undefined;
|
|
52
52
|
} | undefined;
|
|
53
53
|
bridge?: string | undefined;
|
|
@@ -69,12 +69,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
69
69
|
token?: {} | {
|
|
70
70
|
symbol: string;
|
|
71
71
|
chainId: number;
|
|
72
|
-
|
|
72
|
+
address: string;
|
|
73
73
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
74
|
+
name: string;
|
|
74
75
|
decimals: number;
|
|
75
|
-
address: string;
|
|
76
|
-
iconUrl?: string | null | undefined;
|
|
77
76
|
icon?: string | null | undefined;
|
|
77
|
+
iconUrl?: string | null | undefined;
|
|
78
78
|
} | undefined;
|
|
79
79
|
};
|
|
80
80
|
destChain?: {
|
|
@@ -84,12 +84,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
84
84
|
token?: {} | {
|
|
85
85
|
symbol: string;
|
|
86
86
|
chainId: number;
|
|
87
|
-
|
|
87
|
+
address: string;
|
|
88
88
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
89
|
+
name: string;
|
|
89
90
|
decimals: number;
|
|
90
|
-
address: string;
|
|
91
|
-
iconUrl?: string | null | undefined;
|
|
92
91
|
icon?: string | null | undefined;
|
|
92
|
+
iconUrl?: string | null | undefined;
|
|
93
93
|
} | undefined;
|
|
94
94
|
} | undefined;
|
|
95
95
|
bridge?: string | undefined;
|
|
@@ -111,12 +111,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
111
111
|
token?: {} | {
|
|
112
112
|
symbol: string;
|
|
113
113
|
chainId: number;
|
|
114
|
-
|
|
114
|
+
address: string;
|
|
115
115
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
116
|
+
name: string;
|
|
116
117
|
decimals: number;
|
|
117
|
-
address: string;
|
|
118
|
-
iconUrl?: string | null | undefined;
|
|
119
118
|
icon?: string | null | undefined;
|
|
119
|
+
iconUrl?: string | null | undefined;
|
|
120
120
|
} | undefined;
|
|
121
121
|
}, {
|
|
122
122
|
chainId: import("@metamask/superstruct").Struct<number, null>;
|
|
@@ -125,12 +125,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
125
125
|
token: import("@metamask/superstruct").Struct<{} | {
|
|
126
126
|
symbol: string;
|
|
127
127
|
chainId: number;
|
|
128
|
-
|
|
128
|
+
address: string;
|
|
129
129
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
130
|
+
name: string;
|
|
130
131
|
decimals: number;
|
|
131
|
-
address: string;
|
|
132
|
-
iconUrl?: string | null | undefined;
|
|
133
132
|
icon?: string | null | undefined;
|
|
133
|
+
iconUrl?: string | null | undefined;
|
|
134
134
|
} | undefined, null>;
|
|
135
135
|
}>;
|
|
136
136
|
destChain: import("@metamask/superstruct").Struct<{
|
|
@@ -140,12 +140,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
140
140
|
token?: {} | {
|
|
141
141
|
symbol: string;
|
|
142
142
|
chainId: number;
|
|
143
|
-
|
|
143
|
+
address: string;
|
|
144
144
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
145
|
+
name: string;
|
|
145
146
|
decimals: number;
|
|
146
|
-
address: string;
|
|
147
|
-
iconUrl?: string | null | undefined;
|
|
148
147
|
icon?: string | null | undefined;
|
|
148
|
+
iconUrl?: string | null | undefined;
|
|
149
149
|
} | undefined;
|
|
150
150
|
} | undefined, {
|
|
151
151
|
chainId: import("@metamask/superstruct").Struct<number, null>;
|
|
@@ -154,12 +154,12 @@ export declare const QuoteStatusGetResponseSchema: import("@metamask/superstruct
|
|
|
154
154
|
token: import("@metamask/superstruct").Struct<{} | {
|
|
155
155
|
symbol: string;
|
|
156
156
|
chainId: number;
|
|
157
|
-
|
|
157
|
+
address: string;
|
|
158
158
|
assetId: `${string}:${string}/${string}:${string}`;
|
|
159
|
+
name: string;
|
|
159
160
|
decimals: number;
|
|
160
|
-
address: string;
|
|
161
|
-
iconUrl?: string | null | undefined;
|
|
162
161
|
icon?: string | null | undefined;
|
|
162
|
+
iconUrl?: string | null | undefined;
|
|
163
163
|
} | undefined, null>;
|
|
164
164
|
}>;
|
|
165
165
|
bridge: import("@metamask/superstruct").Struct<string | undefined, null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":";;;AAuBA,IAAY,UA2BX;AA3BD,WAAY,UAAU;IACpB;;OAEG;IACH,+CAAiC,CAAA;IACjC;;;OAGG;IACH,mDAAqC,CAAA;IACrC;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;OAEG;IACH,6DAA+C,CAAA;IAC/C;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;;OAGG;IACH,iEAAmD,CAAA;AACrD,CAAC,EA3BW,UAAU,0BAAV,UAAU,QA2BrB","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n BatchSellTradesResponse,\n BridgeClientId,\n QuoteMetadata,\n
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":";;;AAuBA,IAAY,UA2BX;AA3BD,WAAY,UAAU;IACpB;;OAEG;IACH,+CAAiC,CAAA;IACjC;;;OAGG;IACH,mDAAqC,CAAA;IACrC;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;OAEG;IACH,6DAA+C,CAAA;IAC/C;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;;OAGG;IACH,iEAAmD,CAAA;AACrD,CAAC,EA3BW,UAAU,0BAAV,UAAU,QA2BrB","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n BatchSellTradesResponse,\n BridgeClientId,\n QuoteMetadata,\n QuoteResponse,\n Trade,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type {\n TransactionController,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\n\nimport type {\n BridgeStatusControllerMessenger,\n FetchFunction,\n QuoteAndTxMetadata,\n StartPollingForBridgeTxStatusArgs,\n} from '../types';\n\nexport enum SubmitStep {\n /**\n * Adds quote and submission data to BridgeStatusController's `txHistory`\n */\n AddHistoryItem = 'addHistoryItem',\n /**\n * Rekeys the history item keyed by the old history key to the new history key,\n * and merges in the tradeMeta's id and hash\n */\n RekeyHistoryItem = 'rekeyHistoryItem',\n /**\n * Triggers polling for the transaction's status\n */\n StartPolling = 'startPolling',\n /**\n * Publishes the Unified SwapBridge Completed metrics event\n */\n PublishCompletedEvent = 'publishCompletedEvent',\n /**\n * Sets the tradeMeta returned to the client after submission\n */\n SetTradeMeta = 'setTradeMeta',\n /**\n * Updates the transaction type of batch transactions to swap/bridge/swapApproval/bridgeApproval\n * for display purposes.\n */\n UpdateBatchTransactions = 'updateBatchTransactions',\n}\n\n/**\n * Any possible result returned by steps in a submission strategy. These can be returned in any order.\n */\nexport type SubmitStepResult =\n | {\n type: SubmitStep.AddHistoryItem;\n payload: Pick<\n StartPollingForBridgeTxStatusArgs,\n 'approvalTxId' | 'bridgeTxMeta' | 'originalTransactionId' | 'actionId'\n > & {\n historyKey: string;\n quoteResponse: QuoteResponse & QuoteMetadata;\n batchSellData?: BatchSellTradesResponse;\n quoteIds?: string[];\n };\n }\n | {\n type: SubmitStep.RekeyHistoryItem;\n payload: {\n /** Usually the actionId of the preceeding `approval` transaction */\n oldHistoryKey: string;\n /** Usually the txMeta.id of the `trade` transaction */\n newHistoryKey: string;\n /** The {@link TransactionMeta} for the `trade` transaction after it has been submitted successfully */\n tradeMeta: TransactionMeta;\n };\n }\n | {\n type: SubmitStep.StartPolling;\n payload: {\n /** The `txHistory` key of the transaction to start polling for */\n historyKey: string;\n };\n }\n | {\n type: SubmitStep.PublishCompletedEvent;\n payload: {\n /** The `txHistory` key of the transaction that has been submitted successfully */\n historyKey: string;\n };\n }\n | {\n type: SubmitStep.SetTradeMeta;\n /** The {@link TransactionMeta} for the transaction that has been submitted successfully */\n payload: {\n tradeMeta: TransactionMeta;\n };\n }\n | {\n type: SubmitStep.UpdateBatchTransactions;\n payload: {\n quoteAndTxMetas: QuoteAndTxMetadata[];\n };\n };\n\n/**\n * The parameters for the submission flow\n */\nexport type SubmitStrategyParams<\n TradeType extends Trade = TxData,\n BatchSellTradesResponseType extends\n | BatchSellTradesResponse\n | undefined\n | null = BatchSellTradesResponse | undefined | null,\n> = {\n /**\n * The response from obtainGaslessBatch API containing submittable transactions and their fees\n */\n batchSellTrades: BatchSellTradesResponseType;\n /**\n * The function to add a transaction batch to the {@link TransactionControllers}\n */\n addTransactionBatchFn: TransactionController['addTransactionBatch'];\n isBridgeTx: boolean;\n isDelegatedAccount: boolean;\n /**\n * Whether the STX is enabled in the wallet. Does not necessarily mean that\n * STX will be used to submit the transaction.\n */\n isStxEnabled: boolean;\n messenger: BridgeStatusControllerMessenger;\n quoteResponses: (QuoteResponse<TradeType, TradeType> & QuoteMetadata)[];\n /**\n * Set to true so hardware wallets get prompted for approval on mobile\n */\n requireApproval: boolean;\n selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string];\n traceFn: TraceCallback;\n // Used for intent transactions\n fetchFn: FetchFunction;\n clientId: BridgeClientId;\n bridgeApiBaseUrl: string;\n /**\n * The batch ID of the transaction batch passed to the addTransactionBatchFn\n * This is only used for batch-sell transactions.\n */\n batchId?: Hex;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AccountsControllerState } from "@metamask/accounts-controller";
|
|
2
|
-
import type { BatchSellTradesResponse, BridgeClientId, QuoteMetadata,
|
|
2
|
+
import type { BatchSellTradesResponse, BridgeClientId, QuoteMetadata, QuoteResponse, Trade, TxData } from "@metamask/bridge-controller";
|
|
3
3
|
import type { TraceCallback } from "@metamask/controller-utils";
|
|
4
4
|
import type { TransactionController, TransactionMeta } from "@metamask/transaction-controller";
|
|
5
5
|
import type { Hex } from "@metamask/utils";
|
|
@@ -39,7 +39,7 @@ export type SubmitStepResult = {
|
|
|
39
39
|
type: SubmitStep.AddHistoryItem;
|
|
40
40
|
payload: Pick<StartPollingForBridgeTxStatusArgs, 'approvalTxId' | 'bridgeTxMeta' | 'originalTransactionId' | 'actionId'> & {
|
|
41
41
|
historyKey: string;
|
|
42
|
-
quoteResponse:
|
|
42
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
43
43
|
batchSellData?: BatchSellTradesResponse;
|
|
44
44
|
quoteIds?: string[];
|
|
45
45
|
};
|
|
@@ -97,7 +97,7 @@ export type SubmitStrategyParams<TradeType extends Trade = TxData, BatchSellTrad
|
|
|
97
97
|
*/
|
|
98
98
|
isStxEnabled: boolean;
|
|
99
99
|
messenger: BridgeStatusControllerMessenger;
|
|
100
|
-
quoteResponses: (
|
|
100
|
+
quoteResponses: (QuoteResponse<TradeType, TradeType> & QuoteMetadata)[];
|
|
101
101
|
/**
|
|
102
102
|
* Set to true so hardware wallets get prompted for approval on mobile
|
|
103
103
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,aAAa,EACb,KAAK,EACL,MAA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";
|
|
2
|
-
import type { BatchSellTradesResponse, BridgeClientId, QuoteMetadata,
|
|
2
|
+
import type { BatchSellTradesResponse, BridgeClientId, QuoteMetadata, QuoteResponse, Trade, TxData } from "@metamask/bridge-controller";
|
|
3
3
|
import type { TraceCallback } from "@metamask/controller-utils";
|
|
4
4
|
import type { TransactionController, TransactionMeta } from "@metamask/transaction-controller";
|
|
5
5
|
import type { Hex } from "@metamask/utils";
|
|
@@ -39,7 +39,7 @@ export type SubmitStepResult = {
|
|
|
39
39
|
type: SubmitStep.AddHistoryItem;
|
|
40
40
|
payload: Pick<StartPollingForBridgeTxStatusArgs, 'approvalTxId' | 'bridgeTxMeta' | 'originalTransactionId' | 'actionId'> & {
|
|
41
41
|
historyKey: string;
|
|
42
|
-
quoteResponse:
|
|
42
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
43
43
|
batchSellData?: BatchSellTradesResponse;
|
|
44
44
|
quoteIds?: string[];
|
|
45
45
|
};
|
|
@@ -97,7 +97,7 @@ export type SubmitStrategyParams<TradeType extends Trade = TxData, BatchSellTrad
|
|
|
97
97
|
*/
|
|
98
98
|
isStxEnabled: boolean;
|
|
99
99
|
messenger: BridgeStatusControllerMessenger;
|
|
100
|
-
quoteResponses: (
|
|
100
|
+
quoteResponses: (QuoteResponse<TradeType, TradeType> & QuoteMetadata)[];
|
|
101
101
|
/**
|
|
102
102
|
* Set to true so hardware wallets get prompted for approval on mobile
|
|
103
103
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EACV,uBAAuB,EACvB,cAAc,EACd,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sC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AG,CAAC;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,UA2BX;AA3BD,WAAY,UAAU;IACpB;;OAEG;IACH,+CAAiC,CAAA;IACjC;;;OAGG;IACH,mDAAqC,CAAA;IACrC;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;OAEG;IACH,6DAA+C,CAAA;IAC/C;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;;OAGG;IACH,iEAAmD,CAAA;AACrD,CAAC,EA3BW,UAAU,KAAV,UAAU,QA2BrB","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n BatchSellTradesResponse,\n BridgeClientId,\n QuoteMetadata,\n
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/strategy/types.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAN,IAAY,UA2BX;AA3BD,WAAY,UAAU;IACpB;;OAEG;IACH,+CAAiC,CAAA;IACjC;;;OAGG;IACH,mDAAqC,CAAA;IACrC;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;OAEG;IACH,6DAA+C,CAAA;IAC/C;;OAEG;IACH,2CAA6B,CAAA;IAC7B;;;OAGG;IACH,iEAAmD,CAAA;AACrD,CAAC,EA3BW,UAAU,KAAV,UAAU,QA2BrB","sourcesContent":["import type { AccountsControllerState } from '@metamask/accounts-controller';\nimport type {\n BatchSellTradesResponse,\n BridgeClientId,\n QuoteMetadata,\n QuoteResponse,\n Trade,\n TxData,\n} from '@metamask/bridge-controller';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type {\n TransactionController,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\n\nimport type {\n BridgeStatusControllerMessenger,\n FetchFunction,\n QuoteAndTxMetadata,\n StartPollingForBridgeTxStatusArgs,\n} from '../types';\n\nexport enum SubmitStep {\n /**\n * Adds quote and submission data to BridgeStatusController's `txHistory`\n */\n AddHistoryItem = 'addHistoryItem',\n /**\n * Rekeys the history item keyed by the old history key to the new history key,\n * and merges in the tradeMeta's id and hash\n */\n RekeyHistoryItem = 'rekeyHistoryItem',\n /**\n * Triggers polling for the transaction's status\n */\n StartPolling = 'startPolling',\n /**\n * Publishes the Unified SwapBridge Completed metrics event\n */\n PublishCompletedEvent = 'publishCompletedEvent',\n /**\n * Sets the tradeMeta returned to the client after submission\n */\n SetTradeMeta = 'setTradeMeta',\n /**\n * Updates the transaction type of batch transactions to swap/bridge/swapApproval/bridgeApproval\n * for display purposes.\n */\n UpdateBatchTransactions = 'updateBatchTransactions',\n}\n\n/**\n * Any possible result returned by steps in a submission strategy. These can be returned in any order.\n */\nexport type SubmitStepResult =\n | {\n type: SubmitStep.AddHistoryItem;\n payload: Pick<\n StartPollingForBridgeTxStatusArgs,\n 'approvalTxId' | 'bridgeTxMeta' | 'originalTransactionId' | 'actionId'\n > & {\n historyKey: string;\n quoteResponse: QuoteResponse & QuoteMetadata;\n batchSellData?: BatchSellTradesResponse;\n quoteIds?: string[];\n };\n }\n | {\n type: SubmitStep.RekeyHistoryItem;\n payload: {\n /** Usually the actionId of the preceeding `approval` transaction */\n oldHistoryKey: string;\n /** Usually the txMeta.id of the `trade` transaction */\n newHistoryKey: string;\n /** The {@link TransactionMeta} for the `trade` transaction after it has been submitted successfully */\n tradeMeta: TransactionMeta;\n };\n }\n | {\n type: SubmitStep.StartPolling;\n payload: {\n /** The `txHistory` key of the transaction to start polling for */\n historyKey: string;\n };\n }\n | {\n type: SubmitStep.PublishCompletedEvent;\n payload: {\n /** The `txHistory` key of the transaction that has been submitted successfully */\n historyKey: string;\n };\n }\n | {\n type: SubmitStep.SetTradeMeta;\n /** The {@link TransactionMeta} for the transaction that has been submitted successfully */\n payload: {\n tradeMeta: TransactionMeta;\n };\n }\n | {\n type: SubmitStep.UpdateBatchTransactions;\n payload: {\n quoteAndTxMetas: QuoteAndTxMetadata[];\n };\n };\n\n/**\n * The parameters for the submission flow\n */\nexport type SubmitStrategyParams<\n TradeType extends Trade = TxData,\n BatchSellTradesResponseType extends\n | BatchSellTradesResponse\n | undefined\n | null = BatchSellTradesResponse | undefined | null,\n> = {\n /**\n * The response from obtainGaslessBatch API containing submittable transactions and their fees\n */\n batchSellTrades: BatchSellTradesResponseType;\n /**\n * The function to add a transaction batch to the {@link TransactionControllers}\n */\n addTransactionBatchFn: TransactionController['addTransactionBatch'];\n isBridgeTx: boolean;\n isDelegatedAccount: boolean;\n /**\n * Whether the STX is enabled in the wallet. Does not necessarily mean that\n * STX will be used to submit the transaction.\n */\n isStxEnabled: boolean;\n messenger: BridgeStatusControllerMessenger;\n quoteResponses: (QuoteResponse<TradeType, TradeType> & QuoteMetadata)[];\n /**\n * Set to true so hardware wallets get prompted for approval on mobile\n */\n requireApproval: boolean;\n selectedAccount: AccountsControllerState['internalAccounts']['accounts'][string];\n traceFn: TraceCallback;\n // Used for intent transactions\n fetchFn: FetchFunction;\n clientId: BridgeClientId;\n bridgeApiBaseUrl: string;\n /**\n * The batch ID of the transaction batch passed to the addTransactionBatchFn\n * This is only used for batch-sell transactions.\n */\n batchId?: Hex;\n};\n"]}
|
package/dist/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA6CA,+CAA4D;AAC5D,oEAAoE;AACpE,uDAA0D;AAE1D,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAyCD,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,wBAAR,QAAQ,QAanB;AAyHD;;;GAGG;AACH,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n ChainId,\n FeatureId,\n QuoteMetadata,\n QuoteResponseV1,\n MetaMetricsSwapsEventSource,\n SimulatedGasFeeLimits,\n TxData,\n TxFeeGasLimits,\n BridgeControllerTrackUnifiedSwapBridgeEventAction,\n BridgeControllerStopPollingForQuotesAction,\n BatchSellTradesResponse,\n BridgeControllerGetStateAction,\n InputPrimaryDenomination,\n} from '@metamask/bridge-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusControllerMethodActions } from './bridge-status-controller-method-action-types';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport { QuoteStatusState } from './quote-status-manager/constants';\nimport { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: QuoteResponseV1['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\n/**\n * This type ties together the quote, its tx params and the submitted txMeta.\n * Each trade/approval will have its own QuoteAndTxMetadata object.\n */\nexport type QuoteAndTxMetadata = {\n type: TransactionType;\n quoteResponse: QuoteResponseV1 & QuoteMetadata;\n /**\n * The approval or trade object from the quote response\n */\n tx: TxData;\n assetsFiatValues?: { sending?: string; receiving?: string };\n /**\n * The simulated gas fee limits for the transaction provided by the bridge-api\n */\n txFee?: SimulatedGasFeeLimits | TxFeeGasLimits;\n /**\n * Transaction metadata from the TransactionController after submission\n */\n txMeta?: TransactionMeta;\n};\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n /**\n * This is defined when the history item is for a batch sell transaction\n */\n batchSellData?: BatchSellTradesResponse;\n /**\n * This is defined when the history item corresponds to the 7702 batch's delegation tx.\n * It contains the list of quoteIds for the BatchSell quotes that are part of the 7702 batch.\n * Each quote can be retrieved from txHistory as `txHistory[quoteId]`.\n *\n * On single swaps/bridges this value is an empty array, or absent on history items\n * persisted before this field was introduced.\n */\n quoteIds?: string[];\n quote: QuoteResponseV1['quote'];\n /**\n * This is the the quote id used on single swaps/bridges. On batch sell, it is set\n * as the first item of `quoteIds`.\n *\n * This value is absent on history items persisted before this field was introduced.\n */\n quoteId?: string;\n reportedSubmittedTxHash?: string;\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: string;\n amountSentInUsd?: string;\n quotedGasInUsd?: string;\n quotedGasAmount?: string;\n quotedReturnInUsd?: string;\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n /**\n * Client-supplied security classification for the destination token at the\n * time the swap/bridge was submitted. Persisted so post-submit analytics\n * events (Completed, Failed, StatusValidationFailed) can include\n * `token_security_type_destination`. `null` when no security data was\n * available for the destination token.\n */\n tokenSecurityTypeDestination?: string | null;\n /**\n * The denomination shown as the primary source amount input when the\n * swap/bridge was submitted.\n */\n inputPrimaryDenomination?: InputPrimaryDenomination;\n};\n\n/**\n * @deprecated Use the separate action types instead (e.g.\n * `BridgeStatusControllerStartPollingForBridgeTxStatusAction`).\n */\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: Pick<TransactionMeta, 'id' | 'hash' | 'batchId'>;\n actionId?: string;\n batchSellData?: BridgeHistoryItem['batchSellData'];\n quoteIds?: BridgeHistoryItem['quoteIds'];\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string;\n quoteResponse: QuoteResponseV1 & QuoteMetadata;\n startTime: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location: MetaMetricsSwapsEventSource;\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n // Client-supplied destination token security classification, persisted on\n // the history item for post-submit analytics events.\n tokenSecurityTypeDestination?: BridgeHistoryItem['tokenSecurityTypeDestination'];\n // Primary denomination at submission time, persisted for post-submit analytics.\n inputPrimaryDenomination?: BridgeHistoryItem['inputPrimaryDenomination'];\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: QuoteResponseV1 & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type QuoteStatusPersistEntry = {\n quoteId: string;\n srcTxHash: string;\n status: QuoteStatusState;\n createdAt: number;\n lastAttemptAt: number;\n txMetaId?: string;\n};\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n quoteUpdateStatusStore: Record<string, QuoteStatusPersistEntry>;\n};\n\n// Actions\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerMethodActions;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | SnapControllerHandleRequestAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerTrackUnifiedSwapBridgeEventAction\n | BridgeControllerStopPollingForQuotesAction\n | BridgeControllerGetStateAction\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionStatusUpdatedEvent\n | TransactionControllerTransactionSubmittedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.cjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA8CA,+CAA4D;AAC5D,oEAAoE;AACpE,uDAA0D;AAE1D,8EAA8E;AAC9E,2BAA2B;AAE3B,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,8BAAd,cAAc,QAGzB;AAyCD,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,wBAAR,QAAQ,QAanB;AAyHD;;;GAGG;AACH,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,kCAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n SimulatedGasFeeLimits,\n TxData,\n TxFeeGasLimits,\n BridgeControllerTrackUnifiedSwapBridgeEventAction,\n BridgeControllerStopPollingForQuotesAction,\n BatchSellTradesResponse,\n BridgeControllerGetStateAction,\n InputPrimaryDenomination,\n} from '@metamask/bridge-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusControllerMethodActions } from './bridge-status-controller-method-action-types';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport { QuoteStatusState } from './quote-status-manager/constants';\nimport { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\n/**\n * This type ties together the quote, its tx params and the submitted txMeta.\n * Each trade/approval will have its own QuoteAndTxMetadata object.\n */\nexport type QuoteAndTxMetadata = {\n type: TransactionType;\n quoteResponse: QuoteResponse & QuoteMetadata;\n /**\n * The approval or trade object from the quote response\n */\n tx: TxData;\n assetsFiatValues?: { sending?: string; receiving?: string };\n /**\n * The simulated gas fee limits for the transaction provided by the bridge-api\n */\n txFee?: SimulatedGasFeeLimits | TxFeeGasLimits;\n /**\n * Transaction metadata from the TransactionController after submission\n */\n txMeta?: TransactionMeta;\n};\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n /**\n * This is defined when the history item is for a batch sell transaction\n */\n batchSellData?: BatchSellTradesResponse;\n /**\n * This is defined when the history item corresponds to the 7702 batch's delegation tx.\n * It contains the list of quoteIds for the BatchSell quotes that are part of the 7702 batch.\n * Each quote can be retrieved from txHistory as `txHistory[quoteId]`.\n *\n * On single swaps/bridges this value is an empty array, or absent on history items\n * persisted before this field was introduced.\n */\n quoteIds?: string[];\n quote: Quote;\n /**\n * This is the the quote id used on single swaps/bridges. On batch sell, it is set\n * as the first item of `quoteIds`.\n *\n * This value is absent on history items persisted before this field was introduced.\n */\n quoteId?: string;\n reportedSubmittedTxHash?: string;\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: string;\n amountSentInUsd?: string;\n quotedGasInUsd?: string;\n quotedGasAmount?: string;\n quotedReturnInUsd?: string;\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n /**\n * Client-supplied security classification for the destination token at the\n * time the swap/bridge was submitted. Persisted so post-submit analytics\n * events (Completed, Failed, StatusValidationFailed) can include\n * `token_security_type_destination`. `null` when no security data was\n * available for the destination token.\n */\n tokenSecurityTypeDestination?: string | null;\n /**\n * The denomination shown as the primary source amount input when the\n * swap/bridge was submitted.\n */\n inputPrimaryDenomination?: InputPrimaryDenomination;\n};\n\n/**\n * @deprecated Use the separate action types instead (e.g.\n * `BridgeStatusControllerStartPollingForBridgeTxStatusAction`).\n */\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: Pick<TransactionMeta, 'id' | 'hash' | 'batchId'>;\n actionId?: string;\n batchSellData?: BridgeHistoryItem['batchSellData'];\n quoteIds?: BridgeHistoryItem['quoteIds'];\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location: MetaMetricsSwapsEventSource;\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n // Client-supplied destination token security classification, persisted on\n // the history item for post-submit analytics events.\n tokenSecurityTypeDestination?: BridgeHistoryItem['tokenSecurityTypeDestination'];\n // Primary denomination at submission time, persisted for post-submit analytics.\n inputPrimaryDenomination?: BridgeHistoryItem['inputPrimaryDenomination'];\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 & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type QuoteStatusPersistEntry = {\n quoteId: string;\n srcTxHash: string;\n status: QuoteStatusState;\n createdAt: number;\n lastAttemptAt: number;\n txMetaId?: string;\n};\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n quoteUpdateStatusStore: Record<string, QuoteStatusPersistEntry>;\n};\n\n// Actions\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerMethodActions;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | SnapControllerHandleRequestAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerTrackUnifiedSwapBridgeEventAction\n | BridgeControllerStopPollingForQuotesAction\n | BridgeControllerGetStateAction\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionStatusUpdatedEvent\n | TransactionControllerTransactionSubmittedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccountsControllerGetAccountByAddressAction } from "@metamask/accounts-controller";
|
|
2
2
|
import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
3
|
-
import type { ChainId, FeatureId, QuoteMetadata,
|
|
3
|
+
import type { ChainId, FeatureId, Quote, QuoteMetadata, QuoteResponse, MetaMetricsSwapsEventSource, SimulatedGasFeeLimits, TxData, TxFeeGasLimits, BridgeControllerTrackUnifiedSwapBridgeEventAction, BridgeControllerStopPollingForQuotesAction, BatchSellTradesResponse, BridgeControllerGetStateAction, InputPrimaryDenomination } from "@metamask/bridge-controller";
|
|
4
4
|
import type { KeyringControllerSignTypedMessageAction } from "@metamask/keyring-controller";
|
|
5
5
|
import type { Messenger } from "@metamask/messenger";
|
|
6
6
|
import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction } from "@metamask/network-controller";
|
|
@@ -34,7 +34,7 @@ export type StatusRequest = {
|
|
|
34
34
|
bridge: string;
|
|
35
35
|
srcChainId: ChainId;
|
|
36
36
|
destChainId: ChainId;
|
|
37
|
-
quote?:
|
|
37
|
+
quote?: Quote;
|
|
38
38
|
refuel?: boolean;
|
|
39
39
|
};
|
|
40
40
|
export type StatusRequestDto = Omit<StatusRequest, 'quote' | 'srcChainId' | 'destChainId' | 'refuel'> & {
|
|
@@ -68,7 +68,7 @@ export type RefuelStatusResponse = object & StatusResponse;
|
|
|
68
68
|
*/
|
|
69
69
|
export type QuoteAndTxMetadata = {
|
|
70
70
|
type: TransactionType;
|
|
71
|
-
quoteResponse:
|
|
71
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
72
72
|
/**
|
|
73
73
|
* The approval or trade object from the quote response
|
|
74
74
|
*/
|
|
@@ -107,7 +107,7 @@ export type BridgeHistoryItem = {
|
|
|
107
107
|
* persisted before this field was introduced.
|
|
108
108
|
*/
|
|
109
109
|
quoteIds?: string[];
|
|
110
|
-
quote:
|
|
110
|
+
quote: Quote;
|
|
111
111
|
/**
|
|
112
112
|
* This is the the quote id used on single swaps/bridges. On batch sell, it is set
|
|
113
113
|
* as the first item of `quoteIds`.
|
|
@@ -239,7 +239,7 @@ export type StartPollingForBridgeTxStatusArgs = {
|
|
|
239
239
|
* @deprecated the txMeta or orderUid should be used instead
|
|
240
240
|
*/
|
|
241
241
|
originalTransactionId?: string;
|
|
242
|
-
quoteResponse:
|
|
242
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
243
243
|
startTime: BridgeHistoryItem['startTime'];
|
|
244
244
|
slippagePercentage: BridgeHistoryItem['slippagePercentage'];
|
|
245
245
|
initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];
|
|
@@ -259,7 +259,7 @@ export type StartPollingForBridgeTxStatusArgs = {
|
|
|
259
259
|
* so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action
|
|
260
260
|
*/
|
|
261
261
|
export type StartPollingForBridgeTxStatusArgsSerialized = Omit<StartPollingForBridgeTxStatusArgs, 'quoteResponse'> & {
|
|
262
|
-
quoteResponse:
|
|
262
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
263
263
|
};
|
|
264
264
|
export type SourceChainTxMetaId = string;
|
|
265
265
|
export type QuoteStatusPersistEntry = {
|
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,EAAE,2CAA2C,EAAE,sCAAsC;AACjG,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2CAA2C,EAAE,sCAAsC;AACjG,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,KAAK,EACL,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,EACN,cAAc,EACd,iDAAiD,EACjD,0CAA0C,EAC1C,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACzB,oCAAoC;AACrC,OAAO,KAAK,EAAE,uCAAuC,EAAE,qCAAqC;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EACV,mDAAmD,EACnD,2CAA2C,EAC3C,+BAA+B,EAChC,qCAAqC;AACtC,OAAO,KAAK,EAAE,4CAA4C,EAAE,+CAA+C;AAC3G,OAAO,KAAK,EAAE,yCAAyC,EAAE,iDAAiD;AAC1G,OAAO,KAAK,EAAE,iCAAiC,EAAE,oCAAoC;AACrF,OAAO,KAAK,EAAE,KAAK,EAAE,8BAA8B;AACnD,OAAO,KAAK,EACV,yCAAyC,EACzC,yCAAyC,EACzC,mCAAmC,EACnC,iDAAiD,EACjD,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MAAM,MAAM,6BAA6B,GACrC,oCAAoC,GACpC,mCAAmC,CAAC;AAGxC,MAAM,MAAM,sCAAsC,GAAG,0BAA0B,CAC7E,OAAO,6BAA6B,EACpC,2BAA2B,CAC5B,CAAC;AACF;;;GAGG;AACH,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,CAAC,aAAa,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,4BAA4B,GACpC,sCAAsC,GACtC,0DAA0D,CAAC;AAE/D;;GAEG;AACH,KAAK,cAAc,GACf,mDAAmD,GACnD,+BAA+B,GAC/B,2CAA2C,GAC3C,yCAAyC,GACzC,iCAAiC,GACjC,mCAAmC,GACnC,4CAA4C,GAC5C,yCAAyC,GACzC,yCAAyC,GACzC,iDAAiD,GACjD,iDAAiD,GACjD,0CAA0C,GAC1C,8BAA8B,GAC9B,2CAA2C,GAC3C,4CAA4C,GAC5C,uCAAuC,CAAC;AAE5C;;GAEG;AACH,KAAK,aAAa,GACd,kDAAkD,GAClD,8CAA8C,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,+BAA+B,GAAG,SAAS,CACrD,OAAO,6BAA6B,EACpC,6BAA6B,GAAG,cAAc,EAC9C,4BAA4B,GAAG,aAAa,CAC7C,CAAC"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AccountsControllerGetAccountByAddressAction } from "@metamask/accounts-controller";
|
|
2
2
|
import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
3
|
-
import type { ChainId, FeatureId, QuoteMetadata,
|
|
3
|
+
import type { ChainId, FeatureId, Quote, QuoteMetadata, QuoteResponse, MetaMetricsSwapsEventSource, SimulatedGasFeeLimits, TxData, TxFeeGasLimits, BridgeControllerTrackUnifiedSwapBridgeEventAction, BridgeControllerStopPollingForQuotesAction, BatchSellTradesResponse, BridgeControllerGetStateAction, InputPrimaryDenomination } from "@metamask/bridge-controller";
|
|
4
4
|
import type { KeyringControllerSignTypedMessageAction } from "@metamask/keyring-controller";
|
|
5
5
|
import type { Messenger } from "@metamask/messenger";
|
|
6
6
|
import type { NetworkControllerFindNetworkClientIdByChainIdAction, NetworkControllerGetNetworkClientByIdAction, NetworkControllerGetStateAction } from "@metamask/network-controller";
|
|
@@ -34,7 +34,7 @@ export type StatusRequest = {
|
|
|
34
34
|
bridge: string;
|
|
35
35
|
srcChainId: ChainId;
|
|
36
36
|
destChainId: ChainId;
|
|
37
|
-
quote?:
|
|
37
|
+
quote?: Quote;
|
|
38
38
|
refuel?: boolean;
|
|
39
39
|
};
|
|
40
40
|
export type StatusRequestDto = Omit<StatusRequest, 'quote' | 'srcChainId' | 'destChainId' | 'refuel'> & {
|
|
@@ -68,7 +68,7 @@ export type RefuelStatusResponse = object & StatusResponse;
|
|
|
68
68
|
*/
|
|
69
69
|
export type QuoteAndTxMetadata = {
|
|
70
70
|
type: TransactionType;
|
|
71
|
-
quoteResponse:
|
|
71
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
72
72
|
/**
|
|
73
73
|
* The approval or trade object from the quote response
|
|
74
74
|
*/
|
|
@@ -107,7 +107,7 @@ export type BridgeHistoryItem = {
|
|
|
107
107
|
* persisted before this field was introduced.
|
|
108
108
|
*/
|
|
109
109
|
quoteIds?: string[];
|
|
110
|
-
quote:
|
|
110
|
+
quote: Quote;
|
|
111
111
|
/**
|
|
112
112
|
* This is the the quote id used on single swaps/bridges. On batch sell, it is set
|
|
113
113
|
* as the first item of `quoteIds`.
|
|
@@ -239,7 +239,7 @@ export type StartPollingForBridgeTxStatusArgs = {
|
|
|
239
239
|
* @deprecated the txMeta or orderUid should be used instead
|
|
240
240
|
*/
|
|
241
241
|
originalTransactionId?: string;
|
|
242
|
-
quoteResponse:
|
|
242
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
243
243
|
startTime: BridgeHistoryItem['startTime'];
|
|
244
244
|
slippagePercentage: BridgeHistoryItem['slippagePercentage'];
|
|
245
245
|
initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];
|
|
@@ -259,7 +259,7 @@ export type StartPollingForBridgeTxStatusArgs = {
|
|
|
259
259
|
* so we force the ui to do it manually, by using StartPollingForBridgeTxStatusArgsSerialized type on the startPollingForBridgeTxStatus action
|
|
260
260
|
*/
|
|
261
261
|
export type StartPollingForBridgeTxStatusArgsSerialized = Omit<StartPollingForBridgeTxStatusArgs, 'quoteResponse'> & {
|
|
262
|
-
quoteResponse:
|
|
262
|
+
quoteResponse: QuoteResponse & QuoteMetadata;
|
|
263
263
|
};
|
|
264
264
|
export type SourceChainTxMetaId = string;
|
|
265
265
|
export type QuoteStatusPersistEntry = {
|
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,EAAE,2CAA2C,EAAE,sCAAsC;AACjG,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2CAA2C,EAAE,sCAAsC;AACjG,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,kCAAkC;AACnC,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,KAAK,EACL,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,qBAAqB,EACrB,MAAM,EACN,cAAc,EACd,iDAAiD,EACjD,0CAA0C,EAC1C,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACzB,oCAAoC;AACrC,OAAO,KAAK,EAAE,uCAAuC,EAAE,qCAAqC;AAC5F,OAAO,KAAK,EAAE,SAAS,EAAE,4BA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version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AAC5D,OAAO,EAAE,gBAAgB,EAAE,6CAAyC;AACpE,OAAO,EAAE,oBAAoB,EAAE,+BAA2B;AAE1D,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAyCD,MAAM,CAAN,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,KAAR,QAAQ,QAanB;AAyHD;;;GAGG;AACH,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n ChainId,\n FeatureId,\n QuoteMetadata,\n QuoteResponseV1,\n MetaMetricsSwapsEventSource,\n SimulatedGasFeeLimits,\n TxData,\n TxFeeGasLimits,\n BridgeControllerTrackUnifiedSwapBridgeEventAction,\n BridgeControllerStopPollingForQuotesAction,\n BatchSellTradesResponse,\n BridgeControllerGetStateAction,\n InputPrimaryDenomination,\n} from '@metamask/bridge-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusControllerMethodActions } from './bridge-status-controller-method-action-types';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport { QuoteStatusState } from './quote-status-manager/constants';\nimport { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: QuoteResponseV1['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\n/**\n * This type ties together the quote, its tx params and the submitted txMeta.\n * Each trade/approval will have its own QuoteAndTxMetadata object.\n */\nexport type QuoteAndTxMetadata = {\n type: TransactionType;\n quoteResponse: QuoteResponseV1 & QuoteMetadata;\n /**\n * The approval or trade object from the quote response\n */\n tx: TxData;\n assetsFiatValues?: { sending?: string; receiving?: string };\n /**\n * The simulated gas fee limits for the transaction provided by the bridge-api\n */\n txFee?: SimulatedGasFeeLimits | TxFeeGasLimits;\n /**\n * Transaction metadata from the TransactionController after submission\n */\n txMeta?: TransactionMeta;\n};\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n /**\n * This is defined when the history item is for a batch sell transaction\n */\n batchSellData?: BatchSellTradesResponse;\n /**\n * This is defined when the history item corresponds to the 7702 batch's delegation tx.\n * It contains the list of quoteIds for the BatchSell quotes that are part of the 7702 batch.\n * Each quote can be retrieved from txHistory as `txHistory[quoteId]`.\n *\n * On single swaps/bridges this value is an empty array, or absent on history items\n * persisted before this field was introduced.\n */\n quoteIds?: string[];\n quote: QuoteResponseV1['quote'];\n /**\n * This is the the quote id used on single swaps/bridges. On batch sell, it is set\n * as the first item of `quoteIds`.\n *\n * This value is absent on history items persisted before this field was introduced.\n */\n quoteId?: string;\n reportedSubmittedTxHash?: string;\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: string;\n amountSentInUsd?: string;\n quotedGasInUsd?: string;\n quotedGasAmount?: string;\n quotedReturnInUsd?: string;\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n /**\n * Client-supplied security classification for the destination token at the\n * time the swap/bridge was submitted. Persisted so post-submit analytics\n * events (Completed, Failed, StatusValidationFailed) can include\n * `token_security_type_destination`. `null` when no security data was\n * available for the destination token.\n */\n tokenSecurityTypeDestination?: string | null;\n /**\n * The denomination shown as the primary source amount input when the\n * swap/bridge was submitted.\n */\n inputPrimaryDenomination?: InputPrimaryDenomination;\n};\n\n/**\n * @deprecated Use the separate action types instead (e.g.\n * `BridgeStatusControllerStartPollingForBridgeTxStatusAction`).\n */\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: Pick<TransactionMeta, 'id' | 'hash' | 'batchId'>;\n actionId?: string;\n batchSellData?: BridgeHistoryItem['batchSellData'];\n quoteIds?: BridgeHistoryItem['quoteIds'];\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string;\n quoteResponse: QuoteResponseV1 & QuoteMetadata;\n startTime: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location: MetaMetricsSwapsEventSource;\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n // Client-supplied destination token security classification, persisted on\n // the history item for post-submit analytics events.\n tokenSecurityTypeDestination?: BridgeHistoryItem['tokenSecurityTypeDestination'];\n // Primary denomination at submission time, persisted for post-submit analytics.\n inputPrimaryDenomination?: BridgeHistoryItem['inputPrimaryDenomination'];\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: QuoteResponseV1 & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type QuoteStatusPersistEntry = {\n quoteId: string;\n srcTxHash: string;\n status: QuoteStatusState;\n createdAt: number;\n lastAttemptAt: number;\n txMetaId?: string;\n};\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n quoteUpdateStatusStore: Record<string, QuoteStatusPersistEntry>;\n};\n\n// Actions\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerMethodActions;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | SnapControllerHandleRequestAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerTrackUnifiedSwapBridgeEventAction\n | BridgeControllerStopPollingForQuotesAction\n | BridgeControllerGetStateAction\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionStatusUpdatedEvent\n | TransactionControllerTransactionSubmittedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA8CA,OAAO,EAAE,6BAA6B,EAAE,wBAAoB;AAC5D,OAAO,EAAE,gBAAgB,EAAE,6CAAyC;AACpE,OAAO,EAAE,oBAAoB,EAAE,+BAA2B;AAE1D,8EAA8E;AAC9E,2BAA2B;AAE3B,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAyCD,MAAM,CAAN,IAAY,QAaX;AAbD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,2BAAe,CAAA;IACf,uCAA2B,CAAA;IAC3B,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,mCAAuB,CAAA;IACvB,qCAAyB,CAAA;IACzB,6BAAiB,CAAA;IACjB,6BAAiB,CAAA;IACjB,iCAAqB,CAAA;IACrB,2BAAe,CAAA;IACf,2BAAe,CAAA;AACjB,CAAC,EAbW,QAAQ,KAAR,QAAQ,QAanB;AAyHD;;;GAGG;AACH,MAAM,CAAN,IAAY,kBASX;AATD,WAAY,kBAAkB;IAC5B,qFAA+D,CAAA;IAC/D,2DAAqC,CAAA;IACrC,2CAAqB,CAAA;IACrB,+CAAyB,CAAA;IACzB,2CAAqB,CAAA;IACrB,mDAA6B,CAAA;IAC7B,yFAAmE,CAAA;IACnE,uFAAiE,CAAA;AACnE,CAAC,EATW,kBAAkB,KAAlB,kBAAkB,QAS7B","sourcesContent":["import type { AccountsControllerGetAccountByAddressAction } from '@metamask/accounts-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n} from '@metamask/base-controller';\nimport type {\n ChainId,\n FeatureId,\n Quote,\n QuoteMetadata,\n QuoteResponse,\n MetaMetricsSwapsEventSource,\n SimulatedGasFeeLimits,\n TxData,\n TxFeeGasLimits,\n BridgeControllerTrackUnifiedSwapBridgeEventAction,\n BridgeControllerStopPollingForQuotesAction,\n BatchSellTradesResponse,\n BridgeControllerGetStateAction,\n InputPrimaryDenomination,\n} from '@metamask/bridge-controller';\nimport type { KeyringControllerSignTypedMessageAction } from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type {\n NetworkControllerFindNetworkClientIdByChainIdAction,\n NetworkControllerGetNetworkClientByIdAction,\n NetworkControllerGetStateAction,\n} from '@metamask/network-controller';\nimport type { AuthenticationControllerGetBearerTokenAction } from '@metamask/profile-sync-controller/auth';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SnapControllerHandleRequestAction } from '@metamask/snaps-controllers';\nimport type { Infer } from '@metamask/superstruct';\nimport type {\n TransactionControllerAddTransactionAction,\n TransactionControllerEstimateGasFeeAction,\n TransactionControllerGetStateAction,\n TransactionControllerIsAtomicBatchSupportedAction,\n TransactionControllerTransactionStatusUpdatedEvent,\n TransactionControllerTransactionSubmittedEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n TransactionType,\n} from '@metamask/transaction-controller';\nimport type { CaipAssetType } from '@metamask/utils';\n\nimport type { BridgeStatusControllerMethodActions } from './bridge-status-controller-method-action-types';\nimport { BRIDGE_STATUS_CONTROLLER_NAME } from './constants';\nimport { QuoteStatusState } from './quote-status-manager/constants';\nimport { StatusResponseSchema } from './utils/validators';\n\n// All fields need to be types not interfaces, same with their children fields\n// o/w you get a type error\n\nexport enum BridgeClientId {\n EXTENSION = 'extension',\n MOBILE = 'mobile',\n}\n\nexport type FetchFunction = (\n input: RequestInfo | URL,\n init?: RequestInit,\n) => Promise<unknown>;\n\n/**\n * These fields are specific to Solana transactions and can likely be infered from TransactionMeta\n *\n * @deprecated these should be removed eventually\n */\nexport type SolanaTransactionMeta = {\n isSolana: boolean;\n isBridgeTx: boolean;\n};\n\nexport type StatusRequest = {\n bridgeId: string; // lifi, socket, squid\n srcTxHash?: string; // lifi, socket, squid, might be undefined for STX\n bridge: string; // lifi, socket, squid\n srcChainId: ChainId; // lifi, socket, squid\n destChainId: ChainId; // lifi, socket, squid\n quote?: Quote; // squid\n refuel?: boolean; // lifi\n};\n\nexport type StatusRequestDto = Omit<\n StatusRequest,\n 'quote' | 'srcChainId' | 'destChainId' | 'refuel'\n> & {\n srcChainId: string; // lifi, socket, squid\n destChainId: string; // lifi, socket, squid\n requestId?: string;\n refuel?: string; // lifi\n};\n\nexport type StatusRequestWithSrcTxHash = StatusRequest & {\n srcTxHash: string;\n};\n\nexport enum BridgeId {\n HOP = 'hop',\n CELER = 'celer',\n CELERCIRCLE = 'celercircle',\n CONNEXT = 'connext',\n POLYGON = 'polygon',\n AVALANCHE = 'avalanche',\n MULTICHAIN = 'multichain',\n AXELAR = 'axelar',\n ACROSS = 'across',\n STARGATE = 'stargate',\n RELAY = 'relay',\n MAYAN = 'mayan',\n}\n\nexport type StatusResponse = Infer<typeof StatusResponseSchema>;\n\nexport type RefuelStatusResponse = object & StatusResponse;\n\n/**\n * This type ties together the quote, its tx params and the submitted txMeta.\n * Each trade/approval will have its own QuoteAndTxMetadata object.\n */\nexport type QuoteAndTxMetadata = {\n type: TransactionType;\n quoteResponse: QuoteResponse & QuoteMetadata;\n /**\n * The approval or trade object from the quote response\n */\n tx: TxData;\n assetsFiatValues?: { sending?: string; receiving?: string };\n /**\n * The simulated gas fee limits for the transaction provided by the bridge-api\n */\n txFee?: SimulatedGasFeeLimits | TxFeeGasLimits;\n /**\n * Transaction metadata from the TransactionController after submission\n */\n txMeta?: TransactionMeta;\n};\n\nexport type BridgeHistoryItem = {\n txMetaId?: string; // Optional: not available pre-submission or on sync failure\n actionId?: string; // Only for non-batch EVM transactions\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string; // Keep original transaction ID for intent transactions\n batchId?: string;\n /**\n * This is defined when the history item is for a batch sell transaction\n */\n batchSellData?: BatchSellTradesResponse;\n /**\n * This is defined when the history item corresponds to the 7702 batch's delegation tx.\n * It contains the list of quoteIds for the BatchSell quotes that are part of the 7702 batch.\n * Each quote can be retrieved from txHistory as `txHistory[quoteId]`.\n *\n * On single swaps/bridges this value is an empty array, or absent on history items\n * persisted before this field was introduced.\n */\n quoteIds?: string[];\n quote: Quote;\n /**\n * This is the the quote id used on single swaps/bridges. On batch sell, it is set\n * as the first item of `quoteIds`.\n *\n * This value is absent on history items persisted before this field was introduced.\n */\n quoteId?: string;\n reportedSubmittedTxHash?: string;\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: string;\n amountSentInUsd?: string;\n quotedGasInUsd?: string;\n quotedGasAmount?: string;\n quotedReturnInUsd?: string;\n quotedRefuelSrcAmountInUsd?: string;\n quotedRefuelDestAmountInUsd?: string;\n };\n initialDestAssetBalance?: string;\n targetContractAddress?: string;\n account: string;\n hasApprovalTx: boolean;\n approvalTxId?: string;\n featureId?: FeatureId;\n isStxEnabled?: boolean;\n /**\n * The location/entry point from which the user initiated the swap or bridge.\n * Used to attribute swaps to specific flows (e.g. Trending Explore).\n */\n location?: MetaMetricsSwapsEventSource;\n /**\n * Legacy A/B test metrics context (`ab_tests`) kept for backward compatibility.\n * Keys are test names, values are variant names (e.g. { token_details_layout: 'treatment' }).\n */\n abTests?: Record<string, string>;\n /**\n * New A/B test metrics context (`active_ab_tests`) that replaces `ab_tests`.\n * Kept separate so migration can run both payloads in parallel.\n * This field is an array of test objects.\n */\n activeAbTests?: { key: string; value: string }[];\n /**\n * Attempts tracking for exponential backoff on failed fetches.\n * We track the number of attempts and the last attempt time for each txMetaId that has failed at least once\n */\n attempts?: {\n counter: number;\n lastAttemptTime: number; // timestamp in ms\n };\n /**\n * Client-supplied security classification for the destination token at the\n * time the swap/bridge was submitted. Persisted so post-submit analytics\n * events (Completed, Failed, StatusValidationFailed) can include\n * `token_security_type_destination`. `null` when no security data was\n * available for the destination token.\n */\n tokenSecurityTypeDestination?: string | null;\n /**\n * The denomination shown as the primary source amount input when the\n * swap/bridge was submitted.\n */\n inputPrimaryDenomination?: InputPrimaryDenomination;\n};\n\n/**\n * @deprecated Use the separate action types instead (e.g.\n * `BridgeStatusControllerStartPollingForBridgeTxStatusAction`).\n */\nexport enum BridgeStatusAction {\n StartPollingForBridgeTxStatus = 'StartPollingForBridgeTxStatus',\n WipeBridgeStatus = 'WipeBridgeStatus',\n GetState = 'GetState',\n ResetState = 'ResetState',\n SubmitTx = 'SubmitTx',\n SubmitIntent = 'SubmitIntent',\n RestartPollingForFailedAttempts = 'RestartPollingForFailedAttempts',\n GetBridgeHistoryItemByTxMetaId = 'GetBridgeHistoryItemByTxMetaId',\n}\n\nexport type TokenAmountValuesSerialized = {\n amount: string;\n valueInCurrency: string | null;\n usd: string | null;\n};\n\nexport type QuoteMetadataSerialized = {\n gasFee: TokenAmountValuesSerialized;\n /**\n * The total network fee for the bridge transaction\n * estimatedGasFees + relayerFees\n */\n totalNetworkFee: TokenAmountValuesSerialized;\n /**\n * The total max network fee for the bridge transaction\n * maxGasFees + relayerFees\n */\n totalMaxNetworkFee: TokenAmountValuesSerialized;\n toTokenAmount: TokenAmountValuesSerialized;\n /**\n * The adjusted return for the bridge transaction\n * destTokenAmount - totalNetworkFee\n */\n adjustedReturn: Omit<TokenAmountValuesSerialized, 'amount'>;\n /**\n * The actual amount sent by user in non-atomic decimal form\n * srcTokenAmount + metabridgeFee\n */\n sentAmount: TokenAmountValuesSerialized;\n swapRate: string; // destTokenAmount / sentAmount\n /**\n * The cost of the bridge transaction\n * sentAmount - adjustedReturn\n */\n cost: Omit<TokenAmountValuesSerialized, 'amount'>;\n};\n\nexport type StartPollingForBridgeTxStatusArgs = {\n bridgeTxMeta?: Pick<TransactionMeta, 'id' | 'hash' | 'batchId'>;\n actionId?: string;\n batchSellData?: BridgeHistoryItem['batchSellData'];\n quoteIds?: BridgeHistoryItem['quoteIds'];\n /**\n * @deprecated the txMeta or orderUid should be used instead\n */\n originalTransactionId?: string;\n quoteResponse: QuoteResponse & QuoteMetadata;\n startTime: BridgeHistoryItem['startTime'];\n slippagePercentage: BridgeHistoryItem['slippagePercentage'];\n initialDestAssetBalance?: BridgeHistoryItem['initialDestAssetBalance'];\n targetContractAddress?: BridgeHistoryItem['targetContractAddress'];\n approvalTxId?: BridgeHistoryItem['approvalTxId'];\n isStxEnabled?: BridgeHistoryItem['isStxEnabled'];\n location: MetaMetricsSwapsEventSource;\n // Legacy field for `ab_tests` metrics payload.\n abTests?: BridgeHistoryItem['abTests'];\n // New field for `active_ab_tests` metrics payload.\n activeAbTests?: BridgeHistoryItem['activeAbTests'];\n accountAddress: string;\n // Client-supplied destination token security classification, persisted on\n // the history item for post-submit analytics events.\n tokenSecurityTypeDestination?: BridgeHistoryItem['tokenSecurityTypeDestination'];\n // Primary denomination at submission time, persisted for post-submit analytics.\n inputPrimaryDenomination?: BridgeHistoryItem['inputPrimaryDenomination'];\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 & QuoteMetadata;\n};\n\nexport type SourceChainTxMetaId = string;\n\nexport type QuoteStatusPersistEntry = {\n quoteId: string;\n srcTxHash: string;\n status: QuoteStatusState;\n createdAt: number;\n lastAttemptAt: number;\n txMetaId?: string;\n};\n\nexport type BridgeStatusControllerState = {\n txHistory: Record<SourceChainTxMetaId, BridgeHistoryItem>;\n quoteUpdateStatusStore: Record<string, QuoteStatusPersistEntry>;\n};\n\n// Actions\nexport type BridgeStatusControllerGetStateAction = ControllerGetStateAction<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n\nexport type BridgeStatusControllerActions =\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerMethodActions;\n\n// Events\nexport type BridgeStatusControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerState\n>;\n/**\n * This event is published when the destination bridge transaction is completed\n * The payload is the asset received on the destination chain\n */\nexport type BridgeStatusControllerDestinationTransactionCompletedEvent = {\n type: 'BridgeStatusController:destinationTransactionCompleted';\n payload: [CaipAssetType];\n};\n\nexport type BridgeStatusControllerEvents =\n | BridgeStatusControllerStateChangeEvent\n | BridgeStatusControllerDestinationTransactionCompletedEvent;\n\n/**\n * The external actions available to the BridgeStatusController.\n */\ntype AllowedActions =\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetStateAction\n | NetworkControllerGetNetworkClientByIdAction\n | RemoteFeatureFlagControllerGetStateAction\n | SnapControllerHandleRequestAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerEstimateGasFeeAction\n | TransactionControllerIsAtomicBatchSupportedAction\n | BridgeControllerTrackUnifiedSwapBridgeEventAction\n | BridgeControllerStopPollingForQuotesAction\n | BridgeControllerGetStateAction\n | AccountsControllerGetAccountByAddressAction\n | AuthenticationControllerGetBearerTokenAction\n | KeyringControllerSignTypedMessageAction;\n\n/**\n * The external events available to the BridgeStatusController.\n */\ntype AllowedEvents =\n | TransactionControllerTransactionStatusUpdatedEvent\n | TransactionControllerTransactionSubmittedEvent;\n\n/**\n * The messenger for the BridgeStatusController.\n */\nexport type BridgeStatusControllerMessenger = Messenger<\n typeof BRIDGE_STATUS_CONTROLLER_NAME,\n BridgeStatusControllerActions | AllowedActions,\n BridgeStatusControllerEvents | AllowedEvents\n>;\n"]}
|