Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
should fetch gas price now
Browse files Browse the repository at this point in the history
  • Loading branch information
fredo committed May 13, 2020
1 parent dc2077a commit f9405a8
Showing 1 changed file with 37 additions and 33 deletions.
70 changes: 37 additions & 33 deletions resources/templates/account.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ <h2>Fund your Raiden Account with ETH</h2>
</div>

<div class="info-panel">
<div>You need to download the Raiden Account<br>
<div>
You need to download the Raiden Account<br />
<a
id="keystore"
href="{{ reverse_url('keystore', configuration_file.file_name, keystore) }}"
Expand Down Expand Up @@ -130,7 +131,7 @@ <h2>Fund your Raiden Account with ETH</h2>
let gasPrice;

try {
const gasPrice = await getGasPrice(
gasPrice = await getGasPrice(
"{{ reverse_url('gas_price', configuration_file.file_name) }}"
);
} catch {
Expand Down Expand Up @@ -183,39 +184,42 @@ <h2>Fund your Raiden Account with ETH</h2>
}
}

function sendEthButtonlogic(balance) {
const has_web3 = checkWeb3Available(balance);
if (!has_web3) {
return;
}
if (hasEnoughEthToStartSwaps(balance)) {
let button_send_eth = document.getElementById("btn-web3-eth");
button_send_eth.disabled = true;
const action = document.querySelector('.action');
action.classList.add('tx-received');
setTimeout(function() {
window.location.href = "{{ reverse_url('swap', configuration_file.file_name, 'RDN') }}";
}, 2000);
} else {
updateNeededEth(balance);
}
}

async function poll() {
let balance = await getBalances("{{ reverse_url('api-configuration-detail', configuration_file.file_name) }}");
if (balance.ETH.as_wei) {
sendEthButtonlogic(balance);
} else {
let keystore_button = document.getElementById("keystore");
keystore_button.onclick = function() {
function sendEthButtonlogic(balance) {
const has_web3 = checkWeb3Available(balance);
if (!has_web3) {
return;
}
if (hasEnoughEthToStartSwaps(balance)) {
let button_send_eth = document.getElementById("btn-web3-eth");
button_send_eth.disabled = true;
const action = document.querySelector(".action");
action.classList.add("tx-received");
setTimeout(function () {
window.location.href =
"{{ reverse_url('swap', configuration_file.file_name, 'RDN') }}";
}, 2000);
} else {
updateNeededEth(balance);
}
}

async function poll() {
let balance = await getBalances(
"{{ reverse_url('api-configuration-detail', configuration_file.file_name) }}"
);
if (balance.ETH.as_wei) {
sendEthButtonlogic(balance);
}
}
}
} else {
let keystore_button = document.getElementById("keystore");
keystore_button.onclick = function () {
sendEthButtonlogic(balance);
};
}
}

function main() {
poll();
}
function main() {
poll();
}

window.addEventListener("load", function () {
window.MAIN_VIEW_INTERVAL = 10000;
Expand Down

0 comments on commit f9405a8

Please sign in to comment.