@metamask-previews/bridge-status-controller 55.0.0-preview-77daf0c7 → 56.0.0-preview-46d2c977
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 -2
- package/dist/bridge-status-controller.cjs +30 -30
- package/dist/bridge-status-controller.cjs.map +1 -1
- package/dist/bridge-status-controller.d.cts +2 -2
- package/dist/bridge-status-controller.d.cts.map +1 -1
- package/dist/bridge-status-controller.d.mts +2 -2
- package/dist/bridge-status-controller.d.mts.map +1 -1
- package/dist/bridge-status-controller.mjs +30 -30
- package/dist/bridge-status-controller.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -2
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +3 -2
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/gas.cjs +2 -2
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.d.cts +1 -1
- package/dist/utils/gas.d.cts.map +1 -1
- package/dist/utils/gas.d.mts +1 -1
- package/dist/utils/gas.d.mts.map +1 -1
- package/dist/utils/gas.mjs +2 -2
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/transaction.cjs +10 -10
- package/dist/utils/transaction.cjs.map +1 -1
- package/dist/utils/transaction.d.cts +49 -49
- package/dist/utils/transaction.d.cts.map +1 -1
- package/dist/utils/transaction.d.mts +49 -49
- package/dist/utils/transaction.d.mts.map +1 -1
- package/dist/utils/transaction.mjs +10 -10
- package/dist/utils/transaction.mjs.map +1 -1
- package/dist/utils/validators.d.cts +50 -50
- package/dist/utils/validators.d.mts +50 -50
- package/package.json +13 -13
|
@@ -5,13 +5,13 @@ import type { BatchTransactionParams, TransactionController } from "@metamask/tr
|
|
|
5
5
|
import { TransactionType, type TransactionMeta } from "@metamask/transaction-controller";
|
|
6
6
|
import type { BridgeStatusControllerMessenger, SolanaTransactionMeta } from "../types.cjs";
|
|
7
7
|
export declare const generateActionId: () => string;
|
|
8
|
-
export declare const getUSDTAllowanceResetTx: (
|
|
8
|
+
export declare const getUSDTAllowanceResetTx: (messenger: BridgeStatusControllerMessenger, quoteResponse: QuoteResponse & Partial<QuoteMetadata>) => Promise<{
|
|
9
9
|
data: string;
|
|
10
|
-
|
|
10
|
+
chainId: number;
|
|
11
11
|
to: string;
|
|
12
12
|
from: string;
|
|
13
|
+
value: string;
|
|
13
14
|
gasLimit: number | null;
|
|
14
|
-
chainId: number;
|
|
15
15
|
effectiveGas?: number | undefined;
|
|
16
16
|
} | undefined>;
|
|
17
17
|
export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
@@ -20,29 +20,29 @@ export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
|
20
20
|
srcChainId: number;
|
|
21
21
|
destChainId: number;
|
|
22
22
|
quote: {
|
|
23
|
-
requestId: string;
|
|
24
23
|
srcChainId: number;
|
|
25
24
|
destChainId: number;
|
|
26
25
|
srcAsset: {
|
|
27
26
|
symbol: string;
|
|
27
|
+
chainId: number;
|
|
28
28
|
address: string;
|
|
29
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
29
30
|
name: string;
|
|
30
|
-
chainId: number;
|
|
31
31
|
decimals: number;
|
|
32
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
33
|
-
iconUrl?: string | null | undefined;
|
|
34
32
|
icon?: string | null | undefined;
|
|
33
|
+
iconUrl?: string | null | undefined;
|
|
35
34
|
};
|
|
36
35
|
destAsset: {
|
|
37
36
|
symbol: string;
|
|
37
|
+
chainId: number;
|
|
38
38
|
address: string;
|
|
39
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
39
40
|
name: string;
|
|
40
|
-
chainId: number;
|
|
41
41
|
decimals: number;
|
|
42
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
43
|
-
iconUrl?: string | null | undefined;
|
|
44
42
|
icon?: string | null | undefined;
|
|
43
|
+
iconUrl?: string | null | undefined;
|
|
45
44
|
};
|
|
45
|
+
requestId: string;
|
|
46
46
|
srcTokenAmount: string;
|
|
47
47
|
destTokenAmount: string;
|
|
48
48
|
minDestTokenAmount: string;
|
|
@@ -51,96 +51,96 @@ export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
|
51
51
|
amount: string;
|
|
52
52
|
asset: {
|
|
53
53
|
symbol: string;
|
|
54
|
+
chainId: number;
|
|
54
55
|
address: string;
|
|
56
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
55
57
|
name: string;
|
|
56
|
-
chainId: number;
|
|
57
58
|
decimals: number;
|
|
58
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
59
|
-
iconUrl?: string | null | undefined;
|
|
60
59
|
icon?: string | null | undefined;
|
|
60
|
+
iconUrl?: string | null | undefined;
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
txFee?: ({
|
|
64
64
|
amount: string;
|
|
65
65
|
asset: {
|
|
66
66
|
symbol: string;
|
|
67
|
+
chainId: number;
|
|
67
68
|
address: string;
|
|
69
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
68
70
|
name: string;
|
|
69
|
-
chainId: number;
|
|
70
71
|
decimals: number;
|
|
71
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
72
|
-
iconUrl?: string | null | undefined;
|
|
73
72
|
icon?: string | null | undefined;
|
|
73
|
+
iconUrl?: string | null | undefined;
|
|
74
74
|
};
|
|
75
75
|
} & {
|
|
76
|
-
maxPriorityFeePerGas: string;
|
|
77
76
|
maxFeePerGas: string;
|
|
77
|
+
maxPriorityFeePerGas: string;
|
|
78
78
|
}) | undefined;
|
|
79
79
|
};
|
|
80
80
|
bridgeId: string;
|
|
81
81
|
bridges: string[];
|
|
82
82
|
steps: {
|
|
83
83
|
action: import("@metamask/bridge-controller").ActionTypes;
|
|
84
|
-
protocol: {
|
|
85
|
-
name: string;
|
|
86
|
-
displayName?: string | undefined;
|
|
87
|
-
icon?: string | undefined;
|
|
88
|
-
};
|
|
89
84
|
srcChainId: number;
|
|
90
85
|
srcAsset: {
|
|
91
86
|
symbol: string;
|
|
87
|
+
chainId: number;
|
|
92
88
|
address: string;
|
|
89
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
93
90
|
name: string;
|
|
94
|
-
chainId: number;
|
|
95
91
|
decimals: number;
|
|
96
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
97
|
-
iconUrl?: string | null | undefined;
|
|
98
92
|
icon?: string | null | undefined;
|
|
93
|
+
iconUrl?: string | null | undefined;
|
|
99
94
|
};
|
|
100
95
|
destAsset: {
|
|
101
96
|
symbol: string;
|
|
97
|
+
chainId: number;
|
|
102
98
|
address: string;
|
|
99
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
103
100
|
name: string;
|
|
104
|
-
chainId: number;
|
|
105
101
|
decimals: number;
|
|
106
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
107
|
-
iconUrl?: string | null | undefined;
|
|
108
102
|
icon?: string | null | undefined;
|
|
103
|
+
iconUrl?: string | null | undefined;
|
|
109
104
|
};
|
|
110
105
|
srcAmount: string;
|
|
111
106
|
destAmount: string;
|
|
112
|
-
destChainId?: number | undefined;
|
|
113
|
-
}[];
|
|
114
|
-
refuel?: {
|
|
115
|
-
action: import("@metamask/bridge-controller").ActionTypes;
|
|
116
107
|
protocol: {
|
|
117
108
|
name: string;
|
|
118
|
-
displayName?: string | undefined;
|
|
119
109
|
icon?: string | undefined;
|
|
110
|
+
displayName?: string | undefined;
|
|
120
111
|
};
|
|
112
|
+
destChainId?: number | undefined;
|
|
113
|
+
}[];
|
|
114
|
+
refuel?: {
|
|
115
|
+
action: import("@metamask/bridge-controller").ActionTypes;
|
|
121
116
|
srcChainId: number;
|
|
122
117
|
srcAsset: {
|
|
123
118
|
symbol: string;
|
|
119
|
+
chainId: number;
|
|
124
120
|
address: string;
|
|
121
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
125
122
|
name: string;
|
|
126
|
-
chainId: number;
|
|
127
123
|
decimals: number;
|
|
128
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
129
|
-
iconUrl?: string | null | undefined;
|
|
130
124
|
icon?: string | null | undefined;
|
|
125
|
+
iconUrl?: string | null | undefined;
|
|
131
126
|
};
|
|
132
127
|
destAsset: {
|
|
133
128
|
symbol: string;
|
|
129
|
+
chainId: number;
|
|
134
130
|
address: string;
|
|
131
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
135
132
|
name: string;
|
|
136
|
-
chainId: number;
|
|
137
133
|
decimals: number;
|
|
138
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
139
|
-
iconUrl?: string | null | undefined;
|
|
140
134
|
icon?: string | null | undefined;
|
|
135
|
+
iconUrl?: string | null | undefined;
|
|
141
136
|
};
|
|
142
137
|
srcAmount: string;
|
|
143
138
|
destAmount: string;
|
|
139
|
+
protocol: {
|
|
140
|
+
name: string;
|
|
141
|
+
icon?: string | undefined;
|
|
142
|
+
displayName?: string | undefined;
|
|
143
|
+
};
|
|
144
144
|
destChainId?: number | undefined;
|
|
145
145
|
} | undefined;
|
|
146
146
|
gasIncluded?: boolean | undefined;
|
|
@@ -214,34 +214,34 @@ export declare const toBatchTxParams: (disable7702: boolean, { chainId, gasLimit
|
|
|
214
214
|
maxPriorityFeePerGas?: string | undefined;
|
|
215
215
|
gas?: string | undefined;
|
|
216
216
|
}) => BatchTransactionParams;
|
|
217
|
-
export declare const getAddTransactionBatchParams: ({
|
|
218
|
-
|
|
217
|
+
export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, approval, resetApproval, trade, quoteResponse: { quote: { feeData: { txFee }, gasIncluded, gasIncluded7702, }, sentAmount, toTokenAmount, }, requireApproval, estimateGasFeeFn, }: {
|
|
218
|
+
messenger: BridgeStatusControllerMessenger;
|
|
219
219
|
isBridgeTx: boolean;
|
|
220
220
|
trade: TxData;
|
|
221
221
|
quoteResponse: Omit<QuoteResponse, 'approval' | 'trade'> & Partial<QuoteMetadata>;
|
|
222
222
|
estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee;
|
|
223
223
|
approval?: {
|
|
224
|
-
|
|
225
|
-
value: string;
|
|
224
|
+
chainId: number;
|
|
226
225
|
to: string;
|
|
227
226
|
from: string;
|
|
227
|
+
value: string;
|
|
228
|
+
data: string;
|
|
228
229
|
gasLimit: number | null;
|
|
229
|
-
chainId: number;
|
|
230
230
|
effectiveGas?: number | undefined;
|
|
231
231
|
} | undefined;
|
|
232
232
|
resetApproval?: {
|
|
233
|
-
|
|
234
|
-
value: string;
|
|
233
|
+
chainId: number;
|
|
235
234
|
to: string;
|
|
236
235
|
from: string;
|
|
236
|
+
value: string;
|
|
237
|
+
data: string;
|
|
237
238
|
gasLimit: number | null;
|
|
238
|
-
chainId: number;
|
|
239
239
|
effectiveGas?: number | undefined;
|
|
240
240
|
} | undefined;
|
|
241
241
|
requireApproval?: boolean | undefined;
|
|
242
242
|
}) => Promise<import("@metamask/transaction-controller").TransactionBatchRequest>;
|
|
243
|
-
export declare const findAndUpdateTransactionsInBatch: ({
|
|
244
|
-
|
|
243
|
+
export declare const findAndUpdateTransactionsInBatch: ({ messenger, updateTransactionFn, batchId, txDataByType, }: {
|
|
244
|
+
messenger: BridgeStatusControllerMessenger;
|
|
245
245
|
updateTransactionFn: typeof TransactionController.prototype.updateTransaction;
|
|
246
246
|
batchId: string;
|
|
247
247
|
txDataByType: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.cts","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,oCAAoC;AAC1D,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,oCAAoC;AAErC,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,yCAAyC;AAC1C,OAAO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{ TransactionType, type TransactionMeta } from "@metamask/transaction-controller";
|
|
6
6
|
import type { BridgeStatusControllerMessenger, SolanaTransactionMeta } from "../types.mjs";
|
|
7
7
|
export declare const generateActionId: () => string;
|
|
8
|
-
export declare const getUSDTAllowanceResetTx: (
|
|
8
|
+
export declare const getUSDTAllowanceResetTx: (messenger: BridgeStatusControllerMessenger, quoteResponse: QuoteResponse & Partial<QuoteMetadata>) => Promise<{
|
|
9
9
|
data: string;
|
|
10
|
-
|
|
10
|
+
chainId: number;
|
|
11
11
|
to: string;
|
|
12
12
|
from: string;
|
|
13
|
+
value: string;
|
|
13
14
|
gasLimit: number | null;
|
|
14
|
-
chainId: number;
|
|
15
15
|
effectiveGas?: number | undefined;
|
|
16
16
|
} | undefined>;
|
|
17
17
|
export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
@@ -20,29 +20,29 @@ export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
|
20
20
|
srcChainId: number;
|
|
21
21
|
destChainId: number;
|
|
22
22
|
quote: {
|
|
23
|
-
requestId: string;
|
|
24
23
|
srcChainId: number;
|
|
25
24
|
destChainId: number;
|
|
26
25
|
srcAsset: {
|
|
27
26
|
symbol: string;
|
|
27
|
+
chainId: number;
|
|
28
28
|
address: string;
|
|
29
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
29
30
|
name: string;
|
|
30
|
-
chainId: number;
|
|
31
31
|
decimals: number;
|
|
32
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
33
|
-
iconUrl?: string | null | undefined;
|
|
34
32
|
icon?: string | null | undefined;
|
|
33
|
+
iconUrl?: string | null | undefined;
|
|
35
34
|
};
|
|
36
35
|
destAsset: {
|
|
37
36
|
symbol: string;
|
|
37
|
+
chainId: number;
|
|
38
38
|
address: string;
|
|
39
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
39
40
|
name: string;
|
|
40
|
-
chainId: number;
|
|
41
41
|
decimals: number;
|
|
42
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
43
|
-
iconUrl?: string | null | undefined;
|
|
44
42
|
icon?: string | null | undefined;
|
|
43
|
+
iconUrl?: string | null | undefined;
|
|
45
44
|
};
|
|
45
|
+
requestId: string;
|
|
46
46
|
srcTokenAmount: string;
|
|
47
47
|
destTokenAmount: string;
|
|
48
48
|
minDestTokenAmount: string;
|
|
@@ -51,96 +51,96 @@ export declare const getStatusRequestParams: (quoteResponse: QuoteResponse) => {
|
|
|
51
51
|
amount: string;
|
|
52
52
|
asset: {
|
|
53
53
|
symbol: string;
|
|
54
|
+
chainId: number;
|
|
54
55
|
address: string;
|
|
56
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
55
57
|
name: string;
|
|
56
|
-
chainId: number;
|
|
57
58
|
decimals: number;
|
|
58
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
59
|
-
iconUrl?: string | null | undefined;
|
|
60
59
|
icon?: string | null | undefined;
|
|
60
|
+
iconUrl?: string | null | undefined;
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
63
|
txFee?: ({
|
|
64
64
|
amount: string;
|
|
65
65
|
asset: {
|
|
66
66
|
symbol: string;
|
|
67
|
+
chainId: number;
|
|
67
68
|
address: string;
|
|
69
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
68
70
|
name: string;
|
|
69
|
-
chainId: number;
|
|
70
71
|
decimals: number;
|
|
71
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
72
|
-
iconUrl?: string | null | undefined;
|
|
73
72
|
icon?: string | null | undefined;
|
|
73
|
+
iconUrl?: string | null | undefined;
|
|
74
74
|
};
|
|
75
75
|
} & {
|
|
76
|
-
maxPriorityFeePerGas: string;
|
|
77
76
|
maxFeePerGas: string;
|
|
77
|
+
maxPriorityFeePerGas: string;
|
|
78
78
|
}) | undefined;
|
|
79
79
|
};
|
|
80
80
|
bridgeId: string;
|
|
81
81
|
bridges: string[];
|
|
82
82
|
steps: {
|
|
83
83
|
action: import("@metamask/bridge-controller").ActionTypes;
|
|
84
|
-
protocol: {
|
|
85
|
-
name: string;
|
|
86
|
-
displayName?: string | undefined;
|
|
87
|
-
icon?: string | undefined;
|
|
88
|
-
};
|
|
89
84
|
srcChainId: number;
|
|
90
85
|
srcAsset: {
|
|
91
86
|
symbol: string;
|
|
87
|
+
chainId: number;
|
|
92
88
|
address: string;
|
|
89
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
93
90
|
name: string;
|
|
94
|
-
chainId: number;
|
|
95
91
|
decimals: number;
|
|
96
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
97
|
-
iconUrl?: string | null | undefined;
|
|
98
92
|
icon?: string | null | undefined;
|
|
93
|
+
iconUrl?: string | null | undefined;
|
|
99
94
|
};
|
|
100
95
|
destAsset: {
|
|
101
96
|
symbol: string;
|
|
97
|
+
chainId: number;
|
|
102
98
|
address: string;
|
|
99
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
103
100
|
name: string;
|
|
104
|
-
chainId: number;
|
|
105
101
|
decimals: number;
|
|
106
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
107
|
-
iconUrl?: string | null | undefined;
|
|
108
102
|
icon?: string | null | undefined;
|
|
103
|
+
iconUrl?: string | null | undefined;
|
|
109
104
|
};
|
|
110
105
|
srcAmount: string;
|
|
111
106
|
destAmount: string;
|
|
112
|
-
destChainId?: number | undefined;
|
|
113
|
-
}[];
|
|
114
|
-
refuel?: {
|
|
115
|
-
action: import("@metamask/bridge-controller").ActionTypes;
|
|
116
107
|
protocol: {
|
|
117
108
|
name: string;
|
|
118
|
-
displayName?: string | undefined;
|
|
119
109
|
icon?: string | undefined;
|
|
110
|
+
displayName?: string | undefined;
|
|
120
111
|
};
|
|
112
|
+
destChainId?: number | undefined;
|
|
113
|
+
}[];
|
|
114
|
+
refuel?: {
|
|
115
|
+
action: import("@metamask/bridge-controller").ActionTypes;
|
|
121
116
|
srcChainId: number;
|
|
122
117
|
srcAsset: {
|
|
123
118
|
symbol: string;
|
|
119
|
+
chainId: number;
|
|
124
120
|
address: string;
|
|
121
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
125
122
|
name: string;
|
|
126
|
-
chainId: number;
|
|
127
123
|
decimals: number;
|
|
128
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
129
|
-
iconUrl?: string | null | undefined;
|
|
130
124
|
icon?: string | null | undefined;
|
|
125
|
+
iconUrl?: string | null | undefined;
|
|
131
126
|
};
|
|
132
127
|
destAsset: {
|
|
133
128
|
symbol: string;
|
|
129
|
+
chainId: number;
|
|
134
130
|
address: string;
|
|
131
|
+
assetId: `${string}:${string}/${string}:${string}`;
|
|
135
132
|
name: string;
|
|
136
|
-
chainId: number;
|
|
137
133
|
decimals: number;
|
|
138
|
-
assetId: `${string}:${string}/${string}:${string}`;
|
|
139
|
-
iconUrl?: string | null | undefined;
|
|
140
134
|
icon?: string | null | undefined;
|
|
135
|
+
iconUrl?: string | null | undefined;
|
|
141
136
|
};
|
|
142
137
|
srcAmount: string;
|
|
143
138
|
destAmount: string;
|
|
139
|
+
protocol: {
|
|
140
|
+
name: string;
|
|
141
|
+
icon?: string | undefined;
|
|
142
|
+
displayName?: string | undefined;
|
|
143
|
+
};
|
|
144
144
|
destChainId?: number | undefined;
|
|
145
145
|
} | undefined;
|
|
146
146
|
gasIncluded?: boolean | undefined;
|
|
@@ -214,34 +214,34 @@ export declare const toBatchTxParams: (disable7702: boolean, { chainId, gasLimit
|
|
|
214
214
|
maxPriorityFeePerGas?: string | undefined;
|
|
215
215
|
gas?: string | undefined;
|
|
216
216
|
}) => BatchTransactionParams;
|
|
217
|
-
export declare const getAddTransactionBatchParams: ({
|
|
218
|
-
|
|
217
|
+
export declare const getAddTransactionBatchParams: ({ messenger, isBridgeTx, approval, resetApproval, trade, quoteResponse: { quote: { feeData: { txFee }, gasIncluded, gasIncluded7702, }, sentAmount, toTokenAmount, }, requireApproval, estimateGasFeeFn, }: {
|
|
218
|
+
messenger: BridgeStatusControllerMessenger;
|
|
219
219
|
isBridgeTx: boolean;
|
|
220
220
|
trade: TxData;
|
|
221
221
|
quoteResponse: Omit<QuoteResponse, 'approval' | 'trade'> & Partial<QuoteMetadata>;
|
|
222
222
|
estimateGasFeeFn: typeof TransactionController.prototype.estimateGasFee;
|
|
223
223
|
approval?: {
|
|
224
|
-
|
|
225
|
-
value: string;
|
|
224
|
+
chainId: number;
|
|
226
225
|
to: string;
|
|
227
226
|
from: string;
|
|
227
|
+
value: string;
|
|
228
|
+
data: string;
|
|
228
229
|
gasLimit: number | null;
|
|
229
|
-
chainId: number;
|
|
230
230
|
effectiveGas?: number | undefined;
|
|
231
231
|
} | undefined;
|
|
232
232
|
resetApproval?: {
|
|
233
|
-
|
|
234
|
-
value: string;
|
|
233
|
+
chainId: number;
|
|
235
234
|
to: string;
|
|
236
235
|
from: string;
|
|
236
|
+
value: string;
|
|
237
|
+
data: string;
|
|
237
238
|
gasLimit: number | null;
|
|
238
|
-
chainId: number;
|
|
239
239
|
effectiveGas?: number | undefined;
|
|
240
240
|
} | undefined;
|
|
241
241
|
requireApproval?: boolean | undefined;
|
|
242
242
|
}) => Promise<import("@metamask/transaction-controller").TransactionBatchRequest>;
|
|
243
|
-
export declare const findAndUpdateTransactionsInBatch: ({
|
|
244
|
-
|
|
243
|
+
export declare const findAndUpdateTransactionsInBatch: ({ messenger, updateTransactionFn, batchId, txDataByType, }: {
|
|
244
|
+
messenger: BridgeStatusControllerMessenger;
|
|
245
245
|
updateTransactionFn: typeof TransactionController.prototype.updateTransaction;
|
|
246
246
|
batchId: string;
|
|
247
247
|
txDataByType: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.mts","sourceRoot":"","sources":["../../src/utils/transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,sCAAsC;AAC7E,OAAO,KAAK,EAAE,MAAM,EAAE,oCAAoC;AAC1D,OAAO,EAOL,KAAK,aAAa,EA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;;;;;;;;;CAgEhB,CAAC"}
|
|
@@ -8,11 +8,11 @@ import { calculateGasFees } from "./gas.mjs";
|
|
|
8
8
|
import { createClientTransactionRequest } from "./snaps.mjs";
|
|
9
9
|
import { APPROVAL_DELAY_MS } from "../constants.mjs";
|
|
10
10
|
export const generateActionId = () => (Date.now() + Math.random()).toString();
|
|
11
|
-
export const getUSDTAllowanceResetTx = async (
|
|
11
|
+
export const getUSDTAllowanceResetTx = async (messenger, quoteResponse) => {
|
|
12
12
|
const hexChainId = formatChainIdToHex(quoteResponse.quote.srcChainId);
|
|
13
13
|
if (quoteResponse.approval &&
|
|
14
14
|
isEthUsdt(hexChainId, quoteResponse.quote.srcAsset.address)) {
|
|
15
|
-
const allowance = new BigNumber(await
|
|
15
|
+
const allowance = new BigNumber(await messenger.call('BridgeController:getBridgeERC20Allowance', quoteResponse.quote.srcAsset.address, hexChainId));
|
|
16
16
|
const shouldResetApproval = allowance.lt(quoteResponse.sentAmount?.amount ?? '0') && allowance.gt(0);
|
|
17
17
|
if (shouldResetApproval) {
|
|
18
18
|
return { ...quoteResponse.approval, data: getEthUsdtResetData() };
|
|
@@ -181,20 +181,20 @@ export const toBatchTxParams = (disable7702, { chainId, gasLimit, ...trade }, {
|
|
|
181
181
|
maxPriorityFeePerGas: toHex(maxPriorityFeePerGas ?? 0),
|
|
182
182
|
};
|
|
183
183
|
};
|
|
184
|
-
export const getAddTransactionBatchParams = async ({
|
|
184
|
+
export const getAddTransactionBatchParams = async ({ messenger, isBridgeTx, approval, resetApproval, trade, quoteResponse: { quote: { feeData: { txFee }, gasIncluded, gasIncluded7702, }, sentAmount, toTokenAmount, }, requireApproval = false, estimateGasFeeFn, }) => {
|
|
185
185
|
const isGasless = gasIncluded || gasIncluded7702;
|
|
186
|
-
const selectedAccount =
|
|
186
|
+
const selectedAccount = messenger.call('AccountsController:getAccountByAddress', trade.from);
|
|
187
187
|
if (!selectedAccount) {
|
|
188
188
|
throw new Error('Failed to submit cross-chain swap batch transaction: unknown account in trade data');
|
|
189
189
|
}
|
|
190
190
|
const hexChainId = formatChainIdToHex(trade.chainId);
|
|
191
|
-
const networkClientId =
|
|
191
|
+
const networkClientId = messenger.call('NetworkController:findNetworkClientIdByChainId', hexChainId);
|
|
192
192
|
// When an active quote has gasIncluded7702 set to true,
|
|
193
193
|
// enable 7702 gasless txs for smart accounts
|
|
194
194
|
const disable7702 = gasIncluded7702 !== true;
|
|
195
195
|
const transactions = [];
|
|
196
196
|
if (resetApproval) {
|
|
197
|
-
const gasFees = await calculateGasFees(disable7702,
|
|
197
|
+
const gasFees = await calculateGasFees(disable7702, messenger, estimateGasFeeFn, resetApproval, networkClientId, hexChainId, isGasless ? txFee : undefined);
|
|
198
198
|
transactions.push({
|
|
199
199
|
type: isBridgeTx
|
|
200
200
|
? TransactionType.bridgeApproval
|
|
@@ -203,7 +203,7 @@ export const getAddTransactionBatchParams = async ({ messagingSystem, isBridgeTx
|
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
if (approval) {
|
|
206
|
-
const gasFees = await calculateGasFees(disable7702,
|
|
206
|
+
const gasFees = await calculateGasFees(disable7702, messenger, estimateGasFeeFn, approval, networkClientId, hexChainId, isGasless ? txFee : undefined);
|
|
207
207
|
transactions.push({
|
|
208
208
|
type: isBridgeTx
|
|
209
209
|
? TransactionType.bridgeApproval
|
|
@@ -211,7 +211,7 @@ export const getAddTransactionBatchParams = async ({ messagingSystem, isBridgeTx
|
|
|
211
211
|
params: toBatchTxParams(disable7702, approval, gasFees),
|
|
212
212
|
});
|
|
213
213
|
}
|
|
214
|
-
const gasFees = await calculateGasFees(disable7702,
|
|
214
|
+
const gasFees = await calculateGasFees(disable7702, messenger, estimateGasFeeFn, trade, networkClientId, hexChainId, isGasless ? txFee : undefined);
|
|
215
215
|
transactions.push({
|
|
216
216
|
type: isBridgeTx ? TransactionType.bridge : TransactionType.swap,
|
|
217
217
|
params: toBatchTxParams(disable7702, trade, gasFees),
|
|
@@ -231,8 +231,8 @@ export const getAddTransactionBatchParams = async ({ messagingSystem, isBridgeTx
|
|
|
231
231
|
};
|
|
232
232
|
return transactionParams;
|
|
233
233
|
};
|
|
234
|
-
export const findAndUpdateTransactionsInBatch = ({
|
|
235
|
-
const txs =
|
|
234
|
+
export const findAndUpdateTransactionsInBatch = ({ messenger, updateTransactionFn, batchId, txDataByType, }) => {
|
|
235
|
+
const txs = messenger.call('TransactionController:getState').transactions;
|
|
236
236
|
const txBatch = {
|
|
237
237
|
approvalMeta: undefined,
|
|
238
238
|
tradeMeta: undefined,
|