mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-04 20:05:50 +00:00
Merge pull request #1612 from XRPLF/Fix_getAccount_in_Quickstart
Fix getAccount in Quickstart
This commit is contained in:
Binary file not shown.
@@ -400,7 +400,7 @@ Update the form with fields and buttons to support the new functions.
|
|||||||
Choose your ledger instance:
|
Choose your ledger instance:
|
||||||
|
|
||||||
<input type="radio" id="tn" name="server"
|
<input type="radio" id="tn" name="server"
|
||||||
value="wss://s.altnet.rippletest.net:51233">
|
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||||
<label for="testnet">Testnet</label>
|
<label for="testnet">Testnet</label>
|
||||||
|
|
||||||
<input type="radio" id="dn" name="server"
|
<input type="radio" id="dn" name="server"
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ For this form:
|
|||||||
Choose your ledger instance:
|
Choose your ledger instance:
|
||||||
|
|
||||||
<input type="radio" id="tn" name="server"
|
<input type="radio" id="tn" name="server"
|
||||||
value="wss://s.altnet.rippletest.net:51233">
|
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||||
<label for="testnet">Testnet</label>
|
<label for="testnet">Testnet</label>
|
||||||
|
|
||||||
<input type="radio" id="dn" name="server"
|
<input type="radio" id="dn" name="server"
|
||||||
|
|||||||
@@ -627,7 +627,7 @@ Revise the HTML form to add a new Broker section at the top.
|
|||||||
Choose your ledger instance:
|
Choose your ledger instance:
|
||||||
|
|
||||||
<input type="radio" id="tn" name="server"
|
<input type="radio" id="tn" name="server"
|
||||||
value="wss://s.altnet.rippletest.net:51233">
|
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||||
<label for="testnet">Testnet</label>
|
<label for="testnet">Testnet</label>
|
||||||
|
|
||||||
<input type="radio" id="dn" name="server"
|
<input type="radio" id="dn" name="server"
|
||||||
@@ -699,7 +699,7 @@ Revise the HTML form to add a new Broker section at the top.
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="brokerAmountField" size="40" value="100"></input>
|
<input type="text" id="brokerAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -784,7 +784,7 @@ Revise the HTML form to add a new Broker section at the top.
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
<input type="text" id="standbyAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -968,7 +968,7 @@ Revise the HTML form to add a new Broker section at the top.
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
<input type="text" id="operationalAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ This example can be used with any XRP Ledger network, _Testnet_, or _Devnet_. Yo
|
|||||||
### getNet()
|
### getNet()
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
// ******************************************************
|
// ******************************************************
|
||||||
// ************* Get the Preferred Network **************
|
// ************* Get the Preferred Network **************
|
||||||
// ******************************************************
|
// ******************************************************
|
||||||
@@ -92,7 +92,7 @@ This example can be used with any XRP Ledger network, _Testnet_, or _Devnet_. Yo
|
|||||||
This function uses brute force `if` statements to discover the selected network instance and return the URI.
|
This function uses brute force `if` statements to discover the selected network instance and return the URI.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
let net
|
let net
|
||||||
if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
|
if (document.getElementById("tn").checked) net = "wss://s.altnet.rippletest.net:51233"
|
||||||
if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
|
if (document.getElementById("dn").checked) net = "wss://s.devnet.rippletest.net:51233"
|
||||||
@@ -105,7 +105,7 @@ This function uses brute force `if` statements to discover the selected network
|
|||||||
### getAccount(type)
|
### getAccount(type)
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
// ************* Get Account *****************************
|
// ************* Get Account *****************************
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
@@ -118,7 +118,7 @@ This function uses brute force `if` statements to discover the selected network
|
|||||||
Get the selected ledger.
|
Get the selected ledger.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
let net = getNet()
|
let net = getNet()
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -126,7 +126,7 @@ Get the selected ledger.
|
|||||||
Instantiate a client.
|
Instantiate a client.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
const client = new xrpl.Client(net)
|
const client = new xrpl.Client(net)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -134,16 +134,21 @@ Instantiate a client.
|
|||||||
Use the _results_ variable to capture progress information.
|
Use the _results_ variable to capture progress information.
|
||||||
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
results = 'Connecting to ' + net + '....'
|
||||||
```
|
```
|
||||||
results = 'Connecting to ' + getNet() + '....'
|
|
||||||
const walletServer = net
|
Use the default faucet using a _null_ value.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
let faucetHost = null
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Report progress in the appropriate results field.
|
Report progress in the appropriate results field.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
if (type == 'standby') {
|
if (type == 'standby') {
|
||||||
document.getElementById('standbyResultField').value = results
|
document.getElementById('standbyResultField').value = results
|
||||||
} else {
|
} else {
|
||||||
@@ -155,7 +160,7 @@ Report progress in the appropriate results field.
|
|||||||
Connect to the server.
|
Connect to the server.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
await client.connect()
|
await client.connect()
|
||||||
|
|
||||||
|
|
||||||
@@ -171,7 +176,7 @@ Connect to the server.
|
|||||||
Create and fund a test account wallet.
|
Create and fund a test account wallet.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
const my_wallet = (await client.fundWallet(null, { faucetHost: walletServer})).wallet
|
const my_wallet = (await client.fundWallet(null, { faucetHost: walletServer})).wallet
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -179,9 +184,8 @@ Create and fund a test account wallet.
|
|||||||
Get the current XRP balance for the account.
|
Get the current XRP balance for the account.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
const my_balance = (await client.getXrpBalance(my_wallet.address))
|
const my_balance = (await client.getXrpBalance(my_wallet.address))
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -189,9 +193,7 @@ Get the current XRP balance for the account.
|
|||||||
If this is a standby account, populate the standby account fields.
|
If this is a standby account, populate the standby account fields.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
|
|
||||||
|
|
||||||
if (type == 'standby') {
|
if (type == 'standby') {
|
||||||
document.getElementById('standbyAccountField').value = my_wallet.address
|
document.getElementById('standbyAccountField').value = my_wallet.address
|
||||||
document.getElementById('standbyPubKeyField').value = my_wallet.publicKey
|
document.getElementById('standbyPubKeyField').value = my_wallet.publicKey
|
||||||
@@ -207,7 +209,7 @@ If this is a standby account, populate the standby account fields.
|
|||||||
Otherwise, populate the operational account fields.
|
Otherwise, populate the operational account fields.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('operationalAccountField').value = my_wallet.address
|
document.getElementById('operationalAccountField').value = my_wallet.address
|
||||||
document.getElementById('operationalPubKeyField').value = my_wallet.publicKey
|
document.getElementById('operationalPubKeyField').value = my_wallet.publicKey
|
||||||
@@ -224,7 +226,7 @@ Otherwise, populate the operational account fields.
|
|||||||
Insert the seed values for both accounts as they are created to the **Seeds** field as a convenience. You can copy the values and store them offline. When you reload this form or another in this tutorial, copy and paste them into the **Seeds** field to retrieve the accounts with the `getAccountsFromSeeds()` function.
|
Insert the seed values for both accounts as they are created to the **Seeds** field as a convenience. You can copy the values and store them offline. When you reload this form or another in this tutorial, copy and paste them into the **Seeds** field to retrieve the accounts with the `getAccountsFromSeeds()` function.
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
document.getElementById('seeds').value = standbySeedField.value + '\n' + operationalSeedField.value
|
document.getElementById('seeds').value = standbySeedField.value + '\n' + operationalSeedField.value
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -242,7 +244,7 @@ Disconnect from the XRP ledger.
|
|||||||
### Get Accounts from Seeds
|
### Get Accounts from Seeds
|
||||||
|
|
||||||
|
|
||||||
```
|
```javascript
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
// ********** Get Accounts from Seeds ********************
|
// ********** Get Accounts from Seeds ********************
|
||||||
// *******************************************************
|
// *******************************************************
|
||||||
@@ -512,10 +514,18 @@ For each of the transactions, there is an accompanying reciprocal transaction, w
|
|||||||
Create a standard HTML form to send transactions and requests, then display the results.
|
Create a standard HTML form to send transactions and requests, then display the results.
|
||||||
|
|
||||||
|
|
||||||
```
|
```html
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Token Test Harness</title>
|
<title>Token Test Harness</title>
|
||||||
|
<link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
|
||||||
|
<style>
|
||||||
|
body{font-family: "Work Sans", sans-serif;padding: 20px;background: #fafafa;}
|
||||||
|
h1{font-weight: bold;}
|
||||||
|
input, button {padding: 6px;margin-bottom: 8px;}
|
||||||
|
button{font-weight: bold;font-family: "Work Sans", sans-serif;}
|
||||||
|
td{vertical-align: middle;}
|
||||||
|
</style>
|
||||||
<script src='https://unpkg.com/xrpl@2.2.3'></script>
|
<script src='https://unpkg.com/xrpl@2.2.3'></script>
|
||||||
<script src='ripplex1-send-xrp.js'></script>
|
<script src='ripplex1-send-xrp.js'></script>
|
||||||
<script>
|
<script>
|
||||||
@@ -536,7 +546,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
|||||||
Choose your ledger instance:
|
Choose your ledger instance:
|
||||||
|
|
||||||
<input type="radio" id="tn" name="server"
|
<input type="radio" id="tn" name="server"
|
||||||
value="wss://s.altnet.rippletest.net:51233">
|
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||||
<label for="testnet">Testnet</label>
|
<label for="testnet">Testnet</label>
|
||||||
|
|
||||||
<input type="radio" id="dn" name="server"
|
<input type="radio" id="dn" name="server"
|
||||||
@@ -606,7 +616,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
<input type="text" id="standbyAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -615,7 +625,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
|||||||
Destination
|
Destination
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="standbyDestinationField" size="40" value="100"></input>
|
<input type="text" id="standbyDestinationField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -701,7 +711,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
<input type="text" id="operationalAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -710,7 +720,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
|||||||
Destination
|
Destination
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="operationalDestinationField" size="40" value="100"></input>
|
<input type="text" id="operationalDestinationField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -650,7 +650,7 @@ Update the form to support the new functions.
|
|||||||
Choose your ledger instance:
|
Choose your ledger instance:
|
||||||
|
|
||||||
<input type="radio" id="tn" name="server"
|
<input type="radio" id="tn" name="server"
|
||||||
value="wss://s.altnet.rippletest.net:51233">
|
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||||
<label for="testnet">Testnet</label>
|
<label for="testnet">Testnet</label>
|
||||||
|
|
||||||
<input type="radio" id="dn" name="server"
|
<input type="radio" id="dn" name="server"
|
||||||
@@ -720,7 +720,7 @@ Update the form to support the new functions.
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
<input type="text" id="standbyAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -729,7 +729,7 @@ Update the form to support the new functions.
|
|||||||
Destination
|
Destination
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="standbyDestinationField" size="40" value="100"></input>
|
<input type="text" id="standbyDestinationField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -843,7 +843,7 @@ Update the form to support the new functions.
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
<input type="text" id="operationalAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -482,9 +482,9 @@ Bold text in the following indicates changes to the form that support the new fu
|
|||||||
<body>
|
<body>
|
||||||
<h1>Token Test Harness</h1>
|
<h1>Token Test Harness</h1>
|
||||||
<form id="theForm">
|
<form id="theForm">
|
||||||
Choose your ledger instance:
|
Choose your ledger instance:
|
||||||
<input type="radio" id="tn" name="server"
|
<input type="radio" id="tn" name="server"
|
||||||
value="wss://s.altnet.rippletest.net:51233">
|
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||||
<label for="testnet">Testnet</label>
|
<label for="testnet">Testnet</label>
|
||||||
|
|
||||||
<input type="radio" id="dn" name="server"
|
<input type="radio" id="dn" name="server"
|
||||||
@@ -554,7 +554,7 @@ Bold text in the following indicates changes to the form that support the new fu
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
<input type="text" id="standbyAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -706,7 +706,7 @@ Bold text in the following indicates changes to the form that support the new fu
|
|||||||
Amount
|
Amount
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
<input type="text" id="operationalAmountField" size="40"></input>
|
||||||
<br>
|
<br>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -1192,7 +1192,7 @@ Update the form with fields and buttons to support the new functions.
|
|||||||
Choose your ledger instance:
|
Choose your ledger instance:
|
||||||
|
|
||||||
<input type="radio" id="tn" name="server"
|
<input type="radio" id="tn" name="server"
|
||||||
value="wss://s.altnet.rippletest.net:51233">
|
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||||
<label for="testnet">Testnet</label>
|
<label for="testnet">Testnet</label>
|
||||||
|
|
||||||
<input type="radio" id="dn" name="server"
|
<input type="radio" id="dn" name="server"
|
||||||
|
|||||||
Reference in New Issue
Block a user