mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
fix state problems with Storybook (#11984)
* fix state problems with Storybook * lint * lint * Cleanup Co-authored-by: ryanml <ryanlanese@gmail.com>
This commit is contained in:
parent
60920d34b5
commit
09e79f273a
@ -45,6 +45,10 @@ const styles = {
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getNewState = (state, props) => {
|
||||||
|
return Object.assign(state, props);
|
||||||
|
}
|
||||||
|
|
||||||
export const store = configureStore(testData);
|
export const store = configureStore(testData);
|
||||||
const history = createBrowserHistory();
|
const history = createBrowserHistory();
|
||||||
const proxiedBackground = new Proxy({}, {
|
const proxiedBackground = new Proxy({}, {
|
||||||
|
@ -45,6 +45,7 @@ const state = {
|
|||||||
"time": 1620710815484,
|
"time": 1620710815484,
|
||||||
"status": "unapproved",
|
"status": "unapproved",
|
||||||
"metamaskNetworkId": "3",
|
"metamaskNetworkId": "3",
|
||||||
|
"msgParams": "0x64a845a5b02460acf8a3d84503b0d68d028b4bb4",
|
||||||
"chainId": "0x3",
|
"chainId": "0x3",
|
||||||
"loadingDefaults": false,
|
"loadingDefaults": false,
|
||||||
"txParams": {
|
"txParams": {
|
||||||
@ -186,7 +187,501 @@ const state = {
|
|||||||
},
|
},
|
||||||
"currentBlockGasLimit": "0x793af4",
|
"currentBlockGasLimit": "0x793af4",
|
||||||
"currentNetworkTxList": [
|
"currentNetworkTxList": [
|
||||||
|
{
|
||||||
|
"chainId": "0x38",
|
||||||
|
"dappSuggestedGasFees": null,
|
||||||
|
"firstRetryBlockNumber": "0x9c2686",
|
||||||
|
"hash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"history": [
|
||||||
|
{
|
||||||
|
"chainId": "0x38",
|
||||||
|
"dappSuggestedGasFees": null,
|
||||||
|
"id": 2360388496987298,
|
||||||
|
"loadingDefaults": true,
|
||||||
|
"metamaskNetworkId": "56",
|
||||||
|
"origin": "metamask",
|
||||||
|
"status": "unapproved",
|
||||||
|
"time": 1629582710520,
|
||||||
|
"txParams": {
|
||||||
|
"data": "0xa9059cbb0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c2900000000000000000000000000000000000000000000000029a2241af62c0000",
|
||||||
|
"from": "0x17f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"gas": "0x2eb27",
|
||||||
|
"gasPrice": "0x12a05f200",
|
||||||
|
"to": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"type": "0x0",
|
||||||
|
"value": "0x0"
|
||||||
|
},
|
||||||
|
"type": "transfer"
|
||||||
|
},
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "Added new unapproved transaction.",
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/loadingDefaults",
|
||||||
|
"timestamp": 1629582710530,
|
||||||
|
"value": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "txStateManager: setting status to approved",
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/status",
|
||||||
|
"timestamp": 1629582711218,
|
||||||
|
"value": "approved"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "transactions#approveTransaction",
|
||||||
|
"op": "add",
|
||||||
|
"path": "/txParams/nonce",
|
||||||
|
"timestamp": 1629582711220,
|
||||||
|
"value": "0x15b"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/nonceDetails",
|
||||||
|
"value": {
|
||||||
|
"local": {
|
||||||
|
"details": {
|
||||||
|
"highest": 347,
|
||||||
|
"startPoint": 347
|
||||||
|
},
|
||||||
|
"name": "local",
|
||||||
|
"nonce": 347
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"details": {
|
||||||
|
"baseCount": 347,
|
||||||
|
"blockNumber": "0x9c2682"
|
||||||
|
},
|
||||||
|
"name": "network",
|
||||||
|
"nonce": 347
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"highestLocallyConfirmed": 327,
|
||||||
|
"highestSuggested": 347,
|
||||||
|
"nextNetworkNonce": 347
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "transactions#signTransaction: add r, s, v values",
|
||||||
|
"op": "add",
|
||||||
|
"path": "/r",
|
||||||
|
"timestamp": 1629582711236,
|
||||||
|
"value": "0x90a4dfb0646eef9815454d0ab543b5844acb8772101084565155c93ecce8ed69"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/s",
|
||||||
|
"value": "0x7fd317c727025490f282c7990b8518a7dab7521b1ada1cb639f887966bc078df"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/v",
|
||||||
|
"value": "0x93"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "txStateManager: setting status to signed",
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/status",
|
||||||
|
"timestamp": 1629582711236,
|
||||||
|
"value": "signed"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "transactions#publishTransaction",
|
||||||
|
"op": "add",
|
||||||
|
"path": "/rawTx",
|
||||||
|
"timestamp": 1629582711237,
|
||||||
|
"value": "0xf8ad82015b85012a05f2008302eb27942e8c05582176fa93b4590382e8290c73deb8217680b844a9059cbb0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c2900000000000000000000000000000000000000000000000029a2241af62c00008193a090a4dfb0646eef9815454d0ab543b5844acb8772101084565155c93ecce8ed69a07fd317c727025490f282c7990b8518a7dab7521b1ada1cb639f887966bc078df"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "transactions#setTxHash",
|
||||||
|
"op": "add",
|
||||||
|
"path": "/hash",
|
||||||
|
"timestamp": 1629582711336,
|
||||||
|
"value": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "txStateManager - add submitted time stamp",
|
||||||
|
"op": "add",
|
||||||
|
"path": "/submittedTime",
|
||||||
|
"timestamp": 1629582711337,
|
||||||
|
"value": 1629582711337
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "txStateManager: setting status to submitted",
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/status",
|
||||||
|
"timestamp": 1629582711338,
|
||||||
|
"value": "submitted"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "transactions/pending-tx-tracker#event: tx:block-update",
|
||||||
|
"op": "add",
|
||||||
|
"path": "/firstRetryBlockNumber",
|
||||||
|
"timestamp": 1629582711878,
|
||||||
|
"value": "0x9c2686"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "txStateManager: setting status to confirmed",
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/status",
|
||||||
|
"timestamp": 1629582721178,
|
||||||
|
"value": "confirmed"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "add",
|
||||||
|
"path": "/txReceipt",
|
||||||
|
"value": {
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": "9c2688",
|
||||||
|
"contractAddress": null,
|
||||||
|
"cumulativeGasUsed": "19a4942",
|
||||||
|
"from": "0x17f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"gasUsed": "1f21a",
|
||||||
|
"logs": [
|
||||||
|
{
|
||||||
|
"address": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": "9c2688",
|
||||||
|
"data": "0x00000000000000000000000000000000000000000000000028426c213d688000",
|
||||||
|
"logIndex": "245",
|
||||||
|
"removed": false,
|
||||||
|
"topics": [
|
||||||
|
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
||||||
|
"0x00000000000000000000000017f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"0x0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c29"
|
||||||
|
],
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": "ae"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": "9c2688",
|
||||||
|
"data": "0x000000000000000000000000000000000000000000000000006a94d74f430000",
|
||||||
|
"logIndex": "246",
|
||||||
|
"removed": false,
|
||||||
|
"topics": [
|
||||||
|
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
||||||
|
"0x00000000000000000000000017f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"0x000000000000000000000000c825413863f677a2012bb8db3a5e4a18bbf29e56"
|
||||||
|
],
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": "ae"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": "9c2688",
|
||||||
|
"data": "0x000000000000000000000000000000000000000000000000001ff973cafa8000",
|
||||||
|
"logIndex": "247",
|
||||||
|
"removed": false,
|
||||||
|
"topics": [
|
||||||
|
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
||||||
|
"0x00000000000000000000000017f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"0x0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c29"
|
||||||
|
],
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": "ae"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"logsBloom": "0x20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000100000000000020000000000000000000000000000000008000000000080000000000000000000000000000000000000000040000000000000000000000040000000000200000010000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000200000000000000000000800000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000",
|
||||||
|
"status": "0x1",
|
||||||
|
"to": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": "ae",
|
||||||
|
"type": "0x0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"note": "transactions#confirmTransaction - add txReceipt",
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/transactionIndex",
|
||||||
|
"timestamp": 1629582721183,
|
||||||
|
"value": "ae"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/2/logIndex",
|
||||||
|
"value": "247"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/2/transactionIndex",
|
||||||
|
"value": "ae"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/2/blockNumber",
|
||||||
|
"value": "9c2688"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/1/logIndex",
|
||||||
|
"value": "246"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/1/transactionIndex",
|
||||||
|
"value": "ae"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/1/blockNumber",
|
||||||
|
"value": "9c2688"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/0/logIndex",
|
||||||
|
"value": "245"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/0/transactionIndex",
|
||||||
|
"value": "ae"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/logs/0/blockNumber",
|
||||||
|
"value": "9c2688"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/cumulativeGasUsed",
|
||||||
|
"value": "19a4942"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"op": "replace",
|
||||||
|
"path": "/txReceipt/blockNumber",
|
||||||
|
"value": "9c2688"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"id": 7900715443136469,
|
||||||
|
"loadingDefaults": false,
|
||||||
|
"metamaskNetworkId": "56",
|
||||||
|
"nonceDetails": {
|
||||||
|
"local": {
|
||||||
|
"details": {
|
||||||
|
"highest": 347,
|
||||||
|
"startPoint": 347
|
||||||
|
},
|
||||||
|
"name": "local",
|
||||||
|
"nonce": 347
|
||||||
|
},
|
||||||
|
"network": {
|
||||||
|
"details": {
|
||||||
|
"baseCount": 347,
|
||||||
|
"blockNumber": "0x9c2682"
|
||||||
|
},
|
||||||
|
"name": "network",
|
||||||
|
"nonce": 347
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"highestLocallyConfirmed": 327,
|
||||||
|
"highestSuggested": 347,
|
||||||
|
"nextNetworkNonce": 347
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"origin": "metamask",
|
||||||
|
"r": "0x90a4dfb0646eef9815454d0ab543b5844acb8772101084565155c93ecce8ed69",
|
||||||
|
"rawTx": "0xf8ad82015b85012a05f2008302eb27942e8c05582176fa93b4590382e8290c73deb8217680b844a9059cbb0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c2900000000000000000000000000000000000000000000000029a2241af62c00008193a090a4dfb0646eef9815454d0ab543b5844acb8772101084565155c93ecce8ed69a07fd317c727025490f282c7990b8518a7dab7521b1ada1cb639f887966bc078df",
|
||||||
|
"s": "0x7fd317c727025490f282c7990b8518a7dab7521b1ada1cb639f887966bc078df",
|
||||||
|
"status": "confirmed",
|
||||||
|
"submittedTime": 1629582711337,
|
||||||
|
"time": 1629582710520,
|
||||||
|
"txParams": {
|
||||||
|
"data": "0xa9059cbb0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c2900000000000000000000000000000000000000000000000029a2241af62c0000",
|
||||||
|
"from": "0x17f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"gas": "0x2eb27",
|
||||||
|
"gasPrice": "0x12a05f200",
|
||||||
|
"nonce": "0x15b",
|
||||||
|
"to": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"type": "0x0",
|
||||||
|
"value": "0x0"
|
||||||
|
},
|
||||||
|
"txReceipt": {
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
10233480,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"contractAddress": null,
|
||||||
|
"cumulativeGasUsed": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
26888514,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"from": "0x17f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"gasUsed": "1f21a",
|
||||||
|
"logs": [
|
||||||
|
{
|
||||||
|
"address": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
10233480,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"data": "0x00000000000000000000000000000000000000000000000028426c213d688000",
|
||||||
|
"logIndex": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
581,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"removed": false,
|
||||||
|
"topics": [
|
||||||
|
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
||||||
|
"0x00000000000000000000000017f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"0x0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c29"
|
||||||
|
],
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
174,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
10233480,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"data": "0x000000000000000000000000000000000000000000000000006a94d74f430000",
|
||||||
|
"logIndex": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
582,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"removed": false,
|
||||||
|
"topics": [
|
||||||
|
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
||||||
|
"0x00000000000000000000000017f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"0x000000000000000000000000c825413863f677a2012bb8db3a5e4a18bbf29e56"
|
||||||
|
],
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
174,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"blockHash": "0x30bf5dfa12e460a5d121267c00ba3047a14ba286e0c4fe75fa979010f527cba0",
|
||||||
|
"blockNumber": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
10233480,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"data": "0x000000000000000000000000000000000000000000000000001ff973cafa8000",
|
||||||
|
"logIndex": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
583,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"removed": false,
|
||||||
|
"topics": [
|
||||||
|
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
|
||||||
|
"0x00000000000000000000000017f62b1b2407c41c43e14da0699d6b4b0a521548",
|
||||||
|
"0x0000000000000000000000004ef2d5a1d056e7c9e8bcdbf2bd9ac0df749a1c29"
|
||||||
|
],
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
174,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"logsBloom": "0x20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000100000000000020000000000000000000000000000000008000000000080000000000000000000000000000000000000000040000000000000000000000040000000000200000010000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000200000000000000000000800000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000",
|
||||||
|
"status": "0x1",
|
||||||
|
"to": "0x2e8c05582176fa93b4590382e8290c73deb82176",
|
||||||
|
"transactionHash": "0xf45e7a751adfc0fbadccc972816baf33eb34543e52ace51f0f8d0d7f357afdc6",
|
||||||
|
"transactionIndex": {
|
||||||
|
"length": 1,
|
||||||
|
"negative": 0,
|
||||||
|
"red": null,
|
||||||
|
"words": [
|
||||||
|
174,
|
||||||
|
null
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"type": "0x0"
|
||||||
|
},
|
||||||
|
"type": "transfer",
|
||||||
|
"v": "0x93"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"cachedBalances": {
|
"cachedBalances": {
|
||||||
"1": {
|
"1": {
|
||||||
@ -653,7 +1148,12 @@ const state = {
|
|||||||
"send": {
|
"send": {
|
||||||
"toDropdownOpen": false,
|
"toDropdownOpen": false,
|
||||||
"gasButtonGroupShown": true,
|
"gasButtonGroupShown": true,
|
||||||
"errors": {}
|
"errors": {},
|
||||||
|
"asset": {
|
||||||
|
"type": "NATIVE",
|
||||||
|
"balance": "0x0",
|
||||||
|
"details": null
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"confirmTransaction": {
|
"confirmTransaction": {
|
||||||
"txData": {
|
"txData": {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* eslint-disable react/prop-types */
|
/* eslint-disable react/prop-types */
|
||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { text } from '@storybook/addon-knobs';
|
import { text } from '@storybook/addon-knobs';
|
||||||
import { store } from '../../../.storybook/preview';
|
import { store, getNewState } from '../../../.storybook/preview';
|
||||||
import { suggestedTokens } from '../../../.storybook/initial-states/approval-screens/add-suggested-token';
|
import { suggestedTokens } from '../../../.storybook/initial-states/approval-screens/add-suggested-token';
|
||||||
import { updateMetamaskState } from '../../store/actions';
|
import { updateMetamaskState } from '../../store/actions';
|
||||||
import ConfirmAddSuggestedToken from '.';
|
import ConfirmAddSuggestedToken from '.';
|
||||||
@ -22,23 +22,39 @@ const PageSet = ({ children }) => {
|
|||||||
'0x6b175474e89094c44da98b954eedeac495271d0f'
|
'0x6b175474e89094c44da98b954eedeac495271d0f'
|
||||||
].symbol = symbol;
|
].symbol = symbol;
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updateMetamaskState({ suggestedTokens: suggestedTokensState }),
|
updateMetamaskState(
|
||||||
|
getNewState(state.metamask, {
|
||||||
|
suggestedTokens: suggestedTokensState,
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}, [symbol, suggestedTokensState]);
|
}, [symbol, suggestedTokensState, state.metamask]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
suggestedTokensState[
|
suggestedTokensState[
|
||||||
'0x6b175474e89094c44da98b954eedeac495271d0f'
|
'0x6b175474e89094c44da98b954eedeac495271d0f'
|
||||||
].image = image;
|
].image = image;
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updateMetamaskState({ suggestedTokens: suggestedTokensState }),
|
updateMetamaskState(
|
||||||
|
getNewState(state.metamask, {
|
||||||
|
suggestedTokens: suggestedTokensState,
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}, [image, suggestedTokensState]);
|
}, [image, suggestedTokensState, state.metamask]);
|
||||||
|
|
||||||
return children;
|
return children;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AddSuggestedToken = () => {
|
export const AddSuggestedToken = () => {
|
||||||
store.dispatch(updateMetamaskState({ suggestedTokens, pendingTokens: {} }));
|
const state = store.getState();
|
||||||
|
store.dispatch(
|
||||||
|
updateMetamaskState(
|
||||||
|
getNewState(state.metamask, {
|
||||||
|
suggestedTokens,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageSet>
|
<PageSet>
|
||||||
<ConfirmAddSuggestedToken />
|
<ConfirmAddSuggestedToken />
|
||||||
|
@ -3,7 +3,7 @@ import React, { useEffect } from 'react';
|
|||||||
|
|
||||||
import { createBrowserHistory } from 'history';
|
import { createBrowserHistory } from 'history';
|
||||||
import { text } from '@storybook/addon-knobs';
|
import { text } from '@storybook/addon-knobs';
|
||||||
import { store } from '../../../.storybook/preview';
|
import { store, getNewState } from '../../../.storybook/preview';
|
||||||
import { tokens } from '../../../.storybook/initial-states/approval-screens/add-token';
|
import { tokens } from '../../../.storybook/initial-states/approval-screens/add-token';
|
||||||
import { updateMetamaskState } from '../../store/actions';
|
import { updateMetamaskState } from '../../store/actions';
|
||||||
import ConfirmAddToken from '.';
|
import ConfirmAddToken from '.';
|
||||||
@ -20,16 +20,30 @@ const PageSet = ({ children }) => {
|
|||||||
const pendingTokensState = state.metamask.pendingTokens;
|
const pendingTokensState = state.metamask.pendingTokens;
|
||||||
// only change the first token in the list
|
// only change the first token in the list
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const pendingTokens = { ...pendingTokensState };
|
pendingTokensState[
|
||||||
pendingTokens['0x33f90dee07c6e8b9682dd20f73e6c358b2ed0f03'].symbol = symbol;
|
'0x33f90dee07c6e8b9682dd20f73e6c358b2ed0f03'
|
||||||
store.dispatch(updateMetamaskState({ pendingTokens }));
|
].symbol = symbol;
|
||||||
}, [symbol, pendingTokensState]);
|
store.dispatch(
|
||||||
|
updateMetamaskState(
|
||||||
|
getNewState(state.metamask, {
|
||||||
|
pendingTokens: pendingTokensState,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}, [symbol, pendingTokensState, state.metamask]);
|
||||||
|
|
||||||
return children;
|
return children;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AddToken = () => {
|
export const AddToken = () => {
|
||||||
store.dispatch(updateMetamaskState({ pendingTokens: tokens }));
|
const state = store.getState();
|
||||||
|
store.dispatch(
|
||||||
|
updateMetamaskState(
|
||||||
|
getNewState(state.metamask, {
|
||||||
|
pendingTokens: tokens,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
return (
|
return (
|
||||||
<PageSet>
|
<PageSet>
|
||||||
<ConfirmAddToken history={history} />
|
<ConfirmAddToken history={history} />
|
||||||
|
@ -5,12 +5,9 @@ import { useParams } from 'react-router-dom';
|
|||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { updateMetamaskState } from '../../store/actions';
|
import { updateMetamaskState } from '../../store/actions';
|
||||||
import { currentNetworkTxListSelector } from '../../selectors/transactions';
|
import { currentNetworkTxListSelector } from '../../selectors/transactions';
|
||||||
import { store } from '../../../.storybook/preview';
|
import { store, getNewState } from '../../../.storybook/preview';
|
||||||
|
|
||||||
import {
|
import { domainMetadata } from '../../../.storybook/initial-states/approval-screens/token-approval';
|
||||||
currentNetworkTxListSample,
|
|
||||||
domainMetadata,
|
|
||||||
} from '../../../.storybook/initial-states/approval-screens/token-approval';
|
|
||||||
import ConfirmApprove from '.';
|
import ConfirmApprove from '.';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -26,28 +23,34 @@ const PageSet = ({ children }) => {
|
|||||||
'Icon URL',
|
'Icon URL',
|
||||||
'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
'https://metamask.github.io/test-dapp/metamask-fox.svg',
|
||||||
);
|
);
|
||||||
|
const state = store.getState();
|
||||||
const currentNetworkTxList = useSelector(currentNetworkTxListSelector);
|
const currentNetworkTxList = useSelector(currentNetworkTxListSelector);
|
||||||
const transaction = currentNetworkTxList.find(({ id }) => id === txId);
|
const transaction = currentNetworkTxList.find(({ id }) => id === txId);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
transaction.origin = origin;
|
transaction.origin = origin;
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updateMetamaskState({ currentNetworkTxList: [transaction] }),
|
updateMetamaskState(
|
||||||
|
getNewState(state.metamask, {
|
||||||
|
currentNetworkTxList: [transaction],
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}, [origin, transaction]);
|
}, [origin, transaction, state.metamask]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updateMetamaskState({
|
updateMetamaskState(
|
||||||
domainMetadata: {
|
getNewState(state.metamask, {
|
||||||
[origin]: {
|
domainMetadata: {
|
||||||
icon: domainIconUrl,
|
[origin]: {
|
||||||
|
icon: domainIconUrl,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
}),
|
),
|
||||||
);
|
);
|
||||||
}, [domainIconUrl, origin]);
|
}, [domainIconUrl, origin, state.metamask]);
|
||||||
|
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
params.id = txId;
|
params.id = txId;
|
||||||
@ -55,10 +58,14 @@ const PageSet = ({ children }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ApproveTokens = () => {
|
export const ApproveTokens = () => {
|
||||||
|
const state = store.getState();
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updateMetamaskState({ currentNetworkTxList: [currentNetworkTxListSample] }),
|
updateMetamaskState(
|
||||||
|
getNewState(state.metamask, {
|
||||||
|
domainMetadata,
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
store.dispatch(updateMetamaskState({ domainMetadata }));
|
|
||||||
return (
|
return (
|
||||||
<PageSet>
|
<PageSet>
|
||||||
<ConfirmApprove />
|
<ConfirmApprove />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { select } from '@storybook/addon-knobs';
|
import { select } from '@storybook/addon-knobs';
|
||||||
|
|
||||||
import { store } from '../../../.storybook/preview';
|
import { store, getNewState } from '../../../.storybook/preview';
|
||||||
import { updateMetamaskState } from '../../store/actions';
|
import { updateMetamaskState } from '../../store/actions';
|
||||||
import ConfirmEncryptionPublicKey from '.';
|
import ConfirmEncryptionPublicKey from '.';
|
||||||
|
|
||||||
@ -26,17 +26,18 @@ const PageSet = ({ children }) => {
|
|||||||
unapprovedEncryptionPublicKeyMsgs['7786962153682822'].msgParams =
|
unapprovedEncryptionPublicKeyMsgs['7786962153682822'].msgParams =
|
||||||
account.address;
|
account.address;
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
updateMetamaskState({
|
updateMetamaskState(
|
||||||
unapprovedEncryptionPublicKeyMsgs,
|
getNewState(state.metamask, {
|
||||||
}),
|
unapprovedEncryptionPublicKeyMsgs,
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}, [account, unapprovedEncryptionPublicKeyMsgs]);
|
}, [account, unapprovedEncryptionPublicKeyMsgs, state.metamask]);
|
||||||
|
|
||||||
return children;
|
return children;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ConfirmEncryption = () => {
|
export const ConfirmEncryption = () => {
|
||||||
store.dispatch(updateMetamaskState({ unapprovedTxs: {} }));
|
|
||||||
return (
|
return (
|
||||||
<PageSet>
|
<PageSet>
|
||||||
<ConfirmEncryptionPublicKey />
|
<ConfirmEncryptionPublicKey />
|
||||||
|
Loading…
Reference in New Issue
Block a user