mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-04 11:55: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:
|
||||
|
||||
<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>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
|
||||
@@ -362,7 +362,7 @@ For this form:
|
||||
Choose your ledger instance:
|
||||
|
||||
<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>
|
||||
|
||||
<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:
|
||||
|
||||
<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>
|
||||
|
||||
<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
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="brokerAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="brokerAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -784,7 +784,7 @@ Revise the HTML form to add a new Broker section at the top.
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -968,7 +968,7 @@ Revise the HTML form to add a new Broker section at the top.
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -80,7 +80,7 @@ This example can be used with any XRP Ledger network, _Testnet_, or _Devnet_. Yo
|
||||
### getNet()
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
// ******************************************************
|
||||
// ************* 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.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
let net
|
||||
if (document.getElementById("tn").checked) net = "wss://s.altnet.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)
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
// *******************************************************
|
||||
// ************* Get Account *****************************
|
||||
// *******************************************************
|
||||
@@ -118,7 +118,7 @@ This function uses brute force `if` statements to discover the selected network
|
||||
Get the selected ledger.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
let net = getNet()
|
||||
```
|
||||
|
||||
@@ -126,7 +126,7 @@ Get the selected ledger.
|
||||
Instantiate a client.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
const client = new xrpl.Client(net)
|
||||
```
|
||||
|
||||
@@ -134,16 +134,21 @@ Instantiate a client.
|
||||
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.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
if (type == 'standby') {
|
||||
document.getElementById('standbyResultField').value = results
|
||||
} else {
|
||||
@@ -155,7 +160,7 @@ Report progress in the appropriate results field.
|
||||
Connect to the server.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
await client.connect()
|
||||
|
||||
|
||||
@@ -171,7 +176,7 @@ Connect to the server.
|
||||
Create and fund a test account wallet.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
const my_wallet = (await client.fundWallet(null, { faucetHost: walletServer})).wallet
|
||||
```
|
||||
|
||||
@@ -179,19 +184,16 @@ Create and fund a test account wallet.
|
||||
Get the current XRP balance for the account.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
const my_balance = (await client.getXrpBalance(my_wallet.address))
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
If this is a standby account, populate the standby account fields.
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
```javascript
|
||||
if (type == 'standby') {
|
||||
document.getElementById('standbyAccountField').value = my_wallet.address
|
||||
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.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
} else {
|
||||
document.getElementById('operationalAccountField').value = my_wallet.address
|
||||
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.
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
document.getElementById('seeds').value = standbySeedField.value + '\n' + operationalSeedField.value
|
||||
```
|
||||
|
||||
@@ -242,7 +244,7 @@ Disconnect from the XRP ledger.
|
||||
### Get Accounts from Seeds
|
||||
|
||||
|
||||
```
|
||||
```javascript
|
||||
// *******************************************************
|
||||
// ********** 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.
|
||||
|
||||
|
||||
```
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<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='ripplex1-send-xrp.js'></script>
|
||||
<script>
|
||||
@@ -536,7 +546,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
||||
Choose your ledger instance:
|
||||
|
||||
<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>
|
||||
|
||||
<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
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -615,7 +625,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyDestinationField" size="40" value="100"></input>
|
||||
<input type="text" id="standbyDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -701,7 +711,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -710,7 +720,7 @@ Create a standard HTML form to send transactions and requests, then display the
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalDestinationField" size="40" value="100"></input>
|
||||
<input type="text" id="operationalDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -650,7 +650,7 @@ Update the form to support the new functions.
|
||||
Choose your ledger instance:
|
||||
|
||||
<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>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
@@ -720,7 +720,7 @@ Update the form to support the new functions.
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -729,7 +729,7 @@ Update the form to support the new functions.
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyDestinationField" size="40" value="100"></input>
|
||||
<input type="text" id="standbyDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -843,7 +843,7 @@ Update the form to support the new functions.
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -482,9 +482,9 @@ Bold text in the following indicates changes to the form that support the new fu
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
Choose your ledger instance:
|
||||
<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>
|
||||
|
||||
<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
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -706,7 +706,7 @@ Bold text in the following indicates changes to the form that support the new fu
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40" value="100"></input>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1192,7 +1192,7 @@ Update the form with fields and buttons to support the new functions.
|
||||
Choose your ledger instance:
|
||||
|
||||
<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>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
|
||||
Reference in New Issue
Block a user