mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-17 18:25:50 +00:00
Add individual JavaScript example files.
This commit is contained in:
228
content/_code-samples/quickstart/js/1.get-accounts-send-xrp.html
Normal file
228
content/_code-samples/quickstart/js/1.get-accounts-send-xrp.html
Normal file
@@ -0,0 +1,228 @@
|
||||
<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.7.0/build/xrpl-latest-min.js'></script>
|
||||
<script src='ripplex1-send-xrp.js'></script>
|
||||
<script>
|
||||
if (typeof module !== "undefined") {
|
||||
const xrpl = require('xrpl')
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!-- ************************************************************** -->
|
||||
<!-- ********************** The Form ****************************** -->
|
||||
<!-- ************************************************************** -->
|
||||
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
|
||||
<input type="radio" id="tn" name="server"
|
||||
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||
<label for="testnet">Testnet</label>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
value="wss://s.devnet.rippletest.net:51233">
|
||||
<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">
|
||||
<td>
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Standby Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbySeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="sendXRP()">Send XRP></button>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="oPsendXRP()"><Send XRP</button>
|
||||
</td>
|
||||
<td align="right">
|
||||
<button type="button" onClick="getAccount('operational')">Get New Operational Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Operational Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalSeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,273 @@
|
||||
<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.7.0/build/xrpl-latest-min.js'></script>
|
||||
<script src='ripplex1-send-xrp.js'></script>
|
||||
<script src='ripplex2-send-currency.js'></script>
|
||||
<script>
|
||||
if (typeof module !== "undefined") {
|
||||
const xrpl = require('xrpl')
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!-- ************************************************************** -->
|
||||
<!-- ********************** The Form ****************************** -->
|
||||
<!-- ************************************************************** -->
|
||||
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
|
||||
<input type="radio" id="tn" name="server"
|
||||
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||
<label for="testnet">Testnet</label>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
value="wss://s.devnet.rippletest.net:51233">
|
||||
<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">
|
||||
<td>
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Standby Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbySeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
|
||||
<td>
|
||||
<input type="checkbox" id="standbyDefault" checked="true"/>
|
||||
<label for="standbyDefault">Allow Rippling</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="left">
|
||||
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="sendXRP()">Send XRP></button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="sendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="oPsendXRP()">< Send XRP</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPsendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
</td>
|
||||
<td valign="top" align="right">
|
||||
<button type="button" onClick="getAccount('operational')">Get New Operational Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Operational Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalSeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="right">
|
||||
<input type="checkbox" id="operationalDefault" checked="true"/>
|
||||
<label for="operationalDefault">Allow Rippling</label>
|
||||
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
320
content/_code-samples/quickstart/js/3.mint-nfts.html
Normal file
320
content/_code-samples/quickstart/js/3.mint-nfts.html
Normal file
@@ -0,0 +1,320 @@
|
||||
<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.7.0/build/xrpl-latest-min.js'></script>
|
||||
<script src='ripplex1-send-xrp.js'></script>
|
||||
<script src='ripplex2-send-currency.js'></script>
|
||||
<script src='ripplex3-mint-nfts.js'></script>
|
||||
<script>
|
||||
if (typeof module !== "undefined") {
|
||||
const xrpl = require('xrpl')
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!-- ************************************************************** -->
|
||||
<!-- ********************** The Form ****************************** -->
|
||||
<!-- ************************************************************** -->
|
||||
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
|
||||
<input type="radio" id="tn" name="server"
|
||||
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||
<label for="testnet">Testnet</label>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
value="wss://s.devnet.rippletest.net:51233">
|
||||
<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">
|
||||
<td>
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Standby Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbySeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
|
||||
<td>
|
||||
<input type="checkbox" id="standbyDefault" checked="true"/>
|
||||
<label for="standbyDefault">Allow Rippling</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="standbyTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="standbyFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="standbyTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="left">
|
||||
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="sendXRP()">Send XRP></button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="sendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="mintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="burnToken()">Burn NFT</button>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="oPsendXRP()">< Send XRP</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPsendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPmintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPgetTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPburnToken()">Burn NFT</button>
|
||||
<td valign="top" align="right">
|
||||
<button type="button" onClick="getAccount('operational')">Get New Operational Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Operational Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalSeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Destination
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalDestinationField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="right"> <input type="checkbox" id="operationalDefault" checked="true"/>
|
||||
<label for="operationalDefault">Allow Rippling</label>
|
||||
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="operationalTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="operationalFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="operationalTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="operationalTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
361
content/_code-samples/quickstart/js/4.transfer-nfts.html
Normal file
361
content/_code-samples/quickstart/js/4.transfer-nfts.html
Normal file
@@ -0,0 +1,361 @@
|
||||
<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.7.0/build/xrpl-latest-min.js'></script>
|
||||
<script src='ripplex1-send-xrp.js'></script>
|
||||
<script src='ripplex2-send-currency.js'></script>
|
||||
<script src='ripplex3-mint-nfts.js'></script>
|
||||
<script src='ripplex4-transfer-nfts.js'></script>
|
||||
<script>
|
||||
if (typeof module !== "undefined") {
|
||||
const xrpl = require('xrpl')
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!-- ************************************************************** -->
|
||||
<!-- ********************** The Form ****************************** -->
|
||||
<!-- ************************************************************** -->
|
||||
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
|
||||
<input type="radio" id="tn" name="server"
|
||||
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||
<label for="testnet">Testnet</label>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
value="wss://s.devnet.rippletest.net:51233">
|
||||
<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">
|
||||
<td>
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Standby Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbySeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
|
||||
<td>
|
||||
<input type="checkbox" id="standbyDefault" checked="true"/>
|
||||
<label for="standbyDefault">Allow Rippling</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="standbyTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="standbyFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT Offer Index</td>
|
||||
<td><input type="text" id="standbyTokenOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Owner</td>
|
||||
<td><input type="text" id="standbyOwnerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Destination</td>
|
||||
<td><input type="text" id="standbyDestinationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Expiration</td>
|
||||
<td><input type="text" id="standbyExpirationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="standbyTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="left">
|
||||
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="sendXRP()">Send XRP></button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="sendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="mintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="burnToken()">Burn NFT</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createSellOffer()">Create Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="acceptSellOffer()">Accept Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="createBuyOffer()">Create Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="acceptBuyOffer()">Accept Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getOffers()">Get Offers</button>
|
||||
<br/>
|
||||
<button type="button" onClick="cancelOffer()">Cancel Offer</button>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="oPsendXRP()">< Send XRP</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPsendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPmintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPgetTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPburnToken()">Burn NFT</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateSellOffer()">Create Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPacceptSellOffer()">Accept Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPcreateBuyOffer()">Create Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPacceptBuyOffer()">Accept Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPgetOffers()">Get Offers</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPcancelOffer()">Cancel Offer</button>
|
||||
</td>
|
||||
<td valign="top" align="right">
|
||||
<button type="button" onClick="getAccount('operational')">Get New Operational Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Operational Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalSeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="right"> <input type="checkbox" id="operationalDefault" checked="true"/>
|
||||
<label for="operationalDefault">Allow Rippling</label>
|
||||
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="operationalTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="operationalFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="operationalTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT Offer Index</td>
|
||||
<td><input type="text" id="operationalTokenOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Owner</td>
|
||||
<td><input type="text" id="operationalOwnerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Destination</td>
|
||||
<td><input type="text" id="operationalDestinationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Expiration</td>
|
||||
<td><input type="text" id="operationalExpirationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="operationalTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
447
content/_code-samples/quickstart/js/5.broker-nfts.html
Normal file
447
content/_code-samples/quickstart/js/5.broker-nfts.html
Normal file
@@ -0,0 +1,447 @@
|
||||
<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.7.0/build/xrpl-latest-min.js'></script>
|
||||
<script src='ripplex1-send-xrp.js'></script>
|
||||
<script src='ripplex2-send-currency.js'></script>
|
||||
<script src='ripplex3-mint-nfts.js'></script>
|
||||
<script src='ripplex4-transfer-nfts.js'></script>
|
||||
<script src='ripplex5-broker-nfts.js'></script>
|
||||
<script>
|
||||
if (typeof module !== "undefined") {
|
||||
const xrpl = require('xrpl')
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- ************************************************************** -->
|
||||
<!-- ********************** The Form ****************************** -->
|
||||
<!-- ************************************************************** -->
|
||||
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
|
||||
<input type="radio" id="tn" name="server"
|
||||
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||
<label for="testnet">Testnet</label>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
value="wss://s.devnet.rippletest.net:51233">
|
||||
<label for="devnet">Devnet</label>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="getAccountsFromSeeds()">Get Accounts From Seeds</button>
|
||||
<br/>
|
||||
<textarea id="seeds" cols="40" rows= "3"></textarea>
|
||||
<br/><br/>
|
||||
<table align="center">
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('broker')">Get New Broker Account</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Broker Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="brokerAccountField" size="40"></input>
|
||||
<button type="button" id="another" onclick="brokerSale()">Broker Sale</button>
|
||||
</td>
|
||||
<td rowspan="7">
|
||||
<textarea id="brokerResultField" cols="40" rows="12"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="brokerPubKeyField" size="40"></input>
|
||||
<button type="button" onClick="brGetOffers()">Get Offers</button>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="brokerPrivKeyField" size="40"></input>
|
||||
<button type="button" onClick="brCancelOffer()">Cancel Offer</button>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
<br>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="brokerSeedField" size="40"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="brokerBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="brokerAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="brokerTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Sell NFT Offer Index</td>
|
||||
<td><input type="text" id="brokerTokenSellOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Buy NFT Offer Index</td>
|
||||
<td><input type="text" id="brokerTokenBuyOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Owner</td>
|
||||
<td><input type="text" id="brokerOwnerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Broker Fee</td>
|
||||
<td><input type="text" id="brokerBrokerFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/><br/>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Standby Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbySeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
|
||||
<td>
|
||||
<input type="checkbox" id="standbyDefault" checked="true"/>
|
||||
<label for="standbyDefault">Allow Rippling</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="standbyTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="standbyFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT Offer Index</td>
|
||||
<td><input type="text" id="standbyTokenOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Owner</td>
|
||||
<td><input type="text" id="standbyOwnerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Destination</td>
|
||||
<td><input type="text" id="standbyDestinationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Expiration</td>
|
||||
<td><input type="text" id="standbyExpirationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="standbyTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="left">
|
||||
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="sendXRP()">Send XRP></button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="sendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="mintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="burnToken()">Burn NFT</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createSellOffer()">Create Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="acceptSellOffer()">Accept Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="createBuyOffer()">Create Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="acceptBuyOffer()">Accept Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getOffers()">Get Offers</button>
|
||||
<br/>
|
||||
<button type="button" onClick="cancelOffer()">Cancel Offer</button>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="oPsendXRP()">< Send XRP</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPsendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPmintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPgetTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPburnToken()">Burn NFT</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateSellOffer()">Create Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPacceptSellOffer()">Accept Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPcreateBuyOffer()">Create Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPacceptBuyOffer()">Accept Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPgetOffers()">Get Offers</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPcancelOffer()">Cancel Offer</button>
|
||||
</td>
|
||||
<td valign="top" align="right">
|
||||
<button type="button" onClick="getAccount('operational')">Get New Operational Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Operational Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalSeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="right"> <input type="checkbox" id="operationalDefault" checked="true"/>
|
||||
<label for="operationalDefault">Allow Rippling</label>
|
||||
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="operationalTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="operationalFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="operationalTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT Offer Index</td>
|
||||
<td><input type="text" id="operationalTokenOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Owner</td>
|
||||
<td><input type="text" id="operationalOwnerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Destination</td>
|
||||
<td><input type="text" id="operationalDestinationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Expiration</td>
|
||||
<td><input type="text" id="operationalExpirationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="operationalTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
386
content/_code-samples/quickstart/js/6.authorized-minter.html
Normal file
386
content/_code-samples/quickstart/js/6.authorized-minter.html
Normal file
@@ -0,0 +1,386 @@
|
||||
<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.7.0/build/xrpl-latest-min.js'></script>
|
||||
<script src='ripplex1-send-xrp.js'></script>
|
||||
<script src='ripplex2-send-currency.js'></script>
|
||||
<script src='ripplex3-mint-nfts.js'></script>
|
||||
<script src='ripplex4-transfer-nfts.js'></script>
|
||||
<script src='ripplex6-authorized-minter.js'></script>
|
||||
<script>
|
||||
if (typeof module !== "undefined") {
|
||||
const xrpl = require('xrpl')
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!-- ************************************************************** -->
|
||||
<!-- ********************** The Form ****************************** -->
|
||||
<!-- ************************************************************** -->
|
||||
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
|
||||
<input type="radio" id="tn" name="server"
|
||||
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||
<label for="testnet">Testnet</label>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
value="wss://s.devnet.rippletest.net:51233">
|
||||
<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">
|
||||
<td>
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Standby Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbySeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
|
||||
<td>
|
||||
<input type="checkbox" id="standbyDefault" checked="true"/>
|
||||
<label for="standbyDefault">Allow Rippling</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="standbyTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="standbyFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT Offer Index</td>
|
||||
<td><input type="text" id="standbyTokenOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Owner</td>
|
||||
<td><input type="text" id="standbyOwnerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Authorized Minter</td>
|
||||
<td><input type="text" id="standbyMinterField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Issuer</td>
|
||||
<td><input type="text" id="standbyIssuerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Destination</td>
|
||||
<td><input type="text" id="standbyDestinationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Expiration</td>
|
||||
<td><input type="text" id="standbyExpirationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="standbyTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="left">
|
||||
<textarea id="standbyResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="sendXRP()">Send XRP></button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="sendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="mintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="burnToken()">Burn NFT</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="setMinter('standby')">Set Minter</button>
|
||||
<br/>
|
||||
<button type="button" onClick="mintOther()">Mint Other</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="createSellOffer()">Create Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="acceptSellOffer()">Accept Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="createBuyOffer()">Create Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="acceptBuyOffer()">Accept Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getOffers()">Get Offers</button>
|
||||
<br/>
|
||||
<button type="button" onClick="cancelOffer()">Cancel Offer</button>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center" valign="top">
|
||||
<button type="button" onClick="oPsendXRP()">< Send XRP</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateTrustline()">Create TrustLine</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPsendCurrency()">Send Currency</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBalances()">Get Balances</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPmintToken()">Mint NFT</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPgetTokens()">Get NFTs</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPburnToken()">Burn NFT</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPsetMinter()">Set Minter</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPmintOther()">Mint Other</button>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="oPcreateSellOffer()">Create Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPacceptSellOffer()">Accept Sell Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPcreateBuyOffer()">Create Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPacceptBuyOffer()">Accept Buy Offer</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPgetOffers()">Get Offers</button>
|
||||
<br/>
|
||||
<button type="button" onClick="oPcancelOffer()">Cancel Offer</button>
|
||||
</td>
|
||||
<td valign="top" align="right">
|
||||
<button type="button" onClick="getAccount('operational')">Get New Operational Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Operational Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalSeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Amount
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalAmountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
</td>
|
||||
<td align="right"> <input type="checkbox" id="operationalDefault" checked="true"/>
|
||||
<label for="operationalDefault">Allow Rippling</label>
|
||||
<button type="button" onClick="configureAccount('operational',document.querySelector('#operationalDefault').checked)">Configure Account</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="operationalCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="operationalTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="operationalFlagsField" value="1" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="operationalTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT Offer Index</td>
|
||||
<td><input type="text" id="operationalTokenOfferIndexField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Owner</td>
|
||||
<td><input type="text" id="operationalOwnerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Authorized Minter</td>
|
||||
<td><input type="text" id="operationalMinterField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Issuer</td>
|
||||
<td><input type="text" id="operationalIssuerField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Destination</td>
|
||||
<td><input type="text" id="operationalDestinationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Expiration</td>
|
||||
<td><input type="text" id="operationalExpirationField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="operationalTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<textarea id="operationalResultField" cols="80" rows="20" ></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
157
content/_code-samples/quickstart/js/7.batch-minting.html
Normal file
157
content/_code-samples/quickstart/js/7.batch-minting.html
Normal file
@@ -0,0 +1,157 @@
|
||||
<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.7.0/build/xrpl-latest-min.js'></script>
|
||||
<script src='ripplex1-send-xrp.js'></script>
|
||||
<script src='ripplex3-mint-nfts.js'></script>
|
||||
<script src='ripplex7-batch-minting.js'></script>
|
||||
<script>
|
||||
if (typeof module !== "undefined") {
|
||||
const xrpl = require('xrpl')
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!-- ************************************************************** -->
|
||||
<!-- ********************** The Form ****************************** -->
|
||||
<!-- ************************************************************** -->
|
||||
|
||||
<body>
|
||||
<h1>Token Test Harness</h1>
|
||||
<form id="theForm">
|
||||
Choose your ledger instance:
|
||||
|
||||
<input type="radio" id="tn" name="server"
|
||||
value="wss://s.altnet.rippletest.net:51233" checked>
|
||||
<label for="testnet">Testnet</label>
|
||||
|
||||
<input type="radio" id="dn" name="server"
|
||||
value="wss://s.devnet.rippletest.net:51233">
|
||||
<label for="devnet">Devnet</label>
|
||||
<br/><br/>
|
||||
<button type="button" onClick="getAccountFromSeed()">Get Account From Seed</button>
|
||||
<br/>
|
||||
<textarea id="seeds" cols="40" rows= "1" maxlength="524,288"></textarea>
|
||||
<br/><br/>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td>
|
||||
<button type="button" onClick="getAccount('standby')">Get New Standby Account</button>
|
||||
<table>
|
||||
<tr valign="top">
|
||||
<td align="right">
|
||||
Standby Account
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyAccountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Public Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPubKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Private Key
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyPrivKeyField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Seed
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbySeedField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
XRP Balance
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyBalanceField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td><button type="button" onClick="configureAccount('standby',document.querySelector('#standbyDefault').checked)">Configure Account</button></td>
|
||||
<td>
|
||||
<input type="checkbox" id="standbyDefault" checked="true"/>
|
||||
<label for="standbyDefault">Allow Rippling</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Currency
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyCurrencyField" size="40" value="USD"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT URL</td>
|
||||
<td><input type="text" id="standbyTokenUrlField"
|
||||
value = "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf4dfuylqabf3oclgtqy55fbzdi" size="80"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Flags</td>
|
||||
<td><input type="text" id="standbyFlagsField" value="8" size="10"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">NFT ID</td>
|
||||
<td><input type="text" id="standbyTokenIdField" value="" size="80"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
NFT Count
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="standbyNFTCountField" size="40"></input>
|
||||
<br>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Transfer Fee</td>
|
||||
<td><input type="text" id="standbyTransferFeeField" value="" size="80"/></td>
|
||||
</tr>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td align="left" valign="top">
|
||||
<button type="button" onClick="batchMint()">Batch Mint</button>
|
||||
<br/>
|
||||
<button type="button" onClick="getBatchNFTs()">Get Batch NFTs</button>
|
||||
<br/>
|
||||
<p align="left">
|
||||
|
||||
<!-- Note the increased maxlength to hold the most possible NFT info. -->
|
||||
|
||||
<textarea id="standbyResultField" cols="80" rows="20" maxlength="524288"></textarea>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
207
content/_code-samples/quickstart/js/ripplex1-send-xrp.js
Normal file
207
content/_code-samples/quickstart/js/ripplex1-send-xrp.js
Normal file
@@ -0,0 +1,207 @@
|
||||
// ******************************************************
|
||||
// ************* Get the Preferred Network **************
|
||||
// ******************************************************
|
||||
|
||||
function getNet() {
|
||||
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"
|
||||
return net
|
||||
} // End of getNet()
|
||||
|
||||
// *******************************************************
|
||||
// ************* Get Account *****************************
|
||||
// *******************************************************
|
||||
|
||||
async function getAccount(type) {
|
||||
let net = getNet()
|
||||
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '....'
|
||||
|
||||
// This uses the default faucet for Testnet/Devnet
|
||||
let faucetHost = null
|
||||
|
||||
if (type == 'standby') {
|
||||
standbyResultField.value = results
|
||||
} else {
|
||||
operationalResultField.value = results
|
||||
}
|
||||
await client.connect()
|
||||
|
||||
results += '\nConnected, funding wallet.'
|
||||
if (type == 'standby') {
|
||||
standbyResultField.value = results
|
||||
} else {
|
||||
operationalResultField.value = results
|
||||
}
|
||||
|
||||
// -----------------------------------Create and fund a test account wallet
|
||||
const my_wallet = (await client.fundWallet(null, { faucetHost })).wallet
|
||||
|
||||
results += '\nGot a wallet.'
|
||||
if (type == 'standby') {
|
||||
standbyResultField.value = results
|
||||
} else {
|
||||
operationalResultField.value = results
|
||||
}
|
||||
|
||||
// ------------------------------------------------------Get the current balance.
|
||||
const my_balance = (await client.getXrpBalance(my_wallet.address))
|
||||
|
||||
if (type == 'standby') {
|
||||
standbyAccountField.value = my_wallet.address
|
||||
standbyPubKeyField.value = my_wallet.publicKey
|
||||
standbyPrivKeyField.value = my_wallet.privateKey
|
||||
standbyBalanceField.value = (await client.getXrpBalance(my_wallet.address))
|
||||
standbySeedField.value = my_wallet.seed
|
||||
results += '\nStandby account created.'
|
||||
standbyResultField.value = results
|
||||
} else {
|
||||
operationalAccountField.value = my_wallet.address
|
||||
operationalPubKeyField.value = my_wallet.publicKey
|
||||
operationalPrivKeyField.value = my_wallet.privateKey
|
||||
operationalSeedField.value = my_wallet.seed
|
||||
operationalBalanceField.value = (await client.getXrpBalance(my_wallet.address))
|
||||
results += '\nOperational account created.'
|
||||
operationalResultField.value = results
|
||||
}
|
||||
// --------------- Capture the seeds for both accounts for ease of reload.
|
||||
seeds.value = standbySeedField.value + '\n' + operationalSeedField.value
|
||||
client.disconnect()
|
||||
} // End of getAccount()
|
||||
|
||||
// *******************************************************
|
||||
// ********** Get Accounts from Seeds ********************
|
||||
// *******************************************************
|
||||
|
||||
async function getAccountsFromSeeds() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected, finding wallets.\n'
|
||||
standbyResultField.value = results
|
||||
|
||||
// -------------------------------------------------Find the test account wallets.
|
||||
var lines = seeds.value.split('\n')
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(lines[0])
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(lines[1])
|
||||
|
||||
// -------------------------------------------------------Get the current balance.
|
||||
const standby_balance = (await client.getXrpBalance(standby_wallet.address))
|
||||
const operational_balance = (await client.getXrpBalance(operational_wallet.address))
|
||||
|
||||
// ----------------------Populate the fields for Standby and Operational accounts.
|
||||
standbyAccountField.value = standby_wallet.address
|
||||
standbyPubKeyField.value = standby_wallet.publicKey
|
||||
standbyPrivKeyField.value = standby_wallet.privateKey
|
||||
standbySeedField.value = standby_wallet.seed
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
|
||||
operationalAccountField.value = operational_wallet.address
|
||||
operationalPubKeyField.value = operational_wallet.publicKey
|
||||
operationalPrivKeyField.value = operational_wallet.privateKey
|
||||
operationalSeedField.value = operational_wallet.seed
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
|
||||
client.disconnect()
|
||||
|
||||
} // End of getAccountsFromSeeds()
|
||||
|
||||
// *******************************************************
|
||||
// ******************** Send XRP *************************
|
||||
// *******************************************************
|
||||
|
||||
async function sendXRP() {
|
||||
results = "Connecting to the selected ledger.\n"
|
||||
standbyResultField.value = results
|
||||
let net = getNet()
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
const client = new xrpl.Client(net)
|
||||
await client.connect()
|
||||
|
||||
results += "\nConnected. Sending XRP.\n"
|
||||
standbyResultField.value = results
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const sendAmount = standbyAmountField.value
|
||||
|
||||
results += "\nstandby_wallet.address: = " + standby_wallet.address
|
||||
standbyResultField.value = results
|
||||
|
||||
// -------------------------------------------------------- Prepare transaction
|
||||
const prepared = await client.autofill({
|
||||
"TransactionType": "Payment",
|
||||
"Account": standby_wallet.address,
|
||||
"Amount": xrpl.xrpToDrops(sendAmount),
|
||||
"Destination": standbyDestinationField.value
|
||||
})
|
||||
|
||||
// ------------------------------------------------- Sign prepared instructions
|
||||
const signed = standby_wallet.sign(prepared)
|
||||
|
||||
// -------------------------------------------------------- Submit signed blob
|
||||
const tx = await client.submitAndWait(signed.tx_blob)
|
||||
|
||||
results += "\nBalance changes: " +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
standbyResultField.value = results
|
||||
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
client.disconnect()
|
||||
} // End of sendXRP()
|
||||
|
||||
// **********************************************************************
|
||||
// ****** Reciprocal Transactions ***************************************
|
||||
// **********************************************************************
|
||||
|
||||
// *******************************************************
|
||||
// ********* Send XRP from Operational account ***********
|
||||
// *******************************************************
|
||||
|
||||
async function oPsendXRP() {
|
||||
|
||||
results = "Connecting to the selected ledger.\n"
|
||||
operationalResultField.value = results
|
||||
let net = getNet()
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
const client = new xrpl.Client(net)
|
||||
await client.connect()
|
||||
|
||||
results += "\nConnected. Sending XRP.\n"
|
||||
operationalResultField.value = results
|
||||
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const sendAmount = operationalAmountField.value
|
||||
|
||||
results += "\noperational_wallet.address: = " + operational_wallet.address
|
||||
operationalResultField.value = results
|
||||
|
||||
// ---------------------------------------------------------- Prepare transaction
|
||||
const prepared = await client.autofill({
|
||||
"TransactionType": "Payment",
|
||||
"Account": operational_wallet.address,
|
||||
"Amount": xrpl.xrpToDrops(operationalAmountField.value),
|
||||
"Destination": operationalDestinationField.value
|
||||
})
|
||||
|
||||
// ---------------------------------------------------- Sign prepared instructions
|
||||
const signed = operational_wallet.sign(prepared)
|
||||
|
||||
// ------------------------------------------------------------ Submit signed blob
|
||||
const tx = await client.submitAndWait(signed.tx_blob)
|
||||
|
||||
results += "\nBalance changes: " +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalResultField.value = results
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
|
||||
client.disconnect()
|
||||
|
||||
} // End of oPsendXRP()
|
||||
282
content/_code-samples/quickstart/js/ripplex2-send-currency.js
Normal file
282
content/_code-samples/quickstart/js/ripplex2-send-currency.js
Normal file
@@ -0,0 +1,282 @@
|
||||
// *******************************************************
|
||||
// **************** Configure Account ********************
|
||||
// *******************************************************
|
||||
|
||||
async function configureAccount(type, defaultRippleSetting) {
|
||||
let net = getNet()
|
||||
let resultField = 'standbyResultField'
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '....'
|
||||
await client.connect()
|
||||
results += '\nConnected, finding wallet.'
|
||||
if (type=='standby') {
|
||||
my_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
} else {
|
||||
my_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
resultField = 'operationalResultField'
|
||||
}
|
||||
results += '\nRipple Default Setting: ' + defaultRippleSetting
|
||||
resultField.value = results
|
||||
|
||||
let settings_tx = {}
|
||||
if (defaultRippleSetting) {
|
||||
settings_tx = {
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": my_wallet.address,
|
||||
"SetFlag": xrpl.AccountSetAsfFlags.asfDefaultRipple
|
||||
}
|
||||
results += '\n Set Default Ripple flag.'
|
||||
} else {
|
||||
settings_tx = {
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": my_wallet.address,
|
||||
"ClearFlag": xrpl.AccountSetAsfFlags.asfDefaultRipple
|
||||
}
|
||||
results += '\n Clear Default Ripple flag.'
|
||||
}
|
||||
results += '\nSending account setting.'
|
||||
resultField.value = results
|
||||
|
||||
const prepared = await client.autofill(settings_tx)
|
||||
const signed = my_wallet.sign(prepared)
|
||||
const result = await client.submitAndWait(signed.tx_blob)
|
||||
if (result.result.meta.TransactionResult == "tesSUCCESS") {
|
||||
results += '\nAccount setting succeeded.'
|
||||
document.getElementById(resultField).value = results
|
||||
} else {
|
||||
throw 'Error sending transaction: ${result}'
|
||||
results += '\nAccount setting failed.'
|
||||
resultField.value = results
|
||||
}
|
||||
client.disconnect()
|
||||
} // End of configureAccount()
|
||||
|
||||
// *******************************************************
|
||||
// ***************** Create TrustLine ********************
|
||||
// *******************************************************
|
||||
|
||||
async function createTrustline() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
|
||||
await client.connect()
|
||||
results += '\nConnected.'
|
||||
standbyResultField.value = results
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const currency_code = standbyCurrencyField.value
|
||||
const trustSet_tx = {
|
||||
"TransactionType": "TrustSet",
|
||||
"Account": standbyDestinationField.value,
|
||||
"LimitAmount": {
|
||||
"currency": standbyCurrencyField.value,
|
||||
"issuer": standby_wallet.address,
|
||||
"value": standbyAmountField.value
|
||||
}
|
||||
}
|
||||
const ts_prepared = await client.autofill(trustSet_tx)
|
||||
const ts_signed = operational_wallet.sign(ts_prepared)
|
||||
results += '\nCreating trust line from operational account to standby account...'
|
||||
standbyResultField.value = results
|
||||
const ts_result = await client.submitAndWait(ts_signed.tx_blob)
|
||||
if (ts_result.result.meta.TransactionResult == "tesSUCCESS") {
|
||||
results += '\nTrustline established between account \n' +
|
||||
standbyDestinationField.value + ' \n and account\n' + standby_wallet.address + '.'
|
||||
standbyResultField.value = results
|
||||
} else {
|
||||
results += '\nTrustLine failed. See JavaScript console for details.'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
throw 'Error sending transaction: ${ts_result.result.meta.TransactionResult}'
|
||||
}
|
||||
} //End of createTrustline()
|
||||
|
||||
// *******************************************************
|
||||
// *************** Send Issued Currency ******************
|
||||
// *******************************************************
|
||||
|
||||
async function sendCurrency() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
|
||||
await client.connect()
|
||||
|
||||
results += '\nConnected.'
|
||||
standbyResultField.value = results
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const currency_code = standbyCurrencyField.value
|
||||
const issue_quantity = standbyAmountField.value
|
||||
|
||||
const send_token_tx = {
|
||||
"TransactionType": "Payment",
|
||||
"Account": standby_wallet.address,
|
||||
"Amount": {
|
||||
"currency": standbyCurrencyField.value,
|
||||
"value": standbyAmountField.value,
|
||||
"issuer": standby_wallet.address
|
||||
},
|
||||
"Destination": standbyDestinationField.value
|
||||
}
|
||||
|
||||
const pay_prepared = await client.autofill(send_token_tx)
|
||||
const pay_signed = standby_wallet.sign(pay_prepared)
|
||||
results += 'Sending ${issue_quantity} ${currency_code} to ' +
|
||||
standbyDestinationField.value + '...'
|
||||
standbyResultField.value = results
|
||||
const pay_result = await client.submitAndWait(pay_signed.tx_blob)
|
||||
if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
|
||||
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${pay_signed.hash}'
|
||||
standbyResultField.value = results
|
||||
} else {
|
||||
results += 'Transaction failed: See JavaScript console for details.'
|
||||
standbyResultField.value = results
|
||||
throw 'Error sending transaction: ${pay_result.result.meta.TransactionResult}'
|
||||
}
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
getBalances()
|
||||
client.disconnect()
|
||||
} // end of sendCurrency()
|
||||
|
||||
// *******************************************************
|
||||
// ****************** Get Balances ***********************
|
||||
// *******************************************************
|
||||
|
||||
async function getBalances() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected.'
|
||||
standbyResultField.value = results
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
results= "\nGetting standby account balances...\n"
|
||||
const standby_balances = await client.request({
|
||||
command: "gateway_balances",
|
||||
account: standby_wallet.address,
|
||||
ledger_index: "validated",
|
||||
hotwallet: [operational_wallet.address]
|
||||
})
|
||||
results += JSON.stringify(standby_balances.result, null, 2)
|
||||
standbyResultField.value = results
|
||||
|
||||
results += "\nGetting operational account balances...\n"
|
||||
const operational_balances = await client.request({
|
||||
command: "gateway_balances",
|
||||
account: operational_wallet.address,
|
||||
ledger_index: "validated"
|
||||
})
|
||||
results += JSON.stringify(operational_balances.result, null, 2)
|
||||
operationalResultField.value = results
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
standbyResultField.value = results
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
|
||||
client.disconnect()
|
||||
} // End of getBalances()
|
||||
|
||||
// **********************************************************************
|
||||
// ****** Reciprocal Transactions ***************************************
|
||||
// **********************************************************************
|
||||
|
||||
// *******************************************************
|
||||
// ************ Create Operational TrustLine *************
|
||||
// *******************************************************
|
||||
|
||||
async function oPcreateTrustline() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
operationalResultField.value = results
|
||||
|
||||
await client.connect()
|
||||
results += '\nConnected.'
|
||||
operationalResultField.value = results
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const trustSet_tx = {
|
||||
"TransactionType": "TrustSet",
|
||||
"Account": operationalDestinationField.value,
|
||||
"LimitAmount": {
|
||||
"currency": operationalCurrencyField.value,
|
||||
"issuer": operational_wallet.address,
|
||||
"value": operationalAmountField.value
|
||||
}
|
||||
}
|
||||
const ts_prepared = await client.autofill(trustSet_tx)
|
||||
const ts_signed = standby_wallet.sign(ts_prepared)
|
||||
results += '\nCreating trust line from operational account to ' +
|
||||
operationalDestinationField.value + ' account...'
|
||||
operationalResultField.value = results
|
||||
const ts_result = await client.submitAndWait(ts_signed.tx_blob)
|
||||
if (ts_result.result.meta.TransactionResult == "tesSUCCESS") {
|
||||
results += '\nTrustline established between account \n' + operational_wallet.address +
|
||||
' \n and account\n' + operationalDestinationField.value + '.'
|
||||
operationalResultField.value = results
|
||||
} else {
|
||||
results += '\nTrustLine failed. See JavaScript console for details.'
|
||||
operationalResultField.value = results
|
||||
throw 'Error sending transaction: ${ts_result.result.meta.TransactionResult}'
|
||||
}
|
||||
} //End of oPcreateTrustline
|
||||
|
||||
// *******************************************************
|
||||
// ************* Operational Send Issued Currency ********
|
||||
// *******************************************************
|
||||
|
||||
async function oPsendCurrency() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
operationalResultField.value = results
|
||||
|
||||
await client.connect()
|
||||
results += '\nConnected.'
|
||||
operationalResultField.value = results
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const currency_code = operationalCurrencyField.value
|
||||
const issue_quantity = operationalAmountField.value
|
||||
|
||||
const send_token_tx = {
|
||||
"TransactionType": "Payment",
|
||||
"Account": operational_wallet.address,
|
||||
"Amount": {
|
||||
"currency": currency_code,
|
||||
"value": issue_quantity,
|
||||
"issuer": operational_wallet.address
|
||||
},
|
||||
"Destination": operationalDestinationField.value
|
||||
}
|
||||
|
||||
const pay_prepared = await client.autofill(send_token_tx)
|
||||
const pay_signed = operational_wallet.sign(pay_prepared)
|
||||
results += 'Sending ${issue_quantity} ${currency_code} to ' +
|
||||
operationalDestinationField.value + '...'
|
||||
operationalResultField.value = results
|
||||
const pay_result = await client.submitAndWait(pay_signed.tx_blob)
|
||||
if (pay_result.result.meta.TransactionResult == "tesSUCCESS") {
|
||||
results += 'Transaction succeeded: https://testnet.xrpl.org/transactions/${pay_signed.hash}'
|
||||
operationalResultField.value = results
|
||||
} else {
|
||||
results += 'Transaction failed: See JavaScript console for details.'
|
||||
operationalResultField.value = results
|
||||
throw 'Error sending transaction: ${pay_result.result.meta.TransactionResult}'
|
||||
}
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
getBalances()
|
||||
client.disconnect()
|
||||
} // end of oPsendCurrency()
|
||||
|
||||
205
content/_code-samples/quickstart/js/ripplex3-mint-nfts.js
Normal file
205
content/_code-samples/quickstart/js/ripplex3-mint-nfts.js
Normal file
@@ -0,0 +1,205 @@
|
||||
// *******************************************************
|
||||
// ********************** Mint Token *********************
|
||||
// *******************************************************
|
||||
|
||||
async function mintToken() {
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
let net = getNet()
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const client = new xrpl.Client(net)
|
||||
await client.connect()
|
||||
results += '\nConnected. Minting NFT.'
|
||||
standbyResultField.value = results
|
||||
|
||||
// Note that you must convert the token URL to a hexadecimal
|
||||
// value for this transaction.
|
||||
// ------------------------------------------------------------------------
|
||||
const transactionJson = {
|
||||
"TransactionType": "NFTokenMint",
|
||||
"Account": standby_wallet.classicAddress,
|
||||
"URI": xrpl.convertStringToHex(standbyTokenUrlField.value),
|
||||
"Flags": parseInt(standbyFlagsField.value),
|
||||
"TransferFee": parseInt(standbyTransferFeeField.value),
|
||||
"NFTokenTaxon": 0 //Required, but if you have no use for it, set to zero.
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- Submit signed blob
|
||||
const tx = await client.submitAndWait(transactionJson, { wallet: standby_wallet} )
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: standby_wallet.classicAddress
|
||||
})
|
||||
|
||||
// ------------------------------------------------------- Report results
|
||||
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
|
||||
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
} //End of mintToken()
|
||||
|
||||
// *******************************************************
|
||||
// ******************* Get Tokens ************************
|
||||
// *******************************************************
|
||||
|
||||
async function getTokens() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Getting NFTs...'
|
||||
standbyResultField.value = results
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: standby_wallet.classicAddress
|
||||
})
|
||||
results += '\nNFTs:\n ' + JSON.stringify(nfts,null,2)
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
} //End of getTokens()
|
||||
|
||||
// *******************************************************
|
||||
// ********************* Burn Token **********************
|
||||
// *******************************************************
|
||||
|
||||
async function burnToken() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Burning NFT...'
|
||||
standbyResultField.value = results
|
||||
|
||||
// ------------------------------------------------------- Prepare transaction
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenBurn",
|
||||
"Account": standby_wallet.classicAddress,
|
||||
"NFTokenID": standbyTokenIdField.value
|
||||
}
|
||||
|
||||
//---------------------------------- Submit transaction and wait for the results
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: standby_wallet})
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: standby_wallet.classicAddress
|
||||
})
|
||||
results += '\nTransaction result: '+ tx.result.meta.TransactionResult
|
||||
results += '\nBalance changes: ' +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
standbyResultField.value = results
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
results += '\nNFTs: \n' + JSON.stringify(nfts,null,2)
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of burnToken()
|
||||
|
||||
// **********************************************************************
|
||||
// ****** Reciprocal Transactions ***************************************
|
||||
// **********************************************************************
|
||||
|
||||
// *******************************************************
|
||||
// ************** Operational Mint Token *****************
|
||||
// *******************************************************
|
||||
|
||||
async function oPmintToken() {
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
operationalResultField.value = results
|
||||
let net = getNet()
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const client = new xrpl.Client(net)
|
||||
await client.connect()
|
||||
results += '\nConnected. Minting NFT.'
|
||||
operationalResultField.value = results
|
||||
|
||||
// Note that you must convert the token URL to a hexadecimal
|
||||
// value for this transaction.
|
||||
// ------------------------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": 'NFTokenMint',
|
||||
"Account": operational_wallet.classicAddress,
|
||||
"URI": xrpl.convertStringToHex(operationalTokenUrlField.value),
|
||||
"Flags": parseInt(operationalFlagsField.value),
|
||||
"TransferFee": parseInt(operationalTransferFeeField.value),
|
||||
"NFTokenTaxon": 0 //Required, but if you have no use for it, set to zero.
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- Submit signed blob
|
||||
const tx = await client.submitAndWait(transactionBlob, { wallet: operational_wallet} )
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: operational_wallet.classicAddress
|
||||
})
|
||||
|
||||
// ------------------------------------------------------- Report results
|
||||
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
|
||||
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
operationalResultField.value = results
|
||||
client.disconnect()
|
||||
} //End of oPmintToken
|
||||
|
||||
// *******************************************************
|
||||
// ************** Operational Get Tokens *****************
|
||||
// *******************************************************
|
||||
|
||||
async function oPgetTokens() {
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Getting NFTs...'
|
||||
operationalResultField.value = results
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: operational_wallet.classicAddress
|
||||
})
|
||||
results += '\nNFTs:\n ' + JSON.stringify(nfts,null,2)
|
||||
operationalResultField.value = results
|
||||
client.disconnect()
|
||||
} //End of oPgetTokens
|
||||
|
||||
// *******************************************************
|
||||
// ************* Operational Burn Token ******************
|
||||
// *******************************************************
|
||||
|
||||
async function oPburnToken() {
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Burning NFT...'
|
||||
operationalResultField.value = results
|
||||
|
||||
// ------------------------------------------------------- Prepare transaction
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenBurn",
|
||||
"Account": operational_wallet.classicAddress,
|
||||
"NFTokenID": operationalTokenIdField.value
|
||||
}
|
||||
|
||||
//-------------------------------------------------------- Submit signed blob
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: operational_wallet.classicAddress
|
||||
})
|
||||
results += '\nTransaction result: '+ tx.result.meta.TransactionResult
|
||||
results += '\nBalance changes: ' +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalResultField.value = results
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
results += '\nNFTs: \n' + JSON.stringify(nfts,null,2)
|
||||
operationalResultField.value = results
|
||||
client.disconnect()
|
||||
}
|
||||
// End of oPburnToken()
|
||||
677
content/_code-samples/quickstart/js/ripplex4-transfer-nfts.js
Normal file
677
content/_code-samples/quickstart/js/ripplex4-transfer-nfts.js
Normal file
@@ -0,0 +1,677 @@
|
||||
// *******************************************************
|
||||
// ****************** Create Sell Offer ******************
|
||||
// *******************************************************
|
||||
|
||||
async function createSellOffer() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Creating sell offer...'
|
||||
standbyResultField.value = results
|
||||
|
||||
//------------------------------------- Prepare Expiration Date
|
||||
var expirationDate = null
|
||||
if (standbyExpirationField.value !="") {
|
||||
var days = standbyExpirationField.value
|
||||
let d = new Date()
|
||||
d.setDate(d.getDate() + parseInt(days))
|
||||
expirationDate = xrpl.isoTimeToRippleTime(d)
|
||||
}
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
let transactionBlob = {
|
||||
"TransactionType": "NFTokenCreateOffer",
|
||||
"Account": standby_wallet.classicAddress,
|
||||
"NFTokenID": standbyTokenIdField.value,
|
||||
"Amount": standbyAmountField.value,
|
||||
"Flags": parseInt(standbyFlagsField.value),
|
||||
}
|
||||
if (expirationDate != null) {
|
||||
transactionBlob.Expiration = expirationDate
|
||||
}
|
||||
if(standbyDestinationField.value !== '') {
|
||||
transactionBlob.Destination = standbyDestinationField.value
|
||||
}
|
||||
|
||||
// Submit transaction --------------------------------------------------------
|
||||
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: standby_wallet})
|
||||
|
||||
results += '\n\n***Sell Offers***\n'
|
||||
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: standbyTokenIdField.value})
|
||||
} catch (err) {
|
||||
nftSellOffers = "No sell offers."
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
results += '\n\n***Buy Offers***\n'
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: standbyTokenIdField.value })
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
} catch (err) {
|
||||
results += 'No buy offers.'
|
||||
}
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
results += '\n\nTransaction result:\n' +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += '\n\nBalance changes:\n' +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of createSellOffer()
|
||||
|
||||
// *******************************************************
|
||||
// ***************** Create Buy Offer ********************
|
||||
// *******************************************************
|
||||
|
||||
async function createBuyOffer() {
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
let results = 'Connecting to ' + net + '...'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results = '\nConnected. Creating buy offer...'
|
||||
standbyResultField.value = results
|
||||
|
||||
//------------------------------------- Prepare Expiration Date
|
||||
var expirationDate = null
|
||||
if (standbyExpirationField.value !="") {
|
||||
var days = standbyExpirationField.value
|
||||
let d = new Date()
|
||||
d.setDate(d.getDate() + parseInt(days))
|
||||
var expirationDate = xrpl.isoTimeToRippleTime(d)
|
||||
}
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenCreateOffer",
|
||||
"Account": standby_wallet.classicAddress,
|
||||
"Owner": standbyOwnerField.value,
|
||||
"NFTokenID": standbyTokenIdField.value,
|
||||
"Amount": standbyAmountField.value,
|
||||
"Flags": null
|
||||
}
|
||||
if (expirationDate != null) {
|
||||
transactionBlob.Expiration = expirationDate
|
||||
}
|
||||
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: standby_wallet})
|
||||
|
||||
results += "\n\n***Sell Offers***\n"
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: standbyTokenIdField.value })
|
||||
} catch (err) {
|
||||
nftSellOffers = "No sell offers."
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
results += "\n\n***Buy Offers***\n"
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: standbyTokenIdField.value })
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
} catch (err) {
|
||||
results += "No buy offers."
|
||||
}
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
results += "\n\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\n\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
standbyResultField.value = results
|
||||
|
||||
client.disconnect()
|
||||
}// End of createBuyOffer()
|
||||
|
||||
// *******************************************************
|
||||
// ******************** Cancel Offer *********************
|
||||
// *******************************************************
|
||||
|
||||
async function cancelOffer() {
|
||||
const wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...' + standbyResultField.value
|
||||
await client.connect()
|
||||
results += "\nConnected. Cancelling offer..."
|
||||
standbyResultField.value = results
|
||||
|
||||
const tokenOfferIDs = [standbyTokenOfferIndexField.value]
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenCancelOffer",
|
||||
"Account": wallet.classicAddress,
|
||||
"NFTokenOffers": tokenOfferIDs
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet})
|
||||
|
||||
results += "\n\n***Sell Offers***\n"
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: standbyTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = "No sell offers."
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
results += "\n\n***Buy Offers***\n"
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: standbyTokenIdField.value
|
||||
})
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
} catch (err) {
|
||||
nftBuyOffers = "No buy offers."
|
||||
}
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
|
||||
results += "\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
standbyResultField.value = results
|
||||
|
||||
client.disconnect() // End of cancelOffer()
|
||||
}
|
||||
|
||||
// *******************************************************
|
||||
// ******************** Get Offers ***********************
|
||||
// *******************************************************
|
||||
|
||||
async function getOffers() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Getting offers...'
|
||||
standbyResultField.value = results
|
||||
|
||||
results += '\n\n***Sell Offers***\n'
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: standbyTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = 'No sell offers.'
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
standbyResultField.value = results
|
||||
|
||||
results += '\n\n***Buy Offers***\n'
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: standbyTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftBuyOffers = 'No buy offers.'
|
||||
}
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
standbyResultField.value = results
|
||||
|
||||
client.disconnect()
|
||||
}// End of getOffers()
|
||||
|
||||
// *******************************************************
|
||||
// ****************** Accept Sell Offer ******************
|
||||
// *******************************************************
|
||||
|
||||
async function acceptSellOffer() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Accepting sell offer...\n\n'
|
||||
standbyResultField.value = results
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenAcceptOffer",
|
||||
"Account": standby_wallet.classicAddress,
|
||||
"NFTokenSellOffer": standbyTokenOfferIndexField.value,
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: standby_wallet})
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: standby_wallet.classicAddress
|
||||
})
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
|
||||
results += 'Transaction result:\n'
|
||||
results += JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += '\nBalance changes:'
|
||||
results += JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
results += JSON.stringify(nfts,null,2)
|
||||
standbyResultField.value = results
|
||||
|
||||
client.disconnect()
|
||||
}// End of acceptSellOffer()
|
||||
|
||||
// *******************************************************
|
||||
// ******************* Accept Buy Offer ******************
|
||||
// *******************************************************
|
||||
|
||||
async function acceptBuyOffer() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Accepting buy offer...'
|
||||
standbyResultField.value = results
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenAcceptOffer",
|
||||
"Account": standby_wallet.classicAddress,
|
||||
"NFTokenBuyOffer": standbyTokenOfferIndexField.value
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: standby_wallet})
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: standby_wallet.classicAddress
|
||||
})
|
||||
results += JSON.stringify(nfts,null,2)
|
||||
standbyResultField.value = results
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
results += "\n\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalBalanceField.value =
|
||||
(await client.getXrpBalance(operational_wallet.address))
|
||||
standbyBalanceField.value =
|
||||
(await client.getXrpBalance(standby_wallet.address))
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of acceptBuyOffer()
|
||||
|
||||
// **********************************************************************
|
||||
// ****** Reciprocal Transactions ***************************************
|
||||
// **********************************************************************
|
||||
|
||||
// *******************************************************
|
||||
// *********** Operational Create Sell Offer *************
|
||||
// *******************************************************
|
||||
|
||||
async function oPcreateSellOffer() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Creating sell offer...'
|
||||
operationalResultField.value = results
|
||||
|
||||
//------------------------------------- Prepare Expiration Date
|
||||
var expirationDate = null
|
||||
if (operationalExpirationField.value !="") {
|
||||
var days = operationalExpirationField.value
|
||||
let d = new Date()
|
||||
d.setDate(d.getDate() + parseInt(days))
|
||||
var expirationDate = xrpl.isoTimeToRippleTime(d)
|
||||
}
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
let transactionBlob = {
|
||||
"TransactionType": "NFTokenCreateOffer",
|
||||
"Account": operational_wallet.classicAddress,
|
||||
"NFTokenID": operationalTokenIdField.value,
|
||||
"Amount": operationalAmountField.value,
|
||||
"Flags": parseInt(operationalFlagsField.value)
|
||||
}
|
||||
if (expirationDate != null) {
|
||||
transactionBlob.Expiration = expirationDate
|
||||
}
|
||||
if(standbyDestinationField.value !== '') {
|
||||
transactionBlob.Destination = operationalDestinationField.value
|
||||
}
|
||||
|
||||
// Submit transaction --------------------------------------------------------
|
||||
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||
|
||||
results += '\n\n***Sell Offers***\n'
|
||||
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = "No sell offers."
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
results += '\n\n***Buy Offers***\n'
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
} catch (err) {
|
||||
results += 'No buy offers.'
|
||||
}
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
results += '\n\nTransaction result:\n' +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += '\n\nBalance changes:\n' +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalBalanceField.value =
|
||||
(await client.getXrpBalance(operational_wallet.address))
|
||||
standbyBalanceField.value =
|
||||
(await client.getXrpBalance(standby_wallet.address))
|
||||
operationalResultField.value = results
|
||||
|
||||
client.disconnect()
|
||||
} // End of oPcreateSellOffer()
|
||||
|
||||
// *******************************************************
|
||||
// ************** Operational Create Buy Offer ***********
|
||||
// *******************************************************
|
||||
|
||||
async function oPcreateBuyOffer() {
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
let results = 'Connecting to ' + net + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results = '\nConnected. Creating buy offer...'
|
||||
operationalResultField.value = results
|
||||
|
||||
//------------------------------------- Prepare Expiration Date
|
||||
var expirationDate = null
|
||||
if (operationalExpirationField.value !="") {
|
||||
var days = operationalExpirationField.value
|
||||
let d = new Date()
|
||||
d.setDate(d.getDate() + parseInt(days))
|
||||
var expirationDate = xrpl.isoTimeToRippleTime(d)
|
||||
}
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenCreateOffer",
|
||||
"Account": operational_wallet.classicAddress,
|
||||
"Owner": operationalOwnerField.value,
|
||||
"NFTokenID": operationalTokenIdField.value,
|
||||
"Amount": operationalAmountField.value,
|
||||
"Flags": null,
|
||||
}
|
||||
if (expirationDate != null) {
|
||||
transactionBlob.Expiration = expirationDate
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||
|
||||
results += "\n\n***Sell Offers***\n"
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = "No sell offers."
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
results += "\n\n***Buy Offers***\n"
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
results += "No buy offers."
|
||||
}
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
results += "\n\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\n\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalResultField.value = results
|
||||
|
||||
client.disconnect()
|
||||
}// End of oPcreateBuyOffer()
|
||||
|
||||
// *******************************************************
|
||||
// ************* Operational Cancel Offer ****************
|
||||
// *******************************************************
|
||||
|
||||
async function oPcancelOffer() {
|
||||
|
||||
const wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += "\nConnected. Cancelling offer..."
|
||||
operationalResultField.value = results
|
||||
|
||||
const tokenOfferIDs = [operationalTokenOfferIndexField.value]
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenCancelOffer",
|
||||
"Account": wallet.classicAddress,
|
||||
"NFTokenOffers": tokenOfferIDs
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet})
|
||||
|
||||
results += "\n\n***Sell Offers***\n"
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = "No sell offers."
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
results += "\n\n***Buy Offers***\n"
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftBuyOffers = "No buy offers."
|
||||
}
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
|
||||
results += "\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalResultField.value = results
|
||||
|
||||
client.disconnect()
|
||||
}// End of oPcancelOffer()
|
||||
|
||||
// *******************************************************
|
||||
// **************** Operational Get Offers ***************
|
||||
// *******************************************************
|
||||
|
||||
async function oPgetOffers() {
|
||||
// const standby_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Getting offers...'
|
||||
|
||||
results += '\n\n***Sell Offers***\n'
|
||||
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = 'No sell offers.'
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
|
||||
results += '\n\n***Buy Offers***\n'
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: operationalTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftBuyOffers = 'No buy offers.'
|
||||
}
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
operationalResultField.value = results
|
||||
|
||||
client.disconnect()
|
||||
}// End of oPgetOffers()
|
||||
|
||||
// *******************************************************
|
||||
// *************** Operational Accept Sell Offer *********
|
||||
// *******************************************************
|
||||
|
||||
async function oPacceptSellOffer() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Accepting sell offer...\n\n'
|
||||
operationalResultField.value = results
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenAcceptOffer",
|
||||
"Account": operational_wallet.classicAddress,
|
||||
"NFTokenSellOffer": operationalTokenOfferIndexField.value,
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: operational_wallet.classicAddress
|
||||
})
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
|
||||
results += 'Transaction result:\n'
|
||||
results += JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += '\nBalance changes:'
|
||||
results += JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
results += JSON.stringify(nfts,null,2)
|
||||
operationalResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of acceptSellOffer()
|
||||
|
||||
// *******************************************************
|
||||
// ********* Operational Accept Buy Offer ****************
|
||||
// *******************************************************
|
||||
|
||||
async function oPacceptBuyOffer() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Accepting buy offer...'
|
||||
operationalResultField.value = results
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenAcceptOffer",
|
||||
"Account": operational_wallet.classicAddress,
|
||||
"NFTokenBuyOffer": operationalTokenOfferIndexField.value
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: operational_wallet})
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: operational_wallet.classicAddress
|
||||
})
|
||||
results += JSON.stringify(nfts,null,2)
|
||||
operationalResultField.value = results
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
results += "\n\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalBalanceField.value =
|
||||
(await client.getXrpBalance(operational_wallet.address))
|
||||
operationalBalanceField.value =
|
||||
(await client.getXrpBalance(standby_wallet.address))
|
||||
operationalResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of acceptBuyOffer()
|
||||
331
content/_code-samples/quickstart/js/ripplex5-broker-nfts.js
Normal file
331
content/_code-samples/quickstart/js/ripplex5-broker-nfts.js
Normal file
@@ -0,0 +1,331 @@
|
||||
// *******************************************************
|
||||
// *******************************************************
|
||||
// ************** Broker Transactions ********************
|
||||
// *******************************************************
|
||||
// *******************************************************
|
||||
|
||||
// *******************************************************
|
||||
// *************** Broker Get Offers *********************
|
||||
// *******************************************************
|
||||
|
||||
async function brGetOffers() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '...'
|
||||
brokerResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Getting offers...'
|
||||
brokerResultField.value = results
|
||||
|
||||
results += '\n\n***Sell Offers***\n'
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: brokerTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = 'No sell offers.'
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
brokerResultField.value = results
|
||||
|
||||
results += '\n\n***Buy Offers***\n'
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: brokerTokenIdField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftBuyOffers = 'No buy offers.'
|
||||
}
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
brokerResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of brGetOffers()
|
||||
|
||||
// *******************************************************
|
||||
// ******************* Broker Sale ***********************
|
||||
// *******************************************************
|
||||
|
||||
async function brokerSale() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const broker_wallet = xrpl.Wallet.fromSeed (brokerSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '...'
|
||||
brokerResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Brokering sale...'
|
||||
brokerResultField.value = results
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenAcceptOffer",
|
||||
"Account": broker_wallet.classicAddress,
|
||||
"NFTokenSellOffer": brokerTokenSellOfferIndexField.value,
|
||||
"NFTokenBuyOffer": brokerTokenBuyOfferIndexField.value,
|
||||
"NFTokenBrokerFee": brokerBrokerFeeField.value
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet: broker_wallet})
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
results += "\n\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
brokerBalanceField.value = (await client.getXrpBalance(broker_wallet.address))
|
||||
brokerResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of brokerSale()
|
||||
|
||||
// *******************************************************
|
||||
// ************* Broker Cancel Offer ****************
|
||||
// *******************************************************
|
||||
|
||||
async function brCancelOffer() {
|
||||
const wallet = xrpl.Wallet.fromSeed(brokerSeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '...'
|
||||
brokerResultField.value = results
|
||||
await client.connect()
|
||||
results += "\nConnected. Cancelling offer..."
|
||||
brokerResultField.value = results
|
||||
|
||||
const tokenOfferIDs = [brokerTokenBuyOfferIndexField.value]
|
||||
|
||||
// Prepare transaction -------------------------------------------------------
|
||||
const transactionBlob = {
|
||||
"TransactionType": "NFTokenCancelOffer",
|
||||
"Account": wallet.classicAddress,
|
||||
"NFTokenOffers": tokenOfferIDs
|
||||
}
|
||||
// Submit transaction --------------------------------------------------------
|
||||
const tx = await client.submitAndWait(transactionBlob,{wallet})
|
||||
|
||||
results += "\n\n***Sell Offers***\n"
|
||||
let nftSellOffers
|
||||
try {
|
||||
nftSellOffers = await client.request({
|
||||
method: "nft_sell_offers",
|
||||
nft_id: brokerTokenBuyOfferIndexField.value
|
||||
})
|
||||
} catch (err) {
|
||||
nftSellOffers = "No sell offers."
|
||||
}
|
||||
results += JSON.stringify(nftSellOffers,null,2)
|
||||
results += "\n\n***Buy Offers***\n"
|
||||
let nftBuyOffers
|
||||
try {
|
||||
nftBuyOffers = await client.request({
|
||||
method: "nft_buy_offers",
|
||||
nft_id: brokerTokenBuyOfferIndexField.value })
|
||||
} catch (err) {
|
||||
nftBuyOffers = "No buy offers."
|
||||
}
|
||||
results += JSON.stringify(nftBuyOffers,null,2)
|
||||
|
||||
// Check transaction results -------------------------------------------------
|
||||
|
||||
results += "\nTransaction result:\n" +
|
||||
JSON.stringify(tx.result.meta.TransactionResult, null, 2)
|
||||
results += "\nBalance changes:\n" +
|
||||
JSON.stringify(xrpl.getBalanceChanges(tx.result.meta), null, 2)
|
||||
brokerResultField.value = results
|
||||
client.disconnect()
|
||||
}// End of brCancelOffer()
|
||||
|
||||
// ***************************************************************************
|
||||
// ************** Revised Functions ******************************************
|
||||
// ***************************************************************************
|
||||
|
||||
// *******************************************************
|
||||
// ************* Get Account *****************************
|
||||
// *******************************************************
|
||||
|
||||
|
||||
async function getAccount(type) {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '....'
|
||||
|
||||
// This uses the default faucet for Testnet/Devnet
|
||||
let faucetHost = null
|
||||
|
||||
if (type == 'standby') {
|
||||
standbyResultField.value = results
|
||||
}
|
||||
if (type == 'operational') {
|
||||
operationalResultField.value = results
|
||||
}
|
||||
if (type == 'broker') {
|
||||
brokerResultField.value = results
|
||||
}
|
||||
await client.connect()
|
||||
|
||||
results += '\nConnected, funding wallet.'
|
||||
if (type == 'standby') {
|
||||
standbyResultField.value = results
|
||||
}
|
||||
if (type == 'operational') {
|
||||
operationalResultField.value = results
|
||||
}
|
||||
if (type == 'broker') {
|
||||
brokerResultField.value = results
|
||||
}
|
||||
|
||||
// -----------------------------------Create and fund a test account wallet
|
||||
const my_wallet = (await client.fundWallet(null, { faucetHost })).wallet
|
||||
|
||||
results += '\nGot a wallet.'
|
||||
if (type == 'standby') {
|
||||
standbyResultField.value = results
|
||||
}
|
||||
if (type == 'operational') {
|
||||
operationalResultField.value = results
|
||||
}
|
||||
if (type == 'broker') {
|
||||
brokerResultField.value = results
|
||||
}
|
||||
|
||||
// -----------------------------------Get the current balance.
|
||||
const my_balance = (await client.getXrpBalance(my_wallet.address))
|
||||
|
||||
if (type == 'standby') {
|
||||
standbyAccountField.value = my_wallet.address
|
||||
standbyPubKeyField.value = my_wallet.publicKey
|
||||
standbyPrivKeyField.value = my_wallet.privateKey
|
||||
standbyBalanceField.value = (await client.getXrpBalance(my_wallet.address))
|
||||
standbySeedField.value = my_wallet.seed
|
||||
results += '\nStandby account created.'
|
||||
standbyResultField.value = results
|
||||
}
|
||||
if (type == 'operational') {
|
||||
operationalAccountField.value = my_wallet.address
|
||||
operationalPubKeyField.value = my_wallet.publicKey
|
||||
operationalPrivKeyField.value = my_wallet.privateKey
|
||||
operationalSeedField.value = my_wallet.seed
|
||||
operationalBalanceField.value = (await client.getXrpBalance(my_wallet.address))
|
||||
results += '\nOperational account created.'
|
||||
operationalResultField.value = results
|
||||
}
|
||||
if (type == 'broker') {
|
||||
brokerAccountField.value = my_wallet.address
|
||||
brokerPubKeyField.value = my_wallet.publicKey
|
||||
brokerPrivKeyField.value = my_wallet.privateKey
|
||||
brokerSeedField.value = my_wallet.seed
|
||||
brokerBalanceField.value = (await client.getXrpBalance(my_wallet.address))
|
||||
results += '\nBroker account created.'
|
||||
brokerResultField.value = results
|
||||
}
|
||||
// --------------- Capture the seeds for accounts for ease of reload.
|
||||
seeds.value = standbySeedField.value + '\n' + operationalSeedField.value + "\n" +
|
||||
brokerSeedField.value
|
||||
client.disconnect()
|
||||
} // End of getAccount()
|
||||
|
||||
// *******************************************************
|
||||
// ********** Get Accounts from Seeds ********************
|
||||
// *******************************************************
|
||||
|
||||
async function getAccountsFromSeeds() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected, finding wallets.\n'
|
||||
standbyResultField.value = results
|
||||
|
||||
// -----------------------------------Find the test account wallets
|
||||
var lines = seeds.value.split('\n');
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(lines[0])
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(lines[1])
|
||||
const broker_wallet = xrpl.Wallet.fromSeed(lines[2])
|
||||
|
||||
// -----------------------------------Get the current balance.
|
||||
const standby_balance = (await client.getXrpBalance(standby_wallet.address))
|
||||
const operational_balance = (await client.getXrpBalance(operational_wallet.address))
|
||||
const broker_balance = (await client.getXrpBalance(broker_wallet.address))
|
||||
|
||||
standbyAccountField.value = standby_wallet.address
|
||||
standbyPubKeyField.value = standby_wallet.publicKey
|
||||
standbyPrivKeyField.value = standby_wallet.privateKey
|
||||
standbySeedField.value = standby_wallet.seed
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
|
||||
operationalAccountField.value = operational_wallet.address
|
||||
operationalPubKeyField.value = operational_wallet.publicKey
|
||||
operationalPrivKeyField.value = operational_wallet.privateKey
|
||||
operationalSeedField.value = operational_wallet.seed
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
|
||||
brokerAccountField.value = broker_wallet.address
|
||||
brokerPubKeyField.value = broker_wallet.publicKey
|
||||
brokerPrivKeyField.value = broker_wallet.privateKey
|
||||
brokerSeedField.value = broker_wallet.seed
|
||||
brokerBalanceField.value = (await client.getXrpBalance(broker_wallet.address))
|
||||
|
||||
client.disconnect()
|
||||
getBalances()
|
||||
} // End of getAccountsFromSeeds()
|
||||
|
||||
// *******************************************************
|
||||
// ****************** Get Balances ***********************
|
||||
// *******************************************************
|
||||
|
||||
async function getBalances() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
|
||||
await client.connect()
|
||||
|
||||
results += '\nConnected.'
|
||||
standbyResultField.value = results
|
||||
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const broker_wallet = xrpl.Wallet.fromSeed(brokerSeedField.value)
|
||||
|
||||
results = "\nGetting standby account balances...\n"
|
||||
const standby_balances = await client.request({
|
||||
command: "gateway_balances",
|
||||
account: standby_wallet.address,
|
||||
ledger_index: "validated",
|
||||
hotwallet: [operational_wallet.address]
|
||||
})
|
||||
results += JSON.stringify(standby_balances.result, null, 2)
|
||||
standbyResultField.value = results
|
||||
|
||||
results= "\nGetting operational account balances...\n"
|
||||
const operational_balances = await client.request({
|
||||
command: "account_lines",
|
||||
account: operational_wallet.address,
|
||||
ledger_index: "validated"
|
||||
})
|
||||
results += JSON.stringify(operational_balances.result, null, 2)
|
||||
operationalResultField.value = results
|
||||
|
||||
results= "\nGetting broker account balances...\n"
|
||||
const broker_balances = await client.request({
|
||||
command: "account_lines",
|
||||
account: broker_wallet.address,
|
||||
ledger_index: "validated"
|
||||
})
|
||||
results += JSON.stringify(broker_balances.result, null, 2)
|
||||
brokerResultField.value = results
|
||||
|
||||
operationalBalanceField.value = (await client.getXrpBalance(operational_wallet.address))
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
brokerBalanceField.value = (await client.getXrpBalance(broker_wallet.address))
|
||||
|
||||
client.disconnect()
|
||||
} // End of getBalances()
|
||||
@@ -0,0 +1,163 @@
|
||||
// *******************************************************
|
||||
// **************** Set Minter *************************
|
||||
// *******************************************************
|
||||
|
||||
async function setMinter() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected, finding wallet.'
|
||||
standbyResultField.value = results
|
||||
my_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
standbyResultField.value = results
|
||||
|
||||
tx_json = {
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": my_wallet.address,
|
||||
"NFTokenMinter": standbyMinterField.value,
|
||||
"SetFlag": xrpl.AccountSetAsfFlags.asfAuthorizedNFTokenMinter
|
||||
}
|
||||
results += '\nSet Minter.'
|
||||
standbyResultField.value = results
|
||||
|
||||
const prepared = await client.autofill(tx_json)
|
||||
const signed = my_wallet.sign(prepared)
|
||||
const result = await client.submitAndWait(signed.tx_blob)
|
||||
if (result.result.meta.TransactionResult == "tesSUCCESS") {
|
||||
results += '\nAccount setting succeeded.\n'
|
||||
results += JSON.stringify(result,null,2)
|
||||
standbyResultField.value = results
|
||||
} else {
|
||||
throw 'Error sending transaction: ${result}'
|
||||
results += '\nAccount setting failed.'
|
||||
standbyResultField.value = results
|
||||
}
|
||||
client.disconnect()
|
||||
} // End of configureAccount()
|
||||
|
||||
// *******************************************************
|
||||
// **************** Mint Other *************************
|
||||
// *******************************************************
|
||||
|
||||
async function mintOther() {
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
standbyResultField.value = results
|
||||
let net = getNet()
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
const client = new xrpl.Client(net)
|
||||
await client.connect()
|
||||
results += '\nConnected. Minting NFT.'
|
||||
standbyResultField.value = results
|
||||
|
||||
// This version adds the "Issuer" field.
|
||||
// ------------------------------------------------------------------------
|
||||
const tx_json = {
|
||||
"TransactionType": "NFTokenMint",
|
||||
"Account": standby_wallet.classicAddress,
|
||||
"URI": xrpl.convertStringToHex(standbyTokenUrlField.value),
|
||||
"Flags": parseInt(standbyFlagsField.value),
|
||||
"TransferFee": parseInt(standbyTransferFeeField.value),
|
||||
"Issuer": standbyIssuerField.value,
|
||||
"NFTokenTaxon": 0 //Required, but if you have no use for it, set to zero.
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- Submit transaction
|
||||
const tx = await client.submitAndWait(tx_json, { wallet: standby_wallet} )
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: standby_wallet.classicAddress
|
||||
})
|
||||
|
||||
// ------------------------------------------------------- Report results
|
||||
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
|
||||
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
|
||||
standbyResultField.value = results + (await
|
||||
client.getXrpBalance(standby_wallet.address))
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
} //End of mintToken()
|
||||
|
||||
// *******************************************************
|
||||
// **************** Set Operational Minter **************
|
||||
// ********************************************************
|
||||
|
||||
async function oPsetMinter() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
operationalResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected, finding wallet.'
|
||||
operationalResultField.value = results
|
||||
my_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
operationalResultField.value = results
|
||||
|
||||
tx_json = {
|
||||
"TransactionType": "AccountSet",
|
||||
"Account": my_wallet.address,
|
||||
"NFTokenMinter": operationalMinterField.value,
|
||||
"SetFlag": xrpl.AccountSetAsfFlags.asfAuthorizedNFTokenMinter
|
||||
}
|
||||
results += '\nSet Minter.'
|
||||
operationalResultField.value = results
|
||||
|
||||
const prepared = await client.autofill(tx_json)
|
||||
const signed = my_wallet.sign(prepared)
|
||||
const result = await client.submitAndWait(signed.tx_blob)
|
||||
if (result.result.meta.TransactionResult == "tesSUCCESS") {
|
||||
results += '\nAccount setting succeeded.\n'
|
||||
results += JSON.stringify(result,null,2)
|
||||
operationalResultField.value = results
|
||||
} else {
|
||||
throw 'Error sending transaction: ${result}'
|
||||
results += '\nAccount setting failed.'
|
||||
operationalResultField.value = results
|
||||
}
|
||||
|
||||
client.disconnect()
|
||||
} // End of oPsetMinter()
|
||||
|
||||
|
||||
// *******************************************************
|
||||
// ************** Operational Mint Other *****************
|
||||
// *******************************************************
|
||||
|
||||
async function oPmintOther() {
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
operationalResultField.value = results
|
||||
let net = getNet()
|
||||
const operational_wallet = xrpl.Wallet.fromSeed(operationalSeedField.value)
|
||||
const client = new xrpl.Client(net)
|
||||
await client.connect()
|
||||
results += '\nConnected. Minting NFT.'
|
||||
operationalResultField.value = results
|
||||
|
||||
// This version adds the "Issuer" field.
|
||||
// ------------------------------------------------------------------------
|
||||
const tx_json = {
|
||||
"TransactionType": 'NFTokenMint',
|
||||
"Account": operational_wallet.classicAddress,
|
||||
"URI": xrpl.convertStringToHex(operationalTokenUrlField.value),
|
||||
"Flags": parseInt(operationalFlagsField.value),
|
||||
"Issuer": operationalIssuerField.value,
|
||||
"TransferFee": parseInt(operationalTransferFeeField.value),
|
||||
"NFTokenTaxon": 0 //Required, but if you have no use for it, set to zero.
|
||||
}
|
||||
|
||||
// ----------------------------------------------------- Submit signed blob
|
||||
const tx = await client.submitAndWait(tx_json, { wallet: operational_wallet} )
|
||||
const nfts = await client.request({
|
||||
method: "account_nfts",
|
||||
account: operational_wallet.classicAddress
|
||||
})
|
||||
|
||||
// ------------------------------------------------------- Report results
|
||||
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
|
||||
results += '\n\nnfts: ' + JSON.stringify(nfts, null, 2)
|
||||
results += await client.getXrpBalance(operational_wallet.address)
|
||||
operationalResultField.value = results
|
||||
client.disconnect()
|
||||
} //End of oPmintToken
|
||||
|
||||
@@ -6,25 +6,24 @@ async function getAccountFromSeed() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected, finding wallets.\n'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
|
||||
// -------------------------------------------- Find the test account wallet.
|
||||
var theSeed = document.getElementById('seeds').value
|
||||
var theSeed = seeds.value
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(theSeed)
|
||||
|
||||
// ------------------------------------------------- Get the current balance.
|
||||
const standby_balance = (await client.getXrpBalance(standby_wallet.address))
|
||||
|
||||
// --------------------------------- Populate the fields for Standby account.
|
||||
document.getElementById('standbyAccountField').value = standby_wallet.address
|
||||
document.getElementById('standbyPubKeyField').value = standby_wallet.publicKey
|
||||
document.getElementById('standbyPrivKeyField').value = standby_wallet.privateKey
|
||||
document.getElementById('standbySeedField').value = standby_wallet.seed
|
||||
document.getElementById('standbyBalanceField').value =
|
||||
(await client.getXrpBalance(standby_wallet.address))
|
||||
standbyAccountField.value = standby_wallet.address
|
||||
standbyPubKeyField.value = standby_wallet.publicKey
|
||||
standbyPrivKeyField.value = standby_wallet.privateKey
|
||||
standbySeedField.value = standby_wallet.seed
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
|
||||
client.disconnect()
|
||||
|
||||
@@ -34,15 +33,15 @@ async function getAccountFromSeed() {
|
||||
// **************** Get Batch Tokens *********************
|
||||
// *******************************************************
|
||||
|
||||
async function getBatchNFTokens() {
|
||||
async function getBatchNFTs() {
|
||||
const standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + net + '...'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected. Getting NFTokens...'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
results += '\nConnected. Getting NFTs...'
|
||||
standbyResultField.value = results
|
||||
|
||||
results += "\n\nNFTs:\n"
|
||||
let nfts = await client.request({
|
||||
@@ -62,7 +61,7 @@ async function getBatchNFTokens() {
|
||||
})
|
||||
results += '\n' + JSON.stringify(nfts,null,2)
|
||||
}
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
} //End of getBatchTokens()
|
||||
|
||||
@@ -77,12 +76,12 @@ async function batchMint() {
|
||||
let net = getNet()
|
||||
const client = new xrpl.Client(net)
|
||||
results = 'Connecting to ' + getNet() + '....'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
await client.connect()
|
||||
results += '\nConnected, finding wallet.'
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
standby_wallet = xrpl.Wallet.fromSeed(standbySeedField.value)
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
|
||||
//----------------- Get account information, particularly the Sequence number.
|
||||
|
||||
@@ -93,15 +92,15 @@ async function batchMint() {
|
||||
|
||||
my_sequence = account_info.result.account_data.Sequence
|
||||
results += "\n\nSequence Number: " + my_sequence + "\n\n"
|
||||
document.getElementById('standbyResultField').value = results
|
||||
standbyResultField.value = results
|
||||
|
||||
// ###################################
|
||||
// Create ticket numbers for the batch
|
||||
|
||||
// Without tickets, if one transaction fails, all others in the batch fail.
|
||||
// With tickets, there can be failures, but the rest will continue, and you
|
||||
// can investigate any problems afterward.
|
||||
/* ###################################
|
||||
Create ticket numbers for the batch
|
||||
|
||||
Without tickets, if one transaction fails, all others in the batch fail.
|
||||
With tickets, there can be failures, but the rest will continue, and you
|
||||
can investigate any problems afterward.
|
||||
*/
|
||||
|
||||
//---------------------- Parse the requested number from NFTokenCountField.
|
||||
const nftokenCount = parseInt(standbyNFTokenCountField.value)
|
||||
@@ -134,11 +133,11 @@ async function batchMint() {
|
||||
}
|
||||
|
||||
//-------------------------------------------------------- Report progress.
|
||||
results += "Tickets generated, minting NFTokens.\n\n"
|
||||
document.getElementById('standbyResultField').value = results
|
||||
results += "Tickets generated, minting NFTs.\n\n"
|
||||
standbyResultField.value = results
|
||||
|
||||
// ###################################
|
||||
// Mint NFTokens
|
||||
// Mint NFTs
|
||||
|
||||
for (let i=0; i < nftokenCount; i++) {
|
||||
const transactionBlob = {
|
||||
@@ -176,11 +175,8 @@ async function batchMint() {
|
||||
}
|
||||
|
||||
results += '\n\nTransaction result: '+ tx.result.meta.TransactionResult
|
||||
results += '\n\nnftokens: ' + JSON.stringify(nfts, null, 2)
|
||||
document.getElementById('standbyBalanceField').value =
|
||||
(await client.getXrpBalance(standby_wallet.address))
|
||||
document.getElementById('standbyResultField').value = results
|
||||
results += '\n\nNFTs: ' + JSON.stringify(nfts, null, 2)
|
||||
standbyBalanceField.value = (await client.getXrpBalance(standby_wallet.address))
|
||||
standbyResultField.value = results
|
||||
client.disconnect()
|
||||
} // End of batchMint()
|
||||
|
||||
|
||||
} // End of batchMint()
|
||||
Reference in New Issue
Block a user