Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4910ad02fc |
No files matched your search
@@ -1176,8 +1176,9 @@ It is resolved from these sources, in this order (`resolveTokenDecimals()` in
|
|||||||
|
|
||||||
The token's name comes from the same sources. While "Use Blockscout" is off, a
|
The token's name comes from the same sources. While "Use Blockscout" is off, a
|
||||||
token's name or decimals may be missing from the bundled list and the tracked
|
token's name or decimals may be missing from the bundled list and the tracked
|
||||||
tokens. Then a line under the token says "This token was not looked up on
|
tokens. Then a line under the token says "Blockscout's report of your balances
|
||||||
Blockscout, because "Use Blockscout" is off in Settings." These screens show it:
|
is not used to name this token, because "Use Blockscout" is off in Settings."
|
||||||
|
These screens show it:
|
||||||
|
|
||||||
- TxApproval and SignApproval
|
- TxApproval and SignApproval
|
||||||
- WaitTx, SuccessTx and ErrorTx, which follow TxApproval
|
- WaitTx, SuccessTx and ErrorTx, which follow TxApproval
|
||||||
@@ -1219,8 +1220,8 @@ for a bundled or tracked token the explorer merely omitted, which is not a
|
|||||||
refusal the wallet has any reason to make.
|
refusal the wallet has any reason to make.
|
||||||
|
|
||||||
While "Use Blockscout" is on, the Send screen also consults every address's
|
While "Use Blockscout" is on, the Send screen also consults every address's
|
||||||
explorer reports. So a contract two addresses report different `decimals` for
|
explorer reports. Two addresses may report different `decimals` for one
|
||||||
has no scale there, and the stored balance, formatted at one of those scales, is
|
contract. That token then has no scale on Send, and its stored balance is
|
||||||
withdrawn with it. The Send screen's `Current balance` and the confirmation
|
withdrawn with it. The Send screen's `Current balance` and the confirmation
|
||||||
screen's balance line then both read `unknown (SYMBOL)`. The balance list
|
screen's balance line then both read `unknown (SYMBOL)`. The balance list
|
||||||
formats each explorer row as it is fetched, without that cross-address check,
|
formats each explorer row as it is fetched, without that cross-address check,
|
||||||
@@ -2064,9 +2065,9 @@ view would leave a wallet one click from deletion.
|
|||||||
`Unknown (could not be decoded)` with no symbol, not the transaction's ETH
|
`Unknown (could not be decoded)` with no symbol, not the transaction's ETH
|
||||||
value. When that swap's `Token In` is `ETH (native)`, the transaction's
|
value. When that swap's `Token In` is `ETH (native)`, the transaction's
|
||||||
ETH value in the network's currency, as for any other transaction
|
ETH value in the network's currency, as for any other transaction
|
||||||
- While "Use Blockscout" is off, TxApproval's line under the amount, when
|
- A line under the amount, worded as on TxApproval. It shows while "Use
|
||||||
the token's name or decimals are missing from the bundled list and the
|
Blockscout" is off and the token's name or decimals are missing from the
|
||||||
tracked tokens
|
bundled list and the tracked tokens.
|
||||||
- To: color dot + full address + etherscan link; for a contract creation,
|
- To: color dot + full address + etherscan link; for a contract creation,
|
||||||
which has no recipient, "This transaction creates a new contract. It has
|
which has no recipient, "This transaction creates a new contract. It has
|
||||||
no recipient." instead
|
no recipient." instead
|
||||||
@@ -2600,10 +2601,10 @@ view would leave a wallet one click from deletion.
|
|||||||
unknown (see Transaction Decoding)
|
unknown (see Transaction Decoding)
|
||||||
- While "Use Blockscout" is off, a line under each token in the decoded
|
- While "Use Blockscout" is off, a line under each token in the decoded
|
||||||
action whose name or decimals are missing from the bundled list and the
|
action whose name or decimals are missing from the bundled list and the
|
||||||
tracked tokens: "This token was not looked up on Blockscout, because "Use
|
tracked tokens: "Blockscout's report of your balances is not used to name
|
||||||
Blockscout" is off in Settings." Blockscout's report of the user's
|
this token, because "Use Blockscout" is off in Settings." Blockscout's
|
||||||
balances gives a token's name and decimals only while the setting is on
|
report of the user's balances gives a token's name and decimals only while
|
||||||
(see Unknown token scale).
|
the setting is on (see Unknown token scale).
|
||||||
- From: color dot + full address + etherscan link
|
- From: color dot + full address + etherscan link
|
||||||
- Contract: color dot + full address + etherscan link, token symbol label if
|
- Contract: color dot + full address + etherscan link, token symbol label if
|
||||||
known; for a contract creation, the same sentence as on WaitTx
|
known; for a contract creation, the same sentence as on WaitTx
|
||||||
|
|||||||
+8
-5
@@ -89,11 +89,14 @@ verify confirmations. The default is a free public RPC endpoint. You can change
|
|||||||
this in Settings to any Ethereum JSON-RPC endpoint, including your own local
|
this in Settings to any Ethereum JSON-RPC endpoint, including your own local
|
||||||
node.
|
node.
|
||||||
|
|
||||||
When it is contacted: on every balance refresh (every 10 seconds while the popup
|
When it is contacted:
|
||||||
is open, every 60 seconds in the background), when you review a send to an ENS
|
|
||||||
name, when a send is prepared and broadcast, while a pending transaction is
|
- on every balance refresh (every 10 seconds while the popup is open, every 60
|
||||||
polled for its receipt, and for the reverse ENS lookups used to label addresses
|
seconds in the background)
|
||||||
(cached for 12 hours).
|
- when you review a send to an ENS name
|
||||||
|
- when a send is prepared and broadcast
|
||||||
|
- while a pending transaction is polled for its receipt
|
||||||
|
- for the reverse ENS lookups used to label addresses (cached for 12 hours)
|
||||||
|
|
||||||
What gets sent: standard Ethereum JSON-RPC requests (balance queries,
|
What gets sent: standard Ethereum JSON-RPC requests (balance queries,
|
||||||
transaction broadcasts, gas estimates, ENS lookups, contract-code checks). Your
|
transaction broadcasts, gas estimates, ENS lookups, contract-code checks). Your
|
||||||
|
|||||||
@@ -330,8 +330,10 @@ function tokenSourcesByChainId(chainId) {
|
|||||||
// decimals are missing from the bundled list and the tracked tokens. Otherwise
|
// decimals are missing from the bundled list and the tracked tokens. Otherwise
|
||||||
// "". The token is a contract address on the network with `chainId`, or on the
|
// "". The token is a contract address on the network with `chainId`, or on the
|
||||||
// active network when none is given. "ETH" and null are no contract, and get
|
// active network when none is given. "ETH" and null are no contract, and get
|
||||||
// "".
|
// "". A token that is not text also gets "": WaitTx and ErrorTx pass a token
|
||||||
|
// restored from storage unchecked.
|
||||||
function tokenLookupOffHtml(token, chainId) {
|
function tokenLookupOffHtml(token, chainId) {
|
||||||
|
if (typeof token !== "string") return "";
|
||||||
if (state.useBlockscout || !token || token === "ETH") return "";
|
if (state.useBlockscout || !token || token === "ETH") return "";
|
||||||
const sources = tokenSourcesByChainId(chainId);
|
const sources = tokenSourcesByChainId(chainId);
|
||||||
if (
|
if (
|
||||||
@@ -341,8 +343,9 @@ function tokenLookupOffHtml(token, chainId) {
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
'<div class="text-xs text-muted">This token was not looked up on' +
|
'<div class="text-xs text-muted">Blockscout\'s report of your balances' +
|
||||||
' Blockscout, because "Use Blockscout" is off in Settings.</div>'
|
' is not used to name this token, because "Use Blockscout" is off in' +
|
||||||
|
" Settings.</div>"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,9 +220,9 @@ function showWait(txInfo, txHash) {
|
|||||||
// init and leaving wait-tx on screen with no back control. A non-numeric
|
// init and leaving wait-tx on screen with no back control. A non-numeric
|
||||||
// broadcastTime leaves an unexitable wait counting "NaNs". txInfo.chainId picks
|
// broadcastTime leaves an unexitable wait counting "NaNs". txInfo.chainId picks
|
||||||
// the node the receipt is asked of and the explorer the links open, so it has
|
// the node the receipt is asked of and the explorer the links open, so it has
|
||||||
// to name a network. txInfo.token and txInfo.tokenSymbol are deliberately
|
// to name a network. txInfo.token and txInfo.tokenSymbol are not checked here.
|
||||||
// unchecked: they are compared and coalesced rather than dereferenced, and
|
// tokenLookupOffHtml() shows no line for a token that is not text. Everything
|
||||||
// tokenSymbol is null for ETH.
|
// else only compares and coalesces them, and tokenSymbol is null for ETH.
|
||||||
function restoreWait() {
|
function restoreWait() {
|
||||||
const d = state.viewData;
|
const d = state.viewData;
|
||||||
if (!d || !d.pendingWait) return false;
|
if (!d || !d.pendingWait) return false;
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
// While "Use Blockscout" is off, the approval screens and the screens after
|
// While "Use Blockscout" is off, the approval screens and the screens after
|
||||||
// TxApproval name a token, and scale its amount, from the bundled list and the
|
// TxApproval name a token, and scale its amount, from the bundled list and the
|
||||||
// tracked tokens alone (https://git.eeqj.de/sneak/AutistMask/issues/668). A
|
// tracked tokens alone (https://git.eeqj.de/sneak/AutistMask/issues/668). A
|
||||||
// token they lack gets a line saying it was not looked up on Blockscout. While
|
// token they lack gets a line saying Blockscout's report of the user's balances
|
||||||
// the setting is on, what Blockscout reported for a token the user holds names
|
// is not used to name it. While the setting is on, what Blockscout reported for
|
||||||
// and scales it, as before.
|
// a token the user holds names and scales it, as before.
|
||||||
//
|
//
|
||||||
// Booted through the real popup entry point, as the approval window or as a
|
// Booted through the real popup entry point, as the approval window or as a
|
||||||
// popup reopened onto SuccessTx. The vault is mocked so that no password has to
|
// popup reopened onto SuccessTx, WaitTx or ErrorTx. The vault is mocked so that
|
||||||
// be hashed: the stored secret decrypts to the test key below.
|
// no password has to be hashed: the stored secret decrypts to the test key
|
||||||
|
// below.
|
||||||
|
|
||||||
jest.mock("../src/shared/vault", () => ({
|
jest.mock("../src/shared/vault", () => ({
|
||||||
decryptWithPassword: jest.fn(),
|
decryptWithPassword: jest.fn(),
|
||||||
@@ -34,7 +35,7 @@ const TOKEN = "0xE2E0000000000000000000000000000000000E2e";
|
|||||||
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
const USDC = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
|
||||||
|
|
||||||
const LINE =
|
const LINE =
|
||||||
'This token was not looked up on Blockscout, because "Use Blockscout" is off in Settings.';
|
'Blockscout\'s report of your balances is not used to name this token, because "Use Blockscout" is off in Settings.';
|
||||||
|
|
||||||
// TOKEN as Blockscout reports the user's holding of it.
|
// TOKEN as Blockscout reports the user's holding of it.
|
||||||
const TOKEN_ROW = {
|
const TOKEN_ROW = {
|
||||||
@@ -154,7 +155,7 @@ afterEach(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("TxApproval", () => {
|
describe("TxApproval", () => {
|
||||||
test("says a token it cannot name was not looked up on Blockscout while Use Blockscout is off", async () => {
|
test("has the line under a token it cannot name while Use Blockscout is off", async () => {
|
||||||
const page = await bootApproval(profile(false, []));
|
const page = await bootApproval(profile(false, []));
|
||||||
const details = page.node("approve-tx-decoded-details").innerHTML;
|
const details = page.node("approve-tx-decoded-details").innerHTML;
|
||||||
expect(details).toContain("Unknown token");
|
expect(details).toContain("Unknown token");
|
||||||
@@ -243,6 +244,50 @@ test("SuccessTx says so under the decoded token while Use Blockscout is off", as
|
|||||||
expect(decoded).toContain(LINE);
|
expect(decoded).toContain(LINE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test.each([
|
||||||
|
[
|
||||||
|
"wait-tx",
|
||||||
|
{
|
||||||
|
pendingWait: {
|
||||||
|
hash: TX_HASH,
|
||||||
|
txInfo: {
|
||||||
|
to: RECIPIENT,
|
||||||
|
amount: "1",
|
||||||
|
token: 42,
|
||||||
|
chainId: "0x1",
|
||||||
|
},
|
||||||
|
broadcastTime: Date.now(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"error-tx",
|
||||||
|
{
|
||||||
|
amount: "1",
|
||||||
|
symbol: "?",
|
||||||
|
token: 42,
|
||||||
|
to: RECIPIENT,
|
||||||
|
hash: TX_HASH,
|
||||||
|
message: "The transaction failed.",
|
||||||
|
chainId: "0x1",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
])(
|
||||||
|
"a popup reopened onto %s shows no line for a stored token that is not text",
|
||||||
|
async (view, viewData) => {
|
||||||
|
const page = await bootPopup(
|
||||||
|
profile(false, [], {
|
||||||
|
currentView: view,
|
||||||
|
viewStack: ["main"],
|
||||||
|
viewData,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
expect(page.pageErrors).toEqual([]);
|
||||||
|
expect(page.visibleViews()).toEqual([view]);
|
||||||
|
expect(page.node(view + "-token-note").innerHTML).toBe("");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
test("SignApproval says so under a permit's token while Use Blockscout is off", async () => {
|
test("SignApproval says so under a permit's token while Use Blockscout is off", async () => {
|
||||||
const signParams = {
|
const signParams = {
|
||||||
method: "eth_signTypedData_v4",
|
method: "eth_signTypedData_v4",
|
||||||
|
|||||||
Reference in new issue
Block a user