1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Replace hardcoded sent ether label on confirm screen (#11802)

* Replace hardcoded sent ether label on confirm screen

* replace transaction type SENT_ETHER with network agnostic SENDING_NATIVE_ASSET

* remove sentEther translation base

* make backwards compatible with lingering transaction of legacy sentEther type

* update localalization files

* fixup legacy sentEther transaction type

* changing new transaction type away from localization string

* revert migration tests

* update fixtures and test data

* update name of new transaction type

* add migration

* remove legacy SENT_ETHER from transaction types enum object
This commit is contained in:
Alex Donesky 2021-09-15 16:54:51 -05:00 committed by GitHub
parent 2100fb0ce1
commit 2a9fbffb6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 589 additions and 192 deletions

View File

@ -886,9 +886,6 @@
"sendTokens": {
"message": "ተለዋጭ ስሞችን ላክ"
},
"sentEther": {
"message": "የተላከ ether"
},
"separateEachWord": {
"message": "እያንዳንዱን ቃል በነጠላ ክፍት ቦታ ይለያዩ"
},

View File

@ -882,9 +882,6 @@
"sendTokens": {
"message": "إرسال عملات رمزية"
},
"sentEther": {
"message": "أرسل عملة إيثير"
},
"separateEachWord": {
"message": "افصل كل كلمة بمسافة واحدة"
},

View File

@ -885,9 +885,6 @@
"sendTokens": {
"message": "Изпращане на жетони"
},
"sentEther": {
"message": "изпратен етер"
},
"separateEachWord": {
"message": "Отделете всяка дума с интервал"
},

View File

@ -889,9 +889,6 @@
"sendTokens": {
"message": "টোকেনগুলি পাঠান"
},
"sentEther": {
"message": "পাঠানো ইথার "
},
"separateEachWord": {
"message": "প্রতিটি শব্দকে একটি স্পেস দিয়ে আলাদা করুন"
},

View File

@ -867,9 +867,6 @@
"sendTokens": {
"message": "Enviar Fitxes"
},
"sentEther": {
"message": "envia ether"
},
"separateEachWord": {
"message": "Separa cada paraula amb un sol espai"
},

View File

@ -867,9 +867,6 @@
"sendTokens": {
"message": "Send tokens"
},
"sentEther": {
"message": "sendte ether"
},
"separateEachWord": {
"message": "Separer hvert ord med et enkelt mellemrum"
},

View File

@ -858,9 +858,6 @@
"sendTokens": {
"message": "Token senden"
},
"sentEther": {
"message": "Ether senden"
},
"separateEachWord": {
"message": "Trennen Sie die Wörter mit einem einzelnen Leerzeichen voneinander"
},

View File

@ -886,9 +886,6 @@
"sendTokens": {
"message": "Στείλτε Tokens"
},
"sentEther": {
"message": "απεσταλμένα ether"
},
"separateEachWord": {
"message": "Διαχωρίστε κάθε λέξη με ένα μόνο κενό"
},

View File

@ -1958,8 +1958,9 @@
"sendTokens": {
"message": "Send Tokens"
},
"sentEther": {
"message": "sent ether"
"sendingNativeAsset": {
"message": "Sending $1",
"description": "$1 represents the native currency symbol for the current network (e.g. ETH or BNB)"
},
"separateEachWord": {
"message": "Separate each word with a single space"

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "Enviar tokens"
},
"sentEther": {
"message": "enviar ether"
},
"separateEachWord": {
"message": "Separar cada palabra con un solo espacio"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "Enviar tokens"
},
"sentEther": {
"message": "enviar ether"
},
"separateEachWord": {
"message": "Separar cada palabra con un solo espacio"
},

View File

@ -879,9 +879,6 @@
"sendTokens": {
"message": "Saada lube"
},
"sentEther": {
"message": "saadetud eeter"
},
"separateEachWord": {
"message": "Eraldage iga sõna ühe tühikuga"
},

View File

@ -889,9 +889,6 @@
"sendTokens": {
"message": "رمزیاب ها را ارسال کنید"
},
"sentEther": {
"message": "ایتر ارسال شد"
},
"separateEachWord": {
"message": "هر کلمه را با یک فاصله واحد جدا سازید"
},

View File

@ -886,9 +886,6 @@
"sendTokens": {
"message": "Lähetä tietueita"
},
"sentEther": {
"message": "lähetä etheriä"
},
"separateEachWord": {
"message": "Erottele sanat toisistaan yhdellä välilyönnillä"
},

View File

@ -801,9 +801,6 @@
"sendTokens": {
"message": "Magpadala ng Mga Token"
},
"sentEther": {
"message": "nagpadala ng ether"
},
"separateEachWord": {
"message": "Paghiwa-hiwalayin ang bawat salita gamit ang isang space"
},

View File

@ -871,9 +871,6 @@
"sendTokens": {
"message": "Envoyer des jetons"
},
"sentEther": {
"message": "Ether envoyé"
},
"separateEachWord": {
"message": "Separez chaque mot avec un espace simple"
},

View File

@ -883,9 +883,6 @@
"sendTokens": {
"message": "שלח טוקנים"
},
"sentEther": {
"message": "את'ר שנשלח"
},
"separateEachWord": {
"message": "יש להפריד כל מילה עם רווח יחיד"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "टोकन भेजें"
},
"sentEther": {
"message": "Ether भेजा गया"
},
"separateEachWord": {
"message": "प्रत्येक शब्द को एक रिक्ति से अलग करें"
},

View File

@ -882,9 +882,6 @@
"sendTokens": {
"message": "Pošalji tokene"
},
"sentEther": {
"message": "pošalji ether"
},
"separateEachWord": {
"message": "Odvojite pojedinačne riječi jednim razmakom"
},

View File

@ -552,9 +552,6 @@
"sendTokens": {
"message": "Voye Tokens"
},
"sentEther": {
"message": "Voye ether"
},
"separateEachWord": {
"message": "Separe chak mo ak yon sèl espas"
},

View File

@ -882,9 +882,6 @@
"sendTokens": {
"message": "Token küldése"
},
"sentEther": {
"message": "elküldött ether"
},
"separateEachWord": {
"message": "Minden egyes szavat szóközzel válasszon el"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "Kirim Token"
},
"sentEther": {
"message": "ether terkirim"
},
"separateEachWord": {
"message": "Pisahkan setiap kata dengan satu spasi"
},

View File

@ -1368,9 +1368,6 @@
"sendTokens": {
"message": "Invia Tokens"
},
"sentEther": {
"message": "ether inviati"
},
"separateEachWord": {
"message": "Separa ogni parola con un solo spazio"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "トークンの送信"
},
"sentEther": {
"message": "Ether の送金"
},
"separateEachWord": {
"message": "単語ごとにスペースを 1 つ置いて分離します"
},

View File

@ -889,9 +889,6 @@
"sendTokens": {
"message": "ಟೋಕನ್‌ಗಳನ್ನು ಕಳುಹಿಸಿ"
},
"sentEther": {
"message": "ಕಳುಹಿಸಲಾದ ಎಥರ್"
},
"separateEachWord": {
"message": "ಒಂದು ಸ್ಪೇಸ್ ಮೂಲಕ ಪ್ರತಿ ಪದವನ್ನು ಬೇರ್ಪಡಿಸಿ"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "토큰 보내기"
},
"sentEther": {
"message": "Ether 보냄"
},
"separateEachWord": {
"message": "공백 한 칸으로 각 단어를 구분하세요."
},

View File

@ -889,9 +889,6 @@
"sendTokens": {
"message": "Siųsti žetonus"
},
"sentEther": {
"message": "siųsti eterių"
},
"separateEachWord": {
"message": "Kiekvieną žodį atskirkite viengubu tarpu"
},

View File

@ -885,9 +885,6 @@
"sendTokens": {
"message": "Nosūtīt marķierus"
},
"sentEther": {
"message": "nosūtītie ether"
},
"separateEachWord": {
"message": "Atdaliet katru vārdu ar vienu atstarpi"
},

View File

@ -866,9 +866,6 @@
"sendTokens": {
"message": "Hantar Token"
},
"sentEther": {
"message": "menghantar ether"
},
"separateEachWord": {
"message": "Pisahkan setiap perkataan dengan ruang tunggal"
},

View File

@ -870,9 +870,6 @@
"sendTokens": {
"message": "Send tokener"
},
"sentEther": {
"message": "sendt ether"
},
"separateEachWord": {
"message": "Del hvert ord med et enkelt mellomrom "
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "Magpadala ng Mga Token"
},
"sentEther": {
"message": "nagpadala ng ether"
},
"separateEachWord": {
"message": "Paghiwa-hiwalayin ang bawat salita gamit ang isang space"
},

View File

@ -883,9 +883,6 @@
"sendTokens": {
"message": "Wyślij tokeny"
},
"sentEther": {
"message": "wyślij eter"
},
"separateEachWord": {
"message": "Oddziel słowa pojedynczą spacją"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "Enviar tokens"
},
"sentEther": {
"message": "ether enviado"
},
"separateEachWord": {
"message": "Separe cada palavra com um único espaço"
},

View File

@ -876,9 +876,6 @@
"sendTokens": {
"message": "Trimiteți indicative"
},
"sentEther": {
"message": "trimiteți ether"
},
"separateEachWord": {
"message": "Despărțiți fiecare cuvânt cu un spațiu"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "Отправить токены"
},
"sentEther": {
"message": "отправленный Ether"
},
"separateEachWord": {
"message": "Отделяйте каждое слово одним пробелом"
},

View File

@ -852,9 +852,6 @@
"sendTokens": {
"message": "Odeslat tokeny"
},
"sentEther": {
"message": "poslaný ether"
},
"separateEachWord": {
"message": "Každé slovo oddeľte jednou medzerou"
},

View File

@ -874,9 +874,6 @@
"sendTokens": {
"message": "Pošlji žetone"
},
"sentEther": {
"message": "poslani ether"
},
"separateEachWord": {
"message": "Vsako besedo ločite z enim presledkom"
},

View File

@ -880,9 +880,6 @@
"sendTokens": {
"message": "Pošalji tokene"
},
"sentEther": {
"message": "ether je poslat"
},
"separateEachWord": {
"message": "Razdvojite svaku reč jednim mestom razmaka"
},

View File

@ -873,9 +873,6 @@
"sendTokens": {
"message": "Skicka tokens"
},
"sentEther": {
"message": "skickat ether"
},
"separateEachWord": {
"message": "Lägg in ett mellanslag mellan varje ord"
},

View File

@ -867,9 +867,6 @@
"sendTokens": {
"message": "Tuma Vianzio"
},
"sentEther": {
"message": "ether iliyotumwa"
},
"separateEachWord": {
"message": "Tenganisha kila neno kwa nafasi moja"
},

View File

@ -1359,9 +1359,6 @@
"sendTokens": {
"message": "Magpadala ng Mga Token"
},
"sentEther": {
"message": "nagpadala ng ether"
},
"separateEachWord": {
"message": "Paghiwa-hiwalayin ang bawat salita gamit ang espasyo"
},

View File

@ -889,9 +889,6 @@
"sendTokens": {
"message": "Надіслати токени"
},
"sentEther": {
"message": "надісланий ефір"
},
"separateEachWord": {
"message": "Відділіть кожне слово одним пробілом"
},

View File

@ -1688,9 +1688,6 @@
"sendTokens": {
"message": "Gửi token"
},
"sentEther": {
"message": "đã gửi ether"
},
"separateEachWord": {
"message": "Phân tách mỗi từ bằng một dấu cách"
},

View File

@ -1362,9 +1362,6 @@
"sendTokens": {
"message": "发送代币"
},
"sentEther": {
"message": "发送 Ether"
},
"separateEachWord": {
"message": "用空格分隔每个单词"
},

View File

@ -877,9 +877,6 @@
"sendTokens": {
"message": "發送代幣"
},
"sentEther": {
"message": "發送以太幣"
},
"separateEachWord": {
"message": "單詞之間請以空白間隔"
},

View File

@ -1,5 +1,8 @@
import { strict as assert } from 'assert';
import { TRANSACTION_STATUSES } from '../../../../shared/constants/transaction';
import {
TRANSACTION_STATUSES,
TRANSACTION_TYPES,
} from '../../../../shared/constants/transaction';
import { formatTxMetaForRpcResult } from './util';
describe('network utils', function () {
@ -16,7 +19,7 @@ describe('network utils', function () {
gas: '0x7b0d',
nonce: '0x4b',
},
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
origin: 'other',
chainId: '0x3',
time: 1624408066355,
@ -63,7 +66,7 @@ describe('network utils', function () {
gas: '0x7b0d',
nonce: '0x4b',
},
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
origin: 'other',
chainId: '0x3',
time: 1624408066355,

View File

@ -584,7 +584,7 @@ export default class TransactionController extends EventEmitter {
return {};
} else if (
txMeta.txParams.to &&
txMeta.type === TRANSACTION_TYPES.SENT_ETHER &&
txMeta.type === TRANSACTION_TYPES.SIMPLE_SEND &&
chainType !== 'custom'
) {
// if there's data in the params, but there's no contract code, it's not a valid transaction
@ -1191,7 +1191,7 @@ export default class TransactionController extends EventEmitter {
}
/**
* @typedef { 'transfer' | 'approve' | 'transferfrom' | 'contractInteraction'| 'sentEther' } InferrableTransactionTypes
* @typedef { 'transfer' | 'approve' | 'transferfrom' | 'contractInteraction'| 'simpleSend' } InferrableTransactionTypes
*/
/**
@ -1245,7 +1245,7 @@ export default class TransactionController extends EventEmitter {
const codeIsEmpty = !code || code === '0x' || code === '0x0';
result = codeIsEmpty
? TRANSACTION_TYPES.SENT_ETHER
? TRANSACTION_TYPES.SIMPLE_SEND
: TRANSACTION_TYPES.CONTRACT_INTERACTION;
}

View File

@ -716,7 +716,7 @@ describe('Transaction Controller', function () {
gas: '0x7b0d',
nonce: '0x4b',
},
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
transaction_envelope_type: 'legacy',
origin: 'metamask',
chainId: currentChainId,
@ -1239,7 +1239,7 @@ describe('Transaction Controller', function () {
data: '',
});
assert.deepEqual(result, {
type: TRANSACTION_TYPES.SENT_ETHER,
type: TRANSACTION_TYPES.SIMPLE_SEND,
getCodeResponse: null,
});
});
@ -1285,7 +1285,7 @@ describe('Transaction Controller', function () {
data: '0xabd',
});
assert.deepEqual(result, {
type: TRANSACTION_TYPES.SENT_ETHER,
type: TRANSACTION_TYPES.SIMPLE_SEND,
getCodeResponse: '0x',
});
});
@ -1296,7 +1296,7 @@ describe('Transaction Controller', function () {
data: '0xabd',
});
assert.deepEqual(result, {
type: TRANSACTION_TYPES.SENT_ETHER,
type: TRANSACTION_TYPES.SIMPLE_SEND,
getCodeResponse: null,
});
});
@ -1499,7 +1499,7 @@ describe('Transaction Controller', function () {
gas: '0x7b0d',
nonce: '0x4b',
},
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
origin: 'metamask',
chainId: currentChainId,
time: 1624408066355,
@ -1513,7 +1513,7 @@ describe('Transaction Controller', function () {
network: '42',
referrer: 'metamask',
source: 'user',
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
},
sensitiveProperties: {
gas_price: '2',
@ -1546,7 +1546,7 @@ describe('Transaction Controller', function () {
gas: '0x7b0d',
nonce: '0x4b',
},
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
origin: 'other',
chainId: currentChainId,
time: 1624408066355,
@ -1560,7 +1560,7 @@ describe('Transaction Controller', function () {
network: '42',
referrer: 'other',
source: 'dapp',
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
},
sensitiveProperties: {
gas_price: '2',
@ -1593,7 +1593,7 @@ describe('Transaction Controller', function () {
gas: '0x7b0d',
nonce: '0x4b',
},
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
origin: 'other',
chainId: currentChainId,
time: 1624408066355,
@ -1606,7 +1606,7 @@ describe('Transaction Controller', function () {
network: '42',
referrer: 'other',
source: 'dapp',
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
chain_id: '0x2a',
},
sensitiveProperties: {
@ -1647,7 +1647,7 @@ describe('Transaction Controller', function () {
gas: '0x7b0d',
nonce: '0x4b',
},
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
origin: 'other',
chainId: currentChainId,
time: 1624408066355,
@ -1661,7 +1661,7 @@ describe('Transaction Controller', function () {
network: '42',
referrer: 'other',
source: 'dapp',
type: 'sentEther',
type: TRANSACTION_TYPES.SIMPLE_SEND,
},
sensitiveProperties: {
baz: 3.0,

View File

@ -24,7 +24,7 @@ function generateTransactions(
to,
from,
status,
type = TRANSACTION_TYPES.SENT_ETHER,
type = TRANSACTION_TYPES.SIMPLE_SEND,
nonce = (i) => `${i}`,
},
) {
@ -653,7 +653,7 @@ describe('TransactionStateManager', function () {
? TRANSACTION_STATUSES.DROPPED
: TRANSACTION_STATUSES.CONFIRMED,
type: (i) =>
i === 1 ? TRANSACTION_TYPES.CANCEL : TRANSACTION_STATUSES.SENT_ETHER,
i === 1 ? TRANSACTION_TYPES.CANCEL : TRANSACTION_TYPES.SIMPLE_SEND,
});
txs.forEach((tx) => txStateManager.addTransaction(tx));
const result = txStateManager.getTransactions();
@ -693,7 +693,7 @@ describe('TransactionStateManager', function () {
type: (i) =>
i === 1 || i === 5
? TRANSACTION_TYPES.CANCEL
: TRANSACTION_STATUSES.SENT_ETHER,
: TRANSACTION_TYPES.SIMPLE_SEND,
});
txs.forEach((tx) => txStateManager.addTransaction(tx));
const result = txStateManager.getTransactions({
@ -737,7 +737,7 @@ describe('TransactionStateManager', function () {
type: (i) =>
i === 1 || i === 5
? TRANSACTION_TYPES.CANCEL
: TRANSACTION_STATUSES.SENT_ETHER,
: TRANSACTION_TYPES.SIMPLE_SEND,
});
txs.forEach((tx) => txStateManager.addTransaction(tx));
const result = txStateManager.getTransactions({

View File

@ -2,6 +2,8 @@ import { strict as assert } from 'assert';
import { TRANSACTION_TYPES } from '../../../shared/constants/transaction';
import migration53 from './053';
const SENT_ETHER = 'sentEther'; // a legacy transaction type replaced now by TRANSACTION_TYPES.SIMPLE_SEND
describe('migration #53', function () {
it('should update the version metadata', async function () {
const oldStorage = {
@ -25,12 +27,12 @@ describe('migration #53', function () {
transactions: [
{
type: TRANSACTION_TYPES.CANCEL,
transactionCategory: TRANSACTION_TYPES.SENT_ETHER,
transactionCategory: SENT_ETHER,
txParams: { foo: 'bar' },
},
{
type: 'standard',
transactionCategory: TRANSACTION_TYPES.SENT_ETHER,
transactionCategory: SENT_ETHER,
txParams: { foo: 'bar' },
},
{
@ -40,7 +42,7 @@ describe('migration #53', function () {
},
{
type: TRANSACTION_TYPES.RETRY,
transactionCategory: TRANSACTION_TYPES.SENT_ETHER,
transactionCategory: SENT_ETHER,
txParams: { foo: 'bar' },
},
],
@ -64,7 +66,10 @@ describe('migration #53', function () {
TransactionController: {
transactions: [
{ type: TRANSACTION_TYPES.CANCEL, txParams: { foo: 'bar' } },
{ type: TRANSACTION_TYPES.SENT_ETHER, txParams: { foo: 'bar' } },
{
type: SENT_ETHER,
txParams: { foo: 'bar' },
},
{
type: TRANSACTION_TYPES.CONTRACT_INTERACTION,
txParams: { foo: 'bar' },

View File

@ -12,6 +12,8 @@ import {
} from '../../../shared/constants/transaction';
import migration59 from './059';
const SENT_ETHER = 'sentEther'; // a legacy transaction type replaced now by TRANSACTION_TYPES.SIMPLE_SEND
const ERRONEOUS_TRANSACTION_STATE = {
0: {
type: TRANSACTION_TYPES.CANCEL,
@ -22,7 +24,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
1: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 1,
chainId: MAINNET_CHAIN_ID,
txParams: {
@ -30,7 +32,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
2: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 2,
chainId: KOVAN_CHAIN_ID,
txParams: {
@ -38,7 +40,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
3: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 3,
chainId: RINKEBY_CHAIN_ID,
txParams: {
@ -46,7 +48,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
4: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 4,
chainId: RINKEBY_CHAIN_ID,
txParams: {
@ -54,7 +56,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
5: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 5,
chainId: MAINNET_CHAIN_ID,
txParams: {
@ -62,7 +64,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
6: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 6,
chainId: KOVAN_CHAIN_ID,
txParams: {
@ -70,7 +72,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
7: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 7,
chainId: RINKEBY_CHAIN_ID,
txParams: {
@ -78,7 +80,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
8: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 8,
chainId: RINKEBY_CHAIN_ID,
txParams: {
@ -86,7 +88,7 @@ const ERRONEOUS_TRANSACTION_STATE = {
},
},
9: {
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
id: 9,
chainId: RINKEBY_CHAIN_ID,
status: TRANSACTION_STATUSES.UNAPPROVED,
@ -169,7 +171,7 @@ describe('migration #59', function () {
...ERRONEOUS_TRANSACTION_STATE['0'],
id: 11,
chainId: GOERLI_CHAIN_ID,
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
},
},
},
@ -200,7 +202,7 @@ describe('migration #59', function () {
11: {
...ERRONEOUS_TRANSACTION_STATE['0'],
id: 11,
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
},
},
},
@ -250,7 +252,7 @@ describe('migration #59', function () {
...ERRONEOUS_TRANSACTION_STATE_RETRY['0'],
id: 11,
chainId: GOERLI_CHAIN_ID,
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
},
},
},
@ -281,7 +283,7 @@ describe('migration #59', function () {
11: {
...ERRONEOUS_TRANSACTION_STATE_RETRY['0'],
id: 11,
type: TRANSACTION_TYPES.SENT_ETHER,
type: SENT_ETHER,
},
},
},

View File

@ -0,0 +1,41 @@
import { cloneDeep, isPlainObject } from 'lodash';
import { TRANSACTION_TYPES } from '../../../shared/constants/transaction';
const version = 64;
const SENT_ETHER = 'sentEther'; // the legacy transaction type being replaced in this migration with TRANSACTION_TYPES.SIMPLE_SEND
/**
* Removes metaMetricsSendCount from MetaMetrics controller
*/
export default {
version,
async migrate(originalVersionedData) {
const versionedData = cloneDeep(originalVersionedData);
versionedData.meta.version = version;
const state = versionedData.data;
const newState = transformState(state);
versionedData.data = newState;
return versionedData;
},
};
function transformState(state) {
const transactions = state?.TransactionController?.transactions;
if (isPlainObject(transactions)) {
for (const tx of Object.values(transactions)) {
if (tx.type === SENT_ETHER) {
tx.type = TRANSACTION_TYPES.SIMPLE_SEND;
}
if (tx.history) {
tx.history.map((txEvent) => {
if (txEvent.type && txEvent.type === SENT_ETHER) {
txEvent.type = TRANSACTION_TYPES.SIMPLE_SEND;
}
return txEvent;
});
}
}
}
return state;
}

View File

@ -0,0 +1,469 @@
import { strict as assert } from 'assert';
import { TRANSACTION_TYPES } from '../../../shared/constants/transaction';
import { MAINNET_CHAIN_ID } from '../../../shared/constants/network';
import migration64 from './064';
const SENT_ETHER = 'sentEther'; // the legacy transaction type being replaced in this migration with TRANSACTION_TYPES.SIMPLE_SEND
describe('migration #64', function () {
it('should update the version metadata', async function () {
const oldStorage = {
meta: {
version: 63,
},
data: {},
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(newStorage.meta, {
version: 64,
});
});
it('should do nothing if transactions state does not exist', async function () {
const oldStorage = {
meta: {},
data: {
TransactionController: {
bar: 'baz',
},
IncomingTransactionsController: {
foo: 'baz',
},
foo: 'bar',
},
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
});
it('should do nothing if transactions state is empty', async function () {
const oldStorage = {
meta: {},
data: {
TransactionController: {
transactions: {},
bar: 'baz',
},
foo: 'bar',
},
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
});
it('should do nothing if transactions state is not an object', async function () {
const oldStorage = {
meta: {},
data: {
TransactionController: {
transactions: [],
bar: 'baz',
},
foo: 'bar',
},
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
});
it('should do nothing if state is empty', async function () {
const oldStorage = {
meta: {},
data: {},
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
});
it('should change action type of "sentEther" to "simpleSend" for any transactions and transaction history events in transactionsController.transactions', async function () {
const OLD_TRANSACTION_STATE = {
1462177651588364: {
type: TRANSACTION_TYPES.CANCEL,
id: 0,
chainId: MAINNET_CHAIN_ID,
txParams: {
nonce: '0x0',
},
origin: 'https://metamask.github.io',
r: '0x29f00dda09306f0f09895e80db110b9348eeb57d3e0b386409bfb674041ba45a',
rawTx:
'0x02f902fc04278459682f008459682f10830314138080b902a3608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029c001a029f00dda09306f0f09895e80db110b9348eeb57d3e0b386409bfb674041ba45aa049f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
s: '0x49f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
status: 'confirmed',
estimatedBaseFee: 'b',
hash:
'0x4d8543f12afd3795b94d723dcd0e20bfc3740e1af668e5e90a0c5ec49f36ba12',
},
1: {
type: SENT_ETHER,
id: 1,
chainId: MAINNET_CHAIN_ID,
txParams: {
nonce: '0x1',
},
history: [
{
chainId: '0x4',
dappSuggestedGasFees: {
gas: '0x31413',
},
id: 1462177651588364,
loadingDefaults: true,
metamaskNetworkId: '4',
origin: 'https://metamask.github.io',
status: 'unapproved',
time: 1631118004776,
txParams: {
data:
'0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gas: '0x31413',
value: '0x0',
},
type: SENT_ETHER,
},
[
{
note: 'Added new unapproved transaction.',
op: 'add',
path: '/txParams/maxFeePerGas',
timestamp: 1631118004862,
value: '0x59682f10',
},
{
op: 'add',
path: '/txParams/maxPriorityFeePerGas',
value: '0x59682f00',
},
{
op: 'replace',
path: '/loadingDefaults',
value: false,
},
{
op: 'add',
path: '/userFeeLevel',
value: 'medium',
},
],
],
},
3274396743040791: {
baseFeePerGas: '0xb',
chainId: '0x4',
dappSuggestedGasFees: {
gas: '0xa9fe',
},
estimatedBaseFee: 'b',
hash:
'0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
origin: 'https://metamask.github.io',
r: '0xc2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71',
rawTx:
'0x02f87604288459682f008459682f1082a9fe949ef57335bc7d5b6cbc06dca6064a604b75e09ace883782dace9d90000084d0e30db0c001a0c2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71a057876a0292d548dd67c6faed8e835b94252b55a043ce01a1206361ccab417ad4',
s: '0x57876a0292d548dd67c6faed8e835b94252b55a043ce01a1206361ccab417ad4',
status: 'confirmed',
submittedTime: 1631118228493,
time: 1631118217596,
txParams: {
data: '0xd0e30db0',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gas: '0xa9fe',
maxFeePerGas: '0x59682f10',
maxPriorityFeePerGas: '0x59682f00',
nonce: '0x28',
to: '0x9ef57335bc7d5b6cbc06dca6064a604b75e09ace',
value: '0x3782dace9d900000',
},
txReceipt: {
blockHash:
'0xafa4e1fd95e429d9c6e6c7c1d282b2bd0bbeb50d0a68743e9392b9c95a06e2eb',
blockNumber: {
length: 1,
negative: 0,
red: null,
words: [9257603, null],
},
contractAddress: null,
cumulativeGasUsed: {
length: 1,
negative: 0,
red: null,
words: [4954851, null],
},
effectiveGasPrice: '0x59682f0b',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gasUsed: 'a9fe',
logs: [],
logsBloom:
'0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
status: '0x1',
to: '0x9ef57335bc7d5b6cbc06dca6064a604b75e09ace',
transactionHash:
'0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
transactionIndex: {
length: 1,
negative: 0,
red: null,
words: [9, null],
},
type: '0x2',
},
type: SENT_ETHER,
history: [
{
chainId: '0x4',
dappSuggestedGasFees: {
gas: '0xa9fe',
},
id: 3274396743040791,
loadingDefaults: true,
metamaskNetworkId: '4',
origin: 'https://metamask.github.io',
status: 'unapproved',
time: 1631118217596,
txParams: {
data: '0xd0e30db0',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gas: '0xa9fe',
to: '0x9ef57335bc7d5b6cbc06dca6064a604b75e09ace',
value: '0x3782dace9d900000',
},
},
[
{
note: 'Added new unapproved transaction.',
op: 'add',
path: '/txParams/maxFeePerGas',
timestamp: 1631118217762,
value: '0x59682f10',
},
{
op: 'add',
path: '/txParams/maxPriorityFeePerGas',
value: '0x59682f00',
},
{
op: 'replace',
path: '/loadingDefaults',
value: false,
},
{
op: 'add',
path: '/userFeeLevel',
value: 'medium',
},
],
],
},
};
const EXPECTED_TRANSACTION_STATE = {
1462177651588364: {
type: TRANSACTION_TYPES.CANCEL,
id: 0,
chainId: MAINNET_CHAIN_ID,
txParams: {
nonce: '0x0',
},
origin: 'https://metamask.github.io',
r: '0x29f00dda09306f0f09895e80db110b9348eeb57d3e0b386409bfb674041ba45a',
rawTx:
'0x02f902fc04278459682f008459682f10830314138080b902a3608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029c001a029f00dda09306f0f09895e80db110b9348eeb57d3e0b386409bfb674041ba45aa049f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
s: '0x49f74084dd8c517b305a2e60b39ae9002176a5244cb06de8f9ea3757811f5ec6',
status: 'confirmed',
estimatedBaseFee: 'b',
hash:
'0x4d8543f12afd3795b94d723dcd0e20bfc3740e1af668e5e90a0c5ec49f36ba12',
},
1: {
type: TRANSACTION_TYPES.SIMPLE_SEND,
id: 1,
chainId: MAINNET_CHAIN_ID,
txParams: {
nonce: '0x1',
},
history: [
{
chainId: '0x4',
dappSuggestedGasFees: {
gas: '0x31413',
},
id: 1462177651588364,
loadingDefaults: true,
metamaskNetworkId: '4',
origin: 'https://metamask.github.io',
status: 'unapproved',
time: 1631118004776,
txParams: {
data:
'0x608060405234801561001057600080fd5b5033600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000808190555061023b806100686000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632e1a7d4d1461005c5780638da5cb5b1461009d578063d0e30db0146100f4575b600080fd5b34801561006857600080fd5b5061008760048036038101908080359060200190929190505050610112565b6040518082815260200191505060405180910390f35b3480156100a957600080fd5b506100b26101d0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100fc6101f6565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561017057600080fd5b8160008082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156101c5573d6000803e3d6000fd5b506000549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003460008082825401925050819055506000549050905600a165627a7a72305820f237db3ec816a52589d82512117bc85bc08d3537683ffeff9059108caf3e5d400029',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gas: '0x31413',
value: '0x0',
},
type: TRANSACTION_TYPES.SIMPLE_SEND,
},
[
{
note: 'Added new unapproved transaction.',
op: 'add',
path: '/txParams/maxFeePerGas',
timestamp: 1631118004862,
value: '0x59682f10',
},
{
op: 'add',
path: '/txParams/maxPriorityFeePerGas',
value: '0x59682f00',
},
{
op: 'replace',
path: '/loadingDefaults',
value: false,
},
{
op: 'add',
path: '/userFeeLevel',
value: 'medium',
},
],
],
},
3274396743040791: {
baseFeePerGas: '0xb',
chainId: '0x4',
dappSuggestedGasFees: {
gas: '0xa9fe',
},
estimatedBaseFee: 'b',
hash:
'0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
origin: 'https://metamask.github.io',
r: '0xc2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71',
rawTx:
'0x02f87604288459682f008459682f1082a9fe949ef57335bc7d5b6cbc06dca6064a604b75e09ace883782dace9d90000084d0e30db0c001a0c2b2901f3593536d21e9b136c469b9b8f91a944f18a29a3cdf3a2eaadf660e71a057876a0292d548dd67c6faed8e835b94252b55a043ce01a1206361ccab417ad4',
s: '0x57876a0292d548dd67c6faed8e835b94252b55a043ce01a1206361ccab417ad4',
status: 'confirmed',
submittedTime: 1631118228493,
time: 1631118217596,
txParams: {
data: '0xd0e30db0',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gas: '0xa9fe',
maxFeePerGas: '0x59682f10',
maxPriorityFeePerGas: '0x59682f00',
nonce: '0x28',
to: '0x9ef57335bc7d5b6cbc06dca6064a604b75e09ace',
value: '0x3782dace9d900000',
},
txReceipt: {
blockHash:
'0xafa4e1fd95e429d9c6e6c7c1d282b2bd0bbeb50d0a68743e9392b9c95a06e2eb',
blockNumber: {
length: 1,
negative: 0,
red: null,
words: [9257603, null],
},
contractAddress: null,
cumulativeGasUsed: {
length: 1,
negative: 0,
red: null,
words: [4954851, null],
},
effectiveGasPrice: '0x59682f0b',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gasUsed: 'a9fe',
logs: [],
logsBloom:
'0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
status: '0x1',
to: '0x9ef57335bc7d5b6cbc06dca6064a604b75e09ace',
transactionHash:
'0x19ffab8a9467df9afbef82d8907f9e39f0696c7a774ed5473ecf7337adcc674b',
transactionIndex: {
length: 1,
negative: 0,
red: null,
words: [9, null],
},
type: '0x2',
},
type: TRANSACTION_TYPES.SIMPLE_SEND,
history: [
{
chainId: '0x4',
dappSuggestedGasFees: {
gas: '0xa9fe',
},
id: 3274396743040791,
loadingDefaults: true,
metamaskNetworkId: '4',
origin: 'https://metamask.github.io',
status: 'unapproved',
time: 1631118217596,
txParams: {
data: '0xd0e30db0',
from: '0x0f002c95c041f003be01c3e4f52cae1f6ab3ba6e',
gas: '0xa9fe',
to: '0x9ef57335bc7d5b6cbc06dca6064a604b75e09ace',
value: '0x3782dace9d900000',
},
},
[
{
note: 'Added new unapproved transaction.',
op: 'add',
path: '/txParams/maxFeePerGas',
timestamp: 1631118217762,
value: '0x59682f10',
},
{
op: 'add',
path: '/txParams/maxPriorityFeePerGas',
value: '0x59682f00',
},
{
op: 'replace',
path: '/loadingDefaults',
value: false,
},
{
op: 'add',
path: '/userFeeLevel',
value: 'medium',
},
],
],
},
};
const oldStorage = {
meta: {},
data: {
TransactionController: {
transactions: OLD_TRANSACTION_STATE,
},
},
};
const expectedStorage = {
meta: {},
data: {
TransactionController: {
transactions: EXPECTED_TRANSACTION_STATE,
},
},
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(expectedStorage.data, newStorage.data);
});
});

View File

@ -67,6 +67,7 @@ import m060 from './060';
import m061 from './061';
import m062 from './062';
import m063 from './063';
import m064 from './064';
const migrations = [
m002,
@ -131,6 +132,7 @@ const migrations = [
m061,
m062,
m063,
m064,
];
export default migrations;

View File

@ -11,7 +11,7 @@ import { MESSAGE_TYPE } from './app';
* @property {'approve'} TOKEN_METHOD_APPROVE - A token transaction requesting an
* allowance of the token to spend on behalf of the user
* @property {'incoming'} INCOMING - An incoming (deposit) transaction
* @property {'sentEther'} SENT_ETHER - A transaction sending ether to a recipient
* @property {'simpleSend'} SIMPLE_SEND - A transaction sending a network's native asset to a recipient
* @property {'contractInteraction'} CONTRACT_INTERACTION - A transaction that is
* interacting with a smart contract's methods that we have not treated as a special
* case, such as approve, transfer, and transferfrom
@ -48,7 +48,7 @@ export const TRANSACTION_TYPES = {
TOKEN_METHOD_TRANSFER_FROM: 'transferfrom',
TOKEN_METHOD_APPROVE: 'approve',
INCOMING: 'incoming',
SENT_ETHER: 'sentEther',
SIMPLE_SEND: 'simpleSend',
CONTRACT_INTERACTION: 'contractInteraction',
DEPLOY_CONTRACT: 'contractDeployment',
SWAP: 'swap',

View File

@ -16,7 +16,7 @@
"gasPrice": "0x2540be400"
},
"origin": "metamask",
"type": "sentEther",
"type": "simpleSend",
"nonceDetails": {
"params": {
"highestLocallyConfirmed": 12,
@ -138,7 +138,7 @@
"gasPrice": "0x2540be400"
},
"origin": "metamask",
"type": "sentEther",
"type": "simpleSend",
"nonceDetails": {
"params": {
"highestLocallyConfirmed": 12,
@ -203,7 +203,7 @@
"gasPrice": "0x2540be400"
},
"origin": "metamask",
"type": "sentEther",
"type": "simpleSend",
"nonceDetails": {
"params": {
"highestLocallyConfirmed": 0,
@ -325,7 +325,7 @@
"gasPrice": "0x2540be400"
},
"origin": "metamask",
"type": "sentEther",
"type": "simpleSend",
"nonceDetails": {
"params": {
"highestLocallyConfirmed": 0,
@ -390,7 +390,7 @@
"gasPrice": "0x306dc4200"
},
"origin": "metamask",
"type": "sentEther",
"type": "simpleSend",
"nonceDetails": {
"params": {
"highestLocallyConfirmed": 0,
@ -514,7 +514,7 @@
"gasPrice": "0x306dc4200"
},
"origin": "metamask",
"type": "sentEther",
"type": "simpleSend",
"nonceDetails": {
"params": {
"highestLocallyConfirmed": 0,

View File

@ -150,7 +150,7 @@
"gasPrice": "0x363fe1da00"
},
"origin": "metamask",
"type": "sentEther",
"type": "simpleSend",
"history": [],
"nonceDetails": {
"params": {

View File

@ -163,7 +163,7 @@
"to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970",
"value": "0xde0b6b3a7640000"
},
"type": "sentEther"
"type": "simpleSend"
},
[
{
@ -188,7 +188,7 @@
"to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970",
"value": "0xde0b6b3a7640000"
},
"type": "sentEther"
"type": "simpleSend"
}
}
},

View File

@ -14,7 +14,7 @@ export const txMetaStub = {
metamaskNetworkId: '4',
status: TRANSACTION_STATUSES.UNAPPROVED,
time: 1572395156620,
type: TRANSACTION_TYPES.SENT_ETHER,
type: TRANSACTION_TYPES.SIMPLE_SEND,
txParams: {
from: '0xf231d46dd78806e1dd93442cf33c7671f8538748',
gas: GAS_LIMITS.SIMPLE,
@ -195,7 +195,7 @@ export const txMetaStub = {
status: TRANSACTION_STATUSES.SUBMITTED,
submittedTime: 1572395158570,
time: 1572395156620,
type: TRANSACTION_TYPES.SENT_ETHER,
type: TRANSACTION_TYPES.SIMPLE_SEND,
txParams: {
from: '0xf231d46dd78806e1dd93442cf33c7671f8538748',
gas: GAS_LIMITS.SIMPLE,

View File

@ -196,9 +196,10 @@ export function getStatusKey(transaction) {
* This will throw an error if the transaction category is unrecognized and no default is provided.
* @param {function} t - The translation function
* @param {TRANSACTION_TYPES[keyof TRANSACTION_TYPES]} type - The transaction type constant
* @param {string} nativeCurrency - The native currency of the currently selected network
* @returns {string} The transaction category title
*/
export function getTransactionTypeTitle(t, type) {
export function getTransactionTypeTitle(t, type, nativeCurrency = 'ETH') {
switch (type) {
case TRANSACTION_TYPES.TOKEN_METHOD_TRANSFER: {
return t('transfer');
@ -209,8 +210,8 @@ export function getTransactionTypeTitle(t, type) {
case TRANSACTION_TYPES.TOKEN_METHOD_APPROVE: {
return t('approve');
}
case TRANSACTION_TYPES.SENT_ETHER: {
return t('sentEther');
case TRANSACTION_TYPES.SIMPLE_SEND: {
return t('sendingNativeAsset', [nativeCurrency]);
}
case TRANSACTION_TYPES.CONTRACT_INTERACTION: {
return t('contractInteraction');

View File

@ -222,7 +222,7 @@ export function useTransactionDisplayData(transactionGroup) {
title = t('sendSpecifiedTokens', [token?.symbol || t('token')]);
recipientAddress = getTokenAddressParam(tokenData);
subtitle = t('toAddress', [shortenAddress(recipientAddress)]);
} else if (type === TRANSACTION_TYPES.SENT_ETHER) {
} else if (type === TRANSACTION_TYPES.SIMPLE_SEND) {
category = TRANSACTION_GROUP_CATEGORIES.SEND;
title = t('send');
subtitle = t('toAddress', [shortenAddress(recipientAddress)]);

View File

@ -127,6 +127,7 @@ export default class ConfirmTransactionBase extends Component {
gasFeeIsCustom: PropTypes.bool,
isLedgerAccount: PropTypes.bool.isRequired,
isFirefox: PropTypes.bool.isRequired,
nativeCurrency: PropTypes.string,
};
state = {
@ -914,6 +915,7 @@ export default class ConfirmTransactionBase extends Component {
txData,
gasIsLoading,
gasFeeIsCustom,
nativeCurrency,
} = this.props;
const {
submitting,
@ -940,7 +942,7 @@ export default class ConfirmTransactionBase extends Component {
let functionType = getMethodName(name);
if (!functionType) {
if (type) {
functionType = getTransactionTypeTitle(t, type);
functionType = getTransactionTypeTitle(t, type, nativeCurrency);
} else {
functionType = t('contractInteraction');
}

View File

@ -44,6 +44,7 @@ import { toChecksumHexAddress } from '../../../shared/modules/hexstring-utils';
import {
updateTransactionGasFees,
getIsGasEstimatesLoading,
getNativeCurrency,
} from '../../ducks/metamask/metamask';
import { getGasLoadingAnimationIsShowing } from '../../ducks/app/app';
import ConfirmTransactionBase from './confirm-transaction-base.component';
@ -169,6 +170,7 @@ const mapStateToProps = (state, ownProps) => {
txParamsAreDappSuggested(fullTxData);
const isLedgerAccount = getAccountType(state) === KEYRING_TYPES.LEDGER;
const isFirefox = getPlatform() === PLATFORM_FIREFOX;
const nativeCurrency = getNativeCurrency(state);
return {
balance,
@ -217,6 +219,7 @@ const mapStateToProps = (state, ownProps) => {
gasFeeIsCustom,
isLedgerAccount,
isFirefox,
nativeCurrency,
};
};

View File

@ -31,7 +31,7 @@ export default class ConfirmTransactionSwitch extends Component {
return <Redirect to={{ pathname }} />;
}
if (type === TRANSACTION_TYPES.SENT_ETHER) {
if (type === TRANSACTION_TYPES.SIMPLE_SEND) {
const pathname = `${CONFIRM_TRANSACTION_ROUTE}/${id}${CONFIRM_SEND_ETHER_PATH}`;
return <Redirect to={{ pathname }} />;
}