Update ripple-lib samples to 1.10.0

- Removes lodash dependecy for web version
- Uses the new generateFaucetWallet() API method
- Make 'issue a token' code capable of running in-browser or in Node.js
  without modification
This commit is contained in:
mDuo13
2021-08-24 14:38:07 -07:00
parent cff0fcc716
commit d6e06ae140
18 changed files with 52 additions and 89 deletions

View File

@@ -256,22 +256,20 @@ See [Reliable Transaction Submission](reliable-transaction-submission.html) for
# RippleAPI in Web Browsers
RippleAPI can also be used in a web browser. To access it, load [Lodash](https://lodash.com/) and [RippleAPI for JavaScript (ripple-lib)](rippleapi-reference.html) in your site's HTML. For example:
RippleAPI can also be used in a web browser. To access it, load [RippleAPI for JavaScript (ripple-lib)](rippleapi-reference.html) in your site's HTML. For example:
<!-- MULTICODE_BLOCK_START -->
_unpkg_
```html
<script src="https://unpkg.com/lodash@4.17.20/lodash.min.js"></script>
<script src="https://unpkg.com/ripple-lib@1.9.1/build/ripple-latest-min.js"></script>
<script src="https://unpkg.com/ripple-lib@1.10.0/build/ripple-latest-min.js"></script>
```
_jsDelivr_
```html
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ripple-lib@1.9.1/build/ripple-latest-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ripple-lib@1.10.0/build/ripple-latest-min.js"></script>
```
<!-- MULTICODE_BLOCK_END -->

View File

@@ -16,7 +16,6 @@ The following example gets the latest [ledger version](ledgers.html) and a list
**Tip:** If you can, open your browser's Developer Tools by pressing **F12**. The "Console" tab provides a native JavaScript console and can give insight into what code is running on any webpage. <!-- SPELLING_IGNORE: f12 -->
<!-- ripple-lib & prerequisites -->
{{currentpage.lodash_tag}}
{{currentpage.ripple_lib_tag}}
<!-- JS_EDITOR_START step2 -->
@@ -101,14 +100,12 @@ Try editing the code above to do something different:
## Setup Steps
This page has the necessary prerequisites already loaded, but you can access the XRP Ledger from **any webpage** if you load [Lodash](https://lodash.com/) and [RippleAPI for JavaScript (ripple-lib)](rippleapi-reference.html) in that page's HTML. For example:
This page has the necessary prerequisites already loaded, but you can access the XRP Ledger from **any webpage** if you load [RippleAPI for JavaScript (ripple-lib)](rippleapi-reference.html) in that page's HTML. For example:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js"></script>
<script src="https://unpkg.com/ripple-lib@1.9.1/build/ripple-latest-min.js"></script>
<script src="https://unpkg.com/ripple-lib@1.10.0/build/ripple-latest-min.js"></script>
```
<!-- SPELLING_IGNORE: lodash -->
## Further Reading

View File

@@ -76,7 +76,7 @@ const socket = new WebSocket('ws://localhost:6006')
例:
{{ start_step("Connect") }}
<button id="connect-button" class="btn btn-primary">Connect</button>
<button id="connect-socket-button" class="btn btn-primary">Connect</button>
<strong>Connection status:</strong>
<span id="connection-status">Not connected</span>
<h5>Console:</h5>
@@ -85,7 +85,7 @@ const socket = new WebSocket('ws://localhost:6006')
<script type="application/javascript">
let socket;
$("#connect-button").click((event) => {
$("#connect-socket-button").click((event) => {
socket = new WebSocket('wss://s.altnet.rippletest.net:51233')
socket.addEventListener('open', (event) => {
// This callback runs when the connection is open

View File

@@ -74,7 +74,7 @@ const socket = new WebSocket('ws://localhost:6006')
Example:
{{ start_step("Connect") }}
<button id="connect-button" class="btn btn-primary">Connect</button>
<button id="connect-socket-button" class="btn btn-primary">Connect</button>
<strong>Connection status:</strong>
<span id="connection-status">Not connected</span>
<h5>Console:</h5>
@@ -83,7 +83,7 @@ Example:
<script type="application/javascript">
let socket;
$("#connect-button").click((event) => {
$("#connect-socket-button").click((event) => {
socket = new WebSocket('wss://s.altnet.rippletest.net:51233')
socket.addEventListener('open', (event) => {
// This callback runs when the connection is open