-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathconfirmations.ts
More file actions
159 lines (144 loc) · 5.13 KB
/
Copy pathconfirmations.ts
File metadata and controls
159 lines (144 loc) · 5.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import { ApprovalType } from '@metamask/controller-utils';
import { TransactionType } from '@metamask/transaction-controller';
export const MMM_ORIGIN = 'metamask';
export const MM_MOBILE_ORIGIN = 'Metamask Mobile';
export const SIGNATURE_APPROVAL_TYPES = [
ApprovalType.EthSignTypedData,
ApprovalType.PersonalSign,
];
export const REDESIGNED_TRANSACTION_TYPES = [
TransactionType.batch,
TransactionType.contractInteraction,
TransactionType.deployContract,
TransactionType.moneyAccountDeposit,
TransactionType.moneyAccountWithdraw,
TransactionType.musdClaim,
TransactionType.musdConversion,
TransactionType.perpsDeposit,
TransactionType.perpsDepositAndOrder,
TransactionType.predictDepositAndOrder,
TransactionType.revokeDelegation,
TransactionType.simpleSend,
TransactionType.stakingClaim,
TransactionType.stakingDeposit,
TransactionType.stakingUnstake,
TransactionType.tokenMethodApprove,
TransactionType.tokenMethodIncreaseAllowance,
TransactionType.tokenMethodSetApprovalForAll,
TransactionType.tokenMethodTransfer,
TransactionType.tokenMethodTransferFrom,
TransactionType.tokenMethodSafeTransferFrom,
TransactionType.lendingDeposit,
TransactionType.lendingWithdraw,
];
export const APPROVE_TRANSACTION_TYPES = [
TransactionType.tokenMethodApprove,
TransactionType.tokenMethodIncreaseAllowance,
TransactionType.tokenMethodSetApprovalForAll,
];
export const TRANSFER_TRANSACTION_TYPES = [
TransactionType.simpleSend,
TransactionType.tokenMethodTransfer,
TransactionType.tokenMethodTransferFrom,
TransactionType.tokenMethodSafeTransferFrom,
];
export const FULL_SCREEN_CONFIRMATIONS = [
TransactionType.moneyAccountDeposit,
TransactionType.moneyAccountWithdraw,
TransactionType.musdConversion,
TransactionType.perpsDeposit,
TransactionType.perpsDepositAndOrder,
TransactionType.perpsWithdraw,
TransactionType.predictDepositAndOrder,
TransactionType.predictDeposit,
TransactionType.predictClaim,
TransactionType.predictWithdraw,
TransactionType.simpleSend,
TransactionType.stakingClaim,
TransactionType.stakingDeposit,
TransactionType.stakingUnstake,
TransactionType.tokenMethodTransfer,
TransactionType.tokenMethodTransferFrom,
TransactionType.tokenMethodSafeTransferFrom,
];
export const EARN_CONTRACT_INTERACTION_TYPES = [
TransactionType.lendingDeposit,
TransactionType.lendingWithdraw,
];
/**
* Transaction types for which the Pay With modal hides the network filter.
* Used when pay token selection is constrained to a single network (e.g. Perps).
*/
export const HIDE_NETWORK_FILTER_TYPES = [
TransactionType.perpsDepositAndOrder,
TransactionType.predictDepositAndOrder,
];
/**
* Post-quote transaction types that use a "Receive as" token picker
* instead of "Pay with" for selecting the destination token.
*/
export const POST_QUOTE_TRANSACTION_TYPES = [
TransactionType.predictWithdraw,
TransactionType.perpsWithdraw,
TransactionType.moneyAccountWithdraw,
] as const;
/**
* Transaction types that use user's currency instead of USD for display.
* mUSD is a stablecoin pegged to USD, so we convert to user's local currency.
*/
export const USER_CURRENCY_TYPES = [TransactionType.musdClaim] as const;
/**
* Transaction types that participate in the pay flow (deposits, orders,
* conversions, withdrawals). Token/amount displays inside these confirmations
* are priced in USD unless the type is also in {@link USER_CURRENCY_TYPES}.
*/
export const PAY_TRANSACTION_TYPES = [
TransactionType.moneyAccountDeposit,
TransactionType.moneyAccountWithdraw,
TransactionType.musdConversion,
TransactionType.perpsDeposit,
TransactionType.perpsDepositAndOrder,
TransactionType.perpsWithdraw,
TransactionType.predictDeposit,
TransactionType.predictDepositAndOrder,
TransactionType.predictWithdraw,
] as const;
export const RELAY_DEPOSIT_TYPES = [
TransactionType.relayDeposit,
TransactionType.musdRelayDeposit,
TransactionType.perpsRelayDeposit,
TransactionType.predictRelayDeposit,
];
export const MM_PAY_TRANSACTION_TYPES = [
TransactionType.moneyAccountDeposit,
TransactionType.moneyAccountWithdraw,
TransactionType.musdClaim,
TransactionType.musdConversion,
TransactionType.perpsDeposit,
TransactionType.perpsDepositAndOrder,
TransactionType.perpsWithdraw,
TransactionType.predictClaim,
TransactionType.predictDeposit,
TransactionType.predictDepositAndOrder,
TransactionType.predictWithdraw,
];
/**
* Transaction types that require a Pay quote before publishing.
* These transactions will fail if no quotes are available.
*/
export const QUOTE_REQUIRED_TRANSACTION_TYPES = [
TransactionType.moneyAccountDeposit,
] as const;
/**
* MetaMask Pay transaction types that cannot work without a payment token
* (unless paying with fiat). Confirmation is blocked and publish throws when
* no payment token is set. Claims and withdraws are excluded because they can
* legitimately submit without engaging MetaMask Pay.
*/
export const PAY_TOKEN_REQUIRED_TRANSACTION_TYPES = [
TransactionType.musdConversion,
TransactionType.perpsDeposit,
TransactionType.perpsDepositAndOrder,
TransactionType.predictDeposit,
TransactionType.predictDepositAndOrder,
] as const;