mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 19:55:54 +00:00
Freeze tutorials: fixes and cleanup
- Move JS code samples to JS folder (future-proofing for other languages) - Make "Freeze a Trust Line" tutorial interactive - Add necessary functionality to interactive_tutorial helper JS - Rework freeze a trust line tutorial/code sample to make an incoming line from another address and make looking up trust lines a full-fledged step
This commit is contained in:
@@ -255,6 +255,7 @@ function get_wallet(event) {
|
||||
const block = $(event.target).closest(".interactive-block")
|
||||
if (!block.length) {return}
|
||||
show_error(block, tl("Can't use the example secret here. Check that the previous steps were completed successfully."))
|
||||
return
|
||||
}
|
||||
return xrpl.Wallet.fromSeed(secret)
|
||||
}
|
||||
@@ -285,6 +286,16 @@ async function call_faucet(faucet_url, destination) {
|
||||
return data
|
||||
}
|
||||
|
||||
/**
|
||||
* Tutorials' scripts should push functions to this array to have them run
|
||||
* automatically after connecting to the network. The scopes don't work out
|
||||
* right to use api.on("connect", callback) directly from the tutorials' unique
|
||||
* scripts because the api instance (specific to the network) is instantiated
|
||||
* by the setup_connect_step() in this file, below.
|
||||
*/
|
||||
window.after_connect = window.after_connect || [];
|
||||
|
||||
|
||||
/**
|
||||
* To be used with _snippets/interactive-tutorials/connect-step.md
|
||||
* Adds an event to the "Connect" button to connect to the appropriate
|
||||
@@ -322,10 +333,14 @@ function setup_connect_step() {
|
||||
|
||||
disable_followup_steps()
|
||||
})
|
||||
$("#connect-button").click(() => {
|
||||
$("#connect-button").click(async (event) => {
|
||||
$("#connection-status").text( tl("Connecting...") )
|
||||
$("#loader-connect").show()
|
||||
api.connect()
|
||||
await api.connect()
|
||||
|
||||
for (const fn of after_connect) {
|
||||
fn()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user