fix: transaction screens name a token from the tokens of the transaction's network (closes #629)
decodeCalldata() looked a token's symbol and decimals up in the active network's tracked tokens and balances, whatever chain id it was given, so TransactionDetail and TxApproval showed a token tracked on another network by address only, with its amount in base units. The lookup now uses what the wallet knows of the tokens on the transaction's network: the active network's tracked tokens and balances, or for another network the tokens tracked on it and no balances. TxApproval's token labels, the symbol it hands the wait, success and error screens, and SuccessTx's decoded token label use the same lookup. Model: opus-5-5
This commit was merged in pull request #630.
This commit is contained in:
@@ -150,6 +150,8 @@ beforeEach(() => {
|
||||
state.rpcUrl = NETWORKS.mainnet.defaultRpcUrl;
|
||||
state.networkEndpoints = {};
|
||||
state.wallets = [];
|
||||
state.trackedTokens = [];
|
||||
state.networkTrackedTokens = {};
|
||||
state.viewData = {};
|
||||
state.viewStack = [];
|
||||
state.currentView = null;
|
||||
@@ -627,6 +629,31 @@ describe("SuccessTx and ErrorTx for a Sepolia transaction with mainnet active",
|
||||
expectSepoliaLinks();
|
||||
});
|
||||
|
||||
// https://git.eeqj.de/sneak/AutistMask/issues/629
|
||||
test("SuccessTx's decoded action names the token from the tokens tracked on Sepolia", async () => {
|
||||
function expectTokenNamed() {
|
||||
expect(getElement("success-tx-decoded").innerHTML).toContain(
|
||||
'<div class="font-bold">TDOL</div>',
|
||||
);
|
||||
}
|
||||
state.networkTrackedTokens = {
|
||||
sepolia: [{ address: TOKEN, symbol: "TDOL", decimals: 6 }],
|
||||
};
|
||||
const decoded = {
|
||||
name: "Transfer",
|
||||
details: [{ label: "Token", address: TOKEN, isToken: true }],
|
||||
};
|
||||
mockReceiptLookup.mockResolvedValue({ blockNumber: 21000000 });
|
||||
txStatus.showWait({ ...sepoliaTx, decoded }, TX_HASH);
|
||||
await jest.advanceTimersByTimeAsync(10000);
|
||||
expect(state.currentView).toBe("success-tx");
|
||||
expectTokenNamed();
|
||||
|
||||
elements.clear();
|
||||
txStatus.renderSuccess();
|
||||
expectTokenNamed();
|
||||
});
|
||||
|
||||
test("the recipient and hash on ErrorTx link to the Sepolia explorer", () => {
|
||||
function expectSepoliaLinks() {
|
||||
expect(getElement("error-tx-to").innerHTML).toContain(
|
||||
|
||||
Reference in New Issue
Block a user