mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-24 05:35:51 +00:00
71 lines
2.6 KiB
Markdown
71 lines
2.6 KiB
Markdown
{{ start_step("Generate") }}
|
|
<button id="generate-creds-button" class="btn btn-primary">Generate credentials</button>
|
|
<div id='loader-0' style="display: none;"><img class='throbber' src="assets/img/xrp-loader-96.png"> Generating Keys...</div>
|
|
<div id='address'></div>
|
|
<div id='secret'></div>
|
|
<div id='balance'></div>
|
|
<div id="populate-creds-status"></div>
|
|
{{ end_step() }}
|
|
<script type="application/javascript">
|
|
$(document).ready( () => {
|
|
|
|
$("#generate-creds-button").click( () => {
|
|
// Wipe existing results
|
|
$("#address").html("")
|
|
$("#secret").html("")
|
|
$("#balance").html("")
|
|
$("#populate-creds-status").html("")
|
|
|
|
$("#loader-0").show()
|
|
|
|
$.ajax({
|
|
url: "https://faucet.altnet.rippletest.net/accounts",
|
|
type: 'POST',
|
|
dataType: 'json',
|
|
success: function(data) {
|
|
$("#loader-0").hide()
|
|
$("#address").hide().html("<strong>Address:</strong> " +
|
|
'<span id="test-net-faucet-address">' +
|
|
data.account.address
|
|
+ "</span>").show()
|
|
$("#secret").hide().html('<strong>Secret:</strong> ' +
|
|
'<span id="test-net-faucet-secret">' +
|
|
data.account.secret +
|
|
"</span>").show()
|
|
$("#balance").hide().html('<strong>Balance:</strong> ' +
|
|
Number(data.balance).toLocaleString('en') +
|
|
' XRP').show()
|
|
|
|
// Automatically populate examples with these credentials...
|
|
// Set sender address
|
|
$("code span:contains('"+EXAMPLE_ADDR+"')").each( function() {
|
|
let eltext = $(this).text()
|
|
$(this).text( eltext.replace(EXAMPLE_ADDR, data.account.address) )
|
|
})
|
|
|
|
// Set sender secret
|
|
$("code span:contains('"+EXAMPLE_SECRET+"')").each( function() {
|
|
let eltext = $(this).text()
|
|
$(this).text( eltext.replace(EXAMPLE_SECRET, data.account.secret) )
|
|
})
|
|
|
|
$("#populate-creds-status").text("Populated this page's examples with these credentials.")
|
|
|
|
complete_step("Generate")
|
|
|
|
},
|
|
error: function() {
|
|
$("#loader-0").hide();
|
|
alert("There was an error with the Testnet. Please try again.");
|
|
}
|
|
})
|
|
})
|
|
|
|
const EXAMPLE_ADDR = "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe"
|
|
const EXAMPLE_SECRET = "s████████████████████████████"
|
|
|
|
})
|
|
</script>
|
|
|
|
**Caution:** Ripple provides the [XRP Ledger Testnet](parallel-networks.html) for testing purposes only, and regularly resets the state of the test net along with all balances. As a precaution, Ripple recommends **not** using the same addresses on Testnet and Mainnet.
|