Restructured Step 2 - 7 to "code along" style

This commit is contained in:
AlexanderBuzz
2023-07-05 10:44:15 +02:00
parent bad6ce54ba
commit b46e8a6ada
9 changed files with 761 additions and 270 deletions

View File

@@ -47,6 +47,14 @@ const main = async () => {
appWindow.webContents.send('update-ledger-data', ledger)
})
// Initial Ledger Request -> Get account details on startup
// Reference: https://xrpl.org/ledger.html
const ledgerResponse = await client.request({
"command": "ledger"
})
const initialLedgerData = prepareLedgerData(ledgerResponse.result.closed.ledger)
appWindow.webContents.send('update-ledger-data', initialLedgerData)
// Reference: https://xrpl.org/subscribe.html#transaction-streams
client.on("transaction", async (transaction) => {
// Reference: https://xrpl.org/account_info.html
@@ -67,8 +75,8 @@ const main = async () => {
"account": address,
"ledger_index": "current"
})
const accountData = prepareAccountData(accountInfoResponse.result.account_data)
appWindow.webContents.send('update-account-data', accountData)
const initialAccountData = prepareAccountData(accountInfoResponse.result.account_data)
appWindow.webContents.send('update-account-data', initialAccountData)
})
}