Move send mpts to tutorials, redo screenshots, revise code samples

This commit is contained in:
Dennis Dawson
2025-04-02 14:04:13 -07:00
parent cbd2040f6e
commit f15eccefb7
37 changed files with 1314 additions and 1028 deletions

View File

@@ -1,211 +1,218 @@
<html>
<head>
<title>Send MPT Test Harness</title>
<head>
<title>Send MPT</title>
<link href='https://fonts.googleapis.com/css?family=Work Sans' rel='stylesheet'>
<link href="mpt-generator.css" rel="stylesheet">
<script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script>
<script src='get-accounts.js'></script>
<link href="modular-tutorials.css" rel="stylesheet">
<script src='https://unpkg.com/xrpl@4.1.0/build/xrpl-latest.js'></script>
<script src="account-support.js"></script>
<script src='send-mpt.js'></script>
<script>
if (typeof module !== "undefined") {
const xrpl = require('xrpl')
}
if (typeof module !== "undefined") {
const xrpl = require('xrpl')
}
</script>
</head>
</head>
<!-- ************************************************************** -->
<!-- ********************** The Form ****************************** -->
<!-- ************************************************************** -->
<body>
<h1>Send MPTs</h1>
<body>
<h1>Send MPT</h1>
<form id="theForm">
Choose your ledger instance:
&nbsp;&nbsp;
<input type="radio" id="tn" name="server"
value="wss://s.altnet.rippletest.net:51233" >
<label for="testnet">Testnet</label>
&nbsp;&nbsp;
<input type="radio" id="dn" name="server"
value="wss://s.devnet.rippletest.net:51233" checked>
<label for="devnet">Devnet</label>
<br/><br/>
<button type="button" onClick="getAccountsFromSeeds()">Get Accounts From Seeds</button>
<br/>
<textarea id="seeds" cols="40" rows= "2"></textarea>
<br/><br/>
<table>
<tr valign="top">
<td>
<table>
<tr valign="top">
<span class="tooltip" tooltip-data="Choose the XRPL host server for your account.">
Choose your ledger instance:
</span>
&nbsp;&nbsp;
<input type="radio" id="dn" name="server" value="wss://s.devnet.rippletest.net:51233" checked>
<label for="dn">Devnet</label>
&nbsp;&nbsp;
<input type="radio" id="tn" name="server" value="wss://s.altnet.rippletest.net:51233">
<label for="tn">Testnet</label>
<br /><br />
<table>
<tr>
<td>
<td>
<button type="button" onClick="getAccount('left')">Get New Left Account</button>
<table>
<tr valign="top">
<td align="right">
Left Account
</td>
<td>
<input type="text" id="leftAccountField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Seed
</td>
<td>
<input type="text" id="leftSeedField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
XRP Balance
</td>
<td>
<input type="text" id="leftBalanceField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Quantity
</td>
<td>
<input type="text" id="leftQuantityField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Destination
</td>
<td>
<input type="text" id="leftDestinationField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
MPT Issuance ID
</td>
<td>
<input type="text" id="leftIssuanceIdField" size="40"></input>
</td>
</tr>
</table>
<p align="left">
<textarea id="leftResultField" cols="80" rows="20" ></textarea>
</p>
</td>
<button type="button" onClick="getNewAccount1()">Get New Account 1</button>
</td>
<td>
<table>
<tr valign="top">
<td align="center" valign="top">
<button type="button" onClick="MPTAuthorize()">Authorize MPTs</button>
<br/>
<button type="button" onClick="sendMPT()">Send MPT</button>
<br/>
<button type="button" onClick="getMPTs()">Get MPTs</button>
</td>
</tr>
</td>
</tr>
</table>
<button type="button" onClick="getAccountFromSeed1()">Get Account 1 From Seed</button>
</td>
</tr>
<td>
<button type="button" onClick="getNewAccount2()">Get New Account 2</button>
</td>
<td>
<button type="button" onClick="getAccountFromSeed2()">Get Account 2 From Seed</button>
</td>
</tr>
<tr>
<td>
<span class="tooltip" tooltip-data="Arbitrary human-readable name for the account."><label for="account1name">Account 1 Name</label>
</span>
</td>
<td>
<input type="text" id="account1name" size="40"></input>
</td>
<td>
<span class="tooltip" tooltip-data="Arbitrary human-readable name for the account.">
<label for="account2name">Account 2 Name</label>
</span>
</td>
<td>
<input type="text" id="account2name" size="40"></input>
</td>
</tr>
<tr>
<td>
<span class="tooltip" tooltip-data="Identifying address for the account.">
<label for="account1address">Account 1 Address</label>
</span>
</td>
<td>
<input type="text" id="account1address" size="40"></input>
</td>
<td>
<span class="tooltip" tooltip-data="Identifying address for the account.">
<label for="account2address">Account 2 Address</label>
</span>
</td>
<td>
<input type="text" id="account2address" size="40"></input>
</td>
</tr>
<tr>
<td>
<span class="tooltip" tooltip-data="Seed for deriving public and private keys for the account.">
<label for="account1seed">Account 1 Seed</label>
</span>
</td>
<td>
<input type="text" id="account1seed" size="40"></input>
</td>
<td>
<span class="tooltip" tooltip-data="Seed for deriving public and private keys for the account.">
<label for="account2seed">Account 2 Seed</label>
</span>
</td>
<td>
<input type="text" id="account2seed" size="40"></input>
</td>
</tr>
</table>
</td>
<td>
<hr />
<table>
<tr>
<td>
<td>
<table>
<tr>
<td align="center" valign="top">
<button type="button" onClick="rightMPTAuthorize()">Authorize MPTs</button>
<br/>
<button type="button" onClick="rightSendMPT()">Send MPT</button>
<br/>
<button type="button" onClick="rightGetMPTs()">Get MPTs</button>
</td>
<td valign="top" align="right">
<button type="button" onClick="getAccount('right')">Get New Right Account</button>
<table>
<tr valign="top">
<td align="right">
Right Account
</td>
<td>
<input type="text" id="rightAccountField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Seed
</td>
<td>
<input type="text" id="rightSeedField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
XRP Balance
</td>
<td>
<input type="text" id="rightBalanceField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Quantity
</td>
<td>
<input type="text" id="rightQuantityField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
Destination
</td>
<td>
<input type="text" id="rightDestinationField" size="40"></input>
<br>
</td>
</tr>
<tr>
<td align="right">
MPT Issuance ID
</td>
<td>
<input type="text" id="rightIssuanceIdField" size="40"></input>
</td>
</tr>
</table>
<p align="right">
<textarea id="rightResultField" cols="80" rows="20" ></textarea>
</p>
</td>
</td>
</tr>
</td>
</tr>
</table>
<tr valign="top">
<td align="right">
<span class="tooltip" tooltip-data="Name of the currently selected account.">
<label for="accountNameField">Account Name</label>
</span>
</td>
</tr>
</table>
</td>
</tr>
</table>
<td>
<input type="text" id="accountNameField" size="40" readonly></input>
<input type="radio" id="account1" name="accounts" value="account1">
<label for="account1">Account 1</label>
</td>
</tr>
<tr valign="top">
<td align="right">
<span class="tooltip" tooltip-data="Address of the currently selected account.">
<label for="accountAddressField">Account Address</label>
</span>
</td>
<td>
<input type="text" id="accountAddressField" size="40" readonly></input>
<input type="radio" id="account2" name="accounts" value="account2">
<label for="account2">Account 2</label>
</td>
</tr>
<tr valign="top">
<td align="right">
<span class="tooltip" tooltip-data="Seed of the currently selected account.">
<label for="accountSeedField">Account Seed</label>
</span>
</td>
<td>
<input type="text" id="accountSeedField" size="40" readonly></input>
<br>
</td>
</tr>
<tr>
<td align="right">
<span class="tooltip" tooltip-data="XRP balance for the currently selected account.">
<label for="xrpBalanceField">XRP Balance</label>
</span>
</td>
<td>
<input type="text" id="xrpBalanceField" size="40" readonly></input>
</td>
</tr>
<tr>
<td align="right">
<span class="tooltip" tooltip-data="Issuance ID of the MPT you want to trade.">
<lable for="mptIdField">MPT Issuance ID</lable>
</span>
</td>
<td>
<input type="text" id="mptIdField" size="40"></input>
<br>
</td>
<td>
<button type="button" onClick="authorizeMPT()">Authorize MPT</button>
</td>
</tr>
<tr>
<td align="right">
<span class="tooltip" tooltip-data="Number of MPTs to send.">
<label for="amountField">Amount</label>
</span>
</td>
<td>
<input type="text" id="amountField" size="40"></input>
<br>
</td>
<td>
<button type="button" onClick="sendMPT()">Send MPT</button>
</td>
</tr>
<tr>
<td align="right">
<span class="tooltip" tooltip-data="Destination account address for MPT transfer.">
<lable for="destinationField">Destination</lable>
</span>
</td>
<td>
<input type="text" id="destinationField" size="40"></input>
<br>
</td>
<td align="left" valign="top">
<button type="button" onClick="getMPTs()">Get MPTs</button>
</td>
</tr>
<tr>
<td colspan="2">
<p align="right">
<textarea id="resultField" cols="80" rows="20"></textarea>
</p>
</td>
<td align="left" valign="top">
<button type="button" onClick="gatherAccountInfo()">Gather Account Info</button><br/>
<button type="button" onClick="distributeAccountInfo()">Distribute Account Info</button>
</td>
</tr>
</table>
</form>
</body>
</body>
<script>
let radioButtons = document.querySelectorAll('input[type="radio"]');
radioButtons.forEach(radio => {
radio.addEventListener('change', function() {
if (this.value === 'account1') {
populate1()
} else if (this.value === 'account2') {
populate2()
}
});
});
</script>
</html>