Fix from address not showing when Send clicked from main view
check / check (push) Has been cancelled
check / check (push) Has been cancelled
Move renderSendTokenSelect to send.js so both the main view and address detail view call it before navigating to send. Without it, the token dropdown was stale and updateSendBalance had no context.
This commit is contained in:
1 parent
4ea5eeabda
commit
2d328c7389
3 files changed
+15
-14
No files matched your search
+12
-1
@@ -4,6 +4,17 @@ const { $, showFlash, formatAddressHtml } = require("./helpers");
|
||||
const { state, currentAddress } = require("../../shared/state");
|
||||
const { getProvider } = require("../../shared/balances");
|
||||
|
||||
function renderSendTokenSelect(addr) {
|
||||
const sel = $("send-token");
|
||||
sel.innerHTML = '<option value="ETH">ETH</option>';
|
||||
for (const t of addr.tokenBalances || []) {
|
||||
const opt = document.createElement("option");
|
||||
opt.value = t.address;
|
||||
opt.textContent = t.symbol;
|
||||
sel.appendChild(opt);
|
||||
}
|
||||
}
|
||||
|
||||
function updateSendBalance() {
|
||||
const addr = currentAddress();
|
||||
if (!addr) return;
|
||||
@@ -77,4 +88,4 @@ function init(ctx) {
|
||||
$("btn-send-back").addEventListener("click", ctx.showAddressDetail);
|
||||
}
|
||||
|
||||
module.exports = { init, updateSendBalance };
|
||||
module.exports = { init, updateSendBalance, renderSendTokenSelect };
|
||||
Reference in new issue
Block a user